@audius/sdk 15.0.1 → 15.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (689) hide show
  1. package/.turbo/turbo-build.log +8 -9
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +24 -23
  4. package/.turbo/turbo-typecheck.log +1 -1
  5. package/CHANGELOG.md +35 -0
  6. package/package.json +22 -8
  7. package/rollup.config.ts +23 -3
  8. package/src/sdk/api/chats/ChatsApi.ts +1 -1
  9. package/src/sdk/api/comments/CommentsAPI.ts +214 -13
  10. package/src/sdk/api/comments/types.ts +61 -8
  11. package/src/sdk/api/developer-apps/types.ts +2 -20
  12. package/src/sdk/api/events/EventsApi.ts +96 -4
  13. package/src/sdk/api/events/types.ts +17 -0
  14. package/src/sdk/api/generated/default/.openapi-generator/FILES +14 -0
  15. package/src/sdk/api/generated/default/apis/ChallengesApi.ts +10 -6
  16. package/src/sdk/api/generated/default/apis/CommentsApi.ts +61 -43
  17. package/src/sdk/api/generated/default/apis/DeveloperAppsApi.ts +7 -5
  18. package/src/sdk/api/generated/default/apis/EventsApi.ts +451 -9
  19. package/src/sdk/api/generated/default/apis/ExploreApi.ts +5 -3
  20. package/src/sdk/api/generated/default/apis/FanClubApi.ts +152 -0
  21. package/src/sdk/api/generated/default/apis/NotificationsApi.ts +4 -1
  22. package/src/sdk/api/generated/default/apis/PlaylistsApi.ts +151 -61
  23. package/src/sdk/api/generated/default/apis/SearchApi.ts +15 -9
  24. package/src/sdk/api/generated/default/apis/TipsApi.ts +5 -3
  25. package/src/sdk/api/generated/default/apis/TracksApi.ts +285 -144
  26. package/src/sdk/api/generated/default/apis/UsersApi.ts +386 -206
  27. package/src/sdk/api/generated/default/apis/index.ts +1 -0
  28. package/src/sdk/api/generated/default/models/AnnouncementNotificationActionData.ts +8 -0
  29. package/src/sdk/api/generated/default/models/Comment.ts +16 -0
  30. package/src/sdk/api/generated/default/models/CommentEntityType.ts +3 -1
  31. package/src/sdk/api/generated/default/models/CreateCommentRequestBody.ts +8 -0
  32. package/src/sdk/api/generated/default/models/EventFollowState.ts +75 -0
  33. package/src/sdk/api/generated/default/models/EventFollowStateResponse.ts +72 -0
  34. package/src/sdk/api/generated/default/models/FanClubTextPostNotification.ts +108 -0
  35. package/src/sdk/api/generated/default/models/FanClubTextPostNotificationAction.ts +100 -0
  36. package/src/sdk/api/generated/default/models/FanClubTextPostNotificationActionData.ts +75 -0
  37. package/src/sdk/api/generated/default/models/FanRemixContestSubmissionNotification.ts +108 -0
  38. package/src/sdk/api/generated/default/models/FanRemixContestSubmissionNotificationAction.ts +100 -0
  39. package/src/sdk/api/generated/default/models/FanRemixContestSubmissionNotificationActionData.ts +102 -0
  40. package/src/sdk/api/generated/default/models/Notification.ts +34 -1
  41. package/src/sdk/api/generated/default/models/RemixContestUpdateNotification.ts +108 -0
  42. package/src/sdk/api/generated/default/models/RemixContestUpdateNotificationAction.ts +100 -0
  43. package/src/sdk/api/generated/default/models/RemixContestUpdateNotificationActionData.ts +93 -0
  44. package/src/sdk/api/generated/default/models/RemixContestsRelated.ts +94 -0
  45. package/src/sdk/api/generated/default/models/RemixContestsResponse.ts +86 -0
  46. package/src/sdk/api/generated/default/models/ReplyComment.ts +8 -0
  47. package/src/sdk/api/generated/default/models/UserCoin.ts +15 -0
  48. package/src/sdk/api/generated/default/models/index.ts +13 -0
  49. package/src/sdk/api/generated/default/runtime.ts +2 -2
  50. package/src/sdk/api/generator/{gen.cjs → gen.js} +1 -0
  51. package/src/sdk/api/generator/templates/typescript-fetch/apis.mustache +7 -5
  52. package/src/sdk/api/generator/templates/typescript-fetch/runtime.mustache +2 -2
  53. package/src/sdk/api/playlists/PlaylistsApi.ts +5 -5
  54. package/src/sdk/api/tracks/types.ts +1 -0
  55. package/src/sdk/createSdk.ts +24 -5
  56. package/src/sdk/createSdkWithServices.ts +39 -9
  57. package/src/sdk/index.ts +1 -0
  58. package/src/sdk/middleware/addSolanaWalletSignatureMiddleware.ts +44 -0
  59. package/src/sdk/middleware/index.ts +1 -0
  60. package/src/sdk/oauth/OAuth.test.ts +110 -4
  61. package/src/sdk/oauth/OAuth.ts +51 -12
  62. package/src/sdk/oauth/TokenStoreAsyncStorage.ts +48 -4
  63. package/src/sdk/oauth/TokenStoreLocalStorage.ts +48 -1
  64. package/src/sdk/oauth/TokenStoreMemory.ts +22 -1
  65. package/src/sdk/oauth/tokenStore.test.ts +32 -3
  66. package/src/sdk/oauth/tokenStore.ts +10 -1
  67. package/src/sdk/oauth/tokenStoreAsyncStorage.test.ts +130 -0
  68. package/src/sdk/oauth/tokenStoreLocalStorage.test.ts +45 -1
  69. package/src/sdk/scripts/generateServicesConfig.ts +1 -2
  70. package/src/sdk/services/EntityManager/EntityManagerClient.ts +27 -4
  71. package/src/sdk/services/EntityManager/types.ts +8 -0
  72. package/src/sdk/services/Solana/programs/ClaimableTokensClient/ClaimableTokensClient.ts +92 -12
  73. package/src/sdk/services/Solana/programs/ClaimableTokensClient/types.ts +5 -1
  74. package/src/sdk/services/Storage/Storage.ts +12 -1
  75. package/src/sdk/solanaWallet/SolanaWallet.ts +61 -0
  76. package/src/sdk/solanaWallet/index.ts +8 -0
  77. package/src/sdk/utils/mergeConfigs.ts +55 -11
  78. package/src/sdk/utils/objectUtils.ts +30 -0
  79. package/dist/browser-15461226.js +0 -2732
  80. package/dist/browser-15461226.js.map +0 -1
  81. package/dist/index.browser.esm.js +0 -51254
  82. package/dist/index.browser.esm.js.map +0 -1
  83. package/dist/index.d.ts +0 -52
  84. package/dist/index.esm.js +0 -48732
  85. package/dist/index.esm.js.map +0 -1
  86. package/dist/index.native.d.ts +0 -15
  87. package/dist/index.native.js +0 -48803
  88. package/dist/index.native.js.map +0 -1
  89. package/dist/sdk/api/ResolveApi.d.ts +0 -24
  90. package/dist/sdk/api/albums/AlbumsApi.d.ts +0 -71
  91. package/dist/sdk/api/albums/AlbumsApi.test.d.ts +0 -1
  92. package/dist/sdk/api/albums/types.d.ts +0 -3109
  93. package/dist/sdk/api/challenges/types.d.ts +0 -26
  94. package/dist/sdk/api/chats/ChatsApi.d.ts +0 -233
  95. package/dist/sdk/api/chats/clientTypes.d.ts +0 -270
  96. package/dist/sdk/api/chats/serverTypes.d.ts +0 -199
  97. package/dist/sdk/api/comments/CommentsAPI.d.ts +0 -58
  98. package/dist/sdk/api/comments/types.d.ts +0 -118
  99. package/dist/sdk/api/dashboard-wallet-users/DashboardWalletUsersApi.d.ts +0 -19
  100. package/dist/sdk/api/dashboard-wallet-users/types.d.ts +0 -87
  101. package/dist/sdk/api/developer-apps/DeveloperAppsApi.d.ts +0 -62
  102. package/dist/sdk/api/developer-apps/types.d.ts +0 -59
  103. package/dist/sdk/api/events/EventsApi.d.ts +0 -19
  104. package/dist/sdk/api/events/types.d.ts +0 -124
  105. package/dist/sdk/api/generated/default/apis/ChallengesApi.d.ts +0 -64
  106. package/dist/sdk/api/generated/default/apis/CidDataApi.d.ts +0 -29
  107. package/dist/sdk/api/generated/default/apis/CoinsApi.d.ts +0 -220
  108. package/dist/sdk/api/generated/default/apis/CommentsApi.d.ts +0 -162
  109. package/dist/sdk/api/generated/default/apis/DashboardWalletUsersApi.d.ts +0 -29
  110. package/dist/sdk/api/generated/default/apis/DeveloperAppsApi.d.ts +0 -130
  111. package/dist/sdk/api/generated/default/apis/EventsApi.d.ts +0 -112
  112. package/dist/sdk/api/generated/default/apis/ExploreApi.d.ts +0 -43
  113. package/dist/sdk/api/generated/default/apis/NotificationsApi.d.ts +0 -94
  114. package/dist/sdk/api/generated/default/apis/PlaylistsApi.d.ts +0 -296
  115. package/dist/sdk/api/generated/default/apis/PrizesApi.d.ts +0 -50
  116. package/dist/sdk/api/generated/default/apis/ReactionsApi.d.ts +0 -30
  117. package/dist/sdk/api/generated/default/apis/ResolveApi.d.ts +0 -30
  118. package/dist/sdk/api/generated/default/apis/RewardsApi.d.ts +0 -41
  119. package/dist/sdk/api/generated/default/apis/SearchApi.d.ts +0 -157
  120. package/dist/sdk/api/generated/default/apis/TipsApi.d.ts +0 -55
  121. package/dist/sdk/api/generated/default/apis/TracksApi.d.ts +0 -846
  122. package/dist/sdk/api/generated/default/apis/TransactionsApi.d.ts +0 -71
  123. package/dist/sdk/api/generated/default/apis/UsersApi.d.ts +0 -1737
  124. package/dist/sdk/api/generated/default/apis/WalletApi.d.ts +0 -31
  125. package/dist/sdk/api/generated/default/apis/index.d.ts +0 -20
  126. package/dist/sdk/api/generated/default/index.d.ts +0 -3
  127. package/dist/sdk/api/generated/default/models/Access.d.ts +0 -36
  128. package/dist/sdk/api/generated/default/models/AccessGate.d.ts +0 -23
  129. package/dist/sdk/api/generated/default/models/AccessInfoResponse.d.ts +0 -31
  130. package/dist/sdk/api/generated/default/models/Account.d.ts +0 -51
  131. package/dist/sdk/api/generated/default/models/AccountCollection.d.ts +0 -55
  132. package/dist/sdk/api/generated/default/models/AccountCollectionUser.d.ts +0 -42
  133. package/dist/sdk/api/generated/default/models/Activity.d.ts +0 -56
  134. package/dist/sdk/api/generated/default/models/AddManagerRequestBody.d.ts +0 -30
  135. package/dist/sdk/api/generated/default/models/AlbumBacklink.d.ts +0 -42
  136. package/dist/sdk/api/generated/default/models/AlbumsResponse.d.ts +0 -74
  137. package/dist/sdk/api/generated/default/models/AnnouncementNotification.d.ts +0 -55
  138. package/dist/sdk/api/generated/default/models/AnnouncementNotificationAction.d.ts +0 -49
  139. package/dist/sdk/api/generated/default/models/AnnouncementNotificationActionData.d.ts +0 -54
  140. package/dist/sdk/api/generated/default/models/ApproveGrantRequestBody.d.ts +0 -30
  141. package/dist/sdk/api/generated/default/models/ApproveManagerRequestNotification.d.ts +0 -55
  142. package/dist/sdk/api/generated/default/models/ApproveManagerRequestNotificationAction.d.ts +0 -49
  143. package/dist/sdk/api/generated/default/models/ApproveManagerRequestNotificationActionData.d.ts +0 -42
  144. package/dist/sdk/api/generated/default/models/ArtistCoinFees.d.ts +0 -36
  145. package/dist/sdk/api/generated/default/models/ArtistLocker.d.ts +0 -48
  146. package/dist/sdk/api/generated/default/models/ArtistRemixContestEndedNotification.d.ts +0 -55
  147. package/dist/sdk/api/generated/default/models/ArtistRemixContestEndedNotificationAction.d.ts +0 -49
  148. package/dist/sdk/api/generated/default/models/ArtistRemixContestEndedNotificationActionData.d.ts +0 -30
  149. package/dist/sdk/api/generated/default/models/ArtistRemixContestEndingSoonNotification.d.ts +0 -55
  150. package/dist/sdk/api/generated/default/models/ArtistRemixContestEndingSoonNotificationAction.d.ts +0 -49
  151. package/dist/sdk/api/generated/default/models/ArtistRemixContestEndingSoonNotificationActionData.d.ts +0 -36
  152. package/dist/sdk/api/generated/default/models/ArtistRemixContestSubmissionsNotification.d.ts +0 -55
  153. package/dist/sdk/api/generated/default/models/ArtistRemixContestSubmissionsNotificationAction.d.ts +0 -49
  154. package/dist/sdk/api/generated/default/models/ArtistRemixContestSubmissionsNotificationActionData.d.ts +0 -42
  155. package/dist/sdk/api/generated/default/models/Attestation.d.ts +0 -36
  156. package/dist/sdk/api/generated/default/models/AttestationReponse.d.ts +0 -31
  157. package/dist/sdk/api/generated/default/models/AuthorizedApp.d.ts +0 -66
  158. package/dist/sdk/api/generated/default/models/AuthorizedApps.d.ts +0 -31
  159. package/dist/sdk/api/generated/default/models/BalanceHistoryDataPoint.d.ts +0 -36
  160. package/dist/sdk/api/generated/default/models/BalanceHistoryResponse.d.ts +0 -31
  161. package/dist/sdk/api/generated/default/models/BestSellingItem.d.ts +0 -56
  162. package/dist/sdk/api/generated/default/models/BestSellingResponse.d.ts +0 -81
  163. package/dist/sdk/api/generated/default/models/BlobInfo.d.ts +0 -36
  164. package/dist/sdk/api/generated/default/models/BulkSubscribersResponse.d.ts +0 -74
  165. package/dist/sdk/api/generated/default/models/ChallengeResponse.d.ts +0 -102
  166. package/dist/sdk/api/generated/default/models/ChallengeRewardNotification.d.ts +0 -55
  167. package/dist/sdk/api/generated/default/models/ChallengeRewardNotificationAction.d.ts +0 -49
  168. package/dist/sdk/api/generated/default/models/ChallengeRewardNotificationActionData.d.ts +0 -48
  169. package/dist/sdk/api/generated/default/models/CidData.d.ts +0 -42
  170. package/dist/sdk/api/generated/default/models/CidDataResponse.d.ts +0 -31
  171. package/dist/sdk/api/generated/default/models/ClaimRewardsRequestBody.d.ts +0 -42
  172. package/dist/sdk/api/generated/default/models/ClaimRewardsResponse.d.ts +0 -31
  173. package/dist/sdk/api/generated/default/models/ClaimRewardsResponseDataInner.d.ts +0 -54
  174. package/dist/sdk/api/generated/default/models/ClaimableRewardNotification.d.ts +0 -55
  175. package/dist/sdk/api/generated/default/models/ClaimableRewardNotificationAction.d.ts +0 -49
  176. package/dist/sdk/api/generated/default/models/ClaimableRewardNotificationActionData.d.ts +0 -42
  177. package/dist/sdk/api/generated/default/models/ClaimedPrize.d.ts +0 -78
  178. package/dist/sdk/api/generated/default/models/ClaimedPrizesResponse.d.ts +0 -31
  179. package/dist/sdk/api/generated/default/models/Coin.d.ts +0 -232
  180. package/dist/sdk/api/generated/default/models/CoinInsights.d.ts +0 -352
  181. package/dist/sdk/api/generated/default/models/CoinInsightsDynamicBondingCurve.d.ts +0 -72
  182. package/dist/sdk/api/generated/default/models/CoinInsightsExtensions.d.ts +0 -54
  183. package/dist/sdk/api/generated/default/models/CoinInsightsResponse.d.ts +0 -31
  184. package/dist/sdk/api/generated/default/models/CoinMember.d.ts +0 -36
  185. package/dist/sdk/api/generated/default/models/CoinMembersCountResponse.d.ts +0 -30
  186. package/dist/sdk/api/generated/default/models/CoinMembersResponse.d.ts +0 -31
  187. package/dist/sdk/api/generated/default/models/CoinResponse.d.ts +0 -31
  188. package/dist/sdk/api/generated/default/models/CoinsResponse.d.ts +0 -31
  189. package/dist/sdk/api/generated/default/models/CoinsVolumeLeadersResponse.d.ts +0 -31
  190. package/dist/sdk/api/generated/default/models/CoinsVolumeLeadersResponseDataInner.d.ts +0 -43
  191. package/dist/sdk/api/generated/default/models/Collectibles.d.ts +0 -30
  192. package/dist/sdk/api/generated/default/models/CollectiblesResponse.d.ts +0 -31
  193. package/dist/sdk/api/generated/default/models/CollectionActivityWithoutTracks.d.ts +0 -45
  194. package/dist/sdk/api/generated/default/models/CollectionLibraryResponse.d.ts +0 -74
  195. package/dist/sdk/api/generated/default/models/Comment.d.ts +0 -135
  196. package/dist/sdk/api/generated/default/models/CommentEntityType.d.ts +0 -21
  197. package/dist/sdk/api/generated/default/models/CommentMention.d.ts +0 -36
  198. package/dist/sdk/api/generated/default/models/CommentMentionNotification.d.ts +0 -55
  199. package/dist/sdk/api/generated/default/models/CommentMentionNotificationAction.d.ts +0 -49
  200. package/dist/sdk/api/generated/default/models/CommentMentionNotificationActionData.d.ts +0 -63
  201. package/dist/sdk/api/generated/default/models/CommentNotification.d.ts +0 -55
  202. package/dist/sdk/api/generated/default/models/CommentNotificationAction.d.ts +0 -49
  203. package/dist/sdk/api/generated/default/models/CommentNotificationActionData.d.ts +0 -57
  204. package/dist/sdk/api/generated/default/models/CommentNotificationSetting.d.ts +0 -30
  205. package/dist/sdk/api/generated/default/models/CommentReactionNotification.d.ts +0 -55
  206. package/dist/sdk/api/generated/default/models/CommentReactionNotificationAction.d.ts +0 -49
  207. package/dist/sdk/api/generated/default/models/CommentReactionNotificationActionData.d.ts +0 -63
  208. package/dist/sdk/api/generated/default/models/CommentRepliesResponse.d.ts +0 -81
  209. package/dist/sdk/api/generated/default/models/CommentResponse.d.ts +0 -31
  210. package/dist/sdk/api/generated/default/models/CommentThreadNotification.d.ts +0 -55
  211. package/dist/sdk/api/generated/default/models/CommentThreadNotificationAction.d.ts +0 -49
  212. package/dist/sdk/api/generated/default/models/CommentThreadNotificationActionData.d.ts +0 -63
  213. package/dist/sdk/api/generated/default/models/ConnectedWallets.d.ts +0 -36
  214. package/dist/sdk/api/generated/default/models/ConnectedWalletsResponse.d.ts +0 -31
  215. package/dist/sdk/api/generated/default/models/CosignNotification.d.ts +0 -55
  216. package/dist/sdk/api/generated/default/models/CosignNotificationAction.d.ts +0 -49
  217. package/dist/sdk/api/generated/default/models/CosignNotificationActionData.d.ts +0 -42
  218. package/dist/sdk/api/generated/default/models/CoverArt.d.ts +0 -48
  219. package/dist/sdk/api/generated/default/models/CoverPhoto.d.ts +0 -42
  220. package/dist/sdk/api/generated/default/models/CreateAccessKeyResponse.d.ts +0 -30
  221. package/dist/sdk/api/generated/default/models/CreateCoinRequest.d.ts +0 -90
  222. package/dist/sdk/api/generated/default/models/CreateCoinResponse.d.ts +0 -31
  223. package/dist/sdk/api/generated/default/models/CreateCoinResponseData.d.ts +0 -102
  224. package/dist/sdk/api/generated/default/models/CreateCommentRequestBody.d.ts +0 -67
  225. package/dist/sdk/api/generated/default/models/CreateCommentResponse.d.ts +0 -48
  226. package/dist/sdk/api/generated/default/models/CreateDeveloperAppRequestBody.d.ts +0 -48
  227. package/dist/sdk/api/generated/default/models/CreateDeveloperAppResponse.d.ts +0 -60
  228. package/dist/sdk/api/generated/default/models/CreateGrantRequestBody.d.ts +0 -30
  229. package/dist/sdk/api/generated/default/models/CreateNotification.d.ts +0 -55
  230. package/dist/sdk/api/generated/default/models/CreateNotificationAction.d.ts +0 -49
  231. package/dist/sdk/api/generated/default/models/CreateNotificationActionData.d.ts +0 -21
  232. package/dist/sdk/api/generated/default/models/CreatePlaylistNotificationActionData.d.ts +0 -36
  233. package/dist/sdk/api/generated/default/models/CreatePlaylistRequestBody.d.ts +0 -171
  234. package/dist/sdk/api/generated/default/models/CreatePlaylistRequestBodyCopyrightLine.d.ts +0 -36
  235. package/dist/sdk/api/generated/default/models/CreatePlaylistRequestBodyProducerCopyrightLine.d.ts +0 -36
  236. package/dist/sdk/api/generated/default/models/CreatePlaylistResponse.d.ts +0 -48
  237. package/dist/sdk/api/generated/default/models/CreateRewardCodeRequest.d.ts +0 -42
  238. package/dist/sdk/api/generated/default/models/CreateRewardCodeResponse.d.ts +0 -48
  239. package/dist/sdk/api/generated/default/models/CreateTrackNotificationActionData.d.ts +0 -30
  240. package/dist/sdk/api/generated/default/models/CreateTrackRequestBody.d.ts +0 -292
  241. package/dist/sdk/api/generated/default/models/CreateTrackResponse.d.ts +0 -48
  242. package/dist/sdk/api/generated/default/models/CreateUserRequestBody.d.ts +0 -153
  243. package/dist/sdk/api/generated/default/models/CreateUserResponse.d.ts +0 -48
  244. package/dist/sdk/api/generated/default/models/DashboardWalletUser.d.ts +0 -37
  245. package/dist/sdk/api/generated/default/models/DashboardWalletUsersResponse.d.ts +0 -31
  246. package/dist/sdk/api/generated/default/models/DataAndType.d.ts +0 -37
  247. package/dist/sdk/api/generated/default/models/DdexCopyright.d.ts +0 -36
  248. package/dist/sdk/api/generated/default/models/DdexResourceContributor.d.ts +0 -42
  249. package/dist/sdk/api/generated/default/models/DdexRightsController.d.ts +0 -42
  250. package/dist/sdk/api/generated/default/models/DeactivateAccessKeyRequestBody.d.ts +0 -30
  251. package/dist/sdk/api/generated/default/models/DeactivateAccessKeyResponse.d.ts +0 -30
  252. package/dist/sdk/api/generated/default/models/DecodedUserToken.d.ts +0 -79
  253. package/dist/sdk/api/generated/default/models/DeveloperApp.d.ts +0 -60
  254. package/dist/sdk/api/generated/default/models/DeveloperAppResponse.d.ts +0 -31
  255. package/dist/sdk/api/generated/default/models/DeveloperAppsResponse.d.ts +0 -31
  256. package/dist/sdk/api/generated/default/models/DynamicBondingCurveInsights.d.ts +0 -72
  257. package/dist/sdk/api/generated/default/models/EmailAccess.d.ts +0 -72
  258. package/dist/sdk/api/generated/default/models/EmailAccessResponse.d.ts +0 -31
  259. package/dist/sdk/api/generated/default/models/Event.d.ts +0 -102
  260. package/dist/sdk/api/generated/default/models/EventsResponse.d.ts +0 -31
  261. package/dist/sdk/api/generated/default/models/ExtendedAccessGate.d.ts +0 -23
  262. package/dist/sdk/api/generated/default/models/ExtendedPaymentSplit.d.ts +0 -54
  263. package/dist/sdk/api/generated/default/models/ExtendedPurchaseGate.d.ts +0 -31
  264. package/dist/sdk/api/generated/default/models/ExtendedTokenGate.d.ts +0 -36
  265. package/dist/sdk/api/generated/default/models/ExtendedUsdcGate.d.ts +0 -37
  266. package/dist/sdk/api/generated/default/models/FanRemixContestEndedNotification.d.ts +0 -55
  267. package/dist/sdk/api/generated/default/models/FanRemixContestEndedNotificationAction.d.ts +0 -49
  268. package/dist/sdk/api/generated/default/models/FanRemixContestEndedNotificationActionData.d.ts +0 -36
  269. package/dist/sdk/api/generated/default/models/FanRemixContestEndingSoonNotification.d.ts +0 -55
  270. package/dist/sdk/api/generated/default/models/FanRemixContestEndingSoonNotificationAction.d.ts +0 -49
  271. package/dist/sdk/api/generated/default/models/FanRemixContestEndingSoonNotificationActionData.d.ts +0 -36
  272. package/dist/sdk/api/generated/default/models/FanRemixContestStartedNotification.d.ts +0 -55
  273. package/dist/sdk/api/generated/default/models/FanRemixContestStartedNotificationAction.d.ts +0 -49
  274. package/dist/sdk/api/generated/default/models/FanRemixContestStartedNotificationActionData.d.ts +0 -36
  275. package/dist/sdk/api/generated/default/models/FanRemixContestWinnersSelectedNotification.d.ts +0 -55
  276. package/dist/sdk/api/generated/default/models/FanRemixContestWinnersSelectedNotificationAction.d.ts +0 -49
  277. package/dist/sdk/api/generated/default/models/FanRemixContestWinnersSelectedNotificationActionData.d.ts +0 -36
  278. package/dist/sdk/api/generated/default/models/Favorite.d.ts +0 -48
  279. package/dist/sdk/api/generated/default/models/FavoriteRequestBody.d.ts +0 -30
  280. package/dist/sdk/api/generated/default/models/FavoritesResponse.d.ts +0 -31
  281. package/dist/sdk/api/generated/default/models/FieldVisibility.d.ts +0 -60
  282. package/dist/sdk/api/generated/default/models/FollowGate.d.ts +0 -30
  283. package/dist/sdk/api/generated/default/models/FollowNotification.d.ts +0 -55
  284. package/dist/sdk/api/generated/default/models/FollowNotificationAction.d.ts +0 -49
  285. package/dist/sdk/api/generated/default/models/FollowNotificationActionData.d.ts +0 -36
  286. package/dist/sdk/api/generated/default/models/FollowersResponse.d.ts +0 -74
  287. package/dist/sdk/api/generated/default/models/FollowingResponse.d.ts +0 -74
  288. package/dist/sdk/api/generated/default/models/Genre.d.ts +0 -71
  289. package/dist/sdk/api/generated/default/models/GetChallenges.d.ts +0 -31
  290. package/dist/sdk/api/generated/default/models/GetSupportedUsers.d.ts +0 -74
  291. package/dist/sdk/api/generated/default/models/GetSupporter.d.ts +0 -74
  292. package/dist/sdk/api/generated/default/models/GetSupporters.d.ts +0 -74
  293. package/dist/sdk/api/generated/default/models/GetSupporting.d.ts +0 -74
  294. package/dist/sdk/api/generated/default/models/GetTipsResponse.d.ts +0 -74
  295. package/dist/sdk/api/generated/default/models/Grant.d.ts +0 -60
  296. package/dist/sdk/api/generated/default/models/HistoryResponse.d.ts +0 -74
  297. package/dist/sdk/api/generated/default/models/ListenCount.d.ts +0 -42
  298. package/dist/sdk/api/generated/default/models/ListenStreakReminderNotification.d.ts +0 -55
  299. package/dist/sdk/api/generated/default/models/ListenStreakReminderNotificationAction.d.ts +0 -49
  300. package/dist/sdk/api/generated/default/models/ListenStreakReminderNotificationActionData.d.ts +0 -30
  301. package/dist/sdk/api/generated/default/models/ManagedUser.d.ts +0 -38
  302. package/dist/sdk/api/generated/default/models/ManagedUsersResponse.d.ts +0 -31
  303. package/dist/sdk/api/generated/default/models/ManagersResponse.d.ts +0 -31
  304. package/dist/sdk/api/generated/default/models/MilestoneNotification.d.ts +0 -55
  305. package/dist/sdk/api/generated/default/models/MilestoneNotificationAction.d.ts +0 -49
  306. package/dist/sdk/api/generated/default/models/MilestoneNotificationActionData.d.ts +0 -22
  307. package/dist/sdk/api/generated/default/models/MonthlyAggregatePlay.d.ts +0 -43
  308. package/dist/sdk/api/generated/default/models/Mood.d.ts +0 -43
  309. package/dist/sdk/api/generated/default/models/MutualFollowersResponse.d.ts +0 -74
  310. package/dist/sdk/api/generated/default/models/NftCollection.d.ts +0 -76
  311. package/dist/sdk/api/generated/default/models/NftGate.d.ts +0 -31
  312. package/dist/sdk/api/generated/default/models/Notification.d.ts +0 -141
  313. package/dist/sdk/api/generated/default/models/Notifications.d.ts +0 -37
  314. package/dist/sdk/api/generated/default/models/NotificationsResponse.d.ts +0 -74
  315. package/dist/sdk/api/generated/default/models/PaymentSplit.d.ts +0 -36
  316. package/dist/sdk/api/generated/default/models/PinCommentRequestBody.d.ts +0 -37
  317. package/dist/sdk/api/generated/default/models/Playlist.d.ts +0 -272
  318. package/dist/sdk/api/generated/default/models/PlaylistAddedTimestamp.d.ts +0 -42
  319. package/dist/sdk/api/generated/default/models/PlaylistArtwork.d.ts +0 -48
  320. package/dist/sdk/api/generated/default/models/PlaylistFeedItem.d.ts +0 -37
  321. package/dist/sdk/api/generated/default/models/PlaylistLibrary.d.ts +0 -30
  322. package/dist/sdk/api/generated/default/models/PlaylistLibraryExplorePlaylistIdentifier.d.ts +0 -43
  323. package/dist/sdk/api/generated/default/models/PlaylistLibraryFolder.d.ts +0 -56
  324. package/dist/sdk/api/generated/default/models/PlaylistLibraryPlaylistIdentifier.d.ts +0 -43
  325. package/dist/sdk/api/generated/default/models/PlaylistMilestoneNotificationActionData.d.ts +0 -48
  326. package/dist/sdk/api/generated/default/models/PlaylistResponse.d.ts +0 -74
  327. package/dist/sdk/api/generated/default/models/PlaylistSearchResult.d.ts +0 -31
  328. package/dist/sdk/api/generated/default/models/PlaylistTracksResponse.d.ts +0 -74
  329. package/dist/sdk/api/generated/default/models/PlaylistUpdate.d.ts +0 -42
  330. package/dist/sdk/api/generated/default/models/PlaylistUpdates.d.ts +0 -31
  331. package/dist/sdk/api/generated/default/models/PlaylistUpdatesResponse.d.ts +0 -74
  332. package/dist/sdk/api/generated/default/models/PlaylistWithoutTracks.d.ts +0 -272
  333. package/dist/sdk/api/generated/default/models/PlaylistsResponse.d.ts +0 -74
  334. package/dist/sdk/api/generated/default/models/PrizeClaimRequestBody.d.ts +0 -36
  335. package/dist/sdk/api/generated/default/models/PrizeClaimResponse.d.ts +0 -56
  336. package/dist/sdk/api/generated/default/models/PrizePublic.d.ts +0 -56
  337. package/dist/sdk/api/generated/default/models/PrizesResponse.d.ts +0 -31
  338. package/dist/sdk/api/generated/default/models/ProfilePicture.d.ts +0 -48
  339. package/dist/sdk/api/generated/default/models/Purchase.d.ts +0 -97
  340. package/dist/sdk/api/generated/default/models/PurchaseGate.d.ts +0 -31
  341. package/dist/sdk/api/generated/default/models/PurchaseSplit.d.ts +0 -42
  342. package/dist/sdk/api/generated/default/models/PurchasersCountResponse.d.ts +0 -73
  343. package/dist/sdk/api/generated/default/models/PurchasersResponse.d.ts +0 -74
  344. package/dist/sdk/api/generated/default/models/PurchasesCountResponse.d.ts +0 -73
  345. package/dist/sdk/api/generated/default/models/PurchasesResponse.d.ts +0 -74
  346. package/dist/sdk/api/generated/default/models/ReactCommentRequestBody.d.ts +0 -37
  347. package/dist/sdk/api/generated/default/models/Reaction.d.ts +0 -48
  348. package/dist/sdk/api/generated/default/models/ReactionNotification.d.ts +0 -55
  349. package/dist/sdk/api/generated/default/models/ReactionNotificationAction.d.ts +0 -49
  350. package/dist/sdk/api/generated/default/models/ReactionNotificationActionData.d.ts +0 -66
  351. package/dist/sdk/api/generated/default/models/Reactions.d.ts +0 -31
  352. package/dist/sdk/api/generated/default/models/ReceiveTipNotification.d.ts +0 -55
  353. package/dist/sdk/api/generated/default/models/ReceiveTipNotificationAction.d.ts +0 -49
  354. package/dist/sdk/api/generated/default/models/ReceiveTipNotificationActionData.d.ts +0 -54
  355. package/dist/sdk/api/generated/default/models/RedeemAmountResponse.d.ts +0 -30
  356. package/dist/sdk/api/generated/default/models/RegisterApiKeyRequestBody.d.ts +0 -30
  357. package/dist/sdk/api/generated/default/models/RegisterApiKeyResponse.d.ts +0 -30
  358. package/dist/sdk/api/generated/default/models/Related.d.ts +0 -45
  359. package/dist/sdk/api/generated/default/models/RelatedArtistResponse.d.ts +0 -74
  360. package/dist/sdk/api/generated/default/models/Remix.d.ts +0 -49
  361. package/dist/sdk/api/generated/default/models/RemixNotification.d.ts +0 -55
  362. package/dist/sdk/api/generated/default/models/RemixNotificationAction.d.ts +0 -49
  363. package/dist/sdk/api/generated/default/models/RemixNotificationActionData.d.ts +0 -36
  364. package/dist/sdk/api/generated/default/models/RemixParent.d.ts +0 -31
  365. package/dist/sdk/api/generated/default/models/RemixParentWrite.d.ts +0 -31
  366. package/dist/sdk/api/generated/default/models/RemixablesResponse.d.ts +0 -74
  367. package/dist/sdk/api/generated/default/models/RemixedTrackAggregate.d.ts +0 -42
  368. package/dist/sdk/api/generated/default/models/RemixersCountResponse.d.ts +0 -73
  369. package/dist/sdk/api/generated/default/models/RemixersResponse.d.ts +0 -74
  370. package/dist/sdk/api/generated/default/models/RemixesResponse.d.ts +0 -31
  371. package/dist/sdk/api/generated/default/models/RemixesResponseData.d.ts +0 -37
  372. package/dist/sdk/api/generated/default/models/RemixingResponse.d.ts +0 -74
  373. package/dist/sdk/api/generated/default/models/ReplyComment.d.ts +0 -110
  374. package/dist/sdk/api/generated/default/models/Repost.d.ts +0 -42
  375. package/dist/sdk/api/generated/default/models/RepostNotification.d.ts +0 -55
  376. package/dist/sdk/api/generated/default/models/RepostNotificationAction.d.ts +0 -49
  377. package/dist/sdk/api/generated/default/models/RepostNotificationActionData.d.ts +0 -51
  378. package/dist/sdk/api/generated/default/models/RepostOfRepostNotification.d.ts +0 -55
  379. package/dist/sdk/api/generated/default/models/RepostOfRepostNotificationAction.d.ts +0 -49
  380. package/dist/sdk/api/generated/default/models/RepostOfRepostNotificationActionData.d.ts +0 -51
  381. package/dist/sdk/api/generated/default/models/RepostRequestBody.d.ts +0 -30
  382. package/dist/sdk/api/generated/default/models/Reposts.d.ts +0 -74
  383. package/dist/sdk/api/generated/default/models/RequestManagerNotification.d.ts +0 -55
  384. package/dist/sdk/api/generated/default/models/RequestManagerNotificationAction.d.ts +0 -49
  385. package/dist/sdk/api/generated/default/models/RequestManagerNotificationActionData.d.ts +0 -42
  386. package/dist/sdk/api/generated/default/models/RewardCodeErrorResponse.d.ts +0 -38
  387. package/dist/sdk/api/generated/default/models/RewardCodeResponse.d.ts +0 -36
  388. package/dist/sdk/api/generated/default/models/RewardPool.d.ts +0 -36
  389. package/dist/sdk/api/generated/default/models/SaleJson.d.ts +0 -108
  390. package/dist/sdk/api/generated/default/models/SalesAggregate.d.ts +0 -42
  391. package/dist/sdk/api/generated/default/models/SalesAggregateResponse.d.ts +0 -31
  392. package/dist/sdk/api/generated/default/models/SalesJsonContent.d.ts +0 -31
  393. package/dist/sdk/api/generated/default/models/SalesJsonResponse.d.ts +0 -31
  394. package/dist/sdk/api/generated/default/models/SaveNotification.d.ts +0 -55
  395. package/dist/sdk/api/generated/default/models/SaveNotificationAction.d.ts +0 -49
  396. package/dist/sdk/api/generated/default/models/SaveNotificationActionData.d.ts +0 -51
  397. package/dist/sdk/api/generated/default/models/SaveOfRepostNotification.d.ts +0 -55
  398. package/dist/sdk/api/generated/default/models/SaveOfRepostNotificationAction.d.ts +0 -49
  399. package/dist/sdk/api/generated/default/models/SaveOfRepostNotificationActionData.d.ts +0 -51
  400. package/dist/sdk/api/generated/default/models/SearchAutocompleteResponse.d.ts +0 -74
  401. package/dist/sdk/api/generated/default/models/SearchModel.d.ts +0 -75
  402. package/dist/sdk/api/generated/default/models/SearchPlaylist.d.ts +0 -272
  403. package/dist/sdk/api/generated/default/models/SearchResponse.d.ts +0 -74
  404. package/dist/sdk/api/generated/default/models/SearchTrack.d.ts +0 -520
  405. package/dist/sdk/api/generated/default/models/SendTipNotification.d.ts +0 -55
  406. package/dist/sdk/api/generated/default/models/SendTipNotificationAction.d.ts +0 -49
  407. package/dist/sdk/api/generated/default/models/SendTipNotificationActionData.d.ts +0 -48
  408. package/dist/sdk/api/generated/default/models/Stem.d.ts +0 -66
  409. package/dist/sdk/api/generated/default/models/StemParent.d.ts +0 -36
  410. package/dist/sdk/api/generated/default/models/StemsResponse.d.ts +0 -74
  411. package/dist/sdk/api/generated/default/models/StreamUrlResponse.d.ts +0 -30
  412. package/dist/sdk/api/generated/default/models/SubscribersResponse.d.ts +0 -74
  413. package/dist/sdk/api/generated/default/models/Supporter.d.ts +0 -43
  414. package/dist/sdk/api/generated/default/models/SupporterDethronedNotification.d.ts +0 -55
  415. package/dist/sdk/api/generated/default/models/SupporterDethronedNotificationAction.d.ts +0 -49
  416. package/dist/sdk/api/generated/default/models/SupporterDethronedNotificationActionData.d.ts +0 -42
  417. package/dist/sdk/api/generated/default/models/SupporterRankUpNotification.d.ts +0 -55
  418. package/dist/sdk/api/generated/default/models/SupporterRankUpNotificationAction.d.ts +0 -49
  419. package/dist/sdk/api/generated/default/models/SupporterRankUpNotificationActionData.d.ts +0 -42
  420. package/dist/sdk/api/generated/default/models/SupporterReference.d.ts +0 -30
  421. package/dist/sdk/api/generated/default/models/Supporting.d.ts +0 -43
  422. package/dist/sdk/api/generated/default/models/TagsResponse.d.ts +0 -30
  423. package/dist/sdk/api/generated/default/models/TastemakerNotification.d.ts +0 -55
  424. package/dist/sdk/api/generated/default/models/TastemakerNotificationAction.d.ts +0 -49
  425. package/dist/sdk/api/generated/default/models/TastemakerNotificationActionData.d.ts +0 -54
  426. package/dist/sdk/api/generated/default/models/TierChangeNotification.d.ts +0 -55
  427. package/dist/sdk/api/generated/default/models/TierChangeNotificationAction.d.ts +0 -49
  428. package/dist/sdk/api/generated/default/models/TierChangeNotificationActionData.d.ts +0 -42
  429. package/dist/sdk/api/generated/default/models/Tip.d.ts +0 -68
  430. package/dist/sdk/api/generated/default/models/TipGate.d.ts +0 -30
  431. package/dist/sdk/api/generated/default/models/TokenGate.d.ts +0 -31
  432. package/dist/sdk/api/generated/default/models/TopGenreUsersResponse.d.ts +0 -74
  433. package/dist/sdk/api/generated/default/models/TopListener.d.ts +0 -30
  434. package/dist/sdk/api/generated/default/models/TopUsersResponse.d.ts +0 -74
  435. package/dist/sdk/api/generated/default/models/Track.d.ts +0 -526
  436. package/dist/sdk/api/generated/default/models/TrackAccessInfo.d.ts +0 -68
  437. package/dist/sdk/api/generated/default/models/TrackActivity.d.ts +0 -45
  438. package/dist/sdk/api/generated/default/models/TrackAddedToPlaylistNotification.d.ts +0 -55
  439. package/dist/sdk/api/generated/default/models/TrackAddedToPlaylistNotificationAction.d.ts +0 -49
  440. package/dist/sdk/api/generated/default/models/TrackAddedToPlaylistNotificationActionData.d.ts +0 -42
  441. package/dist/sdk/api/generated/default/models/TrackAddedToPurchasedAlbumNotification.d.ts +0 -55
  442. package/dist/sdk/api/generated/default/models/TrackAddedToPurchasedAlbumNotificationAction.d.ts +0 -49
  443. package/dist/sdk/api/generated/default/models/TrackAddedToPurchasedAlbumNotificationActionData.d.ts +0 -42
  444. package/dist/sdk/api/generated/default/models/TrackArtwork.d.ts +0 -48
  445. package/dist/sdk/api/generated/default/models/TrackCommentCountResponse.d.ts +0 -30
  446. package/dist/sdk/api/generated/default/models/TrackCommentNotificationResponse.d.ts +0 -31
  447. package/dist/sdk/api/generated/default/models/TrackCommentsResponse.d.ts +0 -81
  448. package/dist/sdk/api/generated/default/models/TrackDownloadCountResponse.d.ts +0 -31
  449. package/dist/sdk/api/generated/default/models/TrackDownloadCountResponseData.d.ts +0 -36
  450. package/dist/sdk/api/generated/default/models/TrackDownloadCountsResponse.d.ts +0 -31
  451. package/dist/sdk/api/generated/default/models/TrackDownloadRequestBody.d.ts +0 -42
  452. package/dist/sdk/api/generated/default/models/TrackElementWrite.d.ts +0 -30
  453. package/dist/sdk/api/generated/default/models/TrackFavoritesResponse.d.ts +0 -74
  454. package/dist/sdk/api/generated/default/models/TrackFeedItem.d.ts +0 -37
  455. package/dist/sdk/api/generated/default/models/TrackId.d.ts +0 -30
  456. package/dist/sdk/api/generated/default/models/TrackInspect.d.ts +0 -31
  457. package/dist/sdk/api/generated/default/models/TrackInspectList.d.ts +0 -31
  458. package/dist/sdk/api/generated/default/models/TrackLibraryResponse.d.ts +0 -74
  459. package/dist/sdk/api/generated/default/models/TrackMilestoneNotificationActionData.d.ts +0 -42
  460. package/dist/sdk/api/generated/default/models/TrackRepostsResponse.d.ts +0 -74
  461. package/dist/sdk/api/generated/default/models/TrackResponse.d.ts +0 -74
  462. package/dist/sdk/api/generated/default/models/TrackSearch.d.ts +0 -31
  463. package/dist/sdk/api/generated/default/models/TrackSegment.d.ts +0 -36
  464. package/dist/sdk/api/generated/default/models/Tracks.d.ts +0 -74
  465. package/dist/sdk/api/generated/default/models/TracksCountResponse.d.ts +0 -30
  466. package/dist/sdk/api/generated/default/models/TracksResponse.d.ts +0 -74
  467. package/dist/sdk/api/generated/default/models/TransactionDetails.d.ts +0 -72
  468. package/dist/sdk/api/generated/default/models/TransactionHistoryCountResponse.d.ts +0 -73
  469. package/dist/sdk/api/generated/default/models/TransactionHistoryResponse.d.ts +0 -74
  470. package/dist/sdk/api/generated/default/models/TrendingIdsResponse.d.ts +0 -31
  471. package/dist/sdk/api/generated/default/models/TrendingNotification.d.ts +0 -55
  472. package/dist/sdk/api/generated/default/models/TrendingNotificationAction.d.ts +0 -49
  473. package/dist/sdk/api/generated/default/models/TrendingNotificationActionData.d.ts +0 -57
  474. package/dist/sdk/api/generated/default/models/TrendingPlaylistNotification.d.ts +0 -55
  475. package/dist/sdk/api/generated/default/models/TrendingPlaylistNotificationAction.d.ts +0 -49
  476. package/dist/sdk/api/generated/default/models/TrendingPlaylistNotificationActionData.d.ts +0 -57
  477. package/dist/sdk/api/generated/default/models/TrendingPlaylistsResponse.d.ts +0 -74
  478. package/dist/sdk/api/generated/default/models/TrendingTimesIds.d.ts +0 -43
  479. package/dist/sdk/api/generated/default/models/TrendingUndergroundNotification.d.ts +0 -55
  480. package/dist/sdk/api/generated/default/models/TrendingUndergroundNotificationAction.d.ts +0 -49
  481. package/dist/sdk/api/generated/default/models/TrendingUndergroundNotificationActionData.d.ts +0 -57
  482. package/dist/sdk/api/generated/default/models/UnclaimedIdResponse.d.ts +0 -30
  483. package/dist/sdk/api/generated/default/models/UndisbursedChallenge.d.ts +0 -84
  484. package/dist/sdk/api/generated/default/models/UndisbursedChallenges.d.ts +0 -31
  485. package/dist/sdk/api/generated/default/models/UpdateCoinRequest.d.ts +0 -60
  486. package/dist/sdk/api/generated/default/models/UpdateCoinResponse.d.ts +0 -30
  487. package/dist/sdk/api/generated/default/models/UpdateCommentRequestBody.d.ts +0 -49
  488. package/dist/sdk/api/generated/default/models/UpdateDeveloperAppRequestBody.d.ts +0 -48
  489. package/dist/sdk/api/generated/default/models/UpdatePlaylistRequestBody.d.ts +0 -165
  490. package/dist/sdk/api/generated/default/models/UpdateTrackRequestBody.d.ts +0 -210
  491. package/dist/sdk/api/generated/default/models/UpdateUserRequestBody.d.ts +0 -159
  492. package/dist/sdk/api/generated/default/models/UpdateUserRequestBodyEvents.d.ts +0 -36
  493. package/dist/sdk/api/generated/default/models/UrlWithMirrors.d.ts +0 -36
  494. package/dist/sdk/api/generated/default/models/UsdcGate.d.ts +0 -37
  495. package/dist/sdk/api/generated/default/models/UsdcPurchaseBuyerNotification.d.ts +0 -55
  496. package/dist/sdk/api/generated/default/models/UsdcPurchaseBuyerNotificationAction.d.ts +0 -49
  497. package/dist/sdk/api/generated/default/models/UsdcPurchaseBuyerNotificationActionData.d.ts +0 -60
  498. package/dist/sdk/api/generated/default/models/UsdcPurchaseSellerNotification.d.ts +0 -55
  499. package/dist/sdk/api/generated/default/models/UsdcPurchaseSellerNotificationAction.d.ts +0 -49
  500. package/dist/sdk/api/generated/default/models/UsdcPurchaseSellerNotificationActionData.d.ts +0 -60
  501. package/dist/sdk/api/generated/default/models/User.d.ts +0 -388
  502. package/dist/sdk/api/generated/default/models/UserAccountResponse.d.ts +0 -31
  503. package/dist/sdk/api/generated/default/models/UserArtistCoinBadge.d.ts +0 -48
  504. package/dist/sdk/api/generated/default/models/UserCoin.d.ts +0 -78
  505. package/dist/sdk/api/generated/default/models/UserCoinAccount.d.ts +0 -54
  506. package/dist/sdk/api/generated/default/models/UserCoinResponse.d.ts +0 -31
  507. package/dist/sdk/api/generated/default/models/UserCoinWithAccounts.d.ts +0 -67
  508. package/dist/sdk/api/generated/default/models/UserCoinsResponse.d.ts +0 -31
  509. package/dist/sdk/api/generated/default/models/UserCommentsResponse.d.ts +0 -81
  510. package/dist/sdk/api/generated/default/models/UserFeedItem.d.ts +0 -25
  511. package/dist/sdk/api/generated/default/models/UserFeedResponse.d.ts +0 -74
  512. package/dist/sdk/api/generated/default/models/UserIdAddress.d.ts +0 -36
  513. package/dist/sdk/api/generated/default/models/UserIdsAddressesResponse.d.ts +0 -31
  514. package/dist/sdk/api/generated/default/models/UserManager.d.ts +0 -38
  515. package/dist/sdk/api/generated/default/models/UserMilestoneNotificationActionData.d.ts +0 -42
  516. package/dist/sdk/api/generated/default/models/UserPlaylistLibrary.d.ts +0 -31
  517. package/dist/sdk/api/generated/default/models/UserPlaylistLibraryContentsInner.d.ts +0 -22
  518. package/dist/sdk/api/generated/default/models/UserResponse.d.ts +0 -74
  519. package/dist/sdk/api/generated/default/models/UserResponseSingle.d.ts +0 -31
  520. package/dist/sdk/api/generated/default/models/UserSearch.d.ts +0 -31
  521. package/dist/sdk/api/generated/default/models/UserSubscribers.d.ts +0 -36
  522. package/dist/sdk/api/generated/default/models/UserTrackListenCountsResponse.d.ts +0 -33
  523. package/dist/sdk/api/generated/default/models/UserTracksDownloadCountResponse.d.ts +0 -30
  524. package/dist/sdk/api/generated/default/models/UserTracksRemixedResponse.d.ts +0 -31
  525. package/dist/sdk/api/generated/default/models/VerifyToken.d.ts +0 -31
  526. package/dist/sdk/api/generated/default/models/VersionMetadata.d.ts +0 -36
  527. package/dist/sdk/api/generated/default/models/WriteResponse.d.ts +0 -42
  528. package/dist/sdk/api/generated/default/models/index.d.ts +0 -401
  529. package/dist/sdk/api/generated/default/runtime.d.ts +0 -172
  530. package/dist/sdk/api/grants/GrantsApi.d.ts +0 -19
  531. package/dist/sdk/api/grants/types.d.ts +0 -65
  532. package/dist/sdk/api/notifications/NotificationsApi.d.ts +0 -14
  533. package/dist/sdk/api/notifications/NotificationsApi.test.d.ts +0 -1
  534. package/dist/sdk/api/notifications/types.d.ts +0 -32
  535. package/dist/sdk/api/playlists/PlaylistsApi.d.ts +0 -106
  536. package/dist/sdk/api/playlists/PlaylistsApi.test.d.ts +0 -1
  537. package/dist/sdk/api/playlists/types.d.ts +0 -3942
  538. package/dist/sdk/api/tracks/TrackUploadHelper.d.ts +0 -133
  539. package/dist/sdk/api/tracks/TracksApi.d.ts +0 -122
  540. package/dist/sdk/api/tracks/TracksApi.test.d.ts +0 -1
  541. package/dist/sdk/api/tracks/constants.d.ts +0 -2
  542. package/dist/sdk/api/tracks/types.d.ts +0 -4431
  543. package/dist/sdk/api/uploads/UploadsApi.d.ts +0 -49
  544. package/dist/sdk/api/uploads/types.d.ts +0 -4
  545. package/dist/sdk/api/users/UsersApi.d.ts +0 -134
  546. package/dist/sdk/api/users/UsersApi.test.d.ts +0 -1
  547. package/dist/sdk/api/users/types.d.ts +0 -1009
  548. package/dist/sdk/config/development.d.ts +0 -2
  549. package/dist/sdk/config/production.d.ts +0 -2
  550. package/dist/sdk/config/types.d.ts +0 -45
  551. package/dist/sdk/createSdk.d.ts +0 -26
  552. package/dist/sdk/createSdkWithServices.d.ts +0 -50
  553. package/dist/sdk/errors.d.ts +0 -3
  554. package/dist/sdk/index.d.ts +0 -40
  555. package/dist/sdk/middleware/addAppInfoMiddleware.d.ts +0 -16
  556. package/dist/sdk/middleware/addRequestSignatureMiddleware.d.ts +0 -12
  557. package/dist/sdk/middleware/addRequestSignatureMiddleware.test.d.ts +0 -1
  558. package/dist/sdk/middleware/addTokenRefreshMiddleware.d.ts +0 -16
  559. package/dist/sdk/middleware/addTokenRefreshMiddleware.test.d.ts +0 -1
  560. package/dist/sdk/middleware/index.d.ts +0 -3
  561. package/dist/sdk/oauth/OAuth.d.ts +0 -131
  562. package/dist/sdk/oauth/OAuth.test.d.ts +0 -1
  563. package/dist/sdk/oauth/TokenStoreAsyncStorage.d.ts +0 -7
  564. package/dist/sdk/oauth/TokenStoreLocalStorage.d.ts +0 -11
  565. package/dist/sdk/oauth/TokenStoreMemory.d.ts +0 -18
  566. package/dist/sdk/oauth/index.d.ts +0 -3
  567. package/dist/sdk/oauth/pkce.d.ts +0 -18
  568. package/dist/sdk/oauth/pkce.test.d.ts +0 -1
  569. package/dist/sdk/oauth/tokenStore.d.ts +0 -11
  570. package/dist/sdk/oauth/tokenStore.test.d.ts +0 -1
  571. package/dist/sdk/oauth/tokenStoreLocalStorage.test.d.ts +0 -1
  572. package/dist/sdk/oauth/types.d.ts +0 -5
  573. package/dist/sdk/scripts/generateServicesConfig.d.ts +0 -1
  574. package/dist/sdk/scripts/manageRewardsLookupTable.d.ts +0 -1
  575. package/dist/sdk/scripts/verifyUser.d.ts +0 -1
  576. package/dist/sdk/sdk.d.ts +0 -5
  577. package/dist/sdk/sdkBrowserDist.d.ts +0 -51
  578. package/dist/sdk/services/AntiAbuseOracle/AntiAbuseOracle.d.ts +0 -10
  579. package/dist/sdk/services/AntiAbuseOracle/index.d.ts +0 -2
  580. package/dist/sdk/services/AntiAbuseOracle/types.d.ts +0 -70
  581. package/dist/sdk/services/AntiAbuseOracleSelector/AntiAbuseOracleSelector.d.ts +0 -26
  582. package/dist/sdk/services/AntiAbuseOracleSelector/AntiAbuseOracleSelector.test.d.ts +0 -1
  583. package/dist/sdk/services/AntiAbuseOracleSelector/getDefaultConfig.d.ts +0 -3
  584. package/dist/sdk/services/AntiAbuseOracleSelector/index.d.ts +0 -3
  585. package/dist/sdk/services/AntiAbuseOracleSelector/types.d.ts +0 -37
  586. package/dist/sdk/services/Archiver/Archiver.d.ts +0 -21
  587. package/dist/sdk/services/Archiver/index.d.ts +0 -1
  588. package/dist/sdk/services/AudiusWalletClient/actions/getSharedSecret.d.ts +0 -7
  589. package/dist/sdk/services/AudiusWalletClient/actions/sign.d.ts +0 -7
  590. package/dist/sdk/services/AudiusWalletClient/createAppWalletClient.d.ts +0 -5
  591. package/dist/sdk/services/AudiusWalletClient/createHedgehogWalletClient.d.ts +0 -9
  592. package/dist/sdk/services/AudiusWalletClient/decorators/audiusWallet.d.ts +0 -184
  593. package/dist/sdk/services/AudiusWalletClient/index.d.ts +0 -4
  594. package/dist/sdk/services/AudiusWalletClient/localTransport.d.ts +0 -10
  595. package/dist/sdk/services/AudiusWalletClient/privateKeyToAudiusAccount.d.ts +0 -6
  596. package/dist/sdk/services/AudiusWalletClient/types.d.ts +0 -24
  597. package/dist/sdk/services/AudiusWalletClient/utils.d.ts +0 -7
  598. package/dist/sdk/services/Encryption/EmailEncryptionService.d.ts +0 -107
  599. package/dist/sdk/services/Encryption/index.d.ts +0 -2
  600. package/dist/sdk/services/Encryption/types.d.ts +0 -13
  601. package/dist/sdk/services/EntityManager/EntityManager.test.d.ts +0 -1
  602. package/dist/sdk/services/EntityManager/EntityManagerClient.d.ts +0 -48
  603. package/dist/sdk/services/EntityManager/contract/EntityManagerContract.d.ts +0 -168
  604. package/dist/sdk/services/EntityManager/contract/abi.d.ts +0 -131
  605. package/dist/sdk/services/EntityManager/getDefaultConfig.d.ts +0 -3
  606. package/dist/sdk/services/EntityManager/index.d.ts +0 -5
  607. package/dist/sdk/services/EntityManager/types.d.ts +0 -131
  608. package/dist/sdk/services/Ethereum/ethereum.d.ts +0 -86
  609. package/dist/sdk/services/Ethereum/getDefaultConfig.d.ts +0 -3
  610. package/dist/sdk/services/Ethereum/index.d.ts +0 -2
  611. package/dist/sdk/services/Ethereum/types.d.ts +0 -26
  612. package/dist/sdk/services/Logger/Logger.d.ts +0 -18
  613. package/dist/sdk/services/Logger/index.d.ts +0 -2
  614. package/dist/sdk/services/Logger/types.d.ts +0 -7
  615. package/dist/sdk/services/Solana/SolanaRelay.d.ts +0 -84
  616. package/dist/sdk/services/Solana/SolanaRelayWalletAdapter.d.ts +0 -42
  617. package/dist/sdk/services/Solana/constants.d.ts +0 -3
  618. package/dist/sdk/services/Solana/index.d.ts +0 -7
  619. package/dist/sdk/services/Solana/programs/ClaimableTokensClient/ClaimableTokensClient.d.ts +0 -77
  620. package/dist/sdk/services/Solana/programs/ClaimableTokensClient/getDefaultConfig.d.ts +0 -3
  621. package/dist/sdk/services/Solana/programs/ClaimableTokensClient/index.d.ts +0 -2
  622. package/dist/sdk/services/Solana/programs/ClaimableTokensClient/types.d.ts +0 -98
  623. package/dist/sdk/services/Solana/programs/CustomInstructionError.d.ts +0 -7
  624. package/dist/sdk/services/Solana/programs/PaymentRouterClient/PaymentRouterClient.d.ts +0 -23
  625. package/dist/sdk/services/Solana/programs/PaymentRouterClient/getDefaultConfig.d.ts +0 -3
  626. package/dist/sdk/services/Solana/programs/PaymentRouterClient/index.d.ts +0 -3
  627. package/dist/sdk/services/Solana/programs/PaymentRouterClient/types.d.ts +0 -136
  628. package/dist/sdk/services/Solana/programs/RewardManagerClient/RewardManagerClient.d.ts +0 -44
  629. package/dist/sdk/services/Solana/programs/RewardManagerClient/getDefaultConfig.d.ts +0 -3
  630. package/dist/sdk/services/Solana/programs/RewardManagerClient/index.d.ts +0 -2
  631. package/dist/sdk/services/Solana/programs/RewardManagerClient/types.d.ts +0 -113
  632. package/dist/sdk/services/Solana/programs/SolanaClient.d.ts +0 -47
  633. package/dist/sdk/services/Solana/programs/getDefaultConfig.d.ts +0 -3
  634. package/dist/sdk/services/Solana/programs/types.d.ts +0 -276
  635. package/dist/sdk/services/Solana/types.d.ts +0 -208
  636. package/dist/sdk/services/Storage/Storage.d.ts +0 -42
  637. package/dist/sdk/services/Storage/getDefaultConfig.d.ts +0 -3
  638. package/dist/sdk/services/Storage/index.d.ts +0 -3
  639. package/dist/sdk/services/Storage/types.d.ts +0 -127
  640. package/dist/sdk/services/StorageNodeSelector/StorageNodeSelector.d.ts +0 -17
  641. package/dist/sdk/services/StorageNodeSelector/StorageNodeSelector.test.d.ts +0 -1
  642. package/dist/sdk/services/StorageNodeSelector/getDefaultConfig.d.ts +0 -3
  643. package/dist/sdk/services/StorageNodeSelector/getNStorageNodes.d.ts +0 -14
  644. package/dist/sdk/services/StorageNodeSelector/index.d.ts +0 -3
  645. package/dist/sdk/services/StorageNodeSelector/types.d.ts +0 -30
  646. package/dist/sdk/services/index.d.ts +0 -11
  647. package/dist/sdk/types/ChainAddress.d.ts +0 -21
  648. package/dist/sdk/types/DDEX.d.ts +0 -37
  649. package/dist/sdk/types/Env.d.ts +0 -1
  650. package/dist/sdk/types/EthAddress.d.ts +0 -2
  651. package/dist/sdk/types/File.d.ts +0 -210
  652. package/dist/sdk/types/Genre.d.ts +0 -54
  653. package/dist/sdk/types/HashId.d.ts +0 -5
  654. package/dist/sdk/types/Hex.d.ts +0 -2
  655. package/dist/sdk/types/Mood.d.ts +0 -25
  656. package/dist/sdk/types/SolanaAddress.d.ts +0 -2
  657. package/dist/sdk/types/StemCategory.d.ts +0 -14
  658. package/dist/sdk/types/Timeout.d.ts +0 -1
  659. package/dist/sdk/types.d.ts +0 -267
  660. package/dist/sdk/utils/EventEmitterTarget.d.ts +0 -6
  661. package/dist/sdk/utils/apiKey.d.ts +0 -1
  662. package/dist/sdk/utils/cid.d.ts +0 -2
  663. package/dist/sdk/utils/crypto.d.ts +0 -26
  664. package/dist/sdk/utils/deepPartial.d.ts +0 -3
  665. package/dist/sdk/utils/errors.d.ts +0 -8
  666. package/dist/sdk/utils/fetch.d.ts +0 -16
  667. package/dist/sdk/utils/getPathFromUrl.d.ts +0 -4
  668. package/dist/sdk/utils/hashId.d.ts +0 -8
  669. package/dist/sdk/utils/hashId.test.d.ts +0 -1
  670. package/dist/sdk/utils/localStorage.d.ts +0 -6
  671. package/dist/sdk/utils/location.d.ts +0 -16
  672. package/dist/sdk/utils/mergeConfigs.d.ts +0 -7
  673. package/dist/sdk/utils/mergeConfigs.test.d.ts +0 -1
  674. package/dist/sdk/utils/oauthScope.d.ts +0 -1
  675. package/dist/sdk/utils/object.d.ts +0 -4
  676. package/dist/sdk/utils/parseMint.d.ts +0 -10
  677. package/dist/sdk/utils/parseParams.d.ts +0 -13
  678. package/dist/sdk/utils/preparePaymentSplits.d.ts +0 -19
  679. package/dist/sdk/utils/prettify.d.ts +0 -3
  680. package/dist/sdk/utils/promiseAny.d.ts +0 -6
  681. package/dist/sdk/utils/reactionsMap.d.ts +0 -11
  682. package/dist/sdk/utils/rendezvous.d.ts +0 -12
  683. package/dist/sdk/utils/retry.d.ts +0 -4
  684. package/dist/sdk/utils/signatureSchemas.d.ts +0 -54
  685. package/dist/sdk/utils/uuid.d.ts +0 -1
  686. package/dist/sdk/utils/wait.d.ts +0 -1
  687. package/dist/sdk.browser.esm.html +0 -5000
  688. package/dist/sdk.min.js +0 -30
  689. package/dist/sdk.min.js.map +0 -1
package/dist/sdk.min.js DELETED
@@ -1,30 +0,0 @@
1
- !function(e){"use strict";var t;!function(e){e.TRACK_UPLOADS="u",e.REFERRALS="r",e.VERIFIED_REFERRALS="rv",e.REFERRED="rd",e.MOBILE_INSTALL="m",e.CONNECT_VERIFIED_ACCOUNT="v",e.LISTEN_STREAK_ENDLESS="e",e.COMPLETE_PROFILE="p",e.SEND_FIRST_TIP="ft",e.CREATE_FIRST_PLAYLIST="fp",e.AUDIO_MATCHING_BUYER="b",e.AUDIO_MATCHING_SELLER="s",e.TRENDING_TRACK="tt",e.TRENDING_PLAYLIST="tp",e.TRENDING_UNDERGROUND_TRACK="tut",e.ONE_SHOT="o",e.FIRST_WEEKLY_COMMENT="c",e.PLAY_COUNT_250_MILESTONE_2025="p1",e.PLAY_COUNT_1000_MILESTONE_2025="p2",e.PLAY_COUNT_10000_MILESTONE_2025="p3",e.TASTEMAKER="t",e.COSIGN="cs",e.PINNED_COMMENT="cp",e.REMIX_CONTEST_WINNER="w"}(t||(t={}));const n={network:{minVersion:"0.0.0",apiEndpoint:"http://audius-api",storageNodes:[{delegateOwnerWallet:"0x0D38e653eC28bdea5A2296fD5940aaB2D0B8875c",endpoint:"http://audius-creator-node-1"}],antiAbuseOracleNodes:{endpoints:["http://audius-anti-abuse-oracle-1:8000"],registeredAddresses:["0xF0D5BC18421fa04D0a2A2ef540ba5A9f04014BE3"]},identityService:"http://audius-identity-service-1"},acdc:{entityManagerContractAddress:"0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B",chainId:1337},solana:{claimableTokensProgramAddress:"testHKV1B56fbvop4w6f2cTGEub9dRQ2Euta5VmqdX9",rewardManagerProgramAddress:"testLsJKtyABc9UXJF8JWFKf1YH4LmqCWBC42c6akPb",rewardManagerStateAddress:"DJPzVothq58SmkpRb1ATn5ddN2Rpv1j2TcGvM3XsHf1c",paymentRouterProgramAddress:"apaySbqV1XAmuiGszeN4NyWrXkkMrnuJVoNhzmS1AMa",stakingBridgeProgramAddress:"",rpcEndpoint:"http://audius-solana-test-validator-1",usdcTokenMint:"26Q7gP8UfkDzi7GMFEQxTJaNJ8D2ybCUjex58M5MLu8y",wAudioTokenMint:"37RCjhgV1qGV2Q54EHFScdxZ22ydRMdKMtVgod47fDP3",rewardManagerLookupTableAddress:"GNHKVSmHvoRBt1JJCxz7RSMfzDQGDGhGEjmhHyxb3K5J"},ethereum:{rpcEndpoint:"http://audius-eth-ganache-1",addresses:{ethRewardsManagerAddress:"0x",serviceProviderFactoryAddress:"0x",serviceTypeManagerAddress:"0x",audiusTokenAddress:"0xdcB2fC9469808630DD0744b0adf97C0003fC29B2",audiusWormholeAddress:"0x",delegateManagerAddress:"0x",stakingAddress:"0x",governanceAddress:"0x",claimsManagerAddress:"0x",trustedNotifierManagerAddress:"0x",registryAddress:"0x"}}},r={network:{minVersion:"0.7.0",apiEndpoint:"https://api.audius.co",storageNodes:[{endpoint:"https://creatornode3.audius.co",delegateOwnerWallet:"0x0C32BE6328578E99b6F06E0e7A6B385EB8FC13d1"},{endpoint:"https://creatornode.audius.co",delegateOwnerWallet:"0xc8d0C29B6d540295e8fc8ac72456F2f4D41088c8"},{endpoint:"https://creatornode2.audius.co",delegateOwnerWallet:"0xf686647E3737d595C60c6DE2f5F90463542FE439"}],antiAbuseOracleNodes:{endpoints:["https://discoveryprovider.audius.co","https://audius-oracle.creatorseed.com","https://oracle.audius.endl.net"],registeredAddresses:["0x9811BA3eAB1F2Cd9A2dFeDB19e8c2a69729DC8b6","0xe60d50356cd891f56B744165fcc1D8B352201A76","0x7A03cFAE79266683D9706731D6E187868E939c9C"]},identityService:"https://identityservice.audius.co"},acdc:{entityManagerContractAddress:"0x1Cd8a543596D499B9b6E7a6eC15ECd2B7857Fd64",chainId:31524},solana:{claimableTokensProgramAddress:"Ewkv3JahEFRKkcJmpoKB7pXbnUHwjAyXiwEo4ZY2rezQ",rewardManagerProgramAddress:"DDZDcYdQFEMwcu2Mwo75yGFjJ1mUQyyXLWzhZLEVFcei",rewardManagerStateAddress:"71hWFVYokLaN1PNYzTAWi13EfJ7Xt9VbSWUKsXUT8mxE",paymentRouterProgramAddress:"paytYpX3LPN98TAeen6bFFeraGSuWnomZmCXjAsoqPa",stakingBridgeProgramAddress:"stkB5DZziVJT1C1VmzvDdRtdWxfs5nwcHViiaNBDK31",rpcEndpoint:"https://carolina-8qh733-fast-mainnet.helius-rpc.com",usdcTokenMint:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",wAudioTokenMint:"9LzCMqDgTKYz9Drzqnpgee3SGa89up3a247ypMj2xrqM",rewardManagerLookupTableAddress:"4UQwpGupH66RgQrWRqmPM9Two6VJEE68VZ7GeqZ3mvVv"},ethereum:{rpcEndpoint:"https://eth-client.audius.co",addresses:{ethRewardsManagerAddress:"0x5aa6B99A2B461bA8E97207740f0A689C5C39C3b0",serviceProviderFactoryAddress:"0xD17A9bc90c582249e211a4f4b16721e7f65156c8",serviceTypeManagerAddress:"0x9EfB0f4F38aFbb4b0984D00C126E97E21b8417C5",audiusTokenAddress:"0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998",audiusWormholeAddress:"0x6E7a1F7339bbB62b23D44797b63e4258d283E095",delegateManagerAddress:"0x4d7968ebfD390D5E7926Cb3587C39eFf2F9FB225",stakingAddress:"0xe6D97B2099F142513be7A2a068bE040656Ae4591",governanceAddress:"0x4DEcA517D6817B6510798b7328F2314d3003AbAC",claimsManagerAddress:"0x44617F9dCEd9787C3B06a05B35B4C779a2AA1334",trustedNotifierManagerAddress:"0x6f08105c8CEef2BC5653640fcdbBE1e7bb519D39",registryAddress:"0xd976d3b4f4e22a238c1A736b6612D22f17b6f64C"}}};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}var s={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==i&&i,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in n,a="ArrayBuffer"in n;if(a)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&u.indexOf(Object.prototype.toString.call(e))>-1};function d(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function g(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=g(t);return t.readAsArrayBuffer(e),n}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&o&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=p(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=g(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=d(e),t=l(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},f.prototype.delete=function(e){delete this.map[d(e)]},f.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},f.prototype.set=function(e,t){this.map[d(e)]=l(t)},f.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),h(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),h(e)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),v.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function A(e,t){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},w.call(b.prototype),w.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];A.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function k(e,r){return new Promise((function(i,s){var u=new b(e,r);if(u.signal&&u.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var c=new XMLHttpRequest;function d(){c.abort()}c.onload=function(){var e,t,n={status:c.status,statusText:c.statusText,headers:(e=c.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in c?c.responseURL:n.headers.get("X-Request-URL");var r="response"in c?c.response:c.responseText;setTimeout((function(){i(new A(r,n))}),0)},c.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},c.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},c.onabort=function(){setTimeout((function(){s(new t.DOMException("Aborted","AbortError"))}),0)},c.open(u.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?c.withCredentials=!0:"omit"===u.credentials&&(c.withCredentials=!1),"responseType"in c&&(o?c.responseType="blob":a&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(c.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof f?u.headers.forEach((function(e,t){c.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){c.setRequestHeader(e,l(r.headers[e]))})),u.signal&&(u.signal.addEventListener("abort",d),c.onreadystatechange=function(){4===c.readyState&&u.signal.removeEventListener("abort",d)}),c.send(void 0===u._bodyInit?null:u._bodyInit)}))}k.polyfill=!0,n.fetch||(n.fetch=k,n.Headers=f,n.Request=b,n.Response=A),t.Headers=f,t.Request=b,t.Response=A,t.fetch=k}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(s,s.exports);var a=s.exports;function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const c="/v1".replace(/\/+$/,"");class d{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,"configuration",void 0),this.configuration=e}set config(e){this.configuration=e}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:c}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||b}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return"function"==typeof e?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return"function"==typeof e?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const l=new d;class h{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l;u(this,"configuration",void 0),u(this,"middleware",void 0),u(this,"fetchApi",(async(e,t)=>{let n,r={url:e,init:t};for(const e of this.middleware)e.pre&&(r=await e.pre({fetch:this.fetchApi,...r})||r);try{n=await(this.configuration.fetchApi||fetch)(r.url,r.init)}catch(e){for(const t of this.middleware)t.onError&&(n=await t.onError({fetch:this.fetchApi,url:r.url,init:r.init,error:e,response:n?n.clone():void 0})||n);if(void 0===n)throw e instanceof Error?new m(e,"The request failed and the interceptors did not return an alternative response"):e}for(const e of this.middleware)e.post&&(n=await e.post({fetch:this.fetchApi,url:r.url,init:r.init,response:n.clone()})||n);return n})),this.configuration=e,this.middleware=e.middleware}withMiddleware(){const e=this.clone();return e.middleware=e.middleware.concat(...arguments),e}withPreMiddleware(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.map((e=>({pre:e})));return this.withMiddleware(...r)}withPostMiddleware(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.map((e=>({post:e})));return this.withMiddleware(...r)}async request(e,t){const{url:n,init:r}=await this.createFetchParams(e,t),i=await this.fetchApi(n,r);if(i&&i.status>=200&&i.status<300)return i;throw new g(i,"Response returned an error code")}async createFetchParams(e,t){let n=this.configuration.basePath+e.path;void 0!==e.query&&0!==Object.keys(e.query).length&&(n+="?"+this.configuration.queryParamsStringify(e.query));const r=Object.assign({},this.configuration.headers,e.headers);Object.keys(r).forEach((e=>void 0===r[e]?delete r[e]:{}));const i="function"==typeof t?t:async()=>t,o={method:e.method,headers:r,body:e.body,credentials:this.configuration.credentials},s={...o,...await i({init:o,context:e})};var a;return{url:n,init:{...s,body:(a=s.body,"undefined"!=typeof FormData&&a instanceof FormData||s.body instanceof URLSearchParams||f(s.body)||p(s.body)?s.body:JSON.stringify(s.body))}}}clone(){const e=new(0,this.constructor)(this.configuration);return e.middleware=this.middleware.slice(),e}}function f(e){return"undefined"!=typeof Blob&&e instanceof Blob}function p(e){return"string"==typeof e}class g extends Error{constructor(e,t){super(t),u(this,"response",void 0),u(this,"name","ResponseError"),this.response=e}}class m extends Error{constructor(e,t){super(t,{cause:e}),u(this,"name","FetchError")}}class y extends Error{constructor(e,t){super(t),u(this,"field",void 0),u(this,"name","RequiredError"),this.field=e}}const w=",";function v(e,t){const n=e[t];return null!=n}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.keys(e).sort().map((n=>_(n,e[n],t))).filter((e=>e.length>0)).join("&")}function _(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const e=t.map((e=>encodeURIComponent(String(e)))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${e}`}if(t instanceof Set){return _(e,Array.from(t),n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?b(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function A(e,t){return Object.keys(e).reduce(((n,r)=>({...n,[r]:t(e[r])})),{})}class E{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;u(this,"raw",void 0),u(this,"transformer",void 0),this.raw=e,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}class k{constructor(e){u(this,"raw",void 0),this.raw=e}async value(){}}function I(e){return function(e,t){if(null==e)return e;return{stream:e.stream,download:e.download}}(e)}function S(e,t){return null==e?e:{followUserId:e.follow_user_id}}function C(e){return function(e,t){if(null==e)return e;return{userId:e.user_id,percentage:e.percentage}}(e)}function x(e){if(void 0!==e)return null===e?null:{user_id:e.userId,percentage:e.percentage}}function B(e){return function(e,t){if(null==e)return e;return{price:e.price,splits:e.splits.map(C)}}(e)}function T(e){if(void 0!==e)return null===e?null:{price:e.price,splits:e.splits.map(x)}}function R(e,t){return null==e?e:{usdcPurchase:B(e.usdc_purchase)}}function D(e,t){return null==e?e:{tipUserId:e.tip_user_id}}function P(e){return function(e,t){if(null==e)return e;return{tokenMint:e.token_mint,tokenAmount:e.token_amount}}(e)}function U(e){if(void 0!==e)return null===e?null:{token_mint:e.tokenMint,token_amount:e.tokenAmount}}function O(e,t){return null==e?e:{tokenGate:P(e.token_gate)}}function F(e){return function(e,t){if(null==e)return e;return{...S(e),...R(e),...D(e),...O(e)}}(e)}function M(e){if(void 0!==e)return null===e?null:function(e){let t=!0;return t=t&&"followUserId"in e&&void 0!==e.followUserId,t}(e)?function(e){if(void 0!==e)return null===e?null:{follow_user_id:e.followUserId}}(e):function(e){let t=!0;return t=t&&"usdcPurchase"in e&&void 0!==e.usdcPurchase,t}(e)?function(e){if(void 0!==e)return null===e?null:{usdc_purchase:T(e.usdcPurchase)}}(e):function(e){let t=!0;return t=t&&"tipUserId"in e&&void 0!==e.tipUserId,t}(e)?function(e){if(void 0!==e)return null===e?null:{tip_user_id:e.tipUserId}}(e):function(e){let t=!0;return t=t&&"tokenGate"in e&&void 0!==e.tokenGate,t}(e)?function(e){if(void 0!==e)return null===e?null:{token_gate:U(e.tokenGate)}}(e):{}}function L(e){return function(e,t){if(null==e)return e;return{userId:v(e,"user_id")?e.user_id:void 0,percentage:e.percentage,ethWallet:v(e,"eth_wallet")?e.eth_wallet:void 0,payoutWallet:e.payout_wallet,amount:e.amount}}(e)}function q(e){return function(e,t){if(null==e)return e;return{price:e.price,splits:e.splits.map(L)}}(e)}function z(e,t){return null==e?e:{usdcPurchase:q(e.usdc_purchase)}}function N(e){return function(e,t){if(null==e)return e;return{...z(e),...S(e),...D(e),...O(e)}}(e)}function j(e){return function(e,t){if(null==e)return e;return{access:v(e,"access")?I(e.access):void 0,userId:e.user_id,blocknumber:e.blocknumber,isStreamGated:v(e,"is_stream_gated")?e.is_stream_gated:void 0,streamConditions:v(e,"stream_conditions")?N(e.stream_conditions):void 0,isDownloadGated:v(e,"is_download_gated")?e.is_download_gated:void 0,downloadConditions:v(e,"download_conditions")?N(e.download_conditions):void 0}}(e)}function $(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?j(e.data):void 0}}(e)}function W(e){return function(e,t){if(null==e)return e;return{id:e.id,handle:e.handle,isDeactivated:v(e,"is_deactivated")?e.is_deactivated:void 0}}(e)}function H(e){return function(e,t){if(null==e)return e;return{id:e.id,isAlbum:e.is_album,name:e.name,permalink:e.permalink,user:W(e.user)}}(e)}function K(e){return function(e,t){if(null==e)return e;return{contents:v(e,"contents")?e.contents:void 0}}(e)}function V(e){return function(e,t){if(null==e)return e;return{_640x:v(e,"640x")?e["640x"]:void 0,_2000x:v(e,"2000x")?e["2000x"]:void 0,mirrors:v(e,"mirrors")?e.mirrors:void 0}}(e)}function G(e){return function(e,t){if(null==e)return e;return{_150x150:v(e,"150x150")?e["150x150"]:void 0,_480x480:v(e,"480x480")?e["480x480"]:void 0,_1000x1000:v(e,"1000x1000")?e["1000x1000"]:void 0,mirrors:v(e,"mirrors")?e.mirrors:void 0}}(e)}function Z(e){return function(e,t){if(null==e)return e;return{mint:v(e,"mint")?e.mint:void 0,logoUri:v(e,"logo_uri")?e.logo_uri:void 0,bannerImageUrl:v(e,"banner_image_url")?e.banner_image_url:void 0,ticker:v(e,"ticker")?e.ticker:void 0}}(e)}function Y(e){let t=!0;return t=t&&"albumCount"in e&&void 0!==e.albumCount,t=t&&"artistCoinBadge"in e&&void 0!==e.artistCoinBadge,t=t&&"followeeCount"in e&&void 0!==e.followeeCount,t=t&&"followerCount"in e&&void 0!==e.followerCount,t=t&&"handle"in e&&void 0!==e.handle,t=t&&"id"in e&&void 0!==e.id,t=t&&"isVerified"in e&&void 0!==e.isVerified,t=t&&"verifiedWithTwitter"in e&&void 0!==e.verifiedWithTwitter,t=t&&"verifiedWithInstagram"in e&&void 0!==e.verifiedWithInstagram,t=t&&"verifiedWithTiktok"in e&&void 0!==e.verifiedWithTiktok,t=t&&"name"in e&&void 0!==e.name,t=t&&"playlistCount"in e&&void 0!==e.playlistCount,t=t&&"repostCount"in e&&void 0!==e.repostCount,t=t&&"trackCount"in e&&void 0!==e.trackCount,t=t&&"isDeactivated"in e&&void 0!==e.isDeactivated,t=t&&"isAvailable"in e&&void 0!==e.isAvailable,t=t&&"ercWallet"in e&&void 0!==e.ercWallet,t=t&&"splWallet"in e&&void 0!==e.splWallet,t=t&&"splUsdcWallet"in e&&void 0!==e.splUsdcWallet,t=t&&"supporterCount"in e&&void 0!==e.supporterCount,t=t&&"supportingCount"in e&&void 0!==e.supportingCount,t=t&&"totalAudioBalance"in e&&void 0!==e.totalAudioBalance,t=t&&"wallet"in e&&void 0!==e.wallet,t=t&&"balance"in e&&void 0!==e.balance,t=t&&"associatedWalletsBalance"in e&&void 0!==e.associatedWalletsBalance,t=t&&"totalBalance"in e&&void 0!==e.totalBalance,t=t&&"waudioBalance"in e&&void 0!==e.waudioBalance,t=t&&"associatedSolWalletsBalance"in e&&void 0!==e.associatedSolWalletsBalance,t=t&&"blocknumber"in e&&void 0!==e.blocknumber,t=t&&"createdAt"in e&&void 0!==e.createdAt,t=t&&"isStorageV2"in e&&void 0!==e.isStorageV2,t=t&&"currentUserFolloweeFollowCount"in e&&void 0!==e.currentUserFolloweeFollowCount,t=t&&"doesCurrentUserFollow"in e&&void 0!==e.doesCurrentUserFollow,t=t&&"doesCurrentUserSubscribe"in e&&void 0!==e.doesCurrentUserSubscribe,t=t&&"doesFollowCurrentUser"in e&&void 0!==e.doesFollowCurrentUser,t=t&&"handleLc"in e&&void 0!==e.handleLc,t=t&&"updatedAt"in e&&void 0!==e.updatedAt,t=t&&"hasCollectibles"in e&&void 0!==e.hasCollectibles,t=t&&"allowAiAttribution"in e&&void 0!==e.allowAiAttribution,t}function J(e){return X(e)}function X(e,t){return null==e?e:{albumCount:e.album_count,artistPickTrackId:v(e,"artist_pick_track_id")?e.artist_pick_track_id:void 0,artistCoinBadge:Z(e.artist_coin_badge),coinFlairMint:v(e,"coin_flair_mint")?e.coin_flair_mint:void 0,bio:v(e,"bio")?e.bio:void 0,coverPhoto:v(e,"cover_photo")?V(e.cover_photo):void 0,followeeCount:e.followee_count,followerCount:e.follower_count,handle:e.handle,id:e.id,isVerified:e.is_verified,twitterHandle:v(e,"twitter_handle")?e.twitter_handle:void 0,instagramHandle:v(e,"instagram_handle")?e.instagram_handle:void 0,tiktokHandle:v(e,"tiktok_handle")?e.tiktok_handle:void 0,verifiedWithTwitter:e.verified_with_twitter,verifiedWithInstagram:e.verified_with_instagram,verifiedWithTiktok:e.verified_with_tiktok,website:v(e,"website")?e.website:void 0,donation:v(e,"donation")?e.donation:void 0,location:v(e,"location")?e.location:void 0,name:e.name,playlistCount:e.playlist_count,profilePicture:v(e,"profile_picture")?G(e.profile_picture):void 0,repostCount:e.repost_count,trackCount:e.track_count,isDeactivated:e.is_deactivated,isAvailable:e.is_available,ercWallet:e.erc_wallet,splWallet:e.spl_wallet,splUsdcWallet:e.spl_usdc_wallet,splUsdcPayoutWallet:v(e,"spl_usdc_payout_wallet")?e.spl_usdc_payout_wallet:void 0,supporterCount:e.supporter_count,supportingCount:e.supporting_count,totalAudioBalance:e.total_audio_balance,wallet:e.wallet,balance:e.balance,associatedWalletsBalance:e.associated_wallets_balance,totalBalance:e.total_balance,waudioBalance:e.waudio_balance,associatedSolWalletsBalance:e.associated_sol_wallets_balance,blocknumber:e.blocknumber,createdAt:e.created_at,isStorageV2:e.is_storage_v2,creatorNodeEndpoint:v(e,"creator_node_endpoint")?e.creator_node_endpoint:void 0,currentUserFolloweeFollowCount:e.current_user_followee_follow_count,doesCurrentUserFollow:e.does_current_user_follow,doesCurrentUserSubscribe:e.does_current_user_subscribe,doesFollowCurrentUser:e.does_follow_current_user,handleLc:e.handle_lc,updatedAt:e.updated_at,coverPhotoSizes:v(e,"cover_photo_sizes")?e.cover_photo_sizes:void 0,coverPhotoCids:v(e,"cover_photo_cids")?V(e.cover_photo_cids):void 0,coverPhotoLegacy:v(e,"cover_photo_legacy")?e.cover_photo_legacy:void 0,profilePictureSizes:v(e,"profile_picture_sizes")?e.profile_picture_sizes:void 0,profilePictureCids:v(e,"profile_picture_cids")?G(e.profile_picture_cids):void 0,profilePictureLegacy:v(e,"profile_picture_legacy")?e.profile_picture_legacy:void 0,hasCollectibles:e.has_collectibles,playlistLibrary:v(e,"playlist_library")?K(e.playlist_library):void 0,allowAiAttribution:e.allow_ai_attribution,profileType:v(e,"profile_type")?e.profile_type:void 0}}function Q(e){return function(e,t){if(null==e)return e;return{user:J(e.user),playlists:e.playlists.map(H),playlistLibrary:v(e,"playlist_library")?K(e.playlist_library):void 0,trackSaveCount:e.track_save_count}}(e)}function ee(e){return te(e,!1)}function te(e,t){if(null==e)return e;if(!t){if("collection_activity_without_tracks"===e._class)return Lt(e,!0);if("track_activity"===e._class)return Br(e,!0)}return{timestamp:e.timestamp,itemType:e.item_type,item:e.item,_class:e.class}}function ne(e){if(void 0!==e)return null===e?null:{manager_user_id:e.managerUserId}}function re(e){return function(e,t){if(null==e)return e;return{playlistId:e.playlist_id,playlistName:e.playlist_name,permalink:e.permalink}}(e)}function ie(e){return function(e,t){if(null==e)return e;return{favoriteItemId:e.favorite_item_id,favoriteType:e.favorite_type,userId:e.user_id,createdAt:e.created_at}}(e)}function oe(e){return function(e,t){if(null==e)return e;return{metadataTimestamp:v(e,"metadata_timestamp")?e.metadata_timestamp:void 0,timestamp:e.timestamp,trackId:e.track_id}}(e)}function se(e){if(void 0!==e)return null===e?null:{metadata_timestamp:e.metadataTimestamp,timestamp:e.timestamp,track_id:e.trackId}}function ae(e){return function(e,t){if(null==e)return e;return{_150x150:v(e,"150x150")?e["150x150"]:void 0,_480x480:v(e,"480x480")?e["480x480"]:void 0,_1000x1000:v(e,"1000x1000")?e["1000x1000"]:void 0,mirrors:v(e,"mirrors")?e.mirrors:void 0}}(e)}function ue(e){return function(e,t){if(null==e)return e;return{repostItemId:e.repost_item_id,repostType:e.repost_type,userId:e.user_id}}(e)}function ce(e){return function(e,t){if(null==e)return e;return{_150x150:v(e,"150x150")?e["150x150"]:void 0,_480x480:v(e,"480x480")?e["480x480"]:void 0,_1000x1000:v(e,"1000x1000")?e["1000x1000"]:void 0,mirrors:v(e,"mirrors")?e.mirrors:void 0}}(e)}function de(e){return function(e,t){if(null==e)return e;return{year:e.year,text:e.text}}(e)}function le(e){return function(e,t){if(null==e)return e;return{name:e.name,roles:e.roles,sequenceNumber:v(e,"sequence_number")?e.sequence_number:void 0}}(e)}function he(e){if(void 0!==e)return null===e?null:{name:e.name,roles:e.roles,sequence_number:e.sequenceNumber}}function fe(e){return function(e,t){if(null==e)return e;return{name:e.name,roles:e.roles,rightsShareUnknown:v(e,"rights_share_unknown")?e.rights_share_unknown:void 0}}(e)}function pe(e){if(void 0!==e)return null===e?null:{name:e.name,roles:e.roles,rights_share_unknown:e.rightsShareUnknown}}function ge(e){return function(e,t){if(null==e)return e;return{mood:e.mood,tags:e.tags,genre:e.genre,share:e.share,playCount:e.play_count,remixes:e.remixes}}(e)}function me(e){if(void 0!==e)return null===e?null:{mood:e.mood,tags:e.tags,genre:e.genre,share:e.share,play_count:e.playCount,remixes:e.remixes}}function ye(e){return function(e,t){if(null==e)return e;return{parentTrackId:e.parent_track_id,user:J(e.user),hasRemixAuthorReposted:e.has_remix_author_reposted,hasRemixAuthorSaved:e.has_remix_author_saved}}(e)}function we(e){return function(e,t){if(null==e)return e;return{tracks:v(e,"tracks")?e.tracks.map(ye):void 0}}(e)}function ve(e){return function(e,t){if(null==e)return e;return{category:e.category,parentTrackId:e.parent_track_id}}(e)}function be(e){if(void 0!==e)return null===e?null:{category:e.category,parent_track_id:e.parentTrackId}}function _e(e){return function(e,t){if(null==e)return e;return{_150x150:v(e,"150x150")?e["150x150"]:void 0,_480x480:v(e,"480x480")?e["480x480"]:void 0,_1000x1000:v(e,"1000x1000")?e["1000x1000"]:void 0,mirrors:v(e,"mirrors")?e.mirrors:void 0}}(e)}function Ae(e){return function(e,t){if(null==e)return e;return{duration:e.duration,multihash:e.multihash}}(e)}function Ee(e){return function(e,t){if(null==e)return e;return{url:v(e,"url")?e.url:void 0,mirrors:e.mirrors}}(e)}function ke(e){let t=!0;return t=t&&"artwork"in e&&void 0!==e.artwork,t=t&&"genre"in e&&void 0!==e.genre,t=t&&"id"in e&&void 0!==e.id,t=t&&"isOriginalAvailable"in e&&void 0!==e.isOriginalAvailable,t=t&&"remixOf"in e&&void 0!==e.remixOf,t=t&&"repostCount"in e&&void 0!==e.repostCount,t=t&&"favoriteCount"in e&&void 0!==e.favoriteCount,t=t&&"commentCount"in e&&void 0!==e.commentCount,t=t&&"title"in e&&void 0!==e.title,t=t&&"user"in e&&void 0!==e.user,t=t&&"duration"in e&&void 0!==e.duration,t=t&&"isDownloadable"in e&&void 0!==e.isDownloadable,t=t&&"playCount"in e&&void 0!==e.playCount,t=t&&"permalink"in e&&void 0!==e.permalink,t=t&&"access"in e&&void 0!==e.access,t=t&&"blocknumber"in e&&void 0!==e.blocknumber,t=t&&"coverArtSizes"in e&&void 0!==e.coverArtSizes,t=t&&"createdAt"in e&&void 0!==e.createdAt,t=t&&"fieldVisibility"in e&&void 0!==e.fieldVisibility,t=t&&"followeeReposts"in e&&void 0!==e.followeeReposts,t=t&&"hasCurrentUserReposted"in e&&void 0!==e.hasCurrentUserReposted,t=t&&"isScheduledRelease"in e&&void 0!==e.isScheduledRelease,t=t&&"isUnlisted"in e&&void 0!==e.isUnlisted,t=t&&"hasCurrentUserSaved"in e&&void 0!==e.hasCurrentUserSaved,t=t&&"followeeFavorites"in e&&void 0!==e.followeeFavorites,t=t&&"routeId"in e&&void 0!==e.routeId,t=t&&"trackSegments"in e&&void 0!==e.trackSegments,t=t&&"updatedAt"in e&&void 0!==e.updatedAt,t=t&&"userId"in e&&void 0!==e.userId,t=t&&"isDelete"in e&&void 0!==e.isDelete,t=t&&"isAvailable"in e&&void 0!==e.isAvailable,t=t&&"isStreamGated"in e&&void 0!==e.isStreamGated,t=t&&"isDownloadGated"in e&&void 0!==e.isDownloadGated,t=t&&"isOwnedByUser"in e&&void 0!==e.isOwnedByUser,t=t&&"stream"in e&&void 0!==e.stream,t=t&&"download"in e&&void 0!==e.download,t=t&&"preview"in e&&void 0!==e.preview,t}function Ie(e){return Se(e)}function Se(e,t){return null==e?e:{artwork:_e(e.artwork),description:v(e,"description")?e.description:void 0,genre:e.genre,id:e.id,trackCid:v(e,"track_cid")?e.track_cid:void 0,previewCid:v(e,"preview_cid")?e.preview_cid:void 0,origFileCid:v(e,"orig_file_cid")?e.orig_file_cid:void 0,origFilename:v(e,"orig_filename")?e.orig_filename:void 0,isOriginalAvailable:e.is_original_available,mood:v(e,"mood")?e.mood:void 0,releaseDate:v(e,"release_date")?new Date(e.release_date):void 0,remixOf:we(e.remix_of),repostCount:e.repost_count,favoriteCount:e.favorite_count,commentCount:e.comment_count,tags:v(e,"tags")?e.tags:void 0,title:e.title,user:J(e.user),duration:e.duration,isDownloadable:e.is_downloadable,playCount:e.play_count,permalink:e.permalink,isStreamable:v(e,"is_streamable")?e.is_streamable:void 0,ddexApp:v(e,"ddex_app")?e.ddex_app:void 0,playlistsContainingTrack:v(e,"playlists_containing_track")?e.playlists_containing_track:void 0,pinnedCommentId:v(e,"pinned_comment_id")?e.pinned_comment_id:void 0,albumBacklink:v(e,"album_backlink")?re(e.album_backlink):void 0,access:I(e.access),blocknumber:e.blocknumber,createDate:v(e,"create_date")?e.create_date:void 0,coverArtSizes:e.cover_art_sizes,coverArtCids:v(e,"cover_art_cids")?ce(e.cover_art_cids):void 0,createdAt:e.created_at,creditsSplits:v(e,"credits_splits")?e.credits_splits:void 0,isrc:v(e,"isrc")?e.isrc:void 0,license:v(e,"license")?e.license:void 0,iswc:v(e,"iswc")?e.iswc:void 0,fieldVisibility:ge(e.field_visibility),followeeReposts:e.followee_reposts.map(ue),hasCurrentUserReposted:e.has_current_user_reposted,isScheduledRelease:e.is_scheduled_release,isUnlisted:e.is_unlisted,hasCurrentUserSaved:e.has_current_user_saved,followeeFavorites:e.followee_favorites.map(ie),routeId:e.route_id,stemOf:v(e,"stem_of")?ve(e.stem_of):void 0,trackSegments:e.track_segments.map(Ae),updatedAt:e.updated_at,userId:e.user_id,isDelete:e.is_delete,coverArt:v(e,"cover_art")?e.cover_art:void 0,isAvailable:e.is_available,aiAttributionUserId:v(e,"ai_attribution_user_id")?e.ai_attribution_user_id:void 0,allowedApiKeys:v(e,"allowed_api_keys")?e.allowed_api_keys:void 0,audioUploadId:v(e,"audio_upload_id")?e.audio_upload_id:void 0,previewStartSeconds:v(e,"preview_start_seconds")?e.preview_start_seconds:void 0,bpm:v(e,"bpm")?e.bpm:void 0,isCustomBpm:v(e,"is_custom_bpm")?e.is_custom_bpm:void 0,musicalKey:v(e,"musical_key")?e.musical_key:void 0,isCustomMusicalKey:v(e,"is_custom_musical_key")?e.is_custom_musical_key:void 0,audioAnalysisErrorCount:v(e,"audio_analysis_error_count")?e.audio_analysis_error_count:void 0,commentsDisabled:v(e,"comments_disabled")?e.comments_disabled:void 0,ddexReleaseIds:v(e,"ddex_release_ids")?e.ddex_release_ids:void 0,artists:v(e,"artists")?e.artists:void 0,resourceContributors:v(e,"resource_contributors")?null===e.resource_contributors?null:e.resource_contributors.map(le):void 0,indirectResourceContributors:v(e,"indirect_resource_contributors")?null===e.indirect_resource_contributors?null:e.indirect_resource_contributors.map(le):void 0,rightsController:v(e,"rights_controller")?fe(e.rights_controller):void 0,copyrightLine:v(e,"copyright_line")?de(e.copyright_line):void 0,producerCopyrightLine:v(e,"producer_copyright_line")?de(e.producer_copyright_line):void 0,parentalWarningType:v(e,"parental_warning_type")?e.parental_warning_type:void 0,isStreamGated:e.is_stream_gated,accessAuthorities:v(e,"access_authorities")?e.access_authorities:void 0,streamConditions:v(e,"stream_conditions")?F(e.stream_conditions):void 0,isDownloadGated:e.is_download_gated,downloadConditions:v(e,"download_conditions")?F(e.download_conditions):void 0,coverOriginalSongTitle:v(e,"cover_original_song_title")?e.cover_original_song_title:void 0,coverOriginalArtist:v(e,"cover_original_artist")?e.cover_original_artist:void 0,isOwnedByUser:e.is_owned_by_user,stream:Ee(e.stream),download:Ee(e.download),preview:Ee(e.preview)}}function Ce(e){return function(e,t){if(null==e)return e;return{artwork:v(e,"artwork")?ae(e.artwork):void 0,description:v(e,"description")?e.description:void 0,permalink:e.permalink,id:e.id,isAlbum:e.is_album,isImageAutogenerated:e.is_image_autogenerated,playlistName:e.playlist_name,playlistContents:e.playlist_contents.map(oe),repostCount:e.repost_count,favoriteCount:e.favorite_count,totalPlayCount:e.total_play_count,user:J(e.user),ddexApp:v(e,"ddex_app")?e.ddex_app:void 0,access:I(e.access),upc:v(e,"upc")?e.upc:void 0,trackCount:e.track_count,blocknumber:e.blocknumber,createdAt:e.created_at,followeeReposts:e.followee_reposts.map(ue),followeeFavorites:e.followee_favorites.map(ie),hasCurrentUserReposted:e.has_current_user_reposted,hasCurrentUserSaved:e.has_current_user_saved,isDelete:e.is_delete,isPrivate:e.is_private,updatedAt:e.updated_at,addedTimestamps:e.added_timestamps.map(oe),userId:e.user_id,tracks:v(e,"tracks")?e.tracks.map(Ie):void 0,coverArt:v(e,"cover_art")?e.cover_art:void 0,coverArtSizes:v(e,"cover_art_sizes")?e.cover_art_sizes:void 0,coverArtCids:v(e,"cover_art_cids")?ae(e.cover_art_cids):void 0,isStreamGated:e.is_stream_gated,streamConditions:v(e,"stream_conditions")?F(e.stream_conditions):void 0,isScheduledRelease:e.is_scheduled_release,releaseDate:v(e,"release_date")?e.release_date:void 0,ddexReleaseIds:v(e,"ddex_release_ids")?e.ddex_release_ids:void 0,artists:v(e,"artists")?e.artists:void 0,copyrightLine:v(e,"copyright_line")?e.copyright_line:void 0,producerCopyrightLine:v(e,"producer_copyright_line")?e.producer_copyright_line:void 0,parentalWarningType:v(e,"parental_warning_type")?e.parental_warning_type:void 0}}(e)}function xe(e){return function(e,t){if(null==e)return e;return{service:e.service,version:e.version}}(e)}function Be(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ce):void 0}}(e)}function Te(e){return function(e,t){if(null==e)return e;return{title:e.title,pushBody:e.push_body,shortDescription:e.short_description,longDescription:e.long_description,route:e.route}}(e)}function Re(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Te(e.data)}}(e)}function De(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Re)}}function Pe(e){if(void 0!==e)return null===e?null:{grantor_user_id:e.grantorUserId}}function Ue(e){return function(e,t){if(null==e)return e;return{userId:e.user_id,granteeUserId:e.grantee_user_id,granteeAddress:e.grantee_address}}(e)}function Oe(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Ue(e.data)}}(e)}function Fe(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Oe)}}function Me(e){return function(e,t){if(null==e)return e;return{unclaimedFees:v(e,"unclaimed_fees")?e.unclaimed_fees:void 0,totalFees:v(e,"total_fees")?e.total_fees:void 0}}(e)}function Le(e){return function(e,t){if(null==e)return e;return{address:v(e,"address")?e.address:void 0,locked:v(e,"locked")?e.locked:void 0,unlocked:v(e,"unlocked")?e.unlocked:void 0,claimable:v(e,"claimable")?e.claimable:void 0}}(e)}function qe(e){return function(e,t){if(null==e)return e;return{entityId:e.entity_id}}(e)}function ze(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:qe(e.data)}}(e)}function Ne(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ze)}}function je(e){return function(e,t){if(null==e)return e;return{entityUserId:e.entity_user_id,entityId:e.entity_id}}(e)}function $e(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:je(e.data)}}(e)}function We(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map($e)}}function He(e){return function(e,t){if(null==e)return e;return{eventId:e.event_id,milestone:e.milestone,entityId:e.entity_id}}(e)}function Ke(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:He(e.data)}}(e)}function Ve(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Ke)}}function Ge(e){return function(e,t){if(null==e)return e;return{ownerWallet:e.owner_wallet,attestation:e.attestation}}(e)}function Ze(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Ge(e.data):void 0}}(e)}function Ye(e){return function(e,t){if(null==e)return e;return{address:e.address,name:e.name,description:v(e,"description")?e.description:void 0,imageUrl:v(e,"image_url")?e.image_url:void 0,grantorUserId:e.grantor_user_id,grantCreatedAt:e.grant_created_at,grantUpdatedAt:e.grant_updated_at}}(e)}function Je(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Ye):void 0}}(e)}function Xe(e){return function(e,t){if(null==e)return e;return{timestamp:e.timestamp,balanceUsd:e.balance_usd}}(e)}function Qe(e){return function(e,t){if(null==e)return e;return{data:e.data.map(Xe)}}(e)}function et(e){return function(e,t){if(null==e)return e;return{contentId:e.content_id,contentType:v(e,"content_type")?e.content_type:void 0,title:e.title,ownerId:e.owner_id}}(e)}function tt(e){let t=!0;return t=t&&"permalink"in e&&void 0!==e.permalink,t=t&&"id"in e&&void 0!==e.id,t=t&&"isAlbum"in e&&void 0!==e.isAlbum,t=t&&"isImageAutogenerated"in e&&void 0!==e.isImageAutogenerated,t=t&&"playlistName"in e&&void 0!==e.playlistName,t=t&&"playlistContents"in e&&void 0!==e.playlistContents,t=t&&"repostCount"in e&&void 0!==e.repostCount,t=t&&"favoriteCount"in e&&void 0!==e.favoriteCount,t=t&&"totalPlayCount"in e&&void 0!==e.totalPlayCount,t=t&&"user"in e&&void 0!==e.user,t=t&&"access"in e&&void 0!==e.access,t=t&&"trackCount"in e&&void 0!==e.trackCount,t=t&&"blocknumber"in e&&void 0!==e.blocknumber,t=t&&"createdAt"in e&&void 0!==e.createdAt,t=t&&"followeeReposts"in e&&void 0!==e.followeeReposts,t=t&&"followeeFavorites"in e&&void 0!==e.followeeFavorites,t=t&&"hasCurrentUserReposted"in e&&void 0!==e.hasCurrentUserReposted,t=t&&"hasCurrentUserSaved"in e&&void 0!==e.hasCurrentUserSaved,t=t&&"isDelete"in e&&void 0!==e.isDelete,t=t&&"isPrivate"in e&&void 0!==e.isPrivate,t=t&&"updatedAt"in e&&void 0!==e.updatedAt,t=t&&"addedTimestamps"in e&&void 0!==e.addedTimestamps,t=t&&"userId"in e&&void 0!==e.userId,t=t&&"isStreamGated"in e&&void 0!==e.isStreamGated,t=t&&"isScheduledRelease"in e&&void 0!==e.isScheduledRelease,t}function nt(e){return rt(e)}function rt(e,t){return null==e?e:{artwork:v(e,"artwork")?ae(e.artwork):void 0,description:v(e,"description")?e.description:void 0,permalink:e.permalink,id:e.id,isAlbum:e.is_album,isImageAutogenerated:e.is_image_autogenerated,playlistName:e.playlist_name,playlistContents:e.playlist_contents.map(oe),repostCount:e.repost_count,favoriteCount:e.favorite_count,totalPlayCount:e.total_play_count,user:J(e.user),ddexApp:v(e,"ddex_app")?e.ddex_app:void 0,access:I(e.access),upc:v(e,"upc")?e.upc:void 0,trackCount:e.track_count,blocknumber:e.blocknumber,createdAt:e.created_at,followeeReposts:e.followee_reposts.map(ue),followeeFavorites:e.followee_favorites.map(ie),hasCurrentUserReposted:e.has_current_user_reposted,hasCurrentUserSaved:e.has_current_user_saved,isDelete:e.is_delete,isPrivate:e.is_private,updatedAt:e.updated_at,addedTimestamps:e.added_timestamps.map(oe),userId:e.user_id,tracks:v(e,"tracks")?e.tracks.map(Ie):void 0,coverArt:v(e,"cover_art")?e.cover_art:void 0,coverArtSizes:v(e,"cover_art_sizes")?e.cover_art_sizes:void 0,coverArtCids:v(e,"cover_art_cids")?ae(e.cover_art_cids):void 0,isStreamGated:e.is_stream_gated,streamConditions:v(e,"stream_conditions")?F(e.stream_conditions):void 0,isScheduledRelease:e.is_scheduled_release,releaseDate:v(e,"release_date")?new Date(e.release_date):void 0,ddexReleaseIds:v(e,"ddex_release_ids")?e.ddex_release_ids:void 0,artists:v(e,"artists")?e.artists:void 0,copyrightLine:v(e,"copyright_line")?e.copyright_line:void 0,producerCopyrightLine:v(e,"producer_copyright_line")?e.producer_copyright_line:void 0,parentalWarningType:v(e,"parental_warning_type")?e.parental_warning_type:void 0}}function it(e){return function(e,t){if(null==e)return e;return{users:v(e,"users")?e.users.map(J):void 0,tracks:v(e,"tracks")?e.tracks.map(Ie):void 0,playlists:v(e,"playlists")?e.playlists.map(nt):void 0}}(e)}function ot(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(et):void 0,related:v(e,"related")?it(e.related):void 0}}(e)}function st(e){return function(e,t){if(null==e)return e;return{size:e.size,contentType:e.content_type}}(e)}function at(e){return function(e,t){if(null==e)return e;return{userId:e.user_id,subscriberIds:v(e,"subscriber_ids")?e.subscriber_ids:void 0}}(e)}function ut(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(at):void 0}}(e)}function ct(e){return function(e,t){if(null==e)return e;return{challengeId:e.challenge_id,userId:e.user_id,specifier:v(e,"specifier")?e.specifier:void 0,isComplete:e.is_complete,isActive:e.is_active,isDisbursed:e.is_disbursed,currentStepCount:v(e,"current_step_count")?e.current_step_count:void 0,maxSteps:v(e,"max_steps")?e.max_steps:void 0,challengeType:e.challenge_type,amount:e.amount,disbursedAmount:e.disbursed_amount,cooldownDays:v(e,"cooldown_days")?e.cooldown_days:void 0,metadata:e.metadata}}(e)}function dt(e){return function(e,t){if(null==e)return e;return{amount:e.amount,specifier:e.specifier,challengeId:e.challenge_id,listenStreak:v(e,"listen_streak")?e.listen_streak:void 0}}(e)}function lt(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:dt(e.data)}}(e)}function ht(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(lt)}}function ft(e){if(void 0!==e)return null===e?null:{challengeId:e.challengeId,specifier:e.specifier,userId:e.userId}}function pt(e){return function(e,t){if(null==e)return e;return{challengeId:e.challengeId,specifier:e.specifier,amount:v(e,"amount")?e.amount:void 0,signatures:v(e,"signatures")?e.signatures:void 0,error:v(e,"error")?e.error:void 0}}(e)}function gt(e){return function(e,t){if(null==e)return e;return{data:e.data.map(pt)}}(e)}function mt(e){return function(e,t){if(null==e)return e;return{amount:e.amount,specifier:e.specifier,challengeId:e.challenge_id}}(e)}function yt(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:mt(e.data)}}(e)}function wt(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(yt)}}function vt(e){return function(e,t){if(null==e)return e;return{id:e.id,wallet:e.wallet,signature:e.signature,mint:e.mint,amount:e.amount,prizeId:e.prize_id,prizeName:e.prize_name,prizeType:v(e,"prize_type")?e.prize_type:void 0,createdAt:new Date(e.created_at)}}(e)}function bt(e){return function(e,t){if(null==e)return e;return{data:e.data.map(vt)}}(e)}function _t(e){return function(e,t){if(null==e)return e;return{address:v(e,"address")?e.address:void 0,price:v(e,"price")?e.price:void 0,priceUSD:v(e,"priceUSD")?e.priceUSD:void 0,curveProgress:v(e,"curveProgress")?e.curveProgress:void 0,isMigrated:v(e,"isMigrated")?e.isMigrated:void 0,creatorQuoteFee:v(e,"creatorQuoteFee")?e.creatorQuoteFee:void 0,totalTradingQuoteFee:v(e,"totalTradingQuoteFee")?e.totalTradingQuoteFee:void 0,creatorWalletAddress:v(e,"creatorWalletAddress")?e.creatorWalletAddress:void 0}}(e)}function At(e){return function(e,t){if(null==e)return e;return{address:v(e,"address")?e.address:void 0,balance:v(e,"balance")?e.balance:void 0}}(e)}function Et(e){return function(e,t){if(null==e)return e;return{mint:e.mint,ticker:e.ticker,decimals:e.decimals,name:e.name,logoUri:v(e,"logo_uri")?e.logo_uri:void 0,bannerImageUrl:v(e,"banner_image_url")?e.banner_image_url:void 0,description:v(e,"description")?e.description:void 0,xHandle:v(e,"x_handle")?e.x_handle:void 0,instagramHandle:v(e,"instagram_handle")?e.instagram_handle:void 0,tiktokHandle:v(e,"tiktok_handle")?e.tiktok_handle:void 0,website:v(e,"website")?e.website:void 0,link1:v(e,"link_1")?e.link_1:void 0,link2:v(e,"link_2")?e.link_2:void 0,link3:v(e,"link_3")?e.link_3:void 0,link4:v(e,"link_4")?e.link_4:void 0,hasDiscord:v(e,"has_discord")?e.has_discord:void 0,createdAt:new Date(e.created_at),updatedAt:v(e,"updated_at")?new Date(e.updated_at):void 0,ownerId:v(e,"owner_id")?e.owner_id:void 0,escrowRecipient:v(e,"escrow_recipient")?e.escrow_recipient:void 0,dynamicBondingCurve:v(e,"dynamicBondingCurve")?_t(e.dynamicBondingCurve):void 0,artistLocker:v(e,"artist_locker")?Le(e.artist_locker):void 0,artistFees:v(e,"artist_fees")?Me(e.artist_fees):void 0,rewardPool:v(e,"reward_pool")?At(e.reward_pool):void 0,price:v(e,"price")?e.price:void 0,marketCap:v(e,"marketCap")?e.marketCap:void 0,totalVolumeUSD:v(e,"totalVolumeUSD")?e.totalVolumeUSD:void 0,holder:v(e,"holder")?e.holder:void 0,totalSupply:v(e,"totalSupply")?e.totalSupply:void 0,liquidity:v(e,"liquidity")?e.liquidity:void 0,circulatingSupply:v(e,"circulatingSupply")?e.circulatingSupply:void 0,priceChange24hPercent:v(e,"priceChange24hPercent")?e.priceChange24hPercent:void 0,displayPrice:v(e,"displayPrice")?e.displayPrice:void 0,displayMarketCap:v(e,"displayMarketCap")?e.displayMarketCap:void 0}}(e)}function kt(e){return function(e,t){if(null==e)return e;return{address:e.address,price:e.price,priceUSD:e.priceUSD,curveProgress:e.curveProgress,isMigrated:v(e,"isMigrated")?e.isMigrated:void 0,creatorQuoteFee:e.creatorQuoteFee,totalTradingQuoteFee:e.totalTradingQuoteFee,creatorWalletAddress:e.creatorWalletAddress}}(e)}function It(e){return function(e,t){if(null==e)return e;return{coingeckoId:v(e,"coingeckoId")?e.coingeckoId:void 0,description:v(e,"description")?e.description:void 0,twitter:v(e,"twitter")?e.twitter:void 0,website:v(e,"website")?e.website:void 0,discord:v(e,"discord")?e.discord:void 0}}(e)}function St(e){return function(e,t){if(null==e)return e;return{address:v(e,"address")?e.address:void 0,decimals:v(e,"decimals")?e.decimals:void 0,symbol:v(e,"symbol")?e.symbol:void 0,name:v(e,"name")?e.name:void 0,marketCap:e.marketCap,fdv:e.fdv,extensions:v(e,"extensions")?It(e.extensions):void 0,liquidity:e.liquidity,lastTradeUnixTime:e.lastTradeUnixTime,lastTradeHumanTime:e.lastTradeHumanTime,price:e.price,history24hPrice:e.history24hPrice,priceChange24hPercent:e.priceChange24hPercent,uniqueWallet24h:e.uniqueWallet24h,uniqueWalletHistory24h:e.uniqueWalletHistory24h,uniqueWallet24hChangePercent:e.uniqueWallet24hChangePercent,totalSupply:e.totalSupply,circulatingSupply:e.circulatingSupply,holder:e.holder,trade24h:e.trade24h,tradeHistory24h:e.tradeHistory24h,trade24hChangePercent:e.trade24hChangePercent,sell24h:e.sell24h,sellHistory24h:e.sellHistory24h,sell24hChangePercent:e.sell24hChangePercent,buy24h:e.buy24h,buyHistory24h:e.buyHistory24h,buy24hChangePercent:e.buy24hChangePercent,v24h:e.v24h,v24hUSD:e.v24hUSD,vHistory24h:e.vHistory24h,vHistory24hUSD:v(e,"vHistory24hUSD")?e.vHistory24hUSD:void 0,v24hChangePercent:v(e,"v24hChangePercent")?e.v24hChangePercent:void 0,vBuy24h:v(e,"vBuy24h")?e.vBuy24h:void 0,vBuy24hUSD:v(e,"vBuy24hUSD")?e.vBuy24hUSD:void 0,vBuyHistory24h:v(e,"vBuyHistory24h")?e.vBuyHistory24h:void 0,vBuyHistory24hUSD:v(e,"vBuyHistory24hUSD")?e.vBuyHistory24hUSD:void 0,vBuy24hChangePercent:v(e,"vBuy24hChangePercent")?e.vBuy24hChangePercent:void 0,vSell24h:v(e,"vSell24h")?e.vSell24h:void 0,vSell24hUSD:v(e,"vSell24hUSD")?e.vSell24hUSD:void 0,vSellHistory24h:v(e,"vSellHistory24h")?e.vSellHistory24h:void 0,vSellHistory24hUSD:v(e,"vSellHistory24hUSD")?e.vSellHistory24hUSD:void 0,vSell24hChangePercent:v(e,"vSell24hChangePercent")?e.vSell24hChangePercent:void 0,numberMarkets:v(e,"numberMarkets")?e.numberMarkets:void 0,totalVolume:e.totalVolume,totalVolumeUSD:e.totalVolumeUSD,volumeBuy:e.volumeBuy,volumeBuyUSD:e.volumeBuyUSD,volumeSell:e.volumeSell,volumeSellUSD:e.volumeSellUSD,totalTrade:e.totalTrade,buy:e.buy,sell:e.sell,dynamicBondingCurve:kt(e.dynamicBondingCurve)}}(e)}function Ct(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?St(e.data):void 0}}(e)}function xt(e){return function(e,t){if(null==e)return e;return{balance:e.balance,userId:e.user_id}}(e)}function Bt(e){return function(e,t){if(null==e)return e;return{data:e.data}}(e)}function Tt(e){return function(e,t){if(null==e)return e;return{data:e.data.map(xt)}}(e)}function Rt(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Et(e.data):void 0}}(e)}function Dt(e){return function(e,t){if(null==e)return e;return{data:e.data.map(Et)}}(e)}function Pt(e){return function(e,t){if(null==e)return e;return{address:e.address,volume:e.volume,user:v(e,"user")?J(e.user):void 0}}(e)}function Ut(e){return function(e,t){if(null==e)return e;return{data:e.data.map(Pt)}}(e)}function Ot(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data:void 0}}(e)}function Ft(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Ot(e.data):void 0}}(e)}function Mt(e){return Lt(e,!1)}function Lt(e,t){return null==e?e:{...te(e,t),itemType:e.item_type,item:Ce(e.item)}}function qt(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Mt):void 0}}(e)}function zt(e){return function(e,t){return e}(e)}function Nt(e){return function(e,t){if(null==e)return e;return{userId:e.user_id,handle:e.handle}}(e)}function jt(e){return function(e,t){if(null==e)return e;return{id:e.id,entityId:e.entity_id,entityType:zt(e.entity_type),userId:e.user_id,message:e.message,mentions:v(e,"mentions")?e.mentions.map(Nt):void 0,trackTimestampS:v(e,"track_timestamp_s")?e.track_timestamp_s:void 0,reactCount:e.react_count,isEdited:e.is_edited,isCurrentUserReacted:v(e,"is_current_user_reacted")?e.is_current_user_reacted:void 0,isArtistReacted:v(e,"is_artist_reacted")?e.is_artist_reacted:void 0,createdAt:e.created_at,updatedAt:v(e,"updated_at")?e.updated_at:void 0,parentCommentId:v(e,"parent_comment_id")?e.parent_comment_id:void 0}}(e)}function $t(e){return function(e,t){if(null==e)return e;return{id:e.id,entityId:e.entity_id,entityType:zt(e.entity_type),userId:v(e,"user_id")?e.user_id:void 0,message:e.message,mentions:v(e,"mentions")?e.mentions.map(Nt):void 0,trackTimestampS:v(e,"track_timestamp_s")?e.track_timestamp_s:void 0,reactCount:e.react_count,replyCount:e.reply_count,isEdited:e.is_edited,isCurrentUserReacted:v(e,"is_current_user_reacted")?e.is_current_user_reacted:void 0,isArtistReacted:v(e,"is_artist_reacted")?e.is_artist_reacted:void 0,isTombstone:v(e,"is_tombstone")?e.is_tombstone:void 0,isMuted:v(e,"is_muted")?e.is_muted:void 0,createdAt:e.created_at,updatedAt:v(e,"updated_at")?e.updated_at:void 0,replies:v(e,"replies")?e.replies.map(jt):void 0,parentCommentId:v(e,"parent_comment_id")?e.parent_comment_id:void 0}}(e)}function Wt(e){return function(e,t){if(null==e)return e;return{type:e.type,entityId:e.entity_id,entityUserId:e.entity_user_id,commentUserId:e.comment_user_id,commentId:v(e,"comment_id")?e.comment_id:void 0}}(e)}function Ht(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Wt(e.data)}}(e)}function Kt(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Ht)}}function Vt(e){return function(e,t){if(null==e)return e;return{type:e.type,entityId:e.entity_id,commentUserId:e.comment_user_id,commentId:v(e,"comment_id")?e.comment_id:void 0}}(e)}function Gt(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Vt(e.data)}}(e)}function Zt(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Gt)}}function Yt(e){return function(e,t){if(null==e)return e;return{isMuted:e.is_muted}}(e)}function Jt(e){return function(e,t){if(null==e)return e;return{type:e.type,entityId:e.entity_id,entityUserId:e.entity_user_id,reacterUserId:e.reacter_user_id,commentId:v(e,"comment_id")?e.comment_id:void 0}}(e)}function Xt(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Jt(e.data)}}(e)}function Qt(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Xt)}}function en(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(jt):void 0,related:v(e,"related")?it(e.related):void 0}}(e)}function tn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map($t):void 0}}(e)}function nn(e){return function(e,t){if(null==e)return e;return{type:e.type,entityId:e.entity_id,entityUserId:e.entity_user_id,commentUserId:e.comment_user_id,commentId:v(e,"comment_id")?e.comment_id:void 0}}(e)}function rn(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:nn(e.data)}}(e)}function on(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(rn)}}function sn(e){return function(e,t){if(null==e)return e;return{ercWallets:e.erc_wallets,splWallets:e.spl_wallets}}(e)}function an(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?sn(e.data):void 0}}(e)}function un(e){return function(e,t){if(null==e)return e;return{parentTrackId:e.parent_track_id,trackId:e.track_id,trackOwnerId:e.track_owner_id}}(e)}function cn(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:un(e.data)}}(e)}function dn(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(cn)}}function ln(e){return function(e,t){if(null==e)return e;return{apiAccessKey:e.api_access_key}}(e)}function hn(e){if(void 0!==e)return null===e?null:{mint:e.mint,ticker:e.ticker,decimals:e.decimals,name:e.name,logo_uri:e.logoUri,banner_image_url:e.bannerImageUrl,description:e.description,link_1:e.link1,link_2:e.link2,link_3:e.link3,link_4:e.link4}}function fn(e){return function(e,t){if(null==e)return e;return{mint:e.mint,ticker:e.ticker,userId:e.user_id,decimals:e.decimals,name:e.name,logoUri:v(e,"logo_uri")?e.logo_uri:void 0,bannerImageUrl:v(e,"banner_image_url")?e.banner_image_url:void 0,description:v(e,"description")?e.description:void 0,link1:v(e,"link_1")?e.link_1:void 0,link2:v(e,"link_2")?e.link_2:void 0,link3:v(e,"link_3")?e.link_3:void 0,link4:v(e,"link_4")?e.link_4:void 0,createdAt:new Date(e.created_at)}}(e)}function pn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?fn(e.data):void 0}}(e)}function gn(e){if(void 0!==e)return null===e?null:{entityType:e.entityType,entityId:e.entityId,body:e.body,commentId:e.commentId,parentId:e.parentId,trackTimestampS:e.trackTimestampS,mentions:e.mentions}}function mn(e){return function(e,t){if(null==e)return e;return{transactionHash:v(e,"transaction_hash")?e.transaction_hash:void 0,blockHash:v(e,"block_hash")?e.block_hash:void 0,blockNumber:v(e,"block_number")?e.block_number:void 0,commentId:v(e,"comment_id")?e.comment_id:void 0}}(e)}function yn(e){if(void 0!==e)return null===e?null:{name:e.name,description:e.description,image_url:e.imageUrl,redirect_uris:e.redirectUris}}function wn(e){return function(e,t){if(null==e)return e;return{apiKey:v(e,"api_key")?e.api_key:void 0,apiSecret:v(e,"api_secret")?e.api_secret:void 0,bearerToken:v(e,"bearer_token")?e.bearer_token:void 0,transactionHash:v(e,"transaction_hash")?e.transaction_hash:void 0,blockHash:v(e,"block_hash")?e.block_hash:void 0,blockNumber:v(e,"block_number")?e.block_number:void 0}}(e)}function vn(e){if(void 0!==e)return null===e?null:{app_api_key:e.appApiKey}}function bn(e,t){return null==e?e:{isAlbum:e.is_album,playlistId:e.playlist_id}}function _n(e,t){return null==e?e:{trackId:e.track_id}}function An(e){return function(e,t){if(null==e)return e;return{...bn(e),..._n(e)}}(e)}function En(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:An(e.data)}}(e)}function kn(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(En)}}function In(e){if(void 0!==e)return null===e?null:{year:e.year,text:e.text}}function Sn(e){if(void 0!==e)return null===e?null:{year:e.year,text:e.text}}function Cn(e){if(void 0!==e)return null===e?null:{playlist_id:e.playlistId,playlist_name:e.playlistName,description:e.description,is_private:e.isPrivate,is_album:e.isAlbum,genre:e.genre,mood:e.mood,tags:e.tags,license:e.license,upc:e.upc,release_date:void 0===e.releaseDate?void 0:e.releaseDate.toISOString().substr(0,10),playlist_image_sizes_multihash:e.playlistImageSizesMultihash,playlist_contents:void 0===e.playlistContents?void 0:e.playlistContents.map(se),is_stream_gated:e.isStreamGated,is_scheduled_release:e.isScheduledRelease,stream_conditions:M(e.streamConditions),ddex_app:e.ddexApp,ddex_release_ids:e.ddexReleaseIds,artists:void 0===e.artists?void 0:null===e.artists?null:e.artists.map(he),copyright_line:In(e.copyrightLine),producer_copyright_line:Sn(e.producerCopyrightLine),parental_warning_type:e.parentalWarningType,is_image_autogenerated:e.isImageAutogenerated}}function xn(e){return function(e,t){if(null==e)return e;return{transactionHash:v(e,"transaction_hash")?e.transaction_hash:void 0,blockHash:v(e,"block_hash")?e.block_hash:void 0,blockNumber:v(e,"block_number")?e.block_number:void 0,playlistId:v(e,"playlist_id")?e.playlist_id:void 0}}(e)}function Bn(e){if(void 0!==e)return null===e?null:{signature:e.signature,mint:e.mint,amount:e.amount}}function Tn(e){return function(e,t){if(null==e)return e;return{code:e.code,mint:e.mint,rewardAddress:e.reward_address,amount:e.amount}}(e)}function Rn(e){if(void 0!==e)return null===e?null:{parent_track_id:e.parentTrackId}}function Dn(e){if(void 0!==e)return null===e?null:{tracks:e.tracks.map(Rn)}}function Pn(e){if(void 0!==e)return null===e?null:{track_id:e.trackId,title:e.title,genre:e.genre,description:e.description,mood:e.mood,bpm:e.bpm,musical_key:e.musicalKey,tags:e.tags,license:e.license,isrc:e.isrc,iswc:e.iswc,release_date:void 0===e.releaseDate?void 0:e.releaseDate.toISOString().substr(0,10),track_cid:e.trackCid,orig_file_cid:e.origFileCid,orig_filename:e.origFilename,cover_art_sizes:e.coverArtSizes,preview_cid:e.previewCid,preview_start_seconds:e.previewStartSeconds,duration:e.duration,is_downloadable:e.isDownloadable,is_unlisted:e.isUnlisted,is_stream_gated:e.isStreamGated,access_authorities:e.accessAuthorities,stream_conditions:M(e.streamConditions),download_conditions:M(e.downloadConditions),field_visibility:me(e.fieldVisibility),placement_hosts:e.placementHosts,stem_of:be(e.stemOf),remix_of:Dn(e.remixOf),ddex_app:e.ddexApp,ddex_release_ids:e.ddexReleaseIds,artists:e.artists,resource_contributors:void 0===e.resourceContributors?void 0:null===e.resourceContributors?null:e.resourceContributors.map(he),indirect_resource_contributors:void 0===e.indirectResourceContributors?void 0:null===e.indirectResourceContributors?null:e.indirectResourceContributors.map(he),rights_controller:pe(e.rightsController),copyright_line:In(e.copyrightLine),producer_copyright_line:Sn(e.producerCopyrightLine),parental_warning_type:e.parentalWarningType,cover_original_song_title:e.coverOriginalSongTitle,cover_original_artist:e.coverOriginalArtist,is_owned_by_user:e.isOwnedByUser,territory_codes:e.territoryCodes,no_ai_use:e.noAiUse}}function Un(e){return function(e,t){if(null==e)return e;return{transactionHash:v(e,"transaction_hash")?e.transaction_hash:void 0,blockHash:v(e,"block_hash")?e.block_hash:void 0,blockNumber:v(e,"block_number")?e.block_number:void 0,trackId:v(e,"track_id")?e.track_id:void 0}}(e)}function On(e){if(void 0!==e)return null===e?null:{referrer:e.referrer,is_mobile_user:e.isMobileUser}}function Fn(e){if(void 0!==e)return null===e?null:function(e){let t=!0;return t=t&&"type"in e&&void 0!==e.type,t=t&&"playlistId"in e&&void 0!==e.playlistId,t}(e)?function(e){if(void 0!==e)return null===e?null:{type:e.type,playlist_id:e.playlistId}}(e):function(e){let t=!0;return t=t&&"id"in e&&void 0!==e.id,t=t&&"type"in e&&void 0!==e.type,t=t&&"name"in e&&void 0!==e.name,t=t&&"contents"in e&&void 0!==e.contents,t}(e)?function(e){if(void 0!==e)return null===e?null:{id:e.id,type:e.type,name:e.name,contents:e.contents.map(Fn)}}(e):function(e){let t=!0;return t=t&&"type"in e&&void 0!==e.type,t=t&&"playlistId"in e&&void 0!==e.playlistId,t}(e)?function(e){if(void 0!==e)return null===e?null:{type:e.type,playlist_id:e.playlistId}}(e):{}}function Mn(e){if(void 0!==e)return null===e?null:{contents:e.contents.map(Fn)}}function Ln(e){if(void 0!==e)return null===e?null:{user_id:e.userId,handle:e.handle,wallet:e.wallet,name:e.name,bio:e.bio,location:e.location,website:e.website,donation:e.donation,twitter_handle:e.twitterHandle,instagram_handle:e.instagramHandle,tiktok_handle:e.tiktokHandle,profile_picture:e.profilePicture,profile_picture_sizes:e.profilePictureSizes,cover_photo:e.coverPhoto,cover_photo_sizes:e.coverPhotoSizes,profile_type:e.profileType,allow_ai_attribution:e.allowAiAttribution,spl_usdc_payout_wallet:e.splUsdcPayoutWallet,playlist_library:Mn(e.playlistLibrary),events:On(e.events)}}function qn(e){return function(e,t){if(null==e)return e;return{transactionHash:v(e,"transaction_hash")?e.transaction_hash:void 0,blockHash:v(e,"block_hash")?e.block_hash:void 0,blockNumber:v(e,"block_number")?e.block_number:void 0,userId:v(e,"user_id")?e.user_id:void 0}}(e)}function zn(e){return function(e,t){if(null==e)return e;return{wallet:e.wallet,user:J(e.user)}}(e)}function Nn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(zn):void 0}}(e)}function jn(e){if(void 0!==e)return null===e?null:{api_access_key:e.apiAccessKey}}function $n(e){return function(e,t){if(null==e)return e;return{success:v(e,"success")?e.success:void 0}}(e)}function Wn(e){return function(e,t){if(null==e)return e;return{apiKey:e.apiKey,userId:e.userId,email:e.email,name:e.name,handle:e.handle,verified:e.verified,profilePicture:v(e,"profile_picture")?G(e.profile_picture):void 0,sub:e.sub,iat:e.iat}}(e)}function Hn(e){return function(e,t){if(null==e)return e;return{address:e.address,userId:e.user_id,name:e.name,description:v(e,"description")?e.description:void 0,imageUrl:v(e,"image_url")?e.image_url:void 0,redirectUris:v(e,"redirect_uris")?e.redirect_uris:void 0}}(e)}function Kn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Hn(e.data):void 0}}(e)}function Vn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Hn):void 0}}(e)}function Gn(e){return function(e,t){if(null==e)return e;return{id:e.id,emailOwnerUserId:e.email_owner_user_id,receivingUserId:e.receiving_user_id,grantorUserId:e.grantor_user_id,encryptedKey:e.encrypted_key,isInitial:e.is_initial,createdAt:e.created_at,updatedAt:e.updated_at}}(e)}function Zn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Gn(e.data):void 0}}(e)}function Yn(e){return function(e,t){if(null==e)return e;return{eventId:e.event_id,eventType:e.event_type,userId:e.user_id,entityType:v(e,"entity_type")?e.entity_type:void 0,entityId:v(e,"entity_id")?e.entity_id:void 0,endDate:v(e,"end_date")?e.end_date:void 0,isDeleted:v(e,"is_deleted")?e.is_deleted:void 0,createdAt:e.created_at,updatedAt:e.updated_at,eventData:e.event_data}}(e)}function Jn(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Yn):void 0}}(e)}function Xn(e){return function(e,t){if(null==e)return e;return{entityUserId:e.entity_user_id,entityId:e.entity_id}}(e)}function Qn(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Xn(e.data)}}(e)}function er(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Qn)}}function tr(e){return function(e,t){if(null==e)return e;return{entityUserId:e.entity_user_id,entityId:e.entity_id}}(e)}function nr(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:tr(e.data)}}(e)}function rr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(nr)}}function ir(e){return function(e,t){if(null==e)return e;return{entityUserId:e.entity_user_id,entityId:e.entity_id}}(e)}function or(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:ir(e.data)}}(e)}function sr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(or)}}function ar(e){return function(e,t){if(null==e)return e;return{entityUserId:e.entity_user_id,entityId:e.entity_id}}(e)}function ur(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:ar(e.data)}}(e)}function cr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ur)}}function dr(e){if(void 0!==e)return null===e?null:{is_save_of_repost:e.isSaveOfRepost}}function lr(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(ie):void 0}}(e)}function hr(e){return function(e,t){if(null==e)return e;return{followerUserId:e.follower_user_id,followeeUserId:e.followee_user_id}}(e)}function fr(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:hr(e.data)}}(e)}function pr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(fr)}}function gr(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function mr(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function yr(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(ct):void 0}}(e)}function wr(e){return function(e,t){if(null==e)return e;return{rank:e.rank,amount:e.amount,receiver:J(e.receiver)}}(e)}function vr(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(wr):void 0}}(e)}function br(e){return function(e,t){if(null==e)return e;return{rank:e.rank,amount:e.amount,sender:J(e.sender)}}(e)}function _r(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?br(e.data):void 0}}(e)}function Ar(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(br):void 0}}(e)}function Er(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?wr(e.data):void 0}}(e)}function kr(e){return function(e,t){if(null==e)return e;return{userId:e.user_id}}(e)}function Ir(e){return function(e,t){if(null==e)return e;return{amount:e.amount,sender:J(e.sender),receiver:J(e.receiver),createdAt:e.created_at,slot:e.slot,followeeSupporters:e.followee_supporters.map(kr),txSignature:e.tx_signature}}(e)}function Sr(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ir):void 0}}(e)}function Cr(e){return function(e,t){if(null==e)return e;return{granteeAddress:e.grantee_address,userId:e.user_id,isRevoked:e.is_revoked,isApproved:e.is_approved,createdAt:e.created_at,updatedAt:e.updated_at}}(e)}function xr(e){return Br(e,!1)}function Br(e,t){return null==e?e:{...te(e,t),itemType:e.item_type,item:Ie(e.item)}}function Tr(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(xr):void 0}}(e)}function Rr(e){return function(e,t){if(null==e)return e;return{trackId:v(e,"trackId")?e.trackId:void 0,date:v(e,"date")?e.date:void 0,listens:v(e,"listens")?e.listens:void 0}}(e)}function Dr(e){return function(e,t){if(null==e)return e;return{streak:e.streak}}(e)}function Pr(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Dr(e.data)}}(e)}function Ur(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Pr)}}function Or(e){return function(e,t){if(null==e)return e;return{user:J(e.user),grant:Cr(e.grant)}}(e)}function Fr(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Or):void 0}}(e)}function Mr(e){return function(e,t){if(null==e)return e;return{manager:J(e.manager),grant:Cr(e.grant)}}(e)}function Lr(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Mr):void 0}}(e)}function qr(e,t){return null==e?e:{type:e.type,threshold:e.threshold,playlistId:e.playlist_id,isAlbum:e.is_album}}function zr(e,t){return null==e?e:{type:e.type,threshold:e.threshold,trackId:e.track_id}}function Nr(e,t){return null==e?e:{type:e.type,threshold:e.threshold,userId:e.user_id}}function jr(e){return function(e,t){if(null==e)return e;return{...qr(e),...zr(e),...Nr(e)}}(e)}function $r(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:jr(e.data)}}(e)}function Wr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map($r)}}function Hr(e){return function(e,t){if(null==e)return e;return{totalListens:v(e,"totalListens")?e.totalListens:void 0,trackIds:v(e,"trackIds")?e.trackIds:void 0,listenCounts:v(e,"listenCounts")?e.listenCounts.map(Rr):void 0}}(e)}function Kr(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function Vr(e){return function(e,t){if(null==e)return e;return{reactedTo:e.reacted_to,reactionType:e.reaction_type,reactionValue:e.reaction_value,receiverUserId:e.receiver_user_id,senderUserId:e.sender_user_id,senderWallet:e.sender_wallet,tipAmount:e.tip_amount}}(e)}function Gr(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Vr(e.data)}}(e)}function Zr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Gr)}}function Yr(e){return function(e,t){if(null==e)return e;return{amount:e.amount,senderUserId:e.sender_user_id,receiverUserId:e.receiver_user_id,tipTxSignature:e.tip_tx_signature,reactionValue:e.reaction_value}}(e)}function Jr(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Yr(e.data)}}(e)}function Xr(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Jr)}}function Qr(e){return function(e,t){if(null==e)return e;return{parentTrackId:e.parent_track_id,trackId:e.track_id}}(e)}function ei(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Qr(e.data)}}(e)}function ti(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ei)}}function ni(e){return function(e,t){if(null==e)return e;return{type:e.type,userId:e.user_id,repostItemId:e.repost_item_id}}(e)}function ri(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:ni(e.data)}}(e)}function ii(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ri)}}function oi(e){return function(e,t){if(null==e)return e;return{type:e.type,userId:e.user_id,repostOfRepostItemId:e.repost_of_repost_item_id}}(e)}function si(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:oi(e.data)}}(e)}function ai(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(si)}}function ui(e){return function(e,t){if(null==e)return e;return{userId:e.user_id,granteeUserId:e.grantee_user_id,granteeAddress:e.grantee_address}}(e)}function ci(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:ui(e.data)}}(e)}function di(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ci)}}function li(e){return function(e,t){if(null==e)return e;return{type:e.type,userId:e.user_id,saveItemId:e.save_item_id}}(e)}function hi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:li(e.data)}}(e)}function fi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(hi)}}function pi(e){return function(e,t){if(null==e)return e;return{type:e.type,userId:e.user_id,saveOfRepostItemId:e.save_of_repost_item_id}}(e)}function gi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:pi(e.data)}}(e)}function mi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(gi)}}function yi(e){return function(e,t){if(null==e)return e;return{amount:e.amount,senderUserId:e.sender_user_id,receiverUserId:e.receiver_user_id,tipTxSignature:e.tip_tx_signature}}(e)}function wi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:yi(e.data)}}(e)}function vi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(wi)}}function bi(e){return function(e,t){if(null==e)return e;return{dethronedUserId:e.dethroned_user_id,senderUserId:e.sender_user_id,receiverUserId:e.receiver_user_id}}(e)}function _i(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:bi(e.data)}}(e)}function Ai(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(_i)}}function Ei(e){return function(e,t){if(null==e)return e;return{rank:e.rank,senderUserId:e.sender_user_id,receiverUserId:e.receiver_user_id}}(e)}function ki(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Ei(e.data)}}(e)}function Ii(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ki)}}function Si(e){return function(e,t){if(null==e)return e;return{tastemakerItemOwnerId:e.tastemaker_item_owner_id,tastemakerItemId:e.tastemaker_item_id,action:e.action,tastemakerItemType:e.tastemaker_item_type,tastemakerUserId:e.tastemaker_user_id}}(e)}function Ci(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Si(e.data)}}(e)}function xi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Ci)}}function Bi(e){return function(e,t){if(null==e)return e;return{newTier:e.new_tier,currentValue:e.current_value,newTierValue:e.new_tier_value}}(e)}function Ti(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Bi(e.data)}}(e)}function Ri(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Ti)}}function Di(e){return function(e,t){if(null==e)return e;return{trackId:e.track_id,playlistId:e.playlist_id,playlistOwnerId:e.playlist_owner_id}}(e)}function Pi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Di(e.data)}}(e)}function Ui(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Pi)}}function Oi(e){return function(e,t){if(null==e)return e;return{trackId:e.track_id,playlistId:e.playlist_id,playlistOwnerId:e.playlist_owner_id}}(e)}function Fi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Oi(e.data)}}(e)}function Mi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Fi)}}function Li(e){return function(e,t){if(null==e)return e;return{rank:e.rank,genre:e.genre,trackId:e.track_id,timeRange:e.time_range}}(e)}function qi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Li(e.data)}}(e)}function zi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(qi)}}function Ni(e){return function(e,t){if(null==e)return e;return{rank:e.rank,genre:e.genre,playlistId:e.playlist_id,timeRange:e.time_range}}(e)}function ji(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Ni(e.data)}}(e)}function $i(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(ji)}}function Wi(e){return function(e,t){if(null==e)return e;return{rank:e.rank,genre:e.genre,trackId:e.track_id,timeRange:e.time_range}}(e)}function Hi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Wi(e.data)}}(e)}function Ki(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Hi)}}function Vi(e){return function(e,t){if(null==e)return e;return{contentType:e.content_type,buyerUserId:e.buyer_user_id,sellerUserId:e.seller_user_id,amount:e.amount,extraAmount:e.extra_amount,contentId:e.content_id}}(e)}function Gi(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Vi(e.data)}}(e)}function Zi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Gi)}}function Yi(e){return function(e,t){if(null==e)return e;return{contentType:e.content_type,buyerUserId:e.buyer_user_id,sellerUserId:e.seller_user_id,amount:e.amount,extraAmount:e.extra_amount,contentId:e.content_id}}(e)}function Ji(e){return function(e,t){if(null==e)return e;return{specifier:e.specifier,type:e.type,timestamp:e.timestamp,data:Yi(e.data)}}(e)}function Xi(e,t){return null==e?e:{type:e.type,groupId:e.group_id,isSeen:e.is_seen,seenAt:v(e,"seen_at")?e.seen_at:void 0,actions:e.actions.map(Ji)}}function Qi(e){return function(e,t){if(null==e)return e;switch(e.type){case"announcement":return{...De(e),type:"announcement"};case"approve_manager_request":return{...Fe(e),type:"approve_manager_request"};case"artist_remix_contest_ended":return{...Ne(e),type:"artist_remix_contest_ended"};case"artist_remix_contest_ending_soon":return{...We(e),type:"artist_remix_contest_ending_soon"};case"artist_remix_contest_submissions":return{...Ve(e),type:"artist_remix_contest_submissions"};case"challenge_reward":return{...ht(e),type:"challenge_reward"};case"claimable_reward":return{...wt(e),type:"claimable_reward"};case"comment":return{...Zt(e),type:"comment"};case"comment_mention":return{...Kt(e),type:"comment_mention"};case"comment_reaction":return{...Qt(e),type:"comment_reaction"};case"comment_thread":return{...on(e),type:"comment_thread"};case"cosign":return{...dn(e),type:"cosign"};case"create":return{...kn(e),type:"create"};case"fan_remix_contest_ended":return{...er(e),type:"fan_remix_contest_ended"};case"fan_remix_contest_ending_soon":return{...rr(e),type:"fan_remix_contest_ending_soon"};case"fan_remix_contest_started":return{...sr(e),type:"fan_remix_contest_started"};case"fan_remix_contest_winners_selected":return{...cr(e),type:"fan_remix_contest_winners_selected"};case"follow":return{...pr(e),type:"follow"};case"listen_streak_reminder":return{...Ur(e),type:"listen_streak_reminder"};case"milestone":return{...Wr(e),type:"milestone"};case"reaction":return{...Zr(e),type:"reaction"};case"remix":return{...ti(e),type:"remix"};case"repost":return{...ii(e),type:"repost"};case"repost_of_repost":return{...ai(e),type:"repost_of_repost"};case"request_manager":return{...di(e),type:"request_manager"};case"save":return{...fi(e),type:"save"};case"save_of_repost":return{...mi(e),type:"save_of_repost"};case"supporter_dethroned":return{...Ai(e),type:"supporter_dethroned"};case"supporter_rank_up":return{...Ii(e),type:"supporter_rank_up"};case"supporting_rank_up":return{...Ii(e),type:"supporting_rank_up"};case"tastemaker":return{...xi(e),type:"tastemaker"};case"tier_change":return{...Ri(e),type:"tier_change"};case"tip_receive":return{...Xr(e),type:"tip_receive"};case"tip_send":return{...vi(e),type:"tip_send"};case"track_added_to_playlist":return{...Ui(e),type:"track_added_to_playlist"};case"track_added_to_purchased_album":return{...Mi(e),type:"track_added_to_purchased_album"};case"trending":return{...zi(e),type:"trending"};case"trending_playlist":return{...$i(e),type:"trending_playlist"};case"trending_underground":return{...Ki(e),type:"trending_underground"};case"usdc_purchase_buyer":return{...Zi(e),type:"usdc_purchase_buyer"};case"usdc_purchase_seller":return{...Xi(e),type:"usdc_purchase_seller"};default:throw new Error(`No variant of Notification exists with 'type=${e.type}'`)}}(e)}function eo(e){return function(e,t){if(null==e)return e;return{notifications:v(e,"notifications")?e.notifications.map(Qi):void 0,unreadCount:e.unread_count}}(e)}function to(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?eo(e.data):void 0}}(e)}function no(e){if(void 0!==e)return null===e?null:{entityType:e.entityType,entityId:e.entityId}}function ro(e,t){return null==e?e:{type:e.type,item:nt(e.item)}}function io(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(nt):void 0}}(e)}function oo(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(nt):void 0}}(e)}function so(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ie):void 0}}(e)}function ao(e){return function(e,t){if(null==e)return e;return{playlistId:e.playlist_id,updatedAt:e.updated_at,lastSeenAt:v(e,"last_seen_at")?e.last_seen_at:void 0}}(e)}function uo(e){return function(e,t){if(null==e)return e;return{playlistUpdates:v(e,"playlist_updates")?e.playlist_updates.map(ao):void 0}}(e)}function co(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?uo(e.data):void 0}}(e)}function lo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ce):void 0}}(e)}function ho(e){if(void 0!==e)return null===e?null:{signature:e.signature,wallet:e.wallet}}function fo(e){return function(e,t){if(null==e)return e;return{prizeId:e.prize_id,prizeName:e.prize_name,wallet:e.wallet,prizeType:v(e,"prize_type")?e.prize_type:void 0,actionData:v(e,"action_data")?e.action_data:void 0}}(e)}function po(e){return function(e,t){if(null==e)return e;return{prizeId:e.prize_id,name:e.name,description:v(e,"description")?e.description:void 0,weight:e.weight,metadata:v(e,"metadata")?e.metadata:void 0}}(e)}function go(e){return function(e,t){if(null==e)return e;return{data:e.data.map(po)}}(e)}function mo(e){return function(e,t){if(null==e)return e;return{userId:v(e,"user_id")?e.user_id:void 0,payoutWallet:e.payout_wallet,amount:e.amount}}(e)}function yo(e){return function(e,t){if(null==e)return e;return{slot:e.slot,signature:e.signature,sellerUserId:e.seller_user_id,buyerUserId:e.buyer_user_id,amount:e.amount,extraAmount:e.extra_amount,contentType:e.content_type,contentId:e.content_id,createdAt:e.created_at,updatedAt:e.updated_at,access:e.access,splits:e.splits.map(mo)}}(e)}function wo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data:void 0}}(e)}function vo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function bo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data:void 0}}(e)}function _o(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(yo):void 0}}(e)}function Ao(e){if(void 0!==e)return null===e?null:{entityType:e.entityType,entityId:e.entityId}}function Eo(e){return function(e,t){if(null==e)return e;return{amount:e.amount}}(e)}function ko(e){if(void 0!==e)return null===e?null:{api_secret:e.apiSecret}}function Io(e){return function(e,t){if(null==e)return e;return{success:v(e,"success")?e.success:void 0}}(e)}function So(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function Co(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ie):void 0}}(e)}function xo(e){return function(e,t){if(null==e)return e;return{trackId:e.track_id,title:e.title,remixCount:e.remix_count}}(e)}function Bo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data:void 0}}(e)}function To(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function Ro(e){return function(e,t){if(null==e)return e;return{count:e.count,tracks:v(e,"tracks")?e.tracks.map(Ie):void 0}}(e)}function Do(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Ro(e.data):void 0}}(e)}function Po(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ie):void 0}}(e)}function Uo(e){if(void 0!==e)return null===e?null:{is_repost_of_repost:e.isRepostOfRepost}}function Oo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(ee):void 0}}(e)}function Fo(e){return function(e,t){if(null==e)return e;return{code:e.code,amount:e.amount}}(e)}function Mo(e){return function(e,t){if(null==e)return e;return{title:v(e,"title")?e.title:void 0,link:v(e,"link")?e.link:void 0,purchasedBy:v(e,"purchased_by")?e.purchased_by:void 0,buyerUserId:v(e,"buyer_user_id")?e.buyer_user_id:void 0,date:v(e,"date")?e.date:void 0,salePrice:v(e,"sale_price")?e.sale_price:void 0,networkFee:v(e,"network_fee")?e.network_fee:void 0,payExtra:v(e,"pay_extra")?e.pay_extra:void 0,total:v(e,"total")?e.total:void 0,country:v(e,"country")?e.country:void 0,encryptedEmail:v(e,"encrypted_email")?e.encrypted_email:void 0,encryptedKey:v(e,"encrypted_key")?e.encrypted_key:void 0,isInitial:v(e,"is_initial")?e.is_initial:void 0,pubkeyBase64:v(e,"pubkey_base64")?e.pubkey_base64:void 0}}(e)}function Lo(e){return function(e,t){if(null==e)return e;return{contentType:e.content_type,contentId:e.content_id,purchaseCount:e.purchase_count}}(e)}function qo(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Lo):void 0}}(e)}function zo(e){return function(e,t){if(null==e)return e;return{sales:v(e,"sales")?e.sales.map(Mo):void 0}}(e)}function No(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?zo(e.data):void 0}}(e)}function jo(e){return function(e,t){if(null==e)return e;return{artwork:v(e,"artwork")?ae(e.artwork):void 0,description:v(e,"description")?e.description:void 0,permalink:e.permalink,id:e.id,isAlbum:e.is_album,isImageAutogenerated:e.is_image_autogenerated,playlistName:e.playlist_name,playlistContents:e.playlist_contents.map(oe),repostCount:e.repost_count,favoriteCount:e.favorite_count,totalPlayCount:e.total_play_count,user:J(e.user),ddexApp:v(e,"ddex_app")?e.ddex_app:void 0,access:I(e.access),upc:v(e,"upc")?e.upc:void 0,trackCount:e.track_count,blocknumber:e.blocknumber,createdAt:e.created_at,followeeReposts:v(e,"followee_reposts")?e.followee_reposts.map(ue):void 0,followeeFavorites:v(e,"followee_favorites")?e.followee_favorites.map(ie):void 0,hasCurrentUserReposted:e.has_current_user_reposted,hasCurrentUserSaved:e.has_current_user_saved,isDelete:e.is_delete,isPrivate:e.is_private,updatedAt:e.updated_at,addedTimestamps:e.added_timestamps.map(oe),userId:e.user_id,tracks:v(e,"tracks")?e.tracks.map(Ie):void 0,coverArt:v(e,"cover_art")?e.cover_art:void 0,coverArtSizes:v(e,"cover_art_sizes")?e.cover_art_sizes:void 0,coverArtCids:v(e,"cover_art_cids")?ae(e.cover_art_cids):void 0,isStreamGated:e.is_stream_gated,streamConditions:v(e,"stream_conditions")?F(e.stream_conditions):void 0,isScheduledRelease:e.is_scheduled_release,releaseDate:v(e,"release_date")?e.release_date:void 0,ddexReleaseIds:v(e,"ddex_release_ids")?e.ddex_release_ids:void 0,artists:v(e,"artists")?e.artists:void 0,copyrightLine:v(e,"copyright_line")?e.copyright_line:void 0,producerCopyrightLine:v(e,"producer_copyright_line")?e.producer_copyright_line:void 0,parentalWarningType:v(e,"parental_warning_type")?e.parental_warning_type:void 0}}(e)}function $o(e){return function(e,t){if(null==e)return e;return{artwork:_e(e.artwork),description:v(e,"description")?e.description:void 0,genre:e.genre,id:e.id,trackCid:v(e,"track_cid")?e.track_cid:void 0,previewCid:v(e,"preview_cid")?e.preview_cid:void 0,origFileCid:v(e,"orig_file_cid")?e.orig_file_cid:void 0,origFilename:v(e,"orig_filename")?e.orig_filename:void 0,isOriginalAvailable:e.is_original_available,mood:v(e,"mood")?e.mood:void 0,releaseDate:v(e,"release_date")?new Date(e.release_date):void 0,remixOf:we(e.remix_of),repostCount:e.repost_count,favoriteCount:e.favorite_count,commentCount:e.comment_count,tags:v(e,"tags")?e.tags:void 0,title:e.title,user:J(e.user),duration:e.duration,isDownloadable:e.is_downloadable,playCount:e.play_count,permalink:e.permalink,isStreamable:v(e,"is_streamable")?e.is_streamable:void 0,ddexApp:v(e,"ddex_app")?e.ddex_app:void 0,playlistsContainingTrack:v(e,"playlists_containing_track")?e.playlists_containing_track:void 0,pinnedCommentId:v(e,"pinned_comment_id")?e.pinned_comment_id:void 0,albumBacklink:v(e,"album_backlink")?re(e.album_backlink):void 0,access:I(e.access),blocknumber:e.blocknumber,createDate:v(e,"create_date")?e.create_date:void 0,coverArtSizes:e.cover_art_sizes,coverArtCids:v(e,"cover_art_cids")?ce(e.cover_art_cids):void 0,createdAt:e.created_at,creditsSplits:v(e,"credits_splits")?e.credits_splits:void 0,isrc:v(e,"isrc")?e.isrc:void 0,license:v(e,"license")?e.license:void 0,iswc:v(e,"iswc")?e.iswc:void 0,fieldVisibility:ge(e.field_visibility),followeeReposts:v(e,"followee_reposts")?e.followee_reposts.map(ue):void 0,hasCurrentUserReposted:e.has_current_user_reposted,isScheduledRelease:e.is_scheduled_release,isUnlisted:e.is_unlisted,hasCurrentUserSaved:e.has_current_user_saved,followeeFavorites:v(e,"followee_favorites")?e.followee_favorites.map(ie):void 0,routeId:e.route_id,stemOf:v(e,"stem_of")?ve(e.stem_of):void 0,trackSegments:e.track_segments.map(Ae),updatedAt:e.updated_at,userId:e.user_id,isDelete:e.is_delete,coverArt:v(e,"cover_art")?e.cover_art:void 0,isAvailable:e.is_available,aiAttributionUserId:v(e,"ai_attribution_user_id")?e.ai_attribution_user_id:void 0,allowedApiKeys:v(e,"allowed_api_keys")?e.allowed_api_keys:void 0,audioUploadId:v(e,"audio_upload_id")?e.audio_upload_id:void 0,previewStartSeconds:v(e,"preview_start_seconds")?e.preview_start_seconds:void 0,bpm:v(e,"bpm")?e.bpm:void 0,isCustomBpm:v(e,"is_custom_bpm")?e.is_custom_bpm:void 0,musicalKey:v(e,"musical_key")?e.musical_key:void 0,isCustomMusicalKey:v(e,"is_custom_musical_key")?e.is_custom_musical_key:void 0,audioAnalysisErrorCount:v(e,"audio_analysis_error_count")?e.audio_analysis_error_count:void 0,commentsDisabled:v(e,"comments_disabled")?e.comments_disabled:void 0,ddexReleaseIds:v(e,"ddex_release_ids")?e.ddex_release_ids:void 0,artists:v(e,"artists")?e.artists:void 0,resourceContributors:v(e,"resource_contributors")?null===e.resource_contributors?null:e.resource_contributors.map(le):void 0,indirectResourceContributors:v(e,"indirect_resource_contributors")?null===e.indirect_resource_contributors?null:e.indirect_resource_contributors.map(le):void 0,rightsController:v(e,"rights_controller")?fe(e.rights_controller):void 0,copyrightLine:v(e,"copyright_line")?de(e.copyright_line):void 0,producerCopyrightLine:v(e,"producer_copyright_line")?de(e.producer_copyright_line):void 0,parentalWarningType:v(e,"parental_warning_type")?e.parental_warning_type:void 0,isStreamGated:e.is_stream_gated,streamConditions:v(e,"stream_conditions")?F(e.stream_conditions):void 0,isDownloadGated:e.is_download_gated,downloadConditions:v(e,"download_conditions")?F(e.download_conditions):void 0,coverOriginalSongTitle:v(e,"cover_original_song_title")?e.cover_original_song_title:void 0,coverOriginalArtist:v(e,"cover_original_artist")?e.cover_original_artist:void 0,isOwnedByUser:e.is_owned_by_user,stream:Ee(e.stream),download:Ee(e.download),preview:Ee(e.preview)}}(e)}function Wo(e){return function(e,t){if(null==e)return e;return{users:e.users.map(J),followedUsers:v(e,"followed_users")?e.followed_users.map(J):void 0,tracks:e.tracks.map($o),savedTracks:v(e,"saved_tracks")?e.saved_tracks.map($o):void 0,playlists:e.playlists.map(jo),savedPlaylists:v(e,"saved_playlists")?e.saved_playlists.map(jo):void 0,albums:e.albums.map(jo),savedAlbums:v(e,"saved_albums")?e.saved_albums.map(jo):void 0}}(e)}function Ho(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?Wo(e.data):void 0}}(e)}function Ko(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?Wo(e.data):void 0}}(e)}function Vo(e){return function(e,t){if(null==e)return e;return{id:e.id,parentId:e.parent_id,category:e.category,cid:e.cid,userId:e.user_id,blocknumber:e.blocknumber,origFilename:e.orig_filename}}(e)}function Go(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Vo):void 0}}(e)}function Zo(e){return function(e,t){if(null==e)return e;return{data:e.data}}(e)}function Yo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function Jo(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data:void 0}}(e)}function Xo(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function Qo(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Qo):void 0}}(e)}function es(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function ts(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data:void 0}}(e)}function ns(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Yt(e.data):void 0}}(e)}function rs(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map($t):void 0,related:v(e,"related")?it(e.related):void 0}}(e)}function is(e){return function(e,t){if(null==e)return e;return{id:e.id,downloadCount:e.download_count}}(e)}function os(e){return function(e,t){if(null==e)return e;return{data:is(e.data)}}(e)}function ss(e){return function(e,t){if(null==e)return e;return{data:e.data.map(is)}}(e)}function as(e){if(void 0!==e)return null===e?null:{city:e.city,region:e.region,country:e.country}}function us(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function cs(e,t){return null==e?e:{type:e.type,item:Ie(e.item)}}function ds(e){return function(e,t){if(null==e)return e;return{id:e.id}}(e)}function ls(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?st(e.data):void 0}}(e)}function hs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(st):void 0}}(e)}function fs(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(xr):void 0}}(e)}function ps(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function gs(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?Ie(e.data):void 0}}(e)}function ms(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Ie):void 0}}(e)}function ys(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ie):void 0}}(e)}function ws(e){return function(e,t){if(null==e)return e;return{data:e.data}}(e)}function vs(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(Ie):void 0}}(e)}function bs(e){return function(e,t){if(null==e)return e;return{transactionDate:e.transaction_date,transactionType:e.transaction_type,method:e.method,signature:e.signature,userBank:e.user_bank,change:e.change,balance:e.balance,metadata:e.metadata}}(e)}function _s(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data:void 0}}(e)}function As(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(bs):void 0}}(e)}function Es(e){return function(e,t){if(null==e)return e;return{week:v(e,"week")?e.week.map(ds):void 0,month:v(e,"month")?e.month.map(ds):void 0,year:v(e,"year")?e.year.map(ds):void 0}}(e)}function ks(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Es(e.data):void 0}}(e)}function Is(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(nt):void 0}}(e)}function Ss(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data:void 0}}(e)}function Cs(e){return function(e,t){if(null==e)return e;return{challengeId:e.challenge_id,userId:e.user_id,specifier:e.specifier,amount:e.amount,completedBlocknumber:e.completed_blocknumber,handle:e.handle,wallet:e.wallet,createdAt:e.created_at,completedAt:e.completed_at,cooldownDays:v(e,"cooldown_days")?e.cooldown_days:void 0}}(e)}function xs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Cs):void 0}}(e)}function Bs(e){if(void 0!==e)return null===e?null:{description:e.description,banner_image_url:e.bannerImageUrl,link_1:e.link1,link_2:e.link2,link_3:e.link3,link_4:e.link4}}function Ts(e){return function(e,t){if(null==e)return e;return{success:v(e,"success")?e.success:void 0}}(e)}function Rs(e){if(void 0!==e)return null===e?null:{entityType:e.entityType,entityId:e.entityId,body:e.body,mentions:e.mentions}}function Ds(e){if(void 0!==e)return null===e?null:{name:e.name,description:e.description,image_url:e.imageUrl,redirect_uris:e.redirectUris}}function Ps(e){if(void 0!==e)return null===e?null:{playlist_name:e.playlistName,description:e.description,is_private:e.isPrivate,is_album:e.isAlbum,genre:e.genre,mood:e.mood,tags:e.tags,license:e.license,upc:e.upc,release_date:void 0===e.releaseDate?void 0:e.releaseDate.toISOString().substr(0,10),playlist_image_sizes_multihash:e.playlistImageSizesMultihash,playlist_contents:void 0===e.playlistContents?void 0:e.playlistContents.map(se),is_stream_gated:e.isStreamGated,is_scheduled_release:e.isScheduledRelease,stream_conditions:M(e.streamConditions),ddex_app:e.ddexApp,ddex_release_ids:e.ddexReleaseIds,artists:void 0===e.artists?void 0:null===e.artists?null:e.artists.map(he),copyright_line:In(e.copyrightLine),producer_copyright_line:Sn(e.producerCopyrightLine),parental_warning_type:e.parentalWarningType,is_image_autogenerated:e.isImageAutogenerated}}function Us(e){if(void 0!==e)return null===e?null:{title:e.title,genre:e.genre,description:e.description,mood:e.mood,bpm:e.bpm,musical_key:e.musicalKey,tags:e.tags,license:e.license,isrc:e.isrc,iswc:e.iswc,release_date:void 0===e.releaseDate?void 0:e.releaseDate.toISOString().substr(0,10),track_cid:e.trackCid,orig_file_cid:e.origFileCid,orig_filename:e.origFilename,cover_art_sizes:e.coverArtSizes,preview_cid:e.previewCid,preview_start_seconds:e.previewStartSeconds,duration:e.duration,is_downloadable:e.isDownloadable,is_unlisted:e.isUnlisted,is_stream_gated:e.isStreamGated,access_authorities:e.accessAuthorities,stream_conditions:M(e.streamConditions),download_conditions:M(e.downloadConditions),field_visibility:me(e.fieldVisibility),placement_hosts:e.placementHosts,stem_of:be(e.stemOf),remix_of:Dn(e.remixOf),ddex_app:e.ddexApp,parental_warning_type:e.parentalWarningType}}function Os(e){if(void 0!==e)return null===e?null:{handle:e.handle,name:e.name,bio:e.bio,location:e.location,website:e.website,donation:e.donation,twitter_handle:e.twitterHandle,instagram_handle:e.instagramHandle,tiktok_handle:e.tiktokHandle,profile_picture:e.profilePicture,profile_picture_sizes:e.profilePictureSizes,cover_photo:e.coverPhoto,cover_photo_sizes:e.coverPhotoSizes,profile_type:e.profileType,is_deactivated:e.isDeactivated,artist_pick_track_id:e.artistPickTrackId,allow_ai_attribution:e.allowAiAttribution,spl_usdc_payout_wallet:e.splUsdcPayoutWallet,coin_flair_mint:e.coinFlairMint,playlist_library:Mn(e.playlistLibrary),events:On(e.events)}}function Fs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Q(e.data):void 0}}(e)}function Ms(e){return function(e,t){if(null==e)return e;return{mint:e.mint,ticker:e.ticker,decimals:e.decimals,ownerId:e.owner_id,logoUri:v(e,"logo_uri")?e.logo_uri:void 0,bannerImageUrl:v(e,"banner_image_url")?e.banner_image_url:void 0,hasDiscord:e.has_discord,balance:e.balance,balanceUsd:e.balance_usd}}(e)}function Ls(e){return function(e,t){if(null==e)return e;return{account:e.account,owner:e.owner,balance:e.balance,balanceUsd:e.balance_usd,isInAppWallet:e.is_in_app_wallet}}(e)}function qs(e){return function(e,t){if(null==e)return e;return{mint:e.mint,ticker:e.ticker,decimals:e.decimals,logoUri:v(e,"logo_uri")?e.logo_uri:void 0,balance:e.balance,balanceUsd:e.balance_usd,accounts:e.accounts.map(Ls)}}(e)}function zs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?qs(e.data):void 0}}(e)}function Ns(e){return function(e,t){if(null==e)return e;return{data:e.data.map(Ms)}}(e)}function js(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map($t):void 0,related:v(e,"related")?it(e.related):void 0}}(e)}function $s(e){return function(e,t){if(null==e)return e;switch(e.type){case"playlist":return{...ro(e),type:"playlist"};case"track":return{...cs(e),type:"track"};default:throw new Error(`No variant of UserFeedItem exists with 'type=${e.type}'`)}}(e)}function Ws(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map($s):void 0}}(e)}function Hs(e){return function(e,t){if(null==e)return e;return{userId:e.user_id,address:e.address}}(e)}function Ks(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(Hs):void 0}}(e)}function Vs(e){return function(e,t){if(null==e)return e;return{latestChainBlock:e.latest_chain_block,latestIndexedBlock:e.latest_indexed_block,latestChainSlotPlays:e.latest_chain_slot_plays,latestIndexedSlotPlays:e.latest_indexed_slot_plays,signature:e.signature,timestamp:e.timestamp,version:xe(e.version),data:v(e,"data")?e.data.map(J):void 0}}(e)}function Gs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?J(e.data):void 0}}(e)}function Zs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(J):void 0}}(e)}function Ys(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?A(e.data,Hr):void 0}}(e)}function Js(e){return function(e,t){if(null==e)return e;return{data:e.data}}(e)}function Xs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?e.data.map(xo):void 0}}(e)}function Qs(e){return function(e,t){if(null==e)return e;return{data:v(e,"data")?Wn(e.data):void 0}}(e)}function ea(e){return function(e,t){if(null==e)return e;return{transactionHash:v(e,"transaction_hash")?e.transaction_hash:void 0,blockHash:v(e,"block_hash")?e.block_hash:void 0,blockNumber:v(e,"block_number")?e.block_number:void 0}}(e)}class ta extends h{async getChallengeAttestationRaw(e,t){if(null===e.challengeId||void 0===e.challengeId)throw new y("challengeId","Required parameter params.challengeId was null or undefined when calling getChallengeAttestation.");if(null===e.oracle||void 0===e.oracle)throw new y("oracle","Required parameter params.oracle was null or undefined when calling getChallengeAttestation.");if(null===e.specifier||void 0===e.specifier)throw new y("specifier","Required parameter params.specifier was null or undefined when calling getChallengeAttestation.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling getChallengeAttestation.");const n={};void 0!==e.oracle&&(n.oracle=e.oracle),void 0!==e.specifier&&(n.specifier=e.specifier),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/challenges/{challenge_id}/attest".replace("{challenge_id}",encodeURIComponent(String(e.challengeId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Ze(e)))}async getChallengeAttestation(e,t){const n=await this.getChallengeAttestationRaw(e,t);return await n.value()}async getUndisbursedChallengesRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.completedBlocknumber&&(n.completed_blocknumber=e.completedBlocknumber),void 0!==e.challengeId&&(n.challenge_id=e.challengeId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/challenges/undisbursed",method:"GET",headers:r,query:n},t);return new E(i,(e=>xs(e)))}async getUndisbursedChallenges(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getUndisbursedChallengesRaw(e,t);return await n.value()}async getUndisbursedChallengesForUserRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling getUndisbursedChallengesForUser.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.completedBlocknumber&&(n.completed_blocknumber=e.completedBlocknumber),void 0!==e.challengeId&&(n.challenge_id=e.challengeId);const r=await this.request({path:"/challenges/undisbursed/{user_id}".replace("{user_id}",encodeURIComponent(String(e.userId))),method:"GET",headers:{},query:n},t);return new E(r,(e=>xs(e)))}async getUndisbursedChallengesForUser(e,t){const n=await this.getUndisbursedChallengesForUserRaw(e,t);return await n.value()}}class na extends h{async claimCoinRewardRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling claimCoinReward.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling claimCoinReward.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r=await this.request({path:"/coins/{mint}/redeem".replace("{mint}",encodeURIComponent(String(e.mint))),method:"POST",headers:{},query:n},t);return new E(r,(e=>gt(e)))}async claimCoinReward(e,t){const n=await this.claimCoinRewardRaw(e,t);return await n.value()}async claimCoinRewardCodeRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling claimCoinRewardCode.");if(null===e.code||void 0===e.code)throw new y("code","Required parameter params.code was null or undefined when calling claimCoinRewardCode.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling claimCoinRewardCode.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r=await this.request({path:"/coins/{mint}/redeem/{code}".replace("{mint}",encodeURIComponent(String(e.mint))).replace("{code}",encodeURIComponent(String(e.code))),method:"POST",headers:{},query:n},t);return new E(r,(e=>gt(e)))}async claimCoinRewardCode(e,t){const n=await this.claimCoinRewardCodeRaw(e,t);return await n.value()}async createCoinRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling createCoin.");if(null===e.createCoinRequest||void 0===e.createCoinRequest)throw new y("createCoinRequest","Required parameter params.createCoinRequest was null or undefined when calling createCoin.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"},i=await this.request({path:"/coins",method:"POST",headers:r,query:n,body:hn(e.createCoinRequest)},t);return new E(i,(e=>pn(e)))}async createCoin(e,t){const n=await this.createCoinRaw(e,t);return await n.value()}async getCoinRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getCoin.");const n=await this.request({path:"/coins/{mint}".replace("{mint}",encodeURIComponent(String(e.mint))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Rt(e)))}async getCoin(e,t){const n=await this.getCoinRaw(e,t);return await n.value()}async getCoinByTickerRaw(e,t){if(null===e.ticker||void 0===e.ticker)throw new y("ticker","Required parameter params.ticker was null or undefined when calling getCoinByTicker.");const n=await this.request({path:"/coins/ticker/{ticker}".replace("{ticker}",encodeURIComponent(String(e.ticker))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Rt(e)))}async getCoinByTicker(e,t){const n=await this.getCoinByTickerRaw(e,t);return await n.value()}async getCoinInsightsRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getCoinInsights.");const n=await this.request({path:"/coins/{mint}/insights".replace("{mint}",encodeURIComponent(String(e.mint))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Ct(e)))}async getCoinInsights(e,t){const n=await this.getCoinInsightsRaw(e,t);return await n.value()}async getCoinMembersRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getCoinMembers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection);const r=await this.request({path:"/coins/{mint}/members".replace("{mint}",encodeURIComponent(String(e.mint))),method:"GET",headers:{},query:n},t);return new E(r,(e=>Tt(e)))}async getCoinMembers(e,t){const n=await this.getCoinMembersRaw(e,t);return await n.value()}async getCoinMembersCountRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getCoinMembersCount.");const n=await this.request({path:"/coins/{mint}/members/count".replace("{mint}",encodeURIComponent(String(e.mint))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Bt(e)))}async getCoinMembersCount(e,t){const n=await this.getCoinMembersCountRaw(e,t);return await n.value()}async getCoinRedeemAmountRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getCoinRedeemAmount.");const n=await this.request({path:"/coins/{mint}/redeem".replace("{mint}",encodeURIComponent(String(e.mint))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Eo(e)))}async getCoinRedeemAmount(e,t){const n=await this.getCoinRedeemAmountRaw(e,t);return await n.value()}async getCoinsRaw(e,t){const n={};e.ticker&&(n.ticker=e.ticker),e.mint&&(n.mint=e.mint),e.ownerId&&(n.owner_id=e.ownerId),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.offset&&(n.offset=e.offset),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection);const r=await this.request({path:"/coins",method:"GET",headers:{},query:n},t);return new E(r,(e=>Dt(e)))}async getCoins(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getCoinsRaw(e,t);return await n.value()}async getRewardCodeRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getRewardCode.");if(null===e.code||void 0===e.code)throw new y("code","Required parameter params.code was null or undefined when calling getRewardCode.");const n=await this.request({path:"/coins/{mint}/redeem/{code}".replace("{mint}",encodeURIComponent(String(e.mint))).replace("{code}",encodeURIComponent(String(e.code))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Fo(e)))}async getRewardCode(e,t){const n=await this.getRewardCodeRaw(e,t);return await n.value()}async getVolumeLeadersRaw(e,t){const n={};void 0!==e.from&&(n.from=e.from),void 0!==e.to&&(n.to=e.to),void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit);const r=await this.request({path:"/coins/volume-leaders",method:"GET",headers:{},query:n},t);return new E(r,(e=>Ut(e)))}async getVolumeLeaders(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getVolumeLeadersRaw(e,t);return await n.value()}async updateCoinRaw(e,t){if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling updateCoin.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling updateCoin.");if(null===e.updateCoinRequest||void 0===e.updateCoinRequest)throw new y("updateCoinRequest","Required parameter params.updateCoinRequest was null or undefined when calling updateCoin.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"},i=await this.request({path:"/coins/{mint}".replace("{mint}",encodeURIComponent(String(e.mint))),method:"POST",headers:r,query:n,body:Bs(e.updateCoinRequest)},t);return new E(i,(e=>Ts(e)))}async updateCoin(e,t){const n=await this.updateCoinRaw(e,t);return await n.value()}}class ra extends h{async createCommentRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling createComment.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling createComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments",method:"POST",headers:r,query:n,body:gn(e.metadata)},t);return new E(i,(e=>mn(e)))}async createComment(e,t){const n=await this.createCommentRaw(e,t);return await n.value()}async deleteCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling deleteComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling deleteComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async deleteComment(e,t){const n=await this.deleteCommentRaw(e,t);return await n.value()}async getCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling getComment.");const n=await this.request({path:"/comments/{comment_id}".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>tn(e)))}async getComment(e,t){const n=await this.getCommentRaw(e,t);return await n.value()}async getCommentRepliesRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling getCommentReplies.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/comments/{comment_id}/replies".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>en(e)))}async getCommentReplies(e,t){const n=await this.getCommentRepliesRaw(e,t);return await n.value()}async getUnclaimedCommentIDRaw(e){const t=await this.request({path:"/comments/unclaimed_id",method:"GET",headers:{},query:{}},e);return new E(t,(e=>Ss(e)))}async getUnclaimedCommentID(e){const t=await this.getUnclaimedCommentIDRaw(e);return await t.value()}async pinCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling pinComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling pinComment.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling pinComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}/pin".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"POST",headers:r,query:n,body:no(e.metadata)},t);return new E(i,(e=>ea(e)))}async pinComment(e,t){const n=await this.pinCommentRaw(e,t);return await n.value()}async reactToCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling reactToComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling reactToComment.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling reactToComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}/react".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"POST",headers:r,query:n,body:Ao(e.metadata)},t);return new E(i,(e=>ea(e)))}async reactToComment(e,t){const n=await this.reactToCommentRaw(e,t);return await n.value()}async reportCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling reportComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling reportComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}/report".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"POST",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async reportComment(e,t){const n=await this.reportCommentRaw(e,t);return await n.value()}async unpinCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling unpinComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unpinComment.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling unpinComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}/pin".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"DELETE",headers:r,query:n,body:no(e.metadata)},t);return new E(i,(e=>ea(e)))}async unpinComment(e,t){const n=await this.unpinCommentRaw(e,t);return await n.value()}async unreactToCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling unreactToComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unreactToComment.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling unreactToComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}/react".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"DELETE",headers:r,query:n,body:Ao(e.metadata)},t);return new E(i,(e=>ea(e)))}async unreactToComment(e,t){const n=await this.unreactToCommentRaw(e,t);return await n.value()}async updateCommentRaw(e,t){if(null===e.commentId||void 0===e.commentId)throw new y("commentId","Required parameter params.commentId was null or undefined when calling updateComment.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling updateComment.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling updateComment.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/comments/{comment_id}".replace("{comment_id}",encodeURIComponent(String(e.commentId))),method:"PUT",headers:r,query:n,body:Rs(e.metadata)},t);return new E(i,(e=>ea(e)))}async updateComment(e,t){const n=await this.updateCommentRaw(e,t);return await n.value()}}class ia extends h{async bulkGetDashboardWalletUsersRaw(e,t){if(null===e.wallets||void 0===e.wallets)throw new y("wallets","Required parameter params.wallets was null or undefined when calling bulkGetDashboardWalletUsers.");const n={};e.wallets&&(n.wallets=e.wallets.join(w));const r=await this.request({path:"/dashboard_wallet_users",method:"GET",headers:{},query:n},t);return new E(r,(e=>Nn(e)))}async bulkGetDashboardWalletUsers(e,t){const n=await this.bulkGetDashboardWalletUsersRaw(e,t);return await n.value()}}class oa extends h{async createDeveloperAppRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling createDeveloperApp.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling createDeveloperApp.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"},i=await this.request({path:"/developer-apps",method:"POST",headers:r,query:n,body:yn(e.metadata)},t);return new E(i,(e=>wn(e)))}async createDeveloperApp(e,t){const n=await this.createDeveloperAppRaw(e,t);return await n.value()}async createDeveloperAppAccessKeyRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling createDeveloperAppAccessKey.");if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling createDeveloperAppAccessKey.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r=await this.request({path:"/developer-apps/{address}/access-keys".replace("{address}",encodeURIComponent(String(e.address))),method:"POST",headers:{},query:n},t);return new E(r,(e=>ln(e)))}async createDeveloperAppAccessKey(e,t){const n=await this.createDeveloperAppAccessKeyRaw(e,t);return await n.value()}async deactivateDeveloperAppAccessKeyRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling deactivateDeveloperAppAccessKey.");if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling deactivateDeveloperAppAccessKey.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling deactivateDeveloperAppAccessKey.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"},i=await this.request({path:"/developer-apps/{address}/access-keys/deactivate".replace("{address}",encodeURIComponent(String(e.address))),method:"POST",headers:r,query:n,body:jn(e.metadata)},t);return new E(i,(e=>$n(e)))}async deactivateDeveloperAppAccessKey(e,t){const n=await this.deactivateDeveloperAppAccessKeyRaw(e,t);return await n.value()}async deleteDeveloperAppRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling deleteDeveloperApp.");if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling deleteDeveloperApp.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r=await this.request({path:"/developer-apps/{address}".replace("{address}",encodeURIComponent(String(e.address))),method:"DELETE",headers:{},query:n},t);return new E(r,(e=>ea(e)))}async deleteDeveloperApp(e,t){const n=await this.deleteDeveloperAppRaw(e,t);return await n.value()}async getDeveloperAppRaw(e,t){if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling getDeveloperApp.");const n=await this.request({path:"/developer-apps/{address}".replace("{address}",encodeURIComponent(String(e.address))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Kn(e)))}async getDeveloperApp(e,t){const n=await this.getDeveloperAppRaw(e,t);return await n.value()}async getDeveloperAppsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getDeveloperApps.");const n={};void 0!==e.include&&(n.include=e.include);const r=await this.request({path:"/users/{id}/developer-apps".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:n},t);return new E(r,(e=>Vn(e)))}async getDeveloperApps(e,t){const n=await this.getDeveloperAppsRaw(e,t);return await n.value()}async registerDeveloperAppAPIKeyRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling registerDeveloperAppAPIKey.");if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling registerDeveloperAppAPIKey.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling registerDeveloperAppAPIKey.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/developer-apps/{address}/register-api-key".replace("{address}",encodeURIComponent(String(e.address))),method:"POST",headers:r,query:n,body:ko(e.metadata)},t);return new E(i,(e=>Io(e)))}async registerDeveloperAppAPIKey(e,t){const n=await this.registerDeveloperAppAPIKeyRaw(e,t);return await n.value()}async updateDeveloperAppRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling updateDeveloperApp.");if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling updateDeveloperApp.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling updateDeveloperApp.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"},i=await this.request({path:"/developer-apps/{address}".replace("{address}",encodeURIComponent(String(e.address))),method:"PUT",headers:r,query:n,body:Ds(e.metadata)},t);return new E(i,(e=>ea(e)))}async updateDeveloperApp(e,t){const n=await this.updateDeveloperAppRaw(e,t);return await n.value()}}class sa extends h{async getAllEventsRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.eventType&&(n.event_type=e.eventType);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/events/all",method:"GET",headers:r,query:n},t);return new E(i,(e=>Jn(e)))}async getAllEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getAllEventsRaw(e,t);return await n.value()}async getBulkEventsRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),e.id&&(n.id=e.id),void 0!==e.eventType&&(n.event_type=e.eventType);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/events",method:"GET",headers:r,query:n},t);return new E(i,(e=>Jn(e)))}async getBulkEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getBulkEventsRaw(e,t);return await n.value()}async getEntityEventsRaw(e,t){if(null===e.entityId||void 0===e.entityId)throw new y("entityId","Required parameter params.entityId was null or undefined when calling getEntityEvents.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),e.entityId&&(n.entity_id=e.entityId),void 0!==e.entityType&&(n.entity_type=e.entityType),void 0!==e.filterDeleted&&(n.filter_deleted=e.filterDeleted);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/events/entity",method:"GET",headers:r,query:n},t);return new E(i,(e=>Jn(e)))}async getEntityEvents(e,t){const n=await this.getEntityEventsRaw(e,t);return await n.value()}async getUnclaimedEventIDRaw(e){const t=await this.request({path:"/events/unclaimed_id",method:"GET",headers:{},query:{}},e);return new E(t,(e=>Ss(e)))}async getUnclaimedEventID(e){const t=await this.getUnclaimedEventIDRaw(e);return await t.value()}}class aa extends h{async getBestSellingRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.type&&(n.type=e.type);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/explore/best-selling",method:"GET",headers:r,query:n},t);return new E(i,(e=>ot(e)))}async getBestSelling(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getBestSellingRaw(e,t);return await n.value()}}class ua extends h{async getNotificationsRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling getNotifications.");const n={};void 0!==e.timestamp&&(n.timestamp=e.timestamp),void 0!==e.groupId&&(n.group_id=e.groupId),void 0!==e.limit&&(n.limit=e.limit),e.types&&(n.types=e.types);const r=await this.request({path:"/notifications/{user_id}".replace("{user_id}",encodeURIComponent(String(e.userId))),method:"GET",headers:{},query:n},t);return new E(r,(e=>to(e)))}async getNotifications(e,t){const n=await this.getNotificationsRaw(e,t);return await n.value()}async getPlaylistUpdatesRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling getPlaylistUpdates.");const n=await this.request({path:"/notifications/{user_id}/playlist_updates".replace("{user_id}",encodeURIComponent(String(e.userId))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>co(e)))}async getPlaylistUpdates(e,t){const n=await this.getPlaylistUpdatesRaw(e,t);return await n.value()}}class ca extends h{async createPlaylistRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling createPlaylist.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling createPlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists",method:"POST",headers:r,query:n,body:Cn(e.metadata)},t);return new E(i,(e=>xn(e)))}async createPlaylist(e,t){const n=await this.createPlaylistRaw(e,t);return await n.value()}async deletePlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling deletePlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling deletePlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async deletePlaylist(e,t){const n=await this.deletePlaylistRaw(e,t);return await n.value()}async favoritePlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling favoritePlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling favoritePlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}/favorites".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"POST",headers:r,query:n,body:dr(e.metadata)},t);return new E(i,(e=>ea(e)))}async favoritePlaylist(e,t){const n=await this.favoritePlaylistRaw(e,t);return await n.value()}async getBulkPlaylistsRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),e.id&&(n.id=e.id),e.permalink&&(n.permalink=e.permalink),e.upc&&(n.upc=e.upc);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists",method:"GET",headers:r,query:n},t);return new E(i,(e=>io(e)))}async getBulkPlaylists(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getBulkPlaylistsRaw(e,t);return await n.value()}async getPlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling getPlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists/{playlist_id}".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>io(e)))}async getPlaylist(e,t){const n=await this.getPlaylistRaw(e,t);return await n.value()}async getPlaylistAccessInfoRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling getPlaylistAccessInfo.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists/{playlist_id}/access-info".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>$(e)))}async getPlaylistAccessInfo(e,t){const n=await this.getPlaylistAccessInfoRaw(e,t);return await n.value()}async getPlaylistTracksRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling getPlaylistTracks.");const n=await this.request({path:"/playlists/{playlist_id}/tracks".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>so(e)))}async getPlaylistTracks(e,t){const n=await this.getPlaylistTracksRaw(e,t);return await n.value()}async getTrendingPlaylistsRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.time&&(n.time=e.time),void 0!==e.type&&(n.type=e.type),void 0!==e.omitTracks&&(n.omit_tracks=e.omitTracks);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists/trending",method:"GET",headers:r,query:n},t);return new E(i,(e=>Is(e)))}async getTrendingPlaylists(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTrendingPlaylistsRaw(e,t);return await n.value()}async getTrendingPlaylistsWithVersionRaw(e,t){if(null===e.version||void 0===e.version)throw new y("version","Required parameter params.version was null or undefined when calling getTrendingPlaylistsWithVersion.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.time&&(n.time=e.time);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists/trending/{version}".replace("{version}",encodeURIComponent(String(e.version))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Is(e)))}async getTrendingPlaylistsWithVersion(e,t){const n=await this.getTrendingPlaylistsWithVersionRaw(e,t);return await n.value()}async getUsersFromPlaylistFavoritesRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling getUsersFromPlaylistFavorites.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists/{playlist_id}/favorites".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>mr(e)))}async getUsersFromPlaylistFavorites(e,t){const n=await this.getUsersFromPlaylistFavoritesRaw(e,t);return await n.value()}async getUsersFromPlaylistRepostsRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling getUsersFromPlaylistReposts.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/playlists/{playlist_id}/reposts".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>mr(e)))}async getUsersFromPlaylistReposts(e,t){const n=await this.getUsersFromPlaylistRepostsRaw(e,t);return await n.value()}async repostPlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling repostPlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling repostPlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}/reposts".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"POST",headers:r,query:n,body:Uo(e.repostRequestBody)},t);return new E(i,(e=>ea(e)))}async repostPlaylist(e,t){const n=await this.repostPlaylistRaw(e,t);return await n.value()}async searchPlaylistsRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.query&&(n.query=e.query),e.genre&&(n.genre=e.genre),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),e.mood&&(n.mood=e.mood),void 0!==e.includePurchaseable&&(n.includePurchaseable=e.includePurchaseable),void 0!==e.hasDownloads&&(n.has_downloads=e.hasDownloads);const r=await this.request({path:"/playlists/search",method:"GET",headers:{},query:n},t);return new E(r,(e=>oo(e)))}async searchPlaylists(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.searchPlaylistsRaw(e,t);return await n.value()}async sharePlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling sharePlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling sharePlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}/shares".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"POST",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async sharePlaylist(e,t){const n=await this.sharePlaylistRaw(e,t);return await n.value()}async unfavoritePlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling unfavoritePlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unfavoritePlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}/favorites".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unfavoritePlaylist(e,t){const n=await this.unfavoritePlaylistRaw(e,t);return await n.value()}async unrepostPlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling unrepostPlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unrepostPlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}/reposts".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unrepostPlaylist(e,t){const n=await this.unrepostPlaylistRaw(e,t);return await n.value()}async updatePlaylistRaw(e,t){if(null===e.playlistId||void 0===e.playlistId)throw new y("playlistId","Required parameter params.playlistId was null or undefined when calling updatePlaylist.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling updatePlaylist.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling updatePlaylist.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/playlists/{playlist_id}".replace("{playlist_id}",encodeURIComponent(String(e.playlistId))),method:"PUT",headers:r,query:n,body:Ps(e.metadata)},t);return new E(i,(e=>ea(e)))}async updatePlaylist(e,t){const n=await this.updatePlaylistRaw(e,t);return await n.value()}}class da extends h{async claimPrizeRaw(e,t){if(null===e.claim||void 0===e.claim)throw new y("claim","Required parameter params.claim was null or undefined when calling claimPrize.");const n={"Content-Type":"application/json"},r=await this.request({path:"/prizes/claim",method:"POST",headers:n,query:{},body:ho(e.claim)},t);return new E(r,(e=>fo(e)))}async claimPrize(e,t){const n=await this.claimPrizeRaw(e,t);return await n.value()}async getPrizesRaw(e){const t=await this.request({path:"/prizes",method:"GET",headers:{},query:{}},e);return new E(t,(e=>go(e)))}async getPrizes(e){const t=await this.getPrizesRaw(e);return await t.value()}async getWalletPrizesRaw(e,t){if(null===e.wallet||void 0===e.wallet)throw new y("wallet","Required parameter params.wallet was null or undefined when calling getWalletPrizes.");const n=await this.request({path:"/wallet/{wallet}/prizes".replace("{wallet}",encodeURIComponent(String(e.wallet))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>bt(e)))}async getWalletPrizes(e,t){const n=await this.getWalletPrizesRaw(e,t);return await n.value()}}class la extends h{async claimRewardsRaw(e,t){if(null===e.reward||void 0===e.reward)throw new y("reward","Required parameter params.reward was null or undefined when calling claimRewards.");const n={"Content-Type":"application/json"},r=await this.request({path:"/rewards/claim",method:"POST",headers:n,query:{},body:ft(e.reward)},t);return new E(r,(e=>gt(e)))}async claimRewards(e,t){const n=await this.claimRewardsRaw(e,t);return await n.value()}async createRewardCodeRaw(e,t){if(null===e.createRewardCodeRequest||void 0===e.createRewardCodeRequest)throw new y("createRewardCodeRequest","Required parameter params.createRewardCodeRequest was null or undefined when calling createRewardCode.");const n={"Content-Type":"application/json"},r=await this.request({path:"/rewards/code",method:"POST",headers:n,query:{},body:Bn(e.createRewardCodeRequest)},t);return new E(r,(e=>Tn(e)))}async createRewardCode(e,t){const n=await this.createRewardCodeRaw(e,t);return await n.value()}}class ha extends h{async searchRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.kind&&(n.kind=e.kind),void 0!==e.includePurchaseable&&(n.includePurchaseable=e.includePurchaseable),e.genre&&(n.genre=e.genre),e.mood&&(n.mood=e.mood),void 0!==e.isVerified&&(n.is_verified=e.isVerified),void 0!==e.hasDownloads&&(n.has_downloads=e.hasDownloads),void 0!==e.isPurchaseable&&(n.is_purchaseable=e.isPurchaseable),e.key&&(n.key=e.key),void 0!==e.bpmMin&&(n.bpm_min=e.bpmMin),void 0!==e.bpmMax&&(n.bpm_max=e.bpmMax),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/search/full",method:"GET",headers:r,query:n},t);return new E(i,(e=>Ko(e)))}async search(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.searchRaw(e,t);return await n.value()}async searchAutocompleteRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.kind&&(n.kind=e.kind),void 0!==e.includePurchaseable&&(n.includePurchaseable=e.includePurchaseable),e.genre&&(n.genre=e.genre),e.mood&&(n.mood=e.mood),void 0!==e.isVerified&&(n.is_verified=e.isVerified),void 0!==e.hasDownloads&&(n.has_downloads=e.hasDownloads),void 0!==e.isPurchaseable&&(n.is_purchaseable=e.isPurchaseable),e.key&&(n.key=e.key),void 0!==e.bpmMin&&(n.bpm_min=e.bpmMin),void 0!==e.bpmMax&&(n.bpm_max=e.bpmMax),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/search/autocomplete",method:"GET",headers:r,query:n},t);return new E(i,(e=>Ho(e)))}async searchAutocomplete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.searchAutocompleteRaw(e,t);return await n.value()}async searchTagsRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.kind&&(n.kind=e.kind),void 0!==e.includePurchaseable&&(n.includePurchaseable=e.includePurchaseable),e.genre&&(n.genre=e.genre),e.mood&&(n.mood=e.mood),void 0!==e.isVerified&&(n.is_verified=e.isVerified),void 0!==e.hasDownloads&&(n.has_downloads=e.hasDownloads),void 0!==e.isPurchaseable&&(n.is_purchaseable=e.isPurchaseable),e.key&&(n.key=e.key),void 0!==e.bpmMin&&(n.bpm_min=e.bpmMin),void 0!==e.bpmMax&&(n.bpm_max=e.bpmMax),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/search/tags",method:"GET",headers:r,query:n},t);return new E(i,(e=>Ko(e)))}async searchTags(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.searchTagsRaw(e,t);return await n.value()}}class fa extends h{async getTipsRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.receiverMinFollowers&&(n.receiver_min_followers=e.receiverMinFollowers),void 0!==e.receiverIsVerified&&(n.receiver_is_verified=e.receiverIsVerified),void 0!==e.currentUserFollows&&(n.current_user_follows=e.currentUserFollows),void 0!==e.uniqueBy&&(n.unique_by=e.uniqueBy),void 0!==e.minSlot&&(n.min_slot=e.minSlot),void 0!==e.maxSlot&&(n.max_slot=e.maxSlot),e.txSignatures&&(n.tx_signatures=e.txSignatures.join(w));const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tips",method:"GET",headers:r,query:n},t);return new E(i,(e=>Sr(e)))}async getTips(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTipsRaw(e,t);return await n.value()}}class pa extends h{async createTrackRaw(e,t){if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling createTrack.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling createTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks",method:"POST",headers:r,query:n,body:Pn(e.metadata)},t);return new E(i,(e=>Un(e)))}async createTrack(e,t){const n=await this.createTrackRaw(e,t);return await n.value()}async deleteTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling deleteTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling deleteTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async deleteTrack(e,t){const n=await this.deleteTrackRaw(e,t);return await n.value()}async downloadTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling downloadTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.userSignature&&(n.user_signature=e.userSignature),void 0!==e.userData&&(n.user_data=e.userData),void 0!==e.nftAccessSignature&&(n.nft_access_signature=e.nftAccessSignature),void 0!==e.filename&&(n.filename=e.filename);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/download".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new k(i)}async downloadTrack(e,t){await this.downloadTrackRaw(e,t)}async favoriteTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling favoriteTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling favoriteTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}/favorites".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"POST",headers:r,query:n,body:dr(e.metadata)},t);return new E(i,(e=>ea(e)))}async favoriteTrack(e,t){const n=await this.favoriteTrackRaw(e,t);return await n.value()}async getBestNewReleasesRaw(e,t){if(null===e.window||void 0===e.window)throw new y("window","Required parameter params.window was null or undefined when calling getBestNewReleases.");const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.window&&(n.window=e.window),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.withUsers&&(n.with_users=e.withUsers);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/best_new_releases",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getBestNewReleases(e,t){const n=await this.getBestNewReleasesRaw(e,t);return await n.value()}async getBulkTracksRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),e.permalink&&(n.permalink=e.permalink),e.id&&(n.id=e.id),e.isrc&&(n.isrc=e.isrc);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getBulkTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getBulkTracksRaw(e,t);return await n.value()}async getFeelingLuckyTracksRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.withUsers&&(n.with_users=e.withUsers),void 0!==e.minFollowers&&(n.min_followers=e.minFollowers);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/feeling-lucky",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getFeelingLuckyTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getFeelingLuckyTracksRaw(e,t);return await n.value()}async getMostLovedTracksRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.withUsers&&(n.with_users=e.withUsers);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/most_loved",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getMostLovedTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getMostLovedTracksRaw(e,t);return await n.value()}async getMostSharedTracksRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.offset&&(n.offset=e.offset),void 0!==e.timeRange&&(n.time_range=e.timeRange);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/most-shared",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getMostSharedTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getMostSharedTracksRaw(e,t);return await n.value()}async getRecentPremiumTracksRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/recent-premium",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getRecentPremiumTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getRecentPremiumTracksRaw(e,t);return await n.value()}async getRecommendedTracksRaw(e,t){const n={};void 0!==e.limit&&(n.limit=e.limit),void 0!==e.genre&&(n.genre=e.genre),void 0!==e.time&&(n.time=e.time),e.exclusionList&&(n.exclusion_list=e.exclusionList),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/recommended",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getRecommendedTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getRecommendedTracksRaw(e,t);return await n.value()}async getRecommendedTracksWithVersionRaw(e,t){if(null===e.version||void 0===e.version)throw new y("version","Required parameter params.version was null or undefined when calling getRecommendedTracksWithVersion.");const n={};void 0!==e.limit&&(n.limit=e.limit),void 0!==e.genre&&(n.genre=e.genre),void 0!==e.time&&(n.time=e.time),e.exclusionList&&(n.exclusion_list=e.exclusionList),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/recommended/{version}".replace("{version}",encodeURIComponent(String(e.version))),method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getRecommendedTracksWithVersion(e,t){const n=await this.getRecommendedTracksWithVersionRaw(e,t);return await n.value()}async getRemixableTracksRaw(e,t){const n={};void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.withUsers&&(n.with_users=e.withUsers);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/remixables",method:"GET",headers:r,query:n},t);return new E(i,(e=>Co(e)))}async getRemixableTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getRemixableTracksRaw(e,t);return await n.value()}async getTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>gs(e)))}async getTrack(e,t){const n=await this.getTrackRaw(e,t);return await n.value()}async getTrackAccessInfoRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackAccessInfo.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/access-info".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>$(e)))}async getTrackAccessInfo(e,t){const n=await this.getTrackAccessInfoRaw(e,t);return await n.value()}async getTrackCommentCountRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackCommentCount.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/comment_count".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ts(e)))}async getTrackCommentCount(e,t){const n=await this.getTrackCommentCountRaw(e,t);return await n.value()}async getTrackCommentNotificationSettingRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackCommentNotificationSetting.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/comment_notification_setting".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ns(e)))}async getTrackCommentNotificationSetting(e,t){const n=await this.getTrackCommentNotificationSettingRaw(e,t);return await n.value()}async getTrackCommentsRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackComments.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/comments".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>rs(e)))}async getTrackComments(e,t){const n=await this.getTrackCommentsRaw(e,t);return await n.value()}async getTrackDownloadCountRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackDownloadCount.");const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const r=await this.request({path:"/tracks/{track_id}/download_count".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:n,query:{}},t);return new E(r,(e=>os(e)))}async getTrackDownloadCount(e,t){const n=await this.getTrackDownloadCountRaw(e,t);return await n.value()}async getTrackDownloadCountsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getTrackDownloadCounts.");const n={};e.id&&(n.id=e.id);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/download_counts",method:"GET",headers:r,query:n},t);return new E(i,(e=>ss(e)))}async getTrackDownloadCounts(e,t){const n=await this.getTrackDownloadCountsRaw(e,t);return await n.value()}async getTrackRemixParentsRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackRemixParents.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/remixing".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Po(e)))}async getTrackRemixParents(e,t){const n=await this.getTrackRemixParentsRaw(e,t);return await n.value()}async getTrackRemixesRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackRemixes.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.onlyCosigns&&(n.only_cosigns=e.onlyCosigns),void 0!==e.onlyContestEntries&&(n.only_contest_entries=e.onlyContestEntries);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/remixes".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Do(e)))}async getTrackRemixes(e,t){const n=await this.getTrackRemixesRaw(e,t);return await n.value()}async getTrackStemsRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackStems.");const n=await this.request({path:"/tracks/{track_id}/stems".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Go(e)))}async getTrackStems(e,t){const n=await this.getTrackStemsRaw(e,t);return await n.value()}async getTrackTopListenersRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getTrackTopListeners.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/top_listeners".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Qo(e)))}async getTrackTopListeners(e,t){const n=await this.getTrackTopListenersRaw(e,t);return await n.value()}async getTracksWithRecentCommentsRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.offset&&(n.offset=e.offset);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/recent-comments",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTracksWithRecentComments(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTracksWithRecentCommentsRaw(e,t);return await n.value()}async getTrendingTrackIDsRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.genre&&(n.genre=e.genre);const r=await this.request({path:"/tracks/trending/ids",method:"GET",headers:{},query:n},t);return new E(r,(e=>ks(e)))}async getTrendingTrackIDs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTrendingTrackIDsRaw(e,t);return await n.value()}async getTrendingTracksRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.genre&&(n.genre=e.genre),void 0!==e.time&&(n.time=e.time);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/trending",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTrendingTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTrendingTracksRaw(e,t);return await n.value()}async getTrendingTracksIDsWithVersionRaw(e,t){if(null===e.version||void 0===e.version)throw new y("version","Required parameter params.version was null or undefined when calling getTrendingTracksIDsWithVersion.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.genre&&(n.genre=e.genre);const r=await this.request({path:"/tracks/trending/ids/{version}".replace("{version}",encodeURIComponent(String(e.version))),method:"GET",headers:{},query:n},t);return new E(r,(e=>ks(e)))}async getTrendingTracksIDsWithVersion(e,t){const n=await this.getTrendingTracksIDsWithVersionRaw(e,t);return await n.value()}async getTrendingTracksWithVersionRaw(e,t){if(null===e.version||void 0===e.version)throw new y("version","Required parameter params.version was null or undefined when calling getTrendingTracksWithVersion.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.genre&&(n.genre=e.genre),void 0!==e.time&&(n.time=e.time);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/trending/{version}".replace("{version}",encodeURIComponent(String(e.version))),method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTrendingTracksWithVersion(e,t){const n=await this.getTrendingTracksWithVersionRaw(e,t);return await n.value()}async getTrendingUSDCPurchaseTracksRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.genre&&(n.genre=e.genre),void 0!==e.time&&(n.time=e.time);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/usdc-purchase",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTrendingUSDCPurchaseTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTrendingUSDCPurchaseTracksRaw(e,t);return await n.value()}async getTrendingUSDCPurchaseTracksWithVersionRaw(e,t){if(null===e.version||void 0===e.version)throw new y("version","Required parameter params.version was null or undefined when calling getTrendingUSDCPurchaseTracksWithVersion.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.genre&&(n.genre=e.genre),void 0!==e.time&&(n.time=e.time);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/usdc-purchase/{version}".replace("{version}",encodeURIComponent(String(e.version))),method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTrendingUSDCPurchaseTracksWithVersion(e,t){const n=await this.getTrendingUSDCPurchaseTracksWithVersionRaw(e,t);return await n.value()}async getTrendingUndergroundWinnersRaw(e,t){const n={};void 0!==e.week&&(n.week=e.week.toISOString().substr(0,10)),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/trending/underground/winners",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTrendingUndergroundWinners(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTrendingUndergroundWinnersRaw(e,t);return await n.value()}async getTrendingWinnersRaw(e,t){const n={};void 0!==e.week&&(n.week=e.week.toISOString().substr(0,10)),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/trending/winners",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getTrendingWinners(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTrendingWinnersRaw(e,t);return await n.value()}async getUnderTheRadarTracksRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.filter&&(n.filter=e.filter),void 0!==e.tracksOnly&&(n.tracks_only=e.tracksOnly),void 0!==e.withUsers&&(n.with_users=e.withUsers);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/under_the_radar",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getUnderTheRadarTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getUnderTheRadarTracksRaw(e,t);return await n.value()}async getUndergroundTrendingTracksRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/trending/underground",method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getUndergroundTrendingTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getUndergroundTrendingTracksRaw(e,t);return await n.value()}async getUndergroundTrendingTracksWithVersionRaw(e,t){if(null===e.version||void 0===e.version)throw new y("version","Required parameter params.version was null or undefined when calling getUndergroundTrendingTracksWithVersion.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/trending/underground/{version}".replace("{version}",encodeURIComponent(String(e.version))),method:"GET",headers:r,query:n},t);return new E(i,(e=>vs(e)))}async getUndergroundTrendingTracksWithVersion(e,t){const n=await this.getUndergroundTrendingTracksWithVersionRaw(e,t);return await n.value()}async getUsersFromFavoritesRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getUsersFromFavorites.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/favorites".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>us(e)))}async getUsersFromFavorites(e,t){const n=await this.getUsersFromFavoritesRaw(e,t);return await n.value()}async getUsersFromRepostsRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling getUsersFromReposts.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/reposts".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ps(e)))}async getUsersFromReposts(e,t){const n=await this.getUsersFromRepostsRaw(e,t);return await n.value()}async inspectTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling inspectTrack.");const n={};void 0!==e.original&&(n.original=e.original);const r=await this.request({path:"/tracks/{track_id}/inspect".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:{},query:n},t);return new E(r,(e=>ls(e)))}async inspectTrack(e,t){const n=await this.inspectTrackRaw(e,t);return await n.value()}async inspectTracksRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling inspectTracks.");const n={};e.id&&(n.id=e.id),void 0!==e.original&&(n.original=e.original);const r=await this.request({path:"/tracks/inspect",method:"GET",headers:{},query:n},t);return new E(r,(e=>hs(e)))}async inspectTracks(e,t){const n=await this.inspectTracksRaw(e,t);return await n.value()}async recordTrackDownloadRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling recordTrackDownload.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}/downloads".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"POST",headers:r,query:n,body:as(e.location)},t);return new E(i,(e=>ea(e)))}async recordTrackDownload(e,t){const n=await this.recordTrackDownloadRaw(e,t);return await n.value()}async repostTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling repostTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling repostTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}/reposts".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"POST",headers:r,query:n,body:Uo(e.repostRequestBody)},t);return new E(i,(e=>ea(e)))}async repostTrack(e,t){const n=await this.repostTrackRaw(e,t);return await n.value()}async searchTracksRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.query&&(n.query=e.query),e.genre&&(n.genre=e.genre),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),e.mood&&(n.mood=e.mood),void 0!==e.onlyDownloadable&&(n.only_downloadable=e.onlyDownloadable),void 0!==e.includePurchaseable&&(n.includePurchaseable=e.includePurchaseable),void 0!==e.isPurchaseable&&(n.is_purchaseable=e.isPurchaseable),void 0!==e.hasDownloads&&(n.has_downloads=e.hasDownloads),e.key&&(n.key=e.key),void 0!==e.bpmMin&&(n.bpm_min=e.bpmMin),void 0!==e.bpmMax&&(n.bpm_max=e.bpmMax);const r=await this.request({path:"/tracks/search",method:"GET",headers:{},query:n},t);return new E(r,(e=>ms(e)))}async searchTracks(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.searchTracksRaw(e,t);return await n.value()}async shareTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling shareTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling shareTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}/shares".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"POST",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async shareTrack(e,t){const n=await this.shareTrackRaw(e,t);return await n.value()}async streamTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling streamTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.preview&&(n.preview=e.preview),void 0!==e.userSignature&&(n.user_signature=e.userSignature),void 0!==e.userData&&(n.user_data=e.userData),void 0!==e.nftAccessSignature&&(n.nft_access_signature=e.nftAccessSignature),void 0!==e.skipPlayCount&&(n.skip_play_count=e.skipPlayCount),void 0!==e.apiKey&&(n.api_key=e.apiKey),void 0!==e.skipCheck&&(n.skip_check=e.skipCheck),void 0!==e.noRedirect&&(n.no_redirect=e.noRedirect);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/tracks/{track_id}/stream".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Zo(e)))}async streamTrack(e,t){const n=await this.streamTrackRaw(e,t);return await n.value()}async unfavoriteTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling unfavoriteTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unfavoriteTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}/favorites".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unfavoriteTrack(e,t){const n=await this.unfavoriteTrackRaw(e,t);return await n.value()}async unrepostTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling unrepostTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unrepostTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}/reposts".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unrepostTrack(e,t){const n=await this.unrepostTrackRaw(e,t);return await n.value()}async updateTrackRaw(e,t){if(null===e.trackId||void 0===e.trackId)throw new y("trackId","Required parameter params.trackId was null or undefined when calling updateTrack.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling updateTrack.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling updateTrack.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/tracks/{track_id}".replace("{track_id}",encodeURIComponent(String(e.trackId))),method:"PUT",headers:r,query:n,body:Us(e.metadata)},t);return new E(i,(e=>ea(e)))}async updateTrack(e,t){const n=await this.updateTrackRaw(e,t);return await n.value()}}class ga extends h{async addManagerRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling addManager.");if(null===e.addManagerRequestBody||void 0===e.addManagerRequestBody)throw new y("addManagerRequestBody","Required parameter params.addManagerRequestBody was null or undefined when calling addManager.");const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(n.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const r=await this.request({path:"/users/{id}/managers".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:ne(e.addManagerRequestBody)},t);return new E(r,(e=>ea(e)))}async addManager(e,t){const n=await this.addManagerRaw(e,t);return await n.value()}async approveGrantRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling approveGrant.");if(null===e.approveGrantRequestBody||void 0===e.approveGrantRequestBody)throw new y("approveGrantRequestBody","Required parameter params.approveGrantRequestBody was null or undefined when calling approveGrant.");const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(n.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const r=await this.request({path:"/users/{id}/grants/approve".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:Pe(e.approveGrantRequestBody)},t);return new E(r,(e=>ea(e)))}async approveGrant(e,t){const n=await this.approveGrantRaw(e,t);return await n.value()}async bulkGetSubscribersRaw(e,t){if(null===e.ids||void 0===e.ids)throw new y("ids","Required parameter params.ids was null or undefined when calling bulkGetSubscribers.");const n={};e.ids&&(n.ids=e.ids.join(w));const r=await this.request({path:"/users/subscribers",method:"GET",headers:{},query:n},t);return new E(r,(e=>ut(e)))}async bulkGetSubscribers(e,t){const n=await this.bulkGetSubscribersRaw(e,t);return await n.value()}async bulkGetSubscribersViaJSONRequestRaw(e,t){if(null===e.ids||void 0===e.ids)throw new y("ids","Required parameter params.ids was null or undefined when calling bulkGetSubscribersViaJSONRequest.");const n={};e.ids&&(n.ids=e.ids.join(w));const r=await this.request({path:"/users/subscribers",method:"POST",headers:{},query:n},t);return new E(r,(e=>ut(e)))}async bulkGetSubscribersViaJSONRequest(e,t){const n=await this.bulkGetSubscribersViaJSONRequestRaw(e,t);return await n.value()}async createGrantRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling createGrant.");if(null===e.createGrantRequestBody||void 0===e.createGrantRequestBody)throw new y("createGrantRequestBody","Required parameter params.createGrantRequestBody was null or undefined when calling createGrant.");const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(n.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const r=await this.request({path:"/users/{id}/grants".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:vn(e.createGrantRequestBody)},t);return new E(r,(e=>ea(e)))}async createGrant(e,t){const n=await this.createGrantRaw(e,t);return await n.value()}async createUserRaw(e,t){if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling createUser.");const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(n.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const r=await this.request({path:"/users",method:"POST",headers:n,query:{},body:Ln(e.metadata)},t);return new E(r,(e=>qn(e)))}async createUser(e,t){const n=await this.createUserRaw(e,t);return await n.value()}async downloadPurchasesAsCSVRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling downloadPurchasesAsCSV.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/purchases/download".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new k(i)}async downloadPurchasesAsCSV(e,t){await this.downloadPurchasesAsCSVRaw(e,t)}async downloadSalesAsCSVRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling downloadSalesAsCSV.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/sales/download".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new k(i)}async downloadSalesAsCSV(e,t){await this.downloadSalesAsCSVRaw(e,t)}async downloadSalesAsJSONRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling downloadSalesAsJSON.");const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.granteeUserId&&(n.grantee_user_id=e.granteeUserId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/sales/download/json".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>No(e)))}async downloadSalesAsJSON(e,t){const n=await this.downloadSalesAsJSONRaw(e,t);return await n.value()}async downloadUSDCWithdrawalsAsCSVRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling downloadUSDCWithdrawalsAsCSV.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/withdrawals/download".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new k(i)}async downloadUSDCWithdrawalsAsCSV(e,t){await this.downloadUSDCWithdrawalsAsCSVRaw(e,t)}async followUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling followUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling followUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}/follow".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async followUser(e,t){const n=await this.followUserRaw(e,t);return await n.value()}async getAIAttributedTracksByUserHandleRaw(e,t){if(null===e.handle||void 0===e.handle)throw new y("handle","Required parameter params.handle was null or undefined when calling getAIAttributedTracksByUserHandle.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sort&&(n.sort=e.sort),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.filterTracks&&(n.filter_tracks=e.filterTracks);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/handle/{handle}/tracks/ai_attributed".replace("{handle}",encodeURIComponent(String(e.handle))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ys(e)))}async getAIAttributedTracksByUserHandle(e,t){const n=await this.getAIAttributedTracksByUserHandleRaw(e,t);return await n.value()}async getAlbumsByUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getAlbumsByUser.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.query&&(n.query=e.query);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/albums".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Be(e)))}async getAlbumsByUser(e,t){const n=await this.getAlbumsByUserRaw(e,t);return await n.value()}async getAudioTransactionCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getAudioTransactionCount.");const n={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(n["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(n["Encoded-Data-Signature"]=String(e.encodedDataSignature));const r=await this.request({path:"/users/{id}/transactions/audio/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new E(r,(e=>_s(e)))}async getAudioTransactionCount(e,t){const n=await this.getAudioTransactionCountRaw(e,t);return await n.value()}async getAudioTransactionsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getAudioTransactions.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature));const i=await this.request({path:"/users/{id}/transactions/audio".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>As(e)))}async getAudioTransactions(e,t){const n=await this.getAudioTransactionsRaw(e,t);return await n.value()}async getAuthorizedAppsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getAuthorizedApps.");const n=await this.request({path:"/users/{id}/authorized_apps".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Je(e)))}async getAuthorizedApps(e,t){const n=await this.getAuthorizedAppsRaw(e,t);return await n.value()}async getBulkUsersRaw(e,t){const n={};void 0!==e.userId&&(n.user_id=e.userId),e.id&&(n.id=e.id);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users",method:"GET",headers:r,query:n},t);return new E(i,(e=>Vs(e)))}async getBulkUsers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getBulkUsersRaw(e,t);return await n.value()}async getConnectedWalletsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getConnectedWallets.");const n=await this.request({path:"/users/{id}/connected_wallets".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>an(e)))}async getConnectedWallets(e,t){const n=await this.getConnectedWalletsRaw(e,t);return await n.value()}async getFollowersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getFollowers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/followers".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>gr(e)))}async getFollowers(e,t){const n=await this.getFollowersRaw(e,t);return await n.value()}async getFollowingRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getFollowing.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/following".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>mr(e)))}async getFollowing(e,t){const n=await this.getFollowingRaw(e,t);return await n.value()}async getManagedUsersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getManagedUsers.");const n={};void 0!==e.isApproved&&(n.is_approved=e.isApproved),void 0!==e.isRevoked&&(n.is_revoked=e.isRevoked);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature));const i=await this.request({path:"/users/{id}/managed_users".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Fr(e)))}async getManagedUsers(e,t){const n=await this.getManagedUsersRaw(e,t);return await n.value()}async getManagersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getManagers.");const n={};void 0!==e.isApproved&&(n.is_approved=e.isApproved),void 0!==e.isRevoked&&(n.is_revoked=e.isRevoked);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature));const i=await this.request({path:"/users/{id}/managers".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Lr(e)))}async getManagers(e,t){const n=await this.getManagersRaw(e,t);return await n.value()}async getMeRaw(e){const t={};this.configuration&&this.configuration.accessToken&&(t.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const n=await this.request({path:"/me",method:"GET",headers:t,query:{}},e);return new E(n,(e=>Gs(e)))}async getMe(e){const t=await this.getMeRaw(e);return await t.value()}async getMutedUsersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getMutedUsers.");const n={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(n["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(n["Encoded-Data-Signature"]=String(e.encodedDataSignature));const r=await this.request({path:"/users/{id}/muted".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new E(r,(e=>Vs(e)))}async getMutedUsers(e,t){const n=await this.getMutedUsersRaw(e,t);return await n.value()}async getMutualFollowersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getMutualFollowers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/mutuals".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Kr(e)))}async getMutualFollowers(e,t){const n=await this.getMutualFollowersRaw(e,t);return await n.value()}async getPlaylistsByUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getPlaylistsByUser.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.query&&(n.query=e.query);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/playlists".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>lo(e)))}async getPlaylistsByUser(e,t){const n=await this.getPlaylistsByUserRaw(e,t);return await n.value()}async getPurchasersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getPurchasers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.contentType&&(n.content_type=e.contentType),void 0!==e.contentId&&(n.content_id=e.contentId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/purchasers".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>vo(e)))}async getPurchasers(e,t){const n=await this.getPurchasersRaw(e,t);return await n.value()}async getPurchasersCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getPurchasersCount.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.contentType&&(n.content_type=e.contentType),void 0!==e.contentId&&(n.content_id=e.contentId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/purchasers/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>wo(e)))}async getPurchasersCount(e,t){const n=await this.getPurchasersCountRaw(e,t);return await n.value()}async getPurchasesRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getPurchases.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),e.contentIds&&(n.content_ids=e.contentIds);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/purchases".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>_o(e)))}async getPurchases(e,t){const n=await this.getPurchasesRaw(e,t);return await n.value()}async getPurchasesCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getPurchasesCount.");const n={};void 0!==e.userId&&(n.user_id=e.userId),e.contentIds&&(n.content_ids=e.contentIds);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/purchases/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>bo(e)))}async getPurchasesCount(e,t){const n=await this.getPurchasesCountRaw(e,t);return await n.value()}async getRelatedUsersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getRelatedUsers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.filterFollowed&&(n.filter_followed=e.filterFollowed);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/related".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>So(e)))}async getRelatedUsers(e,t){const n=await this.getRelatedUsersRaw(e,t);return await n.value()}async getRemixersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getRemixers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.trackId&&(n.track_id=e.trackId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/remixers".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>To(e)))}async getRemixers(e,t){const n=await this.getRemixersRaw(e,t);return await n.value()}async getRemixersCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getRemixersCount.");const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.trackId&&(n.track_id=e.trackId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/remixers/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Bo(e)))}async getRemixersCount(e,t){const n=await this.getRemixersCountRaw(e,t);return await n.value()}async getRepostsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getReposts.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/reposts".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Oo(e)))}async getReposts(e,t){const n=await this.getRepostsRaw(e,t);return await n.value()}async getRepostsByHandleRaw(e,t){if(null===e.handle||void 0===e.handle)throw new y("handle","Required parameter params.handle was null or undefined when calling getRepostsByHandle.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/handle/{handle}/reposts".replace("{handle}",encodeURIComponent(String(e.handle))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Oo(e)))}async getRepostsByHandle(e,t){const n=await this.getRepostsByHandleRaw(e,t);return await n.value()}async getSalesRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSales.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),e.contentIds&&(n.content_ids=e.contentIds);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/sales".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>_o(e)))}async getSales(e,t){const n=await this.getSalesRaw(e,t);return await n.value()}async getSalesAggregateRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSalesAggregate.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/sales/aggregate".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>qo(e)))}async getSalesAggregate(e,t){const n=await this.getSalesAggregateRaw(e,t);return await n.value()}async getSalesCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSalesCount.");const n={};void 0!==e.userId&&(n.user_id=e.userId),e.contentIds&&(n.content_ids=e.contentIds);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/sales/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>bo(e)))}async getSalesCount(e,t){const n=await this.getSalesCountRaw(e,t);return await n.value()}async getSubscribersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSubscribers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/subscribers".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Yo(e)))}async getSubscribers(e,t){const n=await this.getSubscribersRaw(e,t);return await n.value()}async getSupportedUsersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSupportedUsers.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/supporting".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>vr(e)))}async getSupportedUsers(e,t){const n=await this.getSupportedUsersRaw(e,t);return await n.value()}async getSupporterRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSupporter.");if(null===e.supporterUserId||void 0===e.supporterUserId)throw new y("supporterUserId","Required parameter params.supporterUserId was null or undefined when calling getSupporter.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/supporters/{supporter_user_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{supporter_user_id}",encodeURIComponent(String(e.supporterUserId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>_r(e)))}async getSupporter(e,t){const n=await this.getSupporterRaw(e,t);return await n.value()}async getSupportersRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSupporters.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/supporters".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Ar(e)))}async getSupporters(e,t){const n=await this.getSupportersRaw(e,t);return await n.value()}async getSupportingRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getSupporting.");if(null===e.supportedUserId||void 0===e.supportedUserId)throw new y("supportedUserId","Required parameter params.supportedUserId was null or undefined when calling getSupporting.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/supporting/{supported_user_id}".replace("{id}",encodeURIComponent(String(e.id))).replace("{supported_user_id}",encodeURIComponent(String(e.supportedUserId))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Er(e)))}async getSupporting(e,t){const n=await this.getSupportingRaw(e,t);return await n.value()}async getTopTrackTagsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getTopTrackTags.");const n={};void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/tags".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Jo(e)))}async getTopTrackTags(e,t){const n=await this.getTopTrackTagsRaw(e,t);return await n.value()}async getTopUsersRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/top",method:"GET",headers:r,query:n},t);return new E(i,(e=>es(e)))}async getTopUsers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTopUsersRaw(e,t);return await n.value()}async getTopUsersInGenreRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),e.genre&&(n.genre=e.genre);const r=await this.request({path:"/users/genre/top",method:"GET",headers:{},query:n},t);return new E(r,(e=>Xo(e)))}async getTopUsersInGenre(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.getTopUsersInGenreRaw(e,t);return await n.value()}async getTracksByUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getTracksByUser.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sort&&(n.sort=e.sort),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.filterTracks&&(n.filter_tracks=e.filterTracks),e.gateCondition&&(n.gate_condition=e.gateCondition);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/tracks".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ys(e)))}async getTracksByUser(e,t){const n=await this.getTracksByUserRaw(e,t);return await n.value()}async getTracksByUserHandleRaw(e,t){if(null===e.handle||void 0===e.handle)throw new y("handle","Required parameter params.handle was null or undefined when calling getTracksByUserHandle.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.sort&&(n.sort=e.sort),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.filterTracks&&(n.filter_tracks=e.filterTracks);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/handle/{handle}/tracks".replace("{handle}",encodeURIComponent(String(e.handle))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ys(e)))}async getTracksByUserHandle(e,t){const n=await this.getTracksByUserHandleRaw(e,t);return await n.value()}async getTracksCountByUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getTracksCountByUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.filterTracks&&(n.filter_tracks=e.filterTracks),e.gateCondition&&(n.gate_condition=e.gateCondition);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/tracks/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ws(e)))}async getTracksCountByUser(e,t){const n=await this.getTracksCountByUserRaw(e,t);return await n.value()}async getUSDCTransactionCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUSDCTransactionCount.");const n={};e.type&&(n.type=e.type),void 0!==e.includeSystemTransactions&&(n.include_system_transactions=e.includeSystemTransactions),void 0!==e.method&&(n.method=e.method);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature));const i=await this.request({path:"/users/{id}/transactions/usdc/count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>_s(e)))}async getUSDCTransactionCount(e,t){const n=await this.getUSDCTransactionCountRaw(e,t);return await n.value()}async getUSDCTransactionsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUSDCTransactions.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),e.type&&(n.type=e.type),void 0!==e.includeSystemTransactions&&(n.include_system_transactions=e.includeSystemTransactions),void 0!==e.method&&(n.method=e.method);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature));const i=await this.request({path:"/users/{id}/transactions/usdc".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>As(e)))}async getUSDCTransactions(e,t){const n=await this.getUSDCTransactionsRaw(e,t);return await n.value()}async getUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Gs(e)))}async getUser(e,t){const n=await this.getUserRaw(e,t);return await n.value()}async getUserAccountRaw(e,t){if(null===e.wallet||void 0===e.wallet)throw new y("wallet","Required parameter params.wallet was null or undefined when calling getUserAccount.");const n={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(n["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(n["Encoded-Data-Signature"]=String(e.encodedDataSignature));const r=await this.request({path:"/users/account/{wallet}".replace("{wallet}",encodeURIComponent(String(e.wallet))),method:"GET",headers:n,query:{}},t);return new E(r,(e=>Fs(e)))}async getUserAccount(e,t){const n=await this.getUserAccountRaw(e,t);return await n.value()}async getUserBalanceHistoryRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserBalanceHistory.");const n={};void 0!==e.startTime&&(n.start_time=e.startTime.toISOString()),void 0!==e.endTime&&(n.end_time=e.endTime.toISOString()),void 0!==e.granularity&&(n.granularity=e.granularity),void 0!==e.userId&&(n.user_id=e.userId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/balance/history".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Qe(e)))}async getUserBalanceHistory(e,t){const n=await this.getUserBalanceHistoryRaw(e,t);return await n.value()}async getUserByHandleRaw(e,t){if(null===e.handle||void 0===e.handle)throw new y("handle","Required parameter params.handle was null or undefined when calling getUserByHandle.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/handle/{handle}".replace("{handle}",encodeURIComponent(String(e.handle))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Gs(e)))}async getUserByHandle(e,t){const n=await this.getUserByHandleRaw(e,t);return await n.value()}async getUserChallengesRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserChallenges.");const n={};void 0!==e.showHistorical&&(n.show_historical=e.showHistorical);const r=await this.request({path:"/users/{id}/challenges".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:n},t);return new E(r,(e=>yr(e)))}async getUserChallenges(e,t){const n=await this.getUserChallengesRaw(e,t);return await n.value()}async getUserCoinRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserCoin.");if(null===e.mint||void 0===e.mint)throw new y("mint","Required parameter params.mint was null or undefined when calling getUserCoin.");const n=await this.request({path:"/users/{id}/coins/{mint}".replace("{id}",encodeURIComponent(String(e.id))).replace("{mint}",encodeURIComponent(String(e.mint))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>zs(e)))}async getUserCoin(e,t){const n=await this.getUserCoinRaw(e,t);return await n.value()}async getUserCoinsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserCoins.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit);const r=await this.request({path:"/users/{id}/coins".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:n},t);return new E(r,(e=>Ns(e)))}async getUserCoins(e,t){const n=await this.getUserCoinsRaw(e,t);return await n.value()}async getUserCollectiblesRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserCollectibles.");const n=await this.request({path:"/users/{id}/collectibles".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Ft(e)))}async getUserCollectibles(e,t){const n=await this.getUserCollectiblesRaw(e,t);return await n.value()}async getUserCommentsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserComments.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/comments".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>js(e)))}async getUserComments(e,t){const n=await this.getUserCommentsRaw(e,t);return await n.value()}async getUserEmailKeyRaw(e,t){if(null===e.receivingUserId||void 0===e.receivingUserId)throw new y("receivingUserId","Required parameter params.receivingUserId was null or undefined when calling getUserEmailKey.");if(null===e.grantorUserId||void 0===e.grantorUserId)throw new y("grantorUserId","Required parameter params.grantorUserId was null or undefined when calling getUserEmailKey.");const n=await this.request({path:"/users/{receiving_user_id}/emails/{grantor_user_id}/key".replace("{receiving_user_id}",encodeURIComponent(String(e.receivingUserId))).replace("{grantor_user_id}",encodeURIComponent(String(e.grantorUserId))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>Zn(e)))}async getUserEmailKey(e,t){const n=await this.getUserEmailKeyRaw(e,t);return await n.value()}async getUserFavoriteTracksRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserFavoriteTracks.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/favorites/tracks".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>fs(e)))}async getUserFavoriteTracks(e,t){const n=await this.getUserFavoriteTracksRaw(e,t);return await n.value()}async getUserFavoritesRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserFavorites.");const n=await this.request({path:"/users/{id}/favorites".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new E(n,(e=>lr(e)))}async getUserFavorites(e,t){const n=await this.getUserFavoritesRaw(e,t);return await n.value()}async getUserFeedRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserFeed.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.filter&&(n.filter=e.filter),void 0!==e.tracksOnly&&(n.tracks_only=e.tracksOnly),void 0!==e.withUsers&&(n.with_users=e.withUsers),e.followeeUserId&&(n.followee_user_id=e.followeeUserId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/feed".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Ws(e)))}async getUserFeed(e,t){const n=await this.getUserFeedRaw(e,t);return await n.value()}async getUserIDsByAddressesRaw(e,t){if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling getUserIDsByAddresses.");const n={};e.address&&(n.address=e.address);const r=await this.request({path:"/users/address",method:"GET",headers:{},query:n},t);return new E(r,(e=>Ks(e)))}async getUserIDsByAddresses(e,t){const n=await this.getUserIDsByAddressesRaw(e,t);return await n.value()}async getUserLibraryAlbumsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserLibraryAlbums.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.type&&(n.type=e.type),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/library/albums".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>qt(e)))}async getUserLibraryAlbums(e,t){const n=await this.getUserLibraryAlbumsRaw(e,t);return await n.value()}async getUserLibraryPlaylistsRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserLibraryPlaylists.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.type&&(n.type=e.type),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/library/playlists".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>qt(e)))}async getUserLibraryPlaylists(e,t){const n=await this.getUserLibraryPlaylistsRaw(e,t);return await n.value()}async getUserLibraryTracksRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserLibraryTracks.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.type&&(n.type=e.type);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/library/tracks".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>fs(e)))}async getUserLibraryTracks(e,t){const n=await this.getUserLibraryTracksRaw(e,t);return await n.value()}async getUserMonthlyTrackListensRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserMonthlyTrackListens.");if(null===e.startTime||void 0===e.startTime)throw new y("startTime","Required parameter params.startTime was null or undefined when calling getUserMonthlyTrackListens.");if(null===e.endTime||void 0===e.endTime)throw new y("endTime","Required parameter params.endTime was null or undefined when calling getUserMonthlyTrackListens.");const n={};void 0!==e.startTime&&(n.start_time=e.startTime),void 0!==e.endTime&&(n.end_time=e.endTime);const r=await this.request({path:"/users/{id}/listen_counts_monthly".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:n},t);return new E(r,(e=>Ys(e)))}async getUserMonthlyTrackListens(e,t){const n=await this.getUserMonthlyTrackListensRaw(e,t);return await n.value()}async getUserRecommendedTracksRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserRecommendedTracks.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId),void 0!==e.timeRange&&(n.time_range=e.timeRange);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/recommended-tracks".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>ys(e)))}async getUserRecommendedTracks(e,t){const n=await this.getUserRecommendedTracksRaw(e,t);return await n.value()}async getUserTracksDownloadCountRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserTracksDownloadCount.");const n={};this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const r=await this.request({path:"/users/{id}/tracks/download_count".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new E(r,(e=>Js(e)))}async getUserTracksDownloadCount(e,t){const n=await this.getUserTracksDownloadCountRaw(e,t);return await n.value()}async getUserTracksRemixedRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUserTracksRemixed.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.userId&&(n.user_id=e.userId);const r={};this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/tracks/remixed".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Xs(e)))}async getUserTracksRemixed(e,t){const n=await this.getUserTracksRemixedRaw(e,t);return await n.value()}async getUsersTrackHistoryRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling getUsersTrackHistory.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.query&&(n.query=e.query),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.sortDirection&&(n.sort_direction=e.sortDirection),void 0!==e.userId&&(n.user_id=e.userId);const r={};void 0!==e.encodedDataMessage&&null!==e.encodedDataMessage&&(r["Encoded-Data-Message"]=String(e.encodedDataMessage)),void 0!==e.encodedDataSignature&&null!==e.encodedDataSignature&&(r["Encoded-Data-Signature"]=String(e.encodedDataSignature)),this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["read"]));const i=await this.request({path:"/users/{id}/history/tracks".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:r,query:n},t);return new E(i,(e=>Tr(e)))}async getUsersTrackHistory(e,t){const n=await this.getUsersTrackHistoryRaw(e,t);return await n.value()}async muteUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling muteUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling muteUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}/muted".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async muteUser(e,t){const n=await this.muteUserRaw(e,t);return await n.value()}async removeManagerRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling removeManager.");if(null===e.managerUserId||void 0===e.managerUserId)throw new y("managerUserId","Required parameter params.managerUserId was null or undefined when calling removeManager.");const n={};if(this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(n.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const r=await this.request({path:"/users/{id}/managers/{managerUserId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{managerUserId}",encodeURIComponent(String(e.managerUserId))),method:"DELETE",headers:n,query:{}},t);return new E(r,(e=>ea(e)))}async removeManager(e,t){const n=await this.removeManagerRaw(e,t);return await n.value()}async revokeGrantRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling revokeGrant.");if(null===e.address||void 0===e.address)throw new y("address","Required parameter params.address was null or undefined when calling revokeGrant.");const n={};if(this.configuration&&this.configuration.accessToken&&(n.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(n.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const r=await this.request({path:"/users/{id}/grants/{address}".replace("{id}",encodeURIComponent(String(e.id))).replace("{address}",encodeURIComponent(String(e.address))),method:"DELETE",headers:n,query:{}},t);return new E(r,(e=>ea(e)))}async revokeGrant(e,t){const n=await this.revokeGrantRaw(e,t);return await n.value()}async searchUsersRaw(e,t){const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit),void 0!==e.query&&(n.query=e.query),e.genre&&(n.genre=e.genre),void 0!==e.sortMethod&&(n.sort_method=e.sortMethod),void 0!==e.isVerified&&(n.is_verified=e.isVerified);const r=await this.request({path:"/users/search",method:"GET",headers:{},query:n},t);return new E(r,(e=>Zs(e)))}async searchUsers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=await this.searchUsersRaw(e,t);return await n.value()}async subscribeToUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling subscribeToUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling subscribeToUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}/subscribers".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async subscribeToUser(e,t){const n=await this.subscribeToUserRaw(e,t);return await n.value()}async unfollowUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling unfollowUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unfollowUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}/follow".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unfollowUser(e,t){const n=await this.unfollowUserRaw(e,t);return await n.value()}async unmuteUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling unmuteUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unmuteUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}/muted".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unmuteUser(e,t){const n=await this.unmuteUserRaw(e,t);return await n.value()}async unsubscribeFromUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling unsubscribeFromUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling unsubscribeFromUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}/subscribers".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:r,query:n},t);return new E(i,(e=>ea(e)))}async unsubscribeFromUser(e,t){const n=await this.unsubscribeFromUserRaw(e,t);return await n.value()}async updateUserRaw(e,t){if(null===e.id||void 0===e.id)throw new y("id","Required parameter params.id was null or undefined when calling updateUser.");if(null===e.userId||void 0===e.userId)throw new y("userId","Required parameter params.userId was null or undefined when calling updateUser.");if(null===e.metadata||void 0===e.metadata)throw new y("metadata","Required parameter params.metadata was null or undefined when calling updateUser.");const n={};void 0!==e.userId&&(n.user_id=e.userId);const r={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken&&(r.Authorization=await this.configuration.accessToken("OAuth2",["write"])),!this.configuration||void 0===this.configuration.username&&void 0===this.configuration.password||(r.Authorization="Basic "+btoa(this.configuration.username+":"+this.configuration.password)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=await e("BearerAuth",[]);t&&(r.Authorization=`Bearer ${t}`)}const i=await this.request({path:"/users/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:r,query:n,body:Os(e.metadata)},t);return new E(i,(e=>ea(e)))}async updateUser(e,t){const n=await this.updateUserRaw(e,t);return await n.value()}async verifyIDTokenRaw(e,t){if(null===e.token||void 0===e.token)throw new y("token","Required parameter params.token was null or undefined when calling verifyIDToken.");const n={};void 0!==e.token&&(n.token=e.token);const r=await this.request({path:"/users/verify_token",method:"GET",headers:{},query:n},t);return new E(r,(e=>Qs(e)))}async verifyIDToken(e,t){const n=await this.verifyIDTokenRaw(e,t);return await n.value()}}class ma extends h{async getWalletCoinsRaw(e,t){if(null===e.walletId||void 0===e.walletId)throw new y("walletId","Required parameter params.walletId was null or undefined when calling getWalletCoins.");const n={};void 0!==e.offset&&(n.offset=e.offset),void 0!==e.limit&&(n.limit=e.limit);const r=await this.request({path:"/wallet/{walletId}/coins".replace("{walletId}",encodeURIComponent(String(e.walletId))),method:"GET",headers:{},query:n},t);return new E(r,(e=>Ns(e)))}async getWalletCoins(e,t){const n=await this.getWalletCoinsRaw(e,t);return await n.value()}}class ya extends h{async resolveRaw(e){if(null===e.url||void 0===e.url)throw new y("url","Required parameter params.url was null or undefined when calling resolve.");const t={};void 0!==e.url&&(t.url=e.url);const n=await this.request({path:"/resolve",method:"GET",headers:{},query:t});return new E(n,(e=>{var t;const r=null!==(t=null==e?void 0:e.data)&&void 0!==t?t:{};if(ke(Se(r)))return gs(e);if(Array.isArray(r)&&r.length>0&&tt(rt(r[0])))return io(e);if(Y(X(r)))return Vs(e);throw new g(n,"Invalid response type")}))}async resolve(e){return await(await this.resolveRaw(e)).value()}static instanceOfTrackResponse(e){return!!e.data&&ke(e.data)}static instanceOfPlaylistResponse(e){return!!e.data&&Array.isArray(e.data)&&!!e.data[0]&&tt(e.data[0])}static instanceOfUserResponse(e){return!!e.data&&Y(e.data)}}class wa{constructor(e){u(this,"storage",void 0),this.storage=e.storage}createAudioUpload(e){var t,n;let{file:r,onProgress:i,previewStartSeconds:o,placementHosts:s}=e;const a=this.storage.uploadFile({file:r,onProgress:i,metadata:{template:"audio",filename:null!==(t=r.name)&&void 0!==t?t:void 0,filetype:null!==(n=r.type)&&void 0!==n?n:void 0,previewStartSeconds:o,placementHosts:null==s?void 0:s.join(",")}});return{abort:a.abort,start:()=>a.start().then((e=>{var t,n,r,i,s;return{trackCid:e.results[320],previewCid:null!=o?e.results[`320_preview|${o}`]:void 0,origFileCid:e.orig_file_cid,origFilename:e.orig_filename,duration:parseInt(null!==(t=null==e||null===(n=e.probe)||void 0===n||null===(r=n.format)||void 0===r?void 0:r.duration)&&void 0!==t?t:"0",10),bpm:null===(i=e.audio_analysis_results)||void 0===i?void 0:i.bpm,musicalKey:null===(s=e.audio_analysis_results)||void 0===s?void 0:s.key}}))}}createImageUpload(e){var t,n;let{file:r,onProgress:i,isBackdrop:o=!1,placementHosts:s}=e;const a=this.storage.uploadFile({file:r,onProgress:i,metadata:{template:o?"img_backdrop":"img_square",filename:null!==(t=r.name)&&void 0!==t?t:void 0,filetype:null!==(n=r.type)&&void 0!==n?n:void 0,placementHosts:null==s?void 0:s.join(",")}});return{abort:a.abort,start:()=>a.start().then((e=>e.orig_file_cid))}}}function va(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function ba(e){if(!((t=e)instanceof Uint8Array||null!=t&&"object"==typeof t&&"Uint8Array"===t.constructor.name))throw new Error("Uint8Array expected");for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(r.length>0&&!r.includes(e.length))throw new Error(`Uint8Array expected of length ${r}, not of length=${e.length}`)}function _a(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Aa(e,t){ba(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Ea="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,ka=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ia=(e,t)=>e<<32-t|e>>>t,Sa=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];
2
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ca(e){for(let n=0;n<e.length;n++)e[n]=(t=e[n])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function xa(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),ba(e),e}class Ba{clone(){return this._cloneInto()}}function Ta(e){const t=t=>e().update(xa(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ra(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Ea&&"function"==typeof Ea.getRandomValues)return Ea.getRandomValues(new Uint8Array(e));if(Ea&&"function"==typeof Ea.randomBytes)return Ea.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}class Da extends Ba{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");va(e.outputLen),va(e.blockLen)}(e);const n=xa(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return _a(this),this.iHash.update(e),this}digestInto(e){_a(this),ba(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Pa=(e,t,n)=>new Da(e,t).update(n).digest();Pa.create=(e,t)=>new Da(e,t);const Ua=(e,t,n)=>e&t^e&n^t&n;class Oa extends Ba{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ka(this.buffer)}update(e){_a(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=xa(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=ka(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){_a(this),Aa(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=ka(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,c[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}}const Fa=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ma=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),La=new Uint32Array(64);class qa extends Oa{constructor(){super(64,32,8,!1),this.A=0|Ma[0],this.B=0|Ma[1],this.C=0|Ma[2],this.D=0|Ma[3],this.E=0|Ma[4],this.F=0|Ma[5],this.G=0|Ma[6],this.H=0|Ma[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)La[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=La[e-15],n=La[e-2],r=Ia(t,7)^Ia(t,18)^t>>>3,i=Ia(n,17)^Ia(n,19)^n>>>10;La[e]=i+La[e-7]+r+La[e-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let e=0;e<64;e++){const t=c+(Ia(s,6)^Ia(s,11)^Ia(s,25))+((d=s)&a^~d&u)+Fa[e]+La[e]|0,l=(Ia(n,2)^Ia(n,13)^Ia(n,22))+Ua(n,r,i)|0;c=u,u=a,a=s,s=o+t|0,o=i,i=r,r=n,n=t+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){La.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const za=Ta((()=>new qa)),Na=BigInt(2**32-1),ja=BigInt(32);function $a(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&Na),l:Number(e>>ja&Na)}:{h:0|Number(e>>ja&Na),l:0|Number(e&Na)}}function Wa(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=$a(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]}const Ha=BigInt(0),Ka=BigInt(1),Va=BigInt(2);function Ga(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function Za(e){if(!Ga(e))throw new Error("Uint8Array expected")}function Ya(e,t){if("boolean"!=typeof t)throw new Error(`${e} must be valid boolean, got "${t}".`)}const Ja=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Xa(e){Za(e);let t="";for(let n=0;n<e.length;n++)t+=Ja[e[n]];return t}function Qa(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function eu(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}const tu={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function nu(e){return e>=tu._0&&e<=tu._9?e-tu._0:e>=tu._A&&e<=tu._F?e-(tu._A-10):e>=tu._a&&e<=tu._f?e-(tu._a-10):void 0}function ru(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){const n=nu(e.charCodeAt(i)),o=nu(e.charCodeAt(i+1));if(void 0===n||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}r[t]=16*n+o}return r}function iu(e){return eu(Xa(e))}function ou(e){return Za(e),eu(Xa(Uint8Array.from(e).reverse()))}function su(e,t){return ru(e.toString(16).padStart(2*t,"0"))}function au(e,t){return su(e,t).reverse()}function uu(e,t,n){let r;if("string"==typeof t)try{r=ru(t)}catch(n){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else{if(!Ga(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(`${e} expected ${n} bytes, got ${i}`);return r}function cu(){let e=0;for(let t=0;t<arguments.length;t++){const n=t<0||arguments.length<=t?void 0:arguments[t];Za(n),e+=n.length}const t=new Uint8Array(e);for(let e=0,n=0;e<arguments.length;e++){const r=e<0||arguments.length<=e?void 0:arguments[e];t.set(r,n),n+=r.length}return t}const du=e=>"bigint"==typeof e&&Ha<=e;function lu(e,t,n){return du(e)&&du(t)&&du(n)&&t<=e&&e<n}function hu(e,t,n,r){if(!lu(t,n,r))throw new Error(`expected valid ${e}: ${n} <= n < ${r}, got ${typeof t} ${t}`)}function fu(e){let t;for(t=0;e>Ha;e>>=Ka,t+=1);return t}const pu=e=>(Va<<BigInt(e-1))-Ka,gu=e=>new Uint8Array(e),mu=e=>Uint8Array.from(e);function yu(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=gu(e),i=gu(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return n(i,r,...t)},u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gu();i=a(mu([0]),e),r=a(),0!==e.length&&(i=a(mu([1]),e),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return cu(...n)};return(e,t)=>{let n;for(s(),u(e);!(n=t(c()));)u();return s(),n}}const wu={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||Ga(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function vu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(t,n,r)=>{const i=wu[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=e[t];if(!(r&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}function bu(e){const t=new WeakMap;return function(n){const r=t.get(n);if(void 0!==r)return r;for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];const a=e(n,...o);return t.set(n,a),a}}var _u=Object.freeze({__proto__:null,isBytes:Ga,abytes:Za,abool:Ya,bytesToHex:Xa,numberToHexUnpadded:Qa,hexToNumber:eu,hexToBytes:ru,bytesToNumberBE:iu,bytesToNumberLE:ou,numberToBytesBE:su,numberToBytesLE:au,numberToVarBytesBE:function(e){return ru(Qa(e))},ensureBytes:uu,concatBytes:cu,equalBytes:function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},utf8ToBytes:function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},inRange:lu,aInRange:hu,bitLen:fu,bitGet:function(e,t){return e>>BigInt(t)&Ka},bitSet:function(e,t,n){return e|(n?Ka:Ha)<<BigInt(t)},bitMask:pu,createHmacDrbg:yu,validateObject:vu,notImplemented:()=>{throw new Error("not implemented")},memoized:bu});
3
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Au=BigInt(0),Eu=BigInt(1),ku=BigInt(2),Iu=BigInt(3),Su=BigInt(4),Cu=BigInt(5),xu=BigInt(8);function Bu(e,t){const n=e%t;return n>=Au?n:t+n}function Tu(e,t,n){if(n<=Au||t<Au)throw new Error("Expected power/modulo > 0");if(n===Eu)return Au;let r=Eu;for(;t>Au;)t&Eu&&(r=r*e%n),e=e*e%n,t>>=Eu;return r}function Ru(e,t,n){let r=e;for(;t-- >Au;)r*=r,r%=n;return r}function Du(e,t){if(e===Au||t<=Au)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=Bu(e,t),r=t,i=Au,o=Eu;for(;n!==Au;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==Eu)throw new Error("invert: does not exist");return Bu(i,t)}function Pu(e){if(e%Su===Iu){const t=(e+Eu)/Su;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%xu===Cu){const t=(e-Cu)/xu;return function(e,n){const r=e.mul(n,ku),i=e.pow(r,t),o=e.mul(n,i),s=e.mul(e.mul(o,ku),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-Eu)/ku;let n,r,i;for(n=e-Eu,r=0;n%ku===Au;n/=ku,r++);for(i=ku;i<e&&Tu(i,t,e)!==e-Eu;i++);if(1===r){const t=(e+Eu)/Su;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const o=(n+Eu)/ku;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,u=e.pow(e.mul(e.ONE,i),n),c=e.pow(s,o),d=e.pow(s,n);for(;!e.eql(d,e.ONE);){if(e.eql(d,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(d);t<a&&!e.eql(n,e.ONE);t++)n=e.sqr(n);const n=e.pow(u,Eu<<BigInt(a-t-1));u=e.sqr(n),c=e.mul(c,n),d=e.mul(d,u),a=t}return c}}(e)}BigInt(9),BigInt(16);const Uu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ou(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Fu(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=Au)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=Ou(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Pu(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:pu(i),ZERO:Au,ONE:Eu,create:t=>Bu(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return Au<=t&&t<e},is0:e=>e===Au,isOdd:e=>(e&Eu)===Eu,neg:t=>Bu(-t,e),eql:(e,t)=>e===t,sqr:t=>Bu(t*t,e),add:(t,n)=>Bu(t+n,e),sub:(t,n)=>Bu(t-n,e),mul:(t,n)=>Bu(t*n,e),pow:(e,t)=>function(e,t,n){if(n<Au)throw new Error("Expected power > 0");if(n===Au)return e.ONE;if(n===Eu)return t;let r=e.ONE,i=t;for(;n>Au;)n&Eu&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Eu;return r}(a,e,t),div:(t,n)=>Bu(t*Du(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Du(t,e),sqrt:r.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?au(e,o):su(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?ou(e):iu(e)}});return Object.freeze(a)}function Mu(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Lu(e){const t=Mu(e);return t+Math.ceil(t/2)}
4
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
- const qu=BigInt(0),zu=BigInt(1),Nu=new WeakMap,ju=new WeakMap;function $u(e){return vu(e.Fp,Uu.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),vu(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ou(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}
6
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Wu(e){void 0!==e.lowS&&Ya("lowS",e.lowS),void 0!==e.prehash&&Ya("prehash",e.prehash)}const{bytesToNumberBE:Hu,hexToBytes:Ku}=_u,Vu={Err:class extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}},_tlv:{encode:(e,t)=>{const{Err:n}=Vu;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=Qa(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?Qa(i.length/2|128):"";return`${Qa(e)}${o}${i}${t}`},decode(e,t){const{Err:n}=Vu;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const e of s)o=o<<8|e;if(r+=e,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(r,r+o);if(s.length!==o)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Vu;if(e<Gu)throw new t("integer: negative integers are not allowed");let n=Qa(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected assertion");return n},decode(e){const{Err:t}=Vu;if(128&e[0])throw new t("Invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("Invalid signature integer: unnecessary leading zero");return Hu(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Vu,i="string"==typeof e?Ku(e):e;Za(i);const{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("Invalid signature: left bytes after parsing");const{v:a,l:u}=r.decode(2,o),{v:c,l:d}=r.decode(2,u);if(d.length)throw new t("Invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=Vu,r=`${t.encode(2,n.encode(e.r))}${t.encode(2,n.encode(e.s))}`;return t.encode(48,r)}},Gu=BigInt(0),Zu=BigInt(1);BigInt(2);const Yu=BigInt(3);function Ju(e){const t=function(e){const t=$u(e);vu(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,r=Fu(t.n,t.nBitLength),i=t.toBytes||((e,t,r)=>{const i=t.toAffine();return cu(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),o=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function s(e){const{a:r,b:i}=t,o=n.sqr(e),s=n.mul(o,e);return n.add(n.add(s,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:o}=t;if(n&&"bigint"!=typeof e){if(Ga(e)&&(e=Xa(e)),"string"!=typeof e||!n.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*r,"0")}let s;try{s="bigint"==typeof e?e:iu(uu("private key",e,r))}catch(t){throw new Error(`private key must be ${r} bytes, hex or bigint, not ${typeof e}`)}return i&&(s=Bu(s,o)),hu("private key",s,Zu,o),s}function u(e){if(!(e instanceof l))throw new Error("ProjectivePoint expected")}const c=bu(((e,t)=>{const{px:r,py:i,pz:o}=e;if(n.eql(o,n.ONE))return{x:r,y:i};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(o));const a=n.mul(r,t),u=n.mul(i,t),c=n.mul(o,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:a,y:u}})),d=bu((e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not FE");const o=n.sqr(i),a=s(r);if(!n.eql(o,a))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class l{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof l)throw new Error("projective point not allowed");const i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?l.ZERO:new l(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(l.fromAffine)}static fromHex(e){const t=l.fromAffine(o(uu("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return l.BASE.multiply(a(e))}static msm(e,t){return function(e,t,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");r.forEach(((e,n)=>{if(!t.isValid(e))throw new Error(`wrong scalar at index ${n}`)})),n.forEach(((t,n)=>{if(!(t instanceof e))throw new Error(`wrong point at index ${n}`)}));const i=fu(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,s=(1<<o)-1,a=new Array(s+1).fill(e.ZERO),u=Math.floor((t.BITS-1)/o)*o;let c=e.ZERO;for(let t=u;t>=0;t-=o){a.fill(e.ZERO);for(let e=0;e<r.length;e++){const i=r[e],o=Number(i>>BigInt(t)&BigInt(s));a[o]=a[o].add(n[e])}let i=e.ZERO;for(let t=a.length-1,n=e.ZERO;t>0;t--)n=n.add(a[t]),i=i.add(n);if(c=c.add(i),0!==t)for(let e=0;e<o;e++)c=c.double()}return c}(l,r,e,t)}_setWindowSize(e){f.setWindowSize(this,e)}assertValidity(){d(this)}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){u(e);const{px:t,py:r,pz:i}=this,{px:o,py:s,pz:a}=e,c=n.eql(n.mul(t,a),n.mul(o,i)),d=n.eql(n.mul(r,a),n.mul(s,i));return c&&d}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,i=n.mul(r,Yu),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),g=n.mul(o,s);return g=n.add(g,g),d=n.mul(o,a),d=n.add(d,d),u=n.mul(e,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(g,u),d=n.mul(i,d),p=n.mul(e,p),g=n.sub(h,p),g=n.mul(e,g),g=n.add(g,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,g),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,g),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(e){u(e);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:c}=e;let d=n.ZERO,h=n.ZERO,f=n.ZERO;const p=t.a,g=n.mul(t.b,Yu);let m=n.mul(r,s),y=n.mul(i,a),w=n.mul(o,c),v=n.add(r,i),b=n.add(s,a);v=n.mul(v,b),b=n.add(m,y),v=n.sub(v,b),b=n.add(r,o);let _=n.add(s,c);return b=n.mul(b,_),_=n.add(m,w),b=n.sub(b,_),_=n.add(i,o),d=n.add(a,c),_=n.mul(_,d),d=n.add(y,w),_=n.sub(_,d),f=n.mul(p,b),d=n.mul(g,w),f=n.add(d,f),d=n.sub(y,f),f=n.add(y,f),h=n.mul(d,f),y=n.add(m,m),y=n.add(y,m),w=n.mul(p,w),b=n.mul(g,b),y=n.add(y,w),w=n.sub(m,w),w=n.mul(p,w),b=n.add(b,w),m=n.mul(y,b),h=n.add(h,m),m=n.mul(_,b),d=n.mul(v,d),d=n.sub(d,m),m=n.mul(v,y),f=n.mul(_,f),f=n.add(f,m),new l(d,h,f)}subtract(e){return this.add(e.negate())}is0(){return this.equals(l.ZERO)}wNAF(e){return f.wNAFCached(this,e,l.normalizeZ)}multiplyUnsafe(e){hu("scalar",e,Gu,t.n);const r=l.ZERO;if(e===Gu)return r;if(e===Zu)return this;const{endo:i}=t;if(!i)return f.unsafeLadder(this,e);let{k1neg:o,k1:s,k2neg:a,k2:u}=i.splitScalar(e),c=r,d=r,h=this;for(;s>Gu||u>Gu;)s&Zu&&(c=c.add(h)),u&Zu&&(d=d.add(h)),h=h.double(),s>>=Zu,u>>=Zu;return o&&(c=c.negate()),a&&(d=d.negate()),d=new l(n.mul(d.px,i.beta),d.py,d.pz),c.add(d)}multiply(e){const{endo:r,n:i}=t;let o,s;if(hu("scalar",e,Zu,i),r){const{k1neg:t,k1:i,k2neg:a,k2:u}=r.splitScalar(e);let{p:c,f:d}=this.wNAF(i),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,r.beta),h.py,h.pz),o=c.add(h),s=d.add(p)}else{const{p:t,f:n}=this.wNAF(e);o=t,s=n}return l.normalizeZ([o,s])[0]}multiplyAndAddUnsafe(e,t,n){const r=l.BASE,i=(e,t)=>t!==Gu&&t!==Zu&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return c(this,e)}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===Zu)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===Zu?this:n?n(l,this):this.multiplyUnsafe(t.h)}toRawBytes(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return Ya("isCompressed",e),this.assertValidity(),i(l,this,e)}toHex(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return Ya("isCompressed",e),Xa(this.toRawBytes(e))}}l.BASE=new l(t.Gx,t.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=t.nBitLength,f=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>{if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error(`Wrong window size=${e}, should be [1..${t}]`)},i=e=>(r(e),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>qu;)n&zu&&(r=r.add(i)),i=i.double(),n>>=zu;return r},precomputeWindow(e,t){const{windows:n,windowSize:r}=i(t),o=[];let s=e,a=s;for(let e=0;e<n;e++){a=s,o.push(a);for(let e=1;e<r;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(t,r,o){const{windows:s,windowSize:a}=i(t);let u=e.ZERO,c=e.BASE;const d=BigInt(2**t-1),l=2**t,h=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let i=Number(o&d);o>>=h,i>a&&(i-=l,o+=zu);const s=t,f=t+Math.abs(i)-1,p=e%2!=0,g=i<0;0===i?c=c.add(n(p,r[s])):u=u.add(n(g,r[f]))}return{p:u,f:c}},wNAFCached(e,t,n){const r=ju.get(e)||1;let i=Nu.get(e);return i||(i=this.precomputeWindow(e,r),1!==r&&Nu.set(e,n(i))),this.wNAF(r,i,t)},setWindowSize(e,t){r(t),ju.set(e,t),Nu.delete(e)}}}(l,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:l,normPrivateKeyToScalar:a,weierstrassEquation:s,isWithinCurveOrder:function(e){return lu(e,Zu,t.n)}}}function Xu(e){const t=function(e){const t=$u(e);return vu(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,i=n.BYTES+1,o=2*n.BYTES+1;function s(e){return Bu(e,r)}function a(e){return Du(e,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=Ju({...t,toBytes(e,t,r){const i=t.toAffine(),o=n.toBytes(i.x),s=cu;return Ya("isCompressed",r),r?s(Uint8Array.from([t.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(e){const t=e.length,r=e[0],s=e.subarray(1);if(t!==i||2!==r&&3!==r){if(t===o&&4===r){return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=iu(s);if(!lu(e,Zu,n.ORDER))throw new Error("Point is not on curve");const t=d(e);let i;try{i=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return 1==(1&r)!==((i&Zu)===Zu)&&(i=n.neg(i)),{x:e,y:i}}}}),h=e=>Xa(su(e,t.nByteLength));function f(e){return e>r>>Zu}const p=(e,t,n)=>iu(e.slice(t,n));class g{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=uu("compactSignature",e,2*n),new g(p(e,0,n),p(e,n,2*n))}static fromDER(e){const{r:t,s:n}=Vu.toSig(uu("DER",e));return new g(t,n)}assertValidity(){hu("r",this.r,Zu,r),hu("s",this.s,Zu,r)}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:i,recovery:o}=this,c=v(uu("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+t.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),g=s(-c*p),m=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,g,m);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return ru(this.toDERHex())}toDERHex(){return Vu.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ru(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const m={isValidPrivateKey(e){try{return c(e),!0}catch(e){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const e=Lu(t.n);return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.length,i=Mu(t),o=Lu(t);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=Bu(n?iu(e):ou(e),t-Eu)+Eu;return n?au(s,i):su(s,i)}(t.randomBytes(e),t.n)},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}};function y(e){const t=Ga(e),n="string"==typeof e,r=(t||n)&&e.length;return t?r===i||r===o:n?r===2*i||r===2*o:e instanceof u}const w=t.bits2int||function(e){const n=iu(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},v=t.bits2int_modN||function(e){return s(w(e))},b=pu(t.nBitLength);function _(e){return hu(`num < 2^${t.nBitLength}`,e,Gu,b),su(e,t.nByteLength)}function A(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E;if(["recovered","canonical"].some((e=>e in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=t;let{lowS:h,prehash:p,extraEntropy:m}=i;null==h&&(h=!0),e=uu("msgHash",e),Wu(i),p&&(e=uu("prehashed msgHash",o(e)));const y=v(e),b=c(r),A=[_(b),_(y)];if(null!=m&&!1!==m){const e=!0===m?d(n.BYTES):m;A.push(uu("extraEntropy",e))}const k=cu(...A),I=y;return{seed:k,k2sig:function(e){const t=w(e);if(!l(t))return;const n=a(t),r=u.BASE.multiply(t).toAffine(),i=s(r.x);if(i===Gu)return;const o=s(n*s(I+i*b));if(o===Gu)return;let c=(r.x===i?0:2)|Number(r.y&Zu),d=o;return h&&f(o)&&(d=function(e){return f(e)?s(-e):e}(o),c^=1),new g(i,d,c)}}}const E={lowS:t.lowS,prehash:!1},k={lowS:t.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return u.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(y(e))throw new Error("first arg must be private key");if(!y(t))throw new Error("second arg must be public key");return u.fromHex(t).multiply(c(e)).toRawBytes(n)},sign:function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E;const{seed:i,k2sig:o}=A(e,n,r),s=t;return yu(s.hash.outputLen,s.nByteLength,s.hmac)(i,o)},verify:function(e,n,r){var i;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k;const c=e;if(n=uu("msgHash",n),r=uu("publicKey",r),"strict"in o)throw new Error("options.strict was renamed to lowS");Wu(o);const{lowS:d,prehash:l}=o;let h,f;try{if("string"==typeof c||Ga(c))try{h=g.fromDER(c)}catch(e){if(!(e instanceof Vu.Err))throw e;h=g.fromCompact(c)}else{if("object"!=typeof c||"bigint"!=typeof c.r||"bigint"!=typeof c.s)throw new Error("PARSE");{const{r:e,s:t}=c;h=new g(e,t)}}f=u.fromHex(r)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(d&&h.hasHighS())return!1;l&&(n=t.hash(n));const{r:p,s:m}=h,y=v(n),w=a(m),b=s(y*w),_=s(p*w),A=null===(i=u.BASE.multiplyAndAddUnsafe(f,b,_))||void 0===i?void 0:i.toAffine();return!!A&&s(A.x)===p},ProjectivePoint:u,Signature:g,utils:m}}
7
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Qu(e){return{hash:e,hmac:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Pa(e,t,function(){let e=0;for(let t=0;t<arguments.length;t++){const n=t<0||arguments.length<=t?void 0:arguments[t];ba(n),e+=n.length}const t=new Uint8Array(e);for(let e=0,n=0;e<arguments.length;e++){const r=e<0||arguments.length<=e?void 0:arguments[e];t.set(r,n),n+=r.length}return t}(...r))},randomBytes:Ra}}BigInt(4);
8
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
9
- const ec=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),nc=BigInt(1),rc=BigInt(2),ic=(e,t)=>(e+t/rc)/t;const oc=Fu(ec,void 0,void 0,{sqrt:function(e){const t=ec,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=e*e*e%t,d=c*c*e%t,l=Ru(d,n,t)*d%t,h=Ru(l,n,t)*d%t,f=Ru(h,rc,t)*c%t,p=Ru(f,i,t)*f%t,g=Ru(p,o,t)*p%t,m=Ru(g,a,t)*g%t,y=Ru(m,u,t)*m%t,w=Ru(y,a,t)*g%t,v=Ru(w,n,t)*d%t,b=Ru(v,s,t)*p%t,_=Ru(b,r,t)*c%t,A=Ru(_,rc,t);if(!oc.eql(oc.sqr(A),e))throw new Error("Cannot find square root");return A}}),sc=function(e,t){const n=t=>Xu({...e,...Qu(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:oc,n:tc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=tc,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-nc*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=ic(o*e,t),u=ic(-r*e,t);let c=Bu(e-a*n-u*i,t),d=Bu(-a*r-u*o,t);const l=c>s,h=d>s;if(l&&(c=t-c),h&&(d=t-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},za);BigInt(0),sc.ProjectivePoint;const ac="2.21.21";let uc={getDocsUrl:e=>{let{docsBaseUrl:t,docsPath:n="",docsSlug:r}=e;return n?`${null!=t?t:"https://viem.sh"}${n}${r?`#${r}`:""}`:void 0},version:ac};class cc extends Error{constructor(e){var t,n,r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=i.cause instanceof cc?i.cause.details:null!==(s=i.cause)&&void 0!==s&&s.message?i.cause.message:i.details;var s;const a=i.cause instanceof cc&&i.cause.docsPath||i.docsPath,u=null===(t=(n=uc).getDocsUrl)||void 0===t?void 0:t.call(n,{...i,docsPath:a});super([e||"An error occurred.","",...i.metaMessages?[...i.metaMessages,""]:[],...u?[`Docs: ${u}`]:[],...o?[`Details: ${o}`]:[],...uc.version?[`Version: ${uc.version}`]:[]].join("\n"),i.cause?{cause:i.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=a,this.metaMessages=i.metaMessages,this.name=null!==(r=i.name)&&void 0!==r?r:this.name,this.shortMessage=e,this.version=ac}walk(e){return dc(this,e)}}function dc(e,t){return null!=t&&t(e)?e:e&&"object"==typeof e&&"cause"in e?dc(e.cause,t):t?null:e}class lc extends cc{constructor(e){let{max:t,min:n,signed:r,size:i,value:o}=e;super(`Number "${o}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class hc extends cc{constructor(e){let{givenSize:t,maxSize:n}=e;super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}class fc extends cc{constructor(e){let{offset:t,position:n,size:r}=e;super(`Slice ${"start"===n?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class pc extends cc{constructor(e){let{size:t,targetSize:n,type:r}=e;super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function gc(e){let{dir:t,size:n=32}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e?mc(e,{dir:t,size:n}):function(e){let{dir:t,size:n=32}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===n)return e;if(e.length>n)throw new pc({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const o="right"===t;r[o?i:n-i-1]=e[o?i:e.length-i-1]}return r}(e,{dir:t,size:n})}function mc(e){let{dir:t,size:n=32}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===n)return e;const r=e.replace("0x","");if(r.length>2*n)throw new pc({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r["right"===t?"padEnd":"padStart"](2*n,"0")}`}function yc(e){let{strict:t=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function wc(e){return yc(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function vc(e){let{dir:t="left"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="string"==typeof e?e.replace("0x",""):e,r=0;for(let e=0;e<n.length-1&&"0"===n["left"===t?e:n.length-e-1].toString();e++)r++;return n="left"===t?n.slice(r):n.slice(0,n.length-r),"string"==typeof e?(1===n.length&&"right"===t&&(n=`${n}0`),`0x${n.length%2==1?`0${n}`:n}`):n}const bc=new TextEncoder;function _c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"number"==typeof e||"bigint"==typeof e?function(e,t){const n=Pc(e,t);return kc(n)}(e,t):"boolean"==typeof e?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new Uint8Array(1);if(n[0]=Number(e),"number"==typeof t.size)return Sc(n,{size:t.size}),gc(n,{size:t.size});return n}(e,t):yc(e)?kc(e,t):Ic(e,t)}const Ac={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ec(e){return e>=Ac.zero&&e<=Ac.nine?e-Ac.zero:e>=Ac.A&&e<=Ac.F?e-(Ac.A-10):e>=Ac.a&&e<=Ac.f?e-(Ac.a-10):void 0}function kc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;t.size&&(Sc(n,{size:t.size}),n=gc(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,o=new Uint8Array(i);for(let e=0,t=0;e<i;e++){const n=Ec(r.charCodeAt(t++)),i=Ec(r.charCodeAt(t++));if(void 0===n||void 0===i)throw new cc(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);o[e]=16*n+i}return o}function Ic(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=bc.encode(e);return"number"==typeof t.size?(Sc(n,{size:t.size}),gc(n,{dir:"right",size:t.size})):n}function Sc(e,t){let{size:n}=t;if(wc(e)>n)throw new hc({givenSize:wc(e),maxSize:n})}function Cc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{signed:n}=t;t.size&&Sc(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2;return r<=(1n<<8n*BigInt(i)-1n)-1n?r:r-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function xc(e){return Number(Cc(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}const Bc=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Tc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"number"==typeof e||"bigint"==typeof e?Pc(e,t):"string"==typeof e?Oc(e,t):"boolean"==typeof e?Rc(e,t):Dc(e,t)}function Rc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=`0x${Number(e)}`;return"number"==typeof t.size?(Sc(n,{size:t.size}),gc(n,{size:t.size})):n}function Dc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="";for(let t=0;t<e.length;t++)n+=Bc[e[t]];const r=`0x${n}`;return"number"==typeof t.size?(Sc(r,{size:t.size}),gc(r,{dir:"right",size:t.size})):r}function Pc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{signed:n,size:r}=t,i=BigInt(e);let o;r?o=n?(1n<<8n*BigInt(r)-1n)-1n:2n**(8n*BigInt(r))-1n:"number"==typeof e&&(o=BigInt(Number.MAX_SAFE_INTEGER));const s="bigint"==typeof o&&n?-o-1n:0;if(o&&i>o||i<s){const t="bigint"==typeof e?"n":"";throw new lc({max:o?`${o}${t}`:void 0,min:`${s}${t}`,signed:n,size:r,value:`${e}${t}`})}const a=`0x${(n&&i<0?(1n<<BigInt(8*r))+BigInt(i):i).toString(16)}`;return r?gc(a,{size:r}):a}const Uc=new TextEncoder;function Oc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Dc(Uc.encode(e),t)}class Fc extends cc{constructor(e){let{address:t}=e;super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Mc extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const Lc=[],qc=[],zc=[],Nc=BigInt(0),jc=BigInt(1),$c=BigInt(2),Wc=BigInt(7),Hc=BigInt(256),Kc=BigInt(113);for(let e=0,t=jc,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Lc.push(2*(5*r+n)),qc.push((e+1)*(e+2)/2%64);let i=Nc;for(let e=0;e<7;e++)t=(t<<jc^(t>>Wc)*Kc)%Hc,t&$c&&(i^=jc<<(jc<<BigInt(e))-jc);zc.push(i)}const[Vc,Gc]=Wa(zc,!0),Zc=(e,t,n)=>n>32?((e,t,n)=>t<<n-32|e>>>64-n)(e,t,n):((e,t,n)=>e<<n|t>>>32-n)(e,t,n),Yc=(e,t,n)=>n>32?((e,t,n)=>e<<n-32|t>>>64-n)
10
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */(e,t,n):((e,t,n)=>t<<n|e>>>32-n)(e,t,n);class Jc extends Ba{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,va(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){Sa||Ca(this.state32),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,i=(t+2)%10,o=n[i],s=n[i+1],a=Zc(o,s,1)^n[r],u=Yc(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=a,e[t+n+1]^=u}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=qc[n],o=Zc(t,i,r),s=Yc(t,i,r),a=Lc[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=Vc[r],e[1]^=Gc[r]}n.fill(0)}(this.state32,this.rounds),Sa||Ca(this.state32),this.posOut=0,this.pos=0}update(e){_a(this);const{blockLen:t,state:n}=this,r=(e=xa(e)).length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,0!=(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){_a(this,!1),ba(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return va(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Aa(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new Jc(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Xc=((e,t,n)=>Ta((()=>new Jc(t,e,n))))(1,136,32);function Qc(e,t){const n=t||"hex",r=Xc(yc(e,{strict:!1})?_c(e):e);return"bytes"===n?r:Tc(r)}const ed=new Mc(8192);function td(e,t){if(ed.has(`${e}.${t}`))return ed.get(`${e}.${t}`);const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Qc(Ic(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&r[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());const o=`0x${i.join("")}`;return ed.set(`${e}.${t}`,o),o}const nd=/^0x[a-fA-F0-9]{40}$/,rd=new Mc(8192);function id(e,t){const{strict:n=!0}=null!=t?t:{},r=`${e}.${n}`;if(rd.has(r))return rd.get(r);const i=!(!nd.test(e)||e.toLowerCase()!==e&&n&&td(e)!==e);return rd.set(r,i),i}function od(e){return td(`0x${Qc(`0x${e.substring(4)}`).substring(26)}`)}async function sd(e){let{hash:t,privateKey:n,to:r="object"}=e;const{r:i,s:o,recovery:s}=sc.sign(t.slice(2),n.slice(2)),a={r:Pc(i,{size:32}),s:Pc(o,{size:32}),v:s?28n:27n,yParity:s};return"bytes"===r||"hex"===r?function(e){let{r:t,s:n,to:r="hex",v:i,yParity:o}=e;const s=(()=>{if(0===o||1===o)return o;if(i&&(27n===i||28n===i||i>=35n))return i%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),a=`0x${new sc.Signature(Cc(t),Cc(n)).toCompactHex()}${0===s?"1b":"1c"}`;return"hex"===r?a:kc(a)}({...a,to:r}):a}function ad(e){return"string"==typeof e[0]?ud(e):function(e){let t=0;for(const n of e)t+=n.length;const n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(e)}function ud(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class cd extends cc{constructor(e){let{offset:t}=e;super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class dd extends cc{constructor(e){let{length:t,position:n}=e;super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class ld extends cc{constructor(e){let{count:t,limit:n}=e;super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const hd={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new ld({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new dd({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new cd({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new cd({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=null!=e?e:this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=null!=t?t:this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=null!=e?e:this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=null!=e?e:this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=null!=e?e:this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=null!=e?e:this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=null!=t?t:e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function fd(e){let{recursiveReadLimit:t=8192}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Object.create(hd);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function pd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hex";const n=gd(e),r=fd(new Uint8Array(n.length));return n.encode(r),"hex"===t?Dc(r.bytes):r.bytes}function gd(e){return Array.isArray(e)?function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=md(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),1===n?r.pushUint8(t):2===n?r.pushUint16(t):3===n?r.pushUint24(t):r.pushUint32(t));for(const{encode:t}of e)t(r)}}}(e.map((e=>gd(e)))):function(e){const t="string"==typeof e?kc(e):e,n=md(t.length),r=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length;return{length:r,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+n),1===n?e.pushUint8(t.length):2===n?e.pushUint16(t.length):3===n?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function md(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new cc("Length is too large.")}function yd(e){const{chainId:t,contractAddress:n,nonce:r,to:i}=e,o=Qc(ud(["0x05",pd([Pc(t),n,r?Pc(r):"0x"])]));return"bytes"===i?kc(o):o}const wd="Ethereum Signed Message:\n";function vd(e,t){return Qc(function(e){const t="string"==typeof e?Oc(e):"string"==typeof e.raw?e.raw:Dc(e.raw);return ad([Oc(`${wd}${wc(t)}`),t])}(e),t)}const bd={ether:-9,wei:9};function _d(e){return function(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[i,o]=[n.slice(0,n.length-t),n.slice(n.length-t)];return o=o.replace(/(0+)$/,""),`${r?"-":""}${i||"0"}${o?`.${o}`:""}`}(e,bd[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"wei"])}function Ad(e){const t=Object.entries(e).map((e=>{let[t,n]=e;return void 0===n||!1===n?null:[t,n]})).filter(Boolean),n=t.reduce(((e,t)=>{let[n]=t;return Math.max(e,n.length)}),0);return t.map((e=>{let[t,r]=e;return` ${`${t}:`.padEnd(n+1)} ${r}`})).join("\n")}class Ed extends cc{constructor(e){let{v:t}=e;super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class kd extends cc{constructor(e){let{transaction:t}=e;super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ad(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class Id extends cc{constructor(e){let{storageKey:t}=e;super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}function Sd(e){var t;const{kzg:n}=e,r=null!==(t=e.to)&&void 0!==t?t:"string"==typeof e.blobs[0]?"hex":"bytes",i="string"==typeof e.blobs[0]?e.blobs.map((e=>kc(e))):e.blobs,o=[];for(const e of i)o.push(Uint8Array.from(n.blobToKzgCommitment(e)));return"bytes"===r?o:o.map((e=>Dc(e)))}function Cd(e){var t;const{kzg:n}=e,r=null!==(t=e.to)&&void 0!==t?t:"string"==typeof e.blobs[0]?"hex":"bytes",i="string"==typeof e.blobs[0]?e.blobs.map((e=>kc(e))):e.blobs,o="string"==typeof e.commitments[0]?e.commitments.map((e=>kc(e))):e.commitments,s=[];for(let e=0;e<i.length;e++){const t=i[e],r=o[e];s.push(Uint8Array.from(n.computeBlobKzgProof(t,r)))}return"bytes"===r?s:s.map((e=>Dc(e)))}function xd(e){var t;const{commitment:n,version:r=1}=e,i=null!==(t=e.to)&&void 0!==t?t:"string"==typeof n?"hex":"bytes",o=function(e,t){const n=t||"hex",r=za(yc(e,{strict:!1})?_c(e):e);return"bytes"===n?r:Tc(r)}(n,"bytes");return o.set([r],0),"bytes"===i?o:Dc(o)}const Bd=32,Td=4096,Rd=Bd*Td,Dd=6*Rd-1-1*Td*6,Pd=1;class Ud extends cc{constructor(e){let{maxSize:t,size:n}=e;super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Od extends cc{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class Fd extends cc{constructor(e){let{hash:t,size:n}=e;super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class Md extends cc{constructor(e){let{hash:t,version:n}=e;super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${Pd}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function Ld(e){var t,n,r;const{data:i,kzg:o,to:s}=e,a=null!==(t=e.blobs)&&void 0!==t?t:function(e){var t;const n=null!==(t=e.to)&&void 0!==t?t:"string"==typeof e.data?"hex":"bytes",r="string"==typeof e.data?kc(e.data):e.data,i=wc(r);if(!i)throw new Od;if(i>Dd)throw new Ud({maxSize:Dd,size:i});const o=[];let s=!0,a=0;for(;s;){const e=fd(new Uint8Array(Rd));let t=0;for(;t<Td;){const n=r.slice(a,a+(Bd-1));if(e.pushByte(0),e.pushBytes(n),n.length<31){e.pushByte(128),s=!1;break}t++,a+=31}o.push(e)}return"bytes"===n?o.map((e=>e.bytes)):o.map((e=>Dc(e.bytes)))}({data:i,to:s}),u=null!==(n=e.commitments)&&void 0!==n?n:Sd({blobs:a,kzg:o,to:s}),c=null!==(r=e.proofs)&&void 0!==r?r:Cd({blobs:a,commitments:u,kzg:o,to:s}),d=[];for(let e=0;e<a.length;e++)d.push({blob:a[e],commitment:u[e],proof:c[e]});return d}const qd=2n**256n-1n;class zd extends cc{constructor(e){let{chainId:t}=e;super("number"==typeof t?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}class Nd extends cc{constructor(){var e;let{cause:t,message:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=null==n||null===(e=n.replace("execution reverted: ",""))||void 0===e?void 0:e.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Nd,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Nd,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class jd extends cc{constructor(){let{cause:e,maxFeePerGas:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(`The fee cap (\`maxFeePerGas\`${t?` = ${_d(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(jd,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});Object.defineProperty(class extends cc{constructor(){let{cause:e,maxFeePerGas:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(`The fee cap (\`maxFeePerGas\`${t?` = ${_d(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});Object.defineProperty(class extends cc{constructor(){let{cause:e,nonce:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});Object.defineProperty(class extends cc{constructor(){let{cause:e,nonce:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e,name:"NonceTooLowError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Object.defineProperty(class extends cc{constructor(){let{cause:e,nonce:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Object.defineProperty(class extends cc{constructor(){let{cause:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});Object.defineProperty(class extends cc{constructor(){let{cause:e,gas:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});Object.defineProperty(class extends cc{constructor(){let{cause:e,gas:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});Object.defineProperty(class extends cc{constructor(e){let{cause:t}=e;super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}},"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class $d extends cc{constructor(){let{cause:e,maxPriorityFeePerGas:t,maxFeePerGas:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${_d(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${_d(n)} gwei`:""}).`].join("\n"),{cause:e,name:"TipAboveFeeCapError"})}}function Wd(e,t,n){let{strict:r}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return yc(e,{strict:!1})?function(e,t,n){let{strict:r}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Hd(e,t);const i=`0x${e.replace("0x","").slice(2*(null!=t?t:0),2*(null!=n?n:e.length))}`;r&&Kd(i,t,n);return i}(e,t,n,{strict:r}):function(e,t,n){let{strict:r}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Hd(e,t);const i=e.slice(t,n);r&&Kd(i,t,n);return i}(e,t,n,{strict:r})}function Hd(e,t){if("number"==typeof t&&t>0&&t>wc(e)-1)throw new fc({offset:t,position:"start",size:wc(e)})}function Kd(e,t,n){if("number"==typeof t&&"number"==typeof n&&wc(e)!==n-t)throw new fc({offset:n,position:"end",size:wc(e)})}function Vd(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:i}=e;if(t<=0)throw new zd({chainId:t});if(i&&!id(i))throw new Fc({address:i});if(r&&r>qd)throw new jd({maxFeePerGas:r});if(n&&r&&n>r)throw new $d({maxFeePerGas:r,maxPriorityFeePerGas:n})}function Gd(e){if(!e||0===e.length)return[];const t=[];for(let n=0;n<e.length;n++){const{address:r,storageKeys:i}=e[n];for(let e=0;e<i.length;e++)if(i[e].length-2!=64)throw new Id({storageKey:i[e]});if(!id(r,{strict:!1}))throw new Fc({address:r});t.push([r,i])}return t}function Zd(e,t){const n=function(e){if(e.type)return e.type;if(void 0!==e.authorizationList)return"eip7702";if(void 0!==e.blobs||void 0!==e.blobVersionedHashes||void 0!==e.maxFeePerBlobGas||void 0!==e.sidecars)return"eip4844";if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new kd({transaction:e})}(e);return"eip1559"===n?function(e,t){const{chainId:n,gas:r,nonce:i,to:o,value:s,maxFeePerGas:a,maxPriorityFeePerGas:u,accessList:c,data:d}=e;Vd(e);const l=Gd(c),h=[Tc(n),i?Tc(i):"0x",u?Tc(u):"0x",a?Tc(a):"0x",r?Tc(r):"0x",null!=o?o:"0x",s?Tc(s):"0x",null!=d?d:"0x",l,...Yd(e,t)];return ud(["0x02",pd(h)])}(e,t):"eip2930"===n?function(e,t){const{chainId:n,gas:r,data:i,nonce:o,to:s,value:a,accessList:u,gasPrice:c}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:i,to:o}=e;if(t<=0)throw new zd({chainId:t});if(o&&!id(o))throw new Fc({address:o});if(n||i)throw new cc("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>qd)throw new jd({maxFeePerGas:r})}(e);const d=Gd(u),l=[Tc(n),o?Tc(o):"0x",c?Tc(c):"0x",r?Tc(r):"0x",null!=s?s:"0x",a?Tc(a):"0x",null!=i?i:"0x",d,...Yd(e,t)];return ud(["0x01",pd(l)])}(e,t):"eip4844"===n?function(e,t){var n;const{chainId:r,gas:i,nonce:o,to:s,value:a,maxFeePerBlobGas:u,maxFeePerGas:c,maxPriorityFeePerGas:d,accessList:l,data:h}=e;!function(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new Od;for(const e of t){const t=wc(e),n=xc(Wd(e,0,1));if(32!==t)throw new Fd({hash:e,size:t});if(n!==Pd)throw new Md({hash:e,version:n})}}Vd(e)}(e);let f=e.blobVersionedHashes,p=e.sidecars;if(e.blobs&&(void 0===f||void 0===p)){const t="string"==typeof e.blobs[0]?e.blobs:e.blobs.map((e=>Dc(e))),n=e.kzg,r=Sd({blobs:t,kzg:n});if(void 0===f&&(f=function(e){var t;const{commitments:n,version:r}=e,i=null!==(t=e.to)&&void 0!==t?t:"string"==typeof n[0]?"hex":"bytes",o=[];for(const e of n)o.push(xd({commitment:e,to:i,version:r}));return o}({commitments:r})),void 0===p){p=Ld({blobs:t,commitments:r,proofs:Cd({blobs:t,commitments:r,kzg:n})})}}const g=Gd(l),m=[Tc(r),o?Tc(o):"0x",d?Tc(d):"0x",c?Tc(c):"0x",i?Tc(i):"0x",null!=s?s:"0x",a?Tc(a):"0x",null!=h?h:"0x",g,u?Tc(u):"0x",null!==(n=f)&&void 0!==n?n:[],...Yd(e,t)],y=[],w=[],v=[];if(p)for(let e=0;e<p.length;e++){const{blob:t,commitment:n,proof:r}=p[e];y.push(t),w.push(n),v.push(r)}return ud(["0x03",pd(p?[m,y,w,v]:m)])}(e,t):"eip7702"===n?function(e,t){const{authorizationList:n,chainId:r,gas:i,nonce:o,to:s,value:a,maxFeePerGas:u,maxPriorityFeePerGas:c,accessList:d,data:l}=e;!function(e){const{authorizationList:t}=e;if(t)for(const e of t){const{contractAddress:t,chainId:n}=e;if(!id(t))throw new Fc({address:t});if(n<=0)throw new zd({chainId:n})}Vd(e)}(e);const h=Gd(d),f=function(e){if(!e||0===e.length)return[];const t=[];for(const n of e){const{contractAddress:e,chainId:r,nonce:i,...o}=n;t.push([Tc(r),e,i?Tc(i):"0x",...Yd({},o)])}return t}(n);return ud(["0x04",pd([Tc(r),o?Tc(o):"0x",c?Tc(c):"0x",u?Tc(u):"0x",i?Tc(i):"0x",null!=s?s:"0x",a?Tc(a):"0x",null!=l?l:"0x",h,f,...Yd(e,t)])])}(e,t):function(e,t){const{chainId:n=0,gas:r,data:i,nonce:o,to:s,value:a,gasPrice:u}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:i,to:o}=e;if(o&&!id(o))throw new Fc({address:o});if(void 0!==t&&t<=0)throw new zd({chainId:t});if(n||i)throw new cc("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>qd)throw new jd({maxFeePerGas:r})}(e);let c=[o?Tc(o):"0x",u?Tc(u):"0x",r?Tc(r):"0x",null!=s?s:"0x",a?Tc(a):"0x",null!=i?i:"0x"];if(t){const e=(()=>{if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}if(n>0)return BigInt(2*n)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new Ed({v:t.v});return e})(),r=vc(t.r),i=vc(t.s);c=[...c,Tc(e),"0x00"===r?"0x":r,"0x00"===i?"0x":i]}else n>0&&(c=[...c,Tc(n),"0x","0x"]);return pd(c)}(e,t)}function Yd(e,t){const n=null!=t?t:e,{v:r,yParity:i}=n;if(void 0===n.r)return[];if(void 0===n.s)return[];if(void 0===r&&void 0===i)return[];const o=vc(n.r),s=vc(n.s);return["number"==typeof i?i?Tc(1):"0x":0n===r?"0x":1n===r?Tc(1):27n===r?"0x":Tc(1),"0x00"===o?"0x":o,"0x00"===s?"0x":s]}Object.defineProperty($d,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Jd extends cc{constructor(e){let{expectedLength:t,givenLength:n,type:r}=e;super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join("\n"),{name:"AbiEncodingArrayLengthMismatchError"})}}class Xd extends cc{constructor(e){let{expectedSize:t,value:n}=e;super(`Size of bytes "${n}" (bytes${wc(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Qd extends cc{constructor(e){let{expectedLength:t,givenLength:n}=e;super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join("\n"),{name:"AbiEncodingLengthMismatchError"})}}class el extends cc{constructor(e){let{expectedSize:t,givenSize:n}=e;super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}}class tl extends cc{constructor(e,t){let{docsPath:n}=t;super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:n,name:"InvalidAbiEncodingType"})}}class nl extends cc{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n"),{name:"InvalidArrayError"})}}function rl(e,t){if(e.length!==t.length)throw new Qd({expectedLength:e.length,givenLength:t.length});const n=function(e){let{params:t,values:n}=e;const r=[];for(let e=0;e<t.length;e++)r.push(il({param:t[e],value:n[e]}));return r}({params:e,values:t}),r=ol(n);return 0===r.length?"0x":r}function il(e){let{param:t,value:n}=e;const r=function(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}(t.type);if(r){const[e,i]=r;return function(e,t){let{length:n,param:r}=t;const i=null===n;if(!Array.isArray(e))throw new nl(e);if(!i&&e.length!==n)throw new Jd({expectedLength:n,givenLength:e.length,type:`${r.type}[${n}]`});let o=!1;const s=[];for(let t=0;t<e.length;t++){const n=il({param:r,value:e[t]});n.dynamic&&(o=!0),s.push(n)}if(i||o){const e=ol(s);if(i){const t=Pc(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?ad([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:ad(s.map((e=>{let{encoded:t}=e;return t})))}}(n,{length:e,param:{...t,type:i}})}if("tuple"===t.type)return function(e,t){let{param:n}=t,r=!1;const i=[];for(let t=0;t<n.components.length;t++){const o=n.components[t],s=il({param:o,value:e[Array.isArray(e)?t:o.name]});i.push(s),s.dynamic&&(r=!0)}return{dynamic:r,encoded:r?ol(i):ad(i.map((e=>{let{encoded:t}=e;return t})))}}(n,{param:t});if("address"===t.type)return function(e){if(!id(e))throw new Fc({address:e});return{dynamic:!1,encoded:mc(e.toLowerCase())}}(n);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new cc(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:mc(Rc(e))}}(n);if(t.type.startsWith("uint")||t.type.startsWith("int")){return function(e,t){let{signed:n}=t;return{dynamic:!1,encoded:Pc(e,{size:32,signed:n})}}(n,{signed:t.type.startsWith("int")})}if(t.type.startsWith("bytes"))return function(e,t){let{param:n}=t;const[,r]=n.type.split("bytes"),i=wc(e);if(!r){let t=e;return i%32!=0&&(t=mc(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:ad([mc(Pc(i,{size:32})),t])}}if(i!==Number.parseInt(r))throw new Xd({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:mc(e,{dir:"right"})}}(n,{param:t});if("string"===t.type)return function(e){const t=Oc(e),n=Math.ceil(wc(t)/32),r=[];for(let e=0;e<n;e++)r.push(mc(Wd(t,32*e,32*(e+1)),{dir:"right"}));return{dynamic:!0,encoded:ad([mc(Pc(wc(t),{size:32})),...r])}}(n);throw new tl(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ol(e){let t=0;for(let n=0;n<e.length;n++){const{dynamic:r,encoded:i}=e[n];t+=r?32:wc(i)}const n=[],r=[];let i=0;for(let o=0;o<e.length;o++){const{dynamic:s,encoded:a}=e[o];s?(n.push(Pc(t+i,{size:32})),r.push(a),i+=wc(a)):n.push(a)}return ad([...n,...r])}const sl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,al=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,ul=(e,t,n)=>JSON.stringify(e,((e,n)=>{const r="bigint"==typeof n?n.toString():n;return"function"==typeof t?t(e,r):r}),n);function cl(e){const{domain:t,message:n,primaryType:r,types:i}=e,o=(e,t)=>{for(const n of e){const{name:e,type:r}=n,s=t[e],a=r.match(al);if(a&&("number"==typeof s||"bigint"==typeof s)){const[e,t,n]=a;Pc(s,{signed:"int"===t,size:Number.parseInt(n)/8})}if("address"===r&&"string"==typeof s&&!id(s))throw new Fc({address:s});const u=r.match(sl);if(u){const[e,t]=u;if(t&&wc(s)!==Number.parseInt(t))throw new el({expectedSize:Number.parseInt(t),givenSize:wc(s)})}const c=i[r];c&&o(c,s)}};i.EIP712Domain&&t&&o(i.EIP712Domain,t),"EIP712Domain"!==r&&o(i[r],n)}function dl(e){let{domain:t}=e;return["string"==typeof(null==t?void 0:t.name)&&{name:"name",type:"string"},(null==t?void 0:t.version)&&{name:"version",type:"string"},"number"==typeof(null==t?void 0:t.chainId)&&{name:"chainId",type:"uint256"},(null==t?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(null==t?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function ll(e){const{domain:t={},message:n,primaryType:r}=e,i={EIP712Domain:dl({domain:t}),...e.types};cl({domain:t,message:n,primaryType:r,types:i});const o=["0x1901"];return t&&o.push(function(e){let{domain:t,types:n}=e;return hl({data:t,primaryType:"EIP712Domain",types:n})}({domain:t,types:i})),"EIP712Domain"!==r&&o.push(hl({data:n,primaryType:r,types:i})),Qc(ad(o))}function hl(e){let{data:t,primaryType:n,types:r}=e;return Qc(fl({data:t,primaryType:n,types:r}))}function fl(e){let{data:t,primaryType:n,types:r}=e;const i=[{type:"bytes32"}],o=[pl({primaryType:n,types:r})];for(const e of r[n]){const[n,s]=ml({types:r,name:e.name,type:e.type,value:t[e.name]});i.push(n),o.push(s)}return rl(i,o)}function pl(e){let{primaryType:t,types:n}=e;const r=Tc(function(e){let{primaryType:t,types:n}=e,r="";const i=gl({primaryType:t,types:n});i.delete(t);const o=[t,...Array.from(i).sort()];for(const e of o)r+=`${e}(${n[e].map((e=>{let{name:t,type:n}=e;return`${n} ${t}`})).join(",")})`;return r}({primaryType:t,types:n}));return Qc(r)}function gl(e){let{primaryType:t,types:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;const i=t.match(/^\w*/u),o=null==i?void 0:i[0];if(r.has(o)||void 0===n[o])return r;r.add(o);for(const e of n[o])gl({primaryType:e.type,types:n},r);return r}function ml(e){let{types:t,name:n,type:r,value:i}=e;if(void 0!==t[r])return[{type:"bytes32"},Qc(fl({data:i,primaryType:r,types:t}))];if("bytes"===r){return i=`0x${(i.length%2?"0":"")+i.slice(2)}`,[{type:"bytes32"},Qc(i)]}if("string"===r)return[{type:"bytes32"},Qc(Tc(i))];if(r.lastIndexOf("]")===r.length-1){const e=r.slice(0,r.lastIndexOf("[")),o=i.map((r=>ml({name:n,type:e,types:t,value:r})));return[{type:"bytes32"},Qc(rl(o.map((e=>{let[t]=e;return t})),o.map((e=>{let[,t]=e;return t}))))]}return[{type:r},i]}function yl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{nonceManager:n}=t,r=Tc(sc.getPublicKey(e.slice(2),!1)),i=function(e){if("string"==typeof e){if(!id(e,{strict:!1}))throw new Fc({address:e});return{address:e,type:"json-rpc"}}if(!id(e.address,{strict:!1}))throw new Fc({address:e.address});return{address:e.address,nonceManager:e.nonceManager,sign:e.sign,experimental_signAuthorization:e.experimental_signAuthorization,signMessage:e.signMessage,signTransaction:e.signTransaction,signTypedData:e.signTypedData,source:"custom",type:"local"}}({address:od(r),nonceManager:n,async sign(t){let{hash:n}=t;return sd({hash:n,privateKey:e,to:"hex"})},experimental_signAuthorization:async t=>async function(e){const{contractAddress:t,chainId:n,nonce:r,privateKey:i,to:o="object"}=e,s=await sd({hash:yd({contractAddress:t,chainId:n,nonce:r}),privateKey:i,to:o});return"object"===o?{contractAddress:t,chainId:n,nonce:r,...s}:s}({...t,privateKey:e}),async signMessage(t){let{message:n}=t;return async function(e){let{message:t,privateKey:n}=e;return await sd({hash:vd(t),privateKey:n,to:"hex"})}({message:n,privateKey:e})},async signTransaction(t){let{serializer:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function(e){const{privateKey:t,transaction:n,serializer:r=Zd}=e,i="eip4844"===n.type?{...n,sidecars:!1}:n,o=await sd({hash:Qc(r(i)),privateKey:t});return r(n,o)}({privateKey:e,transaction:t,serializer:n})},signTypedData:async t=>async function(e){const{privateKey:t,...n}=e;return await sd({hash:ll(n),privateKey:t,to:"hex"})}({...t,privateKey:e})});return{...i,publicKey:r,source:"privateKey"}}function wl(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}class vl extends Error{constructor(){super("Entity manager is uninitialized. This can happen when calling an API method that requires an API secret in the SDK configuration. Please ensure that you have initialized the SDK with the appropriate credentials for Entity Manager operations."),this.name="UninitializedEntityManagerError"}}const bl=(e,t)=>a(e,{...null!=t?t:{},credentials:"credentials"in _l.prototype?null==t?void 0:t.credentials:void 0}),_l=globalThis.Request;class Al extends Error{constructor(e,t){super(`'${e}' => ${t.message}`),u(this,"method",void 0),u(this,"innerError",void 0),u(this,"name","ParseRequestError"),this.method=e,this.innerError=t}}const El=(e,t)=>async n=>{const r=await t.safeParseAsync(n);if(!r.success)throw new Al(e,r.error);return r.data};var kl,Il;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(kl||(kl={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Il||(Il={}));const Sl=kl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cl=e=>{switch(typeof e){case"undefined":return Sl.undefined;case"string":return Sl.string;case"number":return isNaN(e)?Sl.nan:Sl.number;case"boolean":return Sl.boolean;case"function":return Sl.function;case"bigint":return Sl.bigint;case"symbol":return Sl.symbol;case"object":return Array.isArray(e)?Sl.array:null===e?Sl.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Sl.promise:"undefined"!=typeof Map&&e instanceof Map?Sl.map:"undefined"!=typeof Set&&e instanceof Set?Sl.set:"undefined"!=typeof Date&&e instanceof Date?Sl.date:Sl.object;default:return Sl.unknown}},xl=kl.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Bl extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,kl.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Bl.create=e=>new Bl(e);const Tl=(e,t)=>{let n;switch(e.code){case xl.invalid_type:n=e.received===Sl.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case xl.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,kl.jsonStringifyReplacer)}`;break;case xl.unrecognized_keys:n=`Unrecognized key(s) in object: ${kl.joinValues(e.keys,", ")}`;break;case xl.invalid_union:n="Invalid input";break;case xl.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${kl.joinValues(e.options)}`;break;case xl.invalid_enum_value:n=`Invalid enum value. Expected ${kl.joinValues(e.options)}, received '${e.received}'`;break;case xl.invalid_arguments:n="Invalid function arguments";break;case xl.invalid_return_type:n="Invalid function return type";break;case xl.invalid_date:n="Invalid date";break;case xl.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:kl.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case xl.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case xl.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case xl.custom:n="Invalid input";break;case xl.invalid_intersection_types:n="Intersection results could not be merged";break;case xl.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case xl.not_finite:n="Number must be finite";break;default:n=t.defaultError,kl.assertNever(e)}return{message:n}};let Rl=Tl;function Dl(){return Rl}const Pl=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],s={...i,path:o};let a="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)a=e(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}};function Ul(e,t){const n=Pl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Dl(),Tl].filter((e=>!!e))});e.common.issues.push(n)}class Ol{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Fl;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t)n.push({key:await e.key,value:await e.value});return Ol.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return Fl;if("aborted"===i.status)return Fl;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),(void 0!==i.value||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}}const Fl=Object.freeze({status:"aborted"}),Ml=e=>({status:"dirty",value:e}),Ll=e=>({status:"valid",value:e}),ql=e=>"aborted"===e.status,zl=e=>"dirty"===e.status,Nl=e=>"valid"===e.status,jl=e=>"undefined"!=typeof Promise&&e instanceof Promise;var $l;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}($l||($l={}));class Wl{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Hl=(e,t)=>{if(Nl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Bl(e.common.issues);return this._error=t,this._error}}};function Kl(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=n?n:t.defaultError},description:i}}class Vl{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Cl(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Cl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ol,ctx:{common:e.parent.common,data:e.data,parsedType:Cl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(jl(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cl(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Hl(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cl(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(jl(r)?r:Promise.resolve(r));return Hl(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),o=()=>r.addIssue({code:xl.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(o(),!1))):!!i||(o(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Oh({schema:this,typeName:Kh.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Fh.create(this,this._def)}nullable(){return Mh.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mh.create(this,this._def)}promise(){return Uh.create(this,this._def)}or(e){return vh.create([this,e],this._def)}and(e){return Eh.create(this,e,this._def)}transform(e){return new Oh({...Kl(this._def),schema:this,typeName:Kh.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Lh({...Kl(this._def),innerType:this,defaultValue:t,typeName:Kh.ZodDefault})}brand(){return new jh({typeName:Kh.ZodBranded,type:this,...Kl(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new qh({...Kl(this._def),innerType:this,catchValue:t,typeName:Kh.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return $h.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gl=/^c[^\s-]{8,}$/i,Zl=/^[a-z][a-z0-9]*$/,Yl=/[0-9A-HJKMNP-TV-Z]{26}/,Jl=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Xl=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,Ql=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,eh=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,th=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function nh(e,t){return!("v4"!==t&&t||!eh.test(e))||!("v6"!==t&&t||!th.test(e))}class rh extends Vl{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement((t=>e.test(t)),{validation:t,code:xl.invalid_string,...$l.errToObj(n)}),this.nonempty=e=>this.min(1,$l.errToObj(e)),this.trim=()=>new rh({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new rh({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new rh({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Sl.string){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.string,received:t.parsedType}),Fl}const t=new Ol;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const r=e.data.length>i.value,o=e.data.length<i.value;(r||o)&&(n=this._getOrReturnCtx(e,n),r?Ul(n,{code:xl.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Ul(n,{code:xl.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)Xl.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"email",code:xl.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Ql.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"emoji",code:xl.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Jl.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"uuid",code:xl.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)Gl.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"cuid",code:xl.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)Zl.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"cuid2",code:xl.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Yl.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"ulid",code:xl.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),Ul(n,{validation:"url",code:xl.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"regex",code:xl.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){((r=i).precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):0===r.precision?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else"ip"===i.kind?nh(e.data,i.version)||(n=this._getOrReturnCtx(e,n),Ul(n,{validation:"ip",code:xl.invalid_string,message:i.message}),t.dirty()):kl.assertNever(i);var r;return{status:t.value,value:e.data}}_addCheck(e){return new rh({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...$l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...$l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...$l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...$l.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...$l.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...$l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...$l.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...$l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...$l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...$l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...$l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...$l.errToObj(t)})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ih(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}rh.create=e=>{var t;return new rh({checks:[],typeName:Kh.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Kl(e)})};class oh extends Vl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Sl.number){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.number,received:t.parsedType}),Fl}let t;const n=new Ol;for(const r of this._def.checks)if("int"===r.kind)kl.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==ih(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.not_finite,message:r.message}),n.dirty()):kl.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,$l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,$l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,$l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,$l.toString(t))}setLimit(e,t,n,r){return new oh({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:$l.toString(r)}]})}_addCheck(e){return new oh({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:$l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:$l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&kl.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}oh.create=e=>new oh({checks:[],typeName:Kh.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Kl(e)});class sh extends Vl{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==Sl.bigint){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.bigint,received:t.parsedType}),Fl}let t;const n=new Ol;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ul(t,{code:xl.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):kl.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,$l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,$l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,$l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,$l.toString(t))}setLimit(e,t,n,r){return new sh({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:$l.toString(r)}]})}_addCheck(e){return new sh({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:$l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}sh.create=e=>{var t;return new sh({checks:[],typeName:Kh.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Kl(e)})};class ah extends Vl{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Sl.boolean){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.boolean,received:t.parsedType}),Fl}return Ll(e.data)}}ah.create=e=>new ah({typeName:Kh.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Kl(e)});class uh extends Vl{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Sl.date){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.date,received:t.parsedType}),Fl}if(isNaN(e.data.getTime())){return Ul(this._getOrReturnCtx(e),{code:xl.invalid_date}),Fl}const t=new Ol;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Ul(n,{code:xl.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):kl.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new uh({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:$l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:$l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}uh.create=e=>new uh({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Kh.ZodDate,...Kl(e)});class ch extends Vl{_parse(e){if(this._getType(e)!==Sl.symbol){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.symbol,received:t.parsedType}),Fl}return Ll(e.data)}}ch.create=e=>new ch({typeName:Kh.ZodSymbol,...Kl(e)});class dh extends Vl{_parse(e){if(this._getType(e)!==Sl.undefined){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.undefined,received:t.parsedType}),Fl}return Ll(e.data)}}dh.create=e=>new dh({typeName:Kh.ZodUndefined,...Kl(e)});class lh extends Vl{_parse(e){if(this._getType(e)!==Sl.null){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.null,received:t.parsedType}),Fl}return Ll(e.data)}}lh.create=e=>new lh({typeName:Kh.ZodNull,...Kl(e)});class hh extends Vl{constructor(){super(...arguments),this._any=!0}_parse(e){return Ll(e.data)}}hh.create=e=>new hh({typeName:Kh.ZodAny,...Kl(e)});class fh extends Vl{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ll(e.data)}}fh.create=e=>new fh({typeName:Kh.ZodUnknown,...Kl(e)});class ph extends Vl{_parse(e){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.never,received:t.parsedType}),Fl}}ph.create=e=>new ph({typeName:Kh.ZodNever,...Kl(e)});class gh extends Vl{_parse(e){if(this._getType(e)!==Sl.undefined){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.void,received:t.parsedType}),Fl}return Ll(e.data)}}gh.create=e=>new gh({typeName:Kh.ZodVoid,...Kl(e)});class mh extends Vl{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Sl.array)return Ul(t,{code:xl.invalid_type,expected:Sl.array,received:t.parsedType}),Fl;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Ul(t,{code:e?xl.too_big:xl.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Ul(t,{code:xl.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Ul(t,{code:xl.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new Wl(t,e,t.path,n))))).then((e=>Ol.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new Wl(t,e,t.path,n))));return Ol.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new mh({...this._def,minLength:{value:e,message:$l.toString(t)}})}max(e,t){return new mh({...this._def,maxLength:{value:e,message:$l.toString(t)}})}length(e,t){return new mh({...this._def,exactLength:{value:e,message:$l.toString(t)}})}nonempty(e){return this.min(1,e)}}function yh(e){if(e instanceof wh){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Fh.create(yh(r))}return new wh({...e._def,shape:()=>t})}return e instanceof mh?new mh({...e._def,type:yh(e.element)}):e instanceof Fh?Fh.create(yh(e.unwrap())):e instanceof Mh?Mh.create(yh(e.unwrap())):e instanceof kh?kh.create(e.items.map((e=>yh(e)))):e}mh.create=(e,t)=>new mh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Kh.ZodArray,...Kl(t)});class wh extends Vl{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=kl.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Sl.object){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.object,received:t.parsedType}),Fl}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ph&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||o.push(e);const s=[];for(const e of i){const t=r[e],i=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new Wl(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ph){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)o.length>0&&(Ul(n,{code:xl.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const r=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new Wl(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const n=await t.key;e.push({key:n,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>Ol.mergeObjectSync(t,e))):Ol.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return $l.errToObj,new wh({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,o,s;const a=null!==(o=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==o?o:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=$l.errToObj(e).message)&&void 0!==s?s:a}:{message:a}}}:{}})}strip(){return new wh({...this._def,unknownKeys:"strip"})}passthrough(){return new wh({...this._def,unknownKeys:"passthrough"})}extend(e){return new wh({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new wh({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Kh.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new wh({...this._def,catchall:e})}pick(e){const t={};return kl.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new wh({...this._def,shape:()=>t})}omit(e){const t={};return kl.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new wh({...this._def,shape:()=>t})}deepPartial(){return yh(this)}partial(e){const t={};return kl.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new wh({...this._def,shape:()=>t})}required(e){const t={};return kl.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Fh;)e=e._def.innerType;t[n]=e}})),new wh({...this._def,shape:()=>t})}keyof(){return Rh(kl.objectKeys(this.shape))}}wh.create=(e,t)=>new wh({shape:()=>e,unknownKeys:"strip",catchall:ph.create(),typeName:Kh.ZodObject,...Kl(t)}),wh.strictCreate=(e,t)=>new wh({shape:()=>e,unknownKeys:"strict",catchall:ph.create(),typeName:Kh.ZodObject,...Kl(t)}),wh.lazycreate=(e,t)=>new wh({shape:e,unknownKeys:"strip",catchall:ph.create(),typeName:Kh.ZodObject,...Kl(t)});class vh extends Vl{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Bl(e.ctx.common.issues)));return Ul(t,{code:xl.invalid_union,unionErrors:n}),Fl}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Bl(e)));return Ul(t,{code:xl.invalid_union,unionErrors:i}),Fl}}get options(){return this._def.options}}vh.create=(e,t)=>new vh({options:e,typeName:Kh.ZodUnion,...Kl(t)});const bh=e=>e instanceof Bh?bh(e.schema):e instanceof Oh?bh(e.innerType()):e instanceof Th?[e.value]:e instanceof Dh?e.options:e instanceof Ph?Object.keys(e.enum):e instanceof Lh?bh(e._def.innerType):e instanceof dh?[void 0]:e instanceof lh?[null]:null;class _h extends Vl{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Sl.object)return Ul(t,{code:xl.invalid_type,expected:Sl.object,received:t.parsedType}),Fl;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Ul(t,{code:xl.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Fl)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=bh(n.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new _h({typeName:Kh.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Kl(n)})}}function Ah(e,t){const n=Cl(e),r=Cl(t);if(e===t)return{valid:!0,data:e};if(n===Sl.object&&r===Sl.object){const n=kl.objectKeys(t),r=kl.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=Ah(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Sl.array&&r===Sl.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=Ah(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Sl.date&&r===Sl.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Eh extends Vl{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ql(e)||ql(r))return Fl;const i=Ah(e.value,r.value);return i.valid?((zl(e)||zl(r))&&t.dirty(),{status:t.value,value:i.data}):(Ul(n,{code:xl.invalid_intersection_types}),Fl)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Eh.create=(e,t,n)=>new Eh({left:e,right:t,typeName:Kh.ZodIntersection,...Kl(n)});class kh extends Vl{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Sl.array)return Ul(n,{code:xl.invalid_type,expected:Sl.array,received:n.parsedType}),Fl;if(n.data.length<this._def.items.length)return Ul(n,{code:xl.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fl;!this._def.rest&&n.data.length>this._def.items.length&&(Ul(n,{code:xl.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Wl(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Ol.mergeArray(t,e))):Ol.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new kh({...this._def,rest:e})}}kh.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kh({items:e,typeName:Kh.ZodTuple,rest:null,...Kl(t)})};class Ih extends Vl{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Sl.object)return Ul(n,{code:xl.invalid_type,expected:Sl.object,received:n.parsedType}),Fl;const r=[],i=this._def.keyType,o=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new Wl(n,e,n.path,e)),value:o._parse(new Wl(n,n.data[e],n.path,e))});return n.common.async?Ol.mergeObjectAsync(t,r):Ol.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new Ih(t instanceof Vl?{keyType:e,valueType:t,typeName:Kh.ZodRecord,...Kl(n)}:{keyType:rh.create(),valueType:e,typeName:Kh.ZodRecord,...Kl(t)})}}class Sh extends Vl{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Sl.map)return Ul(n,{code:xl.invalid_type,expected:Sl.map,received:n.parsedType}),Fl;const r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map((([e,t],o)=>({key:r._parse(new Wl(n,e,n.path,[o,"key"])),value:i._parse(new Wl(n,t,n.path,[o,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of o){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return Fl;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of o){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return Fl;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Sh.create=(e,t,n)=>new Sh({valueType:t,keyType:e,typeName:Kh.ZodMap,...Kl(n)});class Ch extends Vl{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Sl.set)return Ul(n,{code:xl.invalid_type,expected:Sl.set,received:n.parsedType}),Fl;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Ul(n,{code:xl.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Ul(n,{code:xl.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Fl;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map(((e,t)=>i._parse(new Wl(n,e,n.path,t))));return n.common.async?Promise.all(s).then((e=>o(e))):o(s)}min(e,t){return new Ch({...this._def,minSize:{value:e,message:$l.toString(t)}})}max(e,t){return new Ch({...this._def,maxSize:{value:e,message:$l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ch.create=(e,t)=>new Ch({valueType:e,minSize:null,maxSize:null,typeName:Kh.ZodSet,...Kl(t)});class xh extends Vl{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Sl.function)return Ul(t,{code:xl.invalid_type,expected:Sl.function,received:t.parsedType}),Fl;function n(e,n){return Pl({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Dl(),Tl].filter((e=>!!e)),issueData:{code:xl.invalid_arguments,argumentsError:n}})}function r(e,n){return Pl({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Dl(),Tl].filter((e=>!!e)),issueData:{code:xl.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;return this._def.returns instanceof Uh?Ll((async(...e)=>{const t=new Bl([]),s=await this._def.args.parseAsync(e,i).catch((r=>{throw t.addIssue(n(e,r)),t})),a=await o(...s);return await this._def.returns._def.type.parseAsync(a,i).catch((e=>{throw t.addIssue(r(a,e)),t}))})):Ll(((...e)=>{const t=this._def.args.safeParse(e,i);if(!t.success)throw new Bl([n(e,t.error)]);const s=o(...t.data),a=this._def.returns.safeParse(s,i);if(!a.success)throw new Bl([r(s,a.error)]);return a.data}))}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new xh({...this._def,args:kh.create(e).rest(fh.create())})}returns(e){return new xh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new xh({args:e||kh.create([]).rest(fh.create()),returns:t||fh.create(),typeName:Kh.ZodFunction,...Kl(n)})}}class Bh extends Vl{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Bh.create=(e,t)=>new Bh({getter:e,typeName:Kh.ZodLazy,...Kl(t)});class Th extends Vl{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ul(t,{received:t.data,code:xl.invalid_literal,expected:this._def.value}),Fl}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Rh(e,t){return new Dh({values:e,typeName:Kh.ZodEnum,...Kl(t)})}Th.create=(e,t)=>new Th({value:e,typeName:Kh.ZodLiteral,...Kl(t)});class Dh extends Vl{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Ul(t,{expected:kl.joinValues(n),received:t.parsedType,code:xl.invalid_type}),Fl}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Ul(t,{received:t.data,code:xl.invalid_enum_value,options:n}),Fl}return Ll(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Dh.create(e)}exclude(e){return Dh.create(this.options.filter((t=>!e.includes(t))))}}Dh.create=Rh;class Ph extends Vl{_parse(e){const t=kl.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Sl.string&&n.parsedType!==Sl.number){const e=kl.objectValues(t);return Ul(n,{expected:kl.joinValues(e),received:n.parsedType,code:xl.invalid_type}),Fl}if(-1===t.indexOf(e.data)){const e=kl.objectValues(t);return Ul(n,{received:n.data,code:xl.invalid_enum_value,options:e}),Fl}return Ll(e.data)}get enum(){return this._def.values}}Ph.create=(e,t)=>new Ph({values:e,typeName:Kh.ZodNativeEnum,...Kl(t)});class Uh extends Vl{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Sl.promise&&!1===t.common.async)return Ul(t,{code:xl.invalid_type,expected:Sl.promise,received:t.parsedType}),Fl;const n=t.parsedType===Sl.promise?t.data:Promise.resolve(t.data);return Ll(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Uh.create=(e,t)=>new Uh({type:e,typeName:Kh.ZodPromise,...Kl(t)});class Oh extends Vl{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Kh.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null;if("preprocess"===r.type){const e=r.transform(n.data);return n.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:n.path,parent:n}))):this._def.schema._parseSync({data:e,path:n.path,parent:n})}const i={addIssue:e=>{Ul(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Fl:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?Fl:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Nl(e))return e;const o=r.transform(e.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Nl(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}kl.assertNever(r)}}Oh.create=(e,t,n)=>new Oh({schema:e,typeName:Kh.ZodEffects,effect:t,...Kl(n)}),Oh.createWithPreprocess=(e,t,n)=>new Oh({schema:t,effect:{type:"preprocess",transform:e},typeName:Kh.ZodEffects,...Kl(n)});class Fh extends Vl{_parse(e){return this._getType(e)===Sl.undefined?Ll(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fh.create=(e,t)=>new Fh({innerType:e,typeName:Kh.ZodOptional,...Kl(t)});class Mh extends Vl{_parse(e){return this._getType(e)===Sl.null?Ll(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mh.create=(e,t)=>new Mh({innerType:e,typeName:Kh.ZodNullable,...Kl(t)});class Lh extends Vl{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Sl.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Lh.create=(e,t)=>new Lh({innerType:e,typeName:Kh.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Kl(t)});class qh extends Vl{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return jl(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Bl(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Bl(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qh.create=(e,t)=>new qh({innerType:e,typeName:Kh.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Kl(t)});class zh extends Vl{_parse(e){if(this._getType(e)!==Sl.nan){const t=this._getOrReturnCtx(e);return Ul(t,{code:xl.invalid_type,expected:Sl.nan,received:t.parsedType}),Fl}return{status:"valid",value:e.data}}}zh.create=e=>new zh({typeName:Kh.ZodNaN,...Kl(e)});const Nh=Symbol("zod_brand");class jh extends Vl{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class $h extends Vl{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Fl:"dirty"===e.status?(t.dirty(),Ml(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Fl:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new $h({in:e,out:t,typeName:Kh.ZodPipeline})}}const Wh=(e,t={},n)=>e?hh.create().superRefine(((r,i)=>{var o,s;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,a=null===(s=null!==(o=e.fatal)&&void 0!==o?o:n)||void 0===s||s,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:a})}})):hh.create(),Hh={object:wh.lazycreate};var Kh;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"}(Kh||(Kh={}));const Vh=rh.create,Gh=oh.create,Zh=zh.create,Yh=sh.create,Jh=ah.create,Xh=uh.create,Qh=ch.create,ef=dh.create,tf=lh.create,nf=hh.create,rf=fh.create,of=ph.create,sf=gh.create,af=mh.create,uf=wh.create,cf=wh.strictCreate,df=vh.create,lf=_h.create,hf=Eh.create,ff=kh.create,pf=Ih.create,gf=Sh.create,mf=Ch.create,yf=xh.create,wf=Bh.create,vf=Th.create,bf=Dh.create,_f=Ph.create,Af=Uh.create,Ef=Oh.create,kf=Fh.create,If=Mh.create,Sf=Oh.createWithPreprocess,Cf=$h.create,xf={string:e=>rh.create({...e,coerce:!0}),number:e=>oh.create({...e,coerce:!0}),boolean:e=>ah.create({...e,coerce:!0}),bigint:e=>sh.create({...e,coerce:!0}),date:e=>uh.create({...e,coerce:!0})},Bf=Fl;var Tf=Object.freeze({__proto__:null,defaultErrorMap:Tl,setErrorMap:function(e){Rl=e},getErrorMap:Dl,makeIssue:Pl,EMPTY_PATH:[],addIssueToContext:Ul,ParseStatus:Ol,INVALID:Fl,DIRTY:Ml,OK:Ll,isAborted:ql,isDirty:zl,isValid:Nl,isAsync:jl,get util(){return kl},get objectUtil(){return Il},ZodParsedType:Sl,getParsedType:Cl,ZodType:Vl,ZodString:rh,ZodNumber:oh,ZodBigInt:sh,ZodBoolean:ah,ZodDate:uh,ZodSymbol:ch,ZodUndefined:dh,ZodNull:lh,ZodAny:hh,ZodUnknown:fh,ZodNever:ph,ZodVoid:gh,ZodArray:mh,ZodObject:wh,ZodUnion:vh,ZodDiscriminatedUnion:_h,ZodIntersection:Eh,ZodTuple:kh,ZodRecord:Ih,ZodMap:Sh,ZodSet:Ch,ZodFunction:xh,ZodLazy:Bh,ZodLiteral:Th,ZodEnum:Dh,ZodNativeEnum:Ph,ZodPromise:Uh,ZodEffects:Oh,ZodTransformer:Oh,ZodOptional:Fh,ZodNullable:Mh,ZodDefault:Lh,ZodCatch:qh,ZodNaN:zh,BRAND:Nh,ZodBranded:jh,ZodPipeline:$h,custom:Wh,Schema:Vl,ZodSchema:Vl,late:Hh,get ZodFirstPartyTypeKind(){return Kh},coerce:xf,any:nf,array:af,bigint:Yh,boolean:Jh,date:Xh,discriminatedUnion:lf,effect:Ef,enum:bf,function:yf,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Wh((t=>t instanceof e),t),intersection:hf,lazy:wf,literal:vf,map:gf,nan:Zh,nativeEnum:_f,never:of,null:tf,nullable:If,number:Gh,object:uf,oboolean:()=>Jh().optional(),onumber:()=>Gh().optional(),optional:kf,ostring:()=>Vh().optional(),pipeline:Cf,preprocess:Sf,promise:Af,record:pf,set:mf,strictObject:cf,string:Vh,symbol:Qh,transformer:Ef,tuple:ff,undefined:ef,union:df,unknown:rf,void:sf,NEVER:Bf,ZodIssueCode:xl,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Bl});Tf.object({handle:Tf.string(),challengeId:Tf.nativeEnum(t),specifier:Tf.string(),amount:Tf.number()});class Rf extends cc{constructor(e){let{body:t,cause:n,details:r,headers:i,status:o,url:s}=e;super("HTTP request failed.",{cause:n,details:r,metaMessages:[o&&`Status: ${o}`,`URL: ${s}`,t&&`Request body: ${ul(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=i,this.status=o,this.url=s}}class Df extends cc{constructor(e){let{body:t,error:n,url:r}=e;super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${r}`,`Request body: ${ul(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code}}class Pf extends cc{constructor(e,t){let{code:n,docsPath:r,metaMessages:i,name:o,shortMessage:s}=t;super(s,{cause:e,docsPath:r,metaMessages:i||(null==e?void 0:e.metaMessages),name:o||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=o||e.name,this.code=e instanceof Df?e.code:null!=n?n:-1}}class Uf extends Pf{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class Of extends Pf{constructor(e){super(e,{code:Of.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Ff extends Pf{constructor(e){super(e,{code:Ff.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Ff,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Mf extends Pf{constructor(e){let{method:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,{code:Mf.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Lf extends Pf{constructor(e){super(e,{code:Lf.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")})}}Object.defineProperty(Lf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class qf extends Pf{constructor(e){super(e,{code:qf.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(qf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class zf extends Pf{constructor(e){super(e,{code:zf.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")})}}Object.defineProperty(zf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Nf extends Pf{constructor(e){super(e,{code:Nf.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Nf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class jf extends Pf{constructor(e){super(e,{code:jf.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class $f extends Pf{constructor(e){super(e,{code:$f.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty($f,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Wf extends Pf{constructor(e){let{method:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,{code:Wf.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not implemented.`})}}Object.defineProperty(Wf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Hf extends Pf{constructor(e){super(e,{code:Hf.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Hf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Kf extends Pf{constructor(e){super(e,{code:Kf.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Kf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Vf extends Uf{constructor(e){super(e,{code:Vf.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Vf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Gf extends Uf{constructor(e){super(e,{code:Gf.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Gf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Zf extends Uf{constructor(e){let{method:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,{code:Zf.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(Zf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Yf extends Uf{constructor(e){super(e,{code:Yf.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Yf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Jf extends Uf{constructor(e){super(e,{code:Jf.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Jf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Xf extends Uf{constructor(e){super(e,{code:Xf.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Xf,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Qf extends Pf{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}class ep extends cc{constructor(){let{docsPath:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join("\n"),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}const tp=256;let np,rp=tp;function ip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:11;if(!np||rp+e>2*tp){np="",rp=0;for(let e=0;e<tp;e++)np+=(256+256*Math.random()|0).toString(16).substring(1)}return np.substring(rp,rp+++e)}function op(e){var t;const{batch:n,cacheTime:r=(null!==(t=e.pollingInterval)&&void 0!==t?t:4e3),ccipRead:i,key:o="base",name:s="Base Client",pollingInterval:a=4e3,type:u="base"}=e,c=e.chain,d=e.account?wl(e.account):void 0,{config:l,request:h,value:f}=e.transport({chain:c,pollingInterval:a}),p={account:d,batch:n,cacheTime:r,ccipRead:i,chain:c,key:o,name:s,pollingInterval:a,request:h,transport:{...l,...f},type:u,uid:ip()};return Object.assign(p,{extend:function e(t){return n=>{const r=n(t);for(const e in p)delete r[e];const i={...t,...r};return Object.assign(i,{extend:e(i)})}}(p)})}const sp=new Mc(8192);function ap(e){let{delay:t=100,retryCount:n=2,shouldRetry:r=(()=>!0)}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,o)=>{const s=async function(){let{count:a=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const u=async e=>{let{error:n}=e;const r="function"==typeof t?t({count:a,error:n}):t;r&&await async function(e){return new Promise((t=>setTimeout(t,e)))}(r),s({count:a+1})};try{const t=await e();i(t)}catch(e){if(a<n&&await r({count:a,error:e}))return u({error:e});o(e)}};s()}))}function up(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{dedupe:i=!1,retryDelay:o=150,retryCount:s=3,uid:a}={...t,...r};return function(e,t){let{enabled:n=!0,id:r}=t;if(!n||!r)return e();if(sp.get(r))return sp.get(r);const i=e().finally((()=>sp.delete(r)));return sp.set(r,i),i}((()=>ap((async()=>{try{return await e(n)}catch(e){const t=e;switch(t.code){case Of.code:throw new Of(t);case Ff.code:throw new Ff(t);case Mf.code:throw new Mf(t,{method:n.method});case Lf.code:throw new Lf(t);case qf.code:throw new qf(t);case zf.code:throw new zf(t);case Nf.code:throw new Nf(t);case jf.code:throw new jf(t);case $f.code:throw new $f(t);case Wf.code:throw new Wf(t,{method:n.method});case Hf.code:throw new Hf(t);case Kf.code:throw new Kf(t);case Vf.code:throw new Vf(t);case Gf.code:throw new Gf(t);case Zf.code:throw new Zf(t);case Yf.code:throw new Yf(t);case Jf.code:throw new Jf(t);case Xf.code:throw new Xf(t);case 5e3:throw new Vf(t);default:if(e instanceof cc)throw e;throw new Qf(t)}}}),{delay:e=>{let{count:t,error:n}=e;if(n&&n instanceof Rf){var r;const e=null==n||null===(r=n.headers)||void 0===r?void 0:r.get("Retry-After");if(null!=e&&e.match(/\d/))return 1e3*Number.parseInt(e)}return~~(1<<t)*o},retryCount:s,shouldRetry:e=>{let{error:t}=e;return function(e){if("code"in e&&"number"==typeof e.code)return-1===e.code||(e.code===Hf.code||e.code===qf.code);if(e instanceof Rf&&e.status)return 403===e.status||(408===e.status||(413===e.status||(429===e.status||(500===e.status||(502===e.status||(503===e.status||504===e.status))))));return!0}(t)}})),{enabled:i,id:i?Qc(Oc(`${a}.${ul(n)}`)):void 0})}}function cp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{key:n="custom",name:r="Custom Provider",retryDelay:i}=t;return o=>{var s;let{retryCount:a}=o;return function(e,t){let{key:n,name:r,request:i,retryCount:o=3,retryDelay:s=150,timeout:a,type:u}=e;return{config:{key:n,name:r,request:i,retryCount:o,retryDelay:s,timeout:a,type:u},request:up(i,{retryCount:o,retryDelay:s,uid:ip()}),value:t}}({key:n,name:r,request:e.request.bind(e),retryCount:null!==(s=t.retryCount)&&void 0!==s?s:a,retryDelay:i,type:"custom"})}}async function dp(e,t){const{account:n=e.account,domain:r,message:i,primaryType:o}=t;if(!n)throw new ep({docsPath:"/docs/actions/wallet/signTypedData"});const s=wl(n),a={EIP712Domain:dl({domain:r}),...t.types};if(cl({domain:r,message:i,primaryType:o,types:a}),s.signTypedData)return s.signTypedData({domain:r,message:i,primaryType:o,types:a});const u=function(e){const{domain:t,message:n,primaryType:r,types:i}=e,o=(e,t)=>{const n={...t};for(const t of e){const{name:e,type:r}=t;"address"===r&&(n[e]=n[e].toLowerCase())}return n},s=i.EIP712Domain&&t?o(i.EIP712Domain,t):{},a=(()=>{if("EIP712Domain"!==r)return o(i[r],n)})();return ul({domain:s,message:a,primaryType:r,types:i})}({domain:r,message:i,primaryType:o,types:a});return e.request({method:"eth_signTypedData_v4",params:[s.address,u]},{retryCount:0})}var lp=function(){this.__data__=[],this.size=0};var hp=function(e,t){return e===t||e!=e&&t!=t},fp=hp;var pp=function(e,t){for(var n=e.length;n--;)if(fp(e[n][0],t))return n;return-1},gp=pp,mp=Array.prototype.splice;var yp=function(e){var t=this.__data__,n=gp(t,e);return!(n<0)&&(n==t.length-1?t.pop():mp.call(t,n,1),--this.size,!0)},wp=pp;var vp=function(e){var t=this.__data__,n=wp(t,e);return n<0?void 0:t[n][1]},bp=pp;var _p=function(e){return bp(this.__data__,e)>-1},Ap=pp;var Ep=function(e,t){var n=this.__data__,r=Ap(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},kp=lp,Ip=yp,Sp=vp,Cp=_p,xp=Ep;function Bp(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bp.prototype.clear=kp,Bp.prototype.delete=Ip,Bp.prototype.get=Sp,Bp.prototype.has=Cp,Bp.prototype.set=xp;var Tp=Bp,Rp=Tp;var Dp=function(){this.__data__=new Rp,this.size=0};var Pp=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var Up=function(e){return this.__data__.get(e)};var Op=function(e){return this.__data__.has(e)},Fp="object"==typeof i&&i&&i.Object===Object&&i,Mp=Fp,Lp="object"==typeof self&&self&&self.Object===Object&&self,qp=Mp||Lp||Function("return this")(),zp=qp.Symbol,Np=zp,jp=Object.prototype,$p=jp.hasOwnProperty,Wp=jp.toString,Hp=Np?Np.toStringTag:void 0;var Kp=function(e){var t=$p.call(e,Hp),n=e[Hp];try{e[Hp]=void 0;var r=!0}catch(e){}var i=Wp.call(e);return r&&(t?e[Hp]=n:delete e[Hp]),i},Vp=Object.prototype.toString;var Gp=function(e){return Vp.call(e)},Zp=Kp,Yp=Gp,Jp=zp?zp.toStringTag:void 0;var Xp=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Jp&&Jp in Object(e)?Zp(e):Yp(e)};var Qp=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eg=Xp,tg=Qp;var ng=function(e){if(!tg(e))return!1;var t=eg(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},rg=qp["__core-js_shared__"],ig=function(){var e=/[^.]+$/.exec(rg&&rg.keys&&rg.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var og=function(e){return!!ig&&ig in e},sg=Function.prototype.toString;var ag=ng,ug=og,cg=Qp,dg=function(e){if(null!=e){try{return sg.call(e)}catch(e){}try{return e+""}catch(e){}}return""},lg=/^\[object .+?Constructor\]$/,hg=Function.prototype,fg=Object.prototype,pg=hg.toString,gg=fg.hasOwnProperty,mg=RegExp("^"+pg.call(gg).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var yg=function(e){return!(!cg(e)||ug(e))&&(ag(e)?mg:lg).test(dg(e))};var wg=function(e,t){return null==e?void 0:e[t]},vg=yg,bg=wg;var _g=function(e,t){var n=bg(e,t);return vg(n)?n:void 0},Ag=_g(qp,"Map"),Eg=_g(Object,"create"),kg=Eg;var Ig=function(){this.__data__=kg?kg(null):{},this.size=0};var Sg=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Cg=Eg,xg=Object.prototype.hasOwnProperty;var Bg=function(e){var t=this.__data__;if(Cg){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return xg.call(t,e)?t[e]:void 0},Tg=Eg,Rg=Object.prototype.hasOwnProperty;var Dg=function(e){var t=this.__data__;return Tg?void 0!==t[e]:Rg.call(t,e)},Pg=Eg;var Ug=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Pg&&void 0===t?"__lodash_hash_undefined__":t,this},Og=Ig,Fg=Sg,Mg=Bg,Lg=Dg,qg=Ug;function zg(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}zg.prototype.clear=Og,zg.prototype.delete=Fg,zg.prototype.get=Mg,zg.prototype.has=Lg,zg.prototype.set=qg;var Ng=zg,jg=Tp,$g=Ag;var Wg=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},Hg=Wg;var Kg=function(e,t){var n=e.__data__;return Hg(t)?n["string"==typeof t?"string":"hash"]:n.map},Vg=Kg;var Gg=function(e){var t=Vg(this,e).delete(e);return this.size-=t?1:0,t},Zg=Kg;var Yg=function(e){return Zg(this,e).get(e)},Jg=Kg;var Xg=function(e){return Jg(this,e).has(e)},Qg=Kg;var em=function(e,t){var n=Qg(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},tm=function(){this.size=0,this.__data__={hash:new Ng,map:new($g||jg),string:new Ng}},nm=Gg,rm=Yg,im=Xg,om=em;function sm(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}sm.prototype.clear=tm,sm.prototype.delete=nm,sm.prototype.get=rm,sm.prototype.has=im,sm.prototype.set=om;var am=Tp,um=Ag,cm=sm;var dm=function(e,t){var n=this.__data__;if(n instanceof am){var r=n.__data__;if(!um||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new cm(r)}return n.set(e,t),this.size=n.size,this},lm=Tp,hm=Dp,fm=Pp,pm=Up,gm=Op,mm=dm;function ym(e){var t=this.__data__=new lm(e);this.size=t.size}ym.prototype.clear=hm,ym.prototype.delete=fm,ym.prototype.get=pm,ym.prototype.has=gm,ym.prototype.set=mm;var wm=ym,vm=_g,bm=function(){try{var e=vm(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_m=bm;var Am=function(e,t,n){"__proto__"==t&&_m?_m(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Em=Am,km=hp;var Im=function(e,t,n){(void 0!==n&&!km(e[t],n)||void 0===n&&!(t in e))&&Em(e,t,n)};var Sm=function(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var u=s[e?a:++i];if(!1===n(o[u],u,o))break}return t}},Cm=Sm(),xm={exports:{}};!function(e,t){var n=qp,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r?n.Buffer:void 0,s=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}}(xm,xm.exports);var Bm=qp.Uint8Array;var Tm=function(e){var t=new e.constructor(e.byteLength);return new Bm(t).set(new Bm(e)),t};var Rm=function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Dm=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t},Pm=Qp,Um=Object.create,Om=function(){function e(){}return function(t){if(!Pm(t))return{};if(Um)return Um(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Fm=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Mm=Object.prototype;var Lm=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Mm)},qm=Om,zm=Fm,Nm=Lm;var jm=function(e){return"function"!=typeof e.constructor||Nm(e)?{}:qm(zm(e))};var $m=function(e){return null!=e&&"object"==typeof e},Wm=Xp,Hm=$m;var Km=function(e){return Hm(e)&&"[object Arguments]"==Wm(e)},Vm=Km,Gm=$m,Zm=Object.prototype,Ym=Zm.hasOwnProperty,Jm=Zm.propertyIsEnumerable,Xm=Vm(function(){return arguments}())?Vm:function(e){return Gm(e)&&Ym.call(e,"callee")&&!Jm.call(e,"callee")},Qm=Xm,ey=Array.isArray;var ty=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},ny=ng,ry=ty;var iy=function(e){return null!=e&&ry(e.length)&&!ny(e)},oy=iy,sy=$m;var ay=function(e){return sy(e)&&oy(e)},uy={exports:{}};var cy=function(){return!1};!function(e,t){var n=qp,r=cy,i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,s=o&&o.exports===i?n.Buffer:void 0,a=(s?s.isBuffer:void 0)||r;e.exports=a}(uy,uy.exports);var dy=Xp,ly=Fm,hy=$m,fy=Function.prototype,py=Object.prototype,gy=fy.toString,my=py.hasOwnProperty,yy=gy.call(Object);var wy=function(e){if(!hy(e)||"[object Object]"!=dy(e))return!1;var t=ly(e);if(null===t)return!0;var n=my.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&gy.call(n)==yy},vy=Xp,by=ty,_y=$m,Ay={};Ay["[object Float32Array]"]=Ay["[object Float64Array]"]=Ay["[object Int8Array]"]=Ay["[object Int16Array]"]=Ay["[object Int32Array]"]=Ay["[object Uint8Array]"]=Ay["[object Uint8ClampedArray]"]=Ay["[object Uint16Array]"]=Ay["[object Uint32Array]"]=!0,Ay["[object Arguments]"]=Ay["[object Array]"]=Ay["[object ArrayBuffer]"]=Ay["[object Boolean]"]=Ay["[object DataView]"]=Ay["[object Date]"]=Ay["[object Error]"]=Ay["[object Function]"]=Ay["[object Map]"]=Ay["[object Number]"]=Ay["[object Object]"]=Ay["[object RegExp]"]=Ay["[object Set]"]=Ay["[object String]"]=Ay["[object WeakMap]"]=!1;var Ey=function(e){return _y(e)&&by(e.length)&&!!Ay[vy(e)]};var ky=function(e){return function(t){return e(t)}},Iy={exports:{}};!function(e,t){var n=Fp,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,o=i&&i.exports===r&&n.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s}(Iy,Iy.exports);var Sy=Ey,Cy=ky,xy=Iy.exports,By=xy&&xy.isTypedArray,Ty=By?Cy(By):Sy;var Ry=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},Dy=Am,Py=hp,Uy=Object.prototype.hasOwnProperty;var Oy=function(e,t,n){var r=e[t];Uy.call(e,t)&&Py(r,n)&&(void 0!==n||t in e)||Dy(e,t,n)},Fy=Oy,My=Am;var Ly=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],u=r?r(n[a],e[a],a,n,e):void 0;void 0===u&&(u=e[a]),i?My(n,a,u):Fy(n,a,u)}return n};var qy=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},zy=/^(?:0|[1-9]\d*)$/;var Ny=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&zy.test(e))&&e>-1&&e%1==0&&e<t},jy=qy,$y=Qm,Wy=ey,Hy=uy.exports,Ky=Ny,Vy=Ty,Gy=Object.prototype.hasOwnProperty;var Zy=function(e,t){var n=Wy(e),r=!n&&$y(e),i=!n&&!r&&Hy(e),o=!n&&!r&&!i&&Vy(e),s=n||r||i||o,a=s?jy(e.length,String):[],u=a.length;for(var c in e)!t&&!Gy.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ky(c,u))||a.push(c);return a};var Yy=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},Jy=Qp,Xy=Lm,Qy=Yy,ew=Object.prototype.hasOwnProperty;var tw=function(e){if(!Jy(e))return Qy(e);var t=Xy(e),n=[];for(var r in e)("constructor"!=r||!t&&ew.call(e,r))&&n.push(r);return n},nw=Zy,rw=tw,iw=iy;var ow=function(e){return iw(e)?nw(e,!0):rw(e)},sw=Ly,aw=ow;var uw=function(e){return sw(e,aw(e))},cw=Im,dw=xm.exports,lw=Rm,hw=Dm,fw=jm,pw=Qm,gw=ey,mw=ay,yw=uy.exports,ww=ng,vw=Qp,bw=wy,_w=Ty,Aw=Ry,Ew=uw;var kw=function(e,t,n,r,i,o,s){var a=Aw(e,n),u=Aw(t,n),c=s.get(u);if(c)cw(e,n,c);else{var d=o?o(a,u,n+"",e,t,s):void 0,l=void 0===d;if(l){var h=gw(u),f=!h&&yw(u),p=!h&&!f&&_w(u);d=u,h||f||p?gw(a)?d=a:mw(a)?d=hw(a):f?(l=!1,d=dw(u,!0)):p?(l=!1,d=lw(u,!0)):d=[]:bw(u)||pw(u)?(d=a,pw(a)?d=Ew(a):vw(a)&&!ww(a)||(d=fw(u))):l=!1}l&&(s.set(u,d),i(d,u,r,o,s),s.delete(u)),cw(e,n,d)}},Iw=wm,Sw=Im,Cw=Cm,xw=kw,Bw=Qp,Tw=ow,Rw=Ry;var Dw=function e(t,n,r,i,o){t!==n&&Cw(n,(function(s,a){if(o||(o=new Iw),Bw(s))xw(t,n,a,r,e,i,o);else{var u=i?i(Rw(t,a),s,a+"",t,n,o):void 0;void 0===u&&(u=s),Sw(t,a,u)}}),Tw)};var Pw=function(e){return e};var Uw=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Ow=Math.max;var Fw=function(e,t,n){return t=Ow(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=Ow(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),Uw(e,this,a)}};var Mw=function(e){return function(){return e}},Lw=Mw,qw=bm,zw=qw?function(e,t){return qw(e,"toString",{configurable:!0,enumerable:!1,value:Lw(t),writable:!0})}:Pw,Nw=zw,jw=Date.now;var $w=function(e){var t=0,n=0;return function(){var r=jw(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}},Ww=$w(Nw),Hw=Pw,Kw=Fw,Vw=Ww;var Gw=hp,Zw=iy,Yw=Ny,Jw=Qp;var Xw=function(e,t,n){if(!Jw(n))return!1;var r=typeof t;return!!("number"==r?Zw(n)&&Yw(t,n.length):"string"==r&&t in n)&&Gw(n[t],e)},Qw=function(e,t){return Vw(Kw(e,t,Hw),e+"")},ev=Xw;var tv=function(e){return Qw((function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&ev(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t}))},nv=Dw,rv=tv((function(e,t,n,r){nv(e,t,n,r)}));const iv=(e,t)=>rv({},t,e,((e,t)=>{if(Array.isArray(t))return t})),ov=["debug","info","warn","error"];class sv{constructor(e){var t,n;u(this,"logLevel",void 0),u(this,"logPrefix","[audius-sdk]"),this.logLevel=null!==(t=null==e?void 0:e.logLevel)&&void 0!==t?t:"warn",this.logPrefix=null!==(n=null==e?void 0:e.logPrefix)&&void 0!==n?n:"[audius-sdk]"}createPrefixedLogger(e){return new sv({logLevel:this.logLevel,logPrefix:`${this.logPrefix}${e}`})}debug(){if(!(ov.indexOf(this.logLevel)>ov.indexOf("debug"))){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];console.debug(this.logPrefix,...t)}}info(){if(!(ov.indexOf(this.logLevel)>ov.indexOf("info"))){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];console.info(this.logPrefix,...t)}}warn(){if(!(ov.indexOf(this.logLevel)>ov.indexOf("warn"))){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];console.warn(this.logPrefix,...t)}}error(){if(!(ov.indexOf(this.logLevel)>ov.indexOf("error"))){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];console.error(this.logPrefix,...t)}}}const av=()=>({request:async e=>{let{method:t,params:n}=e;throw console.error("Local transport in use. RPC methods are not implemented.",{method:t,params:n}),new Error(`Method '${t}' not implemented on local transport.`)}});function uv(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function cv(e){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${n}, not of length=${e.length}`)}const dv={number:uv,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:cv,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");uv(e.outputLen),uv(e.blockLen)},exists:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},output:function(e,t){cv(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},lv=BigInt(2**32-1),hv=BigInt(32);function fv(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&lv),l:Number(e>>hv&lv)}:{h:0|Number(e>>hv&lv),l:0|Number(e&lv)}}const pv={fromBig:fv,split:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=fv(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]},toBig:(e,t)=>BigInt(e>>>0)<<hv|BigInt(t>>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<<n|t>>>32-n,rotlSL:(e,t,n)=>t<<n|e>>>32-n,rotlBH:(e,t,n)=>t<<n-32|e>>>64-n,rotlBL:(e,t,n)=>e<<n-32|t>>>64-n,add:function(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},gv=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),mv=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const yv=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function wv(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=yv[e[n]];return t}function vv(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}class bv{clone(){return this._cloneInto()}}function _v(e){const t=t=>e().update(vv(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const[Av,Ev,kv]=[[],[],[]],Iv=BigInt(0),Sv=BigInt(1),Cv=BigInt(2),xv=BigInt(7),Bv=BigInt(256),Tv=BigInt(113);for(let e=0,t=Sv,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Av.push(2*(5*r+n)),Ev.push((e+1)*(e+2)/2%64);let i=Iv;for(let e=0;e<7;e++)t=(t<<Sv^(t>>xv)*Tv)%Bv,t&Cv&&(i^=Sv<<(Sv<<BigInt(e))-Sv);kv.push(i)}const[Rv,Dv]=pv.split(kv,!0),Pv=(e,t,n)=>n>32?pv.rotlBH(e,t,n):pv.rotlSH(e,t,n),Uv=(e,t,n)=>n>32?pv.rotlBL(e,t,n):pv.rotlSL(e,t,n);class Ov extends bv{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,dv.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,i=(t+2)%10,o=n[i],s=n[i+1],a=Pv(o,s,1)^n[r],u=Uv(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=a,e[t+n+1]^=u}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=Ev[n],o=Pv(t,i,r),s=Uv(t,i,r),a=Av[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=Rv[r],e[1]^=Dv[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){dv.exists(this);const{blockLen:t,state:n}=this,r=(e=vv(e)).length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,0!=(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){dv.exists(this,!1),dv.bytes(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return dv.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(dv.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new Ov(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Fv=(e,t,n)=>_v((()=>new Ov(t,e,n)));Fv(6,144,28),Fv(6,136,32),Fv(6,104,48),Fv(6,72,64),Fv(1,144,28);const Mv=Fv(1,136,32);Fv(1,104,48),Fv(1,72,64);const Lv=(e,t,n)=>function(e){const t=(t,n)=>e(n).update(vv(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}((function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ov(t,e,void 0===r.dkLen?n:r.dkLen,!0)}));Lv(31,168,16),Lv(31,136,32);var qv=Object.freeze({__proto__:null,default:{}});
11
- /*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
12
- const zv=BigInt(0),Nv=BigInt(1),jv=BigInt(2),$v=BigInt(3),Wv=BigInt(8),Hv=Object.freeze({a:zv,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Nv,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});function Kv(e){const{a:t,b:n}=Hv,r=fb(e*e),i=fb(r*e);return fb(i+t*e+n)}const Vv=Hv.a===zv;class Gv extends Error{constructor(e){super(e)}}class Zv{constructor(e,t,n){this.x=e,this.y=t,this.z=n}static fromAffine(e){if(!(e instanceof Jv))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new Zv(e.x,e.y,Nv)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hv.P;const n=new Array(e.length),r=e.reduce(((e,r,i)=>r===zv?e:(n[i]=e,fb(e*r,t))),Nv),i=gb(r,t);return e.reduceRight(((e,r,i)=>r===zv?e:(n[i]=fb(e*n[i],t),fb(e*r,t))),i),n}(e.map((e=>e.z)));return e.map(((e,n)=>e.toAffine(t[n])))}static normalizeZ(e){return Zv.toAffineBatch(e).map(Zv.fromAffine)}equals(e){if(!(e instanceof Zv))throw new TypeError("JacobianPoint expected");const{x:t,y:n,z:r}=this,{x:i,y:o,z:s}=e,a=fb(r*r),u=fb(s*s),c=fb(t*u),d=fb(i*a),l=fb(fb(n*s)*u),h=fb(fb(o*r)*a);return c===d&&l===h}negate(){return new Zv(this.x,fb(-this.y),this.z)}double(){const{x:e,y:t,z:n}=this,r=fb(e*e),i=fb(t*t),o=fb(i*i),s=e+i,a=fb(jv*(fb(s*s)-r-o)),u=fb($v*r),c=fb(u*u),d=fb(c-jv*a),l=fb(u*(a-d)-Wv*o),h=fb(jv*t*n);return new Zv(d,l,h)}add(e){if(!(e instanceof Zv))throw new TypeError("JacobianPoint expected");const{x:t,y:n,z:r}=this,{x:i,y:o,z:s}=e;if(i===zv||o===zv)return this;if(t===zv||n===zv)return e;const a=fb(r*r),u=fb(s*s),c=fb(t*u),d=fb(i*a),l=fb(fb(n*s)*u),h=fb(fb(o*r)*a),f=fb(d-c),p=fb(h-l);if(f===zv)return p===zv?this.double():Zv.ZERO;const g=fb(f*f),m=fb(f*g),y=fb(c*g),w=fb(p*p-m-jv*y),v=fb(p*(y-w)-l*m),b=fb(r*s*f);return new Zv(w,v,b)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=Zv.ZERO;if("bigint"==typeof e&&e===zv)return t;let n=hb(e);if(n===Nv)return this;if(!Vv){let e=t,r=this;for(;n>zv;)n&Nv&&(e=e.add(r)),r=r.double(),n>>=Nv;return e}let{k1neg:r,k1:i,k2neg:o,k2:s}=wb(n),a=t,u=t,c=this;for(;i>zv||s>zv;)i&Nv&&(a=a.add(c)),s&Nv&&(u=u.add(c)),c=c.double(),i>>=Nv,s>>=Nv;return r&&(a=a.negate()),o&&(u=u.negate()),u=new Zv(fb(u.x*Hv.beta),u.y,u.z),a.add(u)}precomputeWindow(e){const t=Vv?128/e+1:256/e+1,n=[];let r=this,i=r;for(let o=0;o<t;o++){i=r,n.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(e,t){!t&&this.equals(Zv.BASE)&&(t=Jv.BASE);const n=t&&t._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=t&&Yv.get(t);r||(r=this.precomputeWindow(n),t&&1!==n&&(r=Zv.normalizeZ(r),Yv.set(t,r)));let i=Zv.ZERO,o=Zv.ZERO;const s=1+(Vv?128/n:256/n),a=2**(n-1),u=BigInt(2**n-1),c=2**n,d=BigInt(n);for(let t=0;t<s;t++){const n=t*a;let s=Number(e&u);if(e>>=d,s>a&&(s-=c,e+=Nv),0===s){let e=r[n];t%2&&(e=e.negate()),o=o.add(e)}else{let e=r[n+Math.abs(s)-1];s<0&&(e=e.negate()),i=i.add(e)}}return{p:i,f:o}}multiply(e,t){let n,r,i=hb(e);if(Vv){const{k1neg:e,k1:o,k2neg:s,k2:a}=wb(i);let{p:u,f:c}=this.wNAF(o,t),{p:d,f:l}=this.wNAF(a,t);e&&(u=u.negate()),s&&(d=d.negate()),d=new Zv(fb(d.x*Hv.beta),d.y,d.z),n=u.add(d),r=c.add(l)}else{const{p:e,f:o}=this.wNAF(i,t);n=e,r=o}return Zv.normalizeZ([n,r])[0]}toAffine(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gb(this.z);const{x:t,y:n,z:r}=this,i=e,o=fb(i*i),s=fb(o*i),a=fb(t*o),u=fb(n*s);if(fb(r*i)!==Nv)throw new Error("invZ was invalid");return new Jv(a,u)}}Zv.BASE=new Zv(Hv.Gx,Hv.Gy,Nv),Zv.ZERO=new Zv(zv,Nv,zv);const Yv=new WeakMap;class Jv{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,Yv.delete(this)}hasEvenY(){return this.y%jv===zv}static fromCompressedHex(e){const t=32===e.length,n=db(t?e:e.subarray(1));if(!Eb(n))throw new Error("Point is not on curve");let r=function(e){const{P:t}=Hv,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),u=e*e*e%t,c=u*u*e%t,d=pb(c,$v)*c%t,l=pb(d,$v)*c%t,h=pb(l,jv)*u%t,f=pb(h,r)*h%t,p=pb(f,i)*f%t,g=pb(p,s)*p%t,m=pb(g,a)*g%t,y=pb(m,s)*p%t,w=pb(y,$v)*c%t,v=pb(w,o)*f%t,b=pb(v,n)*u%t;return pb(b,jv)}(Kv(n));const i=(r&Nv)===Nv;if(t)i&&(r=fb(-r));else{1==(1&e[0])!==i&&(r=fb(-r))}const o=new Jv(n,r);return o.assertValidity(),o}static fromUncompressedHex(e){const t=db(e.subarray(1,33)),n=db(e.subarray(33,65)),r=new Jv(t,n);return r.assertValidity(),r}static fromHex(e){const t=lb(e),n=t.length,r=t[0];if(32===n||33===n&&(2===r||3===r))return this.fromCompressedHex(t);if(65===n&&4===r)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${n}`)}static fromPrivateKey(e){return Jv.BASE.multiply(Ib(e))}static fromSignature(e,t,n){const r=function(e){const{n:t}=Hv,n=e.length,r=8*n-256;let i=db(e);r>0&&(i>>=BigInt(r));i>=t&&(i-=t);return i}(e=lb(e)),{r:i,s:o}=function(e){if(e instanceof eb)return e.assertValidity(),e;try{return eb.fromDER(e)}catch(t){return eb.fromCompact(e)}}(t);if(0!==n&&1!==n)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&n?"03":"02",a=Jv.fromHex(s+ob(i)),{n:u}=Hv,c=gb(i,u),d=fb(-r*c,u),l=fb(o*c,u),h=Jv.BASE.multiplyAndAddUnsafe(a,d,l);if(!h)throw new Error("Cannot recover signature: point at infinify");return h.assertValidity(),h}toRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return cb(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=ob(this.x);if(e){return`${this.hasEvenY()?"02":"03"}${t}`}return`04${t}${ob(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:n}=this;if(!Eb(t)||!Eb(n))throw new Error(e);const r=fb(n*n);if(fb(r-Kv(t))!==zv)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new Jv(this.x,fb(-this.y))}double(){return Zv.fromAffine(this).double().toAffine()}add(e){return Zv.fromAffine(this).add(Zv.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Zv.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,n){const r=Zv.fromAffine(this),i=t===zv||t===Nv||this!==Jv.BASE?r.multiplyUnsafe(t):r.multiply(t),o=Zv.fromAffine(e).multiplyUnsafe(n),s=i.add(o);return s.equals(Zv.ZERO)?void 0:s.toAffine()}}function Xv(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function Qv(e){if(e.length<2||2!==e[0])throw new Error(`Invalid signature integer tag: ${rb(e)}`);const t=e[1],n=e.subarray(2,t+2);if(!t||n.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:db(n),left:e.subarray(t+2)}}Jv.BASE=new Jv(Hv.Gx,Hv.Gy),Jv.ZERO=new Jv(zv,zv);class eb{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=e instanceof Uint8Array,n="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${n}: Expected string or Uint8Array`);const r=t?rb(e):e;if(128!==r.length)throw new Error(`${n}: Expected 64-byte hex`);return new eb(ub(r.slice(0,64)),ub(r.slice(64,128)))}static fromDER(e){const t=e instanceof Uint8Array;if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:n,s:r}=function(e){if(e.length<2||48!=e[0])throw new Error(`Invalid signature tag: ${rb(e)}`);if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:n}=Qv(e.subarray(2)),{data:r,left:i}=Qv(n);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${rb(i)}`);return{r:t,s:r}}(t?e:cb(e));return new eb(n,r)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!Ab(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ab(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=Hv.n>>Nv;return this.s>e}normalizeS(){return this.hasHighS()?new eb(this.r,Hv.n-this.s):this}toDERRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return cb(this.toDERHex(e))}toDERHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=Xv(ab(this.s));if(e)return t;const n=Xv(ab(this.r)),r=ab(n.length/2),i=ab(t.length/2);return`30${ab(n.length/2+t.length/2+4)}02${r}${n}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return cb(this.toCompactHex())}toCompactHex(){return ob(this.r)+ob(this.s)}}function tb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const r=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(r);for(let e=0,n=0;e<t.length;e++){const r=t[e];i.set(r,n),n+=r.length}return i}const nb=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function rb(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let n=0;n<e.length;n++)t+=nb[e[n]];return t}const ib=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function ob(e){if("bigint"!=typeof e)throw new Error("Expected bigint");if(!(zv<=e&&e<ib))throw new Error("Expected number < 2^256");return e.toString(16).padStart(64,"0")}function sb(e){const t=cb(ob(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function ab(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function ub(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function cb(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++){const r=2*n,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[n]=o}return t}function db(e){return ub(rb(e))}function lb(e){return e instanceof Uint8Array?Uint8Array.from(e):cb(e)}function hb(e){if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"==typeof e&&Ab(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function fb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hv.P;const n=e%t;return n>=zv?n:t+n}function pb(e,t){const{P:n}=Hv;let r=e;for(;t-- >zv;)r*=r,r%=n;return r}function gb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hv.P;if(e===zv||t<=zv)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=fb(e,t),r=t,i=zv,o=Nv;for(;n!==zv;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==Nv)throw new Error("invert: does not exist");return fb(i,t)}const mb=(e,t)=>(e+t/jv)/t,yb={a1:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),b1:-Nv*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a2:BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),b2:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),POW_2_128:BigInt("0x100000000000000000000000000000000")};function wb(e){const{n:t}=Hv,{a1:n,b1:r,a2:i,b2:o,POW_2_128:s}=yb,a=mb(o*e,t),u=mb(-r*e,t);let c=fb(e-a*n-u*i,t),d=fb(-a*r-u*o,t);const l=c>s,h=d>s;if(l&&(c=t-c),h&&(d=t-d),c>s||d>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:l,k1:c,k2neg:h,k2:d}}let vb,bb;class _b{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ub.hmacSha256(this.k,...t)}hmacSync(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return bb(this.k,...t)}checkSync(){if("function"!=typeof bb)throw new Gv("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.checkSync(),this.incr(),this.v=this.hmacSync(this.v),this.v}}function Ab(e){return zv<e&&e<Hv.n}function Eb(e){return zv<e&&e<Hv.P}function kb(e,t,n){const r=db(e);if(!Ab(r))return;const{n:i}=Hv,o=Jv.BASE.multiply(r),s=fb(o.x,i);if(s===zv)return;const a=fb(gb(r,i)*fb(t+n*s,i),i);if(a===zv)return;const u=new eb(s,a);return{sig:u,recovery:(o.x===u.r?0:2)|Number(o.y&Nv)}}function Ib(e){let t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=ub(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=db(e)}if(!Ab(t))throw new Error("Expected private key: 0 < key < n");return t}function Sb(e){const t=e instanceof Uint8Array,n="string"==typeof e,r=(t||n)&&e.length;return t?33===r||65===r:n?66===r||130===r:e instanceof Jv}function Cb(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Sb(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!Sb(t))throw new TypeError("getSharedSecret: second arg must be public key");const r=function(e){return e instanceof Jv?(e.assertValidity(),e):Jv.fromHex(e)}(t);return r.assertValidity(),r.multiply(Ib(e)).toRawBytes(n)}function xb(e){return db(e.length>32?e.slice(0,32):e)}function Bb(e){const t=xb(e),n=fb(t,Hv.n);return Tb(n<zv?t:n)}function Tb(e){return sb(e)}async function Rb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:r,m:i,d:o}=function(e,t,n){if(null==e)throw new Error(`sign: expected valid message hash, not "${e}"`);const r=lb(e),i=Ib(t),o=[Tb(i),Bb(r)];if(null!=n){!0===n&&(n=Ub.randomBytes(32));const e=lb(n);if(32!==e.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(e)}return{seed:tb(...o),m:xb(r),d:i}}(e,t,n.extraEntropy);let s;const a=new _b;for(await a.reseed(r);!(s=kb(await a.generate(),i,o));)await a.reseed();return function(e,t){let{sig:n,recovery:r}=e;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},t);i&&n.hasHighS()&&(n=n.normalizeS(),r^=1);const a=o?n.toDERRawBytes():n.toCompactRawBytes();return s?[a,r]:a}(s,n)}Jv.BASE._setWindowSize(8);const Db={node:qv,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},Pb={},Ub={bytesToHex:rb,hexToBytes:cb,concatBytes:tb,mod:fb,invert:gb,isValidPrivateKey(e){try{return Ib(e),!0}catch(e){return!1}},_bigintTo32Bytes:sb,_normalizePrivateKey:Ib,hashToPrivateKey:e=>{if((e=lb(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return sb(fb(db(e),Hv.n-Nv)+Nv)},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Db.web)return Db.web.getRandomValues(new Uint8Array(e));if(Db.node){const{randomBytes:t}=Db.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Ub.hashToPrivateKey(Ub.randomBytes(40)),sha256:async function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(Db.web){const e=await Db.web.subtle.digest("SHA-256",tb(...t));return new Uint8Array(e)}if(Db.node){const{createHash:e}=Db.node,n=e("sha256");return t.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(Db.web){const t=await Db.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=tb(...n),i=await Db.web.subtle.sign("HMAC",t,r);return new Uint8Array(i)}if(Db.node){const{createHmac:t}=Db.node,r=t("sha256",e);return n.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async function(e){let t=Pb[e];if(void 0===t){const n=await Ub.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=tb(n,n),Pb[e]=t}for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Ub.sha256(t,...r)},taggedHashSync:function(e){if("function"!=typeof vb)throw new Gv("sha256Sync is undefined, you need to set it");let t=Pb[e];if(void 0===t){const n=vb(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=tb(n,n),Pb[e]=t}for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return vb(t,...r)},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Jv.BASE;const n=t===Jv.BASE?t:new Jv(t.x,t.y);return n._setWindowSize(e),n.multiply($v),n}};Object.defineProperties(Ub,{sha256Sync:{configurable:!1,get:()=>vb,set(e){vb||(vb=e)}},hmacSha256Sync:{configurable:!1,get:()=>bb,set(e){bb||(bb=e)}}});class Ob extends Error{constructor(){super("Hedgehog wallet not found. Is the user logged in?")}}function Fb(e){return{getAddresses:async()=>async function(e){var t;return"local"===(null===(t=e.account)||void 0===t?void 0:t.type)?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map((e=>td(e)))}(e),sign:t=>async function(e,t){let{account:n=e.account,message:r}=t;if(!n)throw new Error("Account not found");const i="string"==typeof n?{address:n,type:"json-rpc"}:n,o="string"==typeof r?Oc(r):r.raw instanceof Uint8Array?Tc(r.raw):r.raw;if("signRaw"in i&&i.signRaw)return i.signRaw(o);throw new Error(`Account type '${i.type}' does not implement 'sign' method.`)}(e,t),signMessage:t=>async function(e,t){let{account:n=e.account,message:r}=t;if(!n)throw new ep({docsPath:"/docs/actions/wallet/signMessage"});const i=wl(n);if(i.signMessage)return i.signMessage({message:r});const o="string"==typeof r?Oc(r):r.raw instanceof Uint8Array?Tc(r.raw):r.raw;return e.request({method:"personal_sign",params:[o,i.address]},{retryCount:0})}(e,t),signTypedData:t=>dp(e,t),getSharedSecret:t=>async function(e,t){let{account:n=e.account,publicKey:r}=t;if(!n)throw new Error("Account not found");const i="string"==typeof n?{address:n,type:"json-rpc"}:n;if("getSharedSecret"in i&&i.getSharedSecret)return i.getSharedSecret(r);throw new Error(`Account type '${i.type}' does not implement 'getSharedSecret' method.`)}(e,t)}}const Mb=e=>e.startsWith("0x")?e:`0x${e}`,Lb=e=>{let{apiKey:t,apiSecret:n}=e;return n?op({name:"Audius App",type:"audius",account:(r=Mb(n),{...yl(r),source:"custom",getSharedSecret:async e=>Cb(kc(r),e,!0),signRaw:async e=>Rb(Mv(kc(e)),kc(r),{recovered:!0,der:!1})}),transport:cp(av())}).extend(Fb):op({name:"Audius Readonly App",type:"audius",account:{address:Mb(t),type:"local"},transport:cp(av())}).extend(Fb);var r};class qb{}var zb,Nb,jb;u(qb,"abi",[{constant:!0,inputs:[{name:"",type:"bytes32"}],name:"usedSignatures",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,name:"_userId",type:"uint256"},{indexed:!1,name:"_signer",type:"address"},{indexed:!1,name:"_entityType",type:"string"},{indexed:!1,name:"_entityId",type:"uint256"},{indexed:!1,name:"_metadata",type:"string"},{indexed:!1,name:"_action",type:"string"}],name:"ManageEntity",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"_userId",type:"uint256"},{indexed:!1,name:"_isVerified",type:"bool"}],name:"ManageIsVerified",type:"event"},{constant:!1,inputs:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"}],name:"initialize",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_verifierAddress",type:"address"},{name:"_networkId",type:"uint256"}],name:"initialize",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_userId",type:"uint256"},{name:"_entityType",type:"string"},{name:"_entityId",type:"uint256"},{name:"_action",type:"string"},{name:"_metadata",type:"string"},{name:"_nonce",type:"bytes32"},{name:"_subjectSig",type:"bytes"}],name:"manageEntity",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"_userId",type:"uint256"},{name:"_isVerified",type:"bool"}],name:"manageIsVerified",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"}]),u(qb,"types",{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],ManageEntity:[{name:"userId",type:"uint"},{name:"entityType",type:"string"},{name:"entityId",type:"uint"},{name:"action",type:"string"},{name:"metadata",type:"string"},{name:"nonce",type:"bytes32"}]}),function(e){e.CREATE="Create",e.UPDATE="Update",e.DELETE="Delete",e.VERIFY="Verify",e.FOLLOW="Follow",e.UNFOLLOW="Unfollow",e.SAVE="Save",e.SHARE="Share",e.UNSAVE="Unsave",e.REPOST="Repost",e.UNREPOST="Unrepost",e.SUBSCRIBE="Subscribe",e.UNSUBSCRIBE="Unsubscribe",e.VIEW="View",e.VIEW_PLAYLIST="ViewPlaylist",e.APPROVE="Approve",e.REJECT="Reject",e.DOWNLOAD="Download",e.REACT="React",e.UNREACT="Unreact",e.REPORT="Report",e.PIN="Pin",e.UNPIN="Unpin",e.MUTE="Mute",e.UNMUTE="Unmute",e.ADD_EMAIL="AddEmail",e.GRANT_ACCESS="GrantAccess"}(zb||(zb={})),function(e){e.PLAYLIST="Playlist",e.TRACK="Track",e.USER="User",e.USER_REPLICA_SET="UserReplicaSet",e.NOTIFICATION="Notification",e.DEVELOPER_APP="DeveloperApp",e.GRANT="Grant",e.DASHBOARD_WALLET_USER="DashboardWalletUser",e.TIP="Tip",e.COMMENT="Comment",e.ENCRYPTED_EMAIL="EncryptedEmail",e.EMAIL_ACCESS="EmailAccess",e.ASSOCIATED_WALLET="AssociatedWallet",e.COLLECTIBLES="Collectibles",e.EVENT="Event"}(Nb||(Nb={})),function(e){e.CONFIRMED="CONFIRMED",e.DENIED="DENIED",e.UNKNOWN="UNKNOWN"}(jb||(jb={}));for(var $b={},Wb={byteLength:function(e){var t=Yb(e),n=t[0],r=t[1];return 3*(n+r)/4-r},toByteArray:function(e){var t,n,r=Yb(e),i=r[0],o=r[1],s=new Vb(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)t=Kb[e.charCodeAt(n)]<<18|Kb[e.charCodeAt(n+1)]<<12|Kb[e.charCodeAt(n+2)]<<6|Kb[e.charCodeAt(n+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;2===o&&(t=Kb[e.charCodeAt(n)]<<2|Kb[e.charCodeAt(n+1)]>>4,s[a++]=255&t);1===o&&(t=Kb[e.charCodeAt(n)]<<10|Kb[e.charCodeAt(n+1)]<<4|Kb[e.charCodeAt(n+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t);return s},fromByteArray:function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(Jb(e,s,s+o>a?a:s+o));1===r?(t=e[n-1],i.push(Hb[t>>2]+Hb[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(Hb[t>>10]+Hb[t>>4&63]+Hb[t<<2&63]+"="));return i.join("")}},Hb=[],Kb=[],Vb="undefined"!=typeof Uint8Array?Uint8Array:Array,Gb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zb=0;Zb<64;++Zb)Hb[Zb]=Gb[Zb],Kb[Gb.charCodeAt(Zb)]=Zb;function Yb(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function Jb(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(Hb[(i=r)>>18&63]+Hb[i>>12&63]+Hb[i>>6&63]+Hb[63&i]);return o.join("")}Kb["-".charCodeAt(0)]=62,Kb["_".charCodeAt(0)]=63;var Xb={};
13
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function Qb(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function e_(e){if(!((t=e)instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name))throw new Error("Uint8Array expected");for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(r.length>0&&!r.includes(e.length))throw new Error("Uint8Array expected of length "+r+", got length="+e.length)}function t_(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function n_(e,t){e_(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}Xb.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,d=-7,l=n?i-1:0,h=n?-1:1,f=e[t+l];for(l+=h,o=f&(1<<-d)-1,f>>=-d,d+=a;d>0;o=256*o+e[t+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+e[t+l],l+=h,d-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=c}return(f?-1:1)*s*Math.pow(2,o-r)},Xb.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,d=(1<<c)-1,l=d>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+f]=255&s,f+=p,s/=256,c-=8);e[n+f-p]|=128*g},
14
- /*!
15
- * The buffer module from node.js, for the browser.
16
- *
17
- * @author Feross Aboukhadijeh <https://feross.org>
18
- * @license MIT
19
- */
20
- function(e){const t=Wb,n=Xb,r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let r=o(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return l(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return l(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return s.from(r,t,n);const i=function(e){if(s.isBuffer(e)){const t=0|h(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||G(e.length)?o(0):d(e);if("Buffer"===e.type&&Array.isArray(e.data))return d(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),o(e<0?0:0|h(e))}function d(e){const t=e.length<0?0:0|h(e.length),n=o(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function l(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function h(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(i)return r?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return S(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){let o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function w(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(t.substr(2*s,2),16);if(G(r))return s;e[n+s]=r}return s}function v(e,t,n,r){return K(W(t,e.length-n),e,n,r)}function b(e,t,n,r){return K(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return K(H(t),e,n,r)}function A(e,t,n,r){return K(function(e,t){let n,r,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function E(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(u=(31&t)<<6|63&n,u>127&&(o=u));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(u=(15&t)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(u=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,n){return a(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,n){return function(e,t,n){return u(e),e<=0?o(e):void 0!==t?"string"==typeof n?o(e).fill(t,n):o(e).fill(t):o(e)}(e,t,n)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(V(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=s.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(V(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?k(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(V(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const u=Math.min(o,a),c=this.slice(r,i),d=e.slice(t,n);for(let e=0;e<u;++e)if(c[e]!==d[e]){o=c[e],a=d[e];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},s.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},s.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return b(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function S(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=Z[e[r]];return i}function B(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function T(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function D(e,t,n,r,i){z(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function P(e,t,n,r,i){z(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function U(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(e,t,r,i,o){return t=+t,r>>>=0,o||U(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function F(e,t,r,i,o){return t=+t,r>>>=0,o||U(e,0,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=Y((function(e){N(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Y((function(e){N(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=Y((function(e){N(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),s.prototype.readBigInt64BE=Y((function(e){N(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){R(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=Y((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Y((function(e){return P(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);R(this,e,t,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=Y((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Y((function(e){return P(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const o=s.isBuffer(e)?e:s.from(e,r),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%a]}return this};const M={};function L(e,t,n){M[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function q(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new M.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){N(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||j(t,e.length-(n+1))}(r,i,o)}function N(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function j(e,t,n){if(Math.floor(e)!==e)throw N(e,n),new M.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}L("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),L("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),L("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=q(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=q(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const $=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function G(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Y(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}}($b);const r_="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,i_=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),o_=(e,t)=>e<<32-t|e>>>t,s_=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();
21
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function a_(e){for(let n=0;n<e.length;n++)e[n]=(t=e[n])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function u_(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),e_(e),e}class c_{clone(){return this._cloneInto()}}function d_(e){const t=t=>e().update(u_(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function l_(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(r_&&"function"==typeof r_.getRandomValues)return r_.getRandomValues(new Uint8Array(e));if(r_&&"function"==typeof r_.randomBytes)return r_.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const h_=(e,t,n)=>e&t^e&n^t&n;class f_ extends c_{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=i_(this.buffer)}update(e){t_(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=u_(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=i_(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){t_(this),n_(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=i_(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,c[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}}const p_=BigInt(2**32-1),g_=BigInt(32);function m_(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&p_),l:Number(e>>g_&p_)}:{h:0|Number(e>>g_&p_),l:0|Number(e&p_)}}function y_(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=m_(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]}const w_=(e,t,n)=>e<<n|t>>>32-n,v_=(e,t,n)=>t<<n|e>>>32-n,b_=(e,t,n)=>t<<n-32|e>>>64-n,__=(e,t,n)=>e<<n-32|t>>>64-n;const A_={fromBig:m_,split:y_,toBig:(e,t)=>BigInt(e>>>0)<<g_|BigInt(t>>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:w_,rotlSL:v_,rotlBH:b_,rotlBL:__,add:function(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[E_,k_]=(()=>A_.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),I_=new Uint32Array(80),S_=new Uint32Array(80);class C_ extends f_{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:u,El:c,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,s,a,u,c,d,l,h,f,p,g]}set(e,t,n,r,i,o,s,a,u,c,d,l,h,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let n=0;n<16;n++,t+=4)I_[n]=e.getUint32(t),S_[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|I_[e-15],n=0|S_[e-15],r=A_.rotrSH(t,n,1)^A_.rotrSH(t,n,8)^A_.shrSH(t,n,7),i=A_.rotrSL(t,n,1)^A_.rotrSL(t,n,8)^A_.shrSL(t,n,7),o=0|I_[e-2],s=0|S_[e-2],a=A_.rotrSH(o,s,19)^A_.rotrBH(o,s,61)^A_.shrSH(o,s,6),u=A_.rotrSL(o,s,19)^A_.rotrBL(o,s,61)^A_.shrSL(o,s,6),c=A_.add4L(i,u,S_[e-7],S_[e-16]),d=A_.add4H(c,r,a,I_[e-7],I_[e-16]);I_[e]=0|d,S_[e]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:u,Dl:c,Eh:d,El:l,Fh:h,Fl:f,Gh:p,Gl:g,Hh:m,Hl:y}=this;for(let e=0;e<80;e++){const t=A_.rotrSH(d,l,14)^A_.rotrSH(d,l,18)^A_.rotrBH(d,l,41),w=A_.rotrSL(d,l,14)^A_.rotrSL(d,l,18)^A_.rotrBL(d,l,41),v=d&h^~d&p,b=l&f^~l&g,_=A_.add5L(y,w,b,k_[e],S_[e]),A=A_.add5H(_,m,t,v,E_[e],I_[e]),E=0|_,k=A_.rotrSH(n,r,28)^A_.rotrBH(n,r,34)^A_.rotrBH(n,r,39),I=A_.rotrSL(n,r,28)^A_.rotrBL(n,r,34)^A_.rotrBL(n,r,39),S=n&i^n&s^i&s,C=r&o^r&a^o&a;m=0|p,y=0|g,p=0|h,g=0|f,h=0|d,f=0|l,({h:d,l:l}=A_.add(0|u,0|c,0|A,0|E)),u=0|s,c=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const x=A_.add3L(E,I,C);n=A_.add3H(x,A,k,S),r=0|x}({h:n,l:r}=A_.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=A_.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=A_.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:u,l:c}=A_.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l:l}=A_.add(0|this.Eh,0|this.El,0|d,0|l)),({h:h,l:f}=A_.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:g}=A_.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:y}=A_.add(0|this.Hh,0|this.Hl,0|m,0|y)),this.set(n,r,i,o,s,a,u,c,d,l,h,f,p,g,m,y)}roundClean(){I_.fill(0),S_.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const x_=d_((()=>new C_)),B_=BigInt(0),T_=BigInt(1),R_=BigInt(2);
22
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function D_(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function P_(e){if(!D_(e))throw new Error("Uint8Array expected")}function U_(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}const O_=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function F_(e){P_(e);let t="";for(let n=0;n<e.length;n++)t+=O_[e[n]];return t}function M_(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function L_(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?B_:BigInt("0x"+e)}const q_={_0:48,_9:57,A:65,F:70,a:97,f:102};function z_(e){return e>=q_._0&&e<=q_._9?e-q_._0:e>=q_.A&&e<=q_.F?e-(q_.A-10):e>=q_.a&&e<=q_.f?e-(q_.a-10):void 0}function N_(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){const n=z_(e.charCodeAt(i)),o=z_(e.charCodeAt(i+1));if(void 0===n||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}r[t]=16*n+o}return r}function j_(e){return L_(F_(e))}function $_(e){return P_(e),L_(F_(Uint8Array.from(e).reverse()))}function W_(e,t){return N_(e.toString(16).padStart(2*t,"0"))}function H_(e,t){return W_(e,t).reverse()}function K_(e,t,n){let r;if("string"==typeof t)try{r=N_(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!D_(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function V_(){let e=0;for(let t=0;t<arguments.length;t++){const n=t<0||arguments.length<=t?void 0:arguments[t];P_(n),e+=n.length}const t=new Uint8Array(e);for(let e=0,n=0;e<arguments.length;e++){const r=e<0||arguments.length<=e?void 0:arguments[e];t.set(r,n),n+=r.length}return t}const G_=e=>"bigint"==typeof e&&B_<=e;function Z_(e,t,n){return G_(e)&&G_(t)&&G_(n)&&t<=e&&e<n}function Y_(e,t,n,r){if(!Z_(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function J_(e){let t;for(t=0;e>B_;e>>=T_,t+=1);return t}const X_=e=>(R_<<BigInt(e-1))-T_,Q_=e=>new Uint8Array(e),eA=e=>Uint8Array.from(e);function tA(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Q_(e),i=Q_(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return n(i,r,...t)},u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q_();i=a(eA([0]),e),r=a(),0!==e.length&&(i=a(eA([1]),e),r=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return V_(...n)};return(e,t)=>{let n;for(s(),u(e);!(n=t(c()));)u();return s(),n}}const nA={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||D_(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function rA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(t,n,r)=>{const i=nA[n];if("function"!=typeof i)throw new Error("invalid validator function");const o=e[t];if(!(r&&void 0===o||i(o,e)))throw new Error("param "+String(t)+" is invalid. Expected "+n+", got "+o)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}function iA(e){const t=new WeakMap;return function(n){const r=t.get(n);if(void 0!==r)return r;for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];const a=e(n,...o);return t.set(n,a),a}}var oA=Object.freeze({__proto__:null,isBytes:D_,abytes:P_,abool:U_,bytesToHex:F_,numberToHexUnpadded:M_,hexToNumber:L_,hexToBytes:N_,bytesToNumberBE:j_,bytesToNumberLE:$_,numberToBytesBE:W_,numberToBytesLE:H_,numberToVarBytesBE:function(e){return N_(M_(e))},ensureBytes:K_,concatBytes:V_,equalBytes:function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},utf8ToBytes:function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))},inRange:Z_,aInRange:Y_,bitLen:J_,bitGet:function(e,t){return e>>BigInt(t)&T_},bitSet:function(e,t,n){return e|(n?T_:B_)<<BigInt(t)},bitMask:X_,createHmacDrbg:tA,validateObject:rA,notImplemented:()=>{throw new Error("not implemented")},memoized:iA});const sA=BigInt(0),aA=BigInt(1),uA=BigInt(2),cA=BigInt(3),dA=BigInt(4),lA=BigInt(5),hA=BigInt(8);function fA(e,t){const n=e%t;return n>=sA?n:t+n}function pA(e,t,n){if(t<sA)throw new Error("invalid exponent, negatives unsupported");if(n<=sA)throw new Error("invalid modulus");if(n===aA)return sA;let r=aA;for(;t>sA;)t&aA&&(r=r*e%n),e=e*e%n,t>>=aA;return r}function gA(e,t,n){let r=e;for(;t-- >sA;)r*=r,r%=n;return r}function mA(e,t){if(e===sA)throw new Error("invert: expected non-zero number");if(t<=sA)throw new Error("invert: expected positive modulus, got "+t);let n=fA(e,t),r=t,i=sA,o=aA;for(;n!==sA;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==aA)throw new Error("invert: does not exist");return fA(i,t)}function yA(e){if(e%dA===cA){const t=(e+aA)/dA;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%hA===lA){const t=(e-lA)/hA;return function(e,n){const r=e.mul(n,uA),i=e.pow(r,t),o=e.mul(n,i),s=e.mul(e.mul(o,uA),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-aA)/uA;let n,r,i;for(n=e-aA,r=0;n%uA===sA;n/=uA,r++);for(i=uA;i<e&&pA(i,t,e)!==e-aA;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const t=(e+aA)/dA;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const o=(n+aA)/uA;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,u=e.pow(e.mul(e.ONE,i),n),c=e.pow(s,o),d=e.pow(s,n);for(;!e.eql(d,e.ONE);){if(e.eql(d,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(d);t<a&&!e.eql(n,e.ONE);t++)n=e.sqr(n);const n=e.pow(u,aA<<BigInt(a-t-1));u=e.sqr(n),c=e.mul(c,n),d=e.mul(d,u),a=t}return c}}(e)}const wA=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vA(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function bA(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=sA)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:o}=vA(e,t);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:o,MASK:X_(i),ZERO:sA,ONE:aA,create:t=>fA(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return sA<=t&&t<e},is0:e=>e===sA,isOdd:e=>(e&aA)===aA,neg:t=>fA(-t,e),eql:(e,t)=>e===t,sqr:t=>fA(t*t,e),add:(t,n)=>fA(t+n,e),sub:(t,n)=>fA(t-n,e),mul:(t,n)=>fA(t*n,e),pow:(e,t)=>function(e,t,n){if(n<sA)throw new Error("invalid exponent, negatives unsupported");if(n===sA)return e.ONE;if(n===aA)return t;let r=e.ONE,i=t;for(;n>sA;)n&aA&&(r=e.mul(r,i)),i=e.sqr(i),n>>=aA;return r}(a,e,t),div:(t,n)=>fA(t*mA(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>mA(t,e),sqrt:r.sqrt||(t=>(s||(s=yA(e)),s(a,t))),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?H_(e,o):W_(e,o),fromBytes:e=>{if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return n?$_(e):j_(e)}});return Object.freeze(a)}function _A(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function AA(e){const t=_A(e);return t+Math.ceil(t/2)}const EA=BigInt(0),kA=BigInt(1);function IA(e,t){const n=t.negate();return e?n:t}function SA(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function CA(e,t){SA(e,t);return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}const xA=new WeakMap,BA=new WeakMap;function TA(e){return BA.get(e)||1}function RA(e,t){return{constTimeNegate:IA,hasPrecomputes:e=>1!==TA(e),unsafeLadder(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.ZERO,i=t;for(;n>EA;)n&kA&&(r=r.add(i)),i=i.double(),n>>=kA;return r},precomputeWindow(e,n){const{windows:r,windowSize:i}=CA(n,t),o=[];let s=e,a=s;for(let e=0;e<r;e++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(n,r,i){const{windows:o,windowSize:s}=CA(n,t);let a=e.ZERO,u=e.BASE;const c=BigInt(2**n-1),d=2**n,l=BigInt(n);for(let e=0;e<o;e++){const t=e*s;let n=Number(i&c);i>>=l,n>s&&(n-=d,i+=kA);const o=t,h=t+Math.abs(n)-1,f=e%2!=0,p=n<0;0===n?u=u.add(IA(f,r[o])):a=a.add(IA(p,r[h]))}return{p:a,f:u}},wNAFUnsafe(n,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.ZERO;const{windows:s,windowSize:a}=CA(n,t),u=BigInt(2**n-1),c=2**n,d=BigInt(n);for(let e=0;e<s;e++){const t=e*a;if(i===EA)break;let n=Number(i&u);if(i>>=d,n>a&&(n-=c,i+=kA),0===n)continue;let s=r[t+Math.abs(n)-1];n<0&&(s=s.negate()),o=o.add(s)}return o},getPrecomputes(e,t,n){let r=xA.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&xA.set(t,n(r))),r},wNAFCached(e,t,n){const r=TA(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const i=TA(e);return 1===i?this.unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)},setWindowSize(e,n){SA(n,t),BA.set(e,n),xA.delete(e)}}}function DA(e,t,n,r){if(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)}))}(n,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)}))}(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,o=J_(BigInt(n.length)),s=o>12?o-3:o>4?o-2:o?2:1,a=(1<<s)-1,u=new Array(a+1).fill(i);let c=i;for(let e=Math.floor((t.BITS-1)/s)*s;e>=0;e-=s){u.fill(i);for(let t=0;t<r.length;t++){const i=r[t],o=Number(i>>BigInt(e)&BigInt(a));u[o]=u[o].add(n[t])}let t=i;for(let e=u.length-1,n=i;e>0;e--)n=n.add(u[e]),t=t.add(n);if(c=c.add(t),0!==e)for(let e=0;e<s;e++)c=c.double()}return c}function PA(e){return rA(e.Fp,wA.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),rA(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vA(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const UA=BigInt(0),OA=BigInt(1),FA=BigInt(2),MA=BigInt(8),LA={zip215:!0};function qA(e){const t=function(e){const t=PA(e);return rA(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:u}=t,c=FA<<BigInt(8*a)-OA,d=n.create,l=bA(t.n,t.nBitLength),h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:UA}}}),f=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,n)=>{if(U_("phflag",n),t.length||n)throw new Error("Contexts/pre-hash are not supported");return e});function g(e,t){Y_("coordinate "+e,t,UA,c)}function m(e){if(!(e instanceof v))throw new Error("ExtendedPoint expected")}const y=iA(((e,t)=>{const{ex:r,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?MA:n.inv(o));const a=d(r*t),u=d(i*t),c=d(o*t);if(s)return{x:UA,y:OA};if(c!==OA)throw new Error("invZ was invalid");return{x:a,y:u}})),w=iA((e=>{const{a:n,d:r}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:i,ey:o,ez:s,et:a}=e,u=d(i*i),c=d(o*o),l=d(s*s),h=d(l*l),f=d(u*n);if(d(l*d(f+c))!==d(h+d(r*d(u*c))))throw new Error("bad point: equation left != right (1)");if(d(i*o)!==d(s*a))throw new Error("bad point: equation left != right (2)");return!0}));class v{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,g("x",e),g("y",t),g("z",n),g("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof v)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};return g("x",t),g("y",n),new v(t,n,OA,d(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(v.fromAffine)}static msm(e,t){return DA(v,l,e,t)}_setWindowSize(e){A.setWindowSize(this,e)}assertValidity(){w(this)}equals(e){m(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=e,a=d(t*s),u=d(i*r),c=d(n*s),l=d(o*r);return a===u&&c===l}is0(){return this.equals(v.ZERO)}negate(){return new v(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=d(n*n),s=d(r*r),a=d(FA*d(i*i)),u=d(e*o),c=n+r,l=d(d(c*c)-o-s),h=u+s,f=h-a,p=u-s,g=d(l*f),m=d(h*p),y=d(l*p),w=d(f*h);return new v(g,m,w,y)}add(e){m(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:u,ey:c,ez:l,et:h}=e;if(n===BigInt(-1)){const e=d((o-i)*(c+u)),t=d((o+i)*(c-u)),n=d(t-e);if(n===UA)return this.double();const r=d(s*FA*h),f=d(a*FA*l),p=f+r,g=t+e,m=f-r,y=d(p*n),w=d(g*m),b=d(p*m),_=d(n*g);return new v(y,w,_,b)}const f=d(i*u),p=d(o*c),g=d(a*r*h),y=d(s*l),w=d((i+o)*(u+c)-f-p),b=y-g,_=y+g,A=d(p-n*f),E=d(w*b),k=d(_*A),I=d(w*A),S=d(b*_);return new v(E,k,S,I)}subtract(e){return this.add(e.negate())}wNAF(e){return A.wNAFCached(this,e,v.normalizeZ)}multiply(e){const t=e;Y_("scalar",t,OA,r);const{p:n,f:i}=this.wNAF(t);return v.normalizeZ([n,i])[0]}multiplyUnsafe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v.ZERO;const n=e;return Y_("scalar",n,UA,r),n===UA?_:this.is0()||n===OA?this:A.wNAFCachedUnsafe(this,n,v.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(e){return y(this,e)}clearCofactor(){const{h:e}=t;return e===OA?this:this.multiplyUnsafe(e)}static fromHex(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{d:i,a:o}=t,s=n.BYTES;e=K_("pointHex",e,s),U_("zip215",r);const a=e.slice(),u=e[s-1];a[s-1]=-129&u;const l=$_(a),f=r?c:n.ORDER;Y_("pointHex.y",l,UA,f);const p=d(l*l),g=d(p-OA),m=d(i*p-o);let{isValid:y,value:w}=h(g,m);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const b=(w&OA)===OA,_=0!=(128&u);if(!r&&w===UA&&_)throw new Error("Point.fromHex: x=0 and x_0=1");return _!==b&&(w=d(-w)),v.fromAffine({x:w,y:l})}static fromPrivateKey(e){return I(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=H_(t,n.BYTES);return r[r.length-1]|=e&OA?128:0,r}toHex(){return F_(this.toRawBytes())}}v.BASE=new v(t.Gx,t.Gy,OA,d(t.Gx*t.Gy)),v.ZERO=new v(UA,OA,OA,UA);const{BASE:b,ZERO:_}=v,A=RA(v,8*a);function E(e){return fA(e,r)}function k(e){return E($_(e))}function I(e){const t=n.BYTES;e=K_("private key",e,t);const r=K_("hashed private key",o(e),2*t),i=f(r.slice(0,t)),s=r.slice(t,2*t),a=k(i),u=b.multiply(a),c=u.toRawBytes();return{head:i,prefix:s,scalar:a,point:u,pointBytes:c}}function S(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const s=V_(...n);return k(o(p(s,K_("context",e),!!i)))}const C=LA;b._setWindowSize(8);const x={getExtendedPublicKey:I,randomPrivateKey:()=>s(n.BYTES),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}};return{CURVE:t,getPublicKey:function(e){return I(e).pointBytes},sign:function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e=K_("message",e),i&&(e=i(e));const{prefix:s,scalar:a,pointBytes:u}=I(t),c=S(o.context,s,e),d=b.multiply(c).toRawBytes(),l=E(c+S(o.context,d,u,e)*a);return Y_("signature.s",l,UA,r),K_("result",V_(d,H_(l,n.BYTES)),2*n.BYTES)},verify:function(e,t,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:C;const{context:s,zip215:a}=o,u=n.BYTES;e=K_("signature",e,2*u),t=K_("message",t),r=K_("publicKey",r,u),void 0!==a&&U_("zip215",a),i&&(t=i(t));const c=$_(e.slice(u,2*u));let d,l,h;try{d=v.fromHex(r,a),l=v.fromHex(e.slice(0,u),a),h=b.multiplyUnsafe(c)}catch(e){return!1}if(!a&&d.isSmallOrder())return!1;const f=S(s,l.toRawBytes(),d.toRawBytes(),t);return l.add(d.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:x}}const zA=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),NA=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const jA=BigInt(1),$A=BigInt(2);BigInt(3);const WA=BigInt(5),HA=BigInt(8);function KA(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function VA(e,t){const n=zA,r=fA(t*t*t,n),i=function(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=zA,s=e*e%o*e%o,a=gA(s,$A,o)*s%o,u=gA(a,jA,o)*e%o,c=gA(u,WA,o)*u%o,d=gA(c,t,o)*c%o,l=gA(d,n,o)*d%o,h=gA(l,r,o)*l%o,f=gA(h,i,o)*h%o,p=gA(f,i,o)*h%o,g=gA(p,t,o)*c%o;return{pow_p_5_8:gA(g,$A,o)*e%o,b2:s}}(e*fA(r*r*t,n)).pow_p_5_8;let o=fA(e*r*i,n);const s=fA(t*o*o,n),a=o,u=fA(o*NA,n),c=s===e,d=s===fA(-e,n),l=s===fA(-e*NA,n);return c&&(o=a),(d||l)&&(o=u),(fA(o,n)&aA)===aA&&(o=fA(-o,n)),{isValid:c||d,value:o}}const GA=(()=>bA(zA,void 0,!0))(),ZA=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:GA,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:HA,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:x_,randomBytes:l_,adjustScalarBytes:KA,uvRatio:VA}))(),YA=(()=>qA(ZA))();var JA={exports:{}};(function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o=require("buffer").Buffer}catch(e){}function s(e,t,r){for(var i=0,o=Math.min(e.length,r),s=0,a=t;a<o;a++){var u,c=e.charCodeAt(a)-48;i<<=4,i|=u=c>=49&&c<=54?c-49+10:c>=17&&c<=22?c-17+10:c,s|=u}return n(!(240&s),"Invalid character in "+e),i}function a(e,t,r,i){for(var o=0,s=0,a=Math.min(e.length,r),u=t;u<a;u++){var c=e.charCodeAt(u)-48;o*=i,s=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&s<i,"Invalid character"),o+=s}return o}function u(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this._strip(),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=e.length-6,r=0;n>=t;n-=6)i=s(e,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=s(e,t,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,u=Math.min(o,o-s)+n,c=0,d=n;d<u;d+=r)c=a(e,d,d+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var l=1;for(c=a(e,d,e.length,t),d=0;d<s;d++)l*=t;this.imuln(l),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){e.words=this.words,e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?i.prototype[Symbol.for("nodejs.util.inspect.custom")]=u:i.prototype.inspect=u;var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c<r;c++){for(var d=u>>>26,l=67108863&u,h=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=h;f++){var p=c-f|0;d+=(s=(i=0|e.words[p])*(o=0|t.words[f])+l)/67108864|0,l=67108863&s}n.words[c]=0|l,u=0|d}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);r=0!=(o=a>>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var h=d[e],f=l[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modrn(f).toString(e);r=(p=p.idivn(f)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|r;e[n++]=255&s,n<e.length&&(e[n++]=s>>8&255),n<e.length&&(e[n++]=s>>16&255),6===o?(n<e.length&&(e[n++]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|r;e[n--]=255&s,n>=0&&(e[n--]=s>>8&255),n>=0&&(e[n--]=s>>16&255),6===o?(n>=0&&(e[n--]=s>>24&255),r=0,o=0):(r=s>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s<r.length;s++)o=(t=(0|n.words[s])-(0|r.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<n.length;s++)o=(t=(0|n.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var f=function(e,t,n){var r,i,o,s=e.words,a=t.words,u=n.words,c=0,d=0|s[0],l=8191&d,h=d>>>13,f=0|s[1],p=8191&f,g=f>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,A=0|s[4],E=8191&A,k=A>>>13,I=0|s[5],S=8191&I,C=I>>>13,x=0|s[6],B=8191&x,T=x>>>13,R=0|s[7],D=8191&R,P=R>>>13,U=0|s[8],O=8191&U,F=U>>>13,M=0|s[9],L=8191&M,q=M>>>13,z=0|a[0],N=8191&z,j=z>>>13,$=0|a[1],W=8191&$,H=$>>>13,K=0|a[2],V=8191&K,G=K>>>13,Z=0|a[3],Y=8191&Z,J=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,de=0|a[8],le=8191&de,he=de>>>13,fe=0|a[9],pe=8191&fe,ge=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(l,N))|0)+((8191&(i=(i=Math.imul(l,j))+Math.imul(h,N)|0))<<13)|0;c=((o=Math.imul(h,j))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,N),i=(i=Math.imul(p,j))+Math.imul(g,N)|0,o=Math.imul(g,j);var ye=(c+(r=r+Math.imul(l,W)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(h,W)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(y,N),i=(i=Math.imul(y,j))+Math.imul(w,N)|0,o=Math.imul(w,j),r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(g,W)|0,o=o+Math.imul(g,H)|0;var we=(c+(r=r+Math.imul(l,V)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(h,V)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(b,N),i=(i=Math.imul(b,j))+Math.imul(_,N)|0,o=Math.imul(_,j),r=r+Math.imul(y,W)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,H)|0,r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,G)|0;var ve=(c+(r=r+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(E,N),i=(i=Math.imul(E,j))+Math.imul(k,N)|0,o=Math.imul(k,j),r=r+Math.imul(b,W)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,H)|0,r=r+Math.imul(y,V)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,G)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0;var be=(c+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(S,N),i=(i=Math.imul(S,j))+Math.imul(C,N)|0,o=Math.imul(C,j),r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(b,V)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,G)|0,r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,J)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Q)|0,o=o+Math.imul(g,ee)|0;var _e=(c+(r=r+Math.imul(l,ne)|0)|0)+((8191&(i=(i=i+Math.imul(l,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(B,N),i=(i=Math.imul(B,j))+Math.imul(T,N)|0,o=Math.imul(T,j),r=r+Math.imul(S,W)|0,i=(i=i+Math.imul(S,H)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,G)|0,r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0;var Ae=(c+(r=r+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,se)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,se)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,N),i=(i=Math.imul(D,j))+Math.imul(P,N)|0,o=Math.imul(P,j),r=r+Math.imul(B,W)|0,i=(i=i+Math.imul(B,H)|0)+Math.imul(T,W)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(S,V)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,G)|0,r=r+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,J)|0,r=r+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(y,ne)|0,i=(i=i+Math.imul(y,re)|0)+Math.imul(w,ne)|0,o=o+Math.imul(w,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ee=(c+(r=r+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(O,N),i=(i=Math.imul(O,j))+Math.imul(F,N)|0,o=Math.imul(F,j),r=r+Math.imul(D,W)|0,i=(i=i+Math.imul(D,H)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,H)|0,r=r+Math.imul(B,V)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,J)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,se)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,ce)|0;var ke=(c+(r=r+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(L,N),i=(i=Math.imul(L,j))+Math.imul(q,N)|0,o=Math.imul(q,j),r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(F,W)|0,o=o+Math.imul(F,H)|0,r=r+Math.imul(D,V)|0,i=(i=i+Math.imul(D,G)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,G)|0,r=r+Math.imul(B,Y)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,J)|0,r=r+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,r=r+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(g,le)|0,o=o+Math.imul(g,he)|0;var Ie=(c+(r=r+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ge)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(L,W),i=(i=Math.imul(L,H))+Math.imul(q,W)|0,o=Math.imul(q,H),r=r+Math.imul(O,V)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,G)|0,r=r+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,J)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,J)|0,r=r+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(y,le)|0,i=(i=i+Math.imul(y,he)|0)+Math.imul(w,le)|0,o=o+Math.imul(w,he)|0;var Se=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(L,V),i=(i=Math.imul(L,G))+Math.imul(q,V)|0,o=Math.imul(q,G),r=r+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(F,Y)|0,o=o+Math.imul(F,J)|0,r=r+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(T,ne)|0,o=o+Math.imul(T,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(b,le)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(_,le)|0,o=o+Math.imul(_,he)|0;var Ce=(c+(r=r+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(L,Y),i=(i=Math.imul(L,J))+Math.imul(q,Y)|0,o=Math.imul(q,J),r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,r=r+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(k,le)|0,o=o+Math.imul(k,he)|0;var xe=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,ee))+Math.imul(q,Q)|0,o=Math.imul(q,ee),r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(F,ne)|0,o=o+Math.imul(F,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,se)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,se)|0,r=r+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(T,ue)|0,o=o+Math.imul(T,ce)|0,r=r+Math.imul(S,le)|0,i=(i=i+Math.imul(S,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Be=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ge)|0)+Math.imul(k,pe)|0))<<13)|0;c=((o=o+Math.imul(k,ge)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,r=Math.imul(L,ne),i=(i=Math.imul(L,re))+Math.imul(q,ne)|0,o=Math.imul(q,re),r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,se)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(B,le)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(T,le)|0,o=o+Math.imul(T,he)|0;var Te=(c+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ge)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(L,oe),i=(i=Math.imul(L,se))+Math.imul(q,oe)|0,o=Math.imul(q,se),r=r+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(F,ue)|0,o=o+Math.imul(F,ce)|0,r=r+Math.imul(D,le)|0,i=(i=i+Math.imul(D,he)|0)+Math.imul(P,le)|0,o=o+Math.imul(P,he)|0;var Re=(c+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(T,pe)|0))<<13)|0;c=((o=o+Math.imul(T,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(L,ue),i=(i=Math.imul(L,ce))+Math.imul(q,ue)|0,o=Math.imul(q,ce),r=r+Math.imul(O,le)|0,i=(i=i+Math.imul(O,he)|0)+Math.imul(F,le)|0,o=o+Math.imul(F,he)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ge)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ge)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(L,le),i=(i=Math.imul(L,he))+Math.imul(q,le)|0,o=Math.imul(q,he);var Pe=(c+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(F,pe)|0))<<13)|0;c=((o=o+Math.imul(F,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ue=(c+(r=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,ge))+Math.imul(q,pe)|0))<<13)|0;return c=((o=Math.imul(q,ge))+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,u[0]=me,u[1]=ye,u[2]=we,u[3]=ve,u[4]=be,u[5]=_e,u[6]=Ae,u[7]=Ee,u[8]=ke,u[9]=Ie,u[10]=Se,u[11]=Ce,u[12]=xe,u[13]=Be,u[14]=Te,u[15]=Re,u[16]=De,u[17]=Pe,u[18]=Ue,0!==c&&(u[19]=c,n.length++),n};function p(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var s=i;i=0;for(var a=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var d=o-c,l=(0|e.words[d])*(0|t.words[c]),h=67108863&l;a=67108863&(h=h+a|0),i+=(s=(s=s+(l/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return p(e,t,n)}Math.imul||(f=h),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?f(this,e,t):n<63?h(this,e,t):n<1024?p(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<r;this.words[t]=u|s,s=a>>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var d=0;for(c=this.length-1;c>=0&&(0!==d||c>=i);c--){var l=0|this.words[c];this.words[c]=d<<26-o|l>>>o,d=l&a}return u&&0!==d&&(u.words[u.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,s=e.length+r;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)a=(o=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,s=0|o.words[o.length-1];0!=(n=26-this._countBits(s))&&(o=o.ushln(n),r.iushln(n),s=0|o.words[o.length-1]);var a,u=r.length-o.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var d=r.clone()._ishlnsubmul(o,1,u);0===d.negative&&(r=d,a&&(a.words[u]=1));for(var l=u-1;l>=0;l--){var h=67108864*(0|r.words[o.length+l])+(0|r.words[o.length+l-1]);for(h=Math.min(h/s|0,67108863),r._ishlnsubmul(o,h,l);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(o,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=h)}return a&&a._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,s,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var d=r.clone(),l=t.clone();!t.isZero();){for(var h=0,f=1;0==(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(l)),o.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(l)),a.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a),s.isub(u)):(r.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,d=1;0==(t.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new A(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n._strip(),n},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},r(w,y),w.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&n)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(v,y),r(b,y),r(_,y),_.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new v;else if("p192"===e)t=new b;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return m[e]=t,t},A.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(e.umod(this.m)._forceRed(this)._move(e),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},A.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);n(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new i(2*d*d).toRed(this);0!==this.pow(d,c).cmp(u);)d.redIAdd(u);for(var l=this.pow(d,o),h=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=s;0!==f.cmp(a);){for(var g=f,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m<p);var y=this.pow(l,new i(1).iushln(p-m-1));h=h.redMul(y),l=y.redSqr(),f=f.redMul(l),p=m}return h},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],d=u-1;d>=0;d--){var l=c>>d&1;o!==n[0]&&(o=this.sqr(o)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===r&&0===d)&&(o=this.mul(o,n[s]),a=0,s=0)):a=0}u=26}return o},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,A),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(JA,i);var XA=JA.exports,QA={exports:{}};
23
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
24
- !function(e,t){var n=$b,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),i(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(QA,QA.exports);var eE=QA.exports.Buffer;var tE=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var i=e.charAt(r),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=r}var s=e.length,a=e.charAt(0),u=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return eE.alloc(0);for(var n=0,r=0,i=0;e[n]===a;)r++,n++;for(var o=(e.length-n)*u+1>>>0,c=new Uint8Array(o);e[n];){var d=t[e.charCodeAt(n)];if(255===d)return;for(var l=0,h=o-1;(0!==d||l<i)&&-1!==h;h--,l++)d+=s*c[h]>>>0,c[h]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");i=l,n++}for(var f=o-i;f!==o&&0===c[f];)f++;var p=eE.allocUnsafe(r+(o-f));p.fill(0,0,r);for(var g=r;f!==o;)p[g++]=c[f++];return p}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=eE.from(t)),!eE.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var u=(o-i)*c+1>>>0,d=new Uint8Array(u);i!==o;){for(var l=t[i],h=0,f=u-1;(0!==l||h<r)&&-1!==f;f--,h++)l+=256*d[f]>>>0,d[f]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");r=h,i++}for(var p=u-r;p!==u&&0===d[p];)p++;for(var g=a.repeat(n);p<u;++p)g+=e.charAt(d[p]);return g},decodeUnsafe:d,decode:function(e){var t=d(e);if(t)return t;throw new Error("Non-base"+s+" character")}}},nE=tE("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");const rE=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),iE=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oE=new Uint32Array(64);class sE extends f_{constructor(){super(64,32,8,!1),this.A=0|iE[0],this.B=0|iE[1],this.C=0|iE[2],this.D=0|iE[3],this.E=0|iE[4],this.F=0|iE[5],this.G=0|iE[6],this.H=0|iE[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)oE[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=oE[e-15],n=oE[e-2],r=o_(t,7)^o_(t,18)^t>>>3,i=o_(n,17)^o_(n,19)^n>>>10;oE[e]=i+oE[e-7]+r+oE[e-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let e=0;e<64;e++){const t=c+(o_(s,6)^o_(s,11)^o_(s,25))+((d=s)&a^~d&u)+rE[e]+oE[e]|0,l=(o_(n,2)^o_(n,13)^o_(n,22))+h_(n,r,i)|0;c=u,u=a,a=s,s=o+t|0,o=i,i=r,r=n,n=t+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){oE.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const aE=d_((()=>new sE));var uE={},cE={};function dE(e,t,n){return t<=e&&e<=n}function lE(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function hE(e){this.tokens=[].slice.call(e)}hE.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var fE=-1;function pE(e,t){if(e)throw TypeError("Decoder error");return t||65533}var gE="utf-8";function mE(e,t){if(!(this instanceof mE))return new mE(e,t);if((e=void 0!==e?String(e).toLowerCase():gE)!==gE)throw new Error("Encoding not supported. Only utf-8 is supported");t=lE(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(t.fatal),this._ignoreBOM=Boolean(t.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function yE(e,t){if(!(this instanceof yE))return new yE(e,t);if((e=void 0!==e?String(e).toLowerCase():gE)!==gE)throw new Error("Encoding not supported. Only utf-8 is supported");t=lE(t),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(t.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function wE(e){var t=e.fatal,n=0,r=0,i=0,o=128,s=191;this.handler=function(e,a){if(-1===a&&0!==i)return i=0,pE(t);if(-1===a)return fE;if(0===i){if(dE(a,0,127))return a;if(dE(a,194,223))i=1,n=a-192;else if(dE(a,224,239))224===a&&(o=160),237===a&&(s=159),i=2,n=a-224;else{if(!dE(a,240,244))return pE(t);240===a&&(o=144),244===a&&(s=143),i=3,n=a-240}return n<<=6*i,null}if(!dE(a,o,s))return n=i=r=0,o=128,s=191,e.prepend(a),pE(t);if(o=128,s=191,n+=a-128<<6*(i-(r+=1)),r!==i)return null;var u=n;return n=i=r=0,u}}function vE(e){e.fatal,this.handler=function(e,t){if(-1===t)return fE;if(dE(t,0,127))return t;var n,r;dE(t,128,2047)?(n=1,r=192):dE(t,2048,65535)?(n=2,r=224):dE(t,65536,1114111)&&(n=3,r=240);for(var i=[(t>>6*n)+r];n>0;){var o=t>>6*(n-1);i.push(128|63&o),n-=1}return i}}mE.prototype={decode:function(e,t){var n;n="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=lE(t),this._streaming||(this._decoder=new wE({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var r,i=new hE(n),o=[];!i.endOfStream()&&(r=this._decoder.handler(i,i.read()))!==fE;)null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r));if(!this._streaming){do{if((r=this._decoder.handler(i,i.read()))===fE)break;null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(e){for(var t="",n=0;n<e.length;++n){var r=e[n];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode(55296+(r>>10),56320+(1023&r)))}return t}(o)}},yE.prototype={encode:function(e,t){e=e?String(e):"",t=lE(t),this._streaming||(this._encoder=new vE(this._options)),this._streaming=Boolean(t.stream);for(var n,r=[],i=new hE(function(e){for(var t=String(e),n=t.length,r=0,i=[];r<n;){var o=t.charCodeAt(r);if(o<55296||o>57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(r===n-1)i.push(65533);else{var s=e.charCodeAt(r+1);if(56320<=s&&s<=57343){var a=1023&o,u=1023&s;i.push(65536+(a<<10)+u),r+=1}else i.push(65533)}r+=1}return i}(e));!i.endOfStream()&&(n=this._encoder.handler(i,i.read()))!==fE;)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;(n=this._encoder.handler(i,i.read()))!==fE;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}},cE.TextEncoder=yE,cE.TextDecoder=mE;var bE=i&&i.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),_E=i&&i.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),AE=i&&i.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},EE=i&&i.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&bE(t,e,n);return _E(t,e),t},kE=i&&i.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uE,"__esModule",{value:!0});var IE=uE.deserializeUnchecked=NE=uE.deserialize=LE=uE.serialize=uE.BinaryReader=uE.BinaryWriter=uE.BorshError=uE.baseDecode=uE.baseEncode=void 0;const SE=kE(JA.exports),CE=kE(nE),xE=EE(cE),BE=new("function"!=typeof TextDecoder?xE.TextDecoder:TextDecoder)("utf-8",{fatal:!0});uE.baseEncode=function(e){return"string"==typeof e&&(e=Buffer.from(e,"utf8")),CE.default.encode(Buffer.from(e))},uE.baseDecode=function(e){return Buffer.from(CE.default.decode(e))};const TE=1024;class RE extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}uE.BorshError=RE;class DE{constructor(){this.buf=Buffer.alloc(TE),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(TE)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer.from(new SE.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new SE.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new SE.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new SE.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(TE)]),this.length+=e.length}writeString(e){this.maybeResize();const t=Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),t(n)}toArray(){return this.buf.subarray(0,this.length)}}function PE(e,t,n){const r=n.value;n.value=function(){try{for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}catch(e){if(e instanceof RangeError){const t=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t)>=0)throw new RE("Reached the end of buffer when deserializing")}throw e}}}uE.BinaryWriter=DE;class UE{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new SE.default(e,"le")}readU128(){const e=this.readBuffer(16);return new SE.default(e,"le")}readU256(){const e=this.readBuffer(32);return new SE.default(e,"le")}readU512(){const e=this.readBuffer(64);return new SE.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new RE(`Expected buffer length ${e} isn't within bounds`);const t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){const e=this.readU32(),t=this.readBuffer(e);try{return BE.decode(t)}catch(e){throw new RE(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),n=Array();for(let r=0;r<t;++r)n.push(e());return n}}function OE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function FE(e,t,n,r,i){try{if("string"==typeof r)i[`write${OE(r)}`](n);else if(r instanceof Array)if("number"==typeof r[0]){if(n.length!==r[0])throw new RE(`Expecting byte array of length ${r[0]}, but got ${n.length} bytes`);i.writeFixedArray(n)}else if(2===r.length&&"number"==typeof r[1]){if(n.length!==r[1])throw new RE(`Expecting byte array of length ${r[1]}, but got ${n.length} bytes`);for(let t=0;t<r[1];t++)FE(e,null,n[t],r[0],i)}else i.writeArray(n,(n=>{FE(e,t,n,r[0],i)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?i.writeU8(0):(i.writeU8(1),FE(e,t,n,r.type,i));break;case"map":i.writeU32(n.size),n.forEach(((n,o)=>{FE(e,t,o,r.key,i),FE(e,t,n,r.value,i)}));break;default:throw new RE(`FieldType ${r} unrecognized`)}else ME(e,n,i)}catch(e){throw e instanceof RE&&e.addToFieldPath(t),e}}function ME(e,t,n){if("function"==typeof t.borshSerialize)return void t.borshSerialize(n);const r=e.get(t.constructor);if(!r)throw new RE(`Class ${t.constructor.name} is missing in schema`);if("struct"===r.kind)r.fields.map((r=>{let[i,o]=r;FE(e,i,t[i],o,n)}));else{if("enum"!==r.kind)throw new RE(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`);{const i=t[r.field];for(let o=0;o<r.values.length;++o){const[s,a]=r.values[o];if(s===i){n.writeU8(o),FE(e,s,t[s],a,n);break}}}}}AE([PE],UE.prototype,"readU8",null),AE([PE],UE.prototype,"readU16",null),AE([PE],UE.prototype,"readU32",null),AE([PE],UE.prototype,"readU64",null),AE([PE],UE.prototype,"readU128",null),AE([PE],UE.prototype,"readU256",null),AE([PE],UE.prototype,"readU512",null),AE([PE],UE.prototype,"readString",null),AE([PE],UE.prototype,"readFixedArray",null),AE([PE],UE.prototype,"readArray",null),uE.BinaryReader=UE;var LE=uE.serialize=function(e,t){const n=new(arguments.length>2&&void 0!==arguments[2]?arguments[2]:DE);return ME(e,t,n),n.toArray()};function qE(e,t,n,r){try{if("string"==typeof n)return r[`read${OE(n)}`]();if(n instanceof Array){if("number"==typeof n[0])return r.readFixedArray(n[0]);if("number"==typeof n[1]){const t=[];for(let i=0;i<n[1];i++)t.push(qE(e,null,n[0],r));return t}return r.readArray((()=>qE(e,t,n[0],r)))}if("option"===n.kind){return r.readU8()?qE(e,t,n.type,r):void 0}if("map"===n.kind){let i=new Map;const o=r.readU32();for(let s=0;s<o;s++){const o=qE(e,t,n.key,r),s=qE(e,t,n.value,r);i.set(o,s)}return i}return zE(e,n,r)}catch(e){throw e instanceof RE&&e.addToFieldPath(t),e}}function zE(e,t,n){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(n);const r=e.get(t);if(!r)throw new RE(`Class ${t.name} is missing in schema`);if("struct"===r.kind){const r={};for(const[i,o]of e.get(t).fields)r[i]=qE(e,i,o,n);return new t(r)}if("enum"===r.kind){const i=n.readU8();if(i>=r.values.length)throw new RE(`Enum index: ${i} is out of range`);const[o,s]=r.values[i];return new t({[o]:qE(e,o,s,n)})}throw new RE(`Unexpected schema kind: ${r.kind} for ${t.constructor.name}`)}var NE=uE.deserialize=function(e,t,n){const r=new(arguments.length>3&&void 0!==arguments[3]?arguments[3]:UE)(n),i=zE(e,t,r);if(r.offset<n.length)throw new RE(`Unexpected ${n.length-r.offset} bytes after deserialized data`);return i};IE=uE.deserializeUnchecked=function(e,t,n){return zE(e,t,new(arguments.length>3&&void 0!==arguments[3]?arguments[3]:UE)(n))};var jE={};Object.defineProperty(jE,"__esModule",{value:!0}),jE.s16=jE.s8=jE.nu64be=jE.u48be=jE.u40be=jE.u32be=jE.u24be=jE.u16be=Dk=jE.nu64=jE.u48=jE.u40=Rk=jE.u32=jE.u24=Tk=jE.u16=Bk=jE.u8=xk=jE.offset=jE.greedy=jE.Constant=jE.UTF8=jE.CString=jE.Blob=jE.Boolean=jE.BitField=jE.BitStructure=jE.VariantLayout=jE.Union=jE.UnionLayoutDiscriminator=jE.UnionDiscriminator=jE.Structure=jE.Sequence=jE.DoubleBE=jE.Double=jE.FloatBE=jE.Float=jE.NearInt64BE=jE.NearInt64=jE.NearUInt64BE=jE.NearUInt64=jE.IntBE=jE.Int=jE.UIntBE=jE.UInt=jE.OffsetLayout=jE.GreedyCount=jE.ExternalLayout=jE.bindConstructorLayout=jE.nameWithProperty=jE.Layout=KE=jE.uint8ArrayToBuffer=jE.checkUint8Array=void 0,jE.constant=Mk=jE.utf8=jE.cstr=Fk=jE.blob=jE.unionLayoutDiscriminator=jE.union=Ok=jE.seq=jE.bits=Uk=jE.struct=jE.f64be=jE.f64=jE.f32be=jE.f32=jE.ns64be=jE.s48be=jE.s40be=jE.s32be=jE.s24be=jE.s16be=Pk=jE.ns64=jE.s48=jE.s40=jE.s32=jE.s24=void 0;const $E=$b;function WE(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function HE(e){return WE(e),$E.Buffer.from(e.buffer,e.byteOffset,e.length)}jE.checkUint8Array=WE;var KE=jE.uint8ArrayToBuffer=HE;class VE{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}var GE=jE.Layout=VE;function ZE(e,t){return t.property?e+"["+t.property+"]":e}jE.nameWithProperty=ZE,jE.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof VE))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};class YE extends VE{isCount(){throw new Error("ExternalLayout is abstract")}}jE.ExternalLayout=YE;class JE extends YE{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;WE(e);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}jE.GreedyCount=JE;class XE extends YE{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;if(!(e instanceof VE))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof QE||this.layout instanceof ek}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.decode(e,t+this.offset)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.layout.encode(e,t,n+this.offset)}}jE.OffsetLayout=XE;class QE extends VE{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readUIntLE(t,this.span)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeUIntLE(e,n,this.span),this.span}}jE.UInt=QE;class ek extends VE{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readUIntBE(t,this.span)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeUIntBE(e,n,this.span),this.span}}jE.UIntBE=ek;class tk extends VE{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readIntLE(t,this.span)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeIntLE(e,n,this.span),this.span}}jE.Int=tk;class nk extends VE{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readIntBE(t,this.span)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeIntBE(e,n,this.span),this.span}}jE.IntBE=nk;const rk=Math.pow(2,32);function ik(e){const t=Math.floor(e/rk);return{hi32:t,lo32:e-t*rk}}function ok(e,t){return e*rk+t}class sk extends VE{constructor(e){super(8,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=HE(e),r=n.readUInt32LE(t);return ok(n.readUInt32LE(t+4),r)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ik(e),i=HE(t);return i.writeUInt32LE(r.lo32,n),i.writeUInt32LE(r.hi32,n+4),8}}jE.NearUInt64=sk;class ak extends VE{constructor(e){super(8,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=HE(e);return ok(n.readUInt32BE(t),n.readUInt32BE(t+4))}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ik(e),i=HE(t);return i.writeUInt32BE(r.hi32,n),i.writeUInt32BE(r.lo32,n+4),8}}jE.NearUInt64BE=ak;class uk extends VE{constructor(e){super(8,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=HE(e),r=n.readUInt32LE(t);return ok(n.readInt32LE(t+4),r)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ik(e),i=HE(t);return i.writeUInt32LE(r.lo32,n),i.writeInt32LE(r.hi32,n+4),8}}jE.NearInt64=uk;class ck extends VE{constructor(e){super(8,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=HE(e);return ok(n.readInt32BE(t),n.readUInt32BE(t+4))}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=ik(e),i=HE(t);return i.writeInt32BE(r.hi32,n),i.writeUInt32BE(r.lo32,n+4),8}}jE.NearInt64BE=ck;class dk extends VE{constructor(e){super(4,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readFloatLE(t)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeFloatLE(e,n),4}}jE.Float=dk;class lk extends VE{constructor(e){super(4,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readFloatBE(t)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeFloatBE(e,n),4}}jE.FloatBE=lk;class hk extends VE{constructor(e){super(8,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readDoubleLE(t)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeDoubleLE(e,n),8}}jE.Double=hk;class fk extends VE{constructor(e){super(8,e)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return HE(e).readDoubleBE(t)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return HE(t).writeDoubleBE(e,n),8}}jE.DoubleBE=fk;class pk extends VE{constructor(e,t,n){if(!(e instanceof VE))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof YE&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(t instanceof YE)&&0<e.span&&(r=t*e.span),super(r,n),this.elementLayout=e,this.count=t}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let n=0,r=this.count;if(r instanceof YE&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i}return n}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];let r=0,i=this.count;for(i instanceof YE&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=this.elementLayout,i=e.reduce(((e,i)=>e+r.encode(i,t,n+e)),0);return this.count instanceof YE&&this.count.encode(e.length,t,n),i}}jE.Sequence=pk;class gk extends VE{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof VE),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;WE(e);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0<s?s:0,void 0!==r.property){const i=e[r.property];void 0!==i&&(o=r.encode(i,t,n),0>s&&(s=r.getSpan(t,n)))}i=n,n+=s}return i+o-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}jE.Structure=gk;class mk{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,n){throw new Error("UnionDiscriminator is abstract")}}jE.UnionDiscriminator=mk;class yk extends mk{constructor(e,t){if(!(e instanceof YE&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}jE.UnionLayoutDiscriminator=yk;class wk extends VE{constructor(e,t,n){let r;if(e instanceof QE||e instanceof ek)r=new yk(new XE(e));else if(e instanceof YE&&e.isCount())r=new yk(e);else{if(!(e instanceof mk))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");r=e}if(void 0===t&&(t=null),!(null===t||t instanceof VE))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&(i=t.span,0<=i&&(e instanceof QE||e instanceof ek)&&(i+=r.layout.span)),super(i,n),this.discriminator=r,this.usesPrefixDiscriminator=e instanceof QE||e instanceof ek,this.defaultLayout=t,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return o(e)},this.configGetSourceVariant=function(e){o=e.bind(this)}}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=this.discriminator,i=r.decode(e,n),o=this.registry[i];if(void 0===o){const o=this.defaultLayout;let s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),t=this.makeDestinationObject(),t[r.property]=i,t[o.property]=o.decode(e,n+s)}else t=o.decode(e,n);return t}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(e[r.property],t,n),o+i.encode(e[i.property],t,n+o)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new vk(this,e,t,n);return this.registry[e]=r,r}getVariant(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=e instanceof Uint8Array?this.discriminator.decode(e,n):e,this.registry[t]}}jE.Union=wk;class vk extends VE{constructor(e,t,n,r){if(!(e instanceof wk))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof VE))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=e.span;0>e.span&&(i=n?n.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let r=0;return this.layout&&(r=this.layout.getSpan(e,t+n)),n+r}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function bk(e){return 0>e&&(e+=4294967296),e}jE.VariantLayout=vk;class _k extends VE{constructor(e,t,n){if(!(e instanceof QE||e instanceof ek))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===n&&(n=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!t,this.fields=[];let r=0;this._packedSetValue=function(e){return r=bk(e),this},this._packedGetValue=function(){return r}}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.makeDestinationObject(),r=this.word.decode(e,t);this._packedSetValue(r);for(const t of this.fields)void 0!==t.property&&(n[t.property]=t.decode(e));return n}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=this.word.decode(t,n);this._packedSetValue(r);for(const t of this.fields)if(void 0!==t.property){const n=e[t.property];void 0!==n&&t.encode(n)}return this.word.encode(this._packedGetValue(),t,n)}addField(e,t){const n=new Ak(this,e,t);return this.fields.push(n),n}addBoolean(e){const t=new Ek(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}jE.BitStructure=_k;class Ak{constructor(e,t,n){if(!(e instanceof _k))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const r=8*e.span,i=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=r-i-t),this.wordMask=bk(this.valueMask<<this.start),this.property=n}decode(e,t){return bk(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==bk(e&this.valueMask))throw new TypeError(ZE("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=bk(e<<this.start);this.container._packedSetValue(bk(t&~this.wordMask)|n)}}jE.BitField=Ak;class Ek extends Ak{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e=+e),super.encode(e)}}jE.Boolean=Ek;class kk extends VE{constructor(e,t){if(!(e instanceof YE&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof YE||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.span;return 0>n&&(n=this.length.decode(e,t)),HE(e).slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof YE&&(r=e.length),!(e instanceof Uint8Array&&r===e.length))throw new TypeError(ZE("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>t.length)throw new RangeError("encoding overruns Uint8Array");const i=HE(e);return HE(t).write(i.toString("hex"),n,r,"hex"),this.length instanceof YE&&this.length.encode(r,t,n),r}}jE.Blob=kk;class Ik extends VE{constructor(e){super(-1,e)}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;WE(e);let n=t;for(;n<e.length&&0!==e[n];)n+=1;return 1+n-t}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.getSpan(e,t);return HE(e).slice(t,t+n-1).toString("utf-8")}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;"string"!=typeof e&&(e=String(e));const r=$E.Buffer.from(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");const o=HE(t);return r.copy(o,n),o[n+i]=0,i+1}}jE.CString=Ik;class Sk extends VE{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return WE(e),e.length-t}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return HE(e).slice(t,t+n).toString("utf-8")}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;"string"!=typeof e&&(e=String(e));const r=$E.Buffer.from(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(HE(t),n),i}}jE.UTF8=Sk;class Ck extends VE{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,n){return 0}}jE.Constant=Ck,jE.greedy=(e,t)=>new JE(e,t);var xk=jE.offset=(e,t,n)=>new XE(e,t,n),Bk=jE.u8=e=>new QE(1,e),Tk=jE.u16=e=>new QE(2,e);jE.u24=e=>new QE(3,e);var Rk=jE.u32=e=>new QE(4,e);jE.u40=e=>new QE(5,e),jE.u48=e=>new QE(6,e);var Dk=jE.nu64=e=>new sk(e);jE.u16be=e=>new ek(2,e),jE.u24be=e=>new ek(3,e),jE.u32be=e=>new ek(4,e),jE.u40be=e=>new ek(5,e),jE.u48be=e=>new ek(6,e),jE.nu64be=e=>new ak(e),jE.s8=e=>new tk(1,e),jE.s16=e=>new tk(2,e),jE.s24=e=>new tk(3,e),jE.s32=e=>new tk(4,e),jE.s40=e=>new tk(5,e),jE.s48=e=>new tk(6,e);var Pk=jE.ns64=e=>new uk(e);jE.s16be=e=>new nk(2,e),jE.s24be=e=>new nk(3,e),jE.s32be=e=>new nk(4,e),jE.s40be=e=>new nk(5,e),jE.s48be=e=>new nk(6,e),jE.ns64be=e=>new ck(e),jE.f32=e=>new dk(e),jE.f32be=e=>new lk(e),jE.f64=e=>new hk(e),jE.f64be=e=>new fk(e);var Uk=jE.struct=(e,t,n)=>new gk(e,t,n);jE.bits=(e,t,n)=>new _k(e,t,n);var Ok=jE.seq=(e,t,n)=>new pk(e,t,n);jE.union=(e,t,n)=>new wk(e,t,n),jE.unionLayoutDiscriminator=(e,t)=>new yk(e,t);var Fk=jE.blob=(e,t)=>new kk(e,t);jE.cstr=e=>new Ik(e);var Mk=jE.utf8=(e,t)=>new Sk(e,t);jE.constant=(e,t)=>new Ck(e,t);var Lk={};Object.defineProperty(Lk,"__esModule",{value:!0});var qk=Lk.toBigIntLE=function(e){{const t=Buffer.from(e);t.reverse();const n=t.toString("hex");return 0===n.length?BigInt(0):BigInt(`0x${n}`)}};Lk.toBigIntBE=function(e){{const t=e.toString("hex");return 0===t.length?BigInt(0):BigInt(`0x${t}`)}};var zk,Nk=Lk.toBufferLE=function(e,t){{const n=e.toString(16),r=Buffer.from(n.padStart(2*t,"0").slice(0,2*t),"hex");return r.reverse(),r}};Lk.toBufferBE=function(e,t){{const n=e.toString(16);return Buffer.from(n.padStart(2*t,"0").slice(0,2*t),"hex")}};class jk extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:s}=e,a=0===s.length?r:`At path: ${s.join(".")} -- ${r}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function $k(e){return"object"==typeof e&&null!=e}function Wk(e){return $k(e)&&!Array.isArray(e)}function Hk(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function Kk(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=n,{refinement:a,message:u=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${Hk(r)}\``}=e;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:u}}function*Vk(e,t,n,r){var i;$k(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=Kk(i,t,n,r);e&&(yield e)}}function*Gk(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i,mask:s};o&&(e=t.coercer(e,a));let u="valid";for(const r of t.validator(e,a))r.explanation=n.message,u="not_valid",yield[r,void 0];for(let[c,d,l]of t.entries(e,a)){const t=Gk(d,l,{path:void 0===c?r:[...r,c],branch:void 0===c?i:[...i,d],coerce:o,mask:s,message:n.message});for(const n of t)n[0]?(u=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):o&&(d=n[1],void 0===c?e=d:e instanceof Map?e.set(c,d):e instanceof Set?e.add(d):$k(e)&&(void 0!==d||c in e)&&(e[c]=d))}if("not_valid"!==u)for(const r of t.refiner(e,a))r.explanation=n.message,u="not_refined",yield[r,void 0];"valid"===u&&(yield[void 0,e])}class Zk{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(e,t)=>Vk(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>Vk(i(e,t),t,this,e):()=>[]}assert(e,t){return Yk(e,this,t)}create(e,t){return Jk(e,this,t)}is(e){return Xk(e,this)}mask(e,t){return function(e,t,n){const r=Qk(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Qk(e,this,t)}}function Yk(e,t,n){const r=Qk(e,t,{message:n});if(r[0])throw r[0]}function Jk(e,t,n){const r=Qk(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Xk(e,t){return!Qk(e,t)[0]}function Qk(e,t,n={}){const r=Gk(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new jk(i[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,i[1]]}function eI(e,t){return new Zk({type:e,schema:null,validator:t})}function tI(e){return new Zk({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Hk(e)}`})}function nI(){return eI("boolean",(e=>"boolean"==typeof e))}function rI(e){return eI("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Hk(t)}`))}function iI(e){const t=Hk(e),n=typeof e;return new Zk({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${Hk(n)}`})}function oI(e){return new Zk({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function sI(){return eI("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${Hk(e)}`))}function aI(e){return new Zk({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function uI(e,t){return new Zk({type:"record",schema:null,*entries(n){if($k(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>Wk(e)||`Expected an object, but received: ${Hk(e)}`,coercer:e=>Wk(e)?{...e}:e})}function cI(){return eI("string",(e=>"string"==typeof e||`Expected a string, but received: ${Hk(e)}`))}function dI(e){const t=eI("never",(()=>!1));return new Zk({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let i=0;i<r;i++)yield[i,n[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${Hk(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function lI(e){const t=Object.keys(e);return new Zk({type:"type",schema:e,*entries(n){if($k(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>Wk(e)||`Expected an object, but received: ${Hk(e)}`,coercer:e=>Wk(e)?{...e}:e})}function hI(e){const t=e.map((e=>e.type)).join(" | ");return new Zk({type:"union",schema:null,coercer(t,n){for(const r of e){const[e,i]=r.validate(t,{coerce:!0,mask:n.mask});if(!e)return i}return t},validator(n,r){const i=[];for(const t of e){const[...e]=Gk(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Hk(n)}`,...i]}})}function fI(){return eI("unknown",(()=>!0))}function pI(e,t,n){return new Zk({...e,coercer:(r,i)=>Xk(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}var gI=new Uint8Array(16);function mI(){if(!zk&&!(zk="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zk(gI)}var yI=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function wI(e){return"string"==typeof e&&yI.test(e)}for(var vI,bI,_I=[],AI=0;AI<256;++AI)_I.push((AI+256).toString(16).substr(1));function EI(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(_I[e[t+0]]+_I[e[t+1]]+_I[e[t+2]]+_I[e[t+3]]+"-"+_I[e[t+4]]+_I[e[t+5]]+"-"+_I[e[t+6]]+_I[e[t+7]]+"-"+_I[e[t+8]]+_I[e[t+9]]+"-"+_I[e[t+10]]+_I[e[t+11]]+_I[e[t+12]]+_I[e[t+13]]+_I[e[t+14]]+_I[e[t+15]]).toLowerCase();if(!wI(n))throw TypeError("Stringified UUID is invalid");return n}var kI=0,II=0;function SI(e){if(!wI(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function CI(e,t,n){function r(e,r,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=SI(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+e.length);if(s.set(r),s.set(e,r.length),(s=n(s))[6]=15&s[6]|t,s[8]=63&s[8]|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=s[a];return i}return EI(s)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function xI(e){return 14+(e+64>>>9<<4)+1}function BI(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function TI(e,t,n,r,i,o){return BI((s=BI(BI(t,e),BI(r,o)))<<(a=i)|s>>>32-a,n);var s,a}function RI(e,t,n,r,i,o,s){return TI(t&n|~t&r,e,t,i,o,s)}function DI(e,t,n,r,i,o,s){return TI(t&r|n&~r,e,t,i,o,s)}function PI(e,t,n,r,i,o,s){return TI(t^n^r,e,t,i,o,s)}function UI(e,t,n,r,i,o,s){return TI(n^(t|~r),e,t,i,o,s)}var OI=CI("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],n=32*e.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=e[i>>5]>>>i%32&255,s=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[xI(t)-1]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var a=n,u=r,c=i,d=o;n=RI(n,r,i,o,e[s],7,-680876936),o=RI(o,n,r,i,e[s+1],12,-389564586),i=RI(i,o,n,r,e[s+2],17,606105819),r=RI(r,i,o,n,e[s+3],22,-1044525330),n=RI(n,r,i,o,e[s+4],7,-176418897),o=RI(o,n,r,i,e[s+5],12,1200080426),i=RI(i,o,n,r,e[s+6],17,-1473231341),r=RI(r,i,o,n,e[s+7],22,-45705983),n=RI(n,r,i,o,e[s+8],7,1770035416),o=RI(o,n,r,i,e[s+9],12,-1958414417),i=RI(i,o,n,r,e[s+10],17,-42063),r=RI(r,i,o,n,e[s+11],22,-1990404162),n=RI(n,r,i,o,e[s+12],7,1804603682),o=RI(o,n,r,i,e[s+13],12,-40341101),i=RI(i,o,n,r,e[s+14],17,-1502002290),n=DI(n,r=RI(r,i,o,n,e[s+15],22,1236535329),i,o,e[s+1],5,-165796510),o=DI(o,n,r,i,e[s+6],9,-1069501632),i=DI(i,o,n,r,e[s+11],14,643717713),r=DI(r,i,o,n,e[s],20,-373897302),n=DI(n,r,i,o,e[s+5],5,-701558691),o=DI(o,n,r,i,e[s+10],9,38016083),i=DI(i,o,n,r,e[s+15],14,-660478335),r=DI(r,i,o,n,e[s+4],20,-405537848),n=DI(n,r,i,o,e[s+9],5,568446438),o=DI(o,n,r,i,e[s+14],9,-1019803690),i=DI(i,o,n,r,e[s+3],14,-187363961),r=DI(r,i,o,n,e[s+8],20,1163531501),n=DI(n,r,i,o,e[s+13],5,-1444681467),o=DI(o,n,r,i,e[s+2],9,-51403784),i=DI(i,o,n,r,e[s+7],14,1735328473),n=PI(n,r=DI(r,i,o,n,e[s+12],20,-1926607734),i,o,e[s+5],4,-378558),o=PI(o,n,r,i,e[s+8],11,-2022574463),i=PI(i,o,n,r,e[s+11],16,1839030562),r=PI(r,i,o,n,e[s+14],23,-35309556),n=PI(n,r,i,o,e[s+1],4,-1530992060),o=PI(o,n,r,i,e[s+4],11,1272893353),i=PI(i,o,n,r,e[s+7],16,-155497632),r=PI(r,i,o,n,e[s+10],23,-1094730640),n=PI(n,r,i,o,e[s+13],4,681279174),o=PI(o,n,r,i,e[s],11,-358537222),i=PI(i,o,n,r,e[s+3],16,-722521979),r=PI(r,i,o,n,e[s+6],23,76029189),n=PI(n,r,i,o,e[s+9],4,-640364487),o=PI(o,n,r,i,e[s+12],11,-421815835),i=PI(i,o,n,r,e[s+15],16,530742520),n=UI(n,r=PI(r,i,o,n,e[s+2],23,-995338651),i,o,e[s],6,-198630844),o=UI(o,n,r,i,e[s+7],10,1126891415),i=UI(i,o,n,r,e[s+14],15,-1416354905),r=UI(r,i,o,n,e[s+5],21,-57434055),n=UI(n,r,i,o,e[s+12],6,1700485571),o=UI(o,n,r,i,e[s+3],10,-1894986606),i=UI(i,o,n,r,e[s+10],15,-1051523),r=UI(r,i,o,n,e[s+1],21,-2054922799),n=UI(n,r,i,o,e[s+8],6,1873313359),o=UI(o,n,r,i,e[s+15],10,-30611744),i=UI(i,o,n,r,e[s+6],15,-1560198380),r=UI(r,i,o,n,e[s+13],21,1309151649),n=UI(n,r,i,o,e[s+4],6,-145523070),o=UI(o,n,r,i,e[s+11],10,-1120210379),i=UI(i,o,n,r,e[s+2],15,718787259),r=UI(r,i,o,n,e[s+9],21,-343485551),n=BI(n,a),r=BI(r,u),i=BI(i,c),o=BI(o,d)}return[n,r,i,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(xI(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))})),FI=OI;function MI(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function LI(e,t){return e<<t|e>>>32-t}var qI=CI("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var i=0;i<r.length;++i)e.push(r.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,s=Math.ceil(o/16),a=new Array(s),u=0;u<s;++u){for(var c=new Uint32Array(16),d=0;d<16;++d)c[d]=e[64*u+4*d]<<24|e[64*u+4*d+1]<<16|e[64*u+4*d+2]<<8|e[64*u+4*d+3];a[u]=c}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(var l=0;l<s;++l){for(var h=new Uint32Array(80),f=0;f<16;++f)h[f]=a[l][f];for(var p=16;p<80;++p)h[p]=LI(h[p-3]^h[p-8]^h[p-14]^h[p-16],1);for(var g=n[0],m=n[1],y=n[2],w=n[3],v=n[4],b=0;b<80;++b){var _=Math.floor(b/20),A=LI(g,5)+MI(_,m,y,w)+v+t[_]+h[b]>>>0;v=w,w=y,y=LI(m,30)>>>0,m=g,g=A}n[0]=n[0]+g>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+w>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),zI=qI;var NI=Object.freeze({__proto__:null,v1:function(e,t,n){var r=t&&n||0,i=t||new Array(16),o=(e=e||{}).node||vI,s=void 0!==e.clockseq?e.clockseq:bI;if(null==o||null==s){var a=e.random||(e.rng||mI)();null==o&&(o=vI=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=bI=16383&(a[6]<<8|a[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:II+1,d=u-kI+(c-II)/1e4;if(d<0&&void 0===e.clockseq&&(s=s+1&16383),(d<0||u>kI)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");kI=u,II=c,bI=s;var l=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=l>>>24&255,i[r++]=l>>>16&255,i[r++]=l>>>8&255,i[r++]=255&l;var h=u/4294967296*1e4&268435455;i[r++]=h>>>8&255,i[r++]=255&h,i[r++]=h>>>24&15|16,i[r++]=h>>>16&255,i[r++]=s>>>8|128,i[r++]=255&s;for(var f=0;f<6;++f)i[r+f]=o[f];return t||EI(i)},v3:FI,v4:function(e,t,n){var r=(e=e||{}).random||(e.rng||mI)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return EI(r)},v5:zI,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!wI(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:wI,stringify:EI,parse:SI}),jI=o(NI);const $I=jI.v4;var WI=function(e,t,n,r){if("string"!=typeof e)throw new TypeError(e+" must be a string");const i="number"==typeof(r=r||{}).version?r.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");const o={method:e};if(2===i&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");o.params=t}if(void 0===n){const e="function"==typeof r.generator?r.generator:function(){return $I()};o.id=e(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o};const HI=jI.v4,KI=WI,VI=function(e,t){if(!(this instanceof VI))return new VI(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return HI()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};var GI=VI;VI.prototype.request=function(e,t,n,r){const i=this;let o=null;const s=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&s)throw new TypeError("JSON-RPC 1.0 does not support batching");if(s||!s&&e&&"object"==typeof e&&"function"==typeof t)r=t,o=e;else{"function"==typeof n&&(r=n,n=void 0);const i="function"==typeof r;try{o=KI(e,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(i)return r(e);throw e}if(!i)return o}let a;try{a=JSON.stringify(o,this.options.replacer)}catch(e){return r(e)}return this.callServer(a,(function(e,t){i._parseResponse(e,t,r)})),o},VI.prototype._parseResponse=function(e,t,n){if(e)return void n(e);if(!t)return n();let r;try{r=JSON.parse(t,this.options.reviver)}catch(e){return n(e)}if(3===n.length){if(Array.isArray(r)){const e=function(e){return void 0!==e.error},t=function(t){return!e(t)};return n(null,r.filter(e),r.filter(t))}return n(null,r.error,r.result)}n(null,r)};var ZI={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,i,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var u,c,d=this._events[a],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,o),!0;case 6:return d.fn.call(d.context,t,r,i,o,s),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var h,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,i);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];d[c].fn.apply(d[c].context,u)}}return!0},a.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var u=0,c=[],d=a.length;u<d;u++)(a[u].fn!==t||i&&!a[u].once||r&&a[u].context!==r)&&c.push(a[u]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(ZI);var YI=ZI.exports,JI=class extends YI{socket;constructor(e,t,n){super(),this.socket=new window.WebSocket(e,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,n){const r=n||t;try{this.socket.send(e),r()}catch(e){r(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,n){this.socket.addEventListener(e,t,n)}};var XI=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},QI=class extends YI{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:n=!0,reconnect:r=!0,reconnect_interval:i=1e3,max_reconnects:o=5,...s}={},a,u){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=n,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=o,this.rest_options=s,this.current_reconnects=0,this.generate_request_id=a||(()=>++this.rpc_id),this.dataPack=u||new XI,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,n,r){return r||"object"!=typeof n||(r=n,n=null),new Promise(((i,o)=>{if(!this.ready)return o(new Error("socket not ready"));const s=this.generate_request_id(e,t),a={jsonrpc:"2.0",method:e,params:t||void 0,id:s};this.socket.send(this.dataPack.encode(a),r,(e=>{if(e)return o(e);this.queue[s]={promise:[i,o]},n&&(this.queue[s].timeout=setTimeout((()=>{delete this.queue[s],o(new Error("reply timeout"))}),n))}))}))}async login(e){const t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise(((n,r)=>{if(!this.ready)return r(new Error("socket not ready"));const i={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(i),(e=>{if(e)return r(e);n()}))}))}async subscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);const t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0})),this.socket.addEventListener("message",(({data:e})=>{e instanceof ArrayBuffer&&(e=$b.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let n=0;n<e.params.length;n++)t.push(e.params[n]);return Promise.resolve().then((()=>{this.emit.apply(this,t)}))}if(!this.queue[e.id])return e.method?Promise.resolve().then((()=>{this.emit(e.method,e?.params)})):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]})),this.socket.addEventListener("error",(e=>this.emit("error",e))),this.socket.addEventListener("close",(({code:n,reason:r})=>{this.ready&&setTimeout((()=>this.emit("close",n,r)),0),this.ready=!1,this.socket=void 0,1e3!==n&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)&&(this.reconnect_timer_id=setTimeout((()=>this._connect(e,t)),this.reconnect_interval)))}))}};const eS=[],tS=[],nS=[],rS=BigInt(0),iS=BigInt(1),oS=BigInt(2),sS=BigInt(7),aS=BigInt(256),uS=BigInt(113);for(let e=0,t=iS,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],eS.push(2*(5*r+n)),tS.push((e+1)*(e+2)/2%64);let i=rS;for(let e=0;e<7;e++)t=(t<<iS^(t>>sS)*uS)%aS,t&oS&&(i^=iS<<(iS<<BigInt(e))-iS);nS.push(i)}const[cS,dS]=y_(nS,!0),lS=(e,t,n)=>n>32?b_(e,t,n):w_(e,t,n),hS=(e,t,n)=>n>32?__(e,t,n):v_(e,t,n);class fS extends c_{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Qb(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}keccak(){s_||a_(this.state32),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,i=(t+2)%10,o=n[i],s=n[i+1],a=lS(o,s,1)^n[r],u=hS(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=a,e[t+n+1]^=u}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=tS[n],o=lS(t,i,r),s=hS(t,i,r),a=eS[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=cS[r],e[1]^=dS[r]}n.fill(0)}(this.state32,this.rounds),s_||a_(this.state32),this.posOut=0,this.pos=0}update(e){t_(this);const{blockLen:t,state:n}=this,r=(e=u_(e)).length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,0!=(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){t_(this,!1),e_(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Qb(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(n_(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new fS(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const pS=((e,t,n)=>d_((()=>new fS(t,e,n))))(1,136,32);class gS extends c_{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Qb(e.outputLen),Qb(e.blockLen)}(e);const n=u_(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return t_(this),this.iHash.update(e),this}digestInto(e){t_(this),e_(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const mS=(e,t,n)=>new gS(e,t).update(n).digest();function yS(e){void 0!==e.lowS&&U_("lowS",e.lowS),void 0!==e.prehash&&U_("prehash",e.prehash)}mS.create=(e,t)=>new gS(e,t);const{bytesToNumberBE:wS,hexToBytes:vS}=oA;class bS extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}}const _S={Err:bS,_tlv:{encode:(e,t)=>{const{Err:n}=_S;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=M_(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?M_(i.length/2|128):"";return M_(e)+o+i+t},decode(e,t){const{Err:n}=_S;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const e of s)o=o<<8|e;if(r+=e,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(r,r+o);if(s.length!==o)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=_S;if(e<AS)throw new t("integer: negative integers are not allowed");let n=M_(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=_S;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return wS(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=_S,i="string"==typeof e?vS(e):e;P_(i);const{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:u}=r.decode(2,o),{v:c,l:d}=r.decode(2,u);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=_S,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},AS=BigInt(0),ES=BigInt(1);BigInt(2);const kS=BigInt(3);function IS(e){const t=function(e){const t=PA(e);rA(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,r=bA(t.n,t.nBitLength),i=t.toBytes||((e,t,r)=>{const i=t.toAffine();return V_(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),o=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function s(e){const{a:r,b:i}=t,o=n.sqr(e),s=n.mul(o,e);return n.add(n.add(s,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:o}=t;if(n&&"bigint"!=typeof e){if(D_(e)&&(e=F_(e)),"string"!=typeof e||!n.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*r,"0")}let s;try{s="bigint"==typeof e?e:j_(K_("private key",e,r))}catch(t){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof e)}return i&&(s=fA(s,o)),Y_("private key",s,ES,o),s}function u(e){if(!(e instanceof l))throw new Error("ProjectivePoint expected")}const c=iA(((e,t)=>{const{px:r,py:i,pz:o}=e;if(n.eql(o,n.ONE))return{x:r,y:i};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(o));const a=n.mul(r,t),u=n.mul(i,t),c=n.mul(o,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:a,y:u}})),d=iA((e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not FE");const o=n.sqr(i),a=s(r);if(!n.eql(o,a))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class l{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof l)throw new Error("projective point not allowed");const i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?l.ZERO:new l(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(l.fromAffine)}static fromHex(e){const t=l.fromAffine(o(K_("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return l.BASE.multiply(a(e))}static msm(e,t){return DA(l,r,e,t)}_setWindowSize(e){f.setWindowSize(this,e)}assertValidity(){d(this)}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){u(e);const{px:t,py:r,pz:i}=this,{px:o,py:s,pz:a}=e,c=n.eql(n.mul(t,a),n.mul(o,i)),d=n.eql(n.mul(r,a),n.mul(s,i));return c&&d}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,i=n.mul(r,kS),{px:o,py:s,pz:a}=this;let u=n.ZERO,c=n.ZERO,d=n.ZERO,h=n.mul(o,o),f=n.mul(s,s),p=n.mul(a,a),g=n.mul(o,s);return g=n.add(g,g),d=n.mul(o,a),d=n.add(d,d),u=n.mul(e,d),c=n.mul(i,p),c=n.add(u,c),u=n.sub(f,c),c=n.add(f,c),c=n.mul(u,c),u=n.mul(g,u),d=n.mul(i,d),p=n.mul(e,p),g=n.sub(h,p),g=n.mul(e,g),g=n.add(g,d),d=n.add(h,h),h=n.add(d,h),h=n.add(h,p),h=n.mul(h,g),c=n.add(c,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,g),u=n.sub(u,h),d=n.mul(p,f),d=n.add(d,d),d=n.add(d,d),new l(u,c,d)}add(e){u(e);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:c}=e;let d=n.ZERO,h=n.ZERO,f=n.ZERO;const p=t.a,g=n.mul(t.b,kS);let m=n.mul(r,s),y=n.mul(i,a),w=n.mul(o,c),v=n.add(r,i),b=n.add(s,a);v=n.mul(v,b),b=n.add(m,y),v=n.sub(v,b),b=n.add(r,o);let _=n.add(s,c);return b=n.mul(b,_),_=n.add(m,w),b=n.sub(b,_),_=n.add(i,o),d=n.add(a,c),_=n.mul(_,d),d=n.add(y,w),_=n.sub(_,d),f=n.mul(p,b),d=n.mul(g,w),f=n.add(d,f),d=n.sub(y,f),f=n.add(y,f),h=n.mul(d,f),y=n.add(m,m),y=n.add(y,m),w=n.mul(p,w),b=n.mul(g,b),y=n.add(y,w),w=n.sub(m,w),w=n.mul(p,w),b=n.add(b,w),m=n.mul(y,b),h=n.add(h,m),m=n.mul(_,b),d=n.mul(v,d),d=n.sub(d,m),m=n.mul(v,y),f=n.mul(_,f),f=n.add(f,m),new l(d,h,f)}subtract(e){return this.add(e.negate())}is0(){return this.equals(l.ZERO)}wNAF(e){return f.wNAFCached(this,e,l.normalizeZ)}multiplyUnsafe(e){const{endo:r,n:i}=t;Y_("scalar",e,AS,i);const o=l.ZERO;if(e===AS)return o;if(this.is0()||e===ES)return this;if(!r||f.hasPrecomputes(this))return f.wNAFCachedUnsafe(this,e,l.normalizeZ);let{k1neg:s,k1:a,k2neg:u,k2:c}=r.splitScalar(e),d=o,h=o,p=this;for(;a>AS||c>AS;)a&ES&&(d=d.add(p)),c&ES&&(h=h.add(p)),p=p.double(),a>>=ES,c>>=ES;return s&&(d=d.negate()),u&&(h=h.negate()),h=new l(n.mul(h.px,r.beta),h.py,h.pz),d.add(h)}multiply(e){const{endo:r,n:i}=t;let o,s;if(Y_("scalar",e,ES,i),r){const{k1neg:t,k1:i,k2neg:a,k2:u}=r.splitScalar(e);let{p:c,f:d}=this.wNAF(i),{p:h,f:p}=this.wNAF(u);c=f.constTimeNegate(t,c),h=f.constTimeNegate(a,h),h=new l(n.mul(h.px,r.beta),h.py,h.pz),o=c.add(h),s=d.add(p)}else{const{p:t,f:n}=this.wNAF(e);o=t,s=n}return l.normalizeZ([o,s])[0]}multiplyAndAddUnsafe(e,t,n){const r=l.BASE,i=(e,t)=>t!==AS&&t!==ES&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return c(this,e)}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===ES)return!0;if(n)return n(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===ES?this:n?n(l,this):this.multiplyUnsafe(t.h)}toRawBytes(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return U_("isCompressed",e),this.assertValidity(),i(l,this,e)}toHex(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return U_("isCompressed",e),F_(this.toRawBytes(e))}}l.BASE=new l(t.Gx,t.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const h=t.nBitLength,f=RA(l,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:l,normPrivateKeyToScalar:a,weierstrassEquation:s,isWithinCurveOrder:function(e){return Z_(e,ES,t.n)}}}function SS(e){const t=function(e){const t=PA(e);return rA(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,i=n.BYTES+1,o=2*n.BYTES+1;function s(e){return fA(e,r)}function a(e){return mA(e,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:d,isWithinCurveOrder:l}=IS({...t,toBytes(e,t,r){const i=t.toAffine(),o=n.toBytes(i.x),s=V_;return U_("isCompressed",r),r?s(Uint8Array.from([t.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(e){const t=e.length,r=e[0],s=e.subarray(1);if(t!==i||2!==r&&3!==r){if(t===o&&4===r){return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))}}throw new Error("invalid Point, expected length of "+i+", or uncompressed "+o+", got "+t)}{const e=j_(s);if(!Z_(e,ES,n.ORDER))throw new Error("Point is not on curve");const t=d(e);let i;try{i=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return 1==(1&r)!==((i&ES)===ES)&&(i=n.neg(i)),{x:e,y:i}}}}),h=e=>F_(W_(e,t.nByteLength));function f(e){return e>r>>ES}const p=(e,t,n)=>j_(e.slice(t,n));class g{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=K_("compactSignature",e,2*n),new g(p(e,0,n),p(e,n,2*n))}static fromDER(e){const{r:t,s:n}=_S.toSig(K_("DER",e));return new g(t,n)}assertValidity(){Y_("r",this.r,ES,r),Y_("s",this.s,ES,r)}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:i,recovery:o}=this,c=v(K_("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const d=2===o||3===o?r+t.n:r;if(d>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const l=0==(1&o)?"02":"03",f=u.fromHex(l+h(d)),p=a(d),g=s(-c*p),m=s(i*p),y=u.BASE.multiplyAndAddUnsafe(f,g,m);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return N_(this.toDERHex())}toDERHex(){return _S.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return N_(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const m={isValidPrivateKey(e){try{return c(e),!0}catch(e){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const e=AA(t.n);return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.length,i=_A(t),o=AA(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const s=fA(n?$_(e):j_(e),t-aA)+aA;return n?H_(s,i):W_(s,i)}(t.randomBytes(e),t.n)},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}};function y(e){const t=D_(e),n="string"==typeof e,r=(t||n)&&e.length;return t?r===i||r===o:n?r===2*i||r===2*o:e instanceof u}const w=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const n=j_(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},v=t.bits2int_modN||function(e){return s(w(e))},b=X_(t.nBitLength);function _(e){return Y_("num < 2^"+t.nBitLength,e,AS,b),W_(e,t.nByteLength)}function A(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E;if(["recovered","canonical"].some((e=>e in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:d}=t;let{lowS:h,prehash:p,extraEntropy:m}=i;null==h&&(h=!0),e=K_("msgHash",e),yS(i),p&&(e=K_("prehashed msgHash",o(e)));const y=v(e),b=c(r),A=[_(b),_(y)];if(null!=m&&!1!==m){const e=!0===m?d(n.BYTES):m;A.push(K_("extraEntropy",e))}const k=V_(...A),I=y;return{seed:k,k2sig:function(e){const t=w(e);if(!l(t))return;const n=a(t),r=u.BASE.multiply(t).toAffine(),i=s(r.x);if(i===AS)return;const o=s(n*s(I+i*b));if(o===AS)return;let c=(r.x===i?0:2)|Number(r.y&ES),d=o;return h&&f(o)&&(d=function(e){return f(e)?s(-e):e}(o),c^=1),new g(i,d,c)}}}const E={lowS:t.lowS,prehash:!1},k={lowS:t.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return u.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(y(e))throw new Error("first arg must be private key");if(!y(t))throw new Error("second arg must be public key");return u.fromHex(t).multiply(c(e)).toRawBytes(n)},sign:function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E;const{seed:i,k2sig:o}=A(e,n,r),s=t;return tA(s.hash.outputLen,s.nByteLength,s.hmac)(i,o)},verify:function(e,n,r){var i;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k;const c=e;n=K_("msgHash",n),r=K_("publicKey",r);const{lowS:d,prehash:l,format:h}=o;if(yS(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==h&&"compact"!==h&&"der"!==h)throw new Error("format must be compact or der");const f="string"==typeof c||D_(c),p=!f&&!h&&"object"==typeof c&&null!==c&&"bigint"==typeof c.r&&"bigint"==typeof c.s;if(!f&&!p)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let m,y;try{if(p&&(m=new g(c.r,c.s)),f){try{"compact"!==h&&(m=g.fromDER(c))}catch(e){if(!(e instanceof _S.Err))throw e}m||"der"===h||(m=g.fromCompact(c))}y=u.fromHex(r)}catch(e){return!1}if(!m)return!1;if(d&&m.hasHighS())return!1;l&&(n=t.hash(n));const{r:w,s:b}=m,_=v(n),A=a(b),E=s(_*A),I=s(w*A),S=null===(i=u.BASE.multiplyAndAddUnsafe(y,E,I))||void 0===i?void 0:i.toAffine();return!!S&&s(S.x)===w},ProjectivePoint:u,Signature:g,utils:m}}function CS(e){return{hash:e,hmac:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return mS(e,t,function(){let e=0;for(let t=0;t<arguments.length;t++){const n=t<0||arguments.length<=t?void 0:arguments[t];e_(n),e+=n.length}const t=new Uint8Array(e);for(let e=0,n=0;e<arguments.length;e++){const r=e<0||arguments.length<=e?void 0:arguments[e];t.set(r,n),n+=r.length}return t}(...r))},randomBytes:l_}}BigInt(4);const xS=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),BS=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),TS=BigInt(1),RS=BigInt(2),DS=(e,t)=>(e+t/RS)/t;const PS=bA(xS,void 0,void 0,{sqrt:function(e){const t=xS,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=e*e*e%t,d=c*c*e%t,l=gA(d,n,t)*d%t,h=gA(l,n,t)*d%t,f=gA(h,RS,t)*c%t,p=gA(f,i,t)*f%t,g=gA(p,o,t)*p%t,m=gA(g,a,t)*g%t,y=gA(m,u,t)*m%t,w=gA(y,a,t)*g%t,v=gA(w,n,t)*d%t,b=gA(v,s,t)*p%t,_=gA(b,r,t)*c%t,A=gA(_,RS,t);if(!PS.eql(PS.sqr(A),e))throw new Error("Cannot find square root");return A}}),US=function(e,t){const n=t=>SS({...e,...CS(t)});return{...n(t),create:n}}({a:BigInt(0),b:BigInt(7),Fp:PS,n:BS,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=BS,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-TS*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=DS(o*e,t),u=DS(-r*e,t);let c=fA(e-a*n-u*i,t),d=fA(-a*r-u*o,t);const l=c>s,h=d>s;if(l&&(c=t-c),h&&(d=t-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:l,k1:c,k2neg:h,k2:d}}}},aE);BigInt(0),US.ProjectivePoint;const OS=YA.utils.randomPrivateKey,FS=()=>{const e=YA.utils.randomPrivateKey(),t=MS(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},MS=YA.getPublicKey;function LS(e){try{return YA.ExtendedPoint.fromHex(e),!0}catch{return!1}}const qS=(e,t)=>YA.sign(e,t.slice(0,32)),zS=YA.verify,NS=e=>$b.Buffer.isBuffer(e)?e:e instanceof Uint8Array?$b.Buffer.from(e.buffer,e.byteOffset,e.byteLength):$b.Buffer.from(e);class jS{constructor(e){Object.assign(this,e)}encode(){return $b.Buffer.from(LE($S,this))}static decode(e){return NE($S,this,e)}static decodeUnchecked(e){return IE($S,this,e)}}const $S=new Map;var WS;const HS=32;let KS=1;class VS extends jS{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"==typeof e){const t=nE.decode(e);if(t.length!=HS)throw new Error("Invalid public key input");this._bn=new XA(t)}else this._bn=new XA(e);if(this._bn.byteLength()>HS)throw new Error("Invalid public key input")}}static unique(){const e=new VS(KS);return KS+=1,new VS(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return nE.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike($b.Buffer);if(e.length===HS)return e;const t=$b.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,n){const r=$b.Buffer.concat([e.toBuffer(),$b.Buffer.from(t),n.toBuffer()]),i=aE(r);return new VS(i)}static createProgramAddressSync(e,t){let n=$b.Buffer.alloc(0);e.forEach((function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");n=$b.Buffer.concat([n,NS(e)])})),n=$b.Buffer.concat([n,t.toBuffer(),$b.Buffer.from("ProgramDerivedAddress")]);const r=aE(n);if(LS(r))throw new Error("Invalid seeds, address must fall off the curve");return new VS(r)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let n,r=255;for(;0!=r;){try{const i=e.concat($b.Buffer.from([r]));n=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,t){return this.findProgramAddressSync(e,t)}static isOnCurve(e){return LS(new VS(e).toBytes())}}WS=VS,VS.default=new WS("11111111111111111111111111111111"),$S.set(VS,{kind:"struct",fields:[["_bn","u256"]]});const GS=new VS("BPFLoader1111111111111111111111111111111111"),ZS=1232,YS=127;class JS extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(JS.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class XS extends Error{constructor(e,t){super(`Transaction was not confirmed in ${t.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=e}}Object.defineProperty(XS.prototype,"name",{value:"TransactionExpiredTimeoutError"});class QS extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(QS.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class eC{constructor(e,t){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=t}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const t of this.keySegments()){if(e<t.length)return t[e];e-=t.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const t=new Map;this.keySegments().flat().forEach(((e,n)=>{t.set(e.toBase58(),n)}));const n=e=>{const n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((e=>({programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((e=>n(e.pubkey))),data:e.data})))}}const tC=function(){return Fk(32,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey")},nC=function(){return Fk(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature")},rC=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string";const t=Uk([Rk("length"),Rk("lengthPadding"),Fk(xk(Rk(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=(e,t)=>n(e,t).chars.toString(),i.encode=(e,t,n)=>{const i={chars:$b.Buffer.from(e,"utf8")};return r(i,t,n)},i.alloc=e=>Rk().span+Rk().span+$b.Buffer.from(e,"utf8").length,i};function iC(e,t){const n=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(t[e.property]);if("count"in e&&"elementLayout"in e){const r=t[e.property];if(Array.isArray(r))return r.length*n(e.elementLayout)}else if("fields"in e)return iC({layout:e},t[e.property]);return 0};let r=0;return e.layout.fields.forEach((e=>{r+=n(e)})),r}function oC(e){let t=0,n=0;for(;;){let r=e.shift();if(t|=(127&r)<<7*n,n+=1,0==(128&r))break}return t}function sC(e,t){let n=t;for(;;){let t=127&n;if(n>>=7,0==n){e.push(t);break}t|=128,e.push(t)}}function aC(e,t){if(!e)throw new Error(t||"Assertion failed")}class uC{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const n=new Map,r=e=>{const t=e.toBase58();let r=n.get(t);return void 0===r&&(r={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(t,r)),r},i=r(t);i.isSigner=!0,i.isWritable=!0;for(const t of e){r(t.programId).isInvoked=!0;for(const e of t.keys){const t=r(e.pubkey);t.isSigner||(t.isSigner=e.isSigner),t.isWritable||(t.isWritable=e.isWritable)}}return new uC(t,n)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];aC(e.length<=256,"Max static account keys length exceeded");const t=e.filter((e=>{let[,t]=e;return t.isSigner&&t.isWritable})),n=e.filter((e=>{let[,t]=e;return t.isSigner&&!t.isWritable})),r=e.filter((e=>{let[,t]=e;return!t.isSigner&&t.isWritable})),i=e.filter((e=>{let[,t]=e;return!t.isSigner&&!t.isWritable})),o={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{aC(t.length>0,"Expected at least one writable signer key");const[e]=t[0];aC(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[o,[...t.map((e=>{let[t]=e;return new VS(t)})),...n.map((e=>{let[t]=e;return new VS(t)})),...r.map((e=>{let[t]=e;return new VS(t)})),...i.map((e=>{let[t]=e;return new VS(t)}))]]}extractTableLookup(e){const[t,n]=this.drainKeysFoundInLookupTable(e.state.addresses,(e=>!e.isSigner&&!e.isInvoked&&e.isWritable)),[r,i]=this.drainKeysFoundInLookupTable(e.state.addresses,(e=>!e.isSigner&&!e.isInvoked&&!e.isWritable));if(0!==t.length||0!==r.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:r},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(e,t){const n=new Array,r=new Array;for(const[i,o]of this.keyMetaMap.entries())if(t(o)){const t=new VS(i),o=e.findIndex((e=>e.equals(t)));o>=0&&(aC(o<256,"Max lookup table index exceeded"),n.push(o),r.push(t),this.keyMetaMap.delete(i))}return[n,r]}}const cC="Reached end of buffer unexpectedly";function dC(e){if(0===e.length)throw new Error(cC);return e.shift()}function lC(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];const[o]=r;if(2===r.length?o+(null!==(t=r[1])&&void 0!==t?t:0)>e.length:o>=e.length)throw new Error(cC);return e.splice(...r)}class hC{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((e=>new VS(e))),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex])))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map((e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:nE.decode(e.data)})))}get addressTableLookups(){return[]}getAccountKeys(){return new eC(this.staticAccountKeys)}static compile(e){const t=uC.compile(e.instructions,e.payerKey),[n,r]=t.getMessageComponents(),i=new eC(r).compileInstructions(e.instructions).map((e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:nE.encode(e.data)})));return new hC({header:n,accountKeys:r,recentBlockhash:e.recentBlockhash,instructions:i})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){return e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts}return e<t-this.header.numReadonlySignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter(((e,t)=>!this.isProgramId(t)))}serialize(){const e=this.accountKeys.length;let t=[];sC(t,e);const n=this.instructions.map((e=>{const{accounts:t,programIdIndex:n}=e,r=Array.from(nE.decode(e.data));let i=[];sC(i,t.length);let o=[];return sC(o,r.length),{programIdIndex:n,keyIndicesCount:$b.Buffer.from(i),keyIndices:t,dataLength:$b.Buffer.from(o),data:r}}));let r=[];sC(r,n.length);let i=$b.Buffer.alloc(ZS);$b.Buffer.from(r).copy(i);let o=r.length;n.forEach((e=>{const t=Uk([Bk("programIdIndex"),Fk(e.keyIndicesCount.length,"keyIndicesCount"),Ok(Bk("keyIndex"),e.keyIndices.length,"keyIndices"),Fk(e.dataLength.length,"dataLength"),Ok(Bk("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t})),i=i.slice(0,o);const s=Uk([Fk(1,"numRequiredSignatures"),Fk(1,"numReadonlySignedAccounts"),Fk(1,"numReadonlyUnsignedAccounts"),Fk(t.length,"keyCount"),Ok(tC("key"),e,"keys"),tC("recentBlockhash")]),a={numRequiredSignatures:$b.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:$b.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:$b.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:$b.Buffer.from(t),keys:this.accountKeys.map((e=>NS(e.toBytes()))),recentBlockhash:nE.decode(this.recentBlockhash)};let u=$b.Buffer.alloc(2048);const c=s.encode(a,u);return i.copy(u,c),u.slice(0,c+i.length)}static from(e){let t=[...e];const n=dC(t);if(n!==(n&YS))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const r=dC(t),i=dC(t),o=oC(t);let s=[];for(let e=0;e<o;e++){const e=lC(t,0,HS);s.push(new VS($b.Buffer.from(e)))}const a=lC(t,0,HS),u=oC(t);let c=[];for(let e=0;e<u;e++){const e=dC(t),n=lC(t,0,oC(t)),r=lC(t,0,oC(t)),i=nE.encode($b.Buffer.from(r));c.push({programIdIndex:e,accounts:n,data:i})}const d={header:{numRequiredSignatures:n,numReadonlySignedAccounts:r,numReadonlyUnsignedAccounts:i},recentBlockhash:nE.encode($b.Buffer.from(a)),accountKeys:s,instructions:c};return new hC(d)}}class fC{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(const t of this.addressTableLookups)e+=t.readonlyIndexes.length+t.writableIndexes.length;return e}getAccountKeys(e){let t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new eC(this.staticAccountKeys,t)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){const t=e-n,r=this.addressTableLookups.reduce(((e,t)=>e+t.writableIndexes.length),0);return t<r}if(e>=this.header.numRequiredSignatures){return e-t<n-t-this.header.numReadonlyUnsignedAccounts}return e<t-this.header.numReadonlySignedAccounts}resolveAddressTableLookups(e){const t={writable:[],readonly:[]};for(const n of this.addressTableLookups){const r=e.find((e=>e.key.equals(n.accountKey)));if(!r)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const e of n.writableIndexes){if(!(e<r.state.addresses.length))throw new Error(`Failed to find address for index ${e} in address lookup table ${n.accountKey.toBase58()}`);t.writable.push(r.state.addresses[e])}for(const e of n.readonlyIndexes){if(!(e<r.state.addresses.length))throw new Error(`Failed to find address for index ${e} in address lookup table ${n.accountKey.toBase58()}`);t.readonly.push(r.state.addresses[e])}}return t}static compile(e){const t=uC.compile(e.instructions,e.payerKey),n=new Array,r={writable:new Array,readonly:new Array},i=e.addressLookupTableAccounts||[];for(const e of i){const i=t.extractTableLookup(e);if(void 0!==i){const[e,{writable:t,readonly:o}]=i;n.push(e),r.writable.push(...t),r.readonly.push(...o)}}const[o,s]=t.getMessageComponents(),a=new eC(s,r).compileInstructions(e.instructions);return new fC({header:o,staticAccountKeys:s,recentBlockhash:e.recentBlockhash,compiledInstructions:a,addressTableLookups:n})}serialize(){const e=Array();sC(e,this.staticAccountKeys.length);const t=this.serializeInstructions(),n=Array();sC(n,this.compiledInstructions.length);const r=this.serializeAddressTableLookups(),i=Array();sC(i,this.addressTableLookups.length);const o=Uk([Bk("prefix"),Uk([Bk("numRequiredSignatures"),Bk("numReadonlySignedAccounts"),Bk("numReadonlyUnsignedAccounts")],"header"),Fk(e.length,"staticAccountKeysLength"),Ok(tC(),this.staticAccountKeys.length,"staticAccountKeys"),tC("recentBlockhash"),Fk(n.length,"instructionsLength"),Fk(t.length,"serializedInstructions"),Fk(i.length,"addressTableLookupsLength"),Fk(r.length,"serializedAddressTableLookups")]),s=new Uint8Array(ZS),a=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map((e=>e.toBytes())),recentBlockhash:nE.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},s);return s.slice(0,a)}serializeInstructions(){let e=0;const t=new Uint8Array(ZS);for(const n of this.compiledInstructions){const r=Array();sC(r,n.accountKeyIndexes.length);const i=Array();sC(i,n.data.length);e+=Uk([Bk("programIdIndex"),Fk(r.length,"encodedAccountKeyIndexesLength"),Ok(Bk(),n.accountKeyIndexes.length,"accountKeyIndexes"),Fk(i.length,"encodedDataLength"),Fk(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(r),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array(ZS);for(const n of this.addressTableLookups){const r=Array();sC(r,n.writableIndexes.length);const i=Array();sC(i,n.readonlyIndexes.length);e+=Uk([tC("accountKey"),Fk(r.length,"encodedWritableIndexesLength"),Ok(Bk(),n.writableIndexes.length,"writableIndexes"),Fk(i.length,"encodedReadonlyIndexesLength"),Ok(Bk(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(r),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const n=dC(t),r=n&YS;aC(n!==r,"Expected versioned message but received legacy message");aC(0===r,`Expected versioned message with version 0 but found version ${r}`);const i={numRequiredSignatures:dC(t),numReadonlySignedAccounts:dC(t),numReadonlyUnsignedAccounts:dC(t)},o=[],s=oC(t);for(let e=0;e<s;e++)o.push(new VS(lC(t,0,HS)));const a=nE.encode(lC(t,0,HS)),u=oC(t),c=[];for(let e=0;e<u;e++){const e=dC(t),n=lC(t,0,oC(t)),r=oC(t),i=new Uint8Array(lC(t,0,r));c.push({programIdIndex:e,accountKeyIndexes:n,data:i})}const d=oC(t),l=[];for(let e=0;e<d;e++){const e=new VS(lC(t,0,HS)),n=lC(t,0,oC(t)),r=lC(t,0,oC(t));l.push({accountKey:e,writableIndexes:n,readonlyIndexes:r})}return new fC({header:i,staticAccountKeys:o,recentBlockhash:a,compiledInstructions:c,addressTableLookups:l})}}const pC={deserializeMessageVersion(e){const t=e[0],n=t&YS;return n===t?"legacy":n},deserialize:e=>{const t=pC.deserializeMessageVersion(e);if("legacy"===t)return hC.from(e);if(0===t)return fC.deserialize(e);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let gC=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const mC=$b.Buffer.alloc(64).fill(0);class yC{constructor(e){this.keys=void 0,this.programId=void 0,this.data=$b.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map((e=>{let{pubkey:t,isSigner:n,isWritable:r}=e;return{pubkey:t.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:[...this.data]}}}class wC{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:t,nonceInfo:n}=e;this.minNonceContextSlot=t,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:n}=e;this.recentBlockhash=t,this.lastValidBlockHeight=n}else{const{recentBlockhash:t,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=t}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map((e=>e.toJSON())),signers:this.signatures.map((e=>{let{publicKey:t}=e;return t.toJSON()}))}}add(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No instructions");return t.forEach((e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new yC(e))})),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let e=0;e<t.length;e++)if(void 0===t[e].programId)throw new Error(`Transaction instruction index ${e} has undefined program id`);const r=[],i=[];t.forEach((e=>{e.keys.forEach((e=>{i.push({...e})}));const t=e.programId.toString();r.includes(t)||r.push(t)})),r.forEach((e=>{i.push({pubkey:new VS(e),isSigner:!1,isWritable:!1})}));const o=[];i.forEach((e=>{const t=e.pubkey.toString(),n=o.findIndex((e=>e.pubkey.toString()===t));n>-1?(o[n].isWritable=o[n].isWritable||e.isWritable,o[n].isSigner=o[n].isSigner||e.isSigner):o.push(e)})),o.sort((function(e,t){if(e.isSigner!==t.isSigner)return e.isSigner?-1:1;if(e.isWritable!==t.isWritable)return e.isWritable?-1:1;return e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));const s=o.findIndex((e=>e.pubkey.equals(n)));if(s>-1){const[e]=o.splice(s,1);e.isSigner=!0,e.isWritable=!0,o.unshift(e)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const e of this.signatures){const t=o.findIndex((t=>t.pubkey.equals(e.publicKey)));if(!(t>-1))throw new Error(`unknown signer: ${e.publicKey.toString()}`);o[t].isSigner||(o[t].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."))}let a=0,u=0,c=0;const d=[],l=[];o.forEach((e=>{let{pubkey:t,isSigner:n,isWritable:r}=e;n?(d.push(t.toString()),a+=1,r||(u+=1)):(l.push(t.toString()),r||(c+=1))}));const h=d.concat(l),f=t.map((e=>{const{data:t,programId:n}=e;return{programIdIndex:h.indexOf(n.toString()),accounts:e.keys.map((e=>h.indexOf(e.pubkey.toString()))),data:nE.encode(t)}}));return f.forEach((e=>{aC(e.programIdIndex>=0),e.accounts.forEach((e=>aC(e>=0)))})),new hC({header:{numRequiredSignatures:a,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:c},accountKeys:h,recentBlockhash:e,instructions:f})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length){const n=this.signatures.every(((e,n)=>t[n].equals(e.publicKey)));if(n)return e}return this.signatures=t.map((e=>({signature:null,publicKey:e}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");const r=new Set;this.signatures=t.filter((e=>{const t=e.toString();return!r.has(t)&&(r.add(t),!0)})).map((e=>({signature:null,publicKey:e})))}sign(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");const r=new Set,i=[];for(const e of t){const t=e.publicKey.toString();r.has(t)||(r.add(t),i.push(e))}this.signatures=i.map((e=>({signature:null,publicKey:e.publicKey})));const o=this._compile();this._partialSign(o,...i)}partialSign(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");const r=new Set,i=[];for(const e of t){const t=e.publicKey.toString();r.has(t)||(r.add(t),i.push(e))}const o=this._compile();this._partialSign(o,...i)}_partialSign(e){const t=e.serialize();for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];r.forEach((e=>{const n=qS(t,e.secretKey);this._addSignature(e.publicKey,NS(n))}))}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){aC(64===t.length);const n=this.signatures.findIndex((t=>e.equals(t.publicKey)));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=$b.Buffer.from(t)}verifySignatures(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const n={};for(const{signature:r,publicKey:i}of this.signatures)null===r?t&&(n.missing||(n.missing=[])).push(i):zS(r,e,i.toBytes())||(n.invalid||(n.invalid=[])).push(i);return n.invalid||n.missing?n:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),r=this.serializeMessage();if(n){const e=this._getMessageSignednessErrors(r,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=`\nInvalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map((e=>e.toBase58())).join("`, `")}\`].`),e.missing&&(t+=`\nMissing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map((e=>e.toBase58())).join("`, `")}\`].`),new Error(t)}}return this._serialize(r)}_serialize(e){const{signatures:t}=this,n=[];sC(n,t.length);const r=n.length+64*t.length+e.length,i=$b.Buffer.alloc(r);return aC(t.length<256),$b.Buffer.from(n).copy(i,0),t.forEach(((e,t)=>{let{signature:r}=e;null!==r&&(aC(64===r.length,"signature has invalid length"),$b.Buffer.from(r).copy(i,n.length+64*t))})),e.copy(i,n.length+64*t.length),aC(i.length<=ZS,`Transaction too large: ${i.length} > 1232`),i}get keys(){return aC(1===this.instructions.length),this.instructions[0].keys.map((e=>e.pubkey))}get programId(){return aC(1===this.instructions.length),this.instructions[0].programId}get data(){return aC(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e];const n=oC(t);let r=[];for(let e=0;e<n;e++){const e=lC(t,0,64);r.push(nE.encode($b.Buffer.from(e)))}return wC.populate(hC.from(t),r)}static populate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=new wC;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),t.forEach(((t,r)=>{const i={signature:t==nE.encode(mC)?null:nE.decode(t),publicKey:e.accountKeys[r]};n.signatures.push(i)})),e.instructions.forEach((t=>{const r=t.accounts.map((t=>{const r=e.accountKeys[t];return{pubkey:r,isSigner:n.signatures.some((e=>e.publicKey.toString()===r.toString()))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));n.instructions.push(new yC({keys:r,programId:e.accountKeys[t.programIdIndex],data:nE.decode(t.data)}))})),n._message=e,n._json=n.toJSON(),n}}class vC{constructor(e){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}static decompile(e,t){const{header:n,compiledInstructions:r,recentBlockhash:i}=e,{numRequiredSignatures:o,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:a}=n,u=o-s;aC(u>0,"Message header is invalid");const c=e.staticAccountKeys.length-o-a;aC(c>=0,"Message header is invalid");const d=e.getAccountKeys(t),l=d.get(0);if(void 0===l)throw new Error("Failed to decompile message because no account keys were found");const h=[];for(const e of r){const t=[];for(const r of e.accountKeyIndexes){const e=d.get(r);if(void 0===e)throw new Error(`Failed to find key for account key index ${r}`);let i;i=r<o?r<u:r<d.staticAccountKeys.length?r-o<c:r-d.staticAccountKeys.length<d.accountKeysFromLookups.writable.length,t.push({pubkey:e,isSigner:r<n.numRequiredSignatures,isWritable:i})}const r=d.get(e.programIdIndex);if(void 0===r)throw new Error(`Failed to find program id for program id index ${e.programIdIndex}`);h.push(new yC({programId:r,data:NS(e.data),keys:t}))}return new vC({payerKey:l,instructions:h,recentBlockhash:i})}compileToLegacyMessage(){return hC.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(e){return fC.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}class bC{get version(){return this.message.version}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)aC(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{const t=[];for(let n=0;n<e.header.numRequiredSignatures;n++)t.push(new Uint8Array(64));this.signatures=t}this.message=e}serialize(){const e=this.message.serialize(),t=Array();sC(t,this.signatures.length);const n=Uk([Fk(t.length,"encodedSignaturesLength"),Ok(nC(),this.signatures.length,"signatures"),Fk(e.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,i)}static deserialize(e){let t=[...e];const n=[],r=oC(t);for(let e=0;e<r;e++)n.push(new Uint8Array(lC(t,0,64)));const i=pC.deserialize(new Uint8Array(t));return new bC(i,n)}sign(e){const t=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(const r of e){const e=n.findIndex((e=>e.equals(r.publicKey)));aC(e>=0,`Cannot sign with non signer key ${r.publicKey.toBase58()}`),this.signatures[e]=qS(t,r.secretKey)}}addSignature(e,t){aC(64===t.byteLength,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((t=>t.equals(e)));aC(n>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=t}}const _C=new VS("SysvarC1ock11111111111111111111111111111111"),AC=new VS("SysvarEpochSchedu1e111111111111111111111111"),EC=new VS("Sysvar1nstructions1111111111111111111111111"),kC=new VS("SysvarRecentB1ockHashes11111111111111111111"),IC=new VS("SysvarRent111111111111111111111111111111111"),SC=new VS("SysvarRewards111111111111111111111111111111"),CC=new VS("SysvarS1otHashes111111111111111111111111111"),xC=new VS("SysvarS1otHistory11111111111111111111111111"),BC=new VS("SysvarStakeHistory1111111111111111111111111");class TC extends Error{constructor(e){let{action:t,signature:n,transactionMessage:r,logs:i}=e;const o=i?`Logs: \n${JSON.stringify(i.slice(-10),null,2)}. `:"",s="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let a;switch(t){case"send":a=`Transaction ${n} resulted in an error. \n${r}. `+o+s;break;case"simulate":a=`Simulation failed. \nMessage: ${r}. \n`+o+s;break;default:a=`Unknown action '${t}'`}super(a),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=n,this.transactionMessage=r,this.transactionLogs=i||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise(((t,n)=>{e.getTransaction(this.signature).then((e=>{if(e&&e.meta&&e.meta.logMessages){const n=e.meta.logMessages;this.transactionLogs=n,t(n)}else n(new Error("Log messages not found"))})).catch(n)}))),await this.transactionLogs}}class RC extends Error{constructor(e,t){let{code:n,message:r,data:i}=e;super(null!=t?`${t}: ${r}`:r),this.code=void 0,this.data=void 0,this.code=n,this.data=i,this.name="SolanaJSONRPCError"}}async function DC(e,t,n,r){const i=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment,maxRetries:r.maxRetries,minContextSlot:r.minContextSlot},o=await e.sendTransaction(t,n,i);let s;if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)s=(await e.confirmTransaction({abortSignal:null==r?void 0:r.abortSignal,signature:o,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},r&&r.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){const{nonceInstruction:n}=t.nonceInfo,i=n.keys[0].pubkey;s=(await e.confirmTransaction({abortSignal:null==r?void 0:r.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:t.nonceInfo.nonce,signature:o},r&&r.commitment)).value}else null!=(null==r?void 0:r.abortSignal)&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),s=(await e.confirmTransaction(o,r&&r.commitment)).value;if(s.err){if(null!=o)throw new TC({action:"send",signature:o,transactionMessage:`Status: (${JSON.stringify(s)})`});throw new Error(`Transaction ${o} failed (${JSON.stringify(s)})`)}return o}function PC(e){return new Promise((t=>setTimeout(t,e)))}function UC(e,t){const n=e.layout.span>=0?e.layout.span:iC(e,t),r=$b.Buffer.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,r),r}function OC(e,t){let n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error(`invalid instruction; instruction index mismatch ${n.instruction} != ${e.index}`);return n}const FC=Dk("lamportsPerSignature"),MC=Uk([Rk("version"),Rk("state"),tC("authorizedPubkey"),tC("nonce"),Uk([FC],"feeCalculator")]),LC=MC.span;class qC{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=MC.decode(NS(e),0);return new qC({authorizedPubkey:new VS(t.authorizedPubkey),nonce:new VS(t.nonce).toString(),feeCalculator:t.feeCalculator})}}const zC=(NC=8,e=>{const t=Fk(NC,e),{encode:n,decode:r}=(e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)}))(t),i=t;return i.decode=(e,t)=>{const n=r(e,t);return qk($b.Buffer.from(n))},i.encode=(e,t,r)=>{const i=Nk(e,NC);return n(i,t,r)},i});var NC;const jC=Object.freeze({Create:{index:0,layout:Uk([Rk("instruction"),Pk("lamports"),Pk("space"),tC("programId")])},Assign:{index:1,layout:Uk([Rk("instruction"),tC("programId")])},Transfer:{index:2,layout:Uk([Rk("instruction"),zC("lamports")])},CreateWithSeed:{index:3,layout:Uk([Rk("instruction"),tC("base"),rC("seed"),Pk("lamports"),Pk("space"),tC("programId")])},AdvanceNonceAccount:{index:4,layout:Uk([Rk("instruction")])},WithdrawNonceAccount:{index:5,layout:Uk([Rk("instruction"),Pk("lamports")])},InitializeNonceAccount:{index:6,layout:Uk([Rk("instruction"),tC("authorized")])},AuthorizeNonceAccount:{index:7,layout:Uk([Rk("instruction"),tC("authorized")])},Allocate:{index:8,layout:Uk([Rk("instruction"),Pk("space")])},AllocateWithSeed:{index:9,layout:Uk([Rk("instruction"),tC("base"),rC("seed"),Pk("space"),tC("programId")])},AssignWithSeed:{index:10,layout:Uk([Rk("instruction"),tC("base"),rC("seed"),tC("programId")])},TransferWithSeed:{index:11,layout:Uk([Rk("instruction"),zC("lamports"),rC("seed"),tC("programId")])},UpgradeNonceAccount:{index:12,layout:Uk([Rk("instruction")])}});class $C{constructor(){}static createAccount(e){const t=UC(jC.Create,{lamports:e.lamports,space:e.space,programId:NS(e.programId.toBuffer())});return new yC({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}static transfer(e){let t,n;if("basePubkey"in e){t=UC(jC.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:NS(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{t=UC(jC.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new yC({keys:n,programId:this.programId,data:t})}static assign(e){let t,n;if("basePubkey"in e){t=UC(jC.AssignWithSeed,{base:NS(e.basePubkey.toBuffer()),seed:e.seed,programId:NS(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{t=UC(jC.Assign,{programId:NS(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new yC({keys:n,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=UC(jC.CreateWithSeed,{base:NS(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:NS(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new yC({keys:n,programId:this.programId,data:t})}static createNonceAccount(e){const t=new wC;"basePubkey"in e&&"seed"in e?t.add($C.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:LC,programId:this.programId})):t.add($C.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:LC,programId:this.programId}));const n={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(n)),t}static nonceInitialize(e){const t=UC(jC.InitializeNonceAccount,{authorized:NS(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:kC,isSigner:!1,isWritable:!1},{pubkey:IC,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new yC(n)}static nonceAdvance(e){const t=UC(jC.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:kC,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new yC(n)}static nonceWithdraw(e){const t=UC(jC.WithdrawNonceAccount,{lamports:e.lamports});return new yC({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:kC,isSigner:!1,isWritable:!1},{pubkey:IC,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){const t=UC(jC.AuthorizeNonceAccount,{authorized:NS(e.newAuthorizedPubkey.toBuffer())});return new yC({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static allocate(e){let t,n;if("basePubkey"in e){t=UC(jC.AllocateWithSeed,{base:NS(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:NS(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{t=UC(jC.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new yC({keys:n,programId:this.programId,data:t})}}$C.programId=new VS("11111111111111111111111111111111");class WC{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/WC.chunkSize)+1+1)}static async load(e,t,n,r,i){{const o=await e.getMinimumBalanceForRentExemption(i.length),s=await e.getAccountInfo(n.publicKey,"confirmed");let a=null;if(null!==s){if(s.executable)return console.error("Program load failed, account is already executable"),!1;s.data.length!==i.length&&(a=a||new wC,a.add($C.allocate({accountPubkey:n.publicKey,space:i.length}))),s.owner.equals(r)||(a=a||new wC,a.add($C.assign({accountPubkey:n.publicKey,programId:r}))),s.lamports<o&&(a=a||new wC,a.add($C.transfer({fromPubkey:t.publicKey,toPubkey:n.publicKey,lamports:o-s.lamports})))}else a=(new wC).add($C.createAccount({fromPubkey:t.publicKey,newAccountPubkey:n.publicKey,lamports:o>0?o:1,space:i.length,programId:r}));null!==a&&await DC(e,a,[t,n],{commitment:"confirmed"})}const o=Uk([Rk("instruction"),Rk("offset"),Rk("bytesLength"),Rk("bytesLengthPadding"),Ok(Bk("byte"),xk(Rk(),-8),"bytes")]),s=WC.chunkSize;let a=0,u=i,c=[];for(;u.length>0;){const i=u.slice(0,s),d=$b.Buffer.alloc(s+16);o.encode({instruction:0,offset:a,bytes:i,bytesLength:0,bytesLengthPadding:0},d);const l=(new wC).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:r,data:d});if(c.push(DC(e,l,[t,n],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")){const e=4;await PC(1e3/e)}a+=s,u=u.slice(s)}await Promise.all(c);{const i=Uk([Rk("instruction")]),o=$b.Buffer.alloc(i.span);i.encode({instruction:1},o);const s=(new wC).add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:IC,isSigner:!1,isWritable:!1}],programId:r,data:o}),a="processed",u=await e.sendTransaction(s,[t,n],{preflightCommitment:a}),{context:c,value:d}=await e.confirmTransaction({signature:u,lastValidBlockHeight:s.lastValidBlockHeight,blockhash:s.recentBlockhash},a);if(d.err)throw new Error(`Transaction ${u} failed (${JSON.stringify(d)})`);for(;;){try{if(await e.getSlot({commitment:a})>c.slot)break}catch{}await new Promise((e=>setTimeout(e,Math.round(200))))}}return!0}}WC.chunkSize=932;const HC=new VS("BPFLoader2111111111111111111111111111111111");function KC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var VC,GC;function ZC(){if(GC)return VC;GC=1;var e=Object.prototype.toString,t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function n(r,i){var o,s,a,u,c,d,l;if(!0===r)return"true";if(!1===r)return"false";switch(typeof r){case"object":if(null===r)return null;if(r.toJSON&&"function"==typeof r.toJSON)return n(r.toJSON(),i);if("[object Array]"===(l=e.call(r))){for(a="[",s=r.length-1,o=0;o<s;o++)a+=n(r[o],!0)+",";return s>-1&&(a+=n(r[o],!0)),a+"]"}if("[object Object]"===l){for(s=(u=t(r).sort()).length,a="",o=0;o<s;)void 0!==(d=n(r[c=u[o]],!1))&&(a&&(a+=","),a+=JSON.stringify(c)+":"+d),o++;return"{"+a+"}"}return JSON.stringify(r);case"function":case"undefined":return i?null:void 0;case"string":return JSON.stringify(r);default:return isFinite(r)?r:null}}return VC=function(e){var t=n(e,!1);if(void 0!==t)return""+t}}var YC=KC(ZC());function JC(e){let t=0;for(;e>1;)e/=2,t++;return t}class XC{constructor(e,t,n,r,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=n,this.firstNormalEpoch=r,this.firstNormalSlot=i}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const n=JC(0===(t=e+32+1)?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32)))-JC(32)-1;return[n,e-(this.getSlotsInEpoch(n)-32)]}{const t=e-this.firstNormalSlot,n=Math.floor(t/this.slotsPerEpoch);return[this.firstNormalEpoch+n,t%this.slotsPerEpoch]}var t}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+JC(32)):this.slotsPerEpoch}}var QC=globalThis.fetch;class ex extends QI{constructor(e,t,n){super((e=>{const n=function(e,t){return new JI(e,t)}(e,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...t});return this.underlyingSocket="socket"in n?n.socket:n,n}),e,t,n),this.underlyingSocket=void 0}call(){var e;const t=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState;return 1===t?super.call(...arguments):Promise.reject(new Error("Tried to call a JSON-RPC method `"+(arguments.length<=0?void 0:arguments[0])+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}notify(){var e;const t=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState;return 1===t?super.notify(...arguments):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+(arguments.length<=0?void 0:arguments[0])+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+t+")"))}}class tx{constructor(e){this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}isActive(){const e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}static deserialize(e){const t=function(e,t){let n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error(`invalid account data; account type mismatch ${n.typeIndex} != ${e.index}`);return n}(nx,e),n=e.length-56;aC(n>=0,"lookup table is invalid"),aC(n%32==0,"lookup table is invalid");const r=n/32,{addresses:i}=Uk([Ok(tC(),r,"addresses")]).decode(e.slice(56));return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new VS(t.authority[0]):void 0,addresses:i.map((e=>new VS(e)))}}}const nx={index:1,layout:Uk([Rk("typeIndex"),zC("deactivationSlot"),Dk("lastExtendedSlot"),Bk("lastExtendedStartIndex"),Bk(),Ok(tC(),xk(Bk(),-1),"authority")])},rx=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;const ix=pI(rI(VS),cI(),(e=>new VS(e))),ox=dI([cI(),iI("base64")]),sx=pI(rI($b.Buffer),ox,(e=>$b.Buffer.from(e[0],"base64")));function ax(e){let t,n;if("string"==typeof e)t=e;else if(e){const{commitment:r,...i}=e;t=r,n=i}return{commitment:t,config:n}}function ux(e){return e.map((e=>{var t;return"memcmp"in e?{...e,memcmp:{...e.memcmp,encoding:null!==(t=e.memcmp.encoding)&&void 0!==t?t:"base58"}}:e}))}function cx(e){return hI([lI({jsonrpc:iI("2.0"),id:cI(),result:e}),lI({jsonrpc:iI("2.0"),id:cI(),error:lI({code:fI(),message:cI(),data:aI(eI("any",(()=>!0)))})})])}const dx=cx(fI());function lx(e){return pI(cx(e),dx,(t=>"error"in t?t:{...t,result:Jk(t.result,e)}))}function hx(e){return lx(lI({context:lI({slot:sI()}),value:e}))}function fx(e){return lI({context:lI({slot:sI()}),value:e})}function px(e,t){return 0===e?new fC({header:t.header,staticAccountKeys:t.accountKeys.map((e=>new VS(e))),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:nE.decode(e.data)}))),addressTableLookups:t.addressTableLookups}):new hC(t)}const gx=lI({foundation:sI(),foundationTerm:sI(),initial:sI(),taper:sI(),terminal:sI()}),mx=lx(tI(oI(lI({epoch:sI(),effectiveSlot:sI(),amount:sI(),postBalance:sI(),commission:aI(oI(sI()))})))),yx=tI(lI({slot:sI(),prioritizationFee:sI()})),wx=lI({total:sI(),validator:sI(),foundation:sI(),epoch:sI()}),vx=lI({epoch:sI(),slotIndex:sI(),slotsInEpoch:sI(),absoluteSlot:sI(),blockHeight:aI(sI()),transactionCount:aI(sI())}),bx=lI({slotsPerEpoch:sI(),leaderScheduleSlotOffset:sI(),warmup:nI(),firstNormalEpoch:sI(),firstNormalSlot:sI()}),_x=uI(cI(),tI(sI())),Ax=oI(hI([lI({}),cI()])),Ex=lI({err:Ax}),kx=iI("receivedSignature"),Ix=lI({"solana-core":cI(),"feature-set":aI(sI())}),Sx=lI({program:cI(),programId:ix,parsed:fI()}),Cx=lI({programId:ix,accounts:tI(ix),data:cI()}),xx=hx(lI({err:oI(hI([lI({}),cI()])),logs:oI(tI(cI())),accounts:aI(oI(tI(oI(lI({executable:nI(),owner:cI(),lamports:sI(),data:tI(cI()),rentEpoch:aI(sI())}))))),unitsConsumed:aI(sI()),returnData:aI(oI(lI({programId:cI(),data:dI([cI(),iI("base64")])}))),innerInstructions:aI(oI(tI(lI({index:sI(),instructions:tI(hI([Sx,Cx]))}))))})),Bx=hx(lI({byIdentity:uI(cI(),tI(sI())),range:lI({firstSlot:sI(),lastSlot:sI()})}));const Tx=lx(gx),Rx=lx(wx),Dx=lx(yx),Px=lx(vx),Ux=lx(bx),Ox=lx(_x),Fx=lx(sI()),Mx=hx(lI({total:sI(),circulating:sI(),nonCirculating:sI(),nonCirculatingAccounts:tI(ix)})),Lx=lI({amount:cI(),uiAmount:oI(sI()),decimals:sI(),uiAmountString:aI(cI())}),qx=hx(tI(lI({address:ix,amount:cI(),uiAmount:oI(sI()),decimals:sI(),uiAmountString:aI(cI())}))),zx=hx(tI(lI({pubkey:ix,account:lI({executable:nI(),owner:ix,lamports:sI(),data:sx,rentEpoch:sI()})}))),Nx=lI({program:cI(),parsed:fI(),space:sI()}),jx=hx(tI(lI({pubkey:ix,account:lI({executable:nI(),owner:ix,lamports:sI(),data:Nx,rentEpoch:sI()})}))),$x=hx(tI(lI({lamports:sI(),address:ix}))),Wx=lI({executable:nI(),owner:ix,lamports:sI(),data:sx,rentEpoch:sI()}),Hx=lI({pubkey:ix,account:Wx}),Kx=pI(hI([rI($b.Buffer),Nx]),hI([ox,Nx]),(e=>Array.isArray(e)?Jk(e,sx):e)),Vx=lI({executable:nI(),owner:ix,lamports:sI(),data:Kx,rentEpoch:sI()}),Gx=lI({pubkey:ix,account:Vx}),Zx=lI({state:hI([iI("active"),iI("inactive"),iI("activating"),iI("deactivating")]),active:sI(),inactive:sI()}),Yx=lx(tI(lI({signature:cI(),slot:sI(),err:Ax,memo:oI(cI()),blockTime:aI(oI(sI()))}))),Jx=lx(tI(lI({signature:cI(),slot:sI(),err:Ax,memo:oI(cI()),blockTime:aI(oI(sI()))}))),Xx=lI({subscription:sI(),result:fx(Wx)}),Qx=lI({pubkey:ix,account:Wx}),eB=lI({subscription:sI(),result:fx(Qx)}),tB=lI({parent:sI(),slot:sI(),root:sI()}),nB=lI({subscription:sI(),result:tB}),rB=hI([lI({type:hI([iI("firstShredReceived"),iI("completed"),iI("optimisticConfirmation"),iI("root")]),slot:sI(),timestamp:sI()}),lI({type:iI("createdBank"),parent:sI(),slot:sI(),timestamp:sI()}),lI({type:iI("frozen"),slot:sI(),timestamp:sI(),stats:lI({numTransactionEntries:sI(),numSuccessfulTransactions:sI(),numFailedTransactions:sI(),maxTransactionsPerEntry:sI()})}),lI({type:iI("dead"),slot:sI(),timestamp:sI(),err:cI()})]),iB=lI({subscription:sI(),result:rB}),oB=lI({subscription:sI(),result:fx(hI([Ex,kx]))}),sB=lI({subscription:sI(),result:sI()}),aB=lI({pubkey:cI(),gossip:oI(cI()),tpu:oI(cI()),rpc:oI(cI()),version:oI(cI())}),uB=lI({votePubkey:cI(),nodePubkey:cI(),activatedStake:sI(),epochVoteAccount:nI(),epochCredits:tI(dI([sI(),sI(),sI()])),commission:sI(),lastVote:sI(),rootSlot:oI(sI())}),cB=lx(lI({current:tI(uB),delinquent:tI(uB)})),dB=hI([iI("processed"),iI("confirmed"),iI("finalized")]),lB=lI({slot:sI(),confirmations:oI(sI()),err:Ax,confirmationStatus:aI(dB)}),hB=hx(tI(oI(lB))),fB=lx(sI()),pB=lI({accountKey:ix,writableIndexes:tI(sI()),readonlyIndexes:tI(sI())}),gB=lI({signatures:tI(cI()),message:lI({accountKeys:tI(cI()),header:lI({numRequiredSignatures:sI(),numReadonlySignedAccounts:sI(),numReadonlyUnsignedAccounts:sI()}),instructions:tI(lI({accounts:tI(sI()),data:cI(),programIdIndex:sI()})),recentBlockhash:cI(),addressTableLookups:aI(tI(pB))})}),mB=lI({pubkey:ix,signer:nI(),writable:nI(),source:aI(hI([iI("transaction"),iI("lookupTable")]))}),yB=lI({accountKeys:tI(mB),signatures:tI(cI())}),wB=lI({parsed:fI(),program:cI(),programId:ix}),vB=lI({accounts:tI(ix),data:cI(),programId:ix}),bB=pI(hI([vB,wB]),hI([lI({parsed:fI(),program:cI(),programId:cI()}),lI({accounts:tI(cI()),data:cI(),programId:cI()})]),(e=>Jk(e,"accounts"in e?vB:wB))),_B=lI({signatures:tI(cI()),message:lI({accountKeys:tI(mB),instructions:tI(bB),recentBlockhash:cI(),addressTableLookups:aI(oI(tI(pB)))})}),AB=lI({accountIndex:sI(),mint:cI(),owner:aI(cI()),programId:aI(cI()),uiTokenAmount:Lx}),EB=lI({writable:tI(ix),readonly:tI(ix)}),kB=lI({err:Ax,fee:sI(),innerInstructions:aI(oI(tI(lI({index:sI(),instructions:tI(lI({accounts:tI(sI()),data:cI(),programIdIndex:sI()}))})))),preBalances:tI(sI()),postBalances:tI(sI()),logMessages:aI(oI(tI(cI()))),preTokenBalances:aI(oI(tI(AB))),postTokenBalances:aI(oI(tI(AB))),loadedAddresses:aI(EB),computeUnitsConsumed:aI(sI())}),IB=lI({err:Ax,fee:sI(),innerInstructions:aI(oI(tI(lI({index:sI(),instructions:tI(bB)})))),preBalances:tI(sI()),postBalances:tI(sI()),logMessages:aI(oI(tI(cI()))),preTokenBalances:aI(oI(tI(AB))),postTokenBalances:aI(oI(tI(AB))),loadedAddresses:aI(EB),computeUnitsConsumed:aI(sI())}),SB=hI([iI(0),iI("legacy")]),CB=lI({pubkey:cI(),lamports:sI(),postBalance:oI(sI()),rewardType:oI(cI()),commission:aI(oI(sI()))}),xB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),transactions:tI(lI({transaction:gB,meta:oI(kB),version:aI(SB)})),rewards:aI(tI(CB)),blockTime:oI(sI()),blockHeight:oI(sI())}))),BB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),rewards:aI(tI(CB)),blockTime:oI(sI()),blockHeight:oI(sI())}))),TB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),transactions:tI(lI({transaction:yB,meta:oI(kB),version:aI(SB)})),rewards:aI(tI(CB)),blockTime:oI(sI()),blockHeight:oI(sI())}))),RB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),transactions:tI(lI({transaction:_B,meta:oI(IB),version:aI(SB)})),rewards:aI(tI(CB)),blockTime:oI(sI()),blockHeight:oI(sI())}))),DB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),transactions:tI(lI({transaction:yB,meta:oI(IB),version:aI(SB)})),rewards:aI(tI(CB)),blockTime:oI(sI()),blockHeight:oI(sI())}))),PB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),rewards:aI(tI(CB)),blockTime:oI(sI()),blockHeight:oI(sI())}))),UB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),transactions:tI(lI({transaction:gB,meta:oI(kB)})),rewards:aI(tI(CB)),blockTime:oI(sI())}))),OB=lx(oI(lI({blockhash:cI(),previousBlockhash:cI(),parentSlot:sI(),signatures:tI(cI()),blockTime:oI(sI())}))),FB=lx(oI(lI({slot:sI(),meta:oI(kB),blockTime:aI(oI(sI())),transaction:gB,version:aI(SB)}))),MB=lx(oI(lI({slot:sI(),transaction:_B,meta:oI(IB),blockTime:aI(oI(sI())),version:aI(SB)}))),LB=hx(lI({blockhash:cI(),lastValidBlockHeight:sI()})),qB=hx(nI()),zB=lx(tI(lI({slot:sI(),numTransactions:sI(),numSlots:sI(),samplePeriodSecs:sI()}))),NB=hx(oI(lI({feeCalculator:lI({lamportsPerSignature:sI()})}))),jB=lx(cI()),$B=lx(cI()),WB=lI({err:Ax,logs:tI(cI()),signature:cI()}),HB=lI({result:fx(WB),subscription:sI()}),KB={"solana-client":"js/1.0.0-maintenance"};class VB{constructor(e){this._keypair=void 0,this._keypair=null!=e?e:FS()}static generate(){return new VB(FS())}static fromSecretKey(e,t){if(64!==e.byteLength)throw new Error("bad secret key size");const n=e.slice(32,64);if(!t||!t.skipValidation){const t=e.slice(0,32),r=MS(t);for(let e=0;e<32;e++)if(n[e]!==r[e])throw new Error("provided secretKey is invalid")}return new VB({publicKey:n,secretKey:e})}static fromSeed(e){const t=MS(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),new VB({publicKey:t,secretKey:n})}get publicKey(){return new VS(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const GB=Object.freeze({CreateLookupTable:{index:0,layout:Uk([Rk("instruction"),zC("recentSlot"),Bk("bumpSeed")])},FreezeLookupTable:{index:1,layout:Uk([Rk("instruction")])},ExtendLookupTable:{index:2,layout:Uk([Rk("instruction"),zC(),Ok(tC(),xk(Rk(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Uk([Rk("instruction")])},CloseLookupTable:{index:4,layout:Uk([Rk("instruction")])}});class ZB{constructor(){}static createLookupTable(e){const[t,n]=VS.findProgramAddressSync([e.authority.toBuffer(),Nk(BigInt(e.recentSlot),8)],this.programId),r=UC(GB.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:n}),i=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:$C.programId,isSigner:!1,isWritable:!1}];return[new yC({programId:this.programId,keys:i,data:r}),t]}static freezeLookupTable(e){const t=UC(GB.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new yC({programId:this.programId,keys:n,data:t})}static extendLookupTable(e){const t=UC(GB.ExtendLookupTable,{addresses:e.addresses.map((e=>e.toBytes()))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:$C.programId,isSigner:!1,isWritable:!1}),new yC({programId:this.programId,keys:n,data:t})}static deactivateLookupTable(e){const t=UC(GB.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new yC({programId:this.programId,keys:n,data:t})}static closeLookupTable(e){const t=UC(GB.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new yC({programId:this.programId,keys:n,data:t})}}ZB.programId=new VS("AddressLookupTab1e1111111111111111111111111");const YB=Object.freeze({RequestUnits:{index:0,layout:Uk([Bk("instruction"),Rk("units"),Rk("additionalFee")])},RequestHeapFrame:{index:1,layout:Uk([Bk("instruction"),Rk("bytes")])},SetComputeUnitLimit:{index:2,layout:Uk([Bk("instruction"),Rk("units")])},SetComputeUnitPrice:{index:3,layout:Uk([Bk("instruction"),zC("microLamports")])}});class JB{constructor(){}static requestUnits(e){const t=UC(YB.RequestUnits,e);return new yC({keys:[],programId:this.programId,data:t})}static requestHeapFrame(e){const t=UC(YB.RequestHeapFrame,e);return new yC({keys:[],programId:this.programId,data:t})}static setComputeUnitLimit(e){const t=UC(YB.SetComputeUnitLimit,e);return new yC({keys:[],programId:this.programId,data:t})}static setComputeUnitPrice(e){const t=UC(YB.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new yC({keys:[],programId:this.programId,data:t})}}JB.programId=new VS("ComputeBudget111111111111111111111111111111");const XB=Uk([Bk("numSignatures"),Bk("padding"),Tk("signatureOffset"),Tk("signatureInstructionIndex"),Tk("publicKeyOffset"),Tk("publicKeyInstructionIndex"),Tk("messageDataOffset"),Tk("messageDataSize"),Tk("messageInstructionIndex")]);class QB{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,instructionIndex:i}=e;aC(32===t.length,`Public Key must be 32 bytes but received ${t.length} bytes`),aC(64===r.length,`Signature must be 64 bytes but received ${r.length} bytes`);const o=XB.span,s=o+t.length,a=s+r.length,u=$b.Buffer.alloc(a+n.length),c=null==i?65535:i;return XB.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:c,publicKeyOffset:o,publicKeyInstructionIndex:c,messageDataOffset:a,messageDataSize:n.length,messageInstructionIndex:c},u),u.fill(t,o),u.fill(r,s),u.fill(n,a),new yC({keys:[],programId:QB.programId,data:u})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;aC(64===t.length,`Private key must be 64 bytes but received ${t.length} bytes`);try{const e=VB.fromSecretKey(t),i=e.publicKey.toBytes(),o=qS(n,e.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:o,instructionIndex:r})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}QB.programId=new VS("Ed25519SigVerify111111111111111111111111111");US.utils.isValidPrivateKey;const eT=US.getPublicKey,tT=Uk([Bk("numSignatures"),Tk("signatureOffset"),Bk("signatureInstructionIndex"),Tk("ethAddressOffset"),Bk("ethAddressInstructionIndex"),Tk("messageDataOffset"),Tk("messageDataSize"),Bk("messageInstructionIndex"),Fk(20,"ethAddress"),Fk(64,"signature"),Bk("recoveryId")]);class nT{constructor(){}static publicKeyToEthAddress(e){aC(64===e.length,`Public key must be 64 bytes but received ${e.length} bytes`);try{return $b.Buffer.from(pS(NS(e))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:n,signature:r,recoveryId:i,instructionIndex:o}=e;return nT.createInstructionWithEthAddress({ethAddress:nT.publicKeyToEthAddress(t),message:n,signature:r,recoveryId:i,instructionIndex:o})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:n,signature:r,recoveryId:i,instructionIndex:o=0}=e;let s;s="string"==typeof t?t.startsWith("0x")?$b.Buffer.from(t.substr(2),"hex"):$b.Buffer.from(t,"hex"):t,aC(20===s.length,`Address must be 20 bytes but received ${s.length} bytes`);const a=12+s.length,u=a+r.length+1,c=$b.Buffer.alloc(tT.span+n.length);return tT.encode({numSignatures:1,signatureOffset:a,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:n.length,messageInstructionIndex:o,signature:NS(r),ethAddress:NS(s),recoveryId:i},c),c.fill(NS(n),tT.span),new yC({keys:[],programId:nT.programId,data:c})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:n,instructionIndex:r}=e;aC(32===t.length,`Private key must be 32 bytes but received ${t.length} bytes`);try{const e=NS(t),i=eT(e,!1).slice(1),o=$b.Buffer.from(pS(NS(n))),[s,a]=((e,t)=>{const n=US.sign(e,t);return[n.toCompactRawBytes(),n.recovery]})(o,e);return this.createInstructionWithPublicKey({publicKey:i,message:n,signature:s,recoveryId:a,instructionIndex:r})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}var rT;nT.programId=new VS("KeccakSecp256k11111111111111111111111111111");const iT=new VS("StakeConfig11111111111111111111111111111111");class oT{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class sT{constructor(e,t,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=n}}rT=sT,sT.default=new rT(0,0,VS.default);const aT=Object.freeze({Initialize:{index:0,layout:Uk([Rk("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Uk([tC("staker"),tC("withdrawer")],e)}(),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Uk([Pk("unixTimestamp"),Pk("epoch"),tC("custodian")],e)}()])},Authorize:{index:1,layout:Uk([Rk("instruction"),tC("newAuthorized"),Rk("stakeAuthorizationType")])},Delegate:{index:2,layout:Uk([Rk("instruction")])},Split:{index:3,layout:Uk([Rk("instruction"),Pk("lamports")])},Withdraw:{index:4,layout:Uk([Rk("instruction"),Pk("lamports")])},Deactivate:{index:5,layout:Uk([Rk("instruction")])},Merge:{index:7,layout:Uk([Rk("instruction")])},AuthorizeWithSeed:{index:8,layout:Uk([Rk("instruction"),tC("newAuthorized"),Rk("stakeAuthorizationType"),rC("authoritySeed"),tC("authorityOwner")])}}),uT=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class cT{constructor(){}static initialize(e){const{stakePubkey:t,authorized:n,lockup:r}=e,i=r||sT.default,o=UC(aT.Initialize,{authorized:{staker:NS(n.staker.toBuffer()),withdrawer:NS(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:NS(i.custodian.toBuffer())}}),s={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:IC,isSigner:!1,isWritable:!1}],programId:this.programId,data:o};return new yC(s)}static createAccountWithSeed(e){const t=new wC;t.add($C.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static createAccount(e){const t=new wC;t.add($C.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:r,lockup:i}=e;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:n,votePubkey:r}=e,i=UC(aT.Delegate);return(new wC).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:BC,isSigner:!1,isWritable:!1},{pubkey:iT,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(e){const{stakePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,stakeAuthorizationType:i,custodianPubkey:o}=e,s=UC(aT.Authorize,{newAuthorized:NS(r.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_C,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new wC).add({keys:a,programId:this.programId,data:s})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:n,authoritySeed:r,authorityOwner:i,newAuthorizedPubkey:o,stakeAuthorizationType:s,custodianPubkey:a}=e,u=UC(aT.AuthorizeWithSeed,{newAuthorized:NS(o.toBuffer()),stakeAuthorizationType:s.index,authoritySeed:r,authorityOwner:NS(i.toBuffer())}),c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:_C,isSigner:!1,isWritable:!1}];return a&&c.push({pubkey:a,isSigner:!0,isWritable:!1}),(new wC).add({keys:c,programId:this.programId,data:u})}static splitInstruction(e){const{stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:i}=e,o=UC(aT.Split,{lamports:i});return new yC({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}static split(e,t){const n=new wC;return n.add($C.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space:this.space,programId:this.programId})),n.add(this.splitInstruction(e))}static splitWithSeed(e,t){const{stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,basePubkey:o,seed:s,lamports:a}=e,u=new wC;return u.add($C.allocate({accountPubkey:i,basePubkey:o,seed:s,space:this.space,programId:this.programId})),t&&t>0&&u.add($C.transfer({fromPubkey:e.authorizedPubkey,toPubkey:i,lamports:t})),u.add(this.splitInstruction({stakePubkey:n,authorizedPubkey:r,splitStakePubkey:i,lamports:a}))}static merge(e){const{stakePubkey:t,sourceStakePubKey:n,authorizedPubkey:r}=e,i=UC(aT.Merge);return(new wC).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:BC,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:n,toPubkey:r,lamports:i,custodianPubkey:o}=e,s=UC(aT.Withdraw,{lamports:i}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:BC,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&a.push({pubkey:o,isSigner:!0,isWritable:!1}),(new wC).add({keys:a,programId:this.programId,data:s})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:n}=e,r=UC(aT.Deactivate);return(new wC).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}cT.programId=new VS("Stake11111111111111111111111111111111111111"),cT.space=200;class dT{constructor(e,t,n,r){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=t,this.authorizedWithdrawer=n,this.commission=r}}const lT=Object.freeze({InitializeAccount:{index:0,layout:Uk([Rk("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Uk([tC("nodePubkey"),tC("authorizedVoter"),tC("authorizedWithdrawer"),Bk("commission")],e)}()])},Authorize:{index:1,layout:Uk([Rk("instruction"),tC("newAuthorized"),Rk("voteAuthorizationType")])},Withdraw:{index:3,layout:Uk([Rk("instruction"),Pk("lamports")])},UpdateValidatorIdentity:{index:4,layout:Uk([Rk("instruction")])},AuthorizeWithSeed:{index:10,layout:Uk([Rk("instruction"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Uk([Rk("voteAuthorizationType"),tC("currentAuthorityDerivedKeyOwnerPubkey"),rC("currentAuthorityDerivedKeySeed"),tC("newAuthorized")],e)}()])}}),hT=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class fT{constructor(){}static initializeAccount(e){const{votePubkey:t,nodePubkey:n,voteInit:r}=e,i=UC(lT.InitializeAccount,{voteInit:{nodePubkey:NS(r.nodePubkey.toBuffer()),authorizedVoter:NS(r.authorizedVoter.toBuffer()),authorizedWithdrawer:NS(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:IC,isSigner:!1,isWritable:!1},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new yC(o)}static createAccount(e){const t=new wC;return t.add($C.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}static authorize(e){const{votePubkey:t,authorizedPubkey:n,newAuthorizedPubkey:r,voteAuthorizationType:i}=e,o=UC(lT.Authorize,{newAuthorized:NS(r.toBuffer()),voteAuthorizationType:i.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new wC).add({keys:s,programId:this.programId,data:o})}static authorizeWithSeed(e){const{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:i,voteAuthorizationType:o,votePubkey:s}=e,a=UC(lT.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:NS(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:NS(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:_C,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new wC).add({keys:u,programId:this.programId,data:a})}static withdraw(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,lamports:r,toPubkey:i}=e,o=UC(lT.Withdraw,{lamports:r}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new wC).add({keys:s,programId:this.programId,data:o})}static safeWithdraw(e,t,n){if(e.lamports>t-n)throw new Error("Withdraw will leave vote account with insufficient funds.");return fT.withdraw(e)}static updateValidatorIdentity(e){const{votePubkey:t,authorizedWithdrawerPubkey:n,nodePubkey:r}=e,i=UC(lT.UpdateValidatorIdentity),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new wC).add({keys:o,programId:this.programId,data:i})}}fT.programId=new VS("Vote111111111111111111111111111111111111111"),fT.space=3762;const pT=new VS("Va1idator1nfo111111111111111111111111111111"),gT=lI({name:cI(),website:aI(cI()),details:aI(cI()),iconUrl:aI(cI()),keybaseUsername:aI(cI())});class mT{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let t=[...e];if(2!==oC(t))return null;const n=[];for(let e=0;e<2;e++){const e=new VS(lC(t,0,HS)),r=1===dC(t);n.push({publicKey:e,isSigner:r})}if(n[0].publicKey.equals(pT)&&n[1].isSigner){const e=rC().decode($b.Buffer.from(t)),r=JSON.parse(e);return Yk(r,gT),new mT(n[1].publicKey,r)}return null}}const yT=new VS("Vote111111111111111111111111111111111111111"),wT=Uk([tC("nodePubkey"),tC("authorizedWithdrawer"),Bk("commission"),Dk(),Ok(Uk([Dk("slot"),Rk("confirmationCount")]),xk(Rk(),-8),"votes"),Bk("rootSlotValid"),Dk("rootSlot"),Dk(),Ok(Uk([Dk("epoch"),tC("authorizedVoter")]),xk(Rk(),-8),"authorizedVoters"),Uk([Ok(Uk([tC("authorizedPubkey"),Dk("epochOfLastAuthorizedSwitch"),Dk("targetEpoch")]),32,"buf"),Dk("idx"),Bk("isEmpty")],"priorVoters"),Dk(),Ok(Uk([Dk("epoch"),Dk("credits"),Dk("prevCredits")]),xk(Rk(),-8),"epochCredits"),Uk([Dk("slot"),Dk("timestamp")],"lastTimestamp")]);class vT{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const t=wT.decode(NS(e),4);let n=t.rootSlot;return t.rootSlotValid||(n=null),new vT({nodePubkey:new VS(t.nodePubkey),authorizedWithdrawer:new VS(t.authorizedWithdrawer),commission:t.commission,votes:t.votes,rootSlot:n,authorizedVoters:t.authorizedVoters.map(bT),priorVoters:AT(t.priorVoters),epochCredits:t.epochCredits,lastTimestamp:t.lastTimestamp})}}function bT(e){let{authorizedVoter:t,epoch:n}=e;return{epoch:n,authorizedVoter:new VS(t)}}function _T(e){let{authorizedPubkey:t,epochOfLastAuthorizedSwitch:n,targetEpoch:r}=e;return{authorizedPubkey:new VS(t),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function AT(e){let{buf:t,idx:n,isEmpty:r}=e;return r?[]:[...t.slice(n+1).map(_T),...t.slice(0,n).map(_T)]}const ET={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};var kT=Object.freeze({__proto__:null,Account:class{constructor(e){if(this._publicKey=void 0,this._secretKey=void 0,e){const t=NS(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=NS(OS()),this._publicKey=NS(MS(this._secretKey))}get publicKey(){return new VS(this._publicKey)}get secretKey(){return $b.Buffer.concat([this._secretKey,this._publicKey],64)}},AddressLookupTableAccount:tx,AddressLookupTableInstruction:class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Rk("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(GB))if(r.index==t){n=e;break}if(!n)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return n}static decodeCreateLookupTable(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);const{recentSlot:t}=OC(GB.CreateLookupTable,e.data);return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error(`invalid instruction; found ${e.keys.length} keys, expected at least 2`);const{addresses:t}=OC(GB.ExtendLookupTable,e.data);return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((e=>new VS(e)))}}static decodeCloseLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}static decodeFreezeLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static decodeDeactivateLookupTable(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(ZB.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},AddressLookupTableProgram:ZB,Authorized:oT,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:GS,BPF_LOADER_PROGRAM_ID:HC,BpfLoader:class{static getMinNumSignatures(e){return WC.getMinNumSignatures(e)}static load(e,t,n,r,i){return WC.load(e,t,n,i,r)}},COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:YB,ComputeBudgetInstruction:class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Bk("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(YB))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return n}static decodeRequestUnits(e){this.checkProgramId(e.programId);const{units:t,additionalFee:n}=OC(YB.RequestUnits,e.data);return{units:t,additionalFee:n}}static decodeRequestHeapFrame(e){this.checkProgramId(e.programId);const{bytes:t}=OC(YB.RequestHeapFrame,e.data);return{bytes:t}}static decodeSetComputeUnitLimit(e){this.checkProgramId(e.programId);const{units:t}=OC(YB.SetComputeUnitLimit,e.data);return{units:t}}static decodeSetComputeUnitPrice(e){this.checkProgramId(e.programId);const{microLamports:t}=OC(YB.SetComputeUnitPrice,e.data);return{microLamports:t}}static checkProgramId(e){if(!e.equals(JB.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}},ComputeBudgetProgram:JB,Connection:class{constructor(e,t){let n,r,i,o,s,a;var u;this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const e={};return async t=>{var n;const{commitment:r,config:i}=ax(t),o=this._buildArgs([],r,void 0,i),s=YC(o);return e[s]=null!==(n=e[s])&&void 0!==n?n:(async()=>{try{const e=Jk(await this._rpcRequest("getBlockHeight",o),lx(sI()));if("error"in e)throw new RC(e.error,"failed to get block height information");return e.result}finally{delete e[s]}})(),await e[s]}})(),t&&"string"==typeof t?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,n=t.wsEndpoint,r=t.httpHeaders,i=t.fetch,o=t.fetchMiddleware,s=t.disableRetryOnRateLimit,a=t.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(e),this._rpcWsEndpoint=n||function(e){const t=e.match(rx);if(null==t)throw TypeError(`Failed to validate endpoint URL \`${e}\``);const[n,r,i,o]=t,s=e.startsWith("https:")?"wss:":"ws:",a=null==i?null:parseInt(i.slice(1),10);return`${s}//${r}${null==a?"":`:${a+1}`}${o}`}(e),this._rpcClient=function(e,t,n,r,i,o){const s=n||QC;let a;null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=async(e,t)=>{const n=await new Promise(((n,i)=>{try{r(e,t,((e,t)=>n([e,t])))}catch(e){i(e)}}));return await s(...n)});const u=new GI((async(n,r)=>{const o={method:"POST",body:n,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},KB)};try{let t,n=5,u=500;for(;t=a?await a(e,o):await s(e,o),429===t.status&&!0!==i&&(n-=1,0!==n);)console.error(`Server responded with ${t.status} ${t.statusText}. Retrying after ${u}ms delay...`),await PC(u),u*=2;const c=await t.text();t.ok?r(null,c):r(new Error(`${t.status} ${t.statusText}: ${c}`))}catch(e){e instanceof Error&&r(e)}}),{});return u}(e,r,i,o,s,a),this._rpcRequest=(u=this._rpcClient,(e,t)=>new Promise(((n,r)=>{u.request(e,t,((e,t)=>{e?r(e):n(t)}))}))),this._rpcBatchRequest=function(e){return t=>new Promise(((n,r)=>{0===t.length&&n([]);const i=t.map((t=>e.request(t.methodName,t.args)));e.request(i,((e,t)=>{e?r(e):n(t)}))}))}(this._rpcClient),this._rpcWebSocket=new ex(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgs([e.toBase58()],n,void 0,r),o=Jk(await this._rpcRequest("getBalance",i),hx(sI()));if("error"in o)throw new RC(o.error,`failed to get balance for ${e.toBase58()}`);return o.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then((e=>e.value)).catch((t=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+t)}))}async getBlockTime(e){const t=Jk(await this._rpcRequest("getBlockTime",[e]),lx(oI(sI())));if("error"in t)throw new RC(t.error,`failed to get block time for slot ${e}`);return t.result}async getMinimumLedgerSlot(){const e=Jk(await this._rpcRequest("minimumLedgerSlot",[]),lx(sI()));if("error"in e)throw new RC(e.error,"failed to get minimum ledger slot");return e.result}async getFirstAvailableBlock(){const e=Jk(await this._rpcRequest("getFirstAvailableBlock",[]),Fx);if("error"in e)throw new RC(e.error,"failed to get first available block");return e.result}async getSupply(e){let t={};t="string"==typeof e?{commitment:e}:e?{...e,commitment:e&&e.commitment||this.commitment}:{commitment:this.commitment};const n=Jk(await this._rpcRequest("getSupply",[t]),Mx);if("error"in n)throw new RC(n.error,"failed to get supply");return n.result}async getTokenSupply(e,t){const n=this._buildArgs([e.toBase58()],t),r=Jk(await this._rpcRequest("getTokenSupply",n),hx(Lx));if("error"in r)throw new RC(r.error,"failed to get token supply");return r.result}async getTokenAccountBalance(e,t){const n=this._buildArgs([e.toBase58()],t),r=Jk(await this._rpcRequest("getTokenAccountBalance",n),hx(Lx));if("error"in r)throw new RC(r.error,"failed to get token account balance");return r.result}async getTokenAccountsByOwner(e,t,n){const{commitment:r,config:i}=ax(n);let o=[e.toBase58()];"mint"in t?o.push({mint:t.mint.toBase58()}):o.push({programId:t.programId.toBase58()});const s=this._buildArgs(o,r,"base64",i),a=Jk(await this._rpcRequest("getTokenAccountsByOwner",s),zx);if("error"in a)throw new RC(a.error,`failed to get token accounts owned by account ${e.toBase58()}`);return a.result}async getParsedTokenAccountsByOwner(e,t,n){let r=[e.toBase58()];"mint"in t?r.push({mint:t.mint.toBase58()}):r.push({programId:t.programId.toBase58()});const i=this._buildArgs(r,n,"jsonParsed"),o=Jk(await this._rpcRequest("getTokenAccountsByOwner",i),jx);if("error"in o)throw new RC(o.error,`failed to get token accounts owned by account ${e.toBase58()}`);return o.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},n=t.filter||t.commitment?[t]:[],r=Jk(await this._rpcRequest("getLargestAccounts",n),$x);if("error"in r)throw new RC(r.error,"failed to get largest accounts");return r.result}async getTokenLargestAccounts(e,t){const n=this._buildArgs([e.toBase58()],t),r=Jk(await this._rpcRequest("getTokenLargestAccounts",n),qx);if("error"in r)throw new RC(r.error,"failed to get token largest accounts");return r.result}async getAccountInfoAndContext(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgs([e.toBase58()],n,"base64",r),o=Jk(await this._rpcRequest("getAccountInfo",i),hx(oI(Wx)));if("error"in o)throw new RC(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getParsedAccountInfo(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgs([e.toBase58()],n,"jsonParsed",r),o=Jk(await this._rpcRequest("getAccountInfo",i),hx(oI(Vx)));if("error"in o)throw new RC(o.error,`failed to get info about account ${e.toBase58()}`);return o.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(t){throw new Error("failed to get info about account "+e.toBase58()+": "+t)}}async getMultipleParsedAccounts(e,t){const{commitment:n,config:r}=ax(t),i=e.map((e=>e.toBase58())),o=this._buildArgs([i],n,"jsonParsed",r),s=Jk(await this._rpcRequest("getMultipleAccounts",o),hx(tI(oI(Vx))));if("error"in s)throw new RC(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfoAndContext(e,t){const{commitment:n,config:r}=ax(t),i=e.map((e=>e.toBase58())),o=this._buildArgs([i],n,"base64",r),s=Jk(await this._rpcRequest("getMultipleAccounts",o),hx(tI(oI(Wx))));if("error"in s)throw new RC(s.error,`failed to get info for accounts ${i}`);return s.result}async getMultipleAccountsInfo(e,t){return(await this.getMultipleAccountsInfoAndContext(e,t)).value}async getStakeActivation(e,t,n){const{commitment:r,config:i}=ax(t),o=this._buildArgs([e.toBase58()],r,void 0,{...i,epoch:null!=n?n:null==i?void 0:i.epoch}),s=Jk(await this._rpcRequest("getStakeActivation",o),lx(Zx));if("error"in s)throw new RC(s.error,`failed to get Stake Activation ${e.toBase58()}`);return s.result}async getProgramAccounts(e,t){const{commitment:n,config:r}=ax(t),{encoding:i,...o}=r||{},s=this._buildArgs([e.toBase58()],n,i||"base64",{...o,...o.filters?{filters:ux(o.filters)}:null}),a=await this._rpcRequest("getProgramAccounts",s),u=tI(Hx),c=!0===o.withContext?Jk(a,hx(u)):Jk(a,lx(u));if("error"in c)throw new RC(c.error,`failed to get accounts owned by program ${e.toBase58()}`);return c.result}async getParsedProgramAccounts(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgs([e.toBase58()],n,"jsonParsed",r),o=Jk(await this._rpcRequest("getProgramAccounts",i),lx(tI(Gx)));if("error"in o)throw new RC(o.error,`failed to get accounts owned by program ${e.toBase58()}`);return o.result}async confirmTransaction(e,t){let n,r;if("string"==typeof e)n=e;else{var i;const t=e;if(null!==(i=t.abortSignal)&&void 0!==i&&i.aborted)return Promise.reject(t.abortSignal.reason);n=t.signature}try{r=nE.decode(n)}catch(e){throw new Error("signature must be base58 encoded: "+n)}return aC(64===r.length,"signature has invalid length"),"string"==typeof e?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:n}):"lastValidBlockHeight"in e?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:e}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:e})}getCancellationPromise(e){return new Promise(((t,n)=>{null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(()=>{n(e.reason)})))}))}getTransactionConfirmationPromise(e){let t,n,{commitment:r,signature:i}=e,o=!1;const s=new Promise(((e,s)=>{try{t=this.onSignature(i,((n,r)=>{t=void 0;const i={context:r,value:n};e({__type:gC.PROCESSED,response:i})}),r);const a=new Promise((e=>{null==t?e():n=this._onSubscriptionStateChange(t,(t=>{"subscribed"===t&&e()}))}));(async()=>{if(await a,o)return;const t=await this.getSignatureStatus(i);if(o)return;if(null==t)return;const{context:n,value:u}=t;if(null!=u)if(null!=u&&u.err)s(u.err);else{switch(r){case"confirmed":case"single":case"singleGossip":if("processed"===u.confirmationStatus)return;break;case"finalized":case"max":case"root":if("processed"===u.confirmationStatus||"confirmed"===u.confirmationStatus)return}o=!0,e({__type:gC.PROCESSED,response:{context:n,value:u}})}})()}catch(e){s(e)}}));return{abortConfirmation:()=>{n&&(n(),n=void 0),null!=t&&(this.removeSignatureListener(t),t=void 0)},confirmationPromise:s}}async confirmTransactionUsingBlockHeightExceedanceStrategy(e){let{commitment:t,strategy:{abortSignal:n,lastValidBlockHeight:r,signature:i}}=e,o=!1;const s=new Promise((e=>{const n=async()=>{try{return await this.getBlockHeight(t)}catch(e){return-1}};(async()=>{let t=await n();if(!o){for(;t<=r;){if(await PC(1e3),o)return;if(t=await n(),o)return}e({__type:gC.BLOCKHEIGHT_EXCEEDED})}})()})),{abortConfirmation:a,confirmationPromise:u}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),c=this.getCancellationPromise(n);let d;try{const e=await Promise.race([c,u,s]);if(e.__type!==gC.PROCESSED)throw new JS(i);d=e.response}finally{o=!0,a()}return d}async confirmTransactionUsingDurableNonceStrategy(e){let{commitment:t,strategy:{abortSignal:n,minContextSlot:r,nonceAccountPubkey:i,nonceValue:o,signature:s}}=e,a=!1;const u=new Promise((e=>{let n=o,s=null;const u=async()=>{try{const{context:e,value:n}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:r});return s=e.slot,null==n?void 0:n.nonce}catch(e){return n}};(async()=>{if(n=await u(),!a)for(;;){if(o!==n)return void e({__type:gC.NONCE_INVALID,slotInWhichNonceDidAdvance:s});if(await PC(2e3),a)return;if(n=await u(),a)return}})()})),{abortConfirmation:c,confirmationPromise:d}=this.getTransactionConfirmationPromise({commitment:t,signature:s}),l=this.getCancellationPromise(n);let h;try{const e=await Promise.race([l,d,u]);if(e.__type===gC.PROCESSED)h=e.response;else{var f;let n;for(;;){var p;const t=await this.getSignatureStatus(s);if(null==t)break;if(!(t.context.slot<(null!==(p=e.slotInWhichNonceDidAdvance)&&void 0!==p?p:r))){n=t;break}await PC(400)}if(null===(f=n)||void 0===f||!f.value)throw new QS(s);{const e=t||"finalized",{confirmationStatus:r}=n.value;switch(e){case"processed":case"recent":if("processed"!==r&&"confirmed"!==r&&"finalized"!==r)throw new QS(s);break;case"confirmed":case"single":case"singleGossip":if("confirmed"!==r&&"finalized"!==r)throw new QS(s);break;case"finalized":case"max":case"root":if("finalized"!==r)throw new QS(s)}h={context:n.context,value:{err:n.value.err}}}}}finally{a=!0,c()}return h}async confirmTransactionUsingLegacyTimeoutStrategy(e){let t,{commitment:n,signature:r}=e;const i=new Promise((e=>{let r=this._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":r=this._confirmTransactionInitialTimeout||3e4}t=setTimeout((()=>e({__type:gC.TIMED_OUT,timeoutMs:r})),r)})),{abortConfirmation:o,confirmationPromise:s}=this.getTransactionConfirmationPromise({commitment:n,signature:r});let a;try{const e=await Promise.race([s,i]);if(e.__type!==gC.PROCESSED)throw new XS(r,e.timeoutMs/1e3);a=e.response}finally{clearTimeout(t),o()}return a}async getClusterNodes(){const e=Jk(await this._rpcRequest("getClusterNodes",[]),lx(tI(aB)));if("error"in e)throw new RC(e.error,"failed to get cluster nodes");return e.result}async getVoteAccounts(e){const t=this._buildArgs([],e),n=Jk(await this._rpcRequest("getVoteAccounts",t),cB);if("error"in n)throw new RC(n.error,"failed to get vote accounts");return n.result}async getSlot(e){const{commitment:t,config:n}=ax(e),r=this._buildArgs([],t,void 0,n),i=Jk(await this._rpcRequest("getSlot",r),lx(sI()));if("error"in i)throw new RC(i.error,"failed to get slot");return i.result}async getSlotLeader(e){const{commitment:t,config:n}=ax(e),r=this._buildArgs([],t,void 0,n),i=Jk(await this._rpcRequest("getSlotLeader",r),lx(cI()));if("error"in i)throw new RC(i.error,"failed to get slot leader");return i.result}async getSlotLeaders(e,t){const n=[e,t],r=Jk(await this._rpcRequest("getSlotLeaders",n),lx(tI(ix)));if("error"in r)throw new RC(r.error,"failed to get slot leaders");return r.result}async getSignatureStatus(e,t){const{context:n,value:r}=await this.getSignatureStatuses([e],t);aC(1===r.length);return{context:n,value:r[0]}}async getSignatureStatuses(e,t){const n=[e];t&&n.push(t);const r=Jk(await this._rpcRequest("getSignatureStatuses",n),hB);if("error"in r)throw new RC(r.error,"failed to get signature status");return r.result}async getTransactionCount(e){const{commitment:t,config:n}=ax(e),r=this._buildArgs([],t,void 0,n),i=Jk(await this._rpcRequest("getTransactionCount",r),lx(sI()));if("error"in i)throw new RC(i.error,"failed to get transaction count");return i.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),n=Jk(await this._rpcRequest("getInflationGovernor",t),Tx);if("error"in n)throw new RC(n.error,"failed to get inflation");return n.result}async getInflationReward(e,t,n){const{commitment:r,config:i}=ax(n),o=this._buildArgs([e.map((e=>e.toBase58()))],r,void 0,{...i,epoch:null!=t?t:null==i?void 0:i.epoch}),s=Jk(await this._rpcRequest("getInflationReward",o),mx);if("error"in s)throw new RC(s.error,"failed to get inflation reward");return s.result}async getInflationRate(){const e=Jk(await this._rpcRequest("getInflationRate",[]),Rx);if("error"in e)throw new RC(e.error,"failed to get inflation rate");return e.result}async getEpochInfo(e){const{commitment:t,config:n}=ax(e),r=this._buildArgs([],t,void 0,n),i=Jk(await this._rpcRequest("getEpochInfo",r),Px);if("error"in i)throw new RC(i.error,"failed to get epoch info");return i.result}async getEpochSchedule(){const e=Jk(await this._rpcRequest("getEpochSchedule",[]),Ux);if("error"in e)throw new RC(e.error,"failed to get epoch schedule");const t=e.result;return new XC(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){const e=Jk(await this._rpcRequest("getLeaderSchedule",[]),Ox);if("error"in e)throw new RC(e.error,"failed to get leader schedule");return e.result}async getMinimumBalanceForRentExemption(e,t){const n=this._buildArgs([e],t),r=Jk(await this._rpcRequest("getMinimumBalanceForRentExemption",n),fB);return"error"in r?(console.warn("Unable to fetch minimum balance for rent exemption"),0):r.result}async getRecentBlockhashAndContext(e){const{context:t,value:{blockhash:n}}=await this.getLatestBlockhashAndContext(e);return{context:t,value:{blockhash:n,feeCalculator:{get lamportsPerSignature(){throw new Error("The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee for a given message.")},toJSON:()=>({})}}}}async getRecentPerformanceSamples(e){const t=Jk(await this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]),zB);if("error"in t)throw new RC(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(e,t){const n=this._buildArgs([e],t),r=Jk(await this._rpcRequest("getFeeCalculatorForBlockhash",n),NB);if("error"in r)throw new RC(r.error,"failed to get fee calculator");const{context:i,value:o}=r.result;return{context:i,value:null!==o?o.feeCalculator:null}}async getFeeForMessage(e,t){const n=NS(e.serialize()).toString("base64"),r=this._buildArgs([n],t),i=Jk(await this._rpcRequest("getFeeForMessage",r),hx(oI(sI())));if("error"in i)throw new RC(i.error,"failed to get fee for message");if(null===i.result)throw new Error("invalid blockhash");return i.result}async getRecentPrioritizationFees(e){var t;const n=null==e||null===(t=e.lockedWritableAccounts)||void 0===t?void 0:t.map((e=>e.toBase58())),r=null!=n&&n.length?[n]:[],i=Jk(await this._rpcRequest("getRecentPrioritizationFees",r),Dx);if("error"in i)throw new RC(i.error,"failed to get recent prioritization fees");return i.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhash(e){try{return(await this.getLatestBlockhashAndContext(e)).value}catch(e){throw new Error("failed to get recent blockhash: "+e)}}async getLatestBlockhashAndContext(e){const{commitment:t,config:n}=ax(e),r=this._buildArgs([],t,void 0,n),i=Jk(await this._rpcRequest("getLatestBlockhash",r),LB);if("error"in i)throw new RC(i.error,"failed to get latest blockhash");return i.result}async isBlockhashValid(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgs([e],n,void 0,r),o=Jk(await this._rpcRequest("isBlockhashValid",i),qB);if("error"in o)throw new RC(o.error,"failed to determine if the blockhash `"+e+"`is valid");return o.result}async getVersion(){const e=Jk(await this._rpcRequest("getVersion",[]),lx(Ix));if("error"in e)throw new RC(e.error,"failed to get version");return e.result}async getGenesisHash(){const e=Jk(await this._rpcRequest("getGenesisHash",[]),lx(cI()));if("error"in e)throw new RC(e.error,"failed to get genesis hash");return e.result}async getBlock(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgsAtLeastConfirmed([e],n,void 0,r),o=await this._rpcRequest("getBlock",i);try{switch(null==r?void 0:r.transactionDetails){case"accounts":{const e=Jk(o,TB);if("error"in e)throw e.error;return e.result}case"none":{const e=Jk(o,BB);if("error"in e)throw e.error;return e.result}default:{const e=Jk(o,xB);if("error"in e)throw e.error;const{result:t}=e;return t?{...t,transactions:t.transactions.map((e=>{let{transaction:t,meta:n,version:r}=e;return{meta:n,transaction:{...t,message:px(r,t.message)},version:r}}))}:null}}}catch(e){throw new RC(e,"failed to get confirmed block")}}async getParsedBlock(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),o=await this._rpcRequest("getBlock",i);try{switch(null==r?void 0:r.transactionDetails){case"accounts":{const e=Jk(o,DB);if("error"in e)throw e.error;return e.result}case"none":{const e=Jk(o,PB);if("error"in e)throw e.error;return e.result}default:{const e=Jk(o,RB);if("error"in e)throw e.error;return e.result}}}catch(e){throw new RC(e,"failed to get block")}}async getBlockProduction(e){let t,n;if("string"==typeof e)n=e;else if(e){const{commitment:r,...i}=e;n=r,t=i}const r=this._buildArgs([],n,"base64",t),i=Jk(await this._rpcRequest("getBlockProduction",r),Bx);if("error"in i)throw new RC(i.error,"failed to get block production information");return i.result}async getTransaction(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgsAtLeastConfirmed([e],n,void 0,r),o=Jk(await this._rpcRequest("getTransaction",i),FB);if("error"in o)throw new RC(o.error,"failed to get transaction");const s=o.result;return s?{...s,transaction:{...s.transaction,message:px(s.version,s.transaction.message)}}:s}async getParsedTransaction(e,t){const{commitment:n,config:r}=ax(t),i=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r),o=Jk(await this._rpcRequest("getTransaction",i),MB);if("error"in o)throw new RC(o.error,"failed to get transaction");return o.result}async getParsedTransactions(e,t){const{commitment:n,config:r}=ax(t),i=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,"jsonParsed",r)})));return(await this._rpcBatchRequest(i)).map((e=>{const t=Jk(e,MB);if("error"in t)throw new RC(t.error,"failed to get transactions");return t.result}))}async getTransactions(e,t){const{commitment:n,config:r}=ax(t),i=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],n,void 0,r)})));return(await this._rpcBatchRequest(i)).map((e=>{const t=Jk(e,FB);if("error"in t)throw new RC(t.error,"failed to get transactions");const n=t.result;return n?{...n,transaction:{...n.transaction,message:px(n.version,n.transaction.message)}}:n}))}async getConfirmedBlock(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=Jk(await this._rpcRequest("getBlock",n),UB);if("error"in r)throw new RC(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+e+" not found");const o={...i,transactions:i.transactions.map((e=>{let{transaction:t,meta:n}=e;const r=new hC(t.message);return{meta:n,transaction:{...t,message:r}}}))};return{...o,transactions:o.transactions.map((e=>{let{transaction:t,meta:n}=e;return{meta:n,transaction:wC.populate(t.message,t.signatures)}}))}}async getBlocks(e,t,n){const r=this._buildArgsAtLeastConfirmed(void 0!==t?[e,t]:[e],n),i=Jk(await this._rpcRequest("getBlocks",r),lx(tI(sI())));if("error"in i)throw new RC(i.error,"failed to get blocks");return i.result}async getBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=Jk(await this._rpcRequest("getBlock",n),OB);if("error"in r)throw new RC(r.error,"failed to get block");const i=r.result;if(!i)throw new Error("Block "+e+" not found");return i}async getConfirmedBlockSignatures(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),r=Jk(await this._rpcRequest("getBlock",n),OB);if("error"in r)throw new RC(r.error,"failed to get confirmed block");const i=r.result;if(!i)throw new Error("Confirmed block "+e+" not found");return i}async getConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t),r=Jk(await this._rpcRequest("getTransaction",n),FB);if("error"in r)throw new RC(r.error,"failed to get transaction");const i=r.result;if(!i)return i;const o=new hC(i.transaction.message),s=i.transaction.signatures;return{...i,transaction:wC.populate(o,s)}}async getParsedConfirmedTransaction(e,t){const n=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),r=Jk(await this._rpcRequest("getTransaction",n),MB);if("error"in r)throw new RC(r.error,"failed to get confirmed transaction");return r.result}async getParsedConfirmedTransactions(e,t){const n=e.map((e=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([e],t,"jsonParsed")})));return(await this._rpcBatchRequest(n)).map((e=>{const t=Jk(e,MB);if("error"in t)throw new RC(t.error,"failed to get confirmed transactions");return t.result}))}async getConfirmedSignaturesForAddress(e,t,n){let r={},i=await this.getFirstAvailableBlock();for(;!("until"in r)&&!(--t<=0||t<i);)try{const e=await this.getConfirmedBlockSignatures(t,"finalized");e.signatures.length>0&&(r.until=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}let o=await this.getSlot("finalized");for(;!("before"in r||++n>o);)try{const e=await this.getConfirmedBlockSignatures(n);e.signatures.length>0&&(r.before=e.signatures[e.signatures.length-1].toString())}catch(e){if(e instanceof Error&&e.message.includes("skipped"))continue;throw e}return(await this.getConfirmedSignaturesForAddress2(e,r)).map((e=>e.signature))}async getConfirmedSignaturesForAddress2(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),i=Jk(await this._rpcRequest("getConfirmedSignaturesForAddress2",r),Yx);if("error"in i)throw new RC(i.error,"failed to get confirmed signatures for address");return i.result}async getSignaturesForAddress(e,t,n){const r=this._buildArgsAtLeastConfirmed([e.toBase58()],n,void 0,t),i=Jk(await this._rpcRequest("getSignaturesForAddress",r),Jx);if("error"in i)throw new RC(i.error,"failed to get signatures for address");return i.result}async getAddressLookupTable(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==r&&(i=new tx({key:e,state:tx.deserialize(r.data)})),{context:n,value:i}}async getNonceAndContext(e,t){const{context:n,value:r}=await this.getAccountInfoAndContext(e,t);let i=null;return null!==r&&(i=qC.fromAccountData(r.data)),{context:n,value:i}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then((e=>e.value)).catch((t=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}))}async requestAirdrop(e,t){const n=Jk(await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),jB);if("error"in n)throw new RC(n.error,`airdrop to ${e.toBase58()} failed`);return n.result}async _blockhashWithExpiryBlockHeight(e){if(!e){for(;this._pollingBlockhash;)await PC(100);const e=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(null!==this._blockhashInfo.latestBlockhash&&!e)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now(),t=this._blockhashInfo.latestBlockhash,n=t?t.blockhash:null;for(let e=0;e<50;e++){const e=await this.getLatestBlockhash("finalized");if(n!==e.blockhash)return this._blockhashInfo={latestBlockhash:e,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e;await PC(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(e){const{commitment:t,config:n}=ax(e),r=this._buildArgs([],t,"base64",n),i=Jk(await this._rpcRequest("getStakeMinimumDelegation",r),hx(sI()));if("error"in i)throw new RC(i.error,"failed to get stake minimum delegation");return i.result}async simulateTransaction(e,t,n){if("message"in e){const r=e.serialize(),i=$b.Buffer.from(r).toString("base64");if(Array.isArray(t)||void 0!==n)throw new Error("Invalid arguments");const o=t||{};o.encoding="base64","commitment"in o||(o.commitment=this.commitment),t&&"object"==typeof t&&"innerInstructions"in t&&(o.innerInstructions=t.innerInstructions);const s=[i,o],a=Jk(await this._rpcRequest("simulateTransaction",s),xx);if("error"in a)throw new Error("failed to simulate transaction: "+a.error.message);return a.result}let r;if(e instanceof wC){let t=e;r=new wC,r.feePayer=t.feePayer,r.instructions=e.instructions,r.nonceInfo=t.nonceInfo,r.signatures=t.signatures}else r=wC.populate(e),r._message=r._json=void 0;if(void 0!==t&&!Array.isArray(t))throw new Error("Invalid arguments");const i=t;if(r.nonceInfo&&i)r.sign(...i);else{let e=this._disableBlockhashCaching;for(;;){const t=await this._blockhashWithExpiryBlockHeight(e);if(r.lastValidBlockHeight=t.lastValidBlockHeight,r.recentBlockhash=t.blockhash,!i)break;if(r.sign(...i),!r.signature)throw new Error("!signature");const n=r.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(n)&&!this._blockhashInfo.transactionSignatures.includes(n)){this._blockhashInfo.simulatedSignatures.push(n);break}e=!0}}const o=r._compile(),s=o.serialize(),a=r._serialize(s).toString("base64"),u={encoding:"base64",commitment:this.commitment};if(n){const e=(Array.isArray(n)?n:o.nonProgramIds()).map((e=>e.toBase58()));u.accounts={encoding:"base64",addresses:e}}i&&(u.sigVerify=!0),t&&"object"==typeof t&&"innerInstructions"in t&&(u.innerInstructions=t.innerInstructions);const c=[a,u],d=Jk(await this._rpcRequest("simulateTransaction",c),xx);if("error"in d){let e;if("data"in d.error&&(e=d.error.data.logs,e&&Array.isArray(e))){const t="\n ",n=t+e.join(t);console.error(d.error.message,n)}throw new TC({action:"simulate",signature:"",transactionMessage:d.error.message,logs:e})}return d.result}async sendTransaction(e,t,n){if("version"in e){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const n=e.serialize();return await this.sendRawTransaction(n,t)}if(void 0===t||!Array.isArray(t))throw new Error("Invalid arguments");const r=t;if(e.nonceInfo)e.sign(...r);else{let t=this._disableBlockhashCaching;for(;;){const n=await this._blockhashWithExpiryBlockHeight(t);if(e.lastValidBlockHeight=n.lastValidBlockHeight,e.recentBlockhash=n.blockhash,e.sign(...r),!e.signature)throw new Error("!signature");const i=e.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(i)){this._blockhashInfo.transactionSignatures.push(i);break}t=!0}}const i=e.serialize();return await this.sendRawTransaction(i,n)}async sendRawTransaction(e,t){const n=NS(e).toString("base64");return await this.sendEncodedTransaction(n,t)}async sendEncodedTransaction(e,t){const n={encoding:"base64"},r=t&&t.skipPreflight,i=!0===r?"processed":t&&t.preflightCommitment||this.commitment;t&&null!=t.maxRetries&&(n.maxRetries=t.maxRetries),t&&null!=t.minContextSlot&&(n.minContextSlot=t.minContextSlot),r&&(n.skipPreflight=r),i&&(n.preflightCommitment=i);const o=[e,n],s=Jk(await this._rpcRequest("sendTransaction",o),$B);if("error"in s){let e;throw"data"in s.error&&(e=s.error.data.logs),new TC({action:r?"send":"simulate",signature:"",transactionMessage:s.error.message,logs:e})}return s.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()}),5e3),this._updateSubscriptions()}_wsOnError(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}_wsOnClose(e){this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((e=>{let[t,n]=e;this._setSubscription(t,{...n,state:"pending"})}))):this._updateSubscriptions()}_setSubscription(e,t){var n;const r=null===(n=this._subscriptionsByHash[e])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[e]=t,r!==t.state){const n=this._subscriptionStateChangeCallbacksByHash[e];n&&n.forEach((e=>{try{e(t.state)}catch{}}))}}_onSubscriptionStateChange(e,t){var n;const r=this._subscriptionHashByClientSubscriptionId[e];if(null==r)return()=>{};const i=(n=this._subscriptionStateChangeCallbacksByHash)[r]||(n[r]=new Set);return i.add(t),()=>{i.delete(t),0===i.size&&delete this._subscriptionStateChangeCallbacksByHash[r]}}async _updateSubscriptions(){if(0===Object.keys(this._subscriptionsByHash).length)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}}),500)));if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const e=this._rpcWebSocketGeneration,t=()=>e===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map((async e=>{const n=this._subscriptionsByHash[e];if(void 0!==n)switch(n.state){case"pending":case"unsubscribed":if(0===n.callbacks.size)return delete this._subscriptionsByHash[e],"unsubscribed"===n.state&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:r,method:i}=n;try{this._setSubscription(e,{...n,state:"subscribing"});const t=await this._rpcWebSocket.call(i,r);this._setSubscription(e,{...n,serverSubscriptionId:t,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[t]=n.callbacks,await this._updateSubscriptions()}catch(o){if(console.error(`Received ${o instanceof Error?"":"JSON-RPC "}error calling \`${i}\``,{args:r,error:o}),!t())return;this._setSubscription(e,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":0===n.callbacks.size&&await(async()=>{const{serverSubscriptionId:r,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(r))this._subscriptionsAutoDisposedByRpc.delete(r);else{this._setSubscription(e,{...n,state:"unsubscribing"}),this._setSubscription(e,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[r])}catch(r){if(r instanceof Error&&console.error(`${i} error:`,r.message),!t())return;return this._setSubscription(e,{...n,state:"subscribed"}),void await this._updateSubscriptions()}}this._setSubscription(e,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}})))}_handleServerNotification(e,t){const n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach((e=>{try{e(...t)}catch(e){console.error(e)}}))}_wsOnAccountNotification(e){const{result:t,subscription:n}=Jk(e,Xx);this._handleServerNotification(n,[t.value,t.context])}_makeSubscription(e,t){const n=this._nextClientSubscriptionId++,r=YC([e.method,t]),i=this._subscriptionsByHash[r];return void 0===i?this._subscriptionsByHash[r]={...e,args:t,callbacks:new Set([e.callback]),state:"pending"}:i.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[n]=r,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const t=this._subscriptionsByHash[r];aC(void 0!==t,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),t.callbacks.delete(e.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(e,t,n){const{commitment:r,config:i}=ax(n),o=this._buildArgs([e.toBase58()],r||this._commitment||"finalized","base64",i);return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},o)}async removeAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"account change")}_wsOnProgramAccountNotification(e){const{result:t,subscription:n}=Jk(e,eB);this._handleServerNotification(n,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(e,t,n,r){const{commitment:i,config:o}=ax(n),s=this._buildArgs([e.toBase58()],i||this._commitment||"finalized","base64",o||(r?{filters:ux(r)}:void 0));return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(e){await this._unsubscribeClientSubscription(e,"program account change")}onLogs(e,t,n){const r=this._buildArgs(["object"==typeof e?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}async removeOnLogsListener(e){await this._unsubscribeClientSubscription(e,"logs")}_wsOnLogsNotification(e){const{result:t,subscription:n}=Jk(e,HB);this._handleServerNotification(n,[t.value,t.context])}_wsOnSlotNotification(e){const{result:t,subscription:n}=Jk(e,nB);this._handleServerNotification(n,[t])}onSlotChange(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(e){await this._unsubscribeClientSubscription(e,"slot change")}_wsOnSlotUpdatesNotification(e){const{result:t,subscription:n}=Jk(e,iB);this._handleServerNotification(n,[t])}onSlotUpdate(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(e){await this._unsubscribeClientSubscription(e,"slot update")}async _unsubscribeClientSubscription(e,t){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[e];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${e}\` for '${t}' events could not be found.`)}_buildArgs(e,t,n,r){const i=t||this._commitment;if(i||n||r){let t={};n&&(t.encoding=n),i&&(t.commitment=i),r&&(t=Object.assign(t,r)),e.push(t)}return e}_buildArgsAtLeastConfirmed(e,t,n,r){const i=t||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,n,r)}_wsOnSignatureNotification(e){const{result:t,subscription:n}=Jk(e,oB);"receivedSignature"!==t.value&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,"receivedSignature"===t.value?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(e,t,n){const r=this._buildArgs([e],n||this._commitment||"finalized"),i=this._makeSubscription({callback:(e,n)=>{if("status"===e.type){t(e.result,n);try{this.removeSignatureListener(i)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},r);return i}onSignatureWithOptions(e,t,n){const{commitment:r,...i}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([e],r,void 0,i),s=this._makeSubscription({callback:(e,n)=>{t(e,n);try{this.removeSignatureListener(s)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return s}async removeSignatureListener(e){await this._unsubscribeClientSubscription(e,"signature result")}_wsOnRootNotification(e){const{result:t,subscription:n}=Jk(e,sB);this._handleServerNotification(n,[t])}onRootChange(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(e){await this._unsubscribeClientSubscription(e,"root change")}},Ed25519Program:QB,Enum:class extends jS{constructor(e){if(super(e),this.enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");Object.keys(e).map((e=>{this.enum=e}))}},EpochSchedule:XC,FeeCalculatorLayout:FC,Keypair:VB,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:GB,Loader:WC,Lockup:sT,MAX_SEED_LENGTH:32,Message:hC,MessageAccountKeys:eC,MessageV0:fC,NONCE_ACCOUNT_LENGTH:LC,NonceAccount:qC,PACKET_DATA_SIZE:ZS,PUBLIC_KEY_LENGTH:HS,PublicKey:VS,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:$S,STAKE_CONFIG_ID:iT,STAKE_INSTRUCTION_LAYOUTS:aT,SYSTEM_INSTRUCTION_LAYOUTS:jC,SYSVAR_CLOCK_PUBKEY:_C,SYSVAR_EPOCH_SCHEDULE_PUBKEY:AC,SYSVAR_INSTRUCTIONS_PUBKEY:EC,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:kC,SYSVAR_RENT_PUBKEY:IC,SYSVAR_REWARDS_PUBKEY:SC,SYSVAR_SLOT_HASHES_PUBKEY:CC,SYSVAR_SLOT_HISTORY_PUBKEY:xC,SYSVAR_STAKE_HISTORY_PUBKEY:BC,Secp256k1Program:nT,SendTransactionError:TC,SolanaJSONRPCError:RC,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:uT,StakeInstruction:class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Rk("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(aT))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:n}=OC(aT.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new oT(new VS(t.staker),new VS(t.withdrawer)),lockup:new sT(n.unixTimestamp,n.epoch,new VS(n.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),OC(aT.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,stakeAuthorizationType:n}=OC(aT.Authorize,e.data),r={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new VS(t),stakeAuthorizationType:{index:n}};return e.keys.length>3&&(r.custodianPubkey=e.keys[3].pubkey),r}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:n,authoritySeed:r,authorityOwner:i}=OC(aT.AuthorizeWithSeed,e.data),o={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:r,authorityOwner:new VS(i),newAuthorizedPubkey:new VS(t),stakeAuthorizationType:{index:n}};return e.keys.length>3&&(o.custodianPubkey=e.keys[3].pubkey),o}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=OC(aT.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),OC(aT.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=OC(aT.Withdraw,e.data),n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),OC(aT.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(cT.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},StakeProgram:cT,Struct:jS,SystemInstruction:class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Rk("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(jC))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t,space:n,programId:r}=OC(jC.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:n,programId:new VS(r)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=OC(jC.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t,seed:n,programId:r}=OC(jC.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:t,seed:n,programId:new VS(r)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=OC(jC.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:n,space:r,programId:i}=OC(jC.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new VS(t),seed:n,space:r,programId:new VS(i)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=OC(jC.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new VS(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:n,programId:r}=OC(jC.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new VS(t),seed:n,programId:new VS(r)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:n,lamports:r,space:i,programId:o}=OC(jC.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new VS(t),seed:n,lamports:r,space:i,programId:new VS(o)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=OC(jC.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new VS(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),OC(jC.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=OC(jC.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t}=OC(jC.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new VS(t)}}static checkProgramId(e){if(!e.equals($C.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},SystemProgram:$C,Transaction:wC,TransactionExpiredBlockheightExceededError:JS,TransactionExpiredNonceInvalidError:QS,TransactionExpiredTimeoutError:XS,TransactionInstruction:yC,TransactionMessage:vC,TransactionStatus:gC,VALIDATOR_INFO_KEY:pT,VERSION_PREFIX_MASK:YS,VOTE_PROGRAM_ID:yT,ValidatorInfo:mT,VersionedMessage:pC,VersionedTransaction:bC,VoteAccount:vT,VoteAuthorizationLayout:hT,VoteInit:dT,VoteInstruction:class{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const t=Rk("instruction").decode(e.data);let n;for(const[e,r]of Object.entries(lT))if(r.index==t){n=e;break}if(!n)throw new Error("Instruction type incorrect; not a VoteInstruction");return n}static decodeInitializeAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);const{voteInit:t}=OC(lT.InitializeAccount,e.data);return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new dT(new VS(t.nodePubkey),new VS(t.authorizedVoter),new VS(t.authorizedWithdrawer),t.commission)}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,voteAuthorizationType:n}=OC(lT.Authorize,e.data);return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new VS(t),voteAuthorizationType:{index:n}}}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:t,currentAuthorityDerivedKeySeed:n,newAuthorized:r,voteAuthorizationType:i}}=OC(lT.AuthorizeWithSeed,e.data);return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new VS(t),currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:new VS(r),voteAuthorizationType:{index:i},votePubkey:e.keys[0].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=OC(lT.Withdraw,e.data);return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}static checkProgramId(e){if(!e.equals(fT.programId))throw new Error("invalid instruction; programId is not VoteProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}},VoteProgram:fT,clusterApiUrl:function(e,t){const n=!1===t?"http":"https";if(!e)return ET[n].devnet;const r=ET[n][e];if(!r)throw new Error(`Unknown ${n} cluster: ${e}`);return r},sendAndConfirmRawTransaction:async function(e,t,n,r){let i,o;n&&Object.prototype.hasOwnProperty.call(n,"lastValidBlockHeight")||n&&Object.prototype.hasOwnProperty.call(n,"nonceValue")?(i=n,o=r):o=n;const s=o&&{skipPreflight:o.skipPreflight,preflightCommitment:o.preflightCommitment||o.commitment,minContextSlot:o.minContextSlot},a=await e.sendRawTransaction(t,s),u=o&&o.commitment,c=i?e.confirmTransaction(i,u):e.confirmTransaction(a,u),d=(await c).value;if(d.err){if(null!=a)throw new TC({action:null!=s&&s.skipPreflight?"send":"simulate",signature:a,transactionMessage:`Status: (${JSON.stringify(d)})`});throw new Error(`Raw transaction ${a} failed (${JSON.stringify(d)})`)}return a},sendAndConfirmTransaction:DC});const IT=Tf.union([Tf.string().transform(((e,t)=>{try{return new VS(e)}catch(e){t.addIssue({code:Tf.ZodIssueCode.custom,message:e instanceof Error?e.message:"Invalid PublicKey input"})}return Tf.NEVER})),Tf.custom((e=>e instanceof VS))]),ST=Tf.enum(["wAUDIO","USDC"]),CT=Tf.union([ST,IT]);Tf.object({transaction:Tf.custom(),confirmationOptions:Tf.object({strategy:Tf.union([Tf.object({blockhash:Tf.string(),lastValidBlockHeight:Tf.number()}),Tf.object({minContextSlot:Tf.number(),nonceAccountPubkey:IT,nonceValue:Tf.string()})]).optional(),commitment:Tf.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional()}).optional(),sendOptions:Tf.custom().optional()}).strict(),Tf.object({name:Tf.string().min(1,"Name is required"),symbol:Tf.string().min(1,"Symbol is required"),description:Tf.string().min(1,"Description is required"),walletPublicKey:IT,initialBuyAmountAudio:Tf.string().optional(),image:Tf.custom((e=>e instanceof Blob),"Image file is required")}).strict();const xT=Tf.enum(["MIN","LOW","MEDIUM","HIGH","VERY_HIGH","UNSAFE_MAX"]),BT=Tf.object({data:Tf.custom(),keys:Tf.array(Tf.object({pubkey:IT,isSigner:Tf.boolean(),isWritable:Tf.boolean()})),programId:IT}).transform((e=>e instanceof yC?e:new yC(e))),TT=Tf.object({key:IT,state:Tf.object({addresses:Tf.array(IT),authority:Tf.optional(IT),deactivationSlot:Tf.bigint(),lastExtendedSlot:Tf.number(),lastExtendedSlotStartIndex:Tf.number()})}).transform((e=>e instanceof tx?e:new tx(e)));Tf.object({instructions:Tf.array(BT).min(1),recentBlockhash:Tf.string().optional(),feePayer:IT.optional(),addressLookupTables:Tf.union([Tf.array(IT).default([]),Tf.array(TT).default([])]).optional(),priorityFee:Tf.union([Tf.object({microLamports:Tf.number().min(0)}),Tf.object({percentile:Tf.number().min(0).max(100),multiplier:Tf.number().min(0).optional(),minimumMicroLamports:Tf.number().min(0).optional(),maximumMicroLamports:Tf.number().min(0).optional()}),Tf.object({priority:xT,multiplier:Tf.number().min(0).optional(),minimumMicroLamports:Tf.number().min(0).optional(),maximumMicroLamports:Tf.number().min(0).optional()})]).nullable().optional(),computeLimit:Tf.union([Tf.object({units:Tf.number().min(0)}),Tf.object({simulationMultiplier:Tf.number().min(0)})]).nullable().optional()}).strict();const RT=e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)}),DT=(e=>t=>{const n=Fk(e,t),{encode:r,decode:i}=RT(n),o=n;return o.decode=(e,t)=>{const n=i(e,t);return qk(Buffer.from(n))},o.encode=(t,n,i)=>{const o=Nk(t,e);return r(o,n,i)},o})(8),PT=e=>{const t=Fk(32,e),{encode:n,decode:r}=RT(t),i=t;return i.decode=(e,t)=>{const n=r(e,t);return new VS(n)},i.encode=(e,t,r)=>{const i=e.toBuffer();return n(i,t,r)},i},UT=new VS("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new VS("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),new VS("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),new VS("So11111111111111111111111111111111111111112"),new VS("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");!function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const r=e.charAt(n),i=r.charCodeAt(0);if(255!==t[i])throw new TypeError(r+" is ambiguous");t[i]=n}const n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),o=Math.log(256)/Math.log(n);function s(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let o=0,s=0,a=0;for(;e[o]===r;)0;const u=(e.length-o)*i+1>>>0,c=new Uint8Array(u);for(;e[o];){let r=t[e.charCodeAt(o)];if(255===r)return;let i=0;for(let e=u-1;(0!==r||i<a)&&-1!==e;i++)n*c[e]>>>0,c[e]=r%256>>>0,r/256>>>0;if(0!==r)throw new Error("Non-zero carry");i}let d=u-a;for(;d!==u&&0===c[d];)0;const l=new Uint8Array(s+(u-d));let h=s;for(;d!==u;)l[h++]=c[d++];return l}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");class OT extends GE{constructor(e){super(20,e),this.blob=Fk(20,e)}getSpan(e,t){return this.blob.getSpan(e,t)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.blob.decode(e,t);return"0x"+Buffer.from(n).toString("hex")}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=e.replace("0x",""),i=Buffer.from(r,"hex"),o=Buffer.alloc(20,0);return i.copy(o,20-i.length),this.blob.encode(i,t,n)}}class FT extends GE{constructor(e,t){super(-1,t),this.maxLength=e}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e)return Rk().span+this.maxLength;const n=Rk().decode(e,t);return Rk().span+n}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=Rk().decode(e,t),r=Fk(n).decode(e,t+Rk().span);return KE(r).toString("utf-8")}encode(e,t,n){const r=Buffer.from(e,"utf-8");if(r.length>this.maxLength)throw new RangeError("text exceeds maxLength");if(n+r.length>t.length)throw new RangeError("text length exceeds buffer");return Rk().encode(r.length,t,n)+Fk(r.length).encode(r,t,n+Rk().span)}}const MT=e=>new OT(e),LT=(e,t)=>new FT(e,t);var qT,zT;!function(e){e[e.Create=0]="Create",e[e.Transfer=1]="Transfer"}(qT||(qT={})),function(e){e[e.SignatureVerificationFailed=0]="SignatureVerificationFailed",e[e.Secp256InstructionLosing=1]="Secp256InstructionLosing",e[e.InstructionLoadError=2]="InstructionLoadError",e[e.NonceVerificationError=3]="NonceVerificationError"}(zT||(zT={})),zT.SignatureVerificationFailed,zT.Secp256InstructionLosing,zT.InstructionLoadError,zT.NonceVerificationError;(new TextEncoder).encode("N_"),new VS("Ewkv3JahEFRKkcJmpoKB7pXbnUHwjAyXiwEo4ZY2rezQ"),Uk([Bk("instruction"),MT("ethAddress")]),Uk([Bk("instruction"),MT("sender")]),Uk([PT("destination"),DT("amount"),DT("nonce")]),Uk([Bk("version"),DT("nonce")]);class NT extends GE{constructor(e){super(83,e)}getSpan(e){return this.span}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=Buffer.from("_","utf-8"),r=MT().decode(e,t);t+=MT().span+1;const i=DT().decode(e,t);t+=DT().span+1;const o=e.slice(t).findIndex((e=>e===n[0]||0===e)),s=o>-1?o:e.byteLength-t,a=Fk(s).decode(e,t);return t+=s+1,{recipientEthAddress:r,amount:i,disbursementId:Buffer.from(a).toString("utf-8"),antiAbuseOracleEthAddress:t<e.byteLength?MT().decode(e,t):null}}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=Buffer.from("_","utf-8");let i=n;return i+=MT().encode(e.recipientEthAddress,t,i),i+=Fk(1).encode(r,t,i),i+=DT().encode(e.amount,t,i),i+=Fk(1).encode(r,t,i),i+=Mk(32).encode(e.disbursementId,t,i),e.antiAbuseOracleEthAddress&&(i+=Fk(1).encode(r,t,i),i+=MT().encode(e.antiAbuseOracleEthAddress,t,i)),i-n}}const jT=e=>new NT(e),$T=(new TextEncoder).encode("add");class WT extends GE{constructor(e){super(55,e)}decode(e,t){throw new Error("Method not implemented.")}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return n+=Fk(3).encode($T,t,n),n+=PT().encode(e.rewardManagerState,t,n),n+=MT().encode(e.senderEthAddress,t,n),n}}const HT=e=>new WT(e);var KT,VT,GT;!function(e){e[e.Init=0]="Init",e[e.ChangeManagerAccount=1]="ChangeManagerAccount",e[e.CreateSender=2]="CreateSender",e[e.DeleteSender=3]="DeleteSender",e[e.CreateSenderPublic=4]="CreateSenderPublic",e[e.DeleteSenderPublic=5]="DeleteSenderPublic",e[e.SubmitAttestation=6]="SubmitAttestation",e[e.EvaluateAttestations=7]="EvaluateAttestations"}(KT||(KT={})),function(e){e[e.IncorrectOwner=0]="IncorrectOwner",e[e.SignCollision=1]="SignCollision",e[e.WrongSigner=2]="WrongSigner",e[e.NotEnoughSigners=3]="NotEnoughSigners",e[e.Secp256InstructionMissing=4]="Secp256InstructionMissing",e[e.InstructionLoadError=5]="InstructionLoadError",e[e.RepeatedSenders=6]="RepeatedSenders",e[e.SignatureVerificationFailed=7]="SignatureVerificationFailed",e[e.OperatorCollision=8]="OperatorCollision",e[e.AlreadySent=9]="AlreadySent",e[e.IncorrectMessages=10]="IncorrectMessages",e[e.MessagesOverflow=11]="MessagesOverflow",e[e.MathOverflow=12]="MathOverflow",e[e.InvalidRecipient=13]="InvalidRecipient"}(VT||(VT={})),VT.IncorrectOwner,VT.SignCollision,VT.WrongSigner,VT.NotEnoughSigners,VT.Secp256InstructionMissing,VT.InstructionLoadError,VT.RepeatedSenders,VT.SignatureVerificationFailed,VT.OperatorCollision,VT.AlreadySent,VT.IncorrectMessages,VT.MessagesOverflow,VT.MathOverflow,VT.InvalidRecipient;const ZT=new TextEncoder,YT=ZT.encode("S_"),JT=ZT.encode("V_"),XT=ZT.encode("T_");class QT{static createInitInstruction(e){let{rewardManagerState:t,tokenAccount:n,mint:r,manager:i,minVotes:o,rewardManagerProgramId:s=QT.programId}=e;const a=Buffer.alloc(QT.layouts.initRewardManagerInstructionData.span);QT.layouts.initRewardManagerInstructionData.encode({instruction:KT.Init,minVotes:o},a);const u=QT.deriveAuthority({programId:s,rewardManagerState:t});return new yC({programId:s,keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:u,isSigner:!1,isWritable:!1},{pubkey:UT,isSigner:!1,isWritable:!1},{pubkey:IC,isSigner:!1,isWritable:!1}],data:a})}static createChangeManagerAccountInstruction(e){let{rewardManagerState:t,currentManager:n,newManager:r,rewardManagerProgramId:i=QT.programId}=e;const o=Buffer.alloc(QT.layouts.changeManagerAccountInstructionData.span);QT.layouts.changeManagerAccountInstructionData.encode({instruction:KT.ChangeManagerAccount},o);return new yC({programId:i,keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1}],data:o})}static decodeInitInstruction(e){let{programId:t,keys:[n,r,i,o,s,a,u],data:c}=e;return{programId:t,keys:{rewardManagerState:n,tokenAccount:r,mint:i,manager:o,authority:s,tokenProgram:a,rent:u},data:QT.layouts.initRewardManagerInstructionData.decode(c)}}static decodeChangeManagerAccountInstruction(e){let{programId:t,keys:[n,r,i],data:o}=e;return{programId:t,keys:{rewardManagerState:n,currentManager:r,newManager:i},data:QT.layouts.changeManagerAccountInstructionData.decode(o)}}static createSenderInstruction(e){let{senderEthAddress:t,operatorEthAddress:n,rewardManagerState:r,manager:i,authority:o,payer:s,sender:a,rewardManagerProgramId:u=QT.programId}=e;const c=Buffer.alloc(QT.layouts.createSenderInstructionData.span);QT.layouts.createSenderInstructionData.encode({instruction:KT.CreateSender,senderEthAddress:t,operatorEthAddress:n},c);const d=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!0,isWritable:!1},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:$C.programId,isSigner:!1,isWritable:!1},{pubkey:IC,isSigner:!1,isWritable:!1}];return new yC({programId:u,keys:d,data:c})}static decodeCreateSenderInstruction(e){let{programId:t,keys:[n,r,i,o,s,a,u],data:c}=e;return{programId:t,keys:{rewardManagerState:n,manager:r,authority:i,payer:o,sender:s,systemProgramId:a,rent:u},data:QT.layouts.createSenderInstructionData.decode(c)}}static createSenderPublicInstruction(e){let{senderEthAddress:t,operatorEthAddress:n,rewardManagerState:r,authority:i,payer:o,sender:s,existingSenders:a,rewardManagerProgramId:u}=e;const c=Buffer.alloc(QT.layouts.createSenderPublicInstructionData.span);QT.layouts.createSenderPublicInstructionData.encode({instruction:KT.CreateSenderPublic,senderEthAddress:t,operatorEthAddress:n},c);const d=[{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:EC,isSigner:!1,isWritable:!1},{pubkey:IC,isSigner:!1,isWritable:!1},{pubkey:$C.programId,isSigner:!1,isWritable:!1},...a.map((e=>({pubkey:e,isSigner:!1,isWritable:!1})))];return new yC({programId:u,keys:d,data:c})}static decodeCreateSenderPublicInstruction(e){let{programId:t,keys:[n,r,i,o,s,a,u,...c],data:d}=e;return{programId:t,keys:{rewardManagerState:n,authority:r,payer:i,sender:o,sysvarInstructions:s,rent:a,systemProgramId:u,existingSenders:c},data:QT.layouts.createSenderPublicInstructionData.decode(d)}}static decodeDeleteSenderPublicInstruction(e){let{programId:t,keys:[n,r,i,o,...s]}=e;return{programId:t,keys:{rewardManagerState:n,sender:r,refunder:i,sysvarInstructions:o,existingSenders:s},data:{instruction:KT.DeleteSenderPublic}}}static decodeSubmitAttestationInstruction(e){let{programId:t,keys:[n,r,i,o,s,a,u,c],data:d}=e;return{programId:t,keys:{attestations:n,rewardManagerState:r,authority:i,payer:o,sender:s,rent:a,sysvarInstructions:u,systemProgramId:c},data:QT.layouts.submitAttestationInstructionData.decode(d)}}static decodeEvaluateAttestationsInstruction(e){let{programId:t,keys:[n,r,i,o,s,a,u,c,d,l,h],data:f}=e;return{programId:t,keys:{attestations:n,rewardManagerState:r,authority:i,rewardManagerTokenSource:o,destinationUserbank:s,disbursementAccount:a,antiAbuseOracle:u,payer:c,rent:d,tokenProgramId:l,systemProgramId:h},data:QT.layouts.evaluateAttestationsInstructionData.decode(f)}}static decodeInstruction(e){switch(e.data[0]){case KT.Init:return QT.decodeInitInstruction(e);case KT.ChangeManagerAccount:return QT.decodeChangeManagerAccountInstruction(e);case KT.CreateSender:return QT.decodeCreateSenderInstruction(e);case KT.DeleteSender:throw new Error("Not Implemented");case KT.CreateSenderPublic:return QT.decodeCreateSenderPublicInstruction(e);case KT.DeleteSenderPublic:return QT.decodeDeleteSenderPublicInstruction(e);case KT.SubmitAttestation:return QT.decodeSubmitAttestationInstruction(e);case KT.EvaluateAttestations:return QT.decodeEvaluateAttestationsInstruction(e);default:throw new Error("Invalid RewardManager Instruction")}}static isInitInstruction(e){return e.data.instruction===KT.Init}static isCreateSenderInstruction(e){return e.data.instruction===KT.CreateSender}static isCreateSenderPublicInstruction(e){return e.data.instruction===KT.CreateSenderPublic}static isDeleteSenderPublicInstruction(e){return e.data.instruction===KT.DeleteSenderPublic}static isSubmitAttestationInstruction(e){return e.data.instruction===KT.SubmitAttestation}static isEvaluateAttestationsInstruction(e){return e.data.instruction===KT.EvaluateAttestations}static isChangeManagerAccountInstruction(e){return e.data.instruction===KT.ChangeManagerAccount}static encodeAttestation(e){const t=Buffer.alloc(jT().span),n=jT().encode(e,t);return t.subarray(0,n)}static decodeAttestation(e){return jT().decode(e)}static decodeAttestationsAccountData(e,t){const n=this.layouts.attestationsAccountData(e).decode(t);n.messages=n.messages.slice(0,n.count);for(let e=0;e<n.messages.length;e++)"0x0000000000000000000000000000000000000000"===n.messages[e].attestation.antiAbuseOracleEthAddress&&(n.messages[e].attestation.antiAbuseOracleEthAddress=null);return n}static deriveAuthority(e){let{programId:t,rewardManagerState:n}=e;return VS.findProgramAddressSync([n.toBytes().slice(0,32)],t)[0]}static deriveSender(e){let{ethAddress:t,programId:n,authority:r}=e;const i=MT(t),o=Buffer.alloc(i.span);i.encode(t,o);const s=Uint8Array.from([...YT,...o]);return VS.findProgramAddressSync([r.toBytes().slice(0,32),s],n)[0]}static deriveAttestations(e){let{disbursementId:t,programId:n,authority:r}=e;const i=new TextEncoder,o=Uint8Array.from([...JT,...i.encode(t)]);return VS.findProgramAddressSync([r.toBytes().slice(0,32),o],n)[0]}static deriveDisbursement(e){let{disbursementId:t,programId:n,authority:r}=e;const i=new TextEncoder,o=Uint8Array.from([...XT,...i.encode(t)]);return VS.findProgramAddressSync([r.toBytes().slice(0,32),o],n)[0]}static encodeSignature(e){const t=e.slice(-2),n=Buffer.from(t,"hex"),r=e.substring(0,e.length-2).replace("0x","").padStart(128,"0").substring(0,128);return{signature:Buffer.from(r,"hex"),recoveryId:n.readInt8()}}static decodeRewardManagerState(e){return QT.layouts.rewardManagerStateData.decode(e)}static encodeSenderAttestation(e){const t=Buffer.alloc(HT().span),n=HT().encode(e,t);return t.subarray(0,n)}}var eR;GT=QT,QT.programId=new VS("DDZDcYdQFEMwcu2Mwo75yGFjJ1mUQyyXLWzhZLEVFcei"),QT.layouts={initRewardManagerInstructionData:Uk([Bk("instruction"),Bk("minVotes")]),changeManagerAccountInstructionData:Uk([Bk("instruction")]),createSenderInstructionData:Uk([Bk("instruction"),MT("senderEthAddress"),MT("operatorEthAddress")]),createSenderPublicInstructionData:Uk([Bk("instruction"),MT("senderEthAddress"),MT("operatorEthAddress")]),evaluateAttestationsInstructionData:Uk([Bk("instruction"),DT("amount"),LT(32,"disbursementId"),MT("recipientEthAddress")]),submitAttestationInstructionData:Uk([Bk("instruction"),LT(32,"disbursementId")]),rewardManagerStateData:Uk([Bk("version"),PT("tokenAccount"),PT("manager"),Bk("minVotes")]),attestationsAccountData:e=>Uk([Bk("version"),PT("rewardManagerState"),Bk("count"),Ok(Uk([MT("senderEthAddress"),jT("attestation"),Fk(45),MT("operator")]),e,"messages")])},QT.createSubmitAttestationInstruction=e=>{let{disbursementId:t,attestations:n,rewardManagerState:r,authority:i,payer:o,sender:s,rewardManagerProgramId:a=QT.programId}=e;const u=Buffer.alloc(GT.layouts.submitAttestationInstructionData.span),c=GT.layouts.submitAttestationInstructionData.encode({instruction:KT.SubmitAttestation,disbursementId:t},u),d=u.subarray(0,c),l=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1},{pubkey:o,isSigner:!0,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!1},{pubkey:IC,isSigner:!1,isWritable:!1},{pubkey:EC,isSigner:!1,isWritable:!1},{pubkey:$C.programId,isSigner:!1,isWritable:!1}];return new yC({programId:a,keys:l,data:d})},QT.createEvaluateAttestationsInstruction=e=>{let{disbursementId:t,recipientEthAddress:n,amount:r,attestations:i,rewardManagerState:o,authority:s,rewardManagerTokenSource:a,destinationUserBank:u,disbursementAccount:c,antiAbuseOracle:d,payer:l,tokenProgramId:h=UT,rewardManagerProgramId:f=QT.programId}=e;const p=Buffer.alloc(QT.layouts.evaluateAttestationsInstructionData.span),g=QT.layouts.evaluateAttestationsInstructionData.encode({instruction:KT.EvaluateAttestations,disbursementId:t,amount:r,recipientEthAddress:n},p),m=p.subarray(0,g),y=[{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:o,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:u,isSigner:!1,isWritable:!0},{pubkey:c,isSigner:!1,isWritable:!0},{pubkey:d,isSigner:!1,isWritable:!1},{pubkey:l,isSigner:!0,isWritable:!0},{pubkey:IC,isSigner:!1,isWritable:!1},{pubkey:h,isSigner:!1,isWritable:!1},{pubkey:$C.programId,isSigner:!1,isWritable:!1}];return new yC({programId:f,keys:y,data:m})},Uk([Bk("numSignatures"),Tk("signatureOffset"),Bk("signatureInstructionIndex"),Tk("ethAddressOffset"),Bk("ethAddressInstructionIndex"),Tk("messageDataOffset"),Tk("messageDataSize"),Bk("messageInstructionIndex"),Fk(20,"ethAddress"),Fk(64,"signature"),Bk("recoveryId")]),function(e){e[e.Create=0]="Create",e[e.CreateIdempotent=1]="CreateIdempotent",e[e.RecoverNested=2]="RecoverNested"}(eR||(eR={}));var tR={exports:{}};const nR=/[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C89\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7CB\uA7CC\uA7CE\uA7D0\uA7D2\uA7D4\uA7D6\uA7D8\uA7DA\uA7DC\uA7F5\uFF21-\uFF3A\u{10400}-\u{10427}\u{104B0}-\u{104D3}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10C80}-\u{10CB2}\u{10D50}-\u{10D65}\u{118A0}-\u{118BF}\u{16E40}-\u{16E5F}\u{16EA0}-\u{16EB8}\u{1D400}-\u{1D419}\u{1D434}-\u{1D44D}\u{1D468}-\u{1D481}\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B5}\u{1D4D0}-\u{1D4E9}\u{1D504}\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D538}\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D56C}-\u{1D585}\u{1D5A0}-\u{1D5B9}\u{1D5D4}-\u{1D5ED}\u{1D608}-\u{1D621}\u{1D63C}-\u{1D655}\u{1D670}-\u{1D689}\u{1D6A8}-\u{1D6C0}\u{1D6E2}-\u{1D6FA}\u{1D71C}-\u{1D734}\u{1D756}-\u{1D76E}\u{1D790}-\u{1D7A8}\u{1D7CA}\u{1E900}-\u{1E921}]/u,rR=/[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0296-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1C8A\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5F\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C1\uA7C3\uA7C8\uA7CA\uA7CD\uA7CF\uA7D1\uA7D3\uA7D5\uA7D7\uA7D9\uA7DB\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A\u{10428}-\u{1044F}\u{104D8}-\u{104FB}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{10CC0}-\u{10CF2}\u{10D70}-\u{10D85}\u{118C0}-\u{118DF}\u{16E60}-\u{16E7F}\u{16EBB}-\u{16ED3}\u{1D41A}-\u{1D433}\u{1D44E}-\u{1D454}\u{1D456}-\u{1D467}\u{1D482}-\u{1D49B}\u{1D4B6}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D4CF}\u{1D4EA}-\u{1D503}\u{1D51E}-\u{1D537}\u{1D552}-\u{1D56B}\u{1D586}-\u{1D59F}\u{1D5BA}-\u{1D5D3}\u{1D5EE}-\u{1D607}\u{1D622}-\u{1D63B}\u{1D656}-\u{1D66F}\u{1D68A}-\u{1D6A5}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6E1}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D71B}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D755}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D78F}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7C9}\u{1D7CB}\u{1DF00}-\u{1DF09}\u{1DF0B}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E922}-\u{1E943}]/u,iR=/^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C89\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7CB\uA7CC\uA7CE\uA7D0\uA7D2\uA7D4\uA7D6\uA7D8\uA7DA\uA7DC\uA7F5\uFF21-\uFF3A\u{10400}-\u{10427}\u{104B0}-\u{104D3}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10C80}-\u{10CB2}\u{10D50}-\u{10D65}\u{118A0}-\u{118BF}\u{16E40}-\u{16E5F}\u{16EA0}-\u{16EB8}\u{1D400}-\u{1D419}\u{1D434}-\u{1D44D}\u{1D468}-\u{1D481}\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B5}\u{1D4D0}-\u{1D4E9}\u{1D504}\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D538}\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D56C}-\u{1D585}\u{1D5A0}-\u{1D5B9}\u{1D5D4}-\u{1D5ED}\u{1D608}-\u{1D621}\u{1D63C}-\u{1D655}\u{1D670}-\u{1D689}\u{1D6A8}-\u{1D6C0}\u{1D6E2}-\u{1D6FA}\u{1D71C}-\u{1D734}\u{1D756}-\u{1D76E}\u{1D790}-\u{1D7A8}\u{1D7CA}\u{1E900}-\u{1E921}](?![A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C89\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7CB\uA7CC\uA7CE\uA7D0\uA7D2\uA7D4\uA7D6\uA7D8\uA7DA\uA7DC\uA7F5\uFF21-\uFF3A\u{10400}-\u{10427}\u{104B0}-\u{104D3}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10C80}-\u{10CB2}\u{10D50}-\u{10D65}\u{118A0}-\u{118BF}\u{16E40}-\u{16E5F}\u{16EA0}-\u{16EB8}\u{1D400}-\u{1D419}\u{1D434}-\u{1D44D}\u{1D468}-\u{1D481}\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B5}\u{1D4D0}-\u{1D4E9}\u{1D504}\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D538}\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D56C}-\u{1D585}\u{1D5A0}-\u{1D5B9}\u{1D5D4}-\u{1D5ED}\u{1D608}-\u{1D621}\u{1D63C}-\u{1D655}\u{1D670}-\u{1D689}\u{1D6A8}-\u{1D6C0}\u{1D6E2}-\u{1D6FA}\u{1D71C}-\u{1D734}\u{1D756}-\u{1D76E}\u{1D790}-\u{1D7A8}\u{1D7CA}\u{1E900}-\u{1E921}])/gu,oR=/([0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0363-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u0669\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u0897\u08A0-\u08C9\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFC\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C5C\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7E\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDC-\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D54-\u0D63\u0D66-\u0D78\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F83\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1713\u171F-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1ABF\u1AC0\u1ACC-\u1ACE\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4C\u1B50-\u1B59\u1B80-\u1BA9\u1BAC-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DD3-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2189\u2150-\u2182\u2460-\u249B\u24B6-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA805\uA807-\uA827\uA830-\uA835\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10107}-\u{10133}\u{10140}-\u{10178}\u{1018A}\u{1018B}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{102E1}-\u{102FB}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{1037A}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{103D1}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10858}-\u{10876}\u{10879}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{10940}-\u{10959}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A60}-\u{10A7E}\u{10A80}-\u{10A9F}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10AEB}-\u{10AEF}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D27}\u{10D30}-\u{10D39}\u{10D40}-\u{10D65}\u{10D69}\u{10D6F}-\u{10D85}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAB}\u{10EAC}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC7}\u{10EFA}-\u{10EFC}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F54}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{11000}-\u{11045}\u{11052}-\u{1106F}\u{11071}-\u{11075}\u{11080}-\u{110B8}\u{110C2}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11100}-\u{11132}\u{11136}-\u{1113F}\u{11144}-\u{11147}\u{11150}-\u{11172}\u{11176}\u{11180}-\u{111BF}\u{111C1}-\u{111C4}\u{111CE}-\u{111DA}\u{111DC}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{11234}\u{11237}\u{1123E}-\u{11241}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112E8}\u{112F0}-\u{112F9}\u{11300}-\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}-\u{11344}\u{11347}\u{11348}\u{1134B}\u{1134C}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}-\u{113C0}\u{113C2}\u{113C5}\u{113C7}-\u{113CA}\u{113CC}\u{113CD}\u{113D1}\u{113D3}\u{11400}-\u{11441}\u{11443}-\u{11445}\u{11447}-\u{1144A}\u{11450}-\u{11459}\u{1145F}-\u{11461}\u{11480}-\u{114C1}\u{114C4}\u{114C5}\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B5}\u{115B8}-\u{115BE}\u{115D8}-\u{115DD}\u{11600}-\u{1163E}\u{11640}\u{11644}\u{11650}-\u{11659}\u{11680}-\u{116B5}\u{116B8}\u{116C0}-\u{116C9}\u{116D0}-\u{116E3}\u{11700}-\u{1171A}\u{1171D}-\u{1172A}\u{11730}-\u{1173B}\u{11740}-\u{11746}\u{11800}-\u{11838}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193B}\u{1193C}\u{1193F}-\u{11942}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D7}\u{119DA}-\u{119DF}\u{119E1}\u{119E3}\u{119E4}\u{11A00}-\u{11A32}\u{11A35}-\u{11A3E}\u{11A50}-\u{11A97}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11B60}-\u{11B67}\u{11BC0}-\u{11BE0}\u{11BF0}-\u{11BF9}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C36}\u{11C38}-\u{11C3E}\u{11C40}\u{11C50}-\u{11C6C}\u{11C72}-\u{11C8F}\u{11C92}-\u{11CA7}\u{11CA9}-\u{11CB6}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D41}\u{11D43}\u{11D46}\u{11D47}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D90}\u{11D91}\u{11D93}-\u{11D96}\u{11D98}\u{11DA0}-\u{11DA9}\u{11DB0}-\u{11DDB}\u{11DE0}-\u{11DE9}\u{11EE0}-\u{11EF6}\u{11F00}-\u{11F10}\u{11F12}-\u{11F3A}\u{11F3E}-\u{11F40}\u{11F50}-\u{11F59}\u{11FB0}\u{11FC0}-\u{11FD4}\u{12000}-\u{12399}\u{12400}-\u{1246E}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1612E}\u{16130}-\u{16139}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A70}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16D70}-\u{16D79}\u{16E40}-\u{16E96}\u{16EA0}-\u{16EB8}\u{16EBB}-\u{16ED3}\u{16F00}-\u{16F4A}\u{16F4F}-\u{16F87}\u{16F8F}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{16FF0}-\u{16FF6}\u{17000}-\u{18CD5}\u{18CFF}-\u{18D1E}\u{18D80}-\u{18DF2}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9E}\u{1CCF0}-\u{1CCF9}\u{1D2C0}-\u{1D2D3}\u{1D2E0}-\u{1D2F3}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1D7CE}-\u{1D7FF}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E030}-\u{1E06D}\u{1E08F}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E2F0}-\u{1E2F9}\u{1E4D0}-\u{1E4EB}\u{1E4F0}-\u{1E4F9}\u{1E5D0}-\u{1E5ED}\u{1E5F0}-\u{1E5FA}\u{1E6C0}-\u{1E6DE}\u{1E6E0}-\u{1E6F5}\u{1E6FE}\u{1E6FF}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E947}\u{1E94B}\u{1E950}-\u{1E959}\u{1EC71}-\u{1ECAB}\u{1ECAD}-\u{1ECAF}\u{1ECB1}-\u{1ECB4}\u{1ED01}-\u{1ED2D}\u{1ED2F}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1F100}-\u{1F10C}\u{1F130}-\u{1F149}\u{1F150}-\u{1F169}\u{1F170}-\u{1F189}\u{1FBF0}-\u{1FBF9}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B81D}\u{2B820}-\u{2CEAD}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{33479}]|$)/u,sR=/[_.\- ]+/,aR=new RegExp("^"+sR.source),uR=new RegExp(sR.source+oR.source,"gu"),cR=new RegExp("\\d+"+oR.source,"gu"),dR=(e,t)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map((e=>e.trim())).filter((e=>e.length)).join("-"):e.trim()).length)return"";const n=!1===t.locale?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale),r=!1===t.locale?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);if(1===e.length)return t.pascalCase?r(e):n(e);return e!==n(e)&&(e=((e,t,n)=>{let r=!1,i=!1,o=!1;for(let s=0;s<e.length;s++){const a=e[s];r&&nR.test(a)?(e=e.slice(0,s)+"-"+e.slice(s),r=!1,o=i,i=!0,s++):i&&o&&rR.test(a)?(e=e.slice(0,s-1)+"-"+e.slice(s-1),o=i,i=!1,r=!0):(r=t(a)===a&&n(a)!==a,o=i,i=n(a)===a&&t(a)!==a)}return e})(e,n,r)),e=e.replace(aR,""),e=t.preserveConsecutiveUppercase?((e,t)=>(iR.lastIndex=0,e.replace(iR,(e=>t(e)))))(e,n):n(e),t.pascalCase&&(e=r(e.charAt(0))+e.slice(1)),((e,t)=>(uR.lastIndex=0,cR.lastIndex=0,e.replace(uR,((e,n)=>t(n))).replace(cR,(e=>t(e)))))(e,r)};tR.exports=dR,tR.exports.default=dR;var lR={},hR={};class fR{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function pR(e,t){return t.property?e+"["+t.property+"]":e}hR.Layout=fR,hR.nameWithProperty=pR,hR.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof fR))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class gR extends fR{isCount(){throw new Error("ExternalLayout is abstract")}}class mR extends gR{constructor(e,t){if(void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t){void 0===t&&(t=0);const n=e.length-t;return Math.floor(n/this.elementSpan)}encode(e,t,n){return 0}}class yR extends gR{constructor(e,t,n){if(!(e instanceof fR))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof wR||this.layout instanceof vR}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class wR extends fR{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}class vR extends fR{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}class bR extends fR{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}class _R extends fR{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}const AR=Math.pow(2,32);function ER(e){const t=Math.floor(e/AR);return{hi32:t,lo32:e-t*AR}}function kR(e,t){return e*AR+t}class IR extends fR{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return kR(e.readUInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=ER(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}class SR extends fR{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);return kR(e.readUInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){void 0===n&&(n=0);const r=ER(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}class CR extends fR{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return kR(e.readInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=ER(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}class xR extends fR{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);return kR(e.readInt32BE(t),e.readUInt32BE(t+4))}encode(e,t,n){void 0===n&&(n=0);const r=ER(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}class BR extends fR{constructor(e){super(4,e)}decode(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}class TR extends fR{constructor(e){super(4,e)}decode(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}class RR extends fR{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}class DR extends fR{constructor(e){super(8,e)}decode(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}encode(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}class PR extends fR{constructor(e,t,n){if(!(e instanceof fR))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof gR&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let r=-1;!(t instanceof gR)&&0<e.span&&(r=t*e.span),super(r,n),this.elementLayout=e,this.count=t}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0,r=this.count;if(r instanceof gR&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else{let i=0;for(;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i}return n}decode(e,t){void 0===t&&(t=0);const n=[];let r=0,i=this.count;for(i instanceof gR&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}encode(e,t,n){void 0===n&&(n=0);const r=this.elementLayout,i=e.reduce(((e,i)=>e+r.encode(i,t,n+e)),0);return this.count instanceof gR&&this.count.encode(e.length,t,n),i}}class UR extends fR{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof fR),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0<s?s:0,void 0!==r.property){const i=e[r.property];void 0!==i&&(o=r.encode(i,t,n),0>s&&(s=r.getSpan(t,n)))}i=n,n+=s}return i+o-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}class OR{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class FR extends OR{constructor(e,t){if(!(e instanceof gR&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class MR extends fR{constructor(e,t,n){const r=e instanceof wR||e instanceof vR;if(r)e=new FR(new yR(e));else if(e instanceof gR&&e.isCount())e=new FR(e);else if(!(e instanceof OR))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof fR))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&(i=t.span,0<=i&&r&&(i+=e.layout.span)),super(i,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return o(e)},this.configGetSourceVariant=function(e){o=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,i=r.decode(e,t);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(e,t+s)}else n=o.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(e[r.property],t,n),o+i.encode(e[i.property],t,n+o)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new LR(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return Buffer.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class LR extends fR{constructor(e,t,n,r){if(!(e instanceof MR))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof fR))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=e.span;0>e.span&&(i=n?n.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function qR(e){return 0>e&&(e+=4294967296),e}class zR extends fR{constructor(e,t,n){if(!(e instanceof wR||e instanceof vR))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===n&&(n=t,t=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!t,this.fields=[];let r=0;this._packedSetValue=function(e){return r=qR(e),this},this._packedGetValue=function(){return r}}decode(e,t){const n=this.makeDestinationObject();void 0===t&&(t=0);const r=this.word.decode(e,t);this._packedSetValue(r);for(const e of this.fields)void 0!==e.property&&(n[e.property]=e.decode(r));return n}encode(e,t,n){void 0===n&&(n=0);const r=this.word.decode(t,n);this._packedSetValue(r);for(const t of this.fields)if(void 0!==t.property){const n=e[t.property];void 0!==n&&t.encode(n)}return this.word.encode(this._packedGetValue(),t,n)}addField(e,t){const n=new NR(this,e,t);return this.fields.push(n),n}addBoolean(e){const t=new jR(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}}class NR{constructor(e,t,n){if(!(e instanceof zR))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");const r=8*e.span,i=e.fields.reduce(((e,t)=>e+t.bits),0);if(t+i>r)throw new Error("bits too long for span remainder ("+(r-i)+" of "+r+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=r-i-t),this.wordMask=qR(this.valueMask<<this.start),this.property=n}decode(){return qR(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if(!Number.isInteger(e)||e!==qR(e&this.valueMask))throw new TypeError(pR("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const t=this.container._packedGetValue(),n=qR(e<<this.start);this.container._packedSetValue(qR(t&~this.wordMask)|n)}}class jR extends NR{constructor(e,t){super(e,1,t)}decode(e,t){return!!NR.prototype.decode.call(this,e,t)}encode(e){return"boolean"==typeof e&&(e=+e),NR.prototype.encode.call(this,e)}}class $R extends fR{constructor(e,t){if(!(e instanceof gR&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof gR||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof gR&&(r=e.length),!Buffer.isBuffer(e)||r!==e.length)throw new TypeError(pR("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof gR&&this.length.encode(r,t,n),r}}class WR extends fR{constructor(e){super(-1,e)}getSpan(e,t){if(!Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);let n=t;for(;n<e.length&&0!==e[n];)n+=1;return 1+n-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}encode(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());const r=new Buffer(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),t[n+i]=0,i+1}}class HR extends fR{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t){if(!Buffer.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}decode(e,t,n){void 0===t&&(t=0);let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}encode(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());const r=new Buffer(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),i}}class KR extends fR{constructor(e,t){super(0,t),this.value=e}decode(e,t,n){return this.value}encode(e,t,n){return 0}}hR.ExternalLayout=gR,hR.GreedyCount=mR,hR.OffsetLayout=yR,hR.UInt=wR,hR.UIntBE=vR,hR.Int=bR,hR.IntBE=_R,hR.Float=BR,hR.FloatBE=TR,hR.Double=RR,hR.DoubleBE=DR,hR.Sequence=PR,hR.Structure=UR,hR.UnionDiscriminator=OR,hR.UnionLayoutDiscriminator=FR,hR.Union=MR,hR.VariantLayout=LR,hR.BitStructure=zR,hR.BitField=NR,hR.Boolean=jR,hR.Blob=$R,hR.CString=WR,hR.UTF8=HR,hR.Constant=KR,hR.greedy=(e,t)=>new mR(e,t),hR.offset=(e,t,n)=>new yR(e,t,n),hR.u8=e=>new wR(1,e),hR.u16=e=>new wR(2,e),hR.u24=e=>new wR(3,e),hR.u32=e=>new wR(4,e),hR.u40=e=>new wR(5,e),hR.u48=e=>new wR(6,e),hR.nu64=e=>new IR(e),hR.u16be=e=>new vR(2,e),hR.u24be=e=>new vR(3,e),hR.u32be=e=>new vR(4,e),hR.u40be=e=>new vR(5,e),hR.u48be=e=>new vR(6,e),hR.nu64be=e=>new SR(e),hR.s8=e=>new bR(1,e),hR.s16=e=>new bR(2,e),hR.s24=e=>new bR(3,e),hR.s32=e=>new bR(4,e),hR.s40=e=>new bR(5,e),hR.s48=e=>new bR(6,e),hR.ns64=e=>new CR(e),hR.s16be=e=>new _R(2,e),hR.s24be=e=>new _R(3,e),hR.s32be=e=>new _R(4,e),hR.s40be=e=>new _R(5,e),hR.s48be=e=>new _R(6,e),hR.ns64be=e=>new xR(e),hR.f32=e=>new BR(e),hR.f32be=e=>new TR(e),hR.f64=e=>new RR(e),hR.f64be=e=>new DR(e),hR.struct=(e,t,n)=>new UR(e,t,n),hR.bits=(e,t,n)=>new zR(e,t,n),hR.seq=(e,t,n)=>new PR(e,t,n),hR.union=(e,t,n)=>new MR(e,t,n),hR.unionLayoutDiscriminator=(e,t)=>new FR(e,t),hR.blob=(e,t)=>new $R(e,t),hR.cstr=e=>new WR(e),hR.utf8=(e,t)=>new HR(e,t),hR.const=(e,t)=>new KR(e,t);var VR=o(kT);!function(e){var t=i&&i.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i256=e.u256=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;const n=hR,r=VR,o=t(JA.exports);var s=hR;Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return s.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return s.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return s.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return s.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return s.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return s.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return s.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return s.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return s.struct}});class a extends n.Layout{constructor(e,t,r){super(e,r),this.blob=(0,n.blob)(e),this.signed=t}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=new o.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(Buffer,"le",this.span),t,n)}}function u(e){return new a(8,!1,e)}e.u64=u,e.i64=function(e){return new a(8,!0,e)},e.u128=function(e){return new a(16,!1,e)},e.i128=function(e){return new a(16,!0,e)},e.u256=function(e){return new a(32,!1,e)},e.i256=function(e){return new a(32,!0,e)};class c extends n.Layout{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}e.publicKey=function(e){return new c((0,n.blob)(32),(e=>new r.PublicKey(e)),(e=>e.toBuffer()),e)};class d extends n.Layout{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=(0,n.u8)()}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}function l(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function h(e){return e?1:0}function f(e){const t=(0,n.u32)("length"),r=(0,n.struct)([t,(0,n.blob)((0,n.offset)(t,-t.span),"data")]);return new c(r,(e=>{let{data:t}=e;return t}),(e=>({data:e})),e)}e.option=function(e,t){return new d(e,t)},e.bool=function(e){return new c((0,n.u8)(),l,h,e)},e.vec=function(e,t){const r=(0,n.u32)("length"),i=(0,n.struct)([r,(0,n.seq)(e,(0,n.offset)(r,-r.span),"values")]);return new c(i,(e=>{let{values:t}=e;return t}),(e=>({values:e})),t)},e.tagged=function(e,t,r){const i=(0,n.struct)([u("tag"),t.replicate("data")]);return new c(i,(function(t){let{tag:n,data:r}=t;if(!n.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+n.toString("hex"));return r}),(t=>({tag:e,data:t})),r)},e.vecU8=f,e.str=function(e){return new c(f(),(e=>e.toString("utf-8")),(e=>Buffer.from(e,"utf-8")),e)},e.rustEnum=function(e,t,r){const i=(0,n.union)(null!=r?r:(0,n.u8)(),t);return e.forEach(((e,t)=>i.addVariant(t,e,e.property))),i},e.array=function(e,t,r){const i=(0,n.struct)([(0,n.seq)(e,t,"values")]);return new c(i,(e=>{let{values:t}=e;return t}),(e=>({values:e})),r)};class p extends n.Layout{constructor(e,t,n){super(e.span+t.span,n),this.keyLayout=e,this.valueLayout=t}decode(e,t){t=t||0;return[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}encode(e,t,n){n=n||0;const r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}getSpan(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}e.map=function(e,t,r){const i=(0,n.u32)("length"),o=(0,n.struct)([i,(0,n.seq)(new p(e,t),(0,n.offset)(i,-i.span),"values")]);return new c(o,(e=>{let{values:t}=e;return new Map(t)}),(e=>({values:Array.from(e.entries())})),r)}}(lR);function GR(e){let t=e.length;for(;--t>=0;)e[t]=0}const ZR=256,YR=286,JR=30,XR=15,QR=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),eD=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),tD=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),nD=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rD=new Array(576);GR(rD);const iD=new Array(60);GR(iD);const oD=new Array(512);GR(oD);const sD=new Array(256);GR(sD);const aD=new Array(29);GR(aD);const uD=new Array(JR);function cD(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let dD,lD,hD;function fD(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}GR(uD);const pD=e=>e<256?oD[e]:oD[256+(e>>>7)],gD=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},mD=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,gD(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},yD=(e,t,n)=>{mD(e,n[2*t],n[2*t+1])},wD=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},vD=(e,t,n)=>{const r=new Array(16);let i,o,s=0;for(i=1;i<=XR;i++)s=s+n[i-1]<<1,r[i]=s;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=wD(r[t]++,t))}},bD=e=>{let t;for(t=0;t<YR;t++)e.dyn_ltree[2*t]=0;for(t=0;t<JR;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},_D=e=>{e.bi_valid>8?gD(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},AD=(e,t,n,r)=>{const i=2*t,o=2*n;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]},ED=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&AD(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!AD(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},kD=(e,t,n)=>{let r,i,o,s,a=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+a++],r+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],0===r?yD(e,i,t):(o=sD[i],yD(e,o+ZR+1,t),s=QR[o],0!==s&&(i-=aD[o],mD(e,i,s)),r--,o=pD(r),yD(e,o,n),s=eD[o],0!==s&&(r-=uD[o],mD(e,r,s)))}while(a<e.sym_next);yD(e,256,t)},ID=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,a,u,c=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<o;s++)0!==n[2*s]?(e.heap[++e.heap_len]=c=s,e.depth[s]=0):n[2*s+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=c<2?++c:0,n[2*u]=1,e.depth[u]=0,e.opt_len--,i&&(e.static_len-=r[2*u+1]);for(t.max_code=c,s=e.heap_len>>1;s>=1;s--)ED(e,n,s);u=o;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ED(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,n[2*u]=n[2*s]+n[2*a],e.depth[u]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,n[2*s+1]=n[2*a+1]=u,e.heap[1]=u++,ED(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,u=t.stat_desc.max_length;let c,d,l,h,f,p,g=0;for(h=0;h<=XR;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,c=e.heap_max+1;c<573;c++)d=e.heap[c],h=n[2*n[2*d+1]+1]+1,h>u&&(h=u,g++),n[2*d+1]=h,d>r||(e.bl_count[h]++,f=0,d>=a&&(f=s[d-a]),p=n[2*d],e.opt_len+=p*(h+f),o&&(e.static_len+=p*(i[2*d+1]+f)));if(0!==g){do{for(h=u-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[u]--,g-=2}while(g>0);for(h=u;0!==h;h--)for(d=e.bl_count[h];0!==d;)l=e.heap[--c],l>r||(n[2*l+1]!==h&&(e.opt_len+=(h-n[2*l+1])*n[2*l],n[2*l+1]=h),d--)}})(e,t),vD(n,c,e.bl_count)},SD=(e,t,n)=>{let r,i,o=-1,s=t[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=s,s=t[2*(r+1)+1],++a<u&&i===s||(a<c?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=i,0===s?(u=138,c=3):i===s?(u=6,c=3):(u=7,c=4))},CD=(e,t,n)=>{let r,i,o=-1,s=t[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),r=0;r<=n;r++)if(i=s,s=t[2*(r+1)+1],!(++a<u&&i===s)){if(a<c)do{yD(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(yD(e,i,e.bl_tree),a--),yD(e,16,e.bl_tree),mD(e,a-3,2)):a<=10?(yD(e,17,e.bl_tree),mD(e,a-3,3)):(yD(e,18,e.bl_tree),mD(e,a-11,7));a=0,o=i,0===s?(u=138,c=3):i===s?(u=6,c=3):(u=7,c=4)}};let xD=!1;const BD=(e,t,n,r)=>{mD(e,0+(r?1:0),3),_D(e),gD(e,n),gD(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var TD=e=>{xD||((()=>{let e,t,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(aD[r]=n,e=0;e<1<<QR[r];e++)sD[n++]=r;for(sD[n-1]=r,i=0,r=0;r<16;r++)for(uD[r]=i,e=0;e<1<<eD[r];e++)oD[i++]=r;for(i>>=7;r<JR;r++)for(uD[r]=i<<7,e=0;e<1<<eD[r]-7;e++)oD[256+i++]=r;for(t=0;t<=XR;t++)o[t]=0;for(e=0;e<=143;)rD[2*e+1]=8,e++,o[8]++;for(;e<=255;)rD[2*e+1]=9,e++,o[9]++;for(;e<=279;)rD[2*e+1]=7,e++,o[7]++;for(;e<=287;)rD[2*e+1]=8,e++,o[8]++;for(vD(rD,287,o),e=0;e<JR;e++)iD[2*e+1]=5,iD[2*e]=wD(e,5);dD=new cD(rD,QR,257,YR,XR),lD=new cD(iD,eD,0,JR,XR),hD=new cD(new Array(0),tD,0,19,7)})(),xD=!0),e.l_desc=new fD(e.dyn_ltree,dD),e.d_desc=new fD(e.dyn_dtree,lD),e.bl_desc=new fD(e.bl_tree,hD),e.bi_buf=0,e.bi_valid=0,bD(e)},RD=(e,t,n,r)=>{let i,o,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<ZR;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ID(e,e.l_desc),ID(e,e.d_desc),s=(e=>{let t;for(SD(e,e.dyn_ltree,e.l_desc.max_code),SD(e,e.dyn_dtree,e.d_desc.max_code),ID(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*nD[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==t?BD(e,t,n,r):4===e.strategy||o===i?(mD(e,2+(r?1:0),3),kD(e,rD,iD)):(mD(e,4+(r?1:0),3),((e,t,n,r)=>{let i;for(mD(e,t-257,5),mD(e,n-1,5),mD(e,r-4,4),i=0;i<r;i++)mD(e,e.bl_tree[2*nD[i]+1],3);CD(e,e.dyn_ltree,t-1),CD(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),kD(e,e.dyn_ltree,e.dyn_dtree)),bD(e),r&&_D(e)},DD=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(sD[n]+ZR+1)]++,e.dyn_dtree[2*pD(t)]++),e.sym_next===e.sym_end),PD={_tr_init:TD,_tr_stored_block:BD,_tr_flush_block:RD,_tr_tally:DD,_tr_align:e=>{mD(e,2,3),yD(e,256,rD),(e=>{16===e.bi_valid?(gD(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var UD=(e,t,n,r)=>{let i=65535&e|0,o=e>>>16&65535|0,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do{i=i+t[r++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const OD=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var FD=(e,t,n,r)=>{const i=OD,o=r+n;e^=-1;for(let n=r;n<o;n++)e=e>>>8^i[255&(e^t[n])];return-1^e},MD={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},LD={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:qD,_tr_stored_block:zD,_tr_flush_block:ND,_tr_tally:jD,_tr_align:$D}=PD,{Z_NO_FLUSH:WD,Z_PARTIAL_FLUSH:HD,Z_FULL_FLUSH:KD,Z_FINISH:VD,Z_BLOCK:GD,Z_OK:ZD,Z_STREAM_END:YD,Z_STREAM_ERROR:JD,Z_DATA_ERROR:XD,Z_BUF_ERROR:QD,Z_DEFAULT_COMPRESSION:eP,Z_FILTERED:tP,Z_HUFFMAN_ONLY:nP,Z_RLE:rP,Z_FIXED:iP,Z_DEFAULT_STRATEGY:oP,Z_UNKNOWN:sP,Z_DEFLATED:aP}=LD,uP=258,cP=262,dP=42,lP=113,hP=666,fP=(e,t)=>(e.msg=MD[t],t),pP=e=>2*e-(e>4?9:0),gP=e=>{let t=e.length;for(;--t>=0;)e[t]=0},mP=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=i?n-i:0}while(--t);t=i,r=t;do{n=e.prev[--r],e.prev[r]=n>=i?n-i:0}while(--t)};let yP=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const wP=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},vP=(e,t)=>{ND(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,wP(e.strm)},bP=(e,t)=>{e.pending_buf[e.pending++]=t},_P=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},AP=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=UD(e.adler,t,i,n):2===e.state.wrap&&(e.adler=FD(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},EP=(e,t)=>{let n,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match;const u=e.strstart>e.w_size-cP?e.strstart-(e.w_size-cP):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+uP;let f=c[o+s-1],p=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(n=t,c[n+s]===p&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<h);if(r=uP-(h-o),o=h-uP,r>s){if(e.match_start=t,s=r,r>=a)break;f=c[o+s-1],p=c[o+s]}}}while((t=l[t&d])>u&&0!=--i);return s<=e.lookahead?s:e.lookahead},kP=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-cP)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),mP(e),r+=t),0===e.strm.avail_in)break;if(n=AP(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=yP(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=yP(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<cP&&0!==e.strm.avail_in)},IP=(e,t)=>{let n,r,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,a=e.strm.avail_in;do{if(n=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,r=e.strstart-e.block_start,n>r+e.strm.avail_in&&(n=r+e.strm.avail_in),n>i&&(n=i),n<o&&(0===n&&t!==VD||t===WD||n!==r+e.strm.avail_in))break;s=t===VD&&n===r+e.strm.avail_in?1:0,zD(e,0,0,s),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,wP(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(AP(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===s);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==WD&&t!==VD&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(AP(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=o||(r||t===VD)&&t!==WD&&0===e.strm.avail_in&&r<=i)&&(n=r>i?i:r,s=t===VD&&0===e.strm.avail_in&&n===r?1:0,zD(e,e.block_start,n,s),e.block_start+=n,wP(e.strm)),s?3:1)},SP=(e,t)=>{let n,r;for(;;){if(e.lookahead<cP){if(kP(e),e.lookahead<cP&&t===WD)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=yP(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-cP&&(e.match_length=EP(e,n)),e.match_length>=3)if(r=jD(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=yP(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=yP(e,e.ins_h,e.window[e.strstart+1]);else r=jD(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(vP(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===VD?(vP(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(vP(e,!1),0===e.strm.avail_out)?1:2},CP=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<cP){if(kP(e),e.lookahead<cP&&t===WD)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=yP(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-cP&&(e.match_length=EP(e,n),e.match_length<=5&&(e.strategy===tP||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=jD(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=yP(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(vP(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=jD(e,0,e.window[e.strstart-1]),r&&vP(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=jD(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===VD?(vP(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(vP(e,!1),0===e.strm.avail_out)?1:2};function xP(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const BP=[new xP(0,0,0,0,IP),new xP(4,4,8,4,SP),new xP(4,5,16,8,SP),new xP(4,6,32,32,SP),new xP(4,4,16,16,CP),new xP(8,16,32,32,CP),new xP(8,16,128,128,CP),new xP(8,32,128,256,CP),new xP(32,128,258,1024,CP),new xP(32,258,258,4096,CP)];function TP(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=aP,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),gP(this.dyn_ltree),gP(this.dyn_dtree),gP(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),gP(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),gP(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const RP=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==dP&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==lP&&t.status!==hP?1:0},DP=e=>{if(RP(e))return fP(e,JD);e.total_in=e.total_out=0,e.data_type=sP;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?dP:lP,e.adler=2===t.wrap?0:1,t.last_flush=-2,qD(t),ZD},PP=e=>{const t=DP(e);var n;return t===ZD&&((n=e.state).window_size=2*n.w_size,gP(n.head),n.max_lazy_match=BP[n.level].max_lazy,n.good_match=BP[n.level].good_length,n.nice_match=BP[n.level].nice_length,n.max_chain_length=BP[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},UP=(e,t,n,r,i,o)=>{if(!e)return JD;let s=1;if(t===eP&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>9||n!==aP||r<8||r>15||t<0||t>9||o<0||o>iP||8===r&&1!==s)return fP(e,JD);8===r&&(r=9);const a=new TP;return e.state=a,a.strm=e,a.status=dP,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=n,PP(e)};var OP={deflateInit:(e,t)=>UP(e,t,aP,15,8,oP),deflateInit2:UP,deflateReset:PP,deflateResetKeep:DP,deflateSetHeader:(e,t)=>RP(e)||2!==e.state.wrap?JD:(e.state.gzhead=t,ZD),deflate:(e,t)=>{if(RP(e)||t>GD||t<0)return e?fP(e,JD):JD;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===hP&&t!==VD)return fP(e,0===e.avail_out?QD:JD);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(wP(e),0===e.avail_out)return n.last_flush=-1,ZD}else if(0===e.avail_in&&pP(t)<=pP(r)&&t!==VD)return fP(e,QD);if(n.status===hP&&0!==e.avail_in)return fP(e,QD);if(n.status===dP&&0===n.wrap&&(n.status=lP),n.status===dP){let t=aP+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=nP||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,_P(n,t),0!==n.strstart&&(_P(n,e.adler>>>16),_P(n,65535&e.adler)),e.adler=1,n.status=lP,wP(e),0!==n.pending)return n.last_flush=-1,ZD}if(57===n.status)if(e.adler=0,bP(n,31),bP(n,139),bP(n,8),n.gzhead)bP(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),bP(n,255&n.gzhead.time),bP(n,n.gzhead.time>>8&255),bP(n,n.gzhead.time>>16&255),bP(n,n.gzhead.time>>24&255),bP(n,9===n.level?2:n.strategy>=nP||n.level<2?4:0),bP(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(bP(n,255&n.gzhead.extra.length),bP(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=FD(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(bP(n,0),bP(n,0),bP(n,0),bP(n,0),bP(n,0),bP(n,9===n.level?2:n.strategy>=nP||n.level<2?4:0),bP(n,3),n.status=lP,wP(e),0!==n.pending)return n.last_flush=-1,ZD;if(69===n.status){if(n.gzhead.extra){let t=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=FD(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,wP(e),0!==n.pending)return n.last_flush=-1,ZD;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=FD(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=FD(e.adler,n.pending_buf,n.pending-r,r)),wP(e),0!==n.pending)return n.last_flush=-1,ZD;r=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,bP(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=FD(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=FD(e.adler,n.pending_buf,n.pending-r,r)),wP(e),0!==n.pending)return n.last_flush=-1,ZD;r=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,bP(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=FD(e.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(wP(e),0!==n.pending))return n.last_flush=-1,ZD;bP(n,255&e.adler),bP(n,e.adler>>8&255),e.adler=0}if(n.status=lP,wP(e),0!==n.pending)return n.last_flush=-1,ZD}if(0!==e.avail_in||0!==n.lookahead||t!==WD&&n.status!==hP){let r=0===n.level?IP(n,t):n.strategy===nP?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(kP(e),0===e.lookahead)){if(t===WD)return 1;break}if(e.match_length=0,n=jD(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(vP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===VD?(vP(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(vP(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===rP?((e,t)=>{let n,r,i,o;const s=e.window;for(;;){if(e.lookahead<=uP){if(kP(e),e.lookahead<=uP&&t===WD)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=e.strstart+uP;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<o);e.match_length=uP-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=jD(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=jD(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(vP(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===VD?(vP(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(vP(e,!1),0===e.strm.avail_out)?1:2})(n,t):BP[n.level].func(n,t);if(3!==r&&4!==r||(n.status=hP),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),ZD;if(2===r&&(t===HD?$D(n):t!==GD&&(zD(n,0,0,!1),t===KD&&(gP(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),wP(e),0===e.avail_out))return n.last_flush=-1,ZD}return t!==VD?ZD:n.wrap<=0?YD:(2===n.wrap?(bP(n,255&e.adler),bP(n,e.adler>>8&255),bP(n,e.adler>>16&255),bP(n,e.adler>>24&255),bP(n,255&e.total_in),bP(n,e.total_in>>8&255),bP(n,e.total_in>>16&255),bP(n,e.total_in>>24&255)):(_P(n,e.adler>>>16),_P(n,65535&e.adler)),wP(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?ZD:YD)},deflateEnd:e=>{if(RP(e))return JD;const t=e.state.status;return e.state=null,t===lP?fP(e,XD):ZD},deflateSetDictionary:(e,t)=>{let n=t.length;if(RP(e))return JD;const r=e.state,i=r.wrap;if(2===i||1===i&&r.status!==dP||r.lookahead)return JD;if(1===i&&(e.adler=UD(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===i&&(gP(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const o=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,kP(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=yP(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,kP(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,r.wrap=i,ZD},deflateInfo:"pako deflate (from Nodeca project)"};const FP=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var MP=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)FP(n,t)&&(e[t]=n[t])}}return e},LP=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n};let qP=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){qP=!1}const zP=new Uint8Array(256);for(let e=0;e<256;e++)zP[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;zP[254]=zP[254]=1;var NP=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,i,o,s=e.length,a=0;for(i=0;i<s;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<s&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<s&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},jP=(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,i;const o=new Array(2*n);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){o[i++]=t;continue}let s=zP[t];if(s>4)o[i++]=65533,r+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&r<n;)t=t<<6|63&e[r++],s--;s>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&qP)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n})(o,i)},$P=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+zP[e[n]]>t?n:t};var WP=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const HP=Object.prototype.toString,{Z_NO_FLUSH:KP,Z_SYNC_FLUSH:VP,Z_FULL_FLUSH:GP,Z_FINISH:ZP,Z_OK:YP,Z_STREAM_END:JP,Z_DEFAULT_COMPRESSION:XP,Z_DEFAULT_STRATEGY:QP,Z_DEFLATED:eU}=LD;function tU(e){this.options=MP({level:XP,method:eU,chunkSize:16384,windowBits:15,memLevel:8,strategy:QP},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new WP,this.strm.avail_out=0;let n=OP.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==YP)throw new Error(MD[n]);if(t.header&&OP.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?NP(t.dictionary):"[object ArrayBuffer]"===HP.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=OP.deflateSetDictionary(this.strm,e),n!==YP)throw new Error(MD[n]);this._dict_set=!0}}tU.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?ZP:KP,"string"==typeof e?n.input=NP(e):"[object ArrayBuffer]"===HP.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===VP||o===GP)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=OP.deflate(n,o),i===JP)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=OP.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===YP;if(0!==n.avail_out){if(o>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},tU.prototype.onData=function(e){this.chunks.push(e)},tU.prototype.onEnd=function(e){e===YP&&(this.result=LP(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const nU=16209;var rU=function(e,t){let n,r,i,o,s,a,u,c,d,l,h,f,p,g,m,y,w,v,b,_,A,E,k,I;const S=e.state;n=e.next_in,k=e.input,r=n+(e.avail_in-5),i=e.next_out,I=e.output,o=i-(t-e.avail_out),s=i+(e.avail_out-257),a=S.dmax,u=S.wsize,c=S.whave,d=S.wnext,l=S.window,h=S.hold,f=S.bits,p=S.lencode,g=S.distcode,m=(1<<S.lenbits)-1,y=(1<<S.distbits)-1;e:do{f<15&&(h+=k[n++]<<f,f+=8,h+=k[n++]<<f,f+=8),w=p[h&m];t:for(;;){if(v=w>>>24,h>>>=v,f-=v,v=w>>>16&255,0===v)I[i++]=65535&w;else{if(!(16&v)){if(0==(64&v)){w=p[(65535&w)+(h&(1<<v)-1)];continue t}if(32&v){S.mode=16191;break e}e.msg="invalid literal/length code",S.mode=nU;break e}b=65535&w,v&=15,v&&(f<v&&(h+=k[n++]<<f,f+=8),b+=h&(1<<v)-1,h>>>=v,f-=v),f<15&&(h+=k[n++]<<f,f+=8,h+=k[n++]<<f,f+=8),w=g[h&y];n:for(;;){if(v=w>>>24,h>>>=v,f-=v,v=w>>>16&255,!(16&v)){if(0==(64&v)){w=g[(65535&w)+(h&(1<<v)-1)];continue n}e.msg="invalid distance code",S.mode=nU;break e}if(_=65535&w,v&=15,f<v&&(h+=k[n++]<<f,f+=8,f<v&&(h+=k[n++]<<f,f+=8)),_+=h&(1<<v)-1,_>a){e.msg="invalid distance too far back",S.mode=nU;break e}if(h>>>=v,f-=v,v=i-o,_>v){if(v=_-v,v>c&&S.sane){e.msg="invalid distance too far back",S.mode=nU;break e}if(A=0,E=l,0===d){if(A+=u-v,v<b){b-=v;do{I[i++]=l[A++]}while(--v);A=i-_,E=I}}else if(d<v){if(A+=u+d-v,v-=d,v<b){b-=v;do{I[i++]=l[A++]}while(--v);if(A=0,d<b){v=d,b-=v;do{I[i++]=l[A++]}while(--v);A=i-_,E=I}}}else if(A+=d-v,v<b){b-=v;do{I[i++]=l[A++]}while(--v);A=i-_,E=I}for(;b>2;)I[i++]=E[A++],I[i++]=E[A++],I[i++]=E[A++],b-=3;b&&(I[i++]=E[A++],b>1&&(I[i++]=E[A++]))}else{A=i-_;do{I[i++]=I[A++],I[i++]=I[A++],I[i++]=I[A++],b-=3}while(b>2);b&&(I[i++]=I[A++],b>1&&(I[i++]=I[A++]))}break}}break}}while(n<r&&i<s);b=f>>3,n-=b,f-=b<<3,h&=(1<<f)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=i<s?s-i+257:257-(i-s),S.hold=h,S.bits=f};const iU=15,oU=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),sU=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),aU=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),uU=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var cU=(e,t,n,r,i,o,s,a)=>{const u=a.bits;let c,d,l,h,f,p,g=0,m=0,y=0,w=0,v=0,b=0,_=0,A=0,E=0,k=0,I=null;const S=new Uint16Array(16),C=new Uint16Array(16);let x,B,T,R=null;for(g=0;g<=iU;g++)S[g]=0;for(m=0;m<r;m++)S[t[n+m]]++;for(v=u,w=iU;w>=1&&0===S[w];w--);if(v>w&&(v=w),0===w)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(y=1;y<w&&0===S[y];y++);for(v<y&&(v=y),A=1,g=1;g<=iU;g++)if(A<<=1,A-=S[g],A<0)return-1;if(A>0&&(0===e||1!==w))return-1;for(C[1]=0,g=1;g<iU;g++)C[g+1]=C[g]+S[g];for(m=0;m<r;m++)0!==t[n+m]&&(s[C[t[n+m]]++]=m);if(0===e?(I=R=s,p=20):1===e?(I=oU,R=sU,p=257):(I=aU,R=uU,p=0),k=0,m=0,g=y,f=o,b=v,_=0,l=-1,E=1<<v,h=E-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){x=g-_,s[m]+1<p?(B=0,T=s[m]):s[m]>=p?(B=R[s[m]-p],T=I[s[m]-p]):(B=96,T=0),c=1<<g-_,d=1<<b,y=d;do{d-=c,i[f+(k>>_)+d]=x<<24|B<<16|T|0}while(0!==d);for(c=1<<g-1;k&c;)c>>=1;if(0!==c?(k&=c-1,k+=c):k=0,m++,0==--S[g]){if(g===w)break;g=t[n+s[m]]}if(g>v&&(k&h)!==l){for(0===_&&(_=v),f+=y,b=g-_,A=1<<b;b+_<w&&(A-=S[b+_],!(A<=0));)b++,A<<=1;if(E+=1<<b,1===e&&E>852||2===e&&E>592)return 1;l=k&h,i[l]=v<<24|b<<16|f-o|0}}return 0!==k&&(i[f+k]=g-_<<24|64<<16|0),a.bits=v,0};const{Z_FINISH:dU,Z_BLOCK:lU,Z_TREES:hU,Z_OK:fU,Z_STREAM_END:pU,Z_NEED_DICT:gU,Z_STREAM_ERROR:mU,Z_DATA_ERROR:yU,Z_MEM_ERROR:wU,Z_BUF_ERROR:vU,Z_DEFLATED:bU}=LD,_U=16180,AU=16190,EU=16191,kU=16192,IU=16194,SU=16199,CU=16200,xU=16206,BU=16209,TU=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function RU(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const DU=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<_U||t.mode>16211?1:0},PU=e=>{if(DU(e))return mU;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=_U,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,fU},UU=e=>{if(DU(e))return mU;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,PU(e)},OU=(e,t)=>{let n;if(DU(e))return mU;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?mU:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,UU(e))},FU=(e,t)=>{if(!e)return mU;const n=new RU;e.state=n,n.strm=e,n.window=null,n.mode=_U;const r=OU(e,t);return r!==fU&&(e.state=null),r};let MU,LU,qU=!0;const zU=e=>{if(qU){MU=new Int32Array(512),LU=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(cU(1,e.lens,0,288,MU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cU(2,e.lens,0,32,LU,0,e.work,{bits:5}),qU=!1}e.lencode=MU,e.lenbits=9,e.distcode=LU,e.distbits=5},NU=(e,t,n,r)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var jU=(e,t)=>{let n,r,i,o,s,a,u,c,d,l,h,f,p,g,m,y,w,v,b,_,A,E,k=0;const I=new Uint8Array(4);let S,C;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(DU(e)||!e.output||!e.input&&0!==e.avail_in)return mU;n=e.state,n.mode===EU&&(n.mode=kU),s=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,d=n.bits,l=a,h=u,E=fU;e:for(;;)switch(n.mode){case _U:if(0===n.wrap){n.mode=kU;break}for(;d<16;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(2&n.wrap&&35615===c){0===n.wbits&&(n.wbits=15),n.check=0,I[0]=255&c,I[1]=c>>>8&255,n.check=FD(n.check,I,2,0),c=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=BU;break}if((15&c)!==bU){e.msg="unknown compression method",n.mode=BU;break}if(c>>>=4,d-=4,A=8+(15&c),0===n.wbits&&(n.wbits=A),A>15||A>n.wbits){e.msg="invalid window size",n.mode=BU;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&c?16189:EU,c=0,d=0;break;case 16181:for(;d<16;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(n.flags=c,(255&n.flags)!==bU){e.msg="unknown compression method",n.mode=BU;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=BU;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&4&n.wrap&&(I[0]=255&c,I[1]=c>>>8&255,n.check=FD(n.check,I,2,0)),c=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}n.head&&(n.head.time=c),512&n.flags&&4&n.wrap&&(I[0]=255&c,I[1]=c>>>8&255,I[2]=c>>>16&255,I[3]=c>>>24&255,n.check=FD(n.check,I,4,0)),c=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&4&n.wrap&&(I[0]=255&c,I[1]=c>>>8&255,n.check=FD(n.check,I,2,0)),c=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&4&n.wrap&&(I[0]=255&c,I[1]=c>>>8&255,n.check=FD(n.check,I,2,0)),c=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(f=n.length,f>a&&(f=a),f&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+f),A)),512&n.flags&&4&n.wrap&&(n.check=FD(n.check,r,f,o)),a-=f,o+=f,n.length-=f),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break e;f=0;do{A=r[o+f++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A))}while(A&&f<a);if(512&n.flags&&4&n.wrap&&(n.check=FD(n.check,r,f,o)),a-=f,o+=f,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===a)break e;f=0;do{A=r[o+f++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A))}while(A&&f<a);if(512&n.flags&&4&n.wrap&&(n.check=FD(n.check,r,f,o)),a-=f,o+=f,A)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;d<16;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(4&n.wrap&&c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=BU;break}c=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=EU;break;case 16189:for(;d<32;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}e.adler=n.check=TU(c),c=0,d=0,n.mode=AU;case AU:if(0===n.havedict)return e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=d,gU;e.adler=n.check=1,n.mode=EU;case EU:if(t===lU||t===hU)break e;case kU:if(n.last){c>>>=7&d,d-=7&d,n.mode=xU;break}for(;d<3;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}switch(n.last=1&c,c>>>=1,d-=1,3&c){case 0:n.mode=16193;break;case 1:if(zU(n),n.mode=SU,t===hU){c>>>=2,d-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=BU}c>>>=2,d-=2;break;case 16193:for(c>>>=7&d,d-=7&d;d<32;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=BU;break}if(n.length=65535&c,c=0,d=0,n.mode=IU,t===hU)break e;case IU:n.mode=16195;case 16195:if(f=n.length,f){if(f>a&&(f=a),f>u&&(f=u),0===f)break e;i.set(r.subarray(o,o+f),s),a-=f,o+=f,u-=f,s+=f,n.length-=f;break}n.mode=EU;break;case 16196:for(;d<14;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(n.nlen=257+(31&c),c>>>=5,d-=5,n.ndist=1+(31&c),c>>>=5,d-=5,n.ncode=4+(15&c),c>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=BU;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;d<3;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}n.lens[x[n.have++]]=7&c,c>>>=3,d-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,S={bits:n.lenbits},E=cU(0,n.lens,0,19,n.lencode,0,n.work,S),n.lenbits=S.bits,E){e.msg="invalid code lengths set",n.mode=BU;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;k=n.lencode[c&(1<<n.lenbits)-1],m=k>>>24,y=k>>>16&255,w=65535&k,!(m<=d);){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(w<16)c>>>=m,d-=m,n.lens[n.have++]=w;else{if(16===w){for(C=m+2;d<C;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(c>>>=m,d-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=BU;break}A=n.lens[n.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===w){for(C=m+3;d<C;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}c>>>=m,d-=m,A=0,f=3+(7&c),c>>>=3,d-=3}else{for(C=m+7;d<C;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}c>>>=m,d-=m,A=0,f=11+(127&c),c>>>=7,d-=7}if(n.have+f>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=BU;break}for(;f--;)n.lens[n.have++]=A}}if(n.mode===BU)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=BU;break}if(n.lenbits=9,S={bits:n.lenbits},E=cU(1,n.lens,0,n.nlen,n.lencode,0,n.work,S),n.lenbits=S.bits,E){e.msg="invalid literal/lengths set",n.mode=BU;break}if(n.distbits=6,n.distcode=n.distdyn,S={bits:n.distbits},E=cU(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,S),n.distbits=S.bits,E){e.msg="invalid distances set",n.mode=BU;break}if(n.mode=SU,t===hU)break e;case SU:n.mode=CU;case CU:if(a>=6&&u>=258){e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=d,rU(e,h),s=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,c=n.hold,d=n.bits,n.mode===EU&&(n.back=-1);break}for(n.back=0;k=n.lencode[c&(1<<n.lenbits)-1],m=k>>>24,y=k>>>16&255,w=65535&k,!(m<=d);){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(y&&0==(240&y)){for(v=m,b=y,_=w;k=n.lencode[_+((c&(1<<v+b)-1)>>v)],m=k>>>24,y=k>>>16&255,w=65535&k,!(v+m<=d);){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}c>>>=v,d-=v,n.back+=v}if(c>>>=m,d-=m,n.back+=m,n.length=w,0===y){n.mode=16205;break}if(32&y){n.back=-1,n.mode=EU;break}if(64&y){e.msg="invalid literal/length code",n.mode=BU;break}n.extra=15&y,n.mode=16201;case 16201:if(n.extra){for(C=n.extra;d<C;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;k=n.distcode[c&(1<<n.distbits)-1],m=k>>>24,y=k>>>16&255,w=65535&k,!(m<=d);){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(0==(240&y)){for(v=m,b=y,_=w;k=n.distcode[_+((c&(1<<v+b)-1)>>v)],m=k>>>24,y=k>>>16&255,w=65535&k,!(v+m<=d);){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}c>>>=v,d-=v,n.back+=v}if(c>>>=m,d-=m,n.back+=m,64&y){e.msg="invalid distance code",n.mode=BU;break}n.offset=w,n.extra=15&y,n.mode=16203;case 16203:if(n.extra){for(C=n.extra;d<C;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=BU;break}n.mode=16204;case 16204:if(0===u)break e;if(f=h-u,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=BU;break}f>n.wnext?(f-=n.wnext,p=n.wsize-f):p=n.wnext-f,f>n.length&&(f=n.length),g=n.window}else g=i,p=s-n.offset,f=n.length;f>u&&(f=u),u-=f,n.length-=f;do{i[s++]=g[p++]}while(--f);0===n.length&&(n.mode=CU);break;case 16205:if(0===u)break e;i[s++]=n.length,u--,n.mode=CU;break;case xU:if(n.wrap){for(;d<32;){if(0===a)break e;a--,c|=r[o++]<<d,d+=8}if(h-=u,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?FD(n.check,i,h,s-h):UD(n.check,i,h,s-h)),h=u,4&n.wrap&&(n.flags?c:TU(c))!==n.check){e.msg="incorrect data check",n.mode=BU;break}c=0,d=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;d<32;){if(0===a)break e;a--,c+=r[o++]<<d,d+=8}if(4&n.wrap&&c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=BU;break}c=0,d=0}n.mode=16208;case 16208:E=pU;break e;case BU:E=yU;break e;case 16210:return wU;default:return mU}return e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=a,n.hold=c,n.bits=d,(n.wsize||h!==e.avail_out&&n.mode<BU&&(n.mode<xU||t!==dU))&&NU(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?FD(n.check,i,h,e.next_out-h):UD(n.check,i,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===EU?128:0)+(n.mode===SU||n.mode===IU?256:0),(0===l&&0===h||t===dU)&&E===fU&&(E=vU),E},$U={inflateReset:UU,inflateReset2:OU,inflateResetKeep:PU,inflateInit:e=>FU(e,15),inflateInit2:FU,inflate:jU,inflateEnd:e=>{if(DU(e))return mU;let t=e.state;return t.window&&(t.window=null),e.state=null,fU},inflateGetHeader:(e,t)=>{if(DU(e))return mU;const n=e.state;return 0==(2&n.wrap)?mU:(n.head=t,t.done=!1,fU)},inflateSetDictionary:(e,t)=>{const n=t.length;let r,i,o;return DU(e)?mU:(r=e.state,0!==r.wrap&&r.mode!==AU?mU:r.mode===AU&&(i=1,i=UD(i,t,n,0),i!==r.check)?yU:(o=NU(e,t,n,n),o?(r.mode=16210,wU):(r.havedict=1,fU)))},inflateInfo:"pako inflate (from Nodeca project)"};var WU=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const HU=Object.prototype.toString,{Z_NO_FLUSH:KU,Z_FINISH:VU,Z_OK:GU,Z_STREAM_END:ZU,Z_NEED_DICT:YU,Z_STREAM_ERROR:JU,Z_DATA_ERROR:XU,Z_MEM_ERROR:QU}=LD;function eO(e){this.options=MP({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new WP,this.strm.avail_out=0;let n=$U.inflateInit2(this.strm,t.windowBits);if(n!==GU)throw new Error(MD[n]);if(this.header=new WU,$U.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=NP(t.dictionary):"[object ArrayBuffer]"===HU.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=$U.inflateSetDictionary(this.strm,t.dictionary),n!==GU)))throw new Error(MD[n])}eO.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=t===~~t?t:!0===t?VU:KU,"[object ArrayBuffer]"===HU.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=$U.inflate(n,s),o===YU&&i&&(o=$U.inflateSetDictionary(n,i),o===GU?o=$U.inflate(n,s):o===XU&&(o=YU));n.avail_in>0&&o===ZU&&n.state.wrap>0&&0!==e[n.next_in];)$U.inflateReset(n),o=$U.inflate(n,s);switch(o){case JU:case XU:case YU:case QU:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||o===ZU))if("string"===this.options.to){let e=$P(n.output,n.next_out),t=n.next_out-e,i=jP(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(o!==GU||0!==a){if(o===ZU)return o=$U.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},eO.prototype.onData=function(e){this.chunks.push(e)},eO.prototype.onEnd=function(e){e===GU&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=LP(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,i,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var u,c,d=this._events[a],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,o),!0;case 6:return d.fn.call(d.context,t,r,i,o,s),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var h,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,i);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];d[c].fn.apply(d[c].context,u)}}return!0},a.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var u=0,c=[],d=a.length;u<d;u++)(a[u].fn!==t||i&&!a[u].once||r&&a[u].context!==r)&&c.push(a[u]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}({exports:{}});class tO extends TypeError{constructor(e,t){let n;const{message:r,...i}=e,{path:o}=e;super(0===o.length?r:"At path: "+o.join(".")+" -- "+r),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var r;return null!=(r=n)?r:n=[e,...t()]}}}function nO(e){return"object"==typeof e&&null!=e}function rO(e){return"string"==typeof e?JSON.stringify(e):""+e}function iO(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=n,{refinement:a,message:u="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+rO(r)+"`"}=e;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:u}}function*oO(e,t,n,r){var i;nO(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=iO(i,t,n,r);e&&(yield e)}}function*sO(e,t,n){void 0===n&&(n={});const{path:r=[],branch:i=[e],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(e=t.coercer(e,a),s&&"type"!==t.type&&nO(t.schema)&&nO(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let u=!0;for(const n of t.validator(e,a))u=!1,yield[n,void 0];for(let[n,c,d]of t.entries(e,a)){const t=sO(c,d,{path:void 0===n?r:[...r,n],branch:void 0===n?i:[...i,c],coerce:o,mask:s});for(const r of t)r[0]?(u=!1,yield[r[0],void 0]):o&&(c=r[1],void 0===n?e=c:e instanceof Map?e.set(n,c):e instanceof Set?e.add(c):nO(e)&&(e[n]=c))}if(u)for(const n of t.refiner(e,a))u=!1,yield[n,void 0];u&&(yield[void 0,e])}class aO{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:r,refiner:i,coercer:o=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(e,t)=>oO(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>oO(i(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const n=dO(e,t);if(n[0])throw n[0]}(e,this)}create(e){return uO(e,this)}is(e){return cO(e,this)}mask(e){return function(e,t){const n=dO(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(e,this)}validate(e,t){return void 0===t&&(t={}),dO(e,this,t)}}function uO(e,t){const n=dO(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function cO(e,t){return!dO(e,t)[0]}function dO(e,t,n){void 0===n&&(n={});const r=sO(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new tO(i[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,i[1]]}function lO(e,t){return new aO({type:e,schema:null,validator:t})}function hO(e){return new aO({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+rO(e)})}function fO(e){const t=rO(e),n=typeof e;return new aO({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||"Expected the literal `"+t+"`, but received: "+rO(n)})}function pO(e){return new aO({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function gO(){return lO("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+rO(e)))}function mO(e){return new aO({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function yO(){return lO("string",(e=>"string"==typeof e||"Expected a string, but received: "+rO(e)))}function wO(e){const t=Object.keys(e);return new aO({type:"type",schema:e,*entries(n){if(nO(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>nO(e)||"Expected an object, but received: "+rO(e)})}function vO(e){const t=e.map((e=>e.type)).join(" | ");return new aO({type:"union",schema:null,coercer:(t,n)=>(e.find((e=>{const[n]=e.validate(t,{coerce:!0});return!n}))||bO()).coercer(t,n),validator(n,r){const i=[];for(const t of e){const[...e]=sO(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+rO(n),...i]}})}function bO(){return lO("unknown",(()=>!0))}function _O(e){return function(e,t,n){return new aO({...e,coercer:(r,i)=>cO(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}(EO(e),AO,(t=>"error"in t?t:{...t,result:uO(t.result,e)}))}const AO=EO(bO());function EO(e){return vO([wO({jsonrpc:fO("2.0"),id:yO(),result:e}),wO({jsonrpc:fO("2.0"),id:yO(),error:wO({code:bO(),message:yO(),data:mO(lO("any",(()=>!0)))})})])}var kO;kO=wO({err:pO(vO([wO({}),yO()])),logs:pO(hO(yO())),accounts:mO(pO(hO(pO(wO({executable:lO("boolean",(e=>"boolean"==typeof e)),owner:yO(),lamports:gO(),data:hO(yO()),rentEpoch:mO(gO())}))))),unitsConsumed:mO(gO())}),_O(wO({context:wO({slot:gO()}),value:kO}));var IO="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};class SO{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}decode(e,t){throw new Error("Layout is abstract")}encode(e,t,n){throw new Error("Layout is abstract")}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}var CO=SO;class xO extends SO{isCount(){throw new Error("ExternalLayout is abstract")}}class BO extends xO{constructor(e,t,n){if(!(e instanceof SO))throw new TypeError("layout must be a Layout");if(void 0===t)t=0;else if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof TO||this.layout instanceof RO}decode(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}encode(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}class TO extends SO{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}class RO extends SO{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}encode(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}const DO=Math.pow(2,32);function PO(e){const t=Math.floor(e/DO);return{hi32:t,lo32:e-t*DO}}function UO(e,t){return e*DO+t}class OO extends SO{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return UO(e.readUInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=PO(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}class FO extends SO{constructor(e){super(8,e)}decode(e,t){void 0===t&&(t=0);const n=e.readUInt32LE(t);return UO(e.readInt32LE(t+4),n)}encode(e,t,n){void 0===n&&(n=0);const r=PO(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}class MO extends SO{constructor(e,t,n){if(!Array.isArray(e)||!e.reduce(((e,t)=>e&&t instanceof SO),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===n&&(n=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let r=-1;try{r=e.reduce(((e,t)=>e+t.getSpan()),0)}catch(e){}super(r,t),this.fields=e,this.decodePrefixes=!!n}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;try{n=this.fields.reduce(((n,r)=>{const i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}decode(e,t){void 0===t&&(t=0);const n=this.makeDestinationObject();for(const r of this.fields)if(void 0!==r.property&&(n[r.property]=r.decode(e,t)),t+=r.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return n}encode(e,t,n){void 0===n&&(n=0);const r=n;let i=0,o=0;for(const r of this.fields){let s=r.span;if(o=0<s?s:0,void 0!==r.property){const i=e[r.property];void 0!==i&&(o=r.encode(i,t,n),0>s&&(s=r.getSpan(t,n)))}i=n,n+=s}return i+o-r}fromArray(e){const t=this.makeDestinationObject();for(const n of this.fields)void 0!==n.property&&0<e.length&&(t[n.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw new TypeError("property must be string");for(const t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw new TypeError("property must be string");let t=0;for(const n of this.fields){if(n.property===e)return t;0>n.span?t=-1:0<=t&&(t+=n.span)}}}class LO{constructor(e){this.property=e}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class qO extends LO{constructor(e,t){if(!(e instanceof xO&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,n){return this.layout.encode(e,t,n)}}class zO extends SO{constructor(e,t,n){const r=e instanceof TO||e instanceof RO;if(r)e=new qO(new BO(e));else if(e instanceof xO&&e.isCount())e=new qO(e);else if(!(e instanceof LO))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof SO))throw new TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw new Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&(i=t.span,0<=i&&r&&(i+=e.layout.span)),super(i,n),this.discriminator=e,this.usesPrefixDiscriminator=r,this.defaultLayout=t,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return o(e)},this.configGetSourceVariant=function(e){o=e.bind(this)}}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);const n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}defaultGetSourceVariant(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;const t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(const t in this.registry){const n=this.registry[t];if(e.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(e,t){let n;void 0===t&&(t=0);const r=this.discriminator,i=r.decode(e,t);let o=this.registry[i];if(void 0===o){let s=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(s=r.layout.span),n=this.makeDestinationObject(),n[r.property]=i,n[o.property]=this.defaultLayout.decode(e,t+s)}else n=o.decode(e,t);return n}encode(e,t,n){void 0===n&&(n=0);const r=this.getSourceVariant(e);if(void 0===r){const r=this.discriminator,i=this.defaultLayout;let o=0;return this.usesPrefixDiscriminator&&(o=r.layout.span),r.encode(e[r.property],t,n),o+i.encode(e[i.property],t,n+o)}return r.encode(e,t,n)}addVariant(e,t,n){const r=new NO(this,e,t,n);return this.registry[e]=r,r}getVariant(e,t){let n=e;return Buffer.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}class NO extends SO{constructor(e,t,n,r){if(!(e instanceof zO))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof n&&void 0===r&&(r=n,n=null),n){if(!(n instanceof SO))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof r)throw new TypeError("variant must have a String property")}let i=e.span;0>e.span&&(i=n?n.span:0,0<=i&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span)),super(i,r),this.union=e,this.variant=t,this.layout=n||null}getSpan(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}decode(e,t){const n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,t,n){void 0===n&&(n=0);let r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);let i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}class jO extends SO{constructor(e,t){if(!(e instanceof xO&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof xO||(n=e),super(n,t),this.length=e}getSpan(e,t){let n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}decode(e,t){void 0===t&&(t=0);let n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}encode(e,t,n){let r=this.length;if(this.length instanceof xO&&(r=e.length),!Buffer.isBuffer(e)||r!==e.length)throw new TypeError((i="Blob.encode",((o=this).property?i+"["+o.property+"]":i)+" requires (length "+r+") Buffer as src"));var i,o;if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof xO&&this.length.encode(r,t,n),r}}var $O=(e,t,n)=>new BO(e,t,n),WO=e=>new TO(4,e),HO=e=>new FO(e),KO=(e,t,n)=>new MO(e,t,n),VO=(e,t,n)=>new zO(e,t,n),GO=(e,t)=>new jO(e,t);class ZO extends CO{constructor(e){super(-1,e),this.property=e,this.layout=KO([WO("length"),WO("lengthPadding"),GO($O(WO(),-8),"chars")],this.property)}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null==e)return this.layout.span;const r={chars:Buffer.from(e,"utf8")};return this.layout.encode(r,t,n)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.decode(e,t).chars.toString()}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return WO().span+WO().span+new XA(new Uint8Array(e).slice(t,t+4),10,"le").toNumber()}}function YO(e){return new ZO(e)}function JO(e){return GO(32,e)}const XO=VO(WO("instruction"));XO.addVariant(0,KO([HO("lamports"),HO("space"),JO("owner")]),"createAccount"),XO.addVariant(1,KO([JO("owner")]),"assign"),XO.addVariant(2,KO([HO("lamports")]),"transfer"),XO.addVariant(3,KO([JO("base"),YO("seed"),HO("lamports"),HO("space"),JO("owner")]),"createAccountWithSeed"),XO.addVariant(4,KO([JO("authorized")]),"advanceNonceAccount"),XO.addVariant(5,KO([HO("lamports")]),"withdrawNonceAccount"),XO.addVariant(6,KO([JO("authorized")]),"initializeNonceAccount"),XO.addVariant(7,KO([JO("authorized")]),"authorizeNonceAccount"),XO.addVariant(8,KO([HO("space")]),"allocate"),XO.addVariant(9,KO([JO("base"),YO("seed"),HO("space"),JO("owner")]),"allocateWithSeed"),XO.addVariant(10,KO([JO("base"),YO("seed"),JO("owner")]),"assignWithSeed"),XO.addVariant(11,KO([HO("lamports"),YO("seed"),JO("owner")]),"transferWithSeed"),Math.max(...Object.values(XO.registry).map((e=>e.span)));class QO extends CO{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}function eF(e){return new QO(GO(32),(e=>new VS(e)),(e=>e.toBuffer()),e)}var tF;KO([WO("version"),WO("state"),eF("authorizedPubkey"),eF("nonce"),KO([(tF="lamportsPerSignature",new OO(tF))],"feeCalculator")]);new VS("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),new VS("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var nF={exports:{}};function rF(e){return new sF(GO(8),(e=>uF.fromBuffer(e)),(e=>e.toBuffer()),e)}function iF(e){return new sF(GO(32),(e=>new VS(e)),(e=>e.toBuffer()),e)}function oF(e,t){return new aF(e,t)}!function(e,t){var n="undefined"!=typeof self?self:IO,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(e,t){e=c(e),t=d(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},h.prototype.delete=function(e){delete this.map[c(e)]},h.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},h.prototype.set=function(e,t){this.map[c(e)]=d(t)},h.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),l(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),l(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),l(e)},r&&(h.prototype[Symbol.iterator]=h.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(e,t){var n,r,i=(t=t||{}).body;if(e instanceof v){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new h(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new h(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),w.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function _(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},y.call(v.prototype),y.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];_.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var s=new v(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new _(i,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=h,e.Request=v,e.Response=_),t.Headers=h,t.Request=v,t.Response=_,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(nF,nF.exports),lR.rustEnum([lR.struct([],"uninitialized"),lR.struct([lR.option(lR.publicKey(),"authorityAddress")],"buffer"),lR.struct([lR.publicKey("programdataAddress")],"program"),lR.struct([lR.u64("slot"),lR.option(lR.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,lR.u32()),lR.struct([lR.publicKey("authority"),lR.vecU8("data")]);class sF extends CO{constructor(e,t,n,r){super(e.span,r),this.layout=e,this.decoder=t,this.encoder=n}decode(e,t){return this.decoder(this.layout.decode(e,t))}encode(e,t,n){return this.layout.encode(this.encoder(e),t,n)}getSpan(e,t){return this.layout.getSpan(e,t)}}class aF extends CO{constructor(e,t){super(-1,t),this.layout=e,this.discriminator=WO()}encode(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==e?this.layout.span+this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+4)+4)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.getSpan(e,t+4)+4}}class uF extends XA{toBuffer(){const e=super.toArray().reverse(),t=Buffer.from(e);if(8===t.length)return t;if(t.length>=8)throw new Error("u64 too large");const n=Buffer.alloc(8);return t.copy(n),n}static fromBuffer(e){if(8!==e.length)throw new Error(`Invalid buffer length: ${e.length}`);return new uF([...e].reverse().map((e=>`00${e.toString(16)}`.slice(-2))).join(""),16)}}KO([iF("mint"),iF("owner"),rF("amount"),oF(iF(),"delegate"),(e=>{const t=VO((e=>new TO(1,e))("discriminator"),null,"state");return t.addVariant(0,KO([]),"uninitialized"),t.addVariant(1,KO([]),"initialized"),t.addVariant(2,KO([]),"frozen"),t})(),oF(rF(),"isNative"),rF("delegatedAmount"),oF(iF(),"closeAuthority")]),$C.programId,new VS("11111111111111111111111111111111"),new VS("paytYpX3LPN98TAeen6bFFeraGSuWnomZmCXjAsoqPa"),Tf.object({ethWallet:Tf.string().optional(),mint:CT,feePayer:IT.optional()}).strict(),Tf.object({ethWallet:Tf.string().optional(),mint:CT}).strict(),Tf.object({feePayer:IT.optional(),ethWallet:Tf.string().optional(),mint:CT,destination:IT}),Tf.object({ethWallet:Tf.string().optional(),destination:IT,amount:Tf.bigint(),mint:CT,instructionIndex:Tf.number().optional()}).strict(),Tf.object({manager:IT,sender:Tf.string(),operator:Tf.string(),feePayer:IT.optional()}),Tf.object({challengeId:Tf.string(),specifier:Tf.string(),senderEthAddress:Tf.string(),feePayer:IT.optional()}),Tf.object({challengeId:Tf.string(),specifier:Tf.string(),recipientEthAddress:Tf.string(),senderEthAddress:Tf.string(),amount:Tf.bigint(),antiAbuseOracleEthAddress:Tf.string().optional(),senderSignature:Tf.string(),instructionIndex:Tf.number().optional()}),Tf.object({challengeId:Tf.string(),specifier:Tf.string(),recipientEthAddress:Tf.string(),destinationUserBank:IT,antiAbuseOracleEthAddress:Tf.string(),amount:Tf.bigint(),feePayer:IT.optional()}),Tf.object({challengeId:Tf.string(),specifier:Tf.string()}),new VS("Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"),new VS("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");const cF=e=>"bigint"==typeof e||!Number.isNaN(Number(e))&&Math.floor(Number(e))===e,dF=e=>"bigint"==typeof e||e>=0&&Number.isSafeInteger(e);function lF(e,t){if(0===t.length)return e;let n;const r=[...e];for(let e=r.length-1,i=0,o=0;e>0;e--,i++){i%=t.length,o+=n=t[i].codePointAt(0);const s=(n+i+o)%e,a=r[e],u=r[s];r[s]=a,r[e]=u}return r}const hF=(e,t)=>e.reduce(((n,r)=>{const i=t.indexOf(r);if(-1===i)throw new Error(`The provided ID (${e.join("")}) is invalid, as it contains characters that do not exist in the alphabet (${t.join("")})`);if("bigint"==typeof n)return n*BigInt(t.length)+BigInt(i);const o=n*t.length+i;if(Number.isSafeInteger(o))return o;if("function"==typeof BigInt)return BigInt(n)*BigInt(t.length)+BigInt(i);throw new Error("Unable to decode the provided string, due to lack of support for BigInt numbers in the current environment")}),0),fF=/^\+?\d+$/,pF=e=>new RegExp(e.map((e=>gF(e))).sort(((e,t)=>t.length-e.length)).join("|")),gF=e=>e.replace(/[\s#$()*+,.?[\\\]^{|}-]/g,"\\$&");const mF=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"cfhistuCFHISTU";if(this.minLength=t,"number"!=typeof t)throw new TypeError(`Hashids: Provided 'minLength' has to be a number (is ${typeof t})`);if("string"!=typeof e)throw new TypeError(`Hashids: Provided 'salt' has to be a string (is ${typeof e})`);if("string"!=typeof n)throw new TypeError(`Hashids: Provided alphabet has to be a string (is ${typeof n})`);const i=Array.from(e),o=Array.from(n),s=Array.from(r);this.salt=i;const a=[...new Set(o)];var u;if(a.length<16)throw new Error(`Hashids: alphabet must contain at least 16 unique characters, provided: ${a.join("")}`);this.alphabet=(u=s,a.filter((e=>!u.includes(e))));const c=((e,t)=>e.filter((e=>t.includes(e))))(s,a);let d,l;this.seps=lF(c,i),(0===this.seps.length||this.alphabet.length/this.seps.length>3.5)&&(d=Math.ceil(this.alphabet.length/3.5),d>this.seps.length&&(l=d-this.seps.length,this.seps.push(...this.alphabet.slice(0,l)),this.alphabet=this.alphabet.slice(l))),this.alphabet=lF(this.alphabet,i);const h=Math.ceil(this.alphabet.length/12);this.alphabet.length<3?(this.guards=this.seps.slice(0,h),this.seps=this.seps.slice(h)):(this.guards=this.alphabet.slice(0,h),this.alphabet=this.alphabet.slice(h)),this.guardsRegExp=pF(this.guards),this.sepsRegExp=pF(this.seps),this.allowedCharsRegExp=(e=>new RegExp(`^[${e.map((e=>gF(e))).sort(((e,t)=>t.length-e.length)).join("")}]+$`))([...this.alphabet,...this.guards,...this.seps])}encode(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let i=Array.isArray(e)?e:[...null!=e?[e]:[],...n];return 0===i.length?"":(i.every(cF)||(i=i.map((e=>{return"bigint"==typeof e||"number"==typeof e?e:(t=String(e),fF.test(t)?Number.parseInt(t,10):Number.NaN);var t}))),i.every(dF)?this._encode(i).join(""):"")}decode(e){return e&&"string"==typeof e&&0!==e.length?this._decode(e):[]}encodeHex(e){let t=e;switch(typeof t){case"bigint":t=t.toString(16);break;case"string":if(!/^[\dA-Fa-f]+$/.test(t))return"";break;default:throw new Error(`Hashids: The provided value is neither a string, nor a BigInt (got: ${typeof t})`)}const n=(r=t,i=12,o=e=>Number.parseInt(`1${e}`,16),Array.from({length:Math.ceil(r.length/i)},((e,t)=>o(r.slice(t*i,(t+1)*i)))));var r,i,o;return this.encode(n)}decodeHex(e){return this.decode(e).map((e=>e.toString(16).slice(1))).join("")}isValidId(e){return this.allowedCharsRegExp.test(e)}_encode(e){let{alphabet:t}=this;const n=e.reduce(((e,t,n)=>e+("bigint"==typeof t?Number(t%BigInt(n+100)):t%(n+100))),0);let r=[t[n%t.length]];const i=[...r],{seps:o}=this,{guards:s}=this;if(e.forEach(((n,s)=>{const a=i.concat(this.salt,t);t=lF(t,a);const u=((e,t)=>{const n=[];let r=e;if("bigint"==typeof r){const e=BigInt(t.length);do{n.unshift(t[Number(r%e)]),r/=e}while(r>BigInt(0))}else do{n.unshift(t[r%t.length]),r=Math.floor(r/t.length)}while(r>0);return n})(n,t);if(r.push(...u),s+1<e.length){const e=u[0].codePointAt(0)+s,t="bigint"==typeof n?Number(n%BigInt(e)):n%e;r.push(o[t%o.length])}})),r.length<this.minLength){const e=(n+r[0].codePointAt(0))%s.length;if(r.unshift(s[e]),r.length<this.minLength){const e=(n+r[2].codePointAt(0))%s.length;r.push(s[e])}}const a=Math.floor(t.length/2);for(;r.length<this.minLength;){t=lF(t,t),r.unshift(...t.slice(a)),r.push(...t.slice(0,a));const e=r.length-this.minLength;if(e>0){const t=e/2;r=r.slice(t,t+this.minLength)}}return r}_decode(e){if(!this.isValidId(e))throw new Error(`The provided ID (${e}) is invalid, as it contains characters that do not exist in the alphabet (${this.guards.join("")}${this.seps.join("")}${this.alphabet.join("")})`);const t=e.split(this.guardsRegExp),n=t[3===t.length||2===t.length?1:0];if(0===n.length)return[];const r=n[Symbol.iterator]().next().value,i=n.slice(r.length).split(this.sepsRegExp);let o=this.alphabet;const s=[];for(const e of i){const t=lF(o,[r,...this.salt,...o].slice(0,o.length));s.push(hF(Array.from(e),t)),o=t}return this._encode(s).join("")!==e?[]:s}}("azowernasdfoia",5),yF=e=>{try{const t=mF.decode(e);if(!t.length)return null;const n=Number(t[0]);return isNaN(n)?null:n}catch(e){return null}},wF=e=>{try{if(null===e)return null;return mF.encode(e)}catch(e){return null}};Tf.string().nullable().optional().transform((e=>{var t;return e&&null!==(t=yF(e))&&void 0!==t?t:void 0}));const vF=Tf.string().transform(((e,t)=>{const n=yF(e);return null===n?(t.addIssue({code:Tf.ZodIssueCode.custom,message:"Hash id is invalid"}),Tf.NEVER):n}));Tf.number().nullable().optional().transform((e=>{var t;return e&&null!==(t=wF(e))&&void 0!==t?t:void 0})),Tf.number().transform(((e,t)=>{const n=wF(e);return null===n?(t.addIssue({code:Tf.ZodIssueCode.custom,message:"Hash id is invalid"}),Tf.NEVER):n}));const bF=Tf.object({mint:CT,total:Tf.bigint(),sourceWallet:IT}),_F=Tf.object({mint:CT,splits:Tf.array(Tf.object({wallet:IT,amount:Tf.bigint()})),total:Tf.bigint()}),AF=Tf.object({contentType:Tf.enum(["track","album"]),contentId:vF.or(Tf.number()),blockNumber:Tf.number(),buyerUserId:vF.or(Tf.number()),accessType:Tf.enum(["stream","download"]),signer:IT.optional()});function EF(e){return EF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},EF(e)}function kF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,IF(r.key),r)}}function IF(e){var t=function(e,t){if("object"!=EF(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=EF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==EF(t)?t:t+""}function SF(e,t,n){return t=TF(t),function(e,t){if(t&&("object"===EF(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,xF()?Reflect.construct(t,n||[],TF(e).constructor):t.apply(e,n))}function CF(e){var t="function"==typeof Map?new Map:void 0;return CF=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(xF())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&BF(i,n.prototype),i}(e,arguments,TF(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),BF(n,e)},CF(e)}function xF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(xF=function(){return!!e})()}function BF(e,t){return BF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},BF(e,t)}function TF(e){return TF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},TF(e)}bF.extend(_F.shape).extend(AF.shape),Tf.object({mint:CT});var RF=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=SF(this,t,[e])).originalRequest=i,n.originalResponse=o,n.causingError=r,null!=r&&(e+=", caused by ".concat(r.toString())),null!=i){var s=i.getHeader("X-Request-ID")||"n/a",a=i.getMethod(),u=i.getURL(),c=o?o.getStatus():"n/a",d=o?o.getBody()||"":"n/a";e+=", originated from request (method: ".concat(a,", url: ").concat(u,", response code: ").concat(c,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=e,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BF(e,t)}(t,e),n=t,r&&kF(n.prototype,r),i&&kF(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(CF(Error));function DF(e){return DF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DF(e)}function PF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,UF(r.key),r)}}function UF(e){var t=function(e,t){if("object"!=DF(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=DF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==DF(t)?t:t+""}var OF=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(e){return Promise.resolve([])}},{key:"removeUpload",value:function(e){return Promise.resolve()}},{key:"addUpload",value:function(e,t){return Promise.resolve(null)}}])&&PF(e.prototype,t),n&&PF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();const FF="function"==typeof btoa,MF="function"==typeof Buffer,LF=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),qF=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),zF=((e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(qF),String.fromCharCode.bind(String)),NF=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),jF=e=>{let t,n,r,i,o="";const s=e.length%3;for(let s=0;s<e.length;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,o+=qF[t>>18&63]+qF[t>>12&63]+qF[t>>6&63]+qF[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},$F=FF?e=>btoa(e):MF?e=>Buffer.from(e,"binary").toString("base64"):jF,WF=MF?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(zF.apply(null,e.subarray(n,n+4096)));return $F(t.join(""))},HF=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?zF(192|t>>>6)+zF(128|63&t):zF(224|t>>>12&15)+zF(128|t>>>6&63)+zF(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return zF(240|t>>>18&7)+zF(128|t>>>12&63)+zF(128|t>>>6&63)+zF(128|63&t)},KF=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,VF=e=>e.replace(KF,HF),GF=MF?e=>Buffer.from(e,"utf8").toString("base64"):LF?e=>WF(LF.encode(e)):e=>$F(VF(e)),ZF=(e,t=!1)=>t?NF(GF(e)):GF(e),YF=ZF;var JF={},XF=Object.prototype.hasOwnProperty;function QF(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function eM(e){try{return encodeURIComponent(e)}catch(e){return null}}JF.stringify=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(XF.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=eM(r),n=eM(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},JF.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=QF(t[1]),o=QF(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var tM=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},nM=JF,rM=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,iM=/[\n\r\t]/g,oM=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,sM=/:\d+$/,aM=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,uM=/^[a-zA-Z]:/;function cM(e){return(e||"").toString().replace(rM,"")}var dM=[["#","hash"],["?","query"],function(e,t){return fM(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],lM={hash:1,query:1};function hM(e){var t,n=("undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:{}).location||{},r={},o=typeof(e=e||n);if("blob:"===e.protocol)r=new gM(unescape(e.pathname),{});else if("string"===o)for(t in r=new gM(e,{}),lM)delete r[t];else if("object"===o){for(t in e)t in lM||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=oM.test(e.href))}return r}function fM(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function pM(e,t){e=(e=cM(e)).replace(iM,""),t=t||{};var n,r=aM.exec(e),i=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],a=0;return o?s?(n=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(n=r[2]+r[4],a=r[2].length):s?(n=r[3]+r[4],a=r[3].length):n=r[4],"file:"===i?a>=2&&(n=n.slice(2)):fM(i)?n=r[4]:i?o&&(n=n.slice(2)):a>=2&&fM(t.protocol)&&(n=r[4]),{protocol:i,slashes:o||fM(i),slashesCount:a,rest:n}}function gM(e,t,n){if(e=(e=cM(e)).replace(iM,""),!(this instanceof gM))return new gM(e,t,n);var r,i,o,s,a,u,c=dM.slice(),d=typeof t,l=this,h=0;for("object"!==d&&"string"!==d&&(n=t,t=null),n&&"function"!=typeof n&&(n=nM.parse),r=!(i=pM(e||"",t=hM(t))).protocol&&!i.slashes,l.slashes=i.slashes||r&&t.slashes,l.protocol=i.protocol||t.protocol||"",e=i.rest,("file:"===i.protocol&&(2!==i.slashesCount||uM.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!fM(l.protocol)))&&(c[3]=[/(.*)/,"pathname"]);h<c.length;h++)"function"!=typeof(s=c[h])?(o=s[0],u=s[1],o!=o?l[u]=e:"string"==typeof o?~(a="@"===o?e.lastIndexOf(o):e.indexOf(o))&&("number"==typeof s[2]?(l[u]=e.slice(0,a),e=e.slice(a+s[2])):(l[u]=e.slice(a),e=e.slice(0,a))):(a=o.exec(e))&&(l[u]=a[1],e=e.slice(0,a.index)),l[u]=l[u]||r&&s[3]&&t[u]||"",s[4]&&(l[u]=l[u].toLowerCase())):e=s(e,l);n&&(l.query=n(l.query)),r&&t.slashes&&"/"!==l.pathname.charAt(0)&&(""!==l.pathname||""!==t.pathname)&&(l.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,s=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),s++):s&&(0===r&&(o=!0),n.splice(r,1),s--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(l.pathname,t.pathname)),"/"!==l.pathname.charAt(0)&&fM(l.protocol)&&(l.pathname="/"+l.pathname),tM(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(~(a=l.auth.indexOf(":"))?(l.username=l.auth.slice(0,a),l.username=encodeURIComponent(decodeURIComponent(l.username)),l.password=l.auth.slice(a+1),l.password=encodeURIComponent(decodeURIComponent(l.password))):l.username=encodeURIComponent(decodeURIComponent(l.auth)),l.auth=l.password?l.username+":"+l.password:l.username),l.origin="file:"!==l.protocol&&fM(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}gM.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||nM.parse)(t)),r[e]=t;break;case"port":r[e]=t,tM(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,sM.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":if(t){var i="pathname"===e?"/":"#";r[e]=t.charAt(0)!==i?i+t:t}else r[e]=t;break;case"username":case"password":r[e]=encodeURIComponent(t);break;case"auth":var o=t.indexOf(":");~o?(r.username=t.slice(0,o),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=t.slice(o+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(t))}for(var s=0;s<dM.length;s++){var a=dM[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&fM(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=nM.stringify);var t,n=this,r=n.host,i=n.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var o=i+(n.protocol&&n.slashes||fM(n.protocol)?"//":"");return n.username?(o+=n.username,n.password&&(o+=":"+n.password),o+="@"):n.password?(o+=":"+n.password,o+="@"):"file:"!==n.protocol&&fM(n.protocol)&&!r&&"/"!==n.pathname&&(o+="@"),(":"===r[r.length-1]||sM.test(n.hostname)&&!n.port)&&(r+=":"),o+=r+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(o+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(o+=n.hash),o}},gM.extractProtocol=pM,gM.location=hM,gM.trimLeft=cM,gM.qs=nM;var mM=gM;function yM(){
25
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
- yM=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,s=Object.create(o.prototype),a=new T(r||[]);return i(s,"_invoke",{value:S(e,n,a)}),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h="suspendedStart",f="suspendedYield",p="executing",g="completed",m={};function y(){}function w(){}function v(){}var b={};c(b,s,(function(){return this}));var _=Object.getPrototypeOf,A=_&&_(_(R([])));A&&A!==n&&r.call(A,s)&&(b=A);var E=v.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function n(i,o,s,a){var u=l(e[i],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==bM(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function S(t,n,r){var i=h;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===g){if("throw"===o)throw s;return{value:e,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=C(a,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=l(t,n,r);if("normal"===c.type){if(i=r.done?g:f,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=g,r.method="throw",r.arg=c.arg)}}}function C(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=l(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function B(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(bM(t)+" is not iterable")}return w.prototype=v,i(E,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:w,configurable:!0}),w.displayName=c(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},k(I.prototype),c(I.prototype,a,(function(){return this})),t.AsyncIterator=I,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new I(d(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},k(E),c(E,u,"Generator"),c(E,s,(function(){return this})),c(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=R,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(B),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return a.type="throw",a.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),B(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;B(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function wM(e,t,n,r,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function vM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,s,a=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(e,t)||_M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bM(e){return bM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bM(e)}function _M(e,t){if(e){if("string"==typeof e)return AM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?AM(e,t):void 0}}function AM(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function EM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?EM(Object(n),!0).forEach((function(t){IM(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EM(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function IM(e,t,n){return(t=CM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,CM(r.key),r)}}function CM(e){var t=function(e,t){if("object"!=bM(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=bM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==bM(t)?t:t+""}var xM="tus-v1",BM="ietf-draft-03",TM="ietf-draft-05",RM={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:qM,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:xM},DM=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"resume"in n&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=n,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return t=e,n=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then((function(t){return e._urlStorage.findUploadsByFingerprint(t)}))}},{key:"resumeFromPreviousUpload",value:function(e){this.url=e.uploadUrl||null,this._parallelUploadUrls=e.parallelUploadUrls||null,this._urlStorageKey=e.urlStorageKey}},{key:"start",value:function(){var e=this,t=this.file;if(t)if([xM,BM,TM].includes(this.options.protocol))if(this.options.endpoint||this.options.uploadUrl||this.url){var n=this.options.retryDelays;if(null==n||"[object Array]"===Object.prototype.toString.call(n)){if(this.options.parallelUploads>1)for(var r=0,i=["uploadUrl","uploadSize","uploadLengthDeferred"];r<i.length;r++){var o=i[r];if(this.options[o])return void this._emitError(new Error("tus: cannot use the ".concat(o," option when parallelUploads is enabled")))}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1)return void this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length)return void this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"))}this.options.fingerprint(t,this.options).then((function(n){return e._fingerprint=n,e._source?e._source:e.options.fileReader.openFile(t,e.options.chunkSize)})).then((function(t){if(e._source=t,e.options.uploadLengthDeferred)e._size=null;else if(null!=e.options.uploadSize){if(e._size=Number(e.options.uploadSize),Number.isNaN(e._size))return void e._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(e._size=e._source.size,null==e._size)return void e._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));e.options.parallelUploads>1||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()})).catch((function(t){e._emitError(t)}))}else this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var t,n=this,r=this._size,i=0;this._parallelUploads=[];var o=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,s=null!==(t=this.options.parallelUploadBoundaries)&&void 0!==t?t:function(e,t){for(var n=Math.floor(e/t),r=[],i=0;i<t;i++)r.push({start:n*i,end:n*(i+1)});return r[t-1].end=e,r}(this._source.size,o);this._parallelUploadUrls&&s.forEach((function(e,t){e.uploadUrl=n._parallelUploadUrls[t]||null})),this._parallelUploadUrls=new Array(s.length);var a,u=s.map((function(t,o){var a=0;return n._source.slice(t.start,t.end).then((function(u){var c=u.value;return new Promise((function(u,d){var l=kM(kM({},n.options),{},{uploadUrl:t.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:kM(kM({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:u,onError:d,onProgress:function(e){i=i-a+e,a=e,n._emitProgress(i,r)},onUploadUrlAvailable:function(){n._parallelUploadUrls[o]=h.url,n._parallelUploadUrls.filter((function(e){return Boolean(e)})).length===s.length&&n._saveUploadInUrlStorage()}}),h=new e(c,l);h.start(),n._parallelUploads.push(h)}))}))}));Promise.all(u).then((function(){(a=n._openRequest("POST",n.options.endpoint)).setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var e=PM(n.options.metadata);return""!==e&&a.setHeader("Upload-Metadata",e),n._sendRequest(a,null)})).then((function(e){if(UM(e.getStatus(),200)){var t=e.getHeader("Location");null!=t?(n.url=zM(n.options.endpoint,t),"Created upload at ".concat(n.url),n._emitSuccess(e)):n._emitHttpError(a,e,"tus: invalid or missing Location header")}else n._emitHttpError(a,e,"tus: unexpected response while creating upload")})).catch((function(e){n._emitError(e)}))}},{key:"_startSingleUpload",value:function(){return this._aborted=!1,null!=this.url?("Resuming upload from previous URL: ".concat(this.url),void this._resumeUpload()):null!=this.options.uploadUrl?("Resuming upload from provided URL: ".concat(this.options.uploadUrl),this.url=this.options.uploadUrl,void this._resumeUpload()):void this._createUpload()}},{key:"abort",value:function(t){var n=this;if(null!=this._parallelUploads){var r,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_M(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this._parallelUploads);try{for(i.s();!(r=i.n()).done;)r.value.abort(t)}catch(e){i.e(e)}finally{i.f()}}return null!==this._req&&this._req.abort(),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),t&&null!=this.url?e.terminate(this.url,this.options).then((function(){return n._removeFromUrlStorage()})):Promise.resolve()}},{key:"_emitHttpError",value:function(e,t,n,r){this._emitError(new RF(n,r,e,t))}},{key:"_emitError",value:function(e){var t=this;if(!this._aborted){if(null!=this.options.retryDelays&&(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),LM(e,this._retryAttempt,this.options))){var n=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){t.start()}),n))}if("function"!=typeof this.options.onError)throw e;this.options.onError(e)}}},{key:"_emitSuccess",value:function(e){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess({lastResponse:e})}},{key:"_emitProgress",value:function(e,t){"function"==typeof this.options.onProgress&&this.options.onProgress(e,t)}},{key:"_emitChunkComplete",value:function(e,t,n){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(e,t,n)}},{key:"_createUpload",value:function(){var e=this;if(this.options.endpoint){var t=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?t.setHeader("Upload-Defer-Length","1"):t.setHeader("Upload-Length","".concat(this._size));var n,r=PM(this.options.metadata);""!==r&&t.setHeader("Upload-Metadata",r),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,n=this._addChunkToRequest(t)):(this.options.protocol!==BM&&this.options.protocol!==TM||t.setHeader("Upload-Complete","?0"),n=this._sendRequest(t,null)),n.then((function(n){if(UM(n.getStatus(),200)){var r=n.getHeader("Location");if(null!=r){if(e.url=zM(e.options.endpoint,r),"Created upload at ".concat(e.url),"function"==typeof e.options.onUploadUrlAvailable&&e.options.onUploadUrlAvailable(),0===e._size)return e._emitSuccess(n),void e._source.close();e._saveUploadInUrlStorage().then((function(){e.options.uploadDataDuringCreation?e._handleUploadResponse(t,n):(e._offset=0,e._performUpload())}))}else e._emitHttpError(t,n,"tus: invalid or missing Location header")}else e._emitHttpError(t,n,"tus: unexpected response while creating upload")})).catch((function(n){e._emitHttpError(t,null,"tus: failed to create upload",n)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var e=this,t=this._openRequest("HEAD",this.url);this._sendRequest(t,null).then((function(n){var r=n.getStatus();if(!UM(r,200))return 423===r?void e._emitHttpError(t,n,"tus: upload is currently locked; retry later"):(UM(r,400)&&e._removeFromUrlStorage(),e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitHttpError(t,n,"tus: unable to resume upload (new upload cannot be created without an endpoint)"));var i=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(i))e._emitHttpError(t,n,"tus: invalid or missing offset value");else{var o=Number.parseInt(n.getHeader("Upload-Length"),10);!Number.isNaN(o)||e.options.uploadLengthDeferred||e.options.protocol!==xM?("function"==typeof e.options.onUploadUrlAvailable&&e.options.onUploadUrlAvailable(),e._saveUploadInUrlStorage().then((function(){if(i===o)return e._emitProgress(o,o),void e._emitSuccess(n);e._offset=i,e._performUpload()}))):e._emitHttpError(t,n,"tus: invalid or missing length value")}})).catch((function(n){e._emitHttpError(t,null,"tus: failed to resume upload",n)}))}},{key:"_performUpload",value:function(){var e,t=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset","".concat(this._offset)),this._addChunkToRequest(e).then((function(n){UM(n.getStatus(),200)?t._handleUploadResponse(e,n):t._emitHttpError(e,n,"tus: unexpected response while uploading chunk")})).catch((function(n){t._aborted||t._emitHttpError(e,null,"tus: failed to upload chunk at offset ".concat(t._offset),n)})))}},{key:"_addChunkToRequest",value:function(e){var t=this,n=this._offset,r=this._offset+this.options.chunkSize;return e.setProgressHandler((function(e){t._emitProgress(n+e,t._size)})),this.options.protocol===xM?e.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===TM&&e.setHeader("Content-Type","application/partial-upload"),(r===Number.POSITIVE_INFINITY||r>this._size)&&!this.options.uploadLengthDeferred&&(r=this._size),this._source.slice(n,r).then((function(n){var r=n.value,i=n.done,o=null!=r&&r.size?r.size:0;t.options.uploadLengthDeferred&&i&&(t._size=t._offset+o,e.setHeader("Upload-Length","".concat(t._size)));var s=t._offset+o;return!t.options.uploadLengthDeferred&&i&&s!==t._size?Promise.reject(new Error("upload was configured with a size of ".concat(t._size," bytes, but the source is done after ").concat(s," bytes"))):null===r?t._sendRequest(e):(t.options.protocol!==BM&&t.options.protocol!==TM||e.setHeader("Upload-Complete",i?"?1":"?0"),t._emitProgress(t._offset,t._size),t._sendRequest(e,r))}))}},{key:"_handleUploadResponse",value:function(e,t){var n=Number.parseInt(t.getHeader("Upload-Offset"),10);if(Number.isNaN(n))this._emitHttpError(e,t,"tus: invalid or missing offset value");else{if(this._emitProgress(n,this._size),this._emitChunkComplete(n-this._offset,n,this._size),this._offset=n,n===this._size)return this._emitSuccess(t),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(e,t){var n=OM(e,t,this.options);return this._req=n,n}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(t){e._emitError(t)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var e=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||null!==this._urlStorageKey)return Promise.resolve();var t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};return this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then((function(t){e._urlStorageKey=t}))}},{key:"_sendRequest",value:function(e){return FM(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,this.options)}}],r=[{key:"terminate",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=OM("DELETE",t,n);return FM(r,null,n).then((function(e){if(204!==e.getStatus())throw new RF("tus: unexpected response while terminating upload",null,r,e)})).catch((function(i){if(i instanceof RF||(i=new RF("tus: failed to terminate upload",i,r,null)),!LM(i,0,n))throw i;var o=n.retryDelays[0],s=n.retryDelays.slice(1),a=kM(kM({},n),{},{retryDelays:s});return new Promise((function(e){return setTimeout(e,o)})).then((function(){return e.terminate(t,a)}))}))}}],n&&SM(t.prototype,n),r&&SM(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,r}();function PM(e){return Object.entries(e).map((function(e){var t=vM(e,2),n=t[0],r=t[1];return"".concat(n," ").concat(YF(String(r)))})).join(",")}function UM(e,t){return e>=t&&e<t+100}function OM(e,t,n){var r=n.httpStack.createRequest(e,t);n.protocol===BM?r.setHeader("Upload-Draft-Interop-Version","5"):n.protocol===TM?r.setHeader("Upload-Draft-Interop-Version","6"):r.setHeader("Tus-Resumable","1.0.0");for(var i=n.headers||{},o=0,s=Object.entries(i);o<s.length;o++){var a=vM(s[o],2),u=a[0],c=a[1];r.setHeader(u,c)}if(n.addRequestId){var d="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));r.setHeader("X-Request-ID",d)}return r}function FM(e,t,n){return MM.apply(this,arguments)}function MM(){var e;return e=yM().mark((function e(t,n,r){var i;return yM().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof r.onBeforeRequest){e.next=3;break}return e.next=3,r.onBeforeRequest(t);case 3:return e.next=5,t.send(n);case 5:if(i=e.sent,"function"!=typeof r.onAfterResponse){e.next=9;break}return e.next=9,r.onAfterResponse(t,i);case 9:return e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})),MM=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){wM(o,r,i,s,a,"next",e)}function a(e){wM(o,r,i,s,a,"throw",e)}s(void 0)}))},MM.apply(this,arguments)}function LM(e,t,n){return!(null==n.retryDelays||t>=n.retryDelays.length||null==e.originalRequest)&&(n&&"function"==typeof n.onShouldRetry?n.onShouldRetry(e,t,n):qM(e))}function qM(e){var t,n=e.originalResponse?e.originalResponse.getStatus():0;return(!UM(n,400)||409===n||423===n)&&(t=!0,"undefined"!=typeof navigator&&!1===navigator.onLine&&(t=!1),t)}function zM(e,t){return new mM(t,e).toString()}DM.defaultOptions=RM;var NM=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};function jM(e){return new Promise((function(t,n){var r=new XMLHttpRequest;r.responseType="blob",r.onload=function(){var e=r.response;t(e)},r.onerror=function(e){n(e)},r.open("GET",e),r.send()}))}function $M(e){return $M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$M(e)}function WM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,HM(r.key),r)}}function HM(e){var t=function(e,t){if("object"!=$M(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=$M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==$M(t)?t:t+""}var KM=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._file=t,this.size=t.size},t=[{key:"slice",value:function(e,t){if("undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova))return n=this._file.slice(e,t),new Promise((function(e,t){var r=new FileReader;r.onload=function(){var t=new Uint8Array(r.result);e({value:t})},r.onerror=function(e){t(e)},r.readAsArrayBuffer(n)}));var n,r=this._file.slice(e,t),i=t>=this.size;return Promise.resolve({value:r,done:i})}},{key:"close",value:function(){}}],t&&WM(e.prototype,t),n&&WM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function VM(e){return VM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},VM(e)}function GM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ZM(r.key),r)}}function ZM(e){var t=function(e,t){if("object"!=VM(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=VM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==VM(t)?t:t+""}function YM(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var JM=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1},t=[{key:"slice",value:function(e,t){return e<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(e,t)}},{key:"_readUntilEnoughDataOrDone",value:function(e,t){var n=this,r=t<=this._bufferOffset+YM(this._buffer);if(this._done||r){var i=this._getDataFromBuffer(e,t),o=null==i&&this._done;return Promise.resolve({value:i,done:o})}return this._reader.read().then((function(r){var i=r.value;return r.done?n._done=!0:void 0===n._buffer?n._buffer=i:n._buffer=function(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var n=new e.constructor(e.length+t.length);return n.set(e),n.set(t,e.length),n}throw new Error("Unknown data type")}(n._buffer,i),n._readUntilEnoughDataOrDone(e,t)}))}},{key:"_getDataFromBuffer",value:function(e,t){e>this._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var n=0===YM(this._buffer);return this._done&&n?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}],t&&GM(e.prototype,t),n&&GM(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function XM(e){return XM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},XM(e)}function QM(){
27
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
28
- QM=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var o=t&&t.prototype instanceof y?t:y,s=Object.create(o.prototype),a=new T(r||[]);return i(s,"_invoke",{value:S(e,n,a)}),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h="suspendedStart",f="suspendedYield",p="executing",g="completed",m={};function y(){}function w(){}function v(){}var b={};c(b,s,(function(){return this}));var _=Object.getPrototypeOf,A=_&&_(_(R([])));A&&A!==n&&r.call(A,s)&&(b=A);var E=v.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function n(i,o,s,a){var u=l(e[i],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==XM(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(d).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function S(t,n,r){var i=h;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===g){if("throw"===o)throw s;return{value:e,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=C(a,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=l(t,n,r);if("normal"===c.type){if(i=r.done?g:f,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=g,r.method="throw",r.arg=c.arg)}}}function C(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=l(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function B(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(XM(t)+" is not iterable")}return w.prototype=v,i(E,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:w,configurable:!0}),w.displayName=c(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},k(I.prototype),c(I.prototype,a,(function(){return this})),t.AsyncIterator=I,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new I(d(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},k(E),c(E,u,"Generator"),c(E,s,(function(){return this})),c(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=R,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(B),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return a.type="throw",a.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),B(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;B(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function eL(e,t,n,r,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function tL(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,nL(r.key),r)}}function nL(e){var t=function(e,t){if("object"!=XM(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=XM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==XM(t)?t:t+""}var rL=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"openFile",value:(r=QM().mark((function e(t,n){var r;return QM().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!NM()||!t||void 0===t.uri){e.next=11;break}return e.prev=1,e.next=4,jM(t.uri);case 4:return r=e.sent,e.abrupt("return",new KM(r));case 8:throw e.prev=8,e.t0=e.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(e.t0));case 11:if("function"!=typeof t.slice||void 0===t.size){e.next=13;break}return e.abrupt("return",Promise.resolve(new KM(t)));case 13:if("function"!=typeof t.read){e.next=18;break}if(n=Number(n),Number.isFinite(n)){e.next=17;break}return e.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return e.abrupt("return",Promise.resolve(new JM(t,n)));case 18:return e.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return e.stop()}}),e,null,[[1,8]])})),i=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function s(e){eL(o,n,i,s,a,"next",e)}function a(e){eL(o,n,i,s,a,"throw",e)}s(void 0)}))},function(e,t){return i.apply(this,arguments)})}],t&&tL(e.prototype,t),n&&tL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,i}();function iL(e){return iL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},iL(e)}function oL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sL(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,uL(r.key),r)}}function aL(e,t,n){return t&&sL(e.prototype,t),n&&sL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function uL(e){var t=function(e,t){if("object"!=iL(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=iL(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==iL(t)?t:t+""}var cL=function(){return aL((function e(){oL(this,e)}),[{key:"createRequest",value:function(e,t){return new dL(e,t)}},{key:"getName",value:function(){return"XHRHttpStack"}}])}(),dL=function(){return aL((function e(t,n){oL(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,n,!0),this._method=t,this._url=n,this._headers={}}),[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(e,t){this._xhr.setRequestHeader(e,t),this._headers[e]=t}},{key:"getHeader",value:function(e){return this._headers[e]}},{key:"setProgressHandler",value:function(e){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(t){t.lengthComputable&&e(t.loaded)})}},{key:"send",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(n,r){e._xhr.onload=function(){n(new lL(e._xhr))},e._xhr.onerror=function(e){r(e)},e._xhr.send(t)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),lL=function(){return aL((function e(t){oL(this,e),this._xhr=t}),[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(e){return this._xhr.getResponseHeader(e)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function hL(e){return hL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hL(e)}function fL(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,pL(r.key),r)}}function pL(e){var t=function(e,t){if("object"!=hL(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=hL(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==hL(t)?t:t+""}var gL=!1;try{gL="localStorage"in window;var mL="tusSupport",yL=localStorage.getItem(mL);localStorage.setItem(mL,yL),null===yL&&localStorage.removeItem(mL)}catch(e){if(e.code!==e.SECURITY_ERR&&e.code!==e.QUOTA_EXCEEDED_ERR)throw e;gL=!1}var wL=gL,vL=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"findAllUploads",value:function(){var e=this._findEntries("tus::");return Promise.resolve(e)}},{key:"findUploadsByFingerprint",value:function(e){var t=this._findEntries("tus::".concat(e,"::"));return Promise.resolve(t)}},{key:"removeUpload",value:function(e){return localStorage.removeItem(e),Promise.resolve()}},{key:"addUpload",value:function(e,t){var n=Math.round(1e12*Math.random()),r="tus::".concat(e,"::").concat(n);return localStorage.setItem(r,JSON.stringify(t)),Promise.resolve(r)}},{key:"_findEntries",value:function(e){for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);if(0===r.indexOf(e))try{var i=JSON.parse(localStorage.getItem(r));i.urlStorageKey=r,t.push(i)}catch(e){}}return t}}],t&&fL(e.prototype,t),n&&fL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();function bL(e){return bL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bL(e)}function _L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,BL(r.key),r)}}function AL(e,t,n){return t=kL(t),function(e,t){if(t&&("object"===bL(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,EL()?Reflect.construct(t,n||[],kL(e).constructor):t.apply(e,n))}function EL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(EL=function(){return!!e})()}function kL(e){return kL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kL(e)}function IL(e,t){return IL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},IL(e,t)}function SL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function CL(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?SL(Object(n),!0).forEach((function(t){xL(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SL(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xL(e,t,n){return(t=BL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BL(e){var t=function(e,t){if("object"!=bL(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=bL(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==bL(t)?t:t+""}var TL=CL(CL({},DM.defaultOptions),{},{httpStack:new cL,fileReader:new rL,urlStorage:wL?new vL:new OF,fingerprint:function(e,t){return NM()?Promise.resolve(function(e,t){var n=e.exif?function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t&=t}return t}(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",n,t.endpoint].join("/")}(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}}),RL=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),AL(this,t,[e,n=CL(CL({},TL),n)])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&IL(e,t)}(t,e),n=t,i=[{key:"terminate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=CL(CL({},TL),t),DM.terminate(e,t)}}],(r=null)&&_L(n.prototype,r),i&&_L(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(DM);const DL=async e=>await new Promise((t=>setTimeout(t,e))),PL=12e5;class UL{constructor(e){u(this,"config",void 0),u(this,"storageNodeSelector",void 0),u(this,"logger",void 0),this.config=iv(e,{logger:new sv}),this.storageNodeSelector=e.storageNodeSelector,this.logger=this.config.logger.createPrefixedLogger("[storage]")}uploadFile(e){let{file:t,onProgress:n,metadata:r}=e;const i=new AbortController;let o,s,a=0;return{start:async()=>s||(s=new Promise(((e,s)=>{this.storageNodeSelector.getSelectedNode().then((u=>{var c;u?(o=new RL(t,{endpoint:`${u}/files/`,retryDelays:[0,3e3,5e3,1e4,2e4],chunkSize:1e8,removeFingerprintOnSuccess:!0,metadata:{filename:r.filename||t.name||"file",filetype:r.filetype||t.type||"application/octet-stream",template:r.template,...r.placementHosts?{placementHosts:r.placementHosts}:{},...void 0!==r.previewStartSeconds?{previewStartSeconds:r.previewStartSeconds.toString()}:{}},onError:s,onProgress:(e,t)=>{a=t,null==n||n({loaded:e,total:t,transcode:0})},onSuccess:async()=>{var t,u;const c=null===(t=o)||void 0===t||null===(u=t.url)||void 0===u?void 0:u.split("/").pop();if(!c)return void s(new Error("No upload ID received"));const d=await this.pollProcessingStatus(c,r.template,a,n,i.signal);e(d)}}),null===(c=o)||void 0===c||c.findPreviousUploads().then((e=>{var t,n;null!=e&&e.length&&e[0]&&(null===(n=o)||void 0===n||n.resumeFromPreviousUpload(e[0]));null===(t=o)||void 0===t||t.start()})).catch(s)):s(new Error("No node available"))})).catch(s)})),s),abort:function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(e=o)||void 0===e||e.abort(t),i.abort()}}}async getUploadStatus(e){const t=await this.storageNodeSelector.getSelectedNode();if(!t)throw new Error("No node available");const n=await bl(`${t}/uploads/${e}`);if(!n.ok)throw new Error(`Failed to get upload status for uploadId ${e}, status: ${n.status}`);return await n.json()}async generatePreview(e){let{cid:t,secondOffset:n}=e;const r=await this.storageNodeSelector.getSelectedNode();if(!r)throw new Error("No content node available");const i=await bl(`${r}/generate_preview/${t}/${n}`,{method:"POST"});if(!i.ok)throw new Error(`Failed to generate preview for cid ${t} at offset ${n}, status: ${i.status}`);return(await i.json()).cid}async pollProcessingStatus(e,t,n,r,i){const o=Date.now();let s=Date.now(),a=0;const u="audio"===t?36e5:3e5;for(;Date.now()-o<u;){try{if(null!=i&&i.aborted)throw new Error("Upload aborted");const o=await this.getProcessingStatus(e);if("audio"===t&&o.transcode_progress){if(o.transcode_progress>a)s=Date.now(),a=o.transcode_progress;else if(Date.now()-s>PL)throw new Error(`No transcoding progress increase for 1200000ms. Progress stuck at ${a}. id=${e}`);null==r||r({loaded:n,total:n,transcode:o.transcode_progress})}if("done"===(null==o?void 0:o.status))return o;if("error"===(null==o?void 0:o.status))throw new Error(`Upload failed: id=${e}, resp=${JSON.stringify(o)}`)}catch(e){var c,d,l;if(null!==(c=e.message)&&void 0!==c&&c.startsWith("Upload failed")||null!==(d=e.message)&&void 0!==d&&d.startsWith("No transcoding progress increase")||e.response&&422===(null===(l=e.response)||void 0===l?void 0:l.status))throw e;this.logger.error(`Failed to poll for processing status, ${e}`)}await DL(3e3)}throw new Error(`Upload took over ${u}ms. id=${e}`)}async getProcessingStatus(e){let t;for(let n=await this.storageNodeSelector.getSelectedNode();!this.storageNodeSelector.triedSelectingAllNodes();n=await this.storageNodeSelector.getSelectedNode(!0))try{const r=await bl(`${n}/uploads/${e}`);if(r.ok)return await r.json();t=`HTTP error: ${r.status} ${r.statusText}, ${await r.text()}`}catch(e){t=e}const n=`Error sending storagev2 uploads polling request, tried all healthy storage nodes. Last error: ${t}`;throw this.logger.error(n),new Error(n)}}class OL extends bv{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=gv(this.buffer)}update(e){dv.exists(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=vv(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=gv(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){dv.exists(this),dv.output(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,c=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=gv(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)s.setUint32(4*e,c[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}}const FL=(e,t,n)=>e&t^e&n^t&n,ML=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),LL=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qL=new Uint32Array(64);class zL extends OL{constructor(){super(64,32,8,!1),this.A=0|LL[0],this.B=0|LL[1],this.C=0|LL[2],this.D=0|LL[3],this.E=0|LL[4],this.F=0|LL[5],this.G=0|LL[6],this.H=0|LL[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)qL[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=qL[e-15],n=qL[e-2],r=mv(t,7)^mv(t,18)^t>>>3,i=mv(n,17)^mv(n,19)^n>>>10;qL[e]=i+qL[e-7]+r+qL[e-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let e=0;e<64;e++){const t=c+(mv(s,6)^mv(s,11)^mv(s,25))+((d=s)&a^~d&u)+ML[e]+qL[e]|0,l=(mv(n,2)^mv(n,13)^mv(n,22))+FL(n,r,i)|0;c=u,u=a,a=s,s=o+t|0,o=i,i=r,r=n,n=t+l|0}var d;n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,u,c)}roundClean(){qL.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class NL extends zL{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const jL=_v((()=>new zL));_v((()=>new NL));class $L{constructor(e){u(this,"node",void 0),u(this,"score",void 0),this.node=e,this.score=0}}class WL{constructor(){u(this,"nodes",[]),this.add(...arguments)}add(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const e of t)this.nodes.push(new $L($b.Buffer.from(e)))}getNodes(){return this.nodes.map((e=>e.node.toString()))}get(e){const t=this.getN(1,e)[0];return null!=t?t:""}getN(e,t){return this.rendezvous256(t).slice(0,e)}rendezvous256(e){const t=this.nodes.map((t=>{const n=t.node.toString();return[n,wv(jL(`${n}${e}`))]}));return t.sort(((e,t)=>{const[n,r]=e,[i,o]=t;return r===o?n<i?-1:1:r<o?-1:1})),t.map((e=>e[0]))}}var HL={exports:{}},KL=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},VL=KL,GL=Object.prototype.toString;function ZL(e){return"[object Array]"===GL.call(e)}function YL(e){return void 0===e}function JL(e){return null!==e&&"object"==typeof e}function XL(e){return"[object Function]"===GL.call(e)}function QL(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),ZL(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var eq={isArray:ZL,isArrayBuffer:function(e){return"[object ArrayBuffer]"===GL.call(e)},isBuffer:function(e){return null!==e&&!YL(e)&&null!==e.constructor&&!YL(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:JL,isUndefined:YL,isDate:function(e){return"[object Date]"===GL.call(e)},isFile:function(e){return"[object File]"===GL.call(e)},isBlob:function(e){return"[object Blob]"===GL.call(e)},isFunction:XL,isStream:function(e){return JL(e)&&XL(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:QL,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)QL(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,i=arguments.length;r<i;r++)QL(arguments[r],n);return t},extend:function(e,t,n){return QL(t,(function(t,r){e[r]=n&&"function"==typeof t?VL(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},tq=eq;function nq(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var rq=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(tq.isURLSearchParams(t))r=t.toString();else{var i=[];tq.forEach(t,(function(e,t){null!=e&&(tq.isArray(e)?t+="[]":e=[e],tq.forEach(e,(function(e){tq.isDate(e)?e=e.toISOString():tq.isObject(e)&&(e=JSON.stringify(e)),i.push(nq(t)+"="+nq(e))})))})),r=i.join("&")}if(r){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e},iq=eq;function oq(){this.handlers=[]}oq.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},oq.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},oq.prototype.forEach=function(e){iq.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var sq=oq,aq=eq,uq=function(e){return!(!e||!e.__CANCEL__)},cq=eq,dq=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},lq=function(e,t,n,r,i){var o=new Error(e);return dq(o,t,n,r,i)},hq=lq,fq=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},pq=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},gq=eq,mq=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],yq=eq,wq=yq.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=yq.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},vq=eq,bq=vq.isStandardBrowserEnv()?{write:function(e,t,n,r,i,o){var s=[];s.push(e+"="+encodeURIComponent(t)),vq.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),vq.isString(r)&&s.push("path="+r),vq.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},_q=eq,Aq=function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(hq("Request failed with status code "+n.status,n.config,null,n.request,n))},Eq=rq,kq=function(e,t){return e&&!fq(t)?pq(e,t):t},Iq=function(e){var t,n,r,i={};return e?(gq.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=gq.trim(e.substr(0,r)).toLowerCase(),n=gq.trim(e.substr(r+1)),t){if(i[t]&&mq.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}})),i):i},Sq=wq,Cq=lq,xq=function(e){return new Promise((function(t,n){var r=e.data,i=e.headers;_q.isFormData(r)&&delete i["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var s=e.auth.username||"",a=e.auth.password||"";i.Authorization="Basic "+btoa(s+":"+a)}var u=kq(e.baseURL,e.url);if(o.open(e.method.toUpperCase(),Eq(u,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in o?Iq(o.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:r,config:e,request:o};Aq(t,n,i),o=null}},o.onabort=function(){o&&(n(Cq("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){n(Cq("Network Error",e,null,o)),o=null},o.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Cq(t,e,"ECONNABORTED",o)),o=null},_q.isStandardBrowserEnv()){var c=bq,d=(e.withCredentials||Sq(u))&&e.xsrfCookieName?c.read(e.xsrfCookieName):void 0;d&&(i[e.xsrfHeaderName]=d)}if("setRequestHeader"in o&&_q.forEach(i,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete i[t]:o.setRequestHeader(t,e)})),_q.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){o&&(o.abort(),n(e),o=null)})),void 0===r&&(r=null),o.send(r)}))},Bq=eq,Tq=function(e,t){cq.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},Rq={"Content-Type":"application/x-www-form-urlencoded"};function Dq(e,t){!Bq.isUndefined(e)&&Bq.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Pq,Uq={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Pq=xq),Pq),transformRequest:[function(e,t){return Tq(t,"Accept"),Tq(t,"Content-Type"),Bq.isFormData(e)||Bq.isArrayBuffer(e)||Bq.isBuffer(e)||Bq.isStream(e)||Bq.isFile(e)||Bq.isBlob(e)?e:Bq.isArrayBufferView(e)?e.buffer:Bq.isURLSearchParams(e)?(Dq(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Bq.isObject(e)?(Dq(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};Uq.headers={common:{Accept:"application/json, text/plain, */*"}},Bq.forEach(["delete","get","head"],(function(e){Uq.headers[e]={}})),Bq.forEach(["post","put","patch"],(function(e){Uq.headers[e]=Bq.merge(Rq)}));var Oq=Uq,Fq=eq,Mq=function(e,t,n){return aq.forEach(n,(function(n){e=n(e,t)})),e},Lq=uq,qq=Oq;function zq(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Nq=eq,jq=function(e,t){t=t||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],o=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];Nq.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),Nq.forEach(i,(function(r){Nq.isObject(t[r])?n[r]=Nq.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:Nq.isObject(e[r])?n[r]=Nq.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),Nq.forEach(o,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var s=r.concat(i).concat(o),a=Object.keys(t).filter((function(e){return-1===s.indexOf(e)}));return Nq.forEach(a,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n},$q=eq,Wq=rq,Hq=sq,Kq=function(e){return zq(e),e.headers=e.headers||{},e.data=Mq(e.data,e.headers,e.transformRequest),e.headers=Fq.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Fq.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||qq.adapter)(e).then((function(t){return zq(e),t.data=Mq(t.data,t.headers,e.transformResponse),t}),(function(t){return Lq(t)||(zq(e),t&&t.response&&(t.response.data=Mq(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Vq=jq;function Gq(e){this.defaults=e,this.interceptors={request:new Hq,response:new Hq}}Gq.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Vq(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Kq,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Gq.prototype.getUri=function(e){return e=Vq(this.defaults,e),Wq(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},$q.forEach(["delete","get","head","options"],(function(e){Gq.prototype[e]=function(t,n){return this.request($q.merge(n||{},{method:e,url:t}))}})),$q.forEach(["post","put","patch"],(function(e){Gq.prototype[e]=function(t,n,r){return this.request($q.merge(r||{},{method:e,url:t,data:n}))}}));var Zq=Gq;function Yq(e){this.message=e}Yq.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Yq.prototype.__CANCEL__=!0;var Jq=Yq,Xq=Jq;function Qq(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Xq(e),t(n.reason))}))}Qq.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Qq.source=function(){var e;return{token:new Qq((function(t){e=t})),cancel:e}};var ez=Qq,tz=eq,nz=KL,rz=Zq,iz=jq;function oz(e){var t=new rz(e),n=nz(rz.prototype.request,t);return tz.extend(n,rz.prototype,t),tz.extend(n,t),n}var sz=oz(Oq);sz.Axios=rz,sz.create=function(e){return oz(iz(sz.defaults,e))},sz.Cancel=Jq,sz.CancelToken=ez,sz.isCancel=uq,sz.all=function(e){return Promise.all(e)},sz.spread=function(e){return function(t){return e.apply(null,t)}},HL.exports=sz,HL.exports.default=sz;var az=HL.exports;const uz=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:console;try{var n;const r=await az({baseURL:e,url:"/health_check",method:"get",timeout:1e4});if(200!==r.status)return t.warn(`isNodeHealthy: ${e} returned non-200 status ${r.status}`),!1;const i=r.data.data,o=((null===(n=i.transcodeStats)||void 0===n?void 0:n.AvgTranscodeTime)||0)>180;return i.diskHasSpace&&!o}catch(e){return t.error(`isNodeHealthy: Error checking health: ${e}`),!1}};class cz{constructor(e){var t;u(this,"config",void 0),u(this,"logger",void 0),u(this,"nodes",void 0),u(this,"orderedNodes",void 0),u(this,"selectedNode",void 0),u(this,"selectionState",void 0),this.config=iv(e,(e=>({bootstrapNodes:e.network.storageNodes,endpoint:e.network.apiEndpoint,logger:new sv}))(r)),this.logger=this.config.logger.createPrefixedLogger("[storage-node-selector]"),this.nodes=null!==(t=this.config.bootstrapNodes)&&void 0!==t?t:[],this.selectionState="healthy_only",this.updateAvailableStorageNodes(this.config.endpoint)}async updateAvailableStorageNodes(e){var t;this.logger.info("Updating list of available storage nodes");const n=`${e}/health_check`,r=await fetch(n);if(!r.ok)return void this.logger.warn("API health check did not respond successfully");const i=null===(t=(await r.json()).data.network)||void 0===t?void 0:t.content_nodes;i?(this.nodes=i,this.selectionState="healthy_only"):this.logger.warn("API health check did not contain any available content nodes")}async getSelectedNode(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.selectedNode&&!e?this.selectedNode:await this.select()}triedSelectingAllNodes(){return"failed_all"===this.selectionState}getNodes(e){return this.orderNodes(e)}async select(){"failed_all"===this.selectionState&&(this.selectionState="healthy_only");const e=await this.selectUntilEndOfList();return e?(this.selectedNode=e,this.logger.info("Selected content node",this.selectedNode)):(this.selectedNode=null,this.logger.warn("No healthy nodes found"),this.selectionState="failed_all"),this.selectedNode}async selectUntilEndOfList(){var e;if(null!==(e=this.orderedNodes)&&void 0!==e&&e.length||(this.orderedNodes=this.orderNodes((new Date).toString())),0===this.orderedNodes.length)return;let t,n=this.selectedNode?this.orderedNodes.indexOf(this.selectedNode):-1;for(;n!==this.orderedNodes.length-1;){n++;const e=this.orderedNodes[n];if(e&&await uz(e)){t=e;break}}return t}orderNodes(e){const t=this.nodes.map((e=>e.endpoint.toLowerCase()));return new WL(...t).getN(this.nodes.length,e)}}
29
- /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function dz(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function lz(){const e=(e,t)=>n=>e(t(n));for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i=Array.from(n).reverse().reduce(((t,n)=>t?e(t,n.encode):n.encode),void 0),o=n.reduce(((t,n)=>t?e(t,n.decode):n.decode),void 0);return{encode:i,decode:o}}function hz(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(dz(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function fz(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function pz(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"=";if(dz(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function gz(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function mz(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const i=[],o=Array.from(e);for(o.forEach((e=>{if(dz(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,s=!0;for(let i=r;i<o.length;i++){const a=o[i],u=t*e+a;if(!Number.isSafeInteger(u)||t*e/t!==e||u-a!=t*e)throw new Error("convertRadix: carry overflow");if(e=u%n,o[i]=Math.floor(u/n),!Number.isSafeInteger(o[i])||o[i]*n+e!==u)throw new Error("convertRadix: carry overflow");s&&(o[i]?s=!1:r=i)}if(i.push(e),s)break}for(let t=0;t<e.length-1&&0===e[t];t++)i.push(0);return i.reverse()}const yz=(e,t)=>t?yz(t,e%t):e,wz=(e,t)=>e+(t-yz(e,t));function vz(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(wz(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${wz(t,n)}`);let i=0,o=0;const s=2**n-1,a=[];for(const r of e){if(dz(r),r>=2**t)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<<t|r,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)a.push((i>>o-n&s)>>>0);i&=2**o-1}if(i=i<<n-o&s,!r&&o>=t)throw new Error("Excess padding");if(!r&&i)throw new Error(`Non-zero padding: ${i}`);return r&&o>0&&a.push(i>>>0),a}function bz(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(dz(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(wz(8,e)>32||wz(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return vz(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(vz(n,e,8,t))}}}function _z(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(null,n)}catch(e){}}}const Az=lz(bz(4),hz("0123456789ABCDEF"),fz("")),Ez=lz(bz(5),hz("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),pz(5),fz(""));lz(bz(5),hz("0123456789ABCDEFGHIJKLMNOPQRSTUV"),pz(5),fz("")),lz(bz(5),hz("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),fz(""),gz((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))));const kz=lz(bz(6),hz("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),pz(6),fz("")),Iz=lz(bz(6),hz("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),pz(6),fz("")),Sz=e=>{return lz((dz(t=58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return mz(Array.from(e),256,t)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(mz(e,t,256))}}),hz(e),fz(""));var t},Cz=Sz("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Sz("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Sz("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const xz=[0,2,3,5,6,7,9,10,11],Bz={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=Cz.encode(r).padStart(xz[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),i=xz.indexOf(r.length),o=Cz.decode(r);for(let e=0;e<o.length-i;e++)if(0!==o[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(o.slice(o.length-i)))}return Uint8Array.from(t)}},Tz=lz(hz("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),fz("")),Rz=[996825010,642813549,513874426,1027748829,705979059];function Dz(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e<Rz.length;e++)1==(t>>e&1)&&(n^=Rz[e]);return n}function Pz(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=e.length;let i=1;for(let t=0;t<r;t++){const n=e.charCodeAt(t);if(n<33||n>126)throw new Error(`Invalid prefix (${e})`);i=Dz(i)^n>>5}i=Dz(i);for(let t=0;t<r;t++)i=Dz(i)^31&e.charCodeAt(t);for(let e of t)i=Dz(i)^e;for(let e=0;e<6;e++)i=Dz(i);return i^=n,Tz.encode(vz([i%2**30],30,5,!1))}function Uz(e){const t="bech32"===e?1:734539939,n=bz(5),r=n.decode,i=n.encode,o=_z(r);function s(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:90;if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==n&&e.length>n)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(e=r).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=e.slice(0,i),s=e.slice(i+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=Tz.decode(s).slice(0,-6),u=Pz(o,a,t);if(!s.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected "${u}"`);return{prefix:o,words:a}}return{encode:function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:90;if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const i=e.length+7+n.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${Tz.encode(n)}${Pz(e,n,t)}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:_z(s),fromWords:r,fromWordsUnsafe:o,toWords:i}}Uz("bech32"),Uz("bech32m");const Oz={utf8:{encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},hex:lz(bz(4),hz("0123456789abcdef"),fz(""),gz((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}))),base16:Az,base32:Ez,base64:kz,base64url:Iz,base58:Cz,base58xmr:Bz};Object.keys(Oz).join(", ");const Fz=e=>{try{if(40!==e.length)return!1;return/^[0-9a-fA-F]+$/.test(e)}catch(e){return!1}},Mz=/^(https?):\/\//i,Lz=Tf.object({name:Tf.string(),description:Tf.optional(Tf.string().max(128)),imageUrl:Tf.optional(Tf.string().max(2e3).refine((e=>Mz.test(e)),{message:"Invalid URL"})),userId:vF,redirectUris:Tf.array(Tf.string().max(2e3).refine((e=>Mz.test(e)),{message:"Invalid URL"})).optional()}),qz=Tf.object({appApiKey:Tf.custom((e=>Fz(e))),name:Tf.string(),description:Tf.optional(Tf.string().max(128)),imageUrl:Tf.optional(Tf.string().max(2e3).refine((e=>Mz.test(e)),{message:"Invalid URL"})),userId:vF,redirectUris:Tf.array(Tf.string().max(2e3).refine((e=>Mz.test(e)),{message:"Invalid URL"})).optional()}),zz=Tf.object({userId:vF,appApiKey:Tf.custom((e=>Fz(e)))});class Nz extends oa{constructor(e,t){super(e),u(this,"entityManager",void 0),this.entityManager=t.entityManager}async createDeveloperAppWithEntityManager(e,t){var n;const{name:r,userId:i,description:o,imageUrl:s,redirectUris:a}=await El("createDeveloperApp",Lz)(e),u=Tc(sc.utils.randomPrivateKey()),c=function(e){return od(Dc(sc.getPublicKey(e.slice(2),!1)))}(u),d=Lb({apiKey:c,apiSecret:u}),l=`Creating Audius developer app at ${Math.round((new Date).getTime()/1e3)}`,h=await d.signMessage({message:l});if(!this.entityManager)throw new vl;const f=await this.entityManager.manageEntity({userId:i,entityType:Nb.DEVELOPER_APP,entityId:0,action:zb.CREATE,metadata:JSON.stringify({address:c.toLowerCase(),name:r,description:o,image_url:s,app_signature:{message:l,signature:h},redirect_uris:a}),...t}),p=c.startsWith("0x")?c.slice(2).toLowerCase():c.toLowerCase(),g=u.startsWith("0x")?u.slice(2).toLowerCase():u.toLowerCase();await this.registerDeveloperAppAPIKey({address:c,userId:i.toString(),metadata:{apiSecret:g}});const m=`/developer-apps/${encodeURIComponent(c)}/access-keys`,y=await this.request({path:m,method:"POST",headers:{},query:{user_id:i.toString()}}),w=null!==(n=(await y.json()).api_access_key)&&void 0!==n?n:"";return{...f,apiKey:p,apiSecret:g,bearer_token:w,bearerToken:w}}async getDeveloperAppsWithMetrics(e){const t=`/users/${encodeURIComponent(e.id)}/developer-apps`,n=await this.request({path:t,method:"GET",headers:{},query:{include:"metrics"}});return await n.json()}async createDeveloperApp(e,t){const n=!0===e.useApiEndpoint;if(this.entityManager&&!n)return await this.createDeveloperAppWithEntityManager({...e.metadata,userId:e.userId});const{useApiEndpoint:r,...i}=e;return await super.createDeveloperApp(i,t)}async updateDeveloperAppWithEntityManager(e,t){const{appApiKey:n,name:r,userId:i,description:o,imageUrl:s,redirectUris:a}=await El("updateDeveloperApp",qz)(e);if(!this.entityManager)throw new vl;return{...await this.entityManager.manageEntity({userId:i,entityType:Nb.DEVELOPER_APP,entityId:0,action:zb.UPDATE,metadata:JSON.stringify({address:`0x${n}`,name:r,description:o,image_url:s,redirect_uris:a}),...t})}}async updateDeveloperApp(e,t){return this.entityManager?await this.updateDeveloperAppWithEntityManager({...e.metadata,userId:e.userId,appApiKey:e.address}):await super.updateDeveloperApp(e,t)}async deleteDeveloperAppWithEntityManager(e){const{userId:t,appApiKey:n}=await El("deleteDeveloperApp",zz)(e);if(!this.entityManager)throw new vl;return await this.entityManager.manageEntity({userId:t,entityType:Nb.DEVELOPER_APP,entityId:0,action:zb.DELETE,metadata:JSON.stringify({address:`0x${n}`})})}async deleteDeveloperApp(e,t){return this.entityManager?await this.deleteDeveloperAppWithEntityManager({userId:e.userId,appApiKey:e.address}):await super.deleteDeveloperApp(e,t)}}let jz,$z;const Wz=e=>{let{apiKey:t,appName:n,services:r,basePath:i}=e;return $z=t,jz=n,{pre:async e=>{var o,s;if(!n){var a,u;const e=new d({fetchApi:bl,basePath:i}),n=new Nz(e,r);var c;if($z=null!=t?t:null===(a=await(null===(u=r.audiusWalletClient)||void 0===u?void 0:u.getAddresses()))||void 0===a?void 0:a[0],$z)jz=null===(c=(await n.getDeveloperApp({address:$z})).data)||void 0===c?void 0:c.name}if(!jz&&!$z)throw new Error("No appName or apiKey provided");return{...e,url:e.url+(e.url.includes("?")?"&":"?")+b({app_name:null!==(o=jz)&&void 0!==o?o:"",api_key:null!==(s=$z)&&void 0!==s?s:""}),init:{...e.init}}}}},Hz=new Error("request for lock canceled");var Kz=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))};class Vz{constructor(e,t=Hz){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((n,r)=>{const i={resolve:n,reject:r,weight:e,priority:t},o=Gz(this._queue,(e=>t<=e.priority));-1===o&&e<=this._value?this._dispatchItem(i):this._queue.splice(o+1,0,i)}))}runExclusive(e){return Kz(this,arguments,void 0,(function*(e,t=1,n=0){const[r,i]=yield this.acquire(t,n);try{return yield e(r)}finally{i()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const n=Gz(e,(e=>t.priority<=e.priority));e.splice(n+1,0,t)}(this._weightedWaiters[e-1],{resolve:n,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const n=this._weightedWaiters[t-1];if(!n)continue;const r=n.findIndex((t=>t.priority<=e));(-1===r?n:n.splice(0,r)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function Gz(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}var Zz=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))};class Yz{constructor(e){this._semaphore=new Vz(1,e)}acquire(){return Zz(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Jz="Encoded-Data-Message",Xz="Encoded-Data-Signature";function Qz(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const eN="audiusOauthState",tN="audiusPkceCodeVerifier",nN="audiusPkceRedirectUri";class rN{constructor(e){var t,n;u(this,"config",void 0),u(this,"activePopupWindow",void 0),u(this,"popupCheckInterval",void 0),u(this,"apiKey",void 0),u(this,"logger",void 0),u(this,"_currentLoginResolve",null),u(this,"_currentLoginReject",null),u(this,"_boundMessageHandler",null),u(this,"_redirectResult",null),u(this,"_redirectChecked",!1),u(this,"_csrfToken",null),u(this,"_pkceVerifier",null),u(this,"_pkceRedirectUri",null),this.config=e,this.apiKey=null!==(t=e.apiKey)&&void 0!==t?t:null,this.activePopupWindow=null,this.popupCheckInterval=null,this.logger=(null!==(n=e.logger)&&void 0!==n?n:new sv).createPrefixedLogger("[oauth]")}async login(e){let{scope:t="read",redirectUri:n,display:r="popup",responseMode:i="fragment",openUrl:o}=e;if(null!=this._currentLoginResolve)throw new Error("A login is already in progress.");const s=new Promise(((e,t)=>{this._currentLoginResolve=e,this._currentLoginReject=t}));this._redirectChecked=!1,this._redirectResult=null;try{const e="string"==typeof t?[t]:t;if(!this.config.appName&&!this.apiKey)throw new Error("App name or API key not set.");if(e.includes("write")&&!this.apiKey)throw new Error("The 'write' scope requires Audius SDK to be initialized with an API key");if(!(e=>{const t=new Set(iN);return-1===e.findIndex((e=>!t.has(e)))})(e))throw new Error("Scope must be `read` or `write`.");const s=e.includes("write")?"write":"read",a=null!=n?n:this.config.redirectUri;if(!a)throw new Error("redirectUri is required. Pass it to login() or set it in the SDK config.");const u=function(){const e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),Qz(e)}(),c=function(){const e=new Uint8Array(32);return globalThis.crypto.getRandomValues(e),Qz(e)}();let d;this._csrfToken=u,this._pkceVerifier=c,this._pkceRedirectUri=a,"undefined"!=typeof window&&window.sessionStorage&&(window.sessionStorage.setItem(eN,u),window.sessionStorage.setItem(tN,c),window.sessionStorage.setItem(nN,a));try{d=function(e){const t=(new TextEncoder).encode(e);return Qz(jL(t))}(c)}catch(e){throw new Error(e instanceof Error?`PKCE code challenge generation failed: ${e.message}`:"PKCE code challenge generation failed.")}const l="undefined"!=typeof window&&window.location?`&origin=${encodeURIComponent(window.location.origin)}`:"",h=encodeURIComponent(this.apiKey||this.config.appName),f=`${this.apiKey?"api_key":"app_name"}=${h}`,p=`&response_type=code&code_challenge=${encodeURIComponent(d)}&code_challenge_method=S256`,g=`${this.config.basePath}/oauth/authorize?scope=${s}&state=${u}&redirect_uri=${encodeURIComponent(a)}${l}&response_mode=${i}&${f}${p}&display=${r}`,m=null!=o?o:this.config.openUrl;if(m)await m(g);else if("popup"===r){if(this._boundMessageHandler||"undefined"==typeof window||(this._boundMessageHandler=e=>this._receiveMessage(e),window.addEventListener("message",this._boundMessageHandler,!1)),this.activePopupWindow=window.open(g,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=375, height=785, top=100, left=100"),!this.activePopupWindow)throw new Error("The login popup was blocked. Please allow popups for this site and try again.");this._clearPopupCheckInterval(),this.popupCheckInterval=setInterval((()=>{var e;null!==(e=this.activePopupWindow)&&void 0!==e&&e.closed&&(this._settleLogin(new Error("The login popup was closed prematurely.")),clearInterval(this.popupCheckInterval))}),500)}else window.location.href=g}catch(e){this._settleLogin(e instanceof Error?e:new Error("Login failed."))}return s}get csrfToken(){var e;return null!==(e=this._csrfToken)&&void 0!==e?e:"undefined"!=typeof window&&window.sessionStorage?window.sessionStorage.getItem(eN):null}get pkceVerifier(){var e;return null!==(e=this._pkceVerifier)&&void 0!==e?e:"undefined"!=typeof window&&window.sessionStorage?window.sessionStorage.getItem(tN):null}get pkceRedirectUri(){var e;return null!==(e=this._pkceRedirectUri)&&void 0!==e?e:"undefined"!=typeof window&&window.sessionStorage?window.sessionStorage.getItem(nN):null}hasRedirectResult(e){if(this._redirectChecked)return null!=this._redirectResult;const t=null!=e?e:"undefined"!=typeof window?window.location.href:null;if(!t)return!1;try{var n,r;const e=new URL(t),i=e.searchParams,o=new URLSearchParams(e.hash.startsWith("#")?e.hash.slice(1):""),s=null!==(n=i.get("code"))&&void 0!==n?n:o.get("code"),a=null!==(r=i.get("state"))&&void 0!==r?r:o.get("state");return!(!s||!a)}catch{return!1}}async handleRedirect(e){if(!this._redirectChecked){this._redirectChecked=!0;const t=null!=e?e:"undefined"!=typeof window?window.location.href:void 0;t&&this._handleRedirectResult(t)}if(this._redirectResult)try{await this._redirectResult,this._settleLogin()}catch(e){throw this._settleLogin(e instanceof Error?e:new Error("Token exchange failed.")),e}finally{this._redirectResult=null}}async isAuthenticated(){return!!await this.config.tokenStore.getAccessToken()}async hasRefreshToken(){return!!await this.config.tokenStore.getRefreshToken()}async getUser(){const e=await this.config.tokenStore.getAccessToken(),t={};let n;e&&(t.Authorization=`Bearer ${e}`);try{n=await fetch(`${this.config.basePath}/me`,{headers:t})}catch(e){throw new m(e instanceof Error?e:new Error(String(e)),"Failed to fetch user profile.")}if(!n.ok)throw new g(n,"Failed to fetch user profile.");return J((await n.json()).data)}async refreshAccessToken(){const e=await this.config.tokenStore.getRefreshToken();if(!e)return this.logger.error("No refresh token available."),null;try{const t=await fetch(`${this.config.basePath}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:e,client_id:this.apiKey})});if(!t.ok)return null;const n=await t.json();return n.access_token&&n.refresh_token?(await this.config.tokenStore.setTokens(n.access_token,n.refresh_token),n.access_token):null}catch{return null}}async logout(){const e=await this.config.tokenStore.getRefreshToken();if(e)try{await fetch(`${this.config.basePath}/oauth/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,client_id:this.apiKey})})}catch{}await this.config.tokenStore.clear(),this._clearPkceState()}async _exchangeCodeForTokens(e,t,n){const r=await fetch(`${this.config.basePath}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:e,code_verifier:t,client_id:this.apiKey,redirect_uri:n})});if(!r.ok){var i;const e=await r.json().catch((()=>({})));throw new Error(null!==(i=e.error_description)&&void 0!==i?i:"Token exchange failed.")}const o=await r.json();await this.config.tokenStore.setTokens(o.access_token,o.refresh_token)}_handleRedirectResult(e){var t,n,r,i,o,s;let a;try{a=new URL(e)}catch{return}const u=a.searchParams,c=new URLSearchParams(a.hash.startsWith("#")?a.hash.slice(1):""),d=null!==(t=u.get("code"))&&void 0!==t?t:c.get("code"),l=null!==(n=u.get("state"))&&void 0!==n?n:c.get("state"),h=null!==(r=null!==(i=u.get("origin"))&&void 0!==i?i:c.get("origin"))&&void 0!==r?r:a.origin;if(!d||!l){var f;const e=null!==(f=u.get("error"))&&void 0!==f?f:c.get("error");if(e){var p,g;const t=null!==(p=null!==(g=u.get("error_description"))&&void 0!==g?g:c.get("error_description"))&&void 0!==p?p:e;this._settleLogin(new Error(t))}return}if("undefined"!=typeof window&&window.opener){try{window.opener.postMessage({code:d,state:l},h)}catch{}return void window.close()}const m=this.pkceVerifier;if(!m)return void this._settleLogin(new Error("OAuth login state was lost. Please try signing in again."));if(this.csrfToken!==l)return this._clearPkceState(),void this._settleLogin(new Error("OAuth state mismatch — the login attempt may have been tampered with."));const y=null!==(o=null!==(s=this.pkceRedirectUri)&&void 0!==s?s:this.config.redirectUri)&&void 0!==o?o:`${a.origin}${a.pathname}`;if(this._clearPkceState(),"undefined"!=typeof window&&window.history)try{const t=new URL(e);if(t.searchParams.delete("code"),t.searchParams.delete("state"),t.hash){const e=new URLSearchParams(t.hash.slice(1));e.delete("code"),e.delete("state");const n=e.toString();t.hash=n?`#${n}`:""}window.history.replaceState(null,"",t.toString())}catch{}this._redirectResult=this._exchangeCodeForTokens(d,m,y).catch((e=>{throw this.logger.error("OAuth redirect token exchange failed:",e instanceof Error?e.message:e),e}))}_settleLogin(e){var t,n;e?null===(t=this._currentLoginReject)||void 0===t||t.call(this,e):null===(n=this._currentLoginResolve)||void 0===n||n.call(this);this._currentLoginResolve=null,this._currentLoginReject=null,this._boundMessageHandler&&"undefined"!=typeof window&&(window.removeEventListener("message",this._boundMessageHandler,!1),this._boundMessageHandler=null),this._clearPopupCheckInterval()}_clearPkceState(){this._csrfToken=null,this._pkceVerifier=null,this._pkceRedirectUri=null,"undefined"!=typeof window&&window.sessionStorage&&(window.sessionStorage.removeItem(eN),window.sessionStorage.removeItem(tN),window.sessionStorage.removeItem(nN))}_clearPopupCheckInterval(){this.popupCheckInterval&&clearInterval(this.popupCheckInterval)}async _receiveMessage(e){if(e.data&&e.data.state&&e.source===this.activePopupWindow)if(e.data.code){if(this._clearPopupCheckInterval(),this.activePopupWindow&&(this.activePopupWindow.closed||this.activePopupWindow.close(),this.activePopupWindow=null),this.csrfToken!==e.data.state)return void this._settleLogin(new Error("State mismatch."));const t=this.pkceVerifier,n=this.pkceRedirectUri;if(this._clearPkceState(),!t)return void this._settleLogin(new Error("PKCE code verifier not found."));try{await this._exchangeCodeForTokens(e.data.code,t,null!=n?n:window.location.origin),this._settleLogin()}catch(e){this._settleLogin(e instanceof Error?e:new Error("Token exchange failed."))}}else this._settleLogin(new Error("Received message with unknown format."))}}const iN=["read","write"],oN="audius_access_token",sN="audius_refresh_token";class aN{async getAccessToken(){try{return window.localStorage.getItem(oN)}catch{return null}}async getRefreshToken(){try{return window.localStorage.getItem(sN)}catch{return null}}async setTokens(e,t){window.localStorage.setItem(oN,e),window.localStorage.setItem(sN,t)}async clear(){window.localStorage.removeItem(oN),window.localStorage.removeItem(sN)}}const uN=Tf.object({appName:Tf.optional(Tf.string()),services:Tf.optional(Tf.custom()),apiKey:Tf.string().min(1),redirectUri:Tf.string().optional(),environment:Tf.enum(["development","production"]).optional(),apiEndpoint:Tf.string().min(1).optional()}),cN=Tf.object({appName:Tf.optional(Tf.string()),services:Tf.optional(Tf.custom()),apiKey:Tf.string().min(1).optional(),apiSecret:Tf.string().min(1),redirectUri:Tf.string().optional(),environment:Tf.enum(["development","production"]).optional(),apiEndpoint:Tf.string().min(1).optional()}),dN=Tf.object({appName:Tf.optional(Tf.string()),services:Tf.optional(Tf.custom()),apiKey:Tf.string().min(1),bearerToken:Tf.string().min(1),redirectUri:Tf.string().optional(),environment:Tf.enum(["development","production"]).optional(),apiEndpoint:Tf.string().min(1).optional()}),lN=Tf.object({appName:Tf.string().min(1),services:Tf.optional(Tf.custom()),redirectUri:Tf.string().optional(),environment:Tf.enum(["development","production"]).optional(),apiEndpoint:Tf.string().min(1).optional()}),hN=Tf.union([uN,dN,lN,cN]);var fN,pN;!function(e){e.ALL="All Genres",e.ELECTRONIC="Electronic",e.ROCK="Rock",e.METAL="Metal",e.ALTERNATIVE="Alternative",e.HIP_HOP_RAP="Hip-Hop/Rap",e.EXPERIMENTAL="Experimental",e.PUNK="Punk",e.FOLK="Folk",e.POP="Pop",e.AMBIENT="Ambient",e.SOUNDTRACK="Soundtrack",e.WORLD="World",e.JAZZ="Jazz",e.ACOUSTIC="Acoustic",e.FUNK="Funk",e.R_AND_B_SOUL="R&B/Soul",e.DEVOTIONAL="Devotional",e.CLASSICAL="Classical",e.REGGAE="Reggae",e.PODCASTS="Podcasts",e.COUNTRY="Country",e.SPOKEN_WORK="Spoken Word",e.COMEDY="Comedy",e.BLUES="Blues",e.KIDS="Kids",e.AUDIOBOOKS="Audiobooks",e.LATIN="Latin",e.LOFI="Lo-Fi",e.HYPERPOP="Hyperpop",e.DANCEHALL="Dancehall",e.TECHNO="Techno",e.TRAP="Trap",e.HOUSE="House",e.TECH_HOUSE="Tech House",e.DEEP_HOUSE="Deep House",e.DISCO="Disco",e.ELECTRO="Electro",e.JUNGLE="Jungle",e.PROGRESSIVE_HOUSE="Progressive House",e.HARDSTYLE="Hardstyle",e.GLITCH_HOP="Glitch Hop",e.TRANCE="Trance",e.FUTURE_BASS="Future Bass",e.FUTURE_HOUSE="Future House",e.TROPICAL_HOUSE="Tropical House",e.DOWNTEMPO="Downtempo",e.DRUM_AND_BASS="Drum & Bass",e.DUBSTEP="Dubstep",e.JERSEY_CLUB="Jersey Club",e.VAPORWAVE="Vaporwave",e.MOOMBAHTON="Moombahton"}(fN||(fN={})),function(e){e.PEACEFUL="Peaceful",e.ROMANTIC="Romantic",e.SENTIMENTAL="Sentimental",e.TENDER="Tender",e.EASYGOING="Easygoing",e.YEARNING="Yearning",e.SOPHISTICATED="Sophisticated",e.SENSUAL="Sensual",e.COOL="Cool",e.GRITTY="Gritty",e.MELANCHOLY="Melancholy",e.SERIOUS="Serious",e.BROODING="Brooding",e.FIERY="Fiery",e.DEFIANT="Defiant",e.AGGRESSIVE="Aggressive",e.ROWDY="Rowdy",e.EXCITED="Excited",e.ENERGIZING="Energizing",e.EMPOWERING="Empowering",e.STIRRING="Stirring",e.UPBEAT="Upbeat",e.OTHER="Other"}(pN||(pN={}));const gN=e=>{var t,i,o,s;hN.parse(e);const{services:u,environment:c}=e,l="appName"in e?e.appName:void 0,h="bearerToken"in e?e.bearerToken:void 0,f="apiKey"in e?e.apiKey:void 0,p="apiSecret"in e?e.apiSecret:void 0,g=null!==(t=null==u?void 0:u.logger)&&void 0!==t?t:new sv({logLevel:"production"!==c?"debug":void 0}),m="development"===e.environment?n.network.apiEndpoint:r.network.apiEndpoint,y=`${m}/v1`,w=[],v=null!==(i=null==u?void 0:u.tokenStore)&&void 0!==i?i:new aN,b="redirectUri"in e?e.redirectUri:void 0,_=new rN({apiKey:f,tokenStore:v,basePath:y,logger:g,redirectUri:b,openUrl:null==u?void 0:u.openUrl});(p||null!=u&&u.audiusWalletClient)&&w.push((e=>{let{services:t,apiKey:n,apiSecret:r}=e;const i=new Yz;let o=null,s=null,a=null,u=null,c=null;const d=async()=>i.runExclusive((async()=>{const{audiusWalletClient:e,logger:i}=t;try{var d;r&&!e&&(c=Lb({apiKey:null!=n?n:"0x0000000000000000000000000000000000000000",apiSecret:r}));const t=null!=e?e:c,[i]=null!==(d=await(null==t?void 0:t.getAddresses()))&&void 0!==d?d:[],h=(new Date).getTime();if(!o||!a||!u||u+864e5<h||s!==i){var l;if(!i)throw new Error("Could not get a wallet address.");s=i;const e=`signature:${h}`;a=null!==(l=await(null==t?void 0:t.signMessage({message:e})))&&void 0!==l?l:null,o=e,u=h}}catch(e){e instanceof Ob||null==i||i.warn(`Unable to add request signature: ${e}`)}return{message:o,signature:a}}));return{pre:async e=>{const t=e.init.headers;if(t[Jz]&&t[Xz])return e;const{message:n,signature:r}=await d();return n&&r?{...e,url:e.url,init:{...e.init,headers:{...e.init.headers,[Jz]:n,[Xz]:r}}}:e}}})({services:{audiusWalletClient:null==u?void 0:u.audiusWalletClient,logger:g},apiKey:f,apiSecret:p})),(l||f||null!=u&&u.audiusWalletClient)&&w.push(Wz({appName:l,apiKey:f,basePath:y,services:{audiusWalletClient:null==u?void 0:u.audiusWalletClient,entityManager:null==u?void 0:u.entityManager}})),f&&_&&w.push((e=>{let{oauth:t}=e,n=null;return{post:async e=>{var r;if(401!==e.response.status)return e.response;if(!await t.hasRefreshToken())return e.response;n||(n=t.refreshAccessToken().catch((()=>null)).finally((()=>{n=null})));const i=await n;if(!i)return e.response;const o={...e.init,headers:{...null!==(r=e.init.headers)&&void 0!==r?r:{},Authorization:`Bearer ${i}`}};return bl(e.url,o)}}})({oauth:_}));const A=new d({fetchApi:a,middleware:w,basePath:y,accessToken:null!=h?h:()=>v.getAccessToken().then((e=>e?`Bearer ${e}`:""))}),E=new ga(A),k=new ya(A);return{oauth:_,tokenStore:v,tracks:new pa(A),users:E,playlists:new ca(A),tips:new fa(A),resolve:k.resolve.bind(k),developerApps:new oa(A),dashboardWalletUsers:new ia(A),rewards:new la(A),comments:new ra(A),notifications:new ua(A),events:new sa(A),explore:new aa(A),search:new ha(A),coins:new na(A),wallets:new ma(A),challenges:new ta(A),prizes:new da(A),uploads:new wa({storage:null!==(o=null==u?void 0:u.storage)&&void 0!==o?o:new UL({storageNodeSelector:null!==(s=null==u?void 0:u.storageNodeSelector)&&void 0!==s?s:new cz({endpoint:m,logger:g}),logger:g})})}};window.audiusSdk=gN,window.audiusSdk.config={production:r,development:n},window.audiusSdk.ParseRequestError=Al,window.audiusSdk.Genre=fN,window.audiusSdk.Mood=pN,window.audiusSdk.ChallengeId=t,e.sdk=gN}({});
30
- //# sourceMappingURL=sdk.min.js.map