From f2fe62a7f730fcf70b23e94dfaa0e4ba3af62f11 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Wed, 28 Feb 2024 17:10:07 +0300 Subject: [PATCH 01/20] Add the failed bridge transfers --- src/bridgeCore/bridgeOperations.ts | 23 ++++++++++++++++++++--- src/bridgeCore/index.ts | 4 +++- src/common/errors.ts | 2 +- src/index.ts | 4 +++- src/tokenBridge/errors.ts | 21 +++++++++++++++++++-- src/tokenBridge/tokenBridge.ts | 14 ++++++++------ src/utils/bridgeUtils.ts | 3 ++- 7 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/bridgeCore/bridgeOperations.ts b/src/bridgeCore/bridgeOperations.ts index 4c4b805..9fa14d0 100644 --- a/src/bridgeCore/bridgeOperations.ts +++ b/src/bridgeCore/bridgeOperations.ts @@ -79,10 +79,18 @@ export interface FinishedBridgeTokenDeposit extends BridgeTokenTransferBase { readonly etherlinkOperation: EtherlinkTransferTokensOperation; } +export interface FailedBridgeTokenDeposit extends BridgeTokenTransferBase { + readonly kind: BridgeTokenTransferKind.Deposit; + readonly status: BridgeTokenTransferStatus.Failed; + readonly tezosOperation: TezosTransferTokensOperation; + readonly etherlinkOperation?: EtherlinkTransferTokensOperation; +} + export type BridgeTokenDeposit = | PendingBridgeTokenDeposit | CreatedBridgeTokenDeposit - | FinishedBridgeTokenDeposit; + | FinishedBridgeTokenDeposit + | FailedBridgeTokenDeposit; export interface PendingBridgeTokenWithdrawal extends BridgeTokenTransferBase { readonly kind: BridgeTokenTransferKind.Withdrawal; @@ -112,16 +120,25 @@ export interface SealedBridgeTokenWithdrawal extends BridgeTokenTransferBase { export interface FinishedBridgeTokenWithdrawal extends BridgeTokenTransferBase { readonly kind: BridgeTokenTransferKind.Withdrawal; readonly status: BridgeTokenTransferStatus.Finished; - readonly tezosOperation: TezosTransferTokensOperation; readonly etherlinkOperation: EtherlinkTransferTokensOperation; readonly rollupData: CementedRollupData; + readonly tezosOperation: TezosTransferTokensOperation; +} + +export interface FailedBridgeTokenWithdrawal extends BridgeTokenTransferBase { + readonly kind: BridgeTokenTransferKind.Withdrawal; + readonly status: BridgeTokenTransferStatus.Failed; + readonly etherlinkOperation: EtherlinkTransferTokensOperation; + readonly rollupData?: Partial; + readonly tezosOperation?: TezosTransferTokensOperation; } export type BridgeTokenWithdrawal = | PendingBridgeTokenWithdrawal | CreatedBridgeTokenWithdrawal | SealedBridgeTokenWithdrawal - | FinishedBridgeTokenWithdrawal; + | FinishedBridgeTokenWithdrawal + | FailedBridgeTokenWithdrawal; export type BridgeTokenTransfer = | BridgeTokenDeposit diff --git a/src/bridgeCore/index.ts b/src/bridgeCore/index.ts index 692d87c..8ab057c 100644 --- a/src/bridgeCore/index.ts +++ b/src/bridgeCore/index.ts @@ -10,12 +10,14 @@ export { type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, + type FailedBridgeTokenDeposit, type BridgeTokenWithdrawal, type PendingBridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal, type SealedBridgeTokenWithdrawal, - type FinishedBridgeTokenWithdrawal + type FinishedBridgeTokenWithdrawal, + type FailedBridgeTokenWithdrawal } from './bridgeOperations'; export type { diff --git a/src/common/errors.ts b/src/common/errors.ts index 265c35b..95f7bb8 100644 --- a/src/common/errors.ts +++ b/src/common/errors.ts @@ -8,7 +8,7 @@ export abstract class TokenBridgeError extends Error { } } -export class DisposedError extends Error { +export class DisposedError extends TokenBridgeError { } export class RemoteServiceResponseError extends TokenBridgeError { diff --git a/src/index.ts b/src/index.ts index ba36b27..c6b2e64 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,11 +39,13 @@ export { type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, + type FailedBridgeTokenDeposit, type BridgeTokenWithdrawal, type PendingBridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal, type SealedBridgeTokenWithdrawal, - type FinishedBridgeTokenWithdrawal + type FinishedBridgeTokenWithdrawal, + type FailedBridgeTokenWithdrawal } from './bridgeCore'; export type { diff --git a/src/tokenBridge/errors.ts b/src/tokenBridge/errors.ts index 4ce6ddd..d9b078d 100644 --- a/src/tokenBridge/errors.ts +++ b/src/tokenBridge/errors.ts @@ -1,7 +1,14 @@ -import { TokenBridgeError } from '../common'; +import type { BridgeTokenTransfer } from '../bridgeCore'; +import { DisposedError, TokenBridgeError } from '../common'; import type { EtherlinkToken } from '../etherlink'; import type { TezosToken } from '../tezos'; -import { tokenUtils } from '../utils'; +import { bridgeUtils, tokenUtils } from '../utils'; + +export class TokenBridgeDisposed extends DisposedError { + constructor() { + super('The TokenBridge is disposed.'); + } +} export class TokenPairNotFoundError extends TokenBridgeError { constructor(token: TezosToken | EtherlinkToken) { @@ -22,3 +29,13 @@ export class InsufficientBalanceError extends TokenBridgeError { return `${address} has an insufficient balance ${tokenUtils.toDisplayString(token)}. Balance = ${balance}. Requested = ${requested}`; } } + +export class FailedTokenTransferError extends TokenBridgeError { + constructor(tokenTransfer: BridgeTokenTransfer) { + super(FailedTokenTransferError.getMessage(tokenTransfer)); + } + + private static getMessage(tokenTransfer: BridgeTokenTransfer): string { + return `The ${bridgeUtils.getInitialOperationHash(tokenTransfer)} token transfer is failed`; + } +} diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 3efa8b5..85d5c54 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -3,7 +3,7 @@ import { Schema } from '@taquito/michelson-encoder'; import type { TezosToolkit } from '@taquito/taquito'; import type Web3 from 'web3'; -import { InsufficientBalanceError, TokenPairNotFoundError } from './errors'; +import { FailedTokenTransferError, InsufficientBalanceError, TokenBridgeDisposed, TokenPairNotFoundError } from './errors'; import type { TokenBridgeComponents } from './tokenBridgeComponents'; import type { TokenBridgeDataApi } from './tokenBridgeDataApi'; import type { TokenBridgeOptions } from './tokenBridgeOptions'; @@ -19,7 +19,7 @@ import { type PendingBridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal, type SealedBridgeTokenWithdrawal, type FinishedBridgeTokenWithdrawal } from '../bridgeCore'; import type { AccountTokenBalance, AccountTokenBalances } from '../bridgeDataProviders'; -import { EventEmitter, ToEventEmitter, type PublicEventEmitter, DisposedError } from '../common'; +import { EventEmitter, ToEventEmitter, type PublicEventEmitter } from '../common'; import { EtherlinkBlockchainBridgeComponent, EtherlinkToken, type NonNativeEtherlinkToken } from '../etherlink'; import { loggerProvider, @@ -363,7 +363,7 @@ export class TokenBridge implements Disposable { if (guards.isDisposable(this.bridgeComponents.transfersBridgeDataProvider)) this.bridgeComponents.transfersBridgeDataProvider[Symbol.dispose](); - this.rejectAndClearAllStatusWatchers('The TokenBridge has been disposed!'); + this.rejectAndClearAllStatusWatchers(new TokenBridgeDisposed()); this.detachEvents(); clearInterval(this.lastCreatedTokenTransfersTimerId); this.lastCreatedTokenTransfers.clear(); @@ -471,7 +471,6 @@ export class TokenBridge implements Disposable { protected unsubscribeFromAllSubscriptions(): void { this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromAllSubscriptions(); - this.rejectAndClearAllStatusWatchers('Unsubscribe from all subscriptions'); } // #endregion @@ -508,7 +507,10 @@ export class TokenBridge implements Disposable { for (const [status, watcher] of statusWatchers) { if (tokenTransfer.status >= status) { - watcher.resolve(tokenTransfer); + if (tokenTransfer.status === BridgeTokenTransferStatus.Failed) + watcher.reject(new FailedTokenTransferError(tokenTransfer)); + else + watcher.resolve(tokenTransfer); statusWatchers.delete(status); } } @@ -554,7 +556,7 @@ export class TokenBridge implements Disposable { return; loggerProvider.logger.error('Attempting to call the disposed TokenBridge instance'); - throw new DisposedError('TokenBridge is disposed'); + throw new TokenBridgeDisposed(); } private async depositUsingWalletApi( diff --git a/src/utils/bridgeUtils.ts b/src/utils/bridgeUtils.ts index eb88706..ca2f02d 100644 --- a/src/utils/bridgeUtils.ts +++ b/src/utils/bridgeUtils.ts @@ -21,6 +21,7 @@ const bigIntFieldNames: ReadonlyArray typeof value === 'bigint' ? value.toString(10) : value; + export const stringifyBridgeTokenTransfer = (tokenTransfer: BridgeTokenTransfer, space?: string | number | undefined): string => { try { return JSON.stringify(tokenTransfer, jsonStringifyReplacer, space); @@ -30,7 +31,7 @@ export const stringifyBridgeTokenTransfer = (tokenTransfer: BridgeTokenTransfer, } }; -export const parseBridgeTokenTransfer = (tokenTransfer: string): string | null => { +export const parseBridgeTokenTransfer = (tokenTransfer: string): BridgeTokenTransfer | null => { try { const transfer = JSON.parse(tokenTransfer); From bf68866ad7ee0d6643b3270d3a5d63ad46a31aff Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Thu, 29 Feb 2024 02:45:08 +0300 Subject: [PATCH 02/20] Make the SDK independent of blockchain libraries and toolkits --- .eslintignore | 5 +- integration/testHelpers.ts | 17 +- integration/tests/balances.test.ts | 8 +- integration/tests/deposit.test.ts | 25 +- .../bridgeBlockchainService.ts | 3 + .../abi/index.ts | 1 + .../abi/kernelContractAbi.ts} | 4 - .../etherlinkBridgeBlockchainService.ts | 48 +++ .../etherlinkBridgeBlockchainService/index.ts | 2 + src/bridgeBlockchainService/index.ts | 32 ++ .../contracts/fa12.ts | 0 .../contracts/fa2.ts | 0 .../contracts/index.ts | 0 .../contracts/nativeTokenTicketHelper.ts | 0 .../contracts/nonNativeTokenTicketHelper.ts | 0 .../helpers/fa12helper.ts | 0 .../helpers/fa2helper.ts | 0 .../helpers/index.ts | 0 .../index.ts | 10 + ...itoContractTezosBridgeBlockchainService.ts | 66 ++++ .../taquitoTezosBridgeBlockchainService.ts | 191 +++++++++++ ...quitoWalletTezosBridgeBlockchainService.ts | 66 ++++ .../tezosTicketerContentMichelsonType.ts | 0 .../tezosBridgeBlockchainService/index.ts | 1 + .../tezosBridgeBlockchainService.ts | 64 ++++ .../index.ts | 1 + .../precompiles.ts | 5 + .../web3EtherlinkBridgeBlockchainService.ts | 106 ++++++ src/bridgeCore/bridgeOperations.ts | 3 +- src/bridgeCore/depositOptions.ts | 10 +- src/bridgeCore/depositResult.ts | 13 - src/bridgeCore/index.ts | 16 +- src/bridgeCore/operationResults.ts | 16 + src/bridgeCore/tokenPair.ts | 6 +- src/bridgeCore/withdrawResult.ts | 14 - .../accountTokenBalances.ts | 3 +- .../balancesBridgeDataProvider.ts | 3 +- .../etherlinkNodeBalancesProvider/error.ts | 2 +- .../etherlinkNodeBalancesProvider.ts | 2 +- .../tzKTBalancesProvider/errors.ts | 2 +- .../tzKTBalancesProvider.ts | 2 +- .../defaultDataProvider.ts | 6 +- .../dipDupBridgeDataProvider.ts | 2 +- .../dipDupBridgeDataProvider/errors.ts | 3 +- .../dipDupBridgeDataProvider/mappers.ts | 3 +- .../localTokensBridgeDataProvider.ts | 3 +- .../tokensBridgeDataProvider.ts | 3 +- src/common/index.ts | 1 - src/defaultTokenBridge.ts | 116 +++++-- src/etherlink/contracts/index.ts | 1 - .../etherlinkBlockchainBridgeComponent.ts | 67 ---- src/etherlink/index.ts | 2 - src/index.ts | 23 +- src/tezos/common/index.ts | 0 src/tezos/index.ts | 4 - src/tezos/tezosBlockchainBridgeComponent.ts | 57 --- .../tezosBlockchainBridgeComponentBase.ts | 152 -------- .../tezosBlockchainBridgeComponentOptions.ts | 6 - src/tokenBridge/errors.ts | 3 +- src/tokenBridge/tokenBridge.ts | 324 +++++++----------- src/tokenBridge/tokenBridgeComponents.ts | 12 +- src/tokenBridge/tokenBridgeOptions.ts | 28 +- .../tokens.ts => tokens/etherlinkTokens.ts} | 2 +- src/tokens/index.ts | 3 + .../tokens.ts => tokens/tezosTokens.ts} | 2 +- src/{common => tokens}/token.ts | 0 src/utils/tokenUtils.ts | 4 +- 67 files changed, 921 insertions(+), 653 deletions(-) create mode 100644 src/bridgeBlockchainService/bridgeBlockchainService.ts create mode 100644 src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/index.ts rename src/{etherlink/contracts/kernelContract.ts => bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/kernelContractAbi.ts} (97%) create mode 100644 src/bridgeBlockchainService/etherlinkBridgeBlockchainService/etherlinkBridgeBlockchainService.ts create mode 100644 src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts create mode 100644 src/bridgeBlockchainService/index.ts rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/contracts/fa12.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/contracts/fa2.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/contracts/index.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/contracts/nativeTokenTicketHelper.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/contracts/nonNativeTokenTicketHelper.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/helpers/fa12helper.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/helpers/fa2helper.ts (100%) rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/helpers/index.ts (100%) create mode 100644 src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/index.ts create mode 100644 src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoContractTezosBridgeBlockchainService.ts create mode 100644 src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts create mode 100644 src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoWalletTezosBridgeBlockchainService.ts rename src/{tezos => bridgeBlockchainService/taquitoTezosBridgeBlockchainService}/tezosTicketerContentMichelsonType.ts (100%) create mode 100644 src/bridgeBlockchainService/tezosBridgeBlockchainService/index.ts create mode 100644 src/bridgeBlockchainService/tezosBridgeBlockchainService/tezosBridgeBlockchainService.ts create mode 100644 src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/index.ts create mode 100644 src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/precompiles.ts create mode 100644 src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts delete mode 100644 src/bridgeCore/depositResult.ts create mode 100644 src/bridgeCore/operationResults.ts delete mode 100644 src/bridgeCore/withdrawResult.ts delete mode 100644 src/etherlink/contracts/index.ts delete mode 100644 src/etherlink/etherlinkBlockchainBridgeComponent.ts delete mode 100644 src/etherlink/index.ts delete mode 100644 src/tezos/common/index.ts delete mode 100644 src/tezos/index.ts delete mode 100644 src/tezos/tezosBlockchainBridgeComponent.ts delete mode 100644 src/tezos/tezosBlockchainBridgeComponentBase.ts delete mode 100644 src/tezos/tezosBlockchainBridgeComponentOptions.ts rename src/{etherlink/tokens.ts => tokens/etherlinkTokens.ts} (89%) create mode 100644 src/tokens/index.ts rename src/{tezos/tokens.ts => tokens/tezosTokens.ts} (91%) rename src/{common => tokens}/token.ts (100%) diff --git a/.eslintignore b/.eslintignore index f6b3e6b..96c7c47 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ -**/dist -**/build +dist/ +build/ +temp/ diff --git a/integration/testHelpers.ts b/integration/testHelpers.ts index 49997e3..a5c489e 100644 --- a/integration/testHelpers.ts +++ b/integration/testHelpers.ts @@ -6,7 +6,7 @@ import { TestConfig } from './testConfig'; import { createDefaultTokenBridge, BridgeTokenTransferKind, BridgeTokenTransferStatus, LogLevel, - type TokenBridge, type DefaultTokenBridgeOptions, + type DefaultTokenBridgeOptions, type TezosToken, type EtherlinkToken, type BridgeTokenTransfer, type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, @@ -21,10 +21,10 @@ interface CreateTestTokenBridgeParams { testConfig: TestConfig, tezosToolkit?: TezosToolkit, etherlinkToolkit?: Web3, - overrideOptions?: Partial + overrideOptions?: Partial> } -export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolkit, overrideOptions }: CreateTestTokenBridgeParams): TokenBridge => { +export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolkit, overrideOptions }: CreateTestTokenBridgeParams) => { tezosToolkit = tezosToolkit || createTezosToolkitWithSigner(testConfig.tezosRpcUrl, testConfig.tezosAccountPrivateKey); etherlinkToolkit = etherlinkToolkit || createEtherlinkToolkitWithSigner(testConfig.etherlinkRpcUrl, testConfig.etherlinkAccountPrivateKey); @@ -33,11 +33,14 @@ export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolk logLevel: LogLevel.Debug }, tezos: { - toolkit: tezosToolkit, - rollupAddress: testConfig.tezosRollupAddress + name: 'taquito', + apiType: 'contract', + tezosToolkit, + smartRollupAddress: testConfig.tezosRollupAddress }, etherlink: { - toolkit: etherlinkToolkit + name: 'web3', + web3: etherlinkToolkit }, dipDup: { baseUrl: testConfig.dipDupBaseUrl, @@ -77,7 +80,7 @@ export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolk }, ], ...overrideOptions - }); + } as const); }; export const createTezosToolkitWithSigner = (rpcUrl: string, privateKey: string): TezosToolkit => { diff --git a/integration/tests/balances.test.ts b/integration/tests/balances.test.ts index 2025363..2847b96 100644 --- a/integration/tests/balances.test.ts +++ b/integration/tests/balances.test.ts @@ -1,7 +1,7 @@ import { TezosToolkit } from '@taquito/taquito'; import Web3 from 'web3'; -import { type TokenBridge, type AccountTokenBalance, type AccountTokenBalances } from '../../src'; +import type { AccountTokenBalance, AccountTokenBalances } from '../../src'; import { getTestConfig, type TestConfig, type TestTokens } from '../testConfig'; import { createTezosToolkitWithSigner, createEtherlinkToolkitWithSigner, createTestTokenBridge @@ -12,7 +12,7 @@ describe('Balances', () => { let tokens: TestTokens; let tezosToolkit: TezosToolkit; let etherlinkToolkit: Web3; - let tokenBridge: TokenBridge; + let tokenBridge: ReturnType; let testTezosAccountAddress: string; let testEtherlinkAccountAddress: string; @@ -27,8 +27,8 @@ describe('Balances', () => { tokenBridge = createTestTokenBridge({ testConfig, tezosToolkit, etherlinkToolkit }); const connectedAddresses = await Promise.all([ - await tokenBridge.getTezosConnectedAddress(), - await tokenBridge.getEtherlinkConnectedAddress() + await tokenBridge.getTezosSignerAddress(), + await tokenBridge.getEtherlinkSignerAddress() ]); testTezosAccountAddress = connectedAddresses[0]; testEtherlinkAccountAddress = connectedAddresses[1]; diff --git a/integration/tests/deposit.test.ts b/integration/tests/deposit.test.ts index 35c0002..6205e15 100644 --- a/integration/tests/deposit.test.ts +++ b/integration/tests/deposit.test.ts @@ -3,7 +3,7 @@ import Web3 from 'web3'; import { BridgeTokenTransferStatus, - type NativeEtherlinkToken, type NativeTezosToken, type TokenBridge + type NativeEtherlinkToken, type NativeTezosToken } from '../../src'; import { bridgeUtils } from '../../src/utils'; import { getTestConfig, type TestConfig, type TestTokens } from '../testConfig'; @@ -16,15 +16,12 @@ import { createTestTokenBridge } from '../testHelpers'; -// The Taquito Wallet API does not close some handles after tests complete. -const useWalletApi = false; - describe('Deposit', () => { let testConfig: TestConfig; let tokens: TestTokens; let tezosToolkit: TezosToolkit; let etherlinkToolkit: Web3; - let tokenBridge: TokenBridge; + let tokenBridge: ReturnType; let testTezosAccountAddress: string; let testEtherlinkAccountAddress: string; @@ -39,8 +36,8 @@ describe('Deposit', () => { tokenBridge = createTestTokenBridge({ testConfig, tezosToolkit, etherlinkToolkit }); const connectedAddresses = await Promise.all([ - await tokenBridge.getTezosConnectedAddress(), - await tokenBridge.getEtherlinkConnectedAddress() + await tokenBridge.getTezosSignerAddress(), + await tokenBridge.getEtherlinkSignerAddress() ]); testTezosAccountAddress = connectedAddresses[0]; testEtherlinkAccountAddress = connectedAddresses[1]; @@ -54,7 +51,7 @@ describe('Deposit', () => { const amount = 1_000_000n; const [tezosToken, etherlinkToken]: [NativeTezosToken, NativeEtherlinkToken] = [tokens.tezos.tez, tokens.etherlink.tez]; - const depositResult = await tokenBridge.deposit(amount, tezosToken, { useWalletApi }); + const depositResult = await tokenBridge.deposit(amount, tezosToken); expectPendingDeposit(depositResult.tokenTransfer, { amount, source: testTezosAccountAddress, @@ -81,7 +78,7 @@ describe('Deposit', () => { const amount = 7n; const [tezosToken, etherlinkToken] = [tokens.tezos.ctez, tokens.etherlink.ctez]; - const depositResult = await tokenBridge.deposit(amount, tezosToken, { useWalletApi }); + const depositResult = await tokenBridge.deposit(amount, tezosToken); expectPendingDeposit(depositResult.tokenTransfer, { amount, source: testTezosAccountAddress, @@ -108,7 +105,7 @@ describe('Deposit', () => { const amount = 20n; const [tezosToken, etherlinkToken] = [tokens.tezos.usdt, tokens.etherlink.usdt]; - const depositResult = await tokenBridge.deposit(amount, tezosToken, { useWalletApi }); + const depositResult = await tokenBridge.deposit(amount, tezosToken); expectPendingDeposit(depositResult.tokenTransfer, { amount, source: testTezosAccountAddress, @@ -172,7 +169,7 @@ describe('Deposit', () => { } }); - tokenBridge.deposit(amount, tezosToken, { useWalletApi }) + tokenBridge.deposit(amount, tezosToken) .then(result => tokenBridge.stream.subscribeToTokenTransfer(result.tokenTransfer)); }); @@ -217,7 +214,7 @@ describe('Deposit', () => { etherlinkToken }); if (!readyForDone) { - done.fail('The tokenTransferCreated event has not been fired.'); + done('The tokenTransferCreated event has not been fired.'); } done(); @@ -226,9 +223,9 @@ describe('Deposit', () => { tokenBridge.stream.subscribeToAccountTokenTransfers([testTezosAccountAddress, testEtherlinkAccountAddress]); - tokenBridge.deposit(amount, tezosToken, { useWalletApi }) + tokenBridge.deposit(amount, tezosToken) .then(depositResult => { - tokenTransferOperationHash = depositResult.depositOperation.hash; + tokenTransferOperationHash = depositResult.operationResult.hash; }); }); }); diff --git a/src/bridgeBlockchainService/bridgeBlockchainService.ts b/src/bridgeBlockchainService/bridgeBlockchainService.ts new file mode 100644 index 0000000..7af82d1 --- /dev/null +++ b/src/bridgeBlockchainService/bridgeBlockchainService.ts @@ -0,0 +1,3 @@ +export interface BridgeBlockchainService { + getSignerAddress(): Promise; +} diff --git a/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/index.ts b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/index.ts new file mode 100644 index 0000000..9934d25 --- /dev/null +++ b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/index.ts @@ -0,0 +1 @@ +export { kernelContractAbi } from './kernelContractAbi'; diff --git a/src/etherlink/contracts/kernelContract.ts b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/kernelContractAbi.ts similarity index 97% rename from src/etherlink/contracts/kernelContract.ts rename to src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/kernelContractAbi.ts index cfd8b6c..a8f443f 100644 --- a/src/etherlink/contracts/kernelContract.ts +++ b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/abi/kernelContractAbi.ts @@ -1,5 +1,3 @@ -import type { Contract } from 'web3'; - export const kernelContractAbi = [ { anonymous: false, @@ -189,5 +187,3 @@ export const kernelContractAbi = [ type: 'function' } ] as const; - -export type KernelContract = Contract; diff --git a/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/etherlinkBridgeBlockchainService.ts b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/etherlinkBridgeBlockchainService.ts new file mode 100644 index 0000000..61e71ba --- /dev/null +++ b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/etherlinkBridgeBlockchainService.ts @@ -0,0 +1,48 @@ +import type { NonNativeEtherlinkToken } from '../../tokens'; +import type { BridgeBlockchainService } from '../bridgeBlockchainService'; + +interface WithdrawTokenParamsBase { + amount: bigint; + tezosReceiverAddress: string; +} + +export interface WithdrawNativeTokenParams extends WithdrawTokenParamsBase { +} + +export interface WithdrawNonNativeTokenParams extends WithdrawTokenParamsBase { + token: NonNativeEtherlinkToken; + tezosTicketerAddress: string; + tezosTicketerContent: string; +} + +export interface CreateWithdrawNativeTokenOperationParams extends WithdrawNativeTokenParams { +} + +export interface CreateWithdrawNonNativeTokenOperationParams extends WithdrawNonNativeTokenParams { +} + +interface OperationResult { + hash: string; + timestamp: string; +} + +export interface WithdrawNativeTokenResult extends OperationResult { + amount: bigint; +} + +export interface WithdrawNonNativeTokenResult extends OperationResult { + amount: bigint; +} + +export interface EtherlinkBridgeBlockchainService< + TWithdrawNativeTokenExtraResult = unknown, + TWithdrawNonNativeTokenExtraResult = unknown, + TCreateWithdrawNativeTokenOperationResult = unknown, + TCreateWithdrawNonNativeTokenOperationResult = unknown, +> extends BridgeBlockchainService { + withdrawNativeToken(params: WithdrawNativeTokenParams): Promise; + withdrawNonNativeToken(params: WithdrawNonNativeTokenParams): Promise; + + createDepositNativeTokenOperation(params: CreateWithdrawNativeTokenOperationParams): Promise; + createDepositNonNativeTokenOperation(params: CreateWithdrawNonNativeTokenOperationParams): Promise; +} diff --git a/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts new file mode 100644 index 0000000..a79d439 --- /dev/null +++ b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts @@ -0,0 +1,2 @@ +export * from './abi'; +export type * from './etherlinkBridgeBlockchainService'; diff --git a/src/bridgeBlockchainService/index.ts b/src/bridgeBlockchainService/index.ts new file mode 100644 index 0000000..c83ffce --- /dev/null +++ b/src/bridgeBlockchainService/index.ts @@ -0,0 +1,32 @@ +export type { BridgeBlockchainService } from './bridgeBlockchainService'; + +export type { + TezosBridgeBlockchainService, + DepositNativeTokenParams, + DepositNonNativeTokensParams, + FinishWithdrawParams, + CreateDepositNativeTokenOperationParams, + CreateDepositNonNativeTokenOperationParams +} from './tezosBridgeBlockchainService'; + +export type { + EtherlinkBridgeBlockchainService, + WithdrawNativeTokenParams, + WithdrawNonNativeTokenParams, + CreateWithdrawNativeTokenOperationParams, + CreateWithdrawNonNativeTokenOperationParams +} from './etherlinkBridgeBlockchainService'; + +export { + TaquitoContractTezosBridgeBlockchainService, + TaquitoWalletTezosBridgeBlockchainService, + + type TaquitoContractTezosBridgeBlockchainServiceOptions, + type TaquitoWalletTezosBridgeBlockchainServiceOptions +} from './taquitoTezosBridgeBlockchainService'; + +export { + Web3EtherlinkBridgeBlockchainService, + + type Web3EtherlinkBridgeBlockchainServiceOptions +} from './web3EtherlinkBridgeBlockchainService'; diff --git a/src/tezos/contracts/fa12.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/fa12.ts similarity index 100% rename from src/tezos/contracts/fa12.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/fa12.ts diff --git a/src/tezos/contracts/fa2.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/fa2.ts similarity index 100% rename from src/tezos/contracts/fa2.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/fa2.ts diff --git a/src/tezos/contracts/index.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/index.ts similarity index 100% rename from src/tezos/contracts/index.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/index.ts diff --git a/src/tezos/contracts/nativeTokenTicketHelper.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/nativeTokenTicketHelper.ts similarity index 100% rename from src/tezos/contracts/nativeTokenTicketHelper.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/nativeTokenTicketHelper.ts diff --git a/src/tezos/contracts/nonNativeTokenTicketHelper.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/nonNativeTokenTicketHelper.ts similarity index 100% rename from src/tezos/contracts/nonNativeTokenTicketHelper.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/contracts/nonNativeTokenTicketHelper.ts diff --git a/src/tezos/helpers/fa12helper.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/helpers/fa12helper.ts similarity index 100% rename from src/tezos/helpers/fa12helper.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/helpers/fa12helper.ts diff --git a/src/tezos/helpers/fa2helper.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/helpers/fa2helper.ts similarity index 100% rename from src/tezos/helpers/fa2helper.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/helpers/fa2helper.ts diff --git a/src/tezos/helpers/index.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/helpers/index.ts similarity index 100% rename from src/tezos/helpers/index.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/helpers/index.ts diff --git a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/index.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/index.ts new file mode 100644 index 0000000..dfb4029 --- /dev/null +++ b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/index.ts @@ -0,0 +1,10 @@ +export { + TaquitoContractTezosBridgeBlockchainService, + type TaquitoContractTezosBridgeBlockchainServiceOptions +} from './taquitoContractTezosBridgeBlockchainService'; + +export { + TaquitoWalletTezosBridgeBlockchainService, + type TaquitoWalletTezosBridgeBlockchainServiceOptions +} from './taquitoWalletTezosBridgeBlockchainService'; + diff --git a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoContractTezosBridgeBlockchainService.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoContractTezosBridgeBlockchainService.ts new file mode 100644 index 0000000..16cc597 --- /dev/null +++ b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoContractTezosBridgeBlockchainService.ts @@ -0,0 +1,66 @@ +import type { BatchOperation, ContractProvider, OperationBatch, ParamsWithKind, TransactionOperation } from '@taquito/taquito'; + +import type { FA12Contract, FA2Contract, NativeTokenTicketHelper, NonNativeTokenTicketHelper } from './contracts'; +import { TaquitoTezosBridgeBlockchainService, type TaquitoTezosBridgeBlockchainServiceOptions } from './taquitoTezosBridgeBlockchainService'; +import type { + DepositNativeTokenParams, DepositNativeTokenResult, + DepositNonNativeTokensParams, DepositNonNativeTokenResult, + FinishWithdrawParams, FinishWithdrawResult +} from '../tezosBridgeBlockchainService'; + +export interface TaquitoContractTezosBridgeBlockchainServiceOptions extends TaquitoTezosBridgeBlockchainServiceOptions { +} + +export class TaquitoContractTezosBridgeBlockchainService extends TaquitoTezosBridgeBlockchainService { + async depositNativeToken(params: DepositNativeTokenParams): Promise { + const operation = await this.depositNativeTokenInternal(params); + + return { + amount: params.amount, + hash: operation.hash, + timestamp: this.getCurrentOperationTimestamp(), + operation + }; + } + + async depositNonNativeToken(params: DepositNonNativeTokensParams): Promise { + const operation = await this.depositNonNativeTokenInternal(params); + + return { + amount: params.amount, + hash: operation.hash, + timestamp: this.getCurrentOperationTimestamp(), + operation + }; + } + + async finishWithdraw(params: FinishWithdrawParams): Promise>; }> { + const operation = await this.finishWithdrawInternal(params); + + return { + hash: operation.hash, + timestamp: this.getCurrentOperationTimestamp(), + operation + }; + } + + protected createBatch(params?: ParamsWithKind[]): OperationBatch { + return this.tezosToolkit.contract.batch(params); + } + + protected getNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { + return this.tezosToolkit.contract.at>(ticketHelperContractAddress); + } + + protected getNonNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { + return this.tezosToolkit.contract.at>(ticketHelperContractAddress); + } + + protected getFA12TokenContract(fa12TokenContractAddress: string): Promise> { + return this.tezosToolkit.contract.at>(fa12TokenContractAddress); + } + + protected getFA2TokenContract(fa2TokenContractAddress: string): Promise> { + return this.tezosToolkit.contract.at>(fa2TokenContractAddress); + } +} diff --git a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts new file mode 100644 index 0000000..6961c6a --- /dev/null +++ b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts @@ -0,0 +1,191 @@ +import { packDataBytes } from '@taquito/michel-codec'; +import { Schema } from '@taquito/michelson-encoder'; +import type { TezosToolkit, Wallet, ContractProvider, ContractMethod } from '@taquito/taquito'; + +import type { FA12Contract, FA2Contract, NativeTokenTicketHelper, NonNativeTokenTicketHelper } from './contracts'; +import { fa12helper, fa2helper } from './helpers'; +import { tezosTicketerContentMichelsonType } from './tezosTicketerContentMichelsonType'; +import type { FA12TezosToken, FA2TezosToken } from '../../tokens'; +import { etherlinkUtils } from '../../utils'; +import type { + TezosBridgeBlockchainService, + DepositNativeTokenParams, DepositNonNativeTokensParams, FinishWithdrawParams, + DepositNativeTokenResult, DepositNonNativeTokenResult, FinishWithdrawResult, + CreateDepositNativeTokenOperationParams, CreateDepositNonNativeTokenOperationParams, +} from '../tezosBridgeBlockchainService'; + +export interface TaquitoTezosBridgeBlockchainServiceOptions { + tezosToolkit: TezosToolkit; + smartRollupAddress: string; +} + +export abstract class TaquitoTezosBridgeBlockchainService< + TApi extends ContractProvider | Wallet +> implements TezosBridgeBlockchainService< + DepositNativeTokenResult & { operation: Awaited['send']>> }, + DepositNonNativeTokenResult & { operation: Awaited['send']>> }, + FinishWithdrawResult & { operation: Awaited> }, + ContractMethod, + ContractMethod +> { + readonly smartRollupAddress: string; + + protected readonly tezosToolkit: TezosToolkit; + protected readonly tezosTicketerContentSchema = new Schema(tezosTicketerContentMichelsonType); + + constructor(options: TaquitoTezosBridgeBlockchainServiceOptions) { + this.smartRollupAddress = options.smartRollupAddress; + this.tezosToolkit = options.tezosToolkit; + } + + getSignerAddress(): Promise { + return this.tezosToolkit.signer.publicKeyHash(); + } + + abstract depositNativeToken( + params: DepositNativeTokenParams + ): Promise['send']>>; }>; + + abstract depositNonNativeToken( + params: DepositNonNativeTokensParams + ): Promise['send']>>; }>; + + abstract finishWithdraw( + params: FinishWithdrawParams + ): Promise>; }>; + + async createDepositNativeTokenOperation(params: CreateDepositNativeTokenOperationParams) { + const ticketHelperContract = await this.getNativeTokenTicketHelperContract(params.ticketHelperContractAddress); + const routingInfo = this.packDepositRoutingInfo(params.etherlinkReceiverAddress); + + const operation = ticketHelperContract.methodsObject.deposit({ + evm_address: this.smartRollupAddress, + l2_address: routingInfo, + }); + + return operation; + } + + async createDepositNonNativeTokenOperation(params: CreateDepositNonNativeTokenOperationParams) { + const ticketHelperContract = await this.getNonNativeTokenTicketHelperContract(params.ticketHelperContractAddress); + const routingInfo = this.packDepositRoutingInfo(params.etherlinkReceiverAddress); + + const operation = ticketHelperContract.methodsObject.deposit({ + rollup: this.smartRollupAddress, + receiver: routingInfo, + amount: params.amount + }); + + return operation; + } + + async getTezosTicketerContent(tezosTicketerAddress: string): Promise { + const storage = await this.tezosToolkit.contract.getStorage<{ content: any }>(tezosTicketerAddress); + const content = [...Object.values(storage.content)]; + const contentMichelsonData = this.tezosTicketerContentSchema.Encode(content); + + return '0x' + packDataBytes(contentMichelsonData, tezosTicketerContentMichelsonType).bytes.slice(2); + } + + protected async depositNativeTokenInternal(params: DepositNativeTokenParams) { + const depositOperation = await this.createDepositNativeTokenOperation(params); + + return depositOperation.send({ + amount: Number(params.amount), + mutez: true + }) as Promise['send']>>>; + } + + protected async depositNonNativeTokenInternal(params: DepositNonNativeTokensParams): Promise['send']>>> { + const useApprove = params.useApprove ?? true; + const depositOperation = await this.createDepositNonNativeTokenOperation(params); + + let batch = this.createBatch(); + + if (useApprove) { + batch = await (params.token.type === 'fa2' + ? this.wrapContractCallsWithFA2TokenApprove( + batch, + depositOperation, + params.token, + params.ticketHelperContractAddress + ) + : this.wrapContractCallsWithFA12TokenApprove( + batch, + depositOperation, + params.amount, + params.token, + params.ticketHelperContractAddress, + params.resetFA12Approve ?? true + )); + } + + return batch.send() as Promise['send']>>>; + } + + protected finishWithdrawInternal(params: FinishWithdrawParams) { + return this.tezosToolkit.contract.smartRollupExecuteOutboxMessage({ + rollup: this.smartRollupAddress, + cementedCommitment: params.cementedCommitment, + outputProof: params.outputProof + }); + } + + protected getCurrentOperationTimestamp() { + return new Date().toISOString(); + } + + protected async wrapContractCallsWithFA12TokenApprove( + batch: ReturnType, + contractCalls: Parameters[0]['contractCalls'], + amount: bigint, + token: FA12TezosToken, + ticketHelperContractAddress: string, + isNeedToReset: boolean + ): Promise> { + const tokenContract = await this.getFA12TokenContract(token.address); + const resultOperation = fa12helper.wrapContractCallsWithApprove({ + batch, + approvedAddress: ticketHelperContractAddress, + approvedAmount: amount, + tokenContract, + contractCalls, + isNeedToReset + }); + + return resultOperation as ReturnType; + } + + protected async wrapContractCallsWithFA2TokenApprove( + batch: ReturnType, + contractCalls: Parameters[0]['contractCalls'], + token: FA2TezosToken, + ticketHelperContractAddress: string + ): Promise> { + const [tokenContract, tokenOwnerAddress] = await Promise.all([ + this.getFA2TokenContract(token.address), + this.getSignerAddress() + ]); + + const resultOperation = fa2helper.wrapContractCallsWithApprove({ + batch, + approvedAddress: ticketHelperContractAddress, + ownerAddress: tokenOwnerAddress, + tokenId: token.tokenId, + tokenContract, + contractCalls + }); + + return resultOperation as ReturnType; + } + + protected packDepositRoutingInfo(etherlinkReceiverAddress: string): string { + return etherlinkUtils.prepareHexPrefix(etherlinkReceiverAddress, false); + } + + protected abstract createBatch(params?: Parameters[0]): ReturnType; + protected abstract getNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise>; + protected abstract getNonNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise>; + protected abstract getFA12TokenContract(fa12TokenContractAddress: string): Promise>; + protected abstract getFA2TokenContract(fa2TokenContractAddress: string): Promise>; +} diff --git a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoWalletTezosBridgeBlockchainService.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoWalletTezosBridgeBlockchainService.ts new file mode 100644 index 0000000..41ddadf --- /dev/null +++ b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoWalletTezosBridgeBlockchainService.ts @@ -0,0 +1,66 @@ +import type { ContractProvider, TransactionWalletOperation, Wallet, WalletOperationBatch, WalletParamsWithKind } from '@taquito/taquito'; + +import type { FA12Contract, FA2Contract, NativeTokenTicketHelper, NonNativeTokenTicketHelper } from './contracts'; +import { TaquitoTezosBridgeBlockchainService, type TaquitoTezosBridgeBlockchainServiceOptions } from './taquitoTezosBridgeBlockchainService'; +import type { + DepositNativeTokenParams, DepositNativeTokenResult, + DepositNonNativeTokenResult, DepositNonNativeTokensParams, + FinishWithdrawParams, FinishWithdrawResult +} from '../tezosBridgeBlockchainService'; + +export interface TaquitoWalletTezosBridgeBlockchainServiceOptions extends TaquitoTezosBridgeBlockchainServiceOptions { +} + +export class TaquitoWalletTezosBridgeBlockchainService extends TaquitoTezosBridgeBlockchainService { + async depositNativeToken(params: DepositNativeTokenParams): Promise { + const operation = await this.depositNativeTokenInternal(params); + + return { + amount: params.amount, + hash: operation.opHash, + timestamp: this.getCurrentOperationTimestamp(), + operation + }; + } + + async depositNonNativeToken(params: DepositNonNativeTokensParams): Promise['send']>>; }> { + const operation = await this.depositNonNativeTokenInternal(params); + + return { + amount: params.amount, + hash: operation.opHash, + timestamp: this.getCurrentOperationTimestamp(), + operation + }; + } + + async finishWithdraw(params: FinishWithdrawParams): Promise>; }> { + const operation = await this.finishWithdrawInternal(params); + + return { + hash: operation.hash, + timestamp: this.getCurrentOperationTimestamp(), + operation + }; + } + + protected createBatch(params?: WalletParamsWithKind[]): WalletOperationBatch { + return this.tezosToolkit.wallet.batch(params); + } + + protected getNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { + return this.tezosToolkit.wallet.at>(ticketHelperContractAddress); + } + + protected getNonNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { + return this.tezosToolkit.wallet.at>(ticketHelperContractAddress); + } + + protected getFA12TokenContract(fa12TokenContractAddress: string): Promise> { + return this.tezosToolkit.wallet.at>(fa12TokenContractAddress); + } + + protected getFA2TokenContract(fa2TokenContractAddress: string): Promise> { + return this.tezosToolkit.wallet.at>(fa2TokenContractAddress); + } +} diff --git a/src/tezos/tezosTicketerContentMichelsonType.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/tezosTicketerContentMichelsonType.ts similarity index 100% rename from src/tezos/tezosTicketerContentMichelsonType.ts rename to src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/tezosTicketerContentMichelsonType.ts diff --git a/src/bridgeBlockchainService/tezosBridgeBlockchainService/index.ts b/src/bridgeBlockchainService/tezosBridgeBlockchainService/index.ts new file mode 100644 index 0000000..aff66ab --- /dev/null +++ b/src/bridgeBlockchainService/tezosBridgeBlockchainService/index.ts @@ -0,0 +1 @@ +export type * from './tezosBridgeBlockchainService'; diff --git a/src/bridgeBlockchainService/tezosBridgeBlockchainService/tezosBridgeBlockchainService.ts b/src/bridgeBlockchainService/tezosBridgeBlockchainService/tezosBridgeBlockchainService.ts new file mode 100644 index 0000000..40d512b --- /dev/null +++ b/src/bridgeBlockchainService/tezosBridgeBlockchainService/tezosBridgeBlockchainService.ts @@ -0,0 +1,64 @@ +import type { NonNativeTezosToken } from '../../tokens'; +import type { BridgeBlockchainService } from '../bridgeBlockchainService'; + +interface DepositTokenParamsBase { + amount: bigint; + etherlinkReceiverAddress: string; + ticketHelperContractAddress: string; +} + +export interface DepositNativeTokenParams extends DepositTokenParamsBase { +} + +export interface DepositNonNativeTokensParams extends DepositTokenParamsBase { + token: NonNativeTezosToken; + useApprove?: boolean; + resetFA12Approve?: boolean; +} + +export interface FinishWithdrawParams { + cementedCommitment: string; + outputProof: string; +} + +export interface CreateDepositNativeTokenOperationParams extends DepositNativeTokenParams { +} + +export interface CreateDepositNonNativeTokenOperationParams extends CreateDepositNativeTokenOperationParams { +} + +interface OperationResult { + hash: string; + timestamp: string; +} + +export interface DepositNativeTokenResult extends OperationResult { + amount: bigint; +} + +export interface DepositNonNativeTokenResult extends OperationResult { + amount: bigint; +} + +export interface FinishWithdrawResult extends OperationResult { +} + +export interface TezosBridgeBlockchainService< + TDepositNativeTokenExtraResult = unknown, + TDepositNonNativeTokenExtraResult = unknown, + TFinishWithdrawExtraResult = unknown, + TCreateDepositNativeTokenOperationResult = unknown, + TCreateDepositNonNativeTokenOperationResult = unknown, +> extends BridgeBlockchainService { + readonly smartRollupAddress: string; + + depositNativeToken(params: DepositNativeTokenParams): Promise; + depositNonNativeToken(params: DepositNonNativeTokensParams): Promise; + + finishWithdraw(params: FinishWithdrawParams): Promise; + + createDepositNativeTokenOperation(params: CreateDepositNativeTokenOperationParams): Promise; + createDepositNonNativeTokenOperation(params: CreateDepositNonNativeTokenOperationParams): Promise; + + getTezosTicketerContent(tezosTicketerAddress: string): Promise; +} diff --git a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/index.ts b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/index.ts new file mode 100644 index 0000000..ce4f143 --- /dev/null +++ b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/index.ts @@ -0,0 +1 @@ +export { Web3EtherlinkBridgeBlockchainService, type Web3EtherlinkBridgeBlockchainServiceOptions } from './web3EtherlinkBridgeBlockchainService'; diff --git a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/precompiles.ts b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/precompiles.ts new file mode 100644 index 0000000..f41ed3c --- /dev/null +++ b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/precompiles.ts @@ -0,0 +1,5 @@ +import type { Contract } from 'web3'; + +import { kernelContractAbi } from '../etherlinkBridgeBlockchainService'; + +export type WithdrawNonNativeTokenPrecompile = Contract; diff --git a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts new file mode 100644 index 0000000..32884dd --- /dev/null +++ b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts @@ -0,0 +1,106 @@ +import type { Web3, TransactionReceipt } from 'web3'; +import type { NonPayableMethodObject } from 'web3-eth-contract'; + +import type { WithdrawNonNativeTokenPrecompile } from './precompiles'; +import { tezosUtils } from '../../utils'; +import { + kernelContractAbi, + type EtherlinkBridgeBlockchainService, + type WithdrawNativeTokenParams, + type WithdrawNativeTokenResult, + type WithdrawNonNativeTokenParams, + type WithdrawNonNativeTokenResult, + type CreateWithdrawNativeTokenOperationParams, + type CreateWithdrawNonNativeTokenOperationParams, +} from '../etherlinkBridgeBlockchainService'; + +export interface Web3EtherlinkBridgeBlockchainServiceOptions { + web3: Web3; + kernelAddress: string; + withdrawNativeTokenPrecompileAddress: string; + withdrawNonNativeTokenPrecompileAddress: string; +} + +export class Web3EtherlinkBridgeBlockchainService implements EtherlinkBridgeBlockchainService< + { receipt: TransactionReceipt }, + { receipt: TransactionReceipt }, + NonPayableMethodObject, + NonPayableMethodObject +> { + protected readonly web3: Web3; + protected readonly withdrawNativeTokenPrecompiledAddress: string; + protected readonly withdrawNonNativeTokenPrecompiledAddress: string; + protected readonly withdrawNonNativeTokenPrecompile: WithdrawNonNativeTokenPrecompile; + + constructor(options: Web3EtherlinkBridgeBlockchainServiceOptions) { + this.web3 = options.web3; + this.withdrawNativeTokenPrecompiledAddress = options.withdrawNativeTokenPrecompileAddress; + this.withdrawNonNativeTokenPrecompiledAddress = options.withdrawNonNativeTokenPrecompileAddress; + + this.withdrawNonNativeTokenPrecompile = new this.web3.eth.Contract( + kernelContractAbi, + this.withdrawNonNativeTokenPrecompiledAddress + ); + } + + async getSignerAddress(): Promise { + const accounts = await this.web3.eth.getAccounts(); + const address = accounts[0] || this.web3.eth.defaultAccount; + if (!address) + throw new Error('Address is unavailable'); + + return address; + } + + withdrawNativeToken(_params: WithdrawNativeTokenParams): Promise { + throw new Error('Withdrawal of native tokens is not supported yet'); + } + + async withdrawNonNativeToken(params: WithdrawNonNativeTokenParams): Promise { + const [nonNativeTokenOperation, gasPrice, signerAddress] = await Promise.all([ + this.createDepositNonNativeTokenOperation(params), + this.web3.eth.getGasPrice(), + this.getSignerAddress() + ]); + const data = nonNativeTokenOperation.encodeABI(); + // TODO: need to calculate the value or hardcode it in config + const receipt = await this.web3.eth.sendTransaction({ + from: signerAddress, + to: this.withdrawNonNativeTokenPrecompiledAddress, + gas: 30000n, + gasPrice, + data, + }); + + return { + hash: receipt.transactionHash.toString(), + amount: params.amount, + timestamp: this.getCurrentTransactionTimestamp(), + receipt + }; + } + + createDepositNativeTokenOperation(_params: CreateWithdrawNativeTokenOperationParams): Promise> { + throw new Error('Withdrawal of native tokens is not supported yet'); + } + + createDepositNonNativeTokenOperation(params: CreateWithdrawNonNativeTokenOperationParams): Promise> { + const tezosReceiverAddressBytes = tezosUtils.convertAddressToBytes(params.tezosReceiverAddress, true); + const tezosTicketerAddressBytes = tezosUtils.convertAddressToBytes(params.tezosTicketerAddress, true); + const tezosProxyAddressBytes = tezosUtils.convertAddressToBytes(params.tezosTicketerAddress); + const receiverBytes = tezosReceiverAddressBytes + tezosProxyAddressBytes; + + return Promise.resolve(this.withdrawNonNativeTokenPrecompile.methods + .withdraw( + params.token.address, + receiverBytes, + params.amount, + tezosTicketerAddressBytes, + params.tezosTicketerContent + )); + } + + protected getCurrentTransactionTimestamp() { + return new Date().toISOString(); + } +} diff --git a/src/bridgeCore/bridgeOperations.ts b/src/bridgeCore/bridgeOperations.ts index 9fa14d0..0a052ad 100644 --- a/src/bridgeCore/bridgeOperations.ts +++ b/src/bridgeCore/bridgeOperations.ts @@ -1,5 +1,4 @@ -import type { EtherlinkToken } from '../etherlink'; -import type { TezosToken } from '../tezos'; +import type { TezosToken, EtherlinkToken } from '../tokens'; export interface TezosTransferTokensOperation { readonly blockId: number; diff --git a/src/bridgeCore/depositOptions.ts b/src/bridgeCore/depositOptions.ts index 33a882e..ecacaf9 100644 --- a/src/bridgeCore/depositOptions.ts +++ b/src/bridgeCore/depositOptions.ts @@ -1,12 +1,4 @@ -interface DepositOptionsBase { +export interface DepositOptions { useApprove?: boolean; resetFA12Approve?: boolean; } - -export interface DepositOptions extends DepositOptionsBase { - useWalletApi: false; -} - -export interface WalletDepositOptions extends DepositOptionsBase { - useWalletApi?: true; -} diff --git a/src/bridgeCore/depositResult.ts b/src/bridgeCore/depositResult.ts deleted file mode 100644 index 2ec5934..0000000 --- a/src/bridgeCore/depositResult.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ContractProvider, Wallet } from '@taquito/taquito'; - -import type { PendingBridgeTokenDeposit } from './bridgeOperations'; - -export interface WalletDepositResult { - tokenTransfer: PendingBridgeTokenDeposit; - depositOperation: Awaited['send']>>; -} - -export interface DepositResult { - tokenTransfer: PendingBridgeTokenDeposit; - depositOperation: Awaited['send']>>; -} diff --git a/src/bridgeCore/index.ts b/src/bridgeCore/index.ts index 8ab057c..1eaab2c 100644 --- a/src/bridgeCore/index.ts +++ b/src/bridgeCore/index.ts @@ -20,17 +20,5 @@ export { type FailedBridgeTokenWithdrawal } from './bridgeOperations'; -export type { - DepositOptions, - WalletDepositOptions -} from './depositOptions'; - -export type { - DepositResult, - WalletDepositResult -} from './depositResult'; - -export type { - StartWithdrawResult, - FinishWithdrawResult -} from './withdrawResult'; +export type { DepositOptions } from './depositOptions'; +export type { DepositResult, StartWithdrawResult, FinishWithdrawResult } from './operationResults'; diff --git a/src/bridgeCore/operationResults.ts b/src/bridgeCore/operationResults.ts new file mode 100644 index 0000000..a4090a1 --- /dev/null +++ b/src/bridgeCore/operationResults.ts @@ -0,0 +1,16 @@ +import type { PendingBridgeTokenDeposit, PendingBridgeTokenWithdrawal, SealedBridgeTokenWithdrawal } from './bridgeOperations'; + +export interface StartWithdrawResult Promise> { + tokenTransfer: PendingBridgeTokenWithdrawal; + operationResult: Awaited>; +} + +export interface FinishWithdrawResult Promise> { + tokenTransfer: SealedBridgeTokenWithdrawal; + operationResult: Awaited>; +} + +export interface DepositResult Promise> { + tokenTransfer: PendingBridgeTokenDeposit; + operationResult: Awaited>; +} diff --git a/src/bridgeCore/tokenPair.ts b/src/bridgeCore/tokenPair.ts index 69f53dd..ac407ef 100644 --- a/src/bridgeCore/tokenPair.ts +++ b/src/bridgeCore/tokenPair.ts @@ -1,5 +1,7 @@ -import type { NativeEtherlinkToken, ERC20EtherlinkToken } from '../etherlink'; -import type { NativeTezosToken, FA12TezosToken, FA2TezosToken } from '../tezos'; +import type { + NativeTezosToken, FA12TezosToken, FA2TezosToken, + NativeEtherlinkToken, ERC20EtherlinkToken +} from '../tokens'; interface NativeTezosTokenTicketerInfo { readonly ticketHelperContractAddress: string; diff --git a/src/bridgeCore/withdrawResult.ts b/src/bridgeCore/withdrawResult.ts deleted file mode 100644 index f0a487f..0000000 --- a/src/bridgeCore/withdrawResult.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ContractProvider } from '@taquito/taquito'; -import type { TransactionReceipt } from 'web3'; - -import type { PendingBridgeTokenWithdrawal, SealedBridgeTokenWithdrawal } from './bridgeOperations'; - -export interface StartWithdrawResult { - tokenTransfer: PendingBridgeTokenWithdrawal; - startWithdrawOperation: TransactionReceipt; -} - -export interface FinishWithdrawResult { - tokenTransfer: SealedBridgeTokenWithdrawal; - finishWithdrawOperation: Awaited>; -} diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/accountTokenBalances.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/accountTokenBalances.ts index 795f693..9d75f8b 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/accountTokenBalances.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/accountTokenBalances.ts @@ -1,5 +1,4 @@ -import type { EtherlinkToken } from '../../etherlink'; -import type { TezosToken } from '../../tezos'; +import type { TezosToken, EtherlinkToken } from '../../tokens'; export interface TokenBalanceInfo { readonly token: TezosToken | EtherlinkToken; diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts index ba3bf2f..96cb965 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts @@ -1,6 +1,5 @@ import type { AccountTokenBalance, AccountTokenBalances } from './accountTokenBalances'; -import type { EtherlinkToken } from '../../etherlink'; -import type { TezosToken } from '../../tezos'; +import type { TezosToken, EtherlinkToken } from '../../tokens'; export interface BalancesBridgeDataProvider { getBalance(accountAddress: string, token: TezosToken | EtherlinkToken): Promise; diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/error.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/error.ts index 05a11cd..37c5071 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/error.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/error.ts @@ -1,6 +1,6 @@ import type { RPCNodeError } from './dto'; import { TokenBridgeError } from '../../../common'; -import type { NativeEtherlinkToken } from '../../../etherlink'; +import type { NativeEtherlinkToken } from '../../../tokens'; import { tokenUtils } from '../../../utils'; export class EtherlinkNodeTokenBalanceNotSupported extends TokenBridgeError { diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts index 4ecd3d7..6a2a037 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts @@ -1,8 +1,8 @@ import type { BalanceData, RPCNodeResponse } from './dto'; import { EtherlinkNodeRPCError, EtherlinkNodeTokenBalanceNotSupported } from './error'; import { RemoteService } from '../../../common'; -import type { NativeEtherlinkToken } from '../../../etherlink'; import { getErrorLogMessage, loggerProvider } from '../../../logging'; +import type { NativeEtherlinkToken } from '../../../tokens'; import type { AccountTokenBalance, AccountTokenBalances } from '../accountTokenBalances'; import type { BalancesBridgeDataProvider } from '../balancesBridgeDataProvider'; diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/errors.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/errors.ts index 7376daa..758a515 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/errors.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/errors.ts @@ -1,5 +1,5 @@ import { TokenBridgeError } from '../../../common'; -import type { TezosToken } from '../../../tezos'; +import type { TezosToken } from '../../../tokens'; import { tokenUtils } from '../../../utils'; export class TzKTTokenBalanceNotSupported extends TokenBridgeError { diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts index 70af0a4..b2db519 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts @@ -3,7 +3,7 @@ import { TzKTTokenBalanceNotSupported } from './errors'; import * as mappers from './mappers'; import { RemoteService } from '../../../common'; import { getTokenLogMessage, loggerProvider } from '../../../logging'; -import type { TezosToken, NativeTezosToken, NonNativeTezosToken, FA2TezosToken } from '../../../tezos'; +import type { TezosToken, NativeTezosToken, NonNativeTezosToken, FA2TezosToken } from '../../../tokens'; import { guards, tokenUtils } from '../../../utils'; import type { AccountTokenBalance, AccountTokenBalances, TokenBalanceInfo } from '../accountTokenBalances'; import type { BalancesBridgeDataProvider } from '../balancesBridgeDataProvider'; diff --git a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts index bc4444a..d53612f 100644 --- a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts +++ b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts @@ -1,7 +1,9 @@ import type { DefaultDataProviderOptions } from './defaultDataProviderOptions'; import type { BridgeTokenTransfer, TokenPair } from '../../bridgeCore'; -import type { EtherlinkToken, NativeEtherlinkToken, NonNativeEtherlinkToken } from '../../etherlink'; -import type { TezosToken, NativeTezosToken, NonNativeTezosToken } from '../../tezos'; +import type { + TezosToken, NativeTezosToken, NonNativeTezosToken, + EtherlinkToken, NativeEtherlinkToken, NonNativeEtherlinkToken +} from '../../tokens'; import { guards, memoize } from '../../utils'; import { TzKTBalancesProvider, EtherlinkNodeBalancesProvider, diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts index 35cfa2f..9c4c403 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts @@ -7,13 +7,13 @@ import { DipDupWebSocketClient, type DipDupWebSocketResponseDto } from './webSoc import { loggerProvider } from '../..'; import { BridgeTokenTransferKind, type BridgeTokenTransfer } from '../../bridgeCore'; import { EventEmitter, RemoteService, ToEventEmitter } from '../../common'; -import type { NonNativeEtherlinkToken } from '../../etherlink'; import { getErrorLogMessage, getBridgeTokenTransferLogMessage, getDetailedBridgeTokenTransferLogMessage, getTokenLogMessage } from '../../logging'; +import type { NonNativeEtherlinkToken } from '../../tokens'; import { bridgeUtils } from '../../utils'; import type { BalancesBridgeDataProvider, AccountTokenBalance, AccountTokenBalances } from '../balancesBridgeDataProvider'; import type { TransfersBridgeDataProvider } from '../transfersBridgeDataProvider'; diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts index dd63369..61016f2 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts @@ -1,7 +1,6 @@ import type { GraphQLError } from './dtos'; import { TokenBridgeError } from '../../common'; -import { EtherlinkToken } from '../../etherlink'; -import { TezosToken } from '../../tezos'; +import { TezosToken, EtherlinkToken } from '../../tokens'; import { tokenUtils } from '../../utils'; export class DipDupAutoUpdateIsDisabledError extends TokenBridgeError { diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts index 97e1cf3..4fb2cda 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts @@ -9,9 +9,8 @@ import { type BridgeTokenDeposit, type CreatedBridgeTokenDeposit, type BridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal } from '../../bridgeCore'; -import type { EtherlinkToken } from '../../etherlink'; import { getErrorLogMessage, loggerProvider } from '../../logging'; -import type { TezosToken } from '../../tezos'; +import type { TezosToken, EtherlinkToken } from '../../tokens'; import { etherlinkUtils } from '../../utils'; import type { AccountTokenBalance, AccountTokenBalances } from '../balancesBridgeDataProvider'; diff --git a/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts b/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts index 0caf6c0..f1abd1c 100644 --- a/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts +++ b/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts @@ -1,7 +1,6 @@ import type { TokensBridgeDataProvider } from './tokensBridgeDataProvider'; import type { TokenPair } from '../../bridgeCore'; -import type { EtherlinkToken } from '../../etherlink'; -import type { TezosToken } from '../../tezos'; +import type { TezosToken, EtherlinkToken } from '../../tokens'; type TokenPairsByTokenMap = { native?: TokenPair, diff --git a/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts b/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts index 3dca2d5..7c87074 100644 --- a/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts +++ b/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts @@ -1,6 +1,5 @@ import type { TokenPair } from '../../bridgeCore'; -import type { EtherlinkToken } from '../../etherlink'; -import type { TezosToken } from '../../tezos'; +import type { TezosToken, EtherlinkToken } from '../../tokens'; export interface TokensBridgeDataProvider { getRegisteredTokenPair(token: TezosToken | EtherlinkToken): Promise; diff --git a/src/common/index.ts b/src/common/index.ts index 5e491da..2eff8a1 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -3,4 +3,3 @@ export { EventEmitter, type PublicEventEmitter, type ToEventEmitter, type ToEven export { TimeoutScheduler } from './timeoutScheduler'; export { TokenBridgeError, DisposedError } from './errors'; export type { Network } from './network'; -export type { Token } from './token'; diff --git a/src/defaultTokenBridge.ts b/src/defaultTokenBridge.ts index c4b2830..de9f7fe 100644 --- a/src/defaultTokenBridge.ts +++ b/src/defaultTokenBridge.ts @@ -1,57 +1,123 @@ import type { TezosToolkit } from '@taquito/taquito'; import type Web3 from 'web3'; +import { + TaquitoContractTezosBridgeBlockchainService, + TaquitoWalletTezosBridgeBlockchainService, + Web3EtherlinkBridgeBlockchainService, +} from './bridgeBlockchainService'; import type { TokenPair } from './bridgeCore'; import { DefaultDataProvider, type DefaultDataProviderOptions, type TokensBridgeDataProvider } from './bridgeDataProviders'; import { LogLevel, loggerProvider, type Logger } from './logging'; -import { TokenBridge } from './tokenBridge/tokenBridge'; +import { TokenBridge } from './tokenBridge'; -interface DefaultTezosTokenBridgeOptions { - toolkit: TezosToolkit; - rollupAddress: string; +interface TaquitoTezosBridgeBlockchainServiceOptionsBase { + name: 'taquito'; + tezosToolkit: TezosToolkit; + smartRollupAddress: string; } -interface DefaultEtherlinkTokenBridgeOptions { - toolkit: Web3; +interface TaquitoContractTezosBridgeBlockchainServiceOptions extends TaquitoTezosBridgeBlockchainServiceOptionsBase { + apiType: 'contract'; } +interface TaquitoWalletTezosBridgeBlockchainServiceOptions extends TaquitoTezosBridgeBlockchainServiceOptionsBase { + apiType: 'wallet'; +} + +type TezosBridgeBlockchainServiceOptions = + | TaquitoContractTezosBridgeBlockchainServiceOptions + | TaquitoWalletTezosBridgeBlockchainServiceOptions; + +interface EtherlinkWeb3BridgeBlockchainServiceOptions { + name: 'web3'; + web3: Web3; +} + +type EtherlinkBridgeBlockchainServiceOptions = EtherlinkWeb3BridgeBlockchainServiceOptions; + interface LoggingOptions { logger?: Logger logLevel?: LogLevel } -export type DefaultTokenBridgeOptions = { - tezos: DefaultTezosTokenBridgeOptions; - etherlink: DefaultEtherlinkTokenBridgeOptions; +export type DefaultTokenBridgeOptions< + TTezosBridgeBlockchainServiceOptions extends TezosBridgeBlockchainServiceOptions = TezosBridgeBlockchainServiceOptions, + TEtherlinkBridgeBlockchainServiceOptions extends EtherlinkBridgeBlockchainServiceOptions = EtherlinkBridgeBlockchainServiceOptions +> = { + tezos: TTezosBridgeBlockchainServiceOptions; + etherlink: TEtherlinkBridgeBlockchainServiceOptions; tokenPairs: TokensBridgeDataProvider | ReadonlyArray>; logging?: LoggingOptions; } & DefaultDataProviderOptions; export const defaultEtherlinkKernelAddress = '0x0000000000000000000000000000000000000000'; -export const defaultEtherlinkWithdrawPrecompileAddress = '0x0000000000000000000000000000000000000040'; +export const defaultWithdrawNativeTokenPrecompileAddress = '0x0000000000000000000000000000000000000020'; +export const defaultWithdrawNonNativeTokenPrecompileAddress = '0x0000000000000000000000000000000000000040'; + +const createTezosBridgeBlockchainService = (options: DefaultTokenBridgeOptions['tezos']) => { + switch (options.name) { + case 'taquito': + switch (options.apiType) { + case 'contract': + return new TaquitoContractTezosBridgeBlockchainService({ + tezosToolkit: options.tezosToolkit, + smartRollupAddress: options.smartRollupAddress, + }); + case 'wallet': + return new TaquitoWalletTezosBridgeBlockchainService({ + tezosToolkit: options.tezosToolkit, + smartRollupAddress: options.smartRollupAddress, + }); + default: + throw new Error(`Unknown Taquito API type: ${(options as any).apiType}`); + } + default: + throw new Error(`Unknown service name: ${options.name}`); + } +}; -export const createDefaultTokenBridge = (options: DefaultTokenBridgeOptions): TokenBridge => { +const createEtherlinkBridgeBlockchainService = (options: DefaultTokenBridgeOptions['etherlink']) => { + switch (options.name) { + case 'web3': + return new Web3EtherlinkBridgeBlockchainService({ + web3: options.web3, + kernelAddress: defaultEtherlinkKernelAddress, + withdrawNativeTokenPrecompileAddress: defaultWithdrawNativeTokenPrecompileAddress, + withdrawNonNativeTokenPrecompileAddress: defaultWithdrawNonNativeTokenPrecompileAddress + }); + default: + throw new Error(`Unknown service name: ${options.name}`); + } +}; + +type MapTezosOptionsToService = Options extends TaquitoContractTezosBridgeBlockchainServiceOptions + ? TaquitoContractTezosBridgeBlockchainService + : Options extends TaquitoWalletTezosBridgeBlockchainServiceOptions + ? TaquitoWalletTezosBridgeBlockchainService + : never; + +type MapEtherlinkOptionsToService = Options extends EtherlinkWeb3BridgeBlockchainServiceOptions + ? Web3EtherlinkBridgeBlockchainService + : never; + +export const createDefaultTokenBridge = < + TOptions extends TezosBridgeBlockchainServiceOptions, + EOptions extends EtherlinkBridgeBlockchainServiceOptions +>(options: DefaultTokenBridgeOptions): TokenBridge, MapEtherlinkOptionsToService> => { if (options.logging) { options.logging.logger && loggerProvider.setLogger(options.logging.logger); options.logging.logLevel && loggerProvider.setLogLevel(options.logging.logLevel); } loggerProvider.logger.debug('Creating the default token bridge...'); + const tezosBridgeBlockchainService = createTezosBridgeBlockchainService(options.tezos); + const etherlinkBridgeBlockchainService = createEtherlinkBridgeBlockchainService(options.etherlink); + const defaultDataProvider = new DefaultDataProvider(options); const tokenBridge = new TokenBridge({ - tezos: { - toolkit: options.tezos.toolkit, - bridgeOptions: { - rollupAddress: options.tezos.rollupAddress - } - }, - etherlink: { - toolkit: options.etherlink.toolkit, - bridgeOptions: { - kernelAddress: defaultEtherlinkKernelAddress, - withdrawPrecompileAddress: defaultEtherlinkWithdrawPrecompileAddress - } - }, + tezosBridgeBlockchainService, + etherlinkBridgeBlockchainService, bridgeDataProviders: { tokens: defaultDataProvider, balances: defaultDataProvider, @@ -61,5 +127,5 @@ export const createDefaultTokenBridge = (options: DefaultTokenBridgeOptions): To loggerProvider.logger.debug('The default token bridge has been created'); - return tokenBridge; + return tokenBridge as TokenBridge, MapEtherlinkOptionsToService>; }; diff --git a/src/etherlink/contracts/index.ts b/src/etherlink/contracts/index.ts deleted file mode 100644 index c963df7..0000000 --- a/src/etherlink/contracts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { kernelContractAbi, type KernelContract } from './kernelContract'; diff --git a/src/etherlink/etherlinkBlockchainBridgeComponent.ts b/src/etherlink/etherlinkBlockchainBridgeComponent.ts deleted file mode 100644 index 3a4eb45..0000000 --- a/src/etherlink/etherlinkBlockchainBridgeComponent.ts +++ /dev/null @@ -1,67 +0,0 @@ -import type Web3 from 'web3'; -// eslint-disable-next-line no-duplicate-imports -import type { TransactionReceipt } from 'web3'; - -import { kernelContractAbi, type KernelContract } from './contracts'; -import { tezosUtils } from '../utils'; - -interface WithdrawParams { - tezosReceiverAddress: string; - amount: bigint; - tezosTicketerContent: string; - etherlinkSenderAddress: string; - etherlinkTokenProxyContractAddress: string; - tezosTicketerAddress: string; - tezosProxyAddress: string; -} - -export interface EtherlinkBlockchainBridgeComponentOptions { - etherlinkToolkit: Web3; - kernelAddress: string; - withdrawPrecompileAddress: string; -} - -export class EtherlinkBlockchainBridgeComponent { - protected readonly etherlinkToolkit: Web3; - protected readonly kernelContract: KernelContract; - protected readonly withdrawPrecompileAddress: string; - - constructor(options: EtherlinkBlockchainBridgeComponentOptions) { - this.etherlinkToolkit = options.etherlinkToolkit; - this.withdrawPrecompileAddress = options.withdrawPrecompileAddress; - - this.kernelContract = new this.etherlinkToolkit.eth.Contract( - kernelContractAbi, - this.withdrawPrecompileAddress - ); - } - - async withdraw(params: WithdrawParams): Promise { - const tezosReceiverAddressBytes = tezosUtils.convertAddressToBytes(params.tezosReceiverAddress, true); - const tezosTicketerAddressBytes = tezosUtils.convertAddressToBytes(params.tezosTicketerAddress, true); - const tezosProxyAddressBytes = tezosUtils.convertAddressToBytes(params.tezosProxyAddress); - const receiverBytes = tezosReceiverAddressBytes + tezosProxyAddressBytes; - - const data = this.kernelContract.methods - .withdraw( - params.etherlinkTokenProxyContractAddress, - receiverBytes, - params.amount, - tezosTicketerAddressBytes, - params.tezosTicketerContent - ) - .encodeABI(); - - // TODO: refactoring - const gasPrice = await this.etherlinkToolkit.eth.getGasPrice(); - const receipt = await this.etherlinkToolkit.eth.sendTransaction({ - from: params.etherlinkSenderAddress, - to: this.withdrawPrecompileAddress, - gas: BigInt('30000'), // TODO: need to calculate the value or hardcode it in config - gasPrice, // without gasPrice we get the 'Network doesn't support eip-1559' exception - data, - }); - - return receipt; - } -} diff --git a/src/etherlink/index.ts b/src/etherlink/index.ts deleted file mode 100644 index 7691c13..0000000 --- a/src/etherlink/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type { EtherlinkToken, NativeEtherlinkToken, NonNativeEtherlinkToken, ERC20EtherlinkToken } from './tokens'; -export { EtherlinkBlockchainBridgeComponent, type EtherlinkBlockchainBridgeComponentOptions } from './etherlinkBlockchainBridgeComponent'; diff --git a/src/index.ts b/src/index.ts index c6b2e64..4b68abd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,8 @@ export { export { createDefaultTokenBridge, defaultEtherlinkKernelAddress, - defaultEtherlinkWithdrawPrecompileAddress, + defaultWithdrawNativeTokenPrecompileAddress, + defaultWithdrawNonNativeTokenPrecompileAddress, type DefaultTokenBridgeOptions } from './defaultTokenBridge'; @@ -53,15 +54,27 @@ export type { FA2TezosToken, NonNativeTezosToken, NativeTezosToken, - TezosToken -} from './tezos'; + TezosToken, -export type { ERC20EtherlinkToken, NonNativeEtherlinkToken, NativeEtherlinkToken, EtherlinkToken -} from './etherlink'; +} from './tokens'; + +export { + TaquitoContractTezosBridgeBlockchainService, + TaquitoWalletTezosBridgeBlockchainService, + Web3EtherlinkBridgeBlockchainService, + + type BridgeBlockchainService, + type TezosBridgeBlockchainService, + type EtherlinkBridgeBlockchainService, + + type TaquitoContractTezosBridgeBlockchainServiceOptions, + type TaquitoWalletTezosBridgeBlockchainServiceOptions, + type Web3EtherlinkBridgeBlockchainServiceOptions +} from './bridgeBlockchainService'; export { DipDupBridgeDataProvider, diff --git a/src/tezos/common/index.ts b/src/tezos/common/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/tezos/index.ts b/src/tezos/index.ts deleted file mode 100644 index 1b6ca6b..0000000 --- a/src/tezos/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type { TezosToken, NativeTezosToken, NonNativeTezosToken, FA12TezosToken, FA2TezosToken } from './tokens'; -export { TezosBlockchainBridgeComponent } from './tezosBlockchainBridgeComponent'; -export type { TezosBlockchainBridgeComponentOptions } from './tezosBlockchainBridgeComponentOptions'; -export { tezosTicketerContentMichelsonType } from './tezosTicketerContentMichelsonType'; diff --git a/src/tezos/tezosBlockchainBridgeComponent.ts b/src/tezos/tezosBlockchainBridgeComponent.ts deleted file mode 100644 index d607bdf..0000000 --- a/src/tezos/tezosBlockchainBridgeComponent.ts +++ /dev/null @@ -1,57 +0,0 @@ -import type { ContractProvider, OperationBatch, ParamsWithKind, Wallet, WalletOperationBatch, WalletParamsWithKind } from '@taquito/taquito'; - -import type { NonNativeTokenTicketHelper, FA12Contract, FA2Contract, NativeTokenTicketHelper } from './contracts'; -import { TezosBlockchainBridgeComponentBase } from './tezosBlockchainBridgeComponentBase'; -import type { TezosBlockchainBridgeComponentOptions } from './tezosBlockchainBridgeComponentOptions'; - -export class TezosBlockchainBridgeComponent extends TezosBlockchainBridgeComponentBase { - readonly wallet: WalletTezosBlockchainBridgeComponent; - - constructor(options: TezosBlockchainBridgeComponentOptions) { - super(options); - - this.wallet = new WalletTezosBlockchainBridgeComponent(options); - } - - protected createBatch(params?: ParamsWithKind[]): OperationBatch { - return this.tezosToolkit.contract.batch(params); - } - - protected getNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { - return this.tezosToolkit.contract.at>(ticketHelperContractAddress); - } - - protected getNonNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { - return this.tezosToolkit.contract.at>(ticketHelperContractAddress); - } - - protected getFA12TokenContract(fa12TokenContractAddress: string): Promise> { - return this.tezosToolkit.contract.at>(fa12TokenContractAddress); - } - - protected getFA2TokenContract(fa2TokenContractAddress: string): Promise> { - return this.tezosToolkit.contract.at>(fa2TokenContractAddress); - } -} - -export class WalletTezosBlockchainBridgeComponent extends TezosBlockchainBridgeComponentBase { - protected createBatch(params?: WalletParamsWithKind[]): WalletOperationBatch { - return this.tezosToolkit.wallet.batch(params); - } - - protected getNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { - return this.tezosToolkit.wallet.at>(ticketHelperContractAddress); - } - - protected getNonNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise> { - return this.tezosToolkit.wallet.at>(ticketHelperContractAddress); - } - - protected getFA12TokenContract(fa12TokenContractAddress: string): Promise> { - return this.tezosToolkit.wallet.at>(fa12TokenContractAddress); - } - - protected getFA2TokenContract(fa2TokenContractAddress: string): Promise> { - return this.tezosToolkit.wallet.at>(fa2TokenContractAddress); - } -} diff --git a/src/tezos/tezosBlockchainBridgeComponentBase.ts b/src/tezos/tezosBlockchainBridgeComponentBase.ts deleted file mode 100644 index 20ba48e..0000000 --- a/src/tezos/tezosBlockchainBridgeComponentBase.ts +++ /dev/null @@ -1,152 +0,0 @@ -import { LocalForger } from '@taquito/local-forging'; -import { type TezosToolkit, type Wallet, type ContractProvider, type ContractMethod } from '@taquito/taquito'; - -import type { FA12Contract, FA2Contract, NativeTokenTicketHelper, NonNativeTokenTicketHelper } from './contracts'; -import { fa12helper, fa2helper } from './helpers'; -import type { TezosBlockchainBridgeComponentOptions } from './tezosBlockchainBridgeComponentOptions'; -import type { FA12TezosToken, FA2TezosToken, NonNativeTezosToken } from './tokens'; - -export interface DepositNativeTokenParams { - amount: bigint; - etherlinkReceiverAddress: string; - ticketHelperContractAddress: string; -} - -export interface DepositNonNativeTokensParams { - token: NonNativeTezosToken; - amount: bigint; - etherlinkReceiverAddress: string; - ticketHelperContractAddress: string; -} - -export abstract class TezosBlockchainBridgeComponentBase { - protected readonly tezosToolkit: TezosToolkit; - protected readonly rollupAddress: string; - protected readonly localForger = new LocalForger(); - - constructor(options: TezosBlockchainBridgeComponentOptions) { - this.tezosToolkit = options.tezosToolkit; - this.rollupAddress = options.rollupAddress; - } - - async depositNativeToken(params: DepositNativeTokenParams): Promise['send']>> { - const depositOperation = await this.createDepositNativeTokenOperation( - params.etherlinkReceiverAddress, - params.ticketHelperContractAddress - ); - - const batch = this.createBatch() - .withContractCall(depositOperation as ContractMethod & ContractMethod, { amount: Number(params.amount), mutez: true }); - - return batch.send() as ReturnType['send']>; - } - - async depositNonNativeToken(params: DepositNonNativeTokensParams): Promise['send']>> { - const depositOperation = await this.createDepositNonNativeTokenOperation( - params.etherlinkReceiverAddress, - params.amount, - params.ticketHelperContractAddress - ); - - let batch = this.createBatch(); - batch = await (params.token.type === 'fa2' - ? this.wrapContractCallsWithFA2TokenApprove(batch, depositOperation, params.token, params.ticketHelperContractAddress) - : this.wrapContractCallsWithFA12TokenApprove(batch, depositOperation, params.token, params.amount, params.ticketHelperContractAddress)); - - return batch.send() as ReturnType['send']>; - } - - async finishWithdraw(commitment: string, proof: string) { - return this.tezosToolkit.contract.smartRollupExecuteOutboxMessage({ - rollup: this.rollupAddress, - cementedCommitment: commitment, - outputProof: proof - }); - } - - protected async createDepositNativeTokenOperation(etherlinkReceiverAddress: string, ticketerContractAddress: string) { - const ticketHelperContract = await this.getNativeTokenTicketHelperContract(ticketerContractAddress); - const routingInfo = this.packDepositRoutingInfo(etherlinkReceiverAddress); - - const operation = ticketHelperContract.methodsObject.deposit({ - evm_address: this.rollupAddress, - l2_address: routingInfo, - }); - - return operation; - } - - protected async createDepositNonNativeTokenOperation( - etherlinkReceiverAddress: string, - amount: bigint, - ticketHelperContractAddress: string - ) { - const ticketHelperContract = await this.getNonNativeTokenTicketHelperContract(ticketHelperContractAddress); - const routingInfo = this.packDepositRoutingInfo(etherlinkReceiverAddress); - - const operation = ticketHelperContract.methodsObject.deposit({ - rollup: this.rollupAddress, - receiver: routingInfo, - amount - }); - - return operation; - } - - protected packDepositRoutingInfo(etherlinkReceiverAddress: string, etherlinkProxyAddress?: string): string { - // TODO: validate - // checkEvmAddressIsCorrect(etherlinkReceiverAddress); - // checkEvmAddressIsCorrect(etherlinkTokenProxyContractAddress); - return (etherlinkProxyAddress) - ? `${etherlinkReceiverAddress.substring(2)}${etherlinkProxyAddress.substring(2)}` - : etherlinkReceiverAddress.substring(2); - } - - protected async wrapContractCallsWithFA12TokenApprove( - batch: ReturnType, - contractCalls: Parameters[0]['contractCalls'], - token: FA12TezosToken, - amount: bigint, - ticketHelperContractAddress: string - ): Promise> { - const tokenContract = await this.getFA12TokenContract(token.address); - const resultOperation = fa12helper.wrapContractCallsWithApprove({ - batch, - approvedAddress: ticketHelperContractAddress, - approvedAmount: amount, - tokenContract, - contractCalls - }); - - return resultOperation as ReturnType; - } - - protected async wrapContractCallsWithFA2TokenApprove( - batch: ReturnType, - contractCalls: Parameters[0]['contractCalls'], - token: FA2TezosToken, - ticketHelperContractAddress: string - ): Promise> { - const [tokenContract, tokenOwnerAddress] = await Promise.all([ - this.getFA2TokenContract(token.address), - this.tezosToolkit.wallet.pkh() - ]); - - const resultOperation = fa2helper.wrapContractCallsWithApprove({ - batch, - approvedAddress: ticketHelperContractAddress, - ownerAddress: tokenOwnerAddress, - tokenId: token.tokenId, - tokenContract, - contractCalls - }); - - return resultOperation as ReturnType; - } - - protected abstract createBatch(params?: Parameters[0]): ReturnType; - protected abstract getNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise>; - protected abstract getNonNativeTokenTicketHelperContract(ticketHelperContractAddress: string): Promise>; - protected abstract getFA12TokenContract(fa12TokenContractAddress: string): Promise>; - protected abstract getFA2TokenContract(fa2TokenContractAddress: string): Promise>; -} diff --git a/src/tezos/tezosBlockchainBridgeComponentOptions.ts b/src/tezos/tezosBlockchainBridgeComponentOptions.ts deleted file mode 100644 index 5aa19bb..0000000 --- a/src/tezos/tezosBlockchainBridgeComponentOptions.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { TezosToolkit } from '@taquito/taquito'; - -export interface TezosBlockchainBridgeComponentOptions { - tezosToolkit: TezosToolkit; - rollupAddress: string; -} diff --git a/src/tokenBridge/errors.ts b/src/tokenBridge/errors.ts index d9b078d..e7082a8 100644 --- a/src/tokenBridge/errors.ts +++ b/src/tokenBridge/errors.ts @@ -1,7 +1,6 @@ import type { BridgeTokenTransfer } from '../bridgeCore'; import { DisposedError, TokenBridgeError } from '../common'; -import type { EtherlinkToken } from '../etherlink'; -import type { TezosToken } from '../tezos'; +import type { TezosToken, EtherlinkToken } from '../tokens'; import { bridgeUtils, tokenUtils } from '../utils'; export class TokenBridgeDisposed extends DisposedError { diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 85d5c54..792dda0 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -1,18 +1,13 @@ -import { packDataBytes } from '@taquito/michel-codec'; -import { Schema } from '@taquito/michelson-encoder'; -import type { TezosToolkit } from '@taquito/taquito'; -import type Web3 from 'web3'; - import { FailedTokenTransferError, InsufficientBalanceError, TokenBridgeDisposed, TokenPairNotFoundError } from './errors'; import type { TokenBridgeComponents } from './tokenBridgeComponents'; import type { TokenBridgeDataApi } from './tokenBridgeDataApi'; import type { TokenBridgeOptions } from './tokenBridgeOptions'; import type { TokenBridgeStreamApi } from './tokenBridgeStreamApi'; +import type { EtherlinkBridgeBlockchainService, TezosBridgeBlockchainService } from '../bridgeBlockchainService'; import { BridgeTokenTransferKind, BridgeTokenTransferStatus, type TokenPair, - type DepositOptions, type WalletDepositOptions, type DepositResult, type WalletDepositResult, - type StartWithdrawResult, type FinishWithdrawResult, + type DepositOptions, type DepositResult, type StartWithdrawResult, type FinishWithdrawResult, type BridgeTokenTransfer, type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, @@ -20,13 +15,15 @@ import { } from '../bridgeCore'; import type { AccountTokenBalance, AccountTokenBalances } from '../bridgeDataProviders'; import { EventEmitter, ToEventEmitter, type PublicEventEmitter } from '../common'; -import { EtherlinkBlockchainBridgeComponent, EtherlinkToken, type NonNativeEtherlinkToken } from '../etherlink'; import { loggerProvider, getTokenLogMessage, getBridgeTokenTransferLogMessage, getDetailedBridgeTokenTransferLogMessage, getErrorLogMessage } from '../logging'; -import { TezosBlockchainBridgeComponent, tezosTicketerContentMichelsonType, type TezosToken } from '../tezos'; -import { bridgeUtils, etherlinkUtils, guards } from '../utils'; +import type { + TezosToken, NativeTezosToken, NonNativeTezosToken, + EtherlinkToken, NativeEtherlinkToken, NonNativeEtherlinkToken +} from '../tokens'; +import { bridgeUtils, guards } from '../utils'; type TokenTransferCreatedEventArgument = readonly [ tokenTransfer: PendingBridgeTokenDeposit | PendingBridgeTokenWithdrawal | CreatedBridgeTokenDeposit | CreatedBridgeTokenWithdrawal @@ -37,22 +34,22 @@ interface TokenBridgeComponentsEvents { readonly tokenTransferUpdated: PublicEventEmitter; } -export class TokenBridge implements Disposable { +export class TokenBridge< + TTezosBridgeBlockchainService extends TezosBridgeBlockchainService = TezosBridgeBlockchainService, + TEtherlinkBridgeBlockchainService extends EtherlinkBridgeBlockchainService = EtherlinkBridgeBlockchainService +> implements Disposable { private static readonly defaultLastCreatedTokenTransfersTimerPeriod = 60_000; private static readonly defaultLastCreatedTokenTransferLifetime = 30_000; readonly data: TokenBridgeDataApi; readonly stream: TokenBridgeStreamApi; - readonly bridgeComponents: TokenBridgeComponents; + readonly bridgeComponents: TokenBridgeComponents; protected readonly events: TokenBridgeComponentsEvents = { tokenTransferCreated: new EventEmitter(), tokenTransferUpdated: new EventEmitter() }; - protected readonly tezosToolkit: TezosToolkit; - protected readonly etherlinkToolkit: Web3; - protected readonly tezosTicketerContentSchema = new Schema(tezosTicketerContentMichelsonType); protected readonly tokenTransferOperationWatchers = new Map< string, Map | undefined; private _isDisposed = false; - constructor(options: TokenBridgeOptions) { - this.tezosToolkit = options.tezos.toolkit; - this.etherlinkToolkit = options.etherlink.toolkit; - - const tezosBlockchainBridgeComponent = new TezosBlockchainBridgeComponent({ - tezosToolkit: this.tezosToolkit, - rollupAddress: options.tezos.bridgeOptions.rollupAddress - }); - const etherlinkBlockchainBridgeComponent = new EtherlinkBlockchainBridgeComponent({ - etherlinkToolkit: this.etherlinkToolkit, - kernelAddress: options.etherlink.bridgeOptions.kernelAddress, - withdrawPrecompileAddress: options.etherlink.bridgeOptions.withdrawPrecompileAddress - }); + constructor(options: TokenBridgeOptions) { this.bridgeComponents = { - tezos: tezosBlockchainBridgeComponent, - etherlink: etherlinkBlockchainBridgeComponent, + tezosBridgeBlockchainService: options.tezosBridgeBlockchainService, + etherlinkBridgeBlockchainService: options.etherlinkBridgeBlockchainService, tokensBridgeDataProvider: options.bridgeDataProviders.tokens, balancesBridgeDataProvider: options.bridgeDataProviders.balances, transfersBridgeDataProvider: options.bridgeDataProviders.transfers @@ -194,30 +179,37 @@ export class TokenBridge implements Disposable { return watcherPromise; } - async deposit(amount: bigint, token: TezosToken): Promise; - async deposit(amount: bigint, token: TezosToken, etherlinkReceiverAddress: string): Promise; - async deposit(amount: bigint, token: TezosToken, options: WalletDepositOptions): Promise; - async deposit(amount: bigint, token: TezosToken, options: DepositOptions): Promise; - async deposit(amount: bigint, token: TezosToken, etherlinkReceiverAddress: string, options: WalletDepositOptions): Promise; - async deposit(amount: bigint, token: TezosToken, etherlinkReceiverAddress: string, options: DepositOptions): Promise; + async deposit(amount: bigint, token: NativeTezosToken): Promise>; + async deposit(amount: bigint, token: NativeTezosToken, etherlinkReceiverAddress: string): Promise>; + async deposit(amount: bigint, token: NativeTezosToken, options: DepositOptions): Promise>; + async deposit(amount: bigint, token: NativeTezosToken, etherlinkReceiverAddress: string, options: DepositOptions): Promise>; + async deposit(amount: bigint, token: NonNativeTezosToken): Promise>; + async deposit(amount: bigint, token: NonNativeTezosToken, etherlinkReceiverAddress: string): Promise>; + async deposit(amount: bigint, token: NonNativeTezosToken, options: DepositOptions): Promise>; + async deposit(amount: bigint, token: NonNativeTezosToken, etherlinkReceiverAddress: string, options: DepositOptions): Promise>; async deposit( amount: bigint, token: TezosToken, - etherlinkReceiverAddressOrOptions?: string | WalletDepositOptions | DepositOptions, - options?: WalletDepositOptions | DepositOptions - ): Promise { + etherlinkReceiverAddressOrOptions?: string | DepositOptions, + options?: DepositOptions + ): Promise | DepositResult>; + async deposit( + amount: bigint, + token: TezosToken, + etherlinkReceiverAddressOrOptions?: string | DepositOptions, + options?: DepositOptions + ): Promise | DepositResult> { this.ensureIsNotDisposed(); - const tezosSourceAddress = await this.getTezosConnectedAddress(); + + const tezosSourceAddress = await this.getTezosSignerAddress(); const etherlinkReceiverAddress = typeof etherlinkReceiverAddressOrOptions === 'string' ? etherlinkReceiverAddressOrOptions - : await this.getEtherlinkConnectedAddress(); + : await this.getEtherlinkSignerAddress(); const depositOptions = typeof etherlinkReceiverAddressOrOptions !== 'string' && etherlinkReceiverAddressOrOptions ? etherlinkReceiverAddressOrOptions : options; - const useWalletApi = depositOptions && depositOptions.useWalletApi !== undefined ? depositOptions.useWalletApi : true; loggerProvider.lazyLogger.log?.( `Depositing ${amount.toString(10)} ${getTokenLogMessage(token)} from ${tezosSourceAddress} to ${etherlinkReceiverAddress}` ); - loggerProvider.logger.debug(`Use the Taquito ${useWalletApi ? 'Wallet' : 'Contract'} API`); const tokenPair = await this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPair(token); if (!tokenPair) { @@ -233,38 +225,72 @@ export class TokenBridge implements Disposable { } loggerProvider.logger.log(`The ${tezosSourceAddress} has enough tokens to deposit ${amount}`); - const ticketHelperContractAddress = tokenPair.tezos.ticketHelperContractAddress; - - const depositOperation = await (useWalletApi - ? this.depositUsingWalletApi( - token, + const operationResult = await (token.type === 'native' + ? this.bridgeComponents.tezosBridgeBlockchainService.depositNativeToken({ amount, etherlinkReceiverAddress, - depositOptions as WalletDepositOptions, - ticketHelperContractAddress - ) - : this.depositUsingContractApi( + ticketHelperContractAddress: tokenPair.tezos.ticketHelperContractAddress, + }) + : this.bridgeComponents.tezosBridgeBlockchainService.depositNonNativeToken({ token, amount, etherlinkReceiverAddress, - depositOptions as DepositOptions, - ticketHelperContractAddress - ) + ticketHelperContractAddress: tokenPair.tezos.ticketHelperContractAddress, + useApprove: depositOptions?.useApprove, + resetFA12Approve: depositOptions?.resetFA12Approve, + }) ); + loggerProvider.logger.log('The deposit operation has been created:', operationResult.hash); + + const tokenTransfer: PendingBridgeTokenDeposit = { + kind: BridgeTokenTransferKind.Deposit, + status: BridgeTokenTransferStatus.Pending, + source: tezosSourceAddress, + receiver: etherlinkReceiverAddress, + tezosOperation: { + hash: operationResult.hash, + amount: operationResult.amount, + timestamp: operationResult.timestamp, + token, + } + }; - loggerProvider.lazyLogger.log?.(getBridgeTokenTransferLogMessage(depositOperation.tokenTransfer)); - loggerProvider.lazyLogger.debug?.(getDetailedBridgeTokenTransferLogMessage(depositOperation.tokenTransfer)); + loggerProvider.lazyLogger.log?.(getBridgeTokenTransferLogMessage(tokenTransfer)); + loggerProvider.lazyLogger.debug?.(getDetailedBridgeTokenTransferLogMessage(tokenTransfer)); - this.emitLocalTokenTransferCreatedEvent(depositOperation.tokenTransfer); + this.emitLocalTokenTransferCreatedEvent(tokenTransfer); - return depositOperation; + return { + tokenTransfer, + operationResult + } as DepositResult | DepositResult; } - async startWithdraw(amount: bigint, token: NonNativeEtherlinkToken, tezosReceiverAddress?: string): Promise { + async startWithdraw( + amount: bigint, + token: NativeEtherlinkToken, + tezosReceiverAddress?: string + ): Promise>; + async startWithdraw( + amount: bigint, + token: NonNativeEtherlinkToken, + tezosReceiverAddress?: string + ): Promise>; + async startWithdraw( + amount: bigint, + token: EtherlinkToken, + tezosReceiverAddress?: string + ): Promise | StartWithdrawResult>; + async startWithdraw( + amount: bigint, + token: EtherlinkToken, + tezosReceiverAddress?: string + ): Promise | StartWithdrawResult> { this.ensureIsNotDisposed(); - const etherlinkSourceAddress = await this.getEtherlinkConnectedAddress(); + + const etherlinkSourceAddress = await this.getEtherlinkSignerAddress(); if (!tezosReceiverAddress) { - tezosReceiverAddress = await this.getTezosConnectedAddress(); + tezosReceiverAddress = await this.getTezosSignerAddress(); } const tokenPair = await this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPair(token); @@ -273,8 +299,6 @@ export class TokenBridge implements Disposable { loggerProvider.logger.error(getErrorLogMessage(error)); throw error; } - if (tokenPair.etherlink.type === 'native' || tokenPair.tezos.type === 'native') - throw new Error('Withdrawal of native tokens is not supported yet'); const accountTokenBalance = await this.bridgeComponents.balancesBridgeDataProvider.getBalance(etherlinkSourceAddress, token); if (amount > accountTokenBalance.balance) { const error = new InsufficientBalanceError(token, etherlinkSourceAddress, accountTokenBalance.balance, amount); @@ -283,33 +307,35 @@ export class TokenBridge implements Disposable { } loggerProvider.logger.log(`The ${etherlinkSourceAddress} has enough tokens to withdraw ${amount}`); - const tezosTicketerAddress = tokenPair.tezos.ticketerContractAddress; - const etherlinkTokenProxyContractAddress = tokenPair.etherlink.address; - const tezosProxyAddress = tezosTicketerAddress; - - const [etherlinkConnectedAddress, tezosTicketerContent] = await Promise.all([ - this.getEtherlinkConnectedAddress(), - this.getTezosTicketerContent(tezosTicketerAddress) - ]); - - const withdrawalTransactionReceipt = await this.bridgeComponents.etherlink.withdraw({ - tezosReceiverAddress, - amount, - tezosTicketerContent, - etherlinkSenderAddress: etherlinkConnectedAddress, - etherlinkTokenProxyContractAddress, - tezosProxyAddress, - tezosTicketerAddress - }); - const bridgeTokenWithdrawal: StartWithdrawResult['tokenTransfer'] = { + let operationResult: Awaited>['operationResult']; + if (tokenPair.tezos.type === 'native') { + operationResult = (await this.bridgeComponents.etherlinkBridgeBlockchainService.withdrawNativeToken({ + amount, + tezosReceiverAddress, + }) as Awaited>['operationResult']); + } + else { + const tezosTicketerAddress = tokenPair.tezos.ticketerContractAddress; + const tezosTicketerContent = await this.bridgeComponents.tezosBridgeBlockchainService.getTezosTicketerContent(tezosTicketerAddress); + + operationResult = (await this.bridgeComponents.etherlinkBridgeBlockchainService.withdrawNonNativeToken({ + amount, + tezosReceiverAddress, + tezosTicketerAddress, + tezosTicketerContent, + token: token as NonNativeEtherlinkToken + }) as Awaited>['operationResult']); + } + + const bridgeTokenWithdrawal: PendingBridgeTokenWithdrawal = { kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Pending, - source: etherlinkUtils.toChecksumAddress(withdrawalTransactionReceipt.from), + source: etherlinkSourceAddress, receiver: tezosReceiverAddress, etherlinkOperation: { - hash: withdrawalTransactionReceipt.transactionHash.toString(), - timestamp: Date.now().toString(), + hash: operationResult.hash, amount, + timestamp: operationResult.timestamp, token, } }; @@ -318,36 +344,36 @@ export class TokenBridge implements Disposable { return { tokenTransfer: bridgeTokenWithdrawal, - startWithdrawOperation: withdrawalTransactionReceipt + operationResult }; } - async finishWithdraw(sealedBridgeTokenWithdrawal: SealedBridgeTokenWithdrawal): Promise { + async finishWithdraw( + sealedBridgeTokenWithdrawal: SealedBridgeTokenWithdrawal + ): Promise> { this.ensureIsNotDisposed(); - const finishWithdrawOperation = await this.bridgeComponents.tezos.finishWithdraw( - sealedBridgeTokenWithdrawal.rollupData.commitment, - sealedBridgeTokenWithdrawal.rollupData.proof - ); + + const operationResult = await this.bridgeComponents.tezosBridgeBlockchainService.finishWithdraw({ + cementedCommitment: sealedBridgeTokenWithdrawal.rollupData.commitment, + outputProof: sealedBridgeTokenWithdrawal.rollupData.proof + }); return { tokenTransfer: sealedBridgeTokenWithdrawal, - finishWithdrawOperation - }; + operationResult + } as FinishWithdrawResult; } - async getTezosConnectedAddress(): Promise { + async getTezosSignerAddress(): Promise { this.ensureIsNotDisposed(); - return this.tezosToolkit.wallet.pkh(); + + return this.bridgeComponents.tezosBridgeBlockchainService.getSignerAddress(); } - async getEtherlinkConnectedAddress(): Promise { + async getEtherlinkSignerAddress(): Promise { this.ensureIsNotDisposed(); - const accounts = await this.etherlinkToolkit.eth.getAccounts(); - const address = accounts[0] || this.etherlinkToolkit.eth.defaultAccount; - if (!address) - throw new Error('Address is unavailable'); - return address; + return this.bridgeComponents.etherlinkBridgeBlockchainService.getSignerAddress(); } [Symbol.dispose](): void { @@ -559,92 +585,6 @@ export class TokenBridge implements Disposable { throw new TokenBridgeDisposed(); } - private async depositUsingWalletApi( - token: TezosToken, - amount: bigint, - etherlinkReceiverAddress: string, - options: WalletDepositOptions | undefined | null, - ticketHelperOrNativeTokenTicketerContractAddress: string - ): Promise { - const isNativeToken = token.type === 'native'; - - loggerProvider.logger.log('Creating the deposit operation using Wallet API...'); - const [depositOperation, sourceAddress] = await Promise.all([ - isNativeToken - ? this.bridgeComponents.tezos.wallet.depositNativeToken({ - amount, - etherlinkReceiverAddress, - ticketHelperContractAddress: ticketHelperOrNativeTokenTicketerContractAddress, - }) - : this.bridgeComponents.tezos.wallet.depositNonNativeToken({ - token, - amount, - etherlinkReceiverAddress, - ticketHelperContractAddress: ticketHelperOrNativeTokenTicketerContractAddress - }), - this.getTezosConnectedAddress() - ]); - loggerProvider.logger.log('The deposit operation has been created:', depositOperation.opHash); - - return { - tokenTransfer: { - kind: BridgeTokenTransferKind.Deposit, - status: BridgeTokenTransferStatus.Pending, - source: sourceAddress, - receiver: etherlinkReceiverAddress, - tezosOperation: { - hash: depositOperation.opHash, - timestamp: new Date().toISOString(), - amount, - token, - } - }, - depositOperation - }; - } - - private async depositUsingContractApi( - token: TezosToken, - amount: bigint, - etherlinkReceiverAddress: string, - options: DepositOptions | undefined | null, - ticketHelperOrNativeTokenTicketerContractAddress: string - ): Promise { - const isNativeToken = token.type === 'native'; - - loggerProvider.logger.log('Creating the deposit operation using Contract API...'); - const depositOperation = await (isNativeToken - ? this.bridgeComponents.tezos.depositNativeToken({ - amount, - etherlinkReceiverAddress, - ticketHelperContractAddress: ticketHelperOrNativeTokenTicketerContractAddress - }) - : this.bridgeComponents.tezos.depositNonNativeToken({ - token, - amount, - etherlinkReceiverAddress, - ticketHelperContractAddress: ticketHelperOrNativeTokenTicketerContractAddress - }) - ); - loggerProvider.logger.log('The deposit operation has been created:', depositOperation.hash); - - return { - tokenTransfer: { - kind: BridgeTokenTransferKind.Deposit, - status: BridgeTokenTransferStatus.Pending, - source: depositOperation.source, - receiver: etherlinkReceiverAddress, - tezosOperation: { - hash: depositOperation.hash, - timestamp: new Date().toISOString(), - amount, - token, - } - }, - depositOperation - }; - } - private ensureLastCreatedTokenTransfersTimerIsStarted() { if (this.lastCreatedTokenTransfersTimerId) return; @@ -661,12 +601,4 @@ export class TokenBridge implements Disposable { TokenBridge.defaultLastCreatedTokenTransfersTimerPeriod ); } - - private async getTezosTicketerContent(tezosTicketerAddress: string): Promise { - const storage = await this.tezosToolkit.contract.getStorage<{ content: any }>(tezosTicketerAddress); - const content = [...Object.values(storage.content)]; - const contentMichelsonData = this.tezosTicketerContentSchema.Encode(content); - - return '0x' + packDataBytes(contentMichelsonData, tezosTicketerContentMichelsonType).bytes.slice(2); - } } diff --git a/src/tokenBridge/tokenBridgeComponents.ts b/src/tokenBridge/tokenBridgeComponents.ts index 1c93bbd..d7db12c 100644 --- a/src/tokenBridge/tokenBridgeComponents.ts +++ b/src/tokenBridge/tokenBridgeComponents.ts @@ -1,10 +1,12 @@ +import { EtherlinkBridgeBlockchainService, TezosBridgeBlockchainService } from '../bridgeBlockchainService'; import type { BalancesBridgeDataProvider, TokensBridgeDataProvider, TransfersBridgeDataProvider } from '../bridgeDataProviders'; -import type { EtherlinkBlockchainBridgeComponent } from '../etherlink'; -import type { TezosBlockchainBridgeComponent } from '../tezos'; -export interface TokenBridgeComponents { - readonly tezos: TezosBlockchainBridgeComponent; - readonly etherlink: EtherlinkBlockchainBridgeComponent; +export interface TokenBridgeComponents< + TTezosBridgeBlockchainService extends TezosBridgeBlockchainService, + TEtherlinkBridgeBlockchainService extends EtherlinkBridgeBlockchainService +> { + readonly tezosBridgeBlockchainService: TTezosBridgeBlockchainService; + readonly etherlinkBridgeBlockchainService: TEtherlinkBridgeBlockchainService; readonly balancesBridgeDataProvider: BalancesBridgeDataProvider; readonly tokensBridgeDataProvider: TokensBridgeDataProvider; readonly transfersBridgeDataProvider: TransfersBridgeDataProvider; diff --git a/src/tokenBridge/tokenBridgeOptions.ts b/src/tokenBridge/tokenBridgeOptions.ts index 86d8a84..4949863 100644 --- a/src/tokenBridge/tokenBridgeOptions.ts +++ b/src/tokenBridge/tokenBridgeOptions.ts @@ -1,35 +1,21 @@ -import type { TezosToolkit } from '@taquito/taquito'; -import type Web3 from 'web3'; - +import type { EtherlinkBridgeBlockchainService, TezosBridgeBlockchainService } from '../bridgeBlockchainService'; import type { TokensBridgeDataProvider, BalancesBridgeDataProvider, TransfersBridgeDataProvider } from '../bridgeDataProviders'; -interface TezosTokenBridgeOptions { - toolkit: TezosToolkit; - bridgeOptions: { - rollupAddress: string; - } -} - -interface EtherlinkTokenBridgeOptions { - toolkit: Web3; - bridgeOptions: { - kernelAddress: string; - withdrawPrecompileAddress: string; - } -} - interface DataProvidersTokenBridgeOptions { tokens: TokensBridgeDataProvider; balances: BalancesBridgeDataProvider; transfers: TransfersBridgeDataProvider } -export interface TokenBridgeOptions { - tezos: TezosTokenBridgeOptions; - etherlink: EtherlinkTokenBridgeOptions; +export interface TokenBridgeOptions< + TTezosBridgeBlockchainService extends TezosBridgeBlockchainService = TezosBridgeBlockchainService, + TEtherlinkBridgeBlockchainService extends EtherlinkBridgeBlockchainService = EtherlinkBridgeBlockchainService +> { + tezosBridgeBlockchainService: TTezosBridgeBlockchainService; + etherlinkBridgeBlockchainService: TEtherlinkBridgeBlockchainService; bridgeDataProviders: DataProvidersTokenBridgeOptions; } diff --git a/src/etherlink/tokens.ts b/src/tokens/etherlinkTokens.ts similarity index 89% rename from src/etherlink/tokens.ts rename to src/tokens/etherlinkTokens.ts index 7afaec5..16d2c18 100644 --- a/src/etherlink/tokens.ts +++ b/src/tokens/etherlinkTokens.ts @@ -1,4 +1,4 @@ -import type { Token } from '../common'; +import type { Token } from './token'; export interface NativeEtherlinkToken extends Token { readonly type: 'native'; diff --git a/src/tokens/index.ts b/src/tokens/index.ts new file mode 100644 index 0000000..7cc20c9 --- /dev/null +++ b/src/tokens/index.ts @@ -0,0 +1,3 @@ +export type { Token } from './token'; +export type { TezosToken, NativeTezosToken, NonNativeTezosToken, FA12TezosToken, FA2TezosToken } from './tezosTokens'; +export type { EtherlinkToken, NativeEtherlinkToken, NonNativeEtherlinkToken, ERC20EtherlinkToken } from './etherlinkTokens'; diff --git a/src/tezos/tokens.ts b/src/tokens/tezosTokens.ts similarity index 91% rename from src/tezos/tokens.ts rename to src/tokens/tezosTokens.ts index f976f29..4541f6f 100644 --- a/src/tezos/tokens.ts +++ b/src/tokens/tezosTokens.ts @@ -1,4 +1,4 @@ -import type { Token } from '../common'; +import type { Token } from './token'; export interface NativeTezosToken extends Token { readonly type: 'native'; diff --git a/src/common/token.ts b/src/tokens/token.ts similarity index 100% rename from src/common/token.ts rename to src/tokens/token.ts diff --git a/src/utils/tokenUtils.ts b/src/utils/tokenUtils.ts index 3fc0473..49b5f16 100644 --- a/src/utils/tokenUtils.ts +++ b/src/utils/tokenUtils.ts @@ -1,7 +1,5 @@ import { isReadonlyArray } from './guards'; -import type { Token } from '../common'; -import type { EtherlinkToken } from '../etherlink'; -import type { TezosToken } from '../tezos'; +import type { Token, TezosToken, EtherlinkToken } from '../tokens'; export const isTezosToken = (token: Token): token is TezosToken => { return token.type === 'native' || token.type === 'fa1.2' || token.type === 'fa2'; From 35caf00ac4e47fe68fb21782e87b25a3630abb53 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Thu, 29 Feb 2024 21:38:35 +0300 Subject: [PATCH 03/20] Make all peerDependencies as optional --- package-lock.json | 7 +++++++ package.json | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/package-lock.json b/package-lock.json index b9a0fb6..2643bba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "@baking-bad/tezos-etherlink-bridge-sdk", "version": "0.1.1", + "hasInstallScript": true, "license": "MIT", "devDependencies": { "@taquito/signer": "^19.0.1", @@ -34,6 +35,12 @@ "ws": "^8.16.0" }, "peerDependenciesMeta": { + "@taquito/taquito": { + "optional": true + }, + "web3": { + "optional": true + }, "ws": { "optional": true } diff --git a/package.json b/package.json index a29dfb5..396b63d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,12 @@ "ws": "^8.16.0" }, "peerDependenciesMeta": { + "@taquito/taquito": { + "optional": true + }, + "web3": { + "optional": true + }, "ws": { "optional": true } From 8ee7c7839c06bfd45e64f74443fabc1ec4926297 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 4 Mar 2024 13:35:06 +0300 Subject: [PATCH 04/20] Add direct dependencies on blockchain utils --- package-lock.json | 204 +++++++----------- package.json | 9 +- ....1.patch => @taquito+taquito+19.0.2.patch} | 26 +-- src/utils/etherlinkUtils.ts | 4 +- 4 files changed, 96 insertions(+), 147 deletions(-) rename patches/{@taquito+taquito+19.0.1.patch => @taquito+taquito+19.0.2.patch} (99%) diff --git a/package-lock.json b/package-lock.json index 2643bba..5f6917e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,14 @@ "version": "0.1.1", "hasInstallScript": true, "license": "MIT", + "dependencies": { + "@taquito/utils": "^19.0.2", + "web3-utils": "^4.2.0", + "web3-validator": "^2.0.4" + }, "devDependencies": { - "@taquito/signer": "^19.0.1", - "@taquito/taquito": "^19.0.1", + "@taquito/signer": "^19.0.2", + "@taquito/taquito": "^19.0.2", "@types/jest": "^29.5.11", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", @@ -1674,7 +1679,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", - "dev": true, "dependencies": { "@noble/hashes": "1.3.3" }, @@ -1686,7 +1690,6 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", - "dev": true, "engines": { "node": ">= 16" }, @@ -1733,7 +1736,6 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", - "dev": true, "funding": { "url": "https://paulmillr.com/funding/" } @@ -1742,7 +1744,6 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz", "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==", - "dev": true, "dependencies": { "@noble/curves": "~1.3.0", "@noble/hashes": "~1.3.2", @@ -1756,7 +1757,6 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz", "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==", - "dev": true, "dependencies": { "@noble/hashes": "~1.3.2", "@scure/base": "~1.1.4" @@ -1793,7 +1793,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", - "dev": true, "dependencies": { "@stablelib/int": "^1.0.1" } @@ -1802,7 +1801,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/blake2b/-/blake2b-1.0.1.tgz", "integrity": "sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA==", - "dev": true, "dependencies": { "@stablelib/binary": "^1.0.1", "@stablelib/hash": "^1.0.1", @@ -1825,7 +1823,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", - "dev": true, "dependencies": { "@stablelib/random": "^1.0.2", "@stablelib/sha512": "^1.0.1", @@ -1835,8 +1832,7 @@ "node_modules/@stablelib/hash": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", - "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==", - "dev": true + "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==" }, "node_modules/@stablelib/hmac": { "version": "1.0.1", @@ -1852,8 +1848,7 @@ "node_modules/@stablelib/int": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", - "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==", - "dev": true + "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" }, "node_modules/@stablelib/keyagreement": { "version": "1.0.1", @@ -1903,7 +1898,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", - "dev": true, "dependencies": { "@stablelib/binary": "^1.0.1", "@stablelib/wipe": "^1.0.1" @@ -1924,7 +1918,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", - "dev": true, "dependencies": { "@stablelib/binary": "^1.0.1", "@stablelib/hash": "^1.0.1", @@ -1934,8 +1927,7 @@ "node_modules/@stablelib/wipe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", - "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==", - "dev": true + "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" }, "node_modules/@stablelib/x25519": { "version": "1.0.3", @@ -1960,10 +1952,9 @@ } }, "node_modules/@taquito/core": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/core/-/core-19.0.1.tgz", - "integrity": "sha512-uYtp5fiJDZ5GCbNyyTA50aBJykJtvrViVFGECT6KR/MUYJ+EXQRKgCql+yGLhRo8yyHIa8T5zFiBZR8l82nEsA==", - "dev": true, + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/core/-/core-19.0.2.tgz", + "integrity": "sha512-SJiFqUkB2KnlZO6B7+70T13jlzmVM43qg6bOvV9jYT3bed3Up/OsydkLGbLnL5/Chxqt8y4PYQY8QL8wpQTO0Q==", "dependencies": { "json-stringify-safe": "^5.0.1" }, @@ -1972,12 +1963,12 @@ } }, "node_modules/@taquito/http-utils": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-19.0.1.tgz", - "integrity": "sha512-O5kWpXmcjEpf3vvmWdqjvdlNQe8Ar44dC+xLuWpwtsHTAhXgfxhq/ugjeBvBE3ryjnVgCmNrqovx6cUCejSjyg==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-19.0.2.tgz", + "integrity": "sha512-JhUM0Qop6T6VJkX5TBS+fOpj44oVkuRU0rOfQknsA9NBfIRuR1EbGaSXPno45oe2yrM3eSfMLnJ5eVlbaZybLw==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.1", + "@taquito/core": "^19.0.2", "node-fetch": "^2.7.0" }, "engines": { @@ -1985,13 +1976,13 @@ } }, "node_modules/@taquito/local-forging": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-19.0.1.tgz", - "integrity": "sha512-r10ZD+cgXbjdxU+k6Y3GYJ/GjkDW1FTWs+SJlA98plRsr4CsLZxf21ZyUWM/LcRbpMETJz4aXLTHxUN8oPj8jA==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-19.0.2.tgz", + "integrity": "sha512-Sjrw9xShRYaCrAkbDolpvGhAhpSM9kanVFrGjl2RKxIIQRRBNIvUHniyPNKqGgGt88dUJWFkcCrJL6CNBw/kSw==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.1", - "@taquito/utils": "^19.0.1", + "@taquito/core": "^19.0.2", + "@taquito/utils": "^19.0.2", "bignumber.js": "^9.1.2" }, "engines": { @@ -1999,26 +1990,26 @@ } }, "node_modules/@taquito/michel-codec": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-19.0.1.tgz", - "integrity": "sha512-LwYq9gExJB0fEdEMBHg0yWsaunaUTmv1ZLXY4hbyQO8Yz0B9SGgLTeuKOxWpgYrTefQuZ9OYZ4ZZ5RqbbVhj8g==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-19.0.2.tgz", + "integrity": "sha512-x7duslF4krOS44PpP+BWQgwQxUs0i6q/J5OEh4WXZ9SI4gLT0xji+vmU5ohjvoj1Tv9V19OcYatSPMD0M5V4SQ==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.1" + "@taquito/core": "^19.0.2" }, "engines": { "node": ">=18" } }, "node_modules/@taquito/michelson-encoder": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-19.0.1.tgz", - "integrity": "sha512-z7BPPJyVgaY4H9EmoIeVPpH43NGT6NiKvBEWDsYMgqnOsdpT3VTmINKjpSK7OdPNG4TnEOKyW1MEkaHKKy5RRQ==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-19.0.2.tgz", + "integrity": "sha512-Ctwu1pPi1fTdXvS0G3lq6R2sldOYUesDr8LlUJQ09ks6odHYuwz28DQgka+S0XH5yxNs03T1DP5cyjM+l/NwqQ==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.1", - "@taquito/rpc": "^19.0.1", - "@taquito/utils": "^19.0.1", + "@taquito/core": "^19.0.2", + "@taquito/rpc": "^19.0.2", + "@taquito/utils": "^19.0.2", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -2027,14 +2018,14 @@ } }, "node_modules/@taquito/rpc": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-19.0.1.tgz", - "integrity": "sha512-wpxxHP/Xx/QJJlT391Vz2KNWCrJOtI7ZWZJdo9C2oAr2gH53OThUcTxnh60drC8Zod7nuUlDTsEIxxUjTfExgA==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-19.0.2.tgz", + "integrity": "sha512-Jsued1kqAFU8jKYGDmg+cZ0vQHdDr5wGFWDhlUpFTpuU5yIrkplDu5jnckC64og6VEPaiieiRe9LItpNfUDBvg==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.1", - "@taquito/http-utils": "^19.0.1", - "@taquito/utils": "^19.0.1", + "@taquito/core": "^19.0.2", + "@taquito/http-utils": "^19.0.2", + "@taquito/utils": "^19.0.2", "bignumber.js": "^9.1.2" }, "engines": { @@ -2042,9 +2033,9 @@ } }, "node_modules/@taquito/signer": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-19.0.1.tgz", - "integrity": "sha512-SuO/pZBxFmRvm6aKxlgRJR/l+EhXXfM7BUKKqTVWOmx9gRy8qlbzMkCc+R3a/WaMRqo13wPBVGxLEC+1gEalow==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-19.0.2.tgz", + "integrity": "sha512-qX5CueWC88xL47NeJ/TMaasQNMiojf9cd4jpgPHsqDGW8g/E6qoTdYeeFKG3dexE7ziTx+ZBaFOO2/zVSAF+Rg==", "dev": true, "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -2053,9 +2044,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^19.0.1", - "@taquito/taquito": "^19.0.1", - "@taquito/utils": "^19.0.1", + "@taquito/core": "^19.0.2", + "@taquito/taquito": "^19.0.2", + "@taquito/utils": "^19.0.2", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -2067,19 +2058,19 @@ } }, "node_modules/@taquito/taquito": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-19.0.1.tgz", - "integrity": "sha512-OUhvF7QaqZ3joqTd/SzvGp1PCThZNyh798I2+8VrWZ128oDWWaUxb1jyAhR7AAHrUv5suB6aF3YOwuQcy6tIsg==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-19.0.2.tgz", + "integrity": "sha512-kVwJqnn45VVgu5uFjd4dZKZjdmrSipFZg8N2HE6SGc757pzLhDItQJ8z9cKKZUYlrTe73N3wGij4kr7CZ5r//g==", "dev": true, "hasInstallScript": true, "dependencies": { - "@taquito/core": "^19.0.1", - "@taquito/http-utils": "^19.0.1", - "@taquito/local-forging": "^19.0.1", - "@taquito/michel-codec": "^19.0.1", - "@taquito/michelson-encoder": "^19.0.1", - "@taquito/rpc": "^19.0.1", - "@taquito/utils": "^19.0.1", + "@taquito/core": "^19.0.2", + "@taquito/http-utils": "^19.0.2", + "@taquito/local-forging": "^19.0.2", + "@taquito/michel-codec": "^19.0.2", + "@taquito/michelson-encoder": "^19.0.2", + "@taquito/rpc": "^19.0.2", + "@taquito/utils": "^19.0.2", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -2088,14 +2079,13 @@ } }, "node_modules/@taquito/utils": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-19.0.1.tgz", - "integrity": "sha512-1mld2MXbJfbG/+QLFV6tlJ5gPzHNBsM2yMXWYE9CapbpwoBg4dqMJMjmYeqyvPKRjyf+Vy579r7qi/5yBExKkQ==", - "dev": true, + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-19.0.2.tgz", + "integrity": "sha512-p8GHJuny8l9Wa7KQY62wiTroLNtcLZxvGKvIKIODiV/LuLlCexnqfDdT3AsK4aiy/MjKew24JBe++REXXowAug==", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.0.1", + "@taquito/core": "^19.0.2", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", @@ -2162,7 +2152,6 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/@types/bs58check/-/bs58check-2.1.2.tgz", "integrity": "sha512-xpXaQlOIY1KoXlA/ytHGHpEIU87PJt+g9SH7nC6HdCgaBwT2IEZIwBMHbjuX6BpnfbiUMlmwqurdLDwXpcdmSA==", - "dev": true, "dependencies": { "@types/node": "*" } @@ -2226,7 +2215,6 @@ "version": "20.11.10", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", - "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -2721,7 +2709,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -2854,14 +2841,12 @@ "node_modules/base-x": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", - "dev": true + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, "funding": [ { "type": "github", @@ -2881,7 +2866,6 @@ "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", - "dev": true, "engines": { "node": "*" } @@ -2898,14 +2882,12 @@ "node_modules/blakejs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", - "dev": true + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" }, "node_modules/bn.js": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, "node_modules/brace-expansion": { "version": "2.0.1", @@ -2931,8 +2913,7 @@ "node_modules/brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "dev": true + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" }, "node_modules/browserslist": { "version": "4.22.3", @@ -2982,7 +2963,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "dev": true, "dependencies": { "base-x": "^4.0.0" } @@ -2991,7 +2971,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz", "integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==", - "dev": true, "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^5.0.0" @@ -3010,7 +2989,6 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, "funding": [ { "type": "github", @@ -3040,7 +3018,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", - "dev": true, "dependencies": { "function-bind": "^1.1.2", "get-intrinsic": "^1.2.1", @@ -3337,7 +3314,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", - "dev": true, "dependencies": { "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", @@ -3428,7 +3404,6 @@ "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -3928,7 +3903,6 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz", "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==", - "dev": true, "dependencies": { "@noble/curves": "1.3.0", "@noble/hashes": "1.3.3", @@ -4121,7 +4095,6 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, "dependencies": { "is-callable": "^1.1.3" } @@ -4165,7 +4138,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -4219,7 +4191,6 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", - "dev": true, "dependencies": { "function-bind": "^1.1.2", "has-proto": "^1.0.1", @@ -4375,7 +4346,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -4417,7 +4387,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", - "dev": true, "dependencies": { "get-intrinsic": "^1.2.2" }, @@ -4429,7 +4398,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -4441,7 +4409,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -4453,7 +4420,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -4482,7 +4448,6 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -4492,7 +4457,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", - "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -4504,7 +4468,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dev": true, "dependencies": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -4530,7 +4493,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, "funding": [ { "type": "github", @@ -4612,8 +4574,7 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/internal-slot": { "version": "1.0.6", @@ -4633,7 +4594,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -4697,7 +4657,6 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -4778,7 +4737,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -4920,7 +4878,6 @@ "version": "1.1.12", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", - "dev": true, "dependencies": { "which-typed-array": "^1.1.11" }, @@ -5672,8 +5629,7 @@ "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", - "dev": true + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, "node_modules/json5": { "version": "2.2.3", @@ -5880,14 +5836,12 @@ "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, "node_modules/minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "dev": true + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, "node_modules/minimatch": { "version": "9.0.3", @@ -6749,7 +6703,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", - "dev": true, "dependencies": { "define-data-property": "^1.1.1", "function-bind": "^1.1.2", @@ -7326,7 +7279,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==", - "dev": true, "funding": [ { "type": "github", @@ -7373,8 +7325,7 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/universalify": { "version": "2.0.1", @@ -7428,7 +7379,6 @@ "version": "0.12.5", "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", @@ -7521,7 +7471,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/web3-errors/-/web3-errors-1.1.4.tgz", "integrity": "sha512-WahtszSqILez+83AxGecVroyZsMuuRT+KmQp4Si5P4Rnqbczno1k748PCrZTS1J4UCPmXMG2/Vt+0Bz2zwXkwQ==", - "dev": true, "dependencies": { "web3-types": "^1.3.1" }, @@ -7745,24 +7694,22 @@ } }, "node_modules/web3-types": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.3.1.tgz", - "integrity": "sha512-8fXi7h/t95VKRtgU4sxprLPZpsTh3jYDfSghshIDBgUD/OoGe5S+syP24SUzBZYllZ/L+hMr2gdp/0bGJa8pYQ==", - "dev": true, + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/web3-types/-/web3-types-1.4.0.tgz", + "integrity": "sha512-QnGDNredYqtZ49YD1pIPhsQTJJTOnYPCOnvrUs4/3XzeQLuDM+bAJ8fZ6U2nGEV77h81z2Ins6RE/f40yltvww==", "engines": { "node": ">=14", "npm": ">=6.12.0" } }, "node_modules/web3-utils": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.1.1.tgz", - "integrity": "sha512-5AOmLKH6QuwHunLCNdVFlPSDE+T88bJYRQP+HWYoKNbI4STALCYQiJvj7LXE+Ed6cPfqANaK/LwKNbMPLCPFwA==", - "dev": true, + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-4.2.0.tgz", + "integrity": "sha512-UE7tmqPnC6sD0kpHhZiO9Zu8q7hiBItCQhnmxoMxk8OI91qlBWw6L7w1VNZo7TMBWH1Qe4R5l8h2vaoQCizVyA==", "dependencies": { "ethereum-cryptography": "^2.0.0", "web3-errors": "^1.1.4", - "web3-types": "^1.3.1", + "web3-types": "^1.4.0", "web3-validator": "^2.0.4" }, "engines": { @@ -7774,7 +7721,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/web3-validator/-/web3-validator-2.0.4.tgz", "integrity": "sha512-qRxVePwdW+SByOmTpDZFWHIUAa7PswvxNszrOua6BoGqAhERo5oJZBN+EbWtK/+O+ApNxt5FR3nCPmiZldiOQA==", - "dev": true, "dependencies": { "ethereum-cryptography": "^2.0.0", "util": "^0.12.5", @@ -7838,7 +7784,6 @@ "version": "1.1.13", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", - "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.4", @@ -7977,7 +7922,6 @@ "version": "3.22.4", "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", - "dev": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index 396b63d..8760e7b 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,11 @@ "types": "./dist/types/index.d.ts", "default": "./dist/node/index.js" }, + "dependencies": { + "@taquito/utils": "^19.0.2", + "web3-utils": "^4.2.0", + "web3-validator": "^2.0.4" + }, "peerDependencies": { "@taquito/taquito": ">=19.0.0", "web3": "^4.4.0", @@ -46,8 +51,8 @@ } }, "devDependencies": { - "@taquito/signer": "^19.0.1", - "@taquito/taquito": "^19.0.1", + "@taquito/signer": "^19.0.2", + "@taquito/taquito": "^19.0.2", "@types/jest": "^29.5.11", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", diff --git a/patches/@taquito+taquito+19.0.1.patch b/patches/@taquito+taquito+19.0.2.patch similarity index 99% rename from patches/@taquito+taquito+19.0.1.patch rename to patches/@taquito+taquito+19.0.2.patch index cd1e7d3..ba97fdb 100644 --- a/patches/@taquito+taquito+19.0.1.patch +++ b/patches/@taquito+taquito+19.0.2.patch @@ -286,10 +286,10 @@ index 38c4253..1a3c91c 100644 exports.VERSION = void 0; // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! exports.VERSION = { -- "commitHash": "fc66aa741c240cb367082d1294ef915654c341a6", -- "version": "19.0.1" -+ commitHash: 'fc66aa741c240cb367082d1294ef915654c341a6', -+ version: '19.0.1', +- "commitHash": "13a12ab7cf442043526745db2bbf4ef3b089c34a", +- "version": "19.0.2" ++ commitHash: '13a12ab7cf442043526745db2bbf4ef3b089c34a', ++ version: '19.0.2', }; diff --git a/node_modules/@taquito/taquito/dist/taquito.es6.js b/node_modules/@taquito/taquito/dist/taquito.es6.js index 9f474b4..81603f5 100644 @@ -532,10 +532,10 @@ index 9f474b4..81603f5 100644 // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! const VERSION = { -- "commitHash": "fc66aa741c240cb367082d1294ef915654c341a6", -- "version": "19.0.1" -+ commitHash: 'fc66aa741c240cb367082d1294ef915654c341a6', -+ version: '19.0.1', +- "commitHash": "13a12ab7cf442043526745db2bbf4ef3b089c34a", +- "version": "19.0.2" ++ commitHash: '13a12ab7cf442043526745db2bbf4ef3b089c34a', ++ version: '19.0.2', }; /** @@ -562,7 +562,7 @@ index e11f979..0000000 +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see taquito.min.js.LICENSE.txt */ --!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.taquito=t():e.taquito=t()}(self,(()=>(()=>{var e={3525:(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function i(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){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 a(e,t){i(e);const r=t.outputLen;if(e.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r(3525),i=r(64);class o extends i.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:r,blockLen:o}=this,s=(e=(0,i.toBytes)(e)).length;for(let n=0;no-a&&(this.process(r,0),a=0);for(let e=a;e>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const c=(0,i.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},6053:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r(9350),i=r(64),o=(e,t,r)=>e&t^e&r^t&r,s=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;c[e]=o+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:u,E:l,F:f,G:d,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,i.rotr)(l,6)^(0,i.rotr)(l,11)^(0,i.rotr)(l,25))+((p=l)&f^~p&d)+s[e]+c[e]|0,b=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+o(r,n,a)|0;h=d,d=f,f=l,l=u+t|0,u=a,a=n,n=r,r=t+b|0}var p;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,f=f+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,n,a,u,l,f,d,h)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends u{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}}t.sha256=(0,i.wrapConstructor)((()=>new u)),t.sha224=(0,i.wrapConstructor)((()=>new l))},64:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r(825);t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){if(!i(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=s._0&&e<=s._9?e-s._0:e>=s._A&&e<=s._F?e-(s._A-10):e>=s._a&&e<=s._f?e-(s._a-10):void 0}t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t{},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let o=0;o=0&&ee().update(u(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(u(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(u(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},9437:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5457);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e/4294967296>>>0,t,r),l(e>>>0,t,r+4),t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),f(e>>>0,t,r),f(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=f,t.writeInt32LE=f,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=h,t.writeInt64LE=h,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";var n=r(9437),i=r(2887);t.cn=128,t.k=64,t.Cv=64,t.fg=16,t.fe=16,t.zS=Math.pow(2,32)-1,t.d=255,t.lV=255;var o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),s=[[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6],[22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8],[14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16],[18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26],[4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18],[24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22],[26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20],[12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10],[20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0],[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6]],a=function(){function e(e,r){if(void 0===e&&(e=64),this.digestLength=e,this.blockSize=t.cn,this._state=new Int32Array(o),this._buffer=new Uint8Array(t.cn),this._bufferLength=0,this._ctr=new Uint32Array(4),this._flag=new Uint32Array(4),this._lastNode=!1,this._finished=!1,this._vtmp=new Uint32Array(32),this._mtmp=new Uint32Array(32),e<1||e>t.k)throw new Error("blake2b: wrong digest length");r&&this.validateConfig(r);var i=0;r&&r.key&&(i=r.key.length);var s=1,a=1;r&&r.tree&&(s=r.tree.fanout,a=r.tree.maxDepth),this._state[0]^=e|i<<8|s<<16|a<<24,r&&r.tree&&(this._state[1]^=r.tree.leafSize,this._state[2]^=r.tree.nodeOffsetLowBits,this._state[3]^=r.tree.nodeOffsetHighBits,this._state[4]^=r.tree.nodeDepth|r.tree.innerDigestLength<<8,this._lastNode=r.tree.lastNode),r&&r.salt&&(this._state[8]^=n.readUint32LE(r.salt,0),this._state[9]^=n.readUint32LE(r.salt,4),this._state[10]^=n.readUint32LE(r.salt,8),this._state[11]^=n.readUint32LE(r.salt,12)),r&&r.personalization&&(this._state[12]^=n.readUint32LE(r.personalization,0),this._state[13]^=n.readUint32LE(r.personalization,4),this._state[14]^=n.readUint32LE(r.personalization,8),this._state[15]^=n.readUint32LE(r.personalization,12)),this._initialState=new Uint32Array(this._state),r&&r.key&&i>0&&(this._paddedKey=new Uint8Array(t.cn),this._paddedKey.set(r.key),this._buffer.set(this._paddedKey),this._bufferLength=t.cn)}return e.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=t.cn):this._bufferLength=0,i.wipe(this._ctr),i.wipe(this._flag),this._finished=!1,this},e.prototype.validateConfig=function(e){if(e.key&&e.key.length>t.Cv)throw new Error("blake2b: wrong key length");if(e.salt&&e.salt.length!==t.fe)throw new Error("blake2b: wrong salt length");if(e.personalization&&e.personalization.length!==t.fg)throw new Error("blake2b: wrong personalization length");if(e.tree){if(e.tree.fanout<0||e.tree.fanout>t.d)throw new Error("blake2b: wrong tree fanout");if(e.tree.maxDepth<0||e.tree.maxDepth>t.lV)throw new Error("blake2b: wrong tree depth");if(e.tree.leafSize<0||e.tree.leafSize>t.zS)throw new Error("blake2b: wrong leaf size");if(e.tree.innerDigestLength<0||e.tree.innerDigestLength>t.k)throw new Error("blake2b: wrong tree inner digest length")}},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var n=t.cn-this._bufferLength,i=0;if(0===r)return this;if(r>n){for(var o=0;ot.cn;){for(o=0;o>>16,O=65535&p,A=p>>>16;E+=b>>>16,O+=65535&m,A+=m>>>16,O+=(E+=(w+=65535&b)>>>16)>>>16,w=65535&(h=65535&w|E<<16),E=h>>>16,O=65535&(p=65535&O|(A+=O>>>16)<<16),A=p>>>16,E+=u>>>16,O+=65535&l,A+=l>>>16,h=65535&(w+=65535&u)|(E+=w>>>16)<<16,w=_^=p=65535&(O+=E>>>16)|(A+=O>>>16)<<16,_=y^=h,y=w,w=65535&g,E=g>>>16,O=65535&v,A=v>>>16,E+=y>>>16,O+=65535&_,A+=_>>>16,w=(b^=g=65535&(w+=65535&y)|(E+=w>>>16)<<16)<<8|(m^=v=65535&(O+=E>>>16)|(A+=O>>>16)<<16)>>>24,b=m<<8|b>>>24,m=w,w=65535&h,E=h>>>16,O=65535&p,A=p>>>16,E+=b>>>16,O+=65535&m,A+=m>>>16,O+=(E+=(w+=65535&b)>>>16)>>>16,w=65535&(h=65535&w|E<<16),E=h>>>16,O=65535&(p=65535&O|(A+=O>>>16)<<16),A=p>>>16,E+=f>>>16,O+=65535&d,A+=d>>>16,w=(y^=h=65535&(w+=65535&f)|(E+=w>>>16)<<16)<<16|(_^=p=65535&(O+=E>>>16)|(A+=O>>>16)<<16)>>>16,y=_<<16|y>>>16,_=w,w=65535&g,E=g>>>16,O=65535&v,A=v>>>16,E+=y>>>16,O+=65535&_,A+=_>>>16,w=(m^=v=65535&(O+=(E+=(w+=65535&y)>>>16)>>>16)|(A+=O>>>16)<<16)<<1|(b^=g=65535&w|E<<16)>>>31,b=b<<1|m>>>31,m=w,e[t]=h,e[o]=p,e[r]=b,e[s]=m,e[n]=g,e[a]=v,e[i]=y,e[c]=_},e.prototype._incrementCounter=function(e){for(var t=0;t<3;t++){var r=this._ctr[t]+e;if(this._ctr[t]=r>>>0,this._ctr[t]===r)return;e=1}},e.prototype._processBlock=function(e){this._incrementCounter(e);var t=this._vtmp;t.set(this._state),t.set(o,16),t[24]^=this._ctr[0],t[25]^=this._ctr[1],t[26]^=this._ctr[2],t[27]^=this._ctr[3],t[28]^=this._flag[0],t[29]^=this._flag[1],t[30]^=this._flag[2],t[31]^=this._flag[3];for(var r=this._mtmp,i=0;i<32;i++)r[i]=n.readUint32LE(this._buffer,4*i);for(var a=0;a<12;a++)this._G(t,0,8,16,24,1,9,17,25,r[s[a][0]],r[s[a][0]+1],r[s[a][1]],r[s[a][1]+1]),this._G(t,2,10,18,26,3,11,19,27,r[s[a][2]],r[s[a][2]+1],r[s[a][3]],r[s[a][3]+1]),this._G(t,4,12,20,28,5,13,21,29,r[s[a][4]],r[s[a][4]+1],r[s[a][5]],r[s[a][5]+1]),this._G(t,6,14,22,30,7,15,23,31,r[s[a][6]],r[s[a][6]+1],r[s[a][7]],r[s[a][7]+1]),this._G(t,0,10,20,30,1,11,21,31,r[s[a][8]],r[s[a][8]+1],r[s[a][9]],r[s[a][9]+1]),this._G(t,2,12,22,24,3,13,23,25,r[s[a][10]],r[s[a][10]+1],r[s[a][11]],r[s[a][11]+1]),this._G(t,4,14,16,26,5,15,17,27,r[s[a][12]],r[s[a][12]+1],r[s[a][13]],r[s[a][13]+1]),this._G(t,6,8,18,28,7,9,19,29,r[s[a][14]],r[s[a][14]+1],r[s[a][15]],r[s[a][15]+1]);for(i=0;i<16;i++)this._state[i]^=t[i]^t[i+16]},e}();t.vp=function(e,r,n){void 0===r&&(r=t.k);var i=new a(r,n);i.update(e);var o=i.digest();return i.clean(),o}},7728:(e,t,r)=>{"use strict";t.T=t.aP=t.KS=t.jQ=void 0;const n=r(1293),i=r(6756),o=r(2887);function s(e){const t=new Float64Array(16);if(e)for(let r=0;r>16&1),r[e-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,m(n,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&n[t],e[2*t+1]=n[t]>>8}function v(e,t){let r=0;for(let n=0;n<32;n++)r|=e[n]^t[n];return(1&r-1>>>8)-1}function y(e,t){const r=new Uint8Array(32),n=new Uint8Array(32);return g(r,e),g(n,t),v(r,n)}function _(e){const t=new Uint8Array(32);return g(t,e),1&t[0]}function w(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function E(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function O(e,t,r){let n,i,o=0,s=0,a=0,c=0,u=0,l=0,f=0,d=0,h=0,p=0,b=0,m=0,g=0,v=0,y=0,_=0,w=0,E=0,O=0,A=0,S=0,P=0,T=0,I=0,R=0,x=0,M=0,k=0,L=0,N=0,C=0,j=r[0],D=r[1],U=r[2],B=r[3],F=r[4],K=r[5],H=r[6],G=r[7],$=r[8],V=r[9],z=r[10],q=r[11],W=r[12],Z=r[13],J=r[14],Y=r[15];n=t[0],o+=n*j,s+=n*D,a+=n*U,c+=n*B,u+=n*F,l+=n*K,f+=n*H,d+=n*G,h+=n*$,p+=n*V,b+=n*z,m+=n*q,g+=n*W,v+=n*Z,y+=n*J,_+=n*Y,n=t[1],s+=n*j,a+=n*D,c+=n*U,u+=n*B,l+=n*F,f+=n*K,d+=n*H,h+=n*G,p+=n*$,b+=n*V,m+=n*z,g+=n*q,v+=n*W,y+=n*Z,_+=n*J,w+=n*Y,n=t[2],a+=n*j,c+=n*D,u+=n*U,l+=n*B,f+=n*F,d+=n*K,h+=n*H,p+=n*G,b+=n*$,m+=n*V,g+=n*z,v+=n*q,y+=n*W,_+=n*Z,w+=n*J,E+=n*Y,n=t[3],c+=n*j,u+=n*D,l+=n*U,f+=n*B,d+=n*F,h+=n*K,p+=n*H,b+=n*G,m+=n*$,g+=n*V,v+=n*z,y+=n*q,_+=n*W,w+=n*Z,E+=n*J,O+=n*Y,n=t[4],u+=n*j,l+=n*D,f+=n*U,d+=n*B,h+=n*F,p+=n*K,b+=n*H,m+=n*G,g+=n*$,v+=n*V,y+=n*z,_+=n*q,w+=n*W,E+=n*Z,O+=n*J,A+=n*Y,n=t[5],l+=n*j,f+=n*D,d+=n*U,h+=n*B,p+=n*F,b+=n*K,m+=n*H,g+=n*G,v+=n*$,y+=n*V,_+=n*z,w+=n*q,E+=n*W,O+=n*Z,A+=n*J,S+=n*Y,n=t[6],f+=n*j,d+=n*D,h+=n*U,p+=n*B,b+=n*F,m+=n*K,g+=n*H,v+=n*G,y+=n*$,_+=n*V,w+=n*z,E+=n*q,O+=n*W,A+=n*Z,S+=n*J,P+=n*Y,n=t[7],d+=n*j,h+=n*D,p+=n*U,b+=n*B,m+=n*F,g+=n*K,v+=n*H,y+=n*G,_+=n*$,w+=n*V,E+=n*z,O+=n*q,A+=n*W,S+=n*Z,P+=n*J,T+=n*Y,n=t[8],h+=n*j,p+=n*D,b+=n*U,m+=n*B,g+=n*F,v+=n*K,y+=n*H,_+=n*G,w+=n*$,E+=n*V,O+=n*z,A+=n*q,S+=n*W,P+=n*Z,T+=n*J,I+=n*Y,n=t[9],p+=n*j,b+=n*D,m+=n*U,g+=n*B,v+=n*F,y+=n*K,_+=n*H,w+=n*G,E+=n*$,O+=n*V,A+=n*z,S+=n*q,P+=n*W,T+=n*Z,I+=n*J,R+=n*Y,n=t[10],b+=n*j,m+=n*D,g+=n*U,v+=n*B,y+=n*F,_+=n*K,w+=n*H,E+=n*G,O+=n*$,A+=n*V,S+=n*z,P+=n*q,T+=n*W,I+=n*Z,R+=n*J,x+=n*Y,n=t[11],m+=n*j,g+=n*D,v+=n*U,y+=n*B,_+=n*F,w+=n*K,E+=n*H,O+=n*G,A+=n*$,S+=n*V,P+=n*z,T+=n*q,I+=n*W,R+=n*Z,x+=n*J,M+=n*Y,n=t[12],g+=n*j,v+=n*D,y+=n*U,_+=n*B,w+=n*F,E+=n*K,O+=n*H,A+=n*G,S+=n*$,P+=n*V,T+=n*z,I+=n*q,R+=n*W,x+=n*Z,M+=n*J,k+=n*Y,n=t[13],v+=n*j,y+=n*D,_+=n*U,w+=n*B,E+=n*F,O+=n*K,A+=n*H,S+=n*G,P+=n*$,T+=n*V,I+=n*z,R+=n*q,x+=n*W,M+=n*Z,k+=n*J,L+=n*Y,n=t[14],y+=n*j,_+=n*D,w+=n*U,E+=n*B,O+=n*F,A+=n*K,S+=n*H,P+=n*G,T+=n*$,I+=n*V,R+=n*z,x+=n*q,M+=n*W,k+=n*Z,L+=n*J,N+=n*Y,n=t[15],_+=n*j,w+=n*D,E+=n*U,O+=n*B,A+=n*F,S+=n*K,P+=n*H,T+=n*G,I+=n*$,R+=n*V,x+=n*z,M+=n*q,k+=n*W,L+=n*Z,N+=n*J,C+=n*Y,o+=38*w,s+=38*E,a+=38*O,c+=38*A,u+=38*S,l+=38*P,f+=38*T,d+=38*I,h+=38*R,p+=38*x,b+=38*M,m+=38*k,g+=38*L,v+=38*N,y+=38*C,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=f,e[7]=d,e[8]=h,e[9]=p,e[10]=b,e[11]=m,e[12]=g,e[13]=v,e[14]=y,e[15]=_}function A(e,t){O(e,t,t)}function S(e,t){const r=s();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)A(r,r),2!==n&&4!==n&&O(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}function P(e,t){const r=s(),n=s(),i=s(),o=s(),a=s(),c=s(),u=s(),f=s(),d=s();E(r,e[1],e[0]),E(d,t[1],t[0]),O(r,r,d),w(n,e[0],e[1]),w(d,t[0],t[1]),O(n,n,d),O(i,e[3],t[3]),O(i,i,l),O(o,e[2],t[2]),w(o,o,o),E(a,n,r),E(c,o,i),w(u,o,i),w(f,n,r),O(e[0],a,c),O(e[1],f,u),O(e[2],u,c),O(e[3],a,f)}function T(e,t,r){for(let n=0;n<4;n++)m(e[n],t[n],r)}function I(e,t){const r=s(),n=s(),i=s();S(i,t[2]),O(r,t[0],i),O(n,t[1],i),g(e,n),e[31]^=_(r)<<7}function R(e,t,r){p(e[0],a),p(e[1],c),p(e[2],c),p(e[3],a);for(let n=255;n>=0;--n){const i=r[n/8|0]>>(7&n)&1;T(e,t,i),P(t,e),P(e,e),T(e,t,i)}}function x(e,t){const r=[s(),s(),s(),s()];p(r[0],f),p(r[1],d),p(r[2],c),O(r[3],f,d),R(e,r,t)}function M(e){if(e.length!==t.aP)throw new Error(`ed25519: seed must be ${t.aP} bytes`);const r=(0,i.hash)(e);r[0]&=248,r[31]&=127,r[31]|=64;const n=new Uint8Array(32),o=[s(),s(),s(),s()];x(o,r),I(n,o);const a=new Uint8Array(64);return a.set(e),a.set(n,32),{publicKey:n,secretKey:a}}const k=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function L(e,t){let r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*k[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*k[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function N(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let t=0;t<64;t++)e[t]=0;L(e,t)}function C(e,t){const r=s(),n=s(),i=s(),o=s(),l=s(),f=s(),d=s();return p(e[2],c),function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),A(i,e[1]),O(o,i,u),E(i,i,e[2]),w(o,e[2],o),A(l,o),A(f,l),O(d,f,l),O(r,d,i),O(r,r,o),function(e,t){const r=s();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=250;n>=0;n--)A(r,r),1!==n&&O(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(r,r),O(r,r,i),O(r,r,o),O(r,r,o),O(e[0],r,o),A(n,e[0]),O(n,n,o),y(n,i)&&O(e[0],e[0],h),A(n,e[0]),O(n,n,o),y(n,i)?-1:(_(e[0])===t[31]>>7&&E(e[0],a,e[0]),O(e[3],e[0],e[1]),0)}t.T=function(e,r,n){const o=new Uint8Array(32),a=[s(),s(),s(),s()],c=[s(),s(),s(),s()];if(n.length!==t.jQ)throw new Error(`ed25519: signature must be ${t.jQ} bytes`);if(C(c,e))return!1;const u=new i.SHA512;u.update(n.subarray(0,32)),u.update(e),u.update(r);const l=u.digest();return N(l),R(a,c,l),x(c,n.subarray(32)),P(a,c),I(o,a),!v(n,o)}},5457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},1293:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(5147),i=r(9437),o=r(2887);function s(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(e=t.defaultRandomSource){const r=s(4,e),n=(0,i.readUint32LE)(r);return(0,o.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r=a,n=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const c=r.length,u=256-256%c;for(;e>0;){const t=s(Math.ceil(256*e/u),n);for(let n=0;n0;n++){const o=t[n];o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(2887);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5477);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(2017),i=r(7879);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},6756:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9437),i=r(2887);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%128<112?128:256;this._buffer[r]=128;for(var c=r+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.stateHi),i.wipe(e.stateLo),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=o;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(e,t,r,i,o,a,c){for(var u,l,f,d,h,p,b,m,g=r[0],v=r[1],y=r[2],_=r[3],w=r[4],E=r[5],O=r[6],A=r[7],S=i[0],P=i[1],T=i[2],I=i[3],R=i[4],x=i[5],M=i[6],k=i[7];c>=128;){for(var L=0;L<16;L++){var N=8*L+a;e[L]=n.readUint32BE(o,N),t[L]=n.readUint32BE(o,N+4)}for(L=0;L<80;L++){var C,j,D=g,U=v,B=y,F=_,K=w,H=E,G=O,$=S,V=P,z=T,q=I,W=R,Z=x,J=M;if(h=65535&(l=k),p=l>>>16,b=65535&(u=A),m=u>>>16,h+=65535&(l=(R>>>14|w<<18)^(R>>>18|w<<14)^(w>>>9|R<<23)),p+=l>>>16,b+=65535&(u=(w>>>14|R<<18)^(w>>>18|R<<14)^(R>>>9|w<<23)),m+=u>>>16,h+=65535&(l=R&x^~R&M),p+=l>>>16,b+=65535&(u=w&E^~w&O),m+=u>>>16,u=s[2*L],h+=65535&(l=s[2*L+1]),p+=l>>>16,b+=65535&u,m+=u>>>16,u=e[L%16],p+=(l=t[L%16])>>>16,b+=65535&u,m+=u>>>16,b+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=d=65535&h|p<<16),p=l>>>16,b=65535&(u=f=65535&b|(m+=b>>>16)<<16),m=u>>>16,h+=65535&(l=(S>>>28|g<<4)^(g>>>2|S<<30)^(g>>>7|S<<25)),p+=l>>>16,b+=65535&(u=(g>>>28|S<<4)^(S>>>2|g<<30)^(S>>>7|g<<25)),m+=u>>>16,p+=(l=S&P^S&T^P&T)>>>16,b+=65535&(u=g&v^g&y^v&y),m+=u>>>16,C=65535&(b+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=b>>>16)<<16,j=65535&h|p<<16,h=65535&(l=q),p=l>>>16,b=65535&(u=F),m=u>>>16,p+=(l=d)>>>16,b+=65535&(u=f),m+=u>>>16,v=D,y=U,_=B,w=F=65535&(b+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=b>>>16)<<16,E=K,O=H,A=G,g=C,P=$,T=V,I=z,R=q=65535&h|p<<16,x=W,M=Z,k=J,S=j,L%16==15)for(N=0;N<16;N++)u=e[N],h=65535&(l=t[N]),p=l>>>16,b=65535&u,m=u>>>16,u=e[(N+9)%16],h+=65535&(l=t[(N+9)%16]),p+=l>>>16,b+=65535&u,m+=u>>>16,f=e[(N+1)%16],h+=65535&(l=((d=t[(N+1)%16])>>>1|f<<31)^(d>>>8|f<<24)^(d>>>7|f<<25)),p+=l>>>16,b+=65535&(u=(f>>>1|d<<31)^(f>>>8|d<<24)^f>>>7),m+=u>>>16,f=e[(N+14)%16],p+=(l=((d=t[(N+14)%16])>>>19|f<<13)^(f>>>29|d<<3)^(d>>>6|f<<26))>>>16,b+=65535&(u=(f>>>19|d<<13)^(d>>>29|f<<3)^f>>>6),m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[N]=65535&b|m<<16,t[N]=65535&h|p<<16}h=65535&(l=S),p=l>>>16,b=65535&(u=g),m=u>>>16,u=r[0],p+=(l=i[0])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[0]=g=65535&b|m<<16,i[0]=S=65535&h|p<<16,h=65535&(l=P),p=l>>>16,b=65535&(u=v),m=u>>>16,u=r[1],p+=(l=i[1])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[1]=v=65535&b|m<<16,i[1]=P=65535&h|p<<16,h=65535&(l=T),p=l>>>16,b=65535&(u=y),m=u>>>16,u=r[2],p+=(l=i[2])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[2]=y=65535&b|m<<16,i[2]=T=65535&h|p<<16,h=65535&(l=I),p=l>>>16,b=65535&(u=_),m=u>>>16,u=r[3],p+=(l=i[3])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[3]=_=65535&b|m<<16,i[3]=I=65535&h|p<<16,h=65535&(l=R),p=l>>>16,b=65535&(u=w),m=u>>>16,u=r[4],p+=(l=i[4])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[4]=w=65535&b|m<<16,i[4]=R=65535&h|p<<16,h=65535&(l=x),p=l>>>16,b=65535&(u=E),m=u>>>16,u=r[5],p+=(l=i[5])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[5]=E=65535&b|m<<16,i[5]=x=65535&h|p<<16,h=65535&(l=M),p=l>>>16,b=65535&(u=O),m=u>>>16,u=r[6],p+=(l=i[6])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[6]=O=65535&b|m<<16,i[6]=M=65535&h|p<<16,h=65535&(l=k),p=l>>>16,b=65535&(u=A),m=u>>>16,u=r[7],p+=(l=i[7])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[7]=A=65535&b|m<<16,i[7]=k=65535&h|p<<16,a+=128,c-=128}return a}t.hash=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},2887:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,u=new Uint8Array(o);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var f=0,d=o-1;(0!==l||f>>0,u[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,r++}for(var h=o-i;h!==o&&0===u[h];)h++;for(var p=new Uint8Array(n+(o-h)),b=n;h!==o;)p[b++]=u[h++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var c=(o-i)*u+1>>>0,l=new Uint8Array(c);i!==o;){for(var f=t[i],d=0,h=c-1;(0!==f||d>>0,l[h]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=d,i++}for(var p=c-n;p!==c&&0===l[p];)p++;for(var b=a.repeat(r);p{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),l=0,f=c>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,u=n-i;au?u:a+s));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},6391:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",f=1e14,d=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,m=1e9;function g(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function _(e,t,r,n){if(er||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return g(e.e/d)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function O(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?g.c=g.e=null:e.e=10;f/=10,u++);return void(u>D?g.c=g.e=null:(g.e=u,g.c=[e]))}m=String(e)}else{if(!s.test(m=String(e)))return i(g,m,p);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(f=m.search(/e/i))>0?(u<0&&(u=f),u+=+m.slice(f+1),m=m.substring(0,f)):u<0&&(u=m.length)}else{if(_(t,2,H.length,"Base"),10==t&&G)return W(g=new $(e),k+g.e+1,L);if(m=String(e),p="number"==typeof e){if(0*e!=0)return i(g,m,p,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,$.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=H.slice(0,t),u=f=0,b=m.length;fu){u=b;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,f=-1,u=0;continue}return i(g,String(e),p,t)}p=!1,(u=(m=n(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(f=0;48===m.charCodeAt(f);f++);for(b=m.length;48===m.charCodeAt(--b););if(m=m.slice(f,++b)){if(b-=f,p&&$.DEBUG&&b>15&&(e>h||e!==c(e)))throw Error(l+g.s*e);if((u=u-f-1)>D)g.c=g.e=null;else if(u=C)?E(c,s):O(c,s,"0");else if(o=(e=W(new $(e),t,r)).e,a=(c=v(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function z(e,t){for(var r,n,i=1,o=new $(e[0]);i=10;i/=10,n++);return(r=n+r*d-1)>D?e.c=e.e=null:r=10;u/=10,i++);if((o=t-i)<0)o+=d,s=t,l=m[h=0],b=c(l/g[i-s-1]%10);else if((h=a((o+1)/d))>=m.length){if(!n)break e;for(;m.length<=h;m.push(0));l=b=0,i=1,s=(o%=d)-d+1}else{for(l=u=m[h],i=1;u>=10;u/=10,i++);b=(s=(o%=d)-d+i)<0?0:c(l/g[i-s-1]%10)}if(n=n||t<0||null!=m[h+1]||(s<0?l:l%g[i-s-1]),n=r<4?(b||n)&&(0==r||r==(e.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?l/g[i-s]:0:m[h-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(d-t%d)%d],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=h,u=1,h--):(m.length=h+1,u=g[d-o],m[h]=s>0?c(l/g[i-s]%g[s])*u:0),n)for(;;){if(0==h){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,m[0]==f&&(m[0]=1));break}if(m[h]+=u,m[h]!=f)break;m[h--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}e.e>D?e.c=e.e=null:e.e=C?E(t,r):O(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,m,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-m,0,t),_(r[1],0,m,t),N=r[0],C=r[1]):(_(r,-m,m,t),N=-(C=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-m,-1,t),_(r[1],1,m,t),j=r[0],D=r[1];else{if(_(r,-m,m,t),!r)throw Error(u+t+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,m,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);G="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,C],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:K,ALPHABET:H}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%d)<1&&(t+=d),String(n[0]).length==t){for(t=0;t=f||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return z(arguments,-1)},$.minimum=$.min=function(){return z(arguments,1)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,l=[],f=new $(M);if(null==e?e=k:_(e,0,m),i=a(e/d),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(l.push(o%1e14),s+=7);s=i/7}if(!U)for(;s=10;o/=10,s++);sr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,f,d,h,p,b,m=n.indexOf("."),g=k,y=L;for(m>=0&&(f=F,F=0,n=n.replace(".",""),h=(b=new $(i)).pow(n.length-m),F=f,b.c=t(O(v(h.c),h.e,"0"),10,o,e),b.e=b.c.length),l=f=(p=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=r(h,b,g,y,o)).c,d=h.r,l=h.e),m=p[u=l+g+1],f=o/2,d=d||u<0||null!=p[u+1],d=y<4?(null!=m||d)&&(0==y||y==(h.s<0?3:2)):m>f||m==f&&(4==y||d||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])n=d?O(c.charAt(1),-g,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(f=p.length;!p[--f];);for(m=0,n="";m<=f;n+=c.charAt(p[m++]));n=O(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%b,l=t/b|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%b)+(n=l*o+(s=e[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,s,a){var u,l,h,p,b,m,v,y,_,w,E,O,A,S,P,T,I,R=n.s==i.s?1:-1,x=n.c,M=i.c;if(!(x&&x[0]&&M&&M[0]))return new $(n.s&&i.s&&(x?!M||x[0]!=M[0]:M)?x&&0==x[0]||!M?0*R:R/0:NaN);for(_=(y=new $(R)).c=[],R=o+(l=n.e-i.e)+1,a||(a=f,l=g(n.e/d)-g(i.e/d),R=R/d|0),h=0;M[h]==(x[h]||0);h++);if(M[h]>(x[h]||0)&&l--,R<0)_.push(1),p=!0;else{for(S=x.length,T=M.length,h=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=e(M,b,a),x=e(x,b,a),T=M.length,S=x.length),A=T,E=(w=x.slice(0,T)).length;E=a/2&&P++;do{if(b=0,(u=t(M,w,T,E))<0){if(O=w[0],T!=E&&(O=O*a+(w[1]||0)),(b=c(O/P))>1)for(b>=a&&(b=a-1),v=(m=e(M,b,a)).length,E=w.length;1==t(m,w,v,E);)b--,r(m,T=10;R/=10,h++);W(y,o+(y.e=h+l*d-1)+1,s,p)}else y.e=l,y.r=+p;return y}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(P,"$1").replace(T,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return y(this,new $(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return _(e,0,m),null==t?t=L:_(t,0,8),W(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-g(this.e/d))*d,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new $(e,t),k,L)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new $(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,i,o,s,l,f,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Z(e));if(null!=t&&(t=new $(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Z(p),s?e.s*(2-w(e)):+Z(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&w(e)?-0:0,p.e>-1&&(o=1/o),new $(l?1/o:o);F&&(o=a(F/d+2))}for(s?(r=new $(.5),l&&(e.s=1),f=w(e)):f=(i=Math.abs(+Z(e)))%2,h=new $(M);;){if(f){if(!(h=h.times(p)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}if(i){if(0===(i=c(i/2)))break;f=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)f=w(e);else{if(0===(i=+Z(e)))break;f=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?h:(l&&(h=M.div(h)),t?h.mod(t):o?W(h,F,L,undefined):h)},x.integerValue=function(e){var t=new $(this);return null==e?e=L:_(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===y(this,new $(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return y(this,new $(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=y(this,new $(e,t)))||0===t},x.isInteger=function(){return!!this.c&&g(this.e/d)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return y(this,new $(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=y(this,new $(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/d,u=e.e/d,l=s.c,h=e.c;if(!c||!u){if(!l||!h)return l?(e.s=-t,e):new $(h?s:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new $(l[0]?s:3==L?-0:0)}if(c=g(c),u=g(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=l.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;l[r++]=0);for(t=f-1;n>a;){if(l[--n]=0;){for(r=0,p=O[i]%_,m=O[i]/_|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%_)+(a=m*u+(l=E[s]/_|0)*p)%_*_+v[o]+r)/y|0)+(a/_|0)+m*l,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(e,v,n)},x.negated=function(){var e=new $(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/d,s=e.e/d,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?e:new $(a[0]?n:0*i)}if(o=g(o),s=g(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/f|0,a[t]=f===a[t]?0:a[t]%f;return i&&(a=[i].concat(a),++s),q(e,a,s)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return _(e,1,m),null==t?t=L:_(t,0,8),W(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*d+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return _(e,-9007199254740991,h),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=k+4,f=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Z(s)))||c==1/0?(((t=v(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=g((u+1)/2)-(u<0||u%2),n=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(s,o,l,1))),v(o.c).slice(0,c)===(t=v(n.c)).slice(0,c)){if(n.e0&&b>0){for(o=b%a||a,f=p.substr(0,o);o0&&(f+=l+p.slice(o)),h&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,s,a,c,l,f,h,b,m,g=this,y=g.c;if(null!=e&&(!(c=new $(e)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!y)return new $(g);for(t=new $(M),f=n=new $(M),i=l=new $(M),m=v(y),s=t.e=m.length-g.e-1,t.c[0]=p[(a=s%d)<0?d+a:a],e=!e||c.comparedTo(t)>0?s>0?t:f:c,a=D,D=1/0,c=new $(m),l.c[0]=0;h=r(c,t,0,1),1!=(o=n.plus(h.times(i))).comparedTo(e);)n=i,i=o,f=l.plus(h.times(o=f)),l=o,t=c.minus(h.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),l=l.plus(o.times(f)),n=n.plus(o.times(i)),l.s=f.s=g.s,b=r(f,i,s*=2,L).minus(g).abs().comparedTo(r(l,n,s,L).minus(g).abs())<1?[f,i]:[l,n],D=a,b},x.toNumber=function(){return+Z(this)},x.toPrecision=function(e,t){return null!=e&&_(e,1,m),V(this,e,t,2)},x.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=N||o>=C?E(v(r.c),o):O(v(r.c),o,"0"):10===e&&G?t=O(v((r=W(new $(r),k+o+1,L)).c),r.e,"0"):(_(e,2,H.length,"Base"),t=n(O(v(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,null!=t&&$.set(t),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},651:(e,t,r)=>{const n=r(7967);function i(e,t,r){const n=e[t]+e[r];let i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function o(e,t,r,n){let i=e[t]+r;r<0&&(i+=4294967296);let o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,s,a){const c=f[s],u=f[s+1],d=f[a],h=f[a+1];i(l,e,t),o(l,e,c,u);let p=l[n]^l[e],b=l[n+1]^l[e+1];l[n]=b,l[n+1]=p,i(l,r,n),p=l[t]^l[r],b=l[t+1]^l[r+1],l[t]=p>>>24^b<<8,l[t+1]=b>>>24^p<<8,i(l,e,t),o(l,e,d,h),p=l[n]^l[e],b=l[n+1]^l[e+1],l[n]=p>>>16^b<<16,l[n+1]=b>>>16^p<<16,i(l,r,n),p=l[t]^l[r],b=l[t+1]^l[r+1],l[t]=b>>>31^p<<1,l[t+1]=p>>>31^b<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),f=new Uint32Array(32);function d(e,t){let r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=c[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)f[r]=s(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,u[16*r+0],u[16*r+1]),a(2,10,18,26,u[16*r+2],u[16*r+3]),a(4,12,20,28,u[16*r+4],u[16*r+5]),a(6,14,22,30,u[16*r+6],u[16*r+7]),a(0,10,20,30,u[16*r+8],u[16*r+9]),a(2,12,22,24,u[16*r+10],u[16*r+11]),a(4,14,16,26,u[16*r+12],u[16*r+13]),a(6,8,18,28,u[16*r+14],u[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^l[r]^l[r+16]}const h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,r,n){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&16!==r.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(n&&16!==n.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};h.fill(0),h[0]=e,t&&(h[1]=t.length),h[2]=1,h[3]=1,r&&h.set(r,32),n&&h.set(n,48);for(let e=0;e<16;e++)i.h[e]=c[e]^s(h,4*e);return t&&(b(i,t),i.c=128),i}function b(e,t){for(let r=0;r>2]>>8*(3&r);return t}function g(e,t,r,i,o){r=r||64,e=n.normalizeInput(e),i&&(i=n.normalizeInput(i)),o&&(o=n.normalizeInput(o));const s=p(r,t,i,o);return b(s,e),m(s)}e.exports={blake2b:g,blake2bHex:function(e,t,r,i,o){const s=g(e,t,r,i,o);return n.toHex(s)},blake2bInit:p,blake2bUpdate:b,blake2bFinal:m}},9962:(e,t,r)=>{const n=r(7967);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,r,n,i,o){u[e]=u[e]+u[t]+i,u[n]=s(u[n]^u[e],16),u[r]=u[r]+u[n],u[t]=s(u[t]^u[r],12),u[e]=u[e]+u[t]+o,u[n]=s(u[n]^u[e],8),u[r]=u[r]+u[n],u[t]=s(u[t]^u[r],7)}function s(e,t){return e>>>t^e<<32-t}const a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),u=new Uint32Array(16),l=new Uint32Array(16);function f(e,t){let r=0;for(r=0;r<8;r++)u[r]=e.h[r],u[r+8]=a[r];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),r=0;r<16;r++)l[r]=i(e.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,l[c[16*r+0]],l[c[16*r+1]]),o(1,5,9,13,l[c[16*r+2]],l[c[16*r+3]]),o(2,6,10,14,l[c[16*r+4]],l[c[16*r+5]]),o(3,7,11,15,l[c[16*r+6]],l[c[16*r+7]]),o(0,5,10,15,l[c[16*r+8]],l[c[16*r+9]]),o(1,6,11,12,l[c[16*r+10]],l[c[16*r+11]]),o(2,7,8,13,l[c[16*r+12]],l[c[16*r+13]]),o(3,4,9,14,l[c[16*r+14]],l[c[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=u[r]^u[r+8]}function d(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");const r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");const n={h:new Uint32Array(a),b:new Uint8Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(h(n,t),n.c=64),n}function h(e,t){for(let r=0;r>2]>>8*(3&r)&255;return t}function b(e,t,r){r=r||32,e=n.normalizeInput(e);const i=d(r,t);return h(i,e),p(i)}e.exports={blake2s:b,blake2sHex:function(e,t,r){const i=b(e,t,r);return n.toHex(i)},blake2sInit:d,blake2sUpdate:h,blake2sFinal:p}},1395:(e,t,r)=>{const n=r(651),i=r(9962);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},7967:e=>{function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,r,n){let i="\n"+e+" = ";for(let o=0;o=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.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++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=c(e,t,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var l=["","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"],f=[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],d=[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,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.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>>24-i&16777215)||s!==this.length-1?l[6-c.length]+c+r:c+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 u=f[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?b+r:l[u-b.length]+b+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")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){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"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.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;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.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<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,b=h>>>13,m=0|s[2],g=8191&m,v=m>>>13,y=0|s[3],_=8191&y,w=y>>>13,E=0|s[4],O=8191&E,A=E>>>13,S=0|s[5],P=8191&S,T=S>>>13,I=0|s[6],R=8191&I,x=I>>>13,M=0|s[7],k=8191&M,L=M>>>13,N=0|s[8],C=8191&N,j=N>>>13,D=0|s[9],U=8191&D,B=D>>>13,F=0|a[0],K=8191&F,H=F>>>13,G=0|a[1],$=8191&G,V=G>>>13,z=0|a[2],q=8191&z,W=z>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],fe=8191&le,de=le>>>13,he=0|a[9],pe=8191&he,be=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(f,K))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(d,K)|0))<<13)|0;u=((o=Math.imul(d,H))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,K),i=(i=Math.imul(p,H))+Math.imul(b,K)|0,o=Math.imul(b,H);var ge=(u+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,K),i=(i=Math.imul(g,H))+Math.imul(v,K)|0,o=Math.imul(v,H),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,V)|0;var ve=(u+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,q)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(_,K),i=(i=Math.imul(_,H))+Math.imul(w,K)|0,o=Math.imul(w,H),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,W)|0;var ye=(u+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,J)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(O,K),i=(i=Math.imul(O,H))+Math.imul(A,K)|0,o=Math.imul(A,H),n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0;var _e=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,K),i=(i=Math.imul(P,H))+Math.imul(T,K)|0,o=Math.imul(T,H),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(_,q)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var we=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,K),i=(i=Math.imul(R,H))+Math.imul(x,K)|0,o=Math.imul(x,H),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Ee=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(k,K),i=(i=Math.imul(k,H))+Math.imul(L,K)|0,o=Math.imul(L,H),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var Oe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(C,K),i=(i=Math.imul(C,H))+Math.imul(j,K)|0,o=Math.imul(j,H),n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0;var Ae=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,K),i=(i=Math.imul(U,H))+Math.imul(B,K)|0,o=Math.imul(B,H),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,se)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(v,ce)|0,o=o+Math.imul(v,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,fe)|0,o=o+Math.imul(b,de)|0;var Se=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,be)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,V))+Math.imul(B,$)|0,o=Math.imul(B,V),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,W)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,fe)|0,o=o+Math.imul(v,de)|0;var Pe=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(B,q)|0,o=Math.imul(B,W),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,n=n+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(_,fe)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,de)|0;var Te=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,be)|0)+Math.imul(v,pe)|0))<<13)|0;u=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Y))+Math.imul(B,J)|0,o=Math.imul(B,Y),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,ue)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(A,fe)|0,o=o+Math.imul(A,de)|0;var Ie=(u+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,be)|0)+Math.imul(w,pe)|0))<<13)|0;u=((o=o+Math.imul(w,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(B,Q)|0,o=Math.imul(B,ee),n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,n=n+Math.imul(P,fe)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(T,fe)|0,o=o+Math.imul(T,de)|0;var Re=(u+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,be)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(B,re)|0,o=Math.imul(B,ne),n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,se)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,de)|0;var xe=(u+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(T,pe)|0))<<13)|0;u=((o=o+Math.imul(T,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(B,oe)|0,o=Math.imul(B,se),n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(j,ce)|0,o=o+Math.imul(j,ue)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(L,fe)|0,o=o+Math.imul(L,de)|0;var Me=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(B,ce)|0,o=Math.imul(B,ue),n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(j,fe)|0,o=o+Math.imul(j,de)|0;var ke=(u+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,fe),i=(i=Math.imul(U,de))+Math.imul(B,fe)|0,o=Math.imul(B,de);var Le=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(j,pe)|0))<<13)|0;u=((o=o+Math.imul(j,be)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ne=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,be))+Math.imul(B,pe)|0))<<13)|0;return u=((o=Math.imul(B,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Ee,c[7]=Oe,c[8]=Ae,c[9]=Se,c[10]=Pe,c[11]=Te,c[12]=Ie,c[13]=Re,c[14]=xe,c[15]=Me,c[16]=ke,c[17]=Le,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):n<63?h(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):b(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=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>>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=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=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<=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},o.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>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=d)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,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 o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.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 i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(f)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(c)):(r.isub(t),a.isub(i),c.isub(s))}return{a,b:c,gcd:r.iushln(u)}},o.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 i,s=new o(1),a=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new O(e)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(e){if("string"==typeof e){var t=o._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 A(e){O.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},i(y,v),y.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new _;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return g[e]=t,t},O.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},O.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")},O.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},O.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},O.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},O.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},O.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},O.prototype.isqr=function(e){return this.imul(e,e.clone())},O.prototype.sqr=function(e){return this.mul(e,e)},O.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 o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var b=h,m=0;0!==b.cmp(a);m++)b=b.redSqr();n(m=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},O.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},O.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,O),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},2745:(e,t,r)=>{var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{const n=r(8166);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8616:(e,t,r)=>{"use strict";var n=r(7022);e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),i=e(r),o=r.length+4,s=new Uint8Array(o);return s.set(r,0),s.set(i.subarray(0,4),r.length),n.encode(s,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},4075:(e,t,r)=>{"use strict";var{sha256:n}=r(6053),i=r(8616);e.exports=i((function(e){return n(n(e))}))},8834:(e,t,r)=>{"use strict";const n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|b(e,t);let n=a(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(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(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?a(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 c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(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 f(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function b(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(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 r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=b,c.prototype._isBuffer=!0,c.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;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function C(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||k(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||k(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||k(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||k(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||k(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||k(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeBigUInt64LE=X((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=X((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=r-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+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeBigInt64LE=X((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=X((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function H(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||$(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=K(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=K(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},7554:(e,t,r)=>{"use strict";var n=t;n.version=r(763).i8,n.utils=r(8288),n.rand=r(2745),n.curve=r(8610),n.curves=r(1479),n.ec=r(8596),n.eddsa=r(9208)},8919:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+n[l];u.push(c)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var f=s[u];a(0!==f),c="affine"===e.type?f>0?c.mixedAdd(i[f-1>>1]):c.mixedAdd(i[-f-1>>1].neg()):f>0?c.add(i[f-1>>1]):c.add(i[-f-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){var a,c,u,l=this._wnafT1,f=this._wnafT2,d=this._wnafT3,h=0;for(a=0;a=1;a-=2){var b=a-1,m=a;if(1===l[b]&&1===l[m]){var g=[t[b],null,null,t[m]];0===t[b].y.cmp(t[m].y)?(g[1]=t[b].add(t[m]),g[2]=t[b].toJ().mixedAdd(t[m].neg())):0===t[b].y.cmp(t[m].y.redNeg())?(g[1]=t[b].toJ().mixedAdd(t[m]),g[2]=t[b].add(t[m].neg())):(g[1]=t[b].toJ().mixedAdd(t[m]),g[2]=t[b].toJ().mixedAdd(t[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=s(r[b],r[m]);for(h=Math.max(y[0].length,h),d[b]=new Array(h),d[m]=new Array(h),c=0;c=0;a--){for(var A=0;a>=0;){var S=!0;for(c=0;c=0&&A++,E=E.dblp(A),a<0)break;for(c=0;c0?u=f[c][P-1>>1]:P<0&&(u=f[c][-P-1>>1].neg()),E="affine"===u.type?E.mixedAdd(u):E.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{"use strict";var n=r(8288),i=r(2197),o=r(1285),s=r(8919),a=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,s.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,o){s.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,s),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},o(u,s.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),f=s.redMul(o);return this.curve.point(c,u,f,l)},u.prototype._projDbl=function(){var e,t,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(a.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(t),u=o.redMul(s),l=a.redMul(c),f=o.redMul(c),d=s.redMul(a);return this.curve.point(u,l,d,f)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),f=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(f,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},8610:(e,t,r)=>{"use strict";var n=t;n.base=r(8919),n.short=r(7715),n.mont=r(5125),n.edwards=r(7105)},5125:(e,t,r)=>{"use strict";var n=r(2197),i=r(1285),o=r(8919),s=r(8288);function a(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},7715:(e,t,r)=>{"use strict";var n=r(8288),i=r(2197),o=r(1285),s=r(8919),a=n.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,o,s,a,c,u,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),p=new i(1),b=new i(0),m=new i(0),g=new i(1),v=0;0!==d.cmpn(0);){var y=h.div(d);u=h.sub(y.mul(d)),l=m.sub(y.mul(p));var _=g.sub(y.mul(b));if(!n&&u.cmp(f)<0)t=c.neg(),r=p,n=u.neg(),o=l;else if(n&&2==++v)break;c=u,h=d,d=u,m=p,p=l,g=b,b=_}s=u.neg(),a=l;var w=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(w)>=0&&(s=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=r.redMul(c),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),d=a.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(f,d,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1479:(e,t,r)=>{"use strict";var n,i=t,o=r(4485),s=r(8610),a=r(8288).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(7983)}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},8596:(e,t,r)=>{"use strict";var n=r(2197),i=r(8873),o=r(8288),s=r(1479),a=r(2745),c=o.assert,u=r(2307),l=r(1798);function f(e){if(!(this instanceof f))return new f(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=f,f.prototype.keyPair=function(e){return new u(this,e)},f.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},f.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},f.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(t.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},f.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},f.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new n(1)),d=0;;d++){var h=o.k?o.k(d):new n(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var g=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),v^=1),new l({r:m,s:g,recoveryParam:v})}}}}}},f.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),f)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),f)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new n(e),a=t.r,u=t.s,f=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),b=u.mul(h).umod(o);return this.g.mulAdd(p,a,b)},f.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new l(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},2307:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},1798:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;var u=e.slice(r.place,s+r.place);if(r.place+=s,2!==e[r.place++])return!1;var l=c(e,r);if(!1===l)return!1;if(e.length!==l+r.place)return!1;var f=e.slice(r.place,l+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new n(u),this.s=new n(f),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,t.length),(n=n.concat(t)).push(2),l(n,r.length);var o=n.concat(r),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},9208:(e,t,r)=>{"use strict";var n=r(4485),i=r(1479),o=r(8288),s=o.assert,a=o.parseBytes,c=r(851),u=r(6117);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t{"use strict";var n=r(8288),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},6117:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}s(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},7983:e=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},8288:(e,t,r)=>{"use strict";var n=t,i=r(2197),o=r(9561),s=r(3022);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0==(1&c)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(s),a=0==(1&u)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},5695:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var r,n="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(r=t.cmp,function(e){return function(t,n){var i={key:t,value:e[t]},o={key:n,value:e[n]};return r(i,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var r,s;if(Array.isArray(t)){for(s="[",r=0;r{var n=t;n.utils=r(212),n.common=r(4495),n.sha=r(5530),n.ripemd=r(1396),n.hmac=r(5047),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},4495:(e,t,r)=>{"use strict";var n=r(212),i=r(9561);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(212),i=r(9561);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(212),i=r(4495),o=n.rotl32,s=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function l(){if(!(this instanceof l))return new l;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function h(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(l,u),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],l=this.h[4],v=r,y=n,_=i,w=u,E=l,O=0;O<80;O++){var A=s(o(c(r,f(O,n,i,u),e[p[O]+t],d(O)),m[O]),l);r=l,l=u,u=o(i,10),i=n,n=A,A=s(o(c(v,f(79-O,y,_,w),e[b[O]+t],h(O)),g[O]),E),v=E,E=w,w=o(_,10),_=y,y=A}A=a(this.h[1],i,w),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],l,v),this.h[3]=a(this.h[4],r,y),this.h[4]=a(this.h[0],n,_),this.h[0]=A},l.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},5530:(e,t,r)=>{"use strict";t.sha1=r(5079),t.sha224=r(3823),t.sha256=r(8032),t.sha384=r(5328),t.sha512=r(168)},5079:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,l),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212),i=r(8032);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},8032:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=r(9561),a=n.sum32,c=n.sum32_4,u=n.sum32_5,l=o.ch32,f=o.maj32,d=o.s0_256,h=o.s1_256,p=o.g0_256,b=o.g1_256,m=i.BlockHash,g=[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];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(v,m),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212),i=r(168);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},168:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(9561),s=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,l=n.sum64,f=n.sum64_hi,d=n.sum64_lo,h=n.sum64_4_hi,p=n.sum64_4_lo,b=n.sum64_5_hi,m=n.sum64_5_lo,g=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function _(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function w(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function E(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function O(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function A(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(y,g),e.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},212:(e,t,r)=>{"use strict";var n=r(9561),i=r(1285);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,c,u){return t+n+o+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},8873:(e,t,r)=>{"use strict";var n=r(4485),i=r(3022),o=r(9561);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,l=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=u}return(h?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,b=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=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<0;e[r+h]=255&s,h+=p,s/=256,u-=8);e[r+h-p]|=128*b}},1285:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},9561:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},3022:(e,t)=>{"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},977:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.interval=t.iif=t.generate=t.fromEventPattern=t.fromEvent=t.from=t.forkJoin=t.empty=t.defer=t.connectable=t.concat=t.combineLatest=t.bindNodeCallback=t.bindCallback=t.UnsubscriptionError=t.TimeoutError=t.SequenceError=t.ObjectUnsubscribedError=t.NotFoundError=t.EmptyError=t.ArgumentOutOfRangeError=t.firstValueFrom=t.lastValueFrom=t.isObservable=t.identity=t.noop=t.pipe=t.NotificationKind=t.Notification=t.Subscriber=t.Subscription=t.Scheduler=t.VirtualAction=t.VirtualTimeScheduler=t.animationFrameScheduler=t.animationFrame=t.queueScheduler=t.queue=t.asyncScheduler=t.async=t.asapScheduler=t.asap=t.AsyncSubject=t.ReplaySubject=t.BehaviorSubject=t.Subject=t.animationFrames=t.observable=t.ConnectableObservable=t.Observable=void 0,t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.combineLatestWith=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=t.config=t.NEVER=t.EMPTY=t.scheduled=t.zip=t.using=t.timer=t.throwError=t.range=t.race=t.partition=t.pairs=t.onErrorResumeNext=t.of=t.never=t.merge=void 0,t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.pairwise=t.onErrorResumeNextWith=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=t.mergeAll=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=void 0,t.zipWith=t.zipAll=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=void 0;var o=r(4174);Object.defineProperty(t,"Observable",{enumerable:!0,get:function(){return o.Observable}});var s=r(7165);Object.defineProperty(t,"ConnectableObservable",{enumerable:!0,get:function(){return s.ConnectableObservable}});var a=r(4595);Object.defineProperty(t,"observable",{enumerable:!0,get:function(){return a.observable}});var c=r(2447);Object.defineProperty(t,"animationFrames",{enumerable:!0,get:function(){return c.animationFrames}});var u=r(5294);Object.defineProperty(t,"Subject",{enumerable:!0,get:function(){return u.Subject}});var l=r(8114);Object.defineProperty(t,"BehaviorSubject",{enumerable:!0,get:function(){return l.BehaviorSubject}});var f=r(8806);Object.defineProperty(t,"ReplaySubject",{enumerable:!0,get:function(){return f.ReplaySubject}});var d=r(9960);Object.defineProperty(t,"AsyncSubject",{enumerable:!0,get:function(){return d.AsyncSubject}});var h=r(3769);Object.defineProperty(t,"asap",{enumerable:!0,get:function(){return h.asap}}),Object.defineProperty(t,"asapScheduler",{enumerable:!0,get:function(){return h.asapScheduler}});var p=r(7152);Object.defineProperty(t,"async",{enumerable:!0,get:function(){return p.async}}),Object.defineProperty(t,"asyncScheduler",{enumerable:!0,get:function(){return p.asyncScheduler}});var b=r(4093);Object.defineProperty(t,"queue",{enumerable:!0,get:function(){return b.queue}}),Object.defineProperty(t,"queueScheduler",{enumerable:!0,get:function(){return b.queueScheduler}});var m=r(8989);Object.defineProperty(t,"animationFrame",{enumerable:!0,get:function(){return m.animationFrame}}),Object.defineProperty(t,"animationFrameScheduler",{enumerable:!0,get:function(){return m.animationFrameScheduler}});var g=r(2929);Object.defineProperty(t,"VirtualTimeScheduler",{enumerable:!0,get:function(){return g.VirtualTimeScheduler}}),Object.defineProperty(t,"VirtualAction",{enumerable:!0,get:function(){return g.VirtualAction}});var v=r(6949);Object.defineProperty(t,"Scheduler",{enumerable:!0,get:function(){return v.Scheduler}});var y=r(4666);Object.defineProperty(t,"Subscription",{enumerable:!0,get:function(){return y.Subscription}});var _=r(7747);Object.defineProperty(t,"Subscriber",{enumerable:!0,get:function(){return _.Subscriber}});var w=r(9828);Object.defineProperty(t,"Notification",{enumerable:!0,get:function(){return w.Notification}}),Object.defineProperty(t,"NotificationKind",{enumerable:!0,get:function(){return w.NotificationKind}});var E=r(5250);Object.defineProperty(t,"pipe",{enumerable:!0,get:function(){return E.pipe}});var O=r(7116);Object.defineProperty(t,"noop",{enumerable:!0,get:function(){return O.noop}});var A=r(8987);Object.defineProperty(t,"identity",{enumerable:!0,get:function(){return A.identity}});var S=r(3659);Object.defineProperty(t,"isObservable",{enumerable:!0,get:function(){return S.isObservable}});var P=r(4798);Object.defineProperty(t,"lastValueFrom",{enumerable:!0,get:function(){return P.lastValueFrom}});var T=r(7327);Object.defineProperty(t,"firstValueFrom",{enumerable:!0,get:function(){return T.firstValueFrom}});var I=r(9216);Object.defineProperty(t,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return I.ArgumentOutOfRangeError}});var R=r(9088);Object.defineProperty(t,"EmptyError",{enumerable:!0,get:function(){return R.EmptyError}});var x=r(5722);Object.defineProperty(t,"NotFoundError",{enumerable:!0,get:function(){return x.NotFoundError}});var M=r(8499);Object.defineProperty(t,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return M.ObjectUnsubscribedError}});var k=r(7298);Object.defineProperty(t,"SequenceError",{enumerable:!0,get:function(){return k.SequenceError}});var L=r(1316);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return L.TimeoutError}});var N=r(4043);Object.defineProperty(t,"UnsubscriptionError",{enumerable:!0,get:function(){return N.UnsubscriptionError}});var C=r(6238);Object.defineProperty(t,"bindCallback",{enumerable:!0,get:function(){return C.bindCallback}});var j=r(2375);Object.defineProperty(t,"bindNodeCallback",{enumerable:!0,get:function(){return j.bindNodeCallback}});var D=r(508);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return D.combineLatest}});var U=r(3364);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return U.concat}});var B=r(5360);Object.defineProperty(t,"connectable",{enumerable:!0,get:function(){return B.connectable}});var F=r(9623);Object.defineProperty(t,"defer",{enumerable:!0,get:function(){return F.defer}});var K=r(6929);Object.defineProperty(t,"empty",{enumerable:!0,get:function(){return K.empty}});var H=r(9220);Object.defineProperty(t,"forkJoin",{enumerable:!0,get:function(){return H.forkJoin}});var G=r(4417);Object.defineProperty(t,"from",{enumerable:!0,get:function(){return G.from}});var $=r(9671);Object.defineProperty(t,"fromEvent",{enumerable:!0,get:function(){return $.fromEvent}});var V=r(7357);Object.defineProperty(t,"fromEventPattern",{enumerable:!0,get:function(){return V.fromEventPattern}});var z=r(3482);Object.defineProperty(t,"generate",{enumerable:!0,get:function(){return z.generate}});var q=r(550);Object.defineProperty(t,"iif",{enumerable:!0,get:function(){return q.iif}});var W=r(3154);Object.defineProperty(t,"interval",{enumerable:!0,get:function(){return W.interval}});var Z=r(2039);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return Z.merge}});var J=r(2980);Object.defineProperty(t,"never",{enumerable:!0,get:function(){return J.never}});var Y=r(1377);Object.defineProperty(t,"of",{enumerable:!0,get:function(){return Y.of}});var X=r(8362);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return X.onErrorResumeNext}});var Q=r(968);Object.defineProperty(t,"pairs",{enumerable:!0,get:function(){return Q.pairs}});var ee=r(6394);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ee.partition}});var te=r(6849);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return te.race}});var re=r(7284);Object.defineProperty(t,"range",{enumerable:!0,get:function(){return re.range}});var ne=r(40);Object.defineProperty(t,"throwError",{enumerable:!0,get:function(){return ne.throwError}});var ie=r(8069);Object.defineProperty(t,"timer",{enumerable:!0,get:function(){return ie.timer}});var oe=r(3348);Object.defineProperty(t,"using",{enumerable:!0,get:function(){return oe.using}});var se=r(4981);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return se.zip}});var ae=r(2862);Object.defineProperty(t,"scheduled",{enumerable:!0,get:function(){return ae.scheduled}});var ce=r(6929);Object.defineProperty(t,"EMPTY",{enumerable:!0,get:function(){return ce.EMPTY}});var ue=r(2980);Object.defineProperty(t,"NEVER",{enumerable:!0,get:function(){return ue.NEVER}}),i(r(2793),t);var le=r(9179);Object.defineProperty(t,"config",{enumerable:!0,get:function(){return le.config}});var fe=r(2605);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return fe.audit}});var de=r(4152);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return de.auditTime}});var he=r(5149);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return he.buffer}});var pe=r(3189);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return pe.bufferCount}});var be=r(9459);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return be.bufferTime}});var me=r(8145);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return me.bufferToggle}});var ge=r(7764);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return ge.bufferWhen}});var ve=r(3056);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return ve.catchError}});var ye=r(498);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return ye.combineAll}});var _e=r(7484);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return _e.combineLatestAll}});var we=r(4755);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return we.combineLatestWith}});var Ee=r(482);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return Ee.concatAll}});var Oe=r(1774);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return Oe.concatMap}});var Ae=r(3977);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return Ae.concatMapTo}});var Se=r(7672);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return Se.concatWith}});var Pe=r(5561);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return Pe.connect}});var Te=r(8259);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return Te.count}});var Ie=r(3473);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return Ie.debounce}});var Re=r(8390);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return Re.debounceTime}});var xe=r(4562);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return xe.defaultIfEmpty}});var Me=r(8151);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return Me.delay}});var ke=r(744);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return ke.delayWhen}});var Le=r(8590);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return Le.dematerialize}});var Ne=r(8406);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return Ne.distinct}});var Ce=r(7300);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return Ce.distinctUntilChanged}});var je=r(4405);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return je.distinctUntilKeyChanged}});var De=r(2787);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return De.elementAt}});var Ue=r(1665);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return Ue.endWith}});var Be=r(1511);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return Be.every}});var Fe=r(5592);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return Fe.exhaust}});var Ke=r(2008);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return Ke.exhaustAll}});var He=r(4019);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return He.exhaustMap}});var Ge=r(9101);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return Ge.expand}});var $e=r(7261);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return $e.filter}});var Ve=r(5381);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return Ve.finalize}});var ze=r(4127);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return ze.find}});var qe=r(9727);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return qe.findIndex}});var We=r(7418);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return We.first}});var Ze=r(7533);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return Ze.groupBy}});var Je=r(9186);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return Je.ignoreElements}});var Ye=r(7757);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Ye.isEmpty}});var Xe=r(3374);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return Xe.last}});var Qe=r(6269);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return Qe.map}});var et=r(5471);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return et.mapTo}});var tt=r(1160);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return tt.materialize}});var rt=r(1890);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return rt.max}});var nt=r(400);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return nt.mergeAll}});var it=r(9121);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return it.flatMap}});var ot=r(6086);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ot.mergeMap}});var st=r(1244);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return st.mergeMapTo}});var at=r(3699);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return at.mergeScan}});var ct=r(8220);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ct.mergeWith}});var ut=r(770);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ut.min}});var lt=r(8413);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return lt.multicast}});var ft=r(9314);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return ft.observeOn}});var dt=r(1899);Object.defineProperty(t,"onErrorResumeNextWith",{enumerable:!0,get:function(){return dt.onErrorResumeNextWith}});var ht=r(1186);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ht.pairwise}});var pt=r(9532);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return pt.pluck}});var bt=r(5745);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return bt.publish}});var mt=r(8103);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return mt.publishBehavior}});var gt=r(2610);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return gt.publishLast}});var vt=r(5299);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return vt.publishReplay}});var yt=r(3820);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return yt.raceWith}});var _t=r(8083);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return _t.reduce}});var wt=r(2588);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return wt.repeat}});var Et=r(9249);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return Et.repeatWhen}});var Ot=r(4486);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return Ot.retry}});var At=r(9112);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return At.retryWhen}});var St=r(4508);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return St.refCount}});var Pt=r(778);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Pt.sample}});var Tt=r(7701);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Tt.sampleTime}});var It=r(8167);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return It.scan}});var Rt=r(7821);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Rt.sequenceEqual}});var xt=r(2645);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return xt.share}});var Mt=r(7566);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Mt.shareReplay}});var kt=r(4610);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return kt.single}});var Lt=r(5735);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return Lt.skip}});var Nt=r(3252);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return Nt.skipLast}});var Ct=r(1779);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return Ct.skipUntil}});var jt=r(5454);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return jt.skipWhile}});var Dt=r(1923);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Dt.startWith}});var Ut=r(9130);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ut.subscribeOn}});var Bt=r(1695);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Bt.switchAll}});var Ft=r(6649);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Ft.switchMap}});var Kt=r(3054);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return Kt.switchMapTo}});var Ht=r(2890);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Ht.switchScan}});var Gt=r(9438);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Gt.take}});var $t=r(4125);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return $t.takeLast}});var Vt=r(9008);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Vt.takeUntil}});var zt=r(5884);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return zt.takeWhile}});var qt=r(5383);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return qt.tap}});var Wt=r(1016);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Wt.throttle}});var Zt=r(567);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return Zt.throttleTime}});var Jt=r(1332);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return Jt.throwIfEmpty}});var Yt=r(1149);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Yt.timeInterval}});var Xt=r(1316);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return Xt.timeout}});var Qt=r(4972);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Qt.timeoutWith}});var er=r(1275);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return er.timestamp}});var tr=r(9867);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return tr.toArray}});var rr=r(7649);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return rr.window}});var nr=r(5612);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return nr.windowCount}});var ir=r(9972);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return ir.windowTime}});var or=r(9593);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return or.windowToggle}});var sr=r(6307);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return sr.windowWhen}});var ar=r(5512);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return ar.withLatestFrom}});var cr=r(1221);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return cr.zipAll}});var ur=r(7594);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return ur.zipWith}})},9960:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return i(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,a=t._isComplete;r?e.error(o):(s||a)&&(n&&e.next(i),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))},t}(r(5294).Subject);t.AsyncSubject=o},8114:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var o=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(r(5294).Subject);t.BehaviorSubject=o},9828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n=r(6929),i=r(1377),o=r(40),s=r(2935);!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(t.NotificationKind||(t.NotificationKind={}));var a=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){return c(this,e)},e.prototype.do=function(e,t,r){var n=this,i=n.kind,o=n.value,s=n.error;return"N"===i?null==e?void 0:e(o):"E"===i?null==t?void 0:t(s):null==r?void 0:r()},e.prototype.accept=function(e,t,r){var n;return s.isFunction(null===(n=e)||void 0===n?void 0:n.next)?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){var e=this,t=e.kind,r=e.value,s=e.error,a="N"===t?i.of(r):"E"===t?o.throwError((function(){return s})):"C"===t?n.EMPTY:0;if(!a)throw new TypeError("Unexpected notification kind "+t);return a},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function c(e,t){var r,n,i,o=e,s=o.kind,a=o.value,c=o.error;if("string"!=typeof s)throw new TypeError('Invalid notification, missing "kind"');"N"===s?null===(r=t.next)||void 0===r||r.call(t,a):"E"===s?null===(n=t.error)||void 0===n||n.call(t,c):null===(i=t.complete)||void 0===i||i.call(t)}t.Notification=a,t.observeNotification=c},3005:(e,t)=>{"use strict";function r(e,t,r){return{kind:e,value:t,error:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.createNotification=t.nextNotification=t.errorNotification=t.COMPLETE_NOTIFICATION=void 0,t.COMPLETE_NOTIFICATION=r("C",void 0,void 0),t.errorNotification=function(e){return r("E",void 0,e)},t.nextNotification=function(e){return r("N",e,void 0)},t.createNotification=r},4174:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(7747),i=r(4666),o=r(4595),s=r(5250),a=r(9179),c=r(2935),u=r(5444),l=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,s=this,a=(o=e)&&o instanceof n.Subscriber||function(e){return e&&c.isFunction(e.next)&&c.isFunction(e.error)&&c.isFunction(e.complete)}(o)&&i.isSubscription(o)?e:new n.SafeSubscriber(e,t,r);return u.errorContext((function(){var e=s,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?s._subscribe(a):s._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=f(t))((function(t,i){var o=new n.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),o.unsubscribe()}},error:i,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(9168),i=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=n.dateTimestampProvider.now,e}();t.Scheduler=i},5294:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSubject=t.Subject=void 0;var s=r(4174),a=r(4666),c=r(8499),u=r(1291),l=r(5444),f=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(t,e),t.prototype.lift=function(e){var t=new d(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new c.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;l.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),s=i.next();!s.done;s=i.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;l.errorContext((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;l.errorContext((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?a.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new a.Subscription((function(){t.currentObservers=null,u.arrRemove(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new s.Observable;return e.source=this,e},t.create=function(e,t){return new d(e,t)},t}(s.Observable);t.Subject=f;var d=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:a.EMPTY_SUBSCRIPTION},t}(f);t.AnonymousSubject=d},7747:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var o=r(2935),s=r(4666),a=r(9179),c=r(1600),u=r(7116),l=r(3005),f=r(1577),d=r(5444),h=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,s.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return i(r,e),r.create=function(e,t,r){return new g(e,t,r)},r.prototype.next=function(e){this.isStopped?y(l.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?y(l.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?y(l.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(e){this.destination.next(e)},r.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(s.Subscription);t.Subscriber=h;var p=Function.prototype.bind;function b(e,t){return p.call(e,t)}var m=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){v(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){v(e)}else v(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){v(e)}},e}(),g=function(e){function t(t,r,n){var i,s,c=e.call(this)||this;o.isFunction(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:c&&a.config.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return c.unsubscribe()},i={next:t.next&&b(t.next,s),error:t.error&&b(t.error,s),complete:t.complete&&b(t.complete,s)}):i=t;return c.destination=new m(i),c}return i(t,e),t}(h);function v(e){a.config.useDeprecatedSynchronousErrorHandling?d.captureError(e):c.reportUnhandledError(e)}function y(e,t){var r=a.config.onStoppedNotification;r&&f.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=g,t.EMPTY_OBSERVER={closed:!0,next:u.noop,error:function(e){throw e},complete:u.noop}},4666:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=void 0,t.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},7327:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.firstValueFrom=void 0;var n=r(9088),i=r(7747);t.firstValueFrom=function(e,t){var r="object"==typeof t;return new Promise((function(o,s){var a=new i.SafeSubscriber({next:function(e){o(e),a.unsubscribe()},error:s,complete:function(){r?o(t.defaultValue):s(new n.EmptyError)}});e.subscribe(a)}))}},4798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lastValueFrom=void 0;var n=r(9088);t.lastValueFrom=function(e,t){var r="object"==typeof t;return new Promise((function(i,o){var s,a=!1;e.subscribe({next:function(e){s=e,a=!0},error:o,complete:function(){a?i(s):r?i(t.defaultValue):o(new n.EmptyError)}})}))}},7165:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var o=r(4174),s=r(4666),a=r(4508),c=r(7326),u=r(6097),l=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,u.hasLift(t)&&(n.lift=t.lift),n}return i(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new s.Subscription;var r=this.getSubject();t.add(this.source.subscribe(c.createOperatorSubscriber(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=s.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return a.refCount()(this)},t}(o.Observable);t.ConnectableObservable=l},6238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindCallback=void 0;var n=r(9706);t.bindCallback=function(e,t,r){return n.bindCallbackInternals(!1,e,t,r)}},9706:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindNodeCallback=void 0;var n=r(9706);t.bindNodeCallback=function(e,t,r){return n.bindCallbackInternals(!0,e,t,r)}},508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(4174),i=r(2398),o=r(4417),s=r(8987),a=r(9364),c=r(4544),u=r(4800),l=r(7326),f=r(5267);function d(e,t,r){return void 0===r&&(r=s.identity),function(n){h(t,(function(){for(var i=e.length,s=new Array(i),a=i,c=i,u=function(i){h(t,(function(){var u=o.from(e[i],t),f=!1;u.subscribe(l.createOperatorSubscriber(n,(function(e){s[i]=e,f||(f=!0,c--),c||n.next(r(s.slice()))}),(function(){--a||n.complete()})))}),n)},f=0;f{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(482),i=r(4544),o=r(4417);t.concat=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connectable=void 0;var n=r(5294),i=r(4174),o=r(9623),s={connector:function(){return new n.Subject},resetOnDisconnect:!0};t.connectable=function(e,t){void 0===t&&(t=s);var r=null,n=t.connector,a=t.resetOnDisconnect,c=void 0===a||a,u=n(),l=new i.Observable((function(e){return u.subscribe(e)}));return l.connect=function(){return r&&!r.closed||(r=o.defer((function(){return e})).subscribe(u),c&&r.add((function(){return u=n()}))),r},l}},9623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defer=void 0;var n=r(4174),i=r(6958);t.defer=function(e){return new n.Observable((function(t){i.innerFrom(e()).subscribe(t)}))}},2447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.animationFrames=void 0;var n=r(4174),i=r(2261),o=r(9015);function s(e){return new n.Observable((function(t){var r=e||i.performanceTimestampProvider,n=r.now(),s=0,a=function(){t.closed||(s=o.animationFrameProvider.requestAnimationFrame((function(i){s=0;var o=r.now();t.next({timestamp:e?o:i,elapsed:o-n}),a()})))};return a(),function(){s&&o.animationFrameProvider.cancelAnimationFrame(s)}}))}t.animationFrames=function(e){return e?s(e):a};var a=s()},6929:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(4174);t.EMPTY=new n.Observable((function(e){return e.complete()})),t.empty=function(e){return e?function(e){return new n.Observable((function(t){return e.schedule((function(){return t.complete()}))}))}(e):t.EMPTY}},9220:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.forkJoin=void 0;var n=r(4174),i=r(2398),o=r(6958),s=r(4544),a=r(7326),c=r(9364),u=r(4800);t.forkJoin=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(2862),i=r(6958);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},9671:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.fromEvent=void 0;var i=r(6958),o=r(4174),s=r(6086),a=r(5445),c=r(2935),u=r(9364),l=["addListener","removeListener"],f=["addEventListener","removeEventListener"],d=["on","off"];function h(e,t){return function(r){return function(n){return e[r](t,n)}}}t.fromEvent=function e(t,r,p,b){if(c.isFunction(p)&&(b=p,p=void 0),b)return e(t,r,p).pipe(u.mapOneOrManyArgs(b));var m=n(function(e){return c.isFunction(e.addEventListener)&&c.isFunction(e.removeEventListener)}(t)?f.map((function(e){return function(n){return t[e](r,n,p)}})):function(e){return c.isFunction(e.addListener)&&c.isFunction(e.removeListener)}(t)?l.map(h(t,r)):function(e){return c.isFunction(e.on)&&c.isFunction(e.off)}(t)?d.map(h(t,r)):[],2),g=m[0],v=m[1];if(!g&&a.isArrayLike(t))return s.mergeMap((function(t){return e(t,r,p)}))(i.innerFrom(t));if(!g)throw new TypeError("Invalid event target");return new o.Observable((function(e){var t=function(){for(var t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromEventPattern=void 0;var n=r(4174),i=r(2935),o=r(9364);t.fromEventPattern=function e(t,r,s){return s?e(t,r).pipe(o.mapOneOrManyArgs(s)):new n.Observable((function(e){var n=function(){for(var t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(4174);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},3482:function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iif=void 0;var n=r(9623);t.iif=function(e,t,r){return n.defer((function(){return e()?t:r}))}},6958:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.fromReadableStreamLike=t.fromAsyncIterable=t.fromIterable=t.fromPromise=t.fromArrayLike=t.fromInteropObservable=t.innerFrom=void 0;var a=r(5445),c=r(4283),u=r(4174),l=r(3124),f=r(3260),d=r(7756),h=r(8131),p=r(2221),b=r(2935),m=r(1600),g=r(4595);function v(e){return new u.Observable((function(t){var r=e[g.observable]();if(b.isFunction(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}))}function y(e){return new u.Observable((function(t){for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(7152),i=r(8069);t.interval=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=n.asyncScheduler),e<0&&(e=0),i.timer(e,e,t)}},2039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;var n=r(400),i=r(6958),o=r(6929),s=r(4544),a=r(4417);t.merge=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.never=t.NEVER=void 0;var n=r(4174),i=r(7116);t.NEVER=new n.Observable(i.noop),t.never=function(){return t.NEVER}},1377:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(4544),i=r(4417);t.of=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(4174),i=r(5034),o=r(7326),s=r(7116),a=r(6958);t.onErrorResumeNext=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairs=void 0;var n=r(4417);t.pairs=function(e,t){return n.from(Object.entries(e),t)}},6394:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(8781),i=r(7261),o=r(6958);t.partition=function(e,t,r){return[i.filter(t,r)(o.innerFrom(e)),i.filter(n.not(t,r))(o.innerFrom(e))]}},6849:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(4174),i=r(6958),o=r(5034),s=r(7326);function a(e){return function(t){for(var r=[],n=function(n){r.push(i.innerFrom(e[n]).subscribe(s.createOperatorSubscriber(t,(function(e){if(r){for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range=void 0;var n=r(4174),i=r(6929);t.range=function(e,t,r){if(null==t&&(t=e,e=0),t<=0)return i.EMPTY;var o=t+e;return new n.Observable(r?function(t){var n=e;return r.schedule((function(){n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(4174),i=r(2935);t.throwError=function(e,t){var r=i.isFunction(e)?e:function(){return e},o=function(e){return e.error(r())};return new n.Observable(t?function(e){return t.schedule(o,0,e)}:o)}},8069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(4174),i=r(7152),o=r(9668),s=r(4426);t.timer=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r=i.async);var a=-1;return null!=t&&(o.isScheduler(t)?r=t:a=t),new n.Observable((function(t){var n=s.isValidDate(e)?+e-r.now():e;n<0&&(n=0);var i=0;return r.schedule((function(){t.closed||(t.next(i++),0<=a?this.schedule(void 0,a):t.complete())}),n)}))}},3348:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.using=void 0;var n=r(4174),i=r(6958),o=r(6929);t.using=function(e,t){return new n.Observable((function(r){var n=e(),s=t(n);return(s?i.innerFrom(s):o.EMPTY).subscribe(r),function(){n&&n.unsubscribe()}}))}},4981:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(6097),i=r(6958),o=r(7326);t.audit=function(e){return n.operate((function(t,r){var n=!1,s=null,a=null,c=!1,u=function(){if(null==a||a.unsubscribe(),a=null,n){n=!1;var e=s;s=null,r.next(e)}c&&r.complete()},l=function(){a=null,c&&r.complete()};t.subscribe(o.createOperatorSubscriber(r,(function(t){n=!0,s=t,a||i.innerFrom(e(t)).subscribe(a=o.createOperatorSubscriber(r,u,l))}),(function(){c=!0,(!n||!a||a.closed)&&r.complete()})))}))}},4152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(7152),i=r(2605),o=r(8069);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},5149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.buffer=function(e){return n.operate((function(t,r){var n=[];return t.subscribe(o.createOperatorSubscriber(r,(function(e){return n.push(e)}),(function(){r.next(n),r.complete()}))),s.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){var e=n;n=[],r.next(e)}),i.noop)),function(){n=null}}))}},3189:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferCount=void 0;var i=r(6097),o=r(7326),s=r(1291);t.bufferCount=function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,i.operate((function(r,i){var a=[],c=0;r.subscribe(o.createOperatorSubscriber(i,(function(r){var o,u,l,f,d=null;c++%t==0&&a.push([]);try{for(var h=n(a),p=h.next();!p.done;p=h.next()){(g=p.value).push(r),e<=g.length&&(d=null!=d?d:[]).push(g)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(u=h.return)&&u.call(h)}finally{if(o)throw o.error}}if(d)try{for(var b=n(d),m=b.next();!m.done;m=b.next()){var g=m.value;s.arrRemove(a,g),i.next(g)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(f=b.return)&&f.call(b)}finally{if(l)throw l.error}}}),(function(){var e,t;try{for(var r=n(a),o=r.next();!o.done;o=r.next()){var s=o.value;i.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.complete()}),void 0,(function(){a=null})))}))}},9459:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferTime=void 0;var i=r(4666),o=r(6097),s=r(7326),a=r(1291),c=r(7152),u=r(4544),l=r(5267);t.bufferTime=function(e){for(var t,r,f=[],d=1;d=0?l.executeSchedule(r,h,f,p,!0):c=!0,f();var d=s.createOperatorSubscriber(r,(function(e){var t,r,i=o.slice();try{for(var s=n(i),a=s.next();!a.done;a=s.next()){var c=a.value,l=c.buffer;l.push(e),b<=l.length&&u(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}),(function(){for(;null==o?void 0:o.length;)r.next(o.shift().buffer);null==d||d.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return o=null}));t.subscribe(d)}))}},8145:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToggle=void 0;var i=r(4666),o=r(6097),s=r(6958),a=r(7326),c=r(7116),u=r(1291);t.bufferToggle=function(e,t){return o.operate((function(r,o){var l=[];s.innerFrom(e).subscribe(a.createOperatorSubscriber(o,(function(e){var r=[];l.push(r);var n=new i.Subscription;n.add(s.innerFrom(t(e)).subscribe(a.createOperatorSubscriber(o,(function(){u.arrRemove(l,r),o.next(r),n.unsubscribe()}),c.noop)))}),c.noop)),r.subscribe(a.createOperatorSubscriber(o,(function(e){var t,r;try{for(var i=n(l),o=i.next();!o.done;o=i.next()){o.value.push(e)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}),(function(){for(;l.length>0;)o.next(l.shift());o.complete()})))}))}},7764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.bufferWhen=function(e){return n.operate((function(t,r){var n=null,a=null,c=function(){null==a||a.unsubscribe();var t=n;n=[],t&&r.next(t),s.innerFrom(e()).subscribe(a=o.createOperatorSubscriber(r,c,i.noop))};c(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=a=null})))}))}},3056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(6958),i=r(7326),o=r(6097);t.catchError=function e(t){return o.operate((function(r,o){var s,a=null,c=!1;a=r.subscribe(i.createOperatorSubscriber(o,void 0,void 0,(function(i){s=n.innerFrom(t(i,e(t)(r))),a?(a.unsubscribe(),a=null,s.subscribe(o)):c=!0}))),c&&(a.unsubscribe(),a=null,s.subscribe(o))}))}},498:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(7484);t.combineAll=n.combineLatestAll},6527:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(508),i=r(2208);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},4755:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(400);t.concatAll=function(){return n.mergeAll(1)}},1774:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(6086),i=r(2935);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},3977:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1774),i=r(2935);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},7672:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(5294),i=r(6958),o=r(6097),s=r(6884),a={connector:function(){return new n.Subject}};t.connect=function(e,t){void 0===t&&(t=a);var r=t.connector;return o.operate((function(t,n){var o=r();i.innerFrom(e(s.fromSubscribable(o))).subscribe(n),n.add(t.subscribe(o))}))}},8259:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(8083);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},3473:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.debounce=function(e){return n.operate((function(t,r){var n=!1,a=null,c=null,u=function(){if(null==c||c.unsubscribe(),c=null,n){n=!1;var e=a;a=null,r.next(e)}};t.subscribe(o.createOperatorSubscriber(r,(function(t){null==c||c.unsubscribe(),n=!0,a=t,c=o.createOperatorSubscriber(r,u,i.noop),s.innerFrom(e(t)).subscribe(c)}),(function(){u(),r.complete()}),void 0,(function(){a=c=null})))}))}},8390:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(7152),i=r(6097),o=r(7326);t.debounceTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.operate((function(r,n){var i=null,s=null,a=null,c=function(){if(i){i.unsubscribe(),i=null;var e=s;s=null,n.next(e)}};function u(){var r=a+e,o=t.now();if(o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(6097),i=r(7326);t.defaultIfEmpty=function(e){return n.operate((function(t,r){var n=!1;t.subscribe(i.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){n||r.next(e),r.complete()})))}))}},8151:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(7152),i=r(744),o=r(8069);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(3364),i=r(9438),o=r(9186),s=r(5471),a=r(6086),c=r(6958);t.delayWhen=function e(t,r){return r?function(s){return n.concat(r.pipe(i.take(1),o.ignoreElements()),s.pipe(e(t)))}:a.mergeMap((function(e,r){return c.innerFrom(t(e,r)).pipe(i.take(1),s.mapTo(e))}))}},8590:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(9828),i=r(6097),o=r(7326);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},8406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(6097),i=r(7326),o=r(7116),s=r(6958);t.distinct=function(e,t){return n.operate((function(r,n){var a=new Set;r.subscribe(i.createOperatorSubscriber(n,(function(t){var r=e?e(t):t;a.has(r)||(a.add(r),n.next(t))}))),t&&s.innerFrom(t).subscribe(i.createOperatorSubscriber(n,(function(){return a.clear()}),o.noop))}))}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(8987),i=r(6097),o=r(7326);function s(e,t){return e===t}t.distinctUntilChanged=function(e,t){return void 0===t&&(t=n.identity),e=null!=e?e:s,i.operate((function(r,n){var i,s=!0;r.subscribe(o.createOperatorSubscriber(n,(function(r){var o=t(r);!s&&e(i,o)||(s=!1,i=o,n.next(r))})))}))}},4405:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(7300);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},2787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(9216),i=r(7261),o=r(1332),s=r(4562),a=r(9438);t.elementAt=function(e,t){if(e<0)throw new n.ArgumentOutOfRangeError;var r=arguments.length>=2;return function(c){return c.pipe(i.filter((function(t,r){return r===e})),a.take(1),r?s.defaultIfEmpty(t):o.throwIfEmpty((function(){return new n.ArgumentOutOfRangeError})))}}},1665:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(6097),i=r(7326);t.every=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(i){e.call(t,i,o++,r)||(n.next(!1),n.complete())}),(function(){n.next(!0),n.complete()})))}))}},5592:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(2008);t.exhaust=n.exhaustAll},2008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(4019),i=r(8987);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},4019:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(6269),i=r(6958),o=r(6097),s=r(7326);t.exhaustMap=function e(t,r){return r?function(o){return o.pipe(e((function(e,o){return i.innerFrom(t(e,o)).pipe(n.map((function(t,n){return r(e,t,o,n)})))})))}:o.operate((function(e,r){var n=0,o=null,a=!1;e.subscribe(s.createOperatorSubscriber(r,(function(e){o||(o=s.createOperatorSubscriber(r,void 0,(function(){o=null,a&&r.complete()})),i.innerFrom(t(e,n++)).subscribe(o))}),(function(){a=!0,!o&&r.complete()})))}))}},9101:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(6097),i=r(5926);t.expand=function(e,t,r){return void 0===t&&(t=1/0),t=(t||0)<1?1/0:t,n.operate((function(n,o){return i.mergeInternals(n,o,e,t,void 0,!0,r)}))}},7261:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(6097),i=r(7326);t.filter=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}},5381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(6097);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},4127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(6097),i=r(7326);function o(e,t,r){var n="index"===r;return function(r,o){var s=0;r.subscribe(i.createOperatorSubscriber(o,(function(i){var a=s++;e.call(t,i,a,r)&&(o.next(n?a:i),o.complete())}),(function(){o.next(n?-1:void 0),o.complete()})))}}t.find=function(e,t){return n.operate(o(e,t,"value"))},t.createFind=o},9727:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(6097),i=r(4127);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},7418:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(9088),i=r(7261),o=r(9438),s=r(4562),a=r(1332),c=r(8987);t.first=function(e,t){var r=arguments.length>=2;return function(u){return u.pipe(e?i.filter((function(t,r){return e(t,r,u)})):c.identity,o.take(1),r?s.defaultIfEmpty(t):a.throwIfEmpty((function(){return new n.EmptyError})))}}},9121:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(6086);t.flatMap=n.mergeMap},7533:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(4174),i=r(6958),o=r(5294),s=r(6097),a=r(7326);t.groupBy=function(e,t,r,c){return s.operate((function(s,u){var l;t&&"function"!=typeof t?(r=t.duration,l=t.element,c=t.connector):l=t;var f=new Map,d=function(e){f.forEach(e),e(u)},h=function(e){return d((function(t){return t.error(e)}))},p=0,b=!1,m=new a.OperatorSubscriber(u,(function(t){try{var s=e(t),d=f.get(s);if(!d){f.set(s,d=c?c():new o.Subject);var g=(y=s,_=d,(w=new n.Observable((function(e){p++;var t=_.subscribe(e);return function(){t.unsubscribe(),0==--p&&b&&m.unsubscribe()}}))).key=y,w);if(u.next(g),r){var v=a.createOperatorSubscriber(d,(function(){d.complete(),null==v||v.unsubscribe()}),void 0,void 0,(function(){return f.delete(s)}));m.add(i.innerFrom(r(g)).subscribe(v))}}d.next(l?l(t):t)}catch(e){h(e)}var y,_,w}),(function(){return d((function(e){return e.complete()}))}),h,(function(){return f.clear()}),(function(){return b=!0,0===p}));s.subscribe(m)}))}},9186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(6097),i=r(7326),o=r(7116);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},7757:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(6097),i=r(7326);t.isEmpty=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}},2208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(8987),i=r(9364),o=r(5250),s=r(6086),a=r(9867);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},3374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(9088),i=r(7261),o=r(4125),s=r(1332),a=r(4562),c=r(8987);t.last=function(e,t){var r=arguments.length>=2;return function(u){return u.pipe(e?i.filter((function(t,r){return e(t,r,u)})):c.identity,o.takeLast(1),r?a.defaultIfEmpty(t):s.throwIfEmpty((function(){return new n.EmptyError})))}}},6269:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(6097),i=r(7326);t.map=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){n.next(e.call(t,r,o++))})))}))}},5471:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(6269);t.mapTo=function(e){return n.map((function(){return e}))}},1160:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(9828),i=r(6097),o=r(7326);t.materialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){t.next(n.Notification.createNext(e))}),(function(){t.next(n.Notification.createComplete()),t.complete()}),(function(e){t.next(n.Notification.createError(e)),t.complete()})))}))}},1890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(8083),i=r(2935);t.max=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}},3982:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(6086),i=r(8987);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},5926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(6958),i=r(5267),o=r(7326);t.mergeInternals=function(e,t,r,s,a,c,u,l){var f=[],d=0,h=0,p=!1,b=function(){!p||f.length||d||t.complete()},m=function(e){return d{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(6269),i=r(6958),o=r(6097),s=r(5926),a=r(2935);t.mergeMap=function e(t,r,c){return void 0===c&&(c=1/0),a.isFunction(r)?e((function(e,o){return n.map((function(t,n){return r(e,t,o,n)}))(i.innerFrom(t(e,o)))}),c):("number"==typeof r&&(c=r),o.operate((function(e,r){return s.mergeInternals(e,r,t,c)})))}},1244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(6086),i=r(2935);t.mergeMapTo=function(e,t,r){return void 0===r&&(r=1/0),i.isFunction(t)?n.mergeMap((function(){return e}),t,r):("number"==typeof t&&(r=t),n.mergeMap((function(){return e}),r))}},3699:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(6097),i=r(5926);t.mergeScan=function(e,t,r){return void 0===r&&(r=1/0),n.operate((function(n,o){var s=t;return i.mergeInternals(n,o,(function(t,r){return e(s,t,r)}),r,(function(e){s=e}),!1,void 0,(function(){return s=null}))}))}},8220:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(8083),i=r(2935);t.min=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)<0?t:r}:function(e,t){return e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(7165),i=r(2935),o=r(5561);t.multicast=function(e,t){var r=i.isFunction(e)?e:function(){return e};return i.isFunction(t)?o.connect(t,{connector:r}):function(e){return new n.ConnectableObservable(e,r)}}},9314:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5267),i=r(6097),o=r(7326);t.observeOn=function(e,t){return void 0===t&&(t=0),i.operate((function(r,i){r.subscribe(o.createOperatorSubscriber(i,(function(r){return n.executeSchedule(i,e,(function(){return i.next(r)}),t)}),(function(){return n.executeSchedule(i,e,(function(){return i.complete()}),t)}),(function(r){return n.executeSchedule(i,e,(function(){return i.error(r)}),t)})))}))}},1899:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(6097),i=r(7326);t.pairwise=function(){return n.operate((function(e,t){var r,n=!1;e.subscribe(i.createOperatorSubscriber(t,(function(e){var i=r;r=e,n&&t.next([i,e]),n=!0})))}))}},9857:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(8781),i=r(7261);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},9532:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(6269);t.pluck=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(5294),i=r(8413),o=r(5561);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},8103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(8114),i=r(7165);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},2610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(9960),i=r(7165);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},5299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(8806),i=r(8413),o=r(2935);t.publishReplay=function(e,t,r,s){r&&!o.isFunction(r)&&(s=r);var a=o.isFunction(r)?r:void 0;return function(r){return i.multicast(new n.ReplaySubject(e,t,s),a)(r)}}},6699:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(7235),i=r(6097);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},4508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(6097),i=r(7326);t.refCount=function(){return n.operate((function(e,t){var r=null;e._refCount++;var n=i.createOperatorSubscriber(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))}},2588:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(6929),i=r(6097),o=r(7326),s=r(6958),a=r(8069);t.repeat=function(e){var t,r,c=1/0;return null!=e&&("object"==typeof e?(t=e.count,c=void 0===t?1/0:t,r=e.delay):c=e),c<=0?function(){return n.EMPTY}:i.operate((function(e,t){var n,i=0,u=function(){if(null==n||n.unsubscribe(),n=null,null!=r){var e="number"==typeof r?a.timer(r):s.innerFrom(r(i)),c=o.createOperatorSubscriber(t,(function(){c.unsubscribe(),l()}));e.subscribe(c)}else l()},l=function(){var r=!1;n=e.subscribe(o.createOperatorSubscriber(t,void 0,(function(){++i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(6958),i=r(5294),o=r(6097),s=r(7326);t.repeatWhen=function(e){return o.operate((function(t,r){var o,a,c=!1,u=!1,l=!1,f=function(){return l&&u&&(r.complete(),!0)},d=function(){l=!1,o=t.subscribe(s.createOperatorSubscriber(r,void 0,(function(){l=!0,!f()&&(a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){o?d():c=!0}),(function(){u=!0,f()})))),a).next()}))),c&&(o.unsubscribe(),o=null,c=!1,d())};d()}))}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(6097),i=r(7326),o=r(8987),s=r(8069),a=r(6958);t.retry=function(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,c=void 0===r?1/0:r,u=t.delay,l=t.resetOnSuccess,f=void 0!==l&&l;return c<=0?o.identity:n.operate((function(e,t){var r,n=0,o=function(){var l=!1;r=e.subscribe(i.createOperatorSubscriber(t,(function(e){f&&(n=0),t.next(e)}),void 0,(function(e){if(n++{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(6958),i=r(5294),o=r(6097),s=r(7326);t.retryWhen=function(e){return o.operate((function(t,r){var o,a,c=!1,u=function(){o=t.subscribe(s.createOperatorSubscriber(r,void 0,void 0,(function(t){a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){return o?u():c=!0})))),a&&a.next(t)}))),c&&(o.unsubscribe(),o=null,c=!1,u())};u()}))}},778:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(6958),i=r(6097),o=r(7116),s=r(7326);t.sample=function(e){return i.operate((function(t,r){var i=!1,a=null;t.subscribe(s.createOperatorSubscriber(r,(function(e){i=!0,a=e}))),n.innerFrom(e).subscribe(s.createOperatorSubscriber(r,(function(){if(i){i=!1;var e=a;a=null,r.next(e)}}),o.noop))}))}},7701:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(7152),i=r(778),o=r(3154);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},8167:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(6097),i=r(7235);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},7235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(7326);t.scanInternals=function(e,t,r,i,o){return function(s,a){var c=r,u=t,l=0;s.subscribe(n.createOperatorSubscriber(a,(function(t){var r=l++;u=c?e(u,t,r):(c=!0,t),i&&a.next(u)}),o&&function(){c&&a.next(u),a.complete()}))}}},7821:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(6097),i=r(7326),o=r(6958);t.sequenceEqual=function(e,t){return void 0===t&&(t=function(e,t){return e===t}),n.operate((function(r,n){var s={buffer:[],complete:!1},a={buffer:[],complete:!1},c=function(e){n.next(e),n.complete()},u=function(e,r){var o=i.createOperatorSubscriber(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?c(!1):e.buffer.push(n):!t(n,i.shift())&&c(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&c(0===n.length),null==o||o.unsubscribe()}));return o};r.subscribe(u(s,a)),o.innerFrom(e).subscribe(u(a,s))}))}},2645:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0&&(t=new a.SafeSubscriber({next:function(e){return v.next(e)},error:function(e){p=!0,b(),n=u(m,i,e),v.error(e)},complete:function(){d=!0,b(),n=u(m,f),v.complete()}}),o.innerFrom(e).subscribe(t))}))(e)}}},7566:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(8806),i=r(2645);t.shareReplay=function(e,t,r){var o,s,a,c,u=!1;return e&&"object"==typeof e?(o=e.bufferSize,c=void 0===o?1/0:o,s=e.windowTime,t=void 0===s?1/0:s,u=void 0!==(a=e.refCount)&&a,r=e.scheduler):c=null!=e?e:1/0,i.share({connector:function(){return new n.ReplaySubject(c,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}},4610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(9088),i=r(7298),o=r(5722),s=r(6097),a=r(7326);t.single=function(e){return s.operate((function(t,r){var s,c=!1,u=!1,l=0;t.subscribe(a.createOperatorSubscriber(r,(function(n){u=!0,e&&!e(n,l++,t)||(c&&r.error(new i.SequenceError("Too many matching values")),c=!0,s=n)}),(function(){c?(r.next(s),r.complete()):r.error(u?new o.NotFoundError("No matching values"):new n.EmptyError)})))}))}},5735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(7261);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},3252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(8987),i=r(6097),o=r(7326);t.skipLast=function(e){return e<=0?n.identity:i.operate((function(t,r){var n=new Array(e),i=0;return t.subscribe(o.createOperatorSubscriber(r,(function(t){var o=i++;if(o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(6097),i=r(7326),o=r(6958),s=r(7116);t.skipUntil=function(e){return n.operate((function(t,r){var n=!1,a=i.createOperatorSubscriber(r,(function(){null==a||a.unsubscribe(),n=!0}),s.noop);o.innerFrom(e).subscribe(a),t.subscribe(i.createOperatorSubscriber(r,(function(e){return n&&r.next(e)})))}))}},5454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(6097),i=r(7326);t.skipWhile=function(e){return n.operate((function(t,r){var n=!1,o=0;t.subscribe(i.createOperatorSubscriber(r,(function(t){return(n||(n=!e(t,o++)))&&r.next(t)})))}))}},1923:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(3364),i=r(4544),o=r(6097);t.startWith=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(6097);t.subscribeOn=function(e,t){return void 0===t&&(t=0),n.operate((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}},1695:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(6649),i=r(8987);t.switchAll=function(){return n.switchMap(i.identity)}},6649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(6958),i=r(6097),o=r(7326);t.switchMap=function(e,t){return i.operate((function(r,i){var s=null,a=0,c=!1,u=function(){return c&&!s&&i.complete()};r.subscribe(o.createOperatorSubscriber(i,(function(r){null==s||s.unsubscribe();var c=0,l=a++;n.innerFrom(e(r,l)).subscribe(s=o.createOperatorSubscriber(i,(function(e){return i.next(t?t(r,e,l,c++):e)}),(function(){s=null,u()})))}),(function(){c=!0,u()})))}))}},3054:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(6649),i=r(2935);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},2890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(6649),i=r(6097);t.switchScan=function(e,t){return i.operate((function(r,i){var o=t;return n.switchMap((function(t,r){return e(o,t,r)}),(function(e,t){return o=t,t}))(r).subscribe(i),function(){o=null}}))}},9438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(6929),i=r(6097),o=r(7326);t.take=function(e){return e<=0?function(){return n.EMPTY}:i.operate((function(t,r){var n=0;t.subscribe(o.createOperatorSubscriber(r,(function(t){++n<=e&&(r.next(t),e<=n&&r.complete())})))}))}},4125:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.takeLast=void 0;var i=r(6929),o=r(6097),s=r(7326);t.takeLast=function(e){return e<=0?function(){return i.EMPTY}:o.operate((function(t,r){var i=[];t.subscribe(s.createOperatorSubscriber(r,(function(t){i.push(t),e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(6097),i=r(7326),o=r(6958),s=r(7116);t.takeUntil=function(e){return n.operate((function(t,r){o.innerFrom(e).subscribe(i.createOperatorSubscriber(r,(function(){return r.complete()}),s.noop)),!r.closed&&t.subscribe(r)}))}},5884:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(6097),i=r(7326);t.takeWhile=function(e,t){return void 0===t&&(t=!1),n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){var i=e(r,o++);(i||t)&&n.next(r),!i&&n.complete()})))}))}},5383:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(2935),i=r(6097),o=r(7326),s=r(8987);t.tap=function(e,t,r){var a=n.isFunction(e)||t||r?{next:e,error:t,complete:r}:e;return a?i.operate((function(e,t){var r;null===(r=a.subscribe)||void 0===r||r.call(a);var n=!0;e.subscribe(o.createOperatorSubscriber(t,(function(e){var r;null===(r=a.next)||void 0===r||r.call(a,e),t.next(e)}),(function(){var e;n=!1,null===(e=a.complete)||void 0===e||e.call(a),t.complete()}),(function(e){var r;n=!1,null===(r=a.error)||void 0===r||r.call(a,e),t.error(e)}),(function(){var e,t;n&&(null===(e=a.unsubscribe)||void 0===e||e.call(a)),null===(t=a.finalize)||void 0===t||t.call(a)})))})):s.identity}},1016:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(6097),i=r(7326),o=r(6958);t.throttle=function(e,t){return n.operate((function(r,n){var s=null!=t?t:{},a=s.leading,c=void 0===a||a,u=s.trailing,l=void 0!==u&&u,f=!1,d=null,h=null,p=!1,b=function(){null==h||h.unsubscribe(),h=null,l&&(v(),p&&n.complete())},m=function(){h=null,p&&n.complete()},g=function(t){return h=o.innerFrom(e(t)).subscribe(i.createOperatorSubscriber(n,b,m))},v=function(){if(f){f=!1;var e=d;d=null,n.next(e),!p&&g(e)}};r.subscribe(i.createOperatorSubscriber(n,(function(e){f=!0,d=e,(!h||h.closed)&&(c?v():g(e))}),(function(){p=!0,(!(l&&f&&h)||h.closed)&&n.complete()})))}))}},567:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(7152),i=r(1016),o=r(8069);t.throttleTime=function(e,t,r){void 0===t&&(t=n.asyncScheduler);var s=o.timer(e,t);return i.throttle((function(){return s}),r)}},1332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(9088),i=r(6097),o=r(7326);function s(){return new n.EmptyError}t.throwIfEmpty=function(e){return void 0===e&&(e=s),i.operate((function(t,r){var n=!1;t.subscribe(o.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){return n?r.complete():r.error(e())})))}))}},1149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(7152),i=r(6097),o=r(7326);t.timeInterval=function(e){return void 0===e&&(e=n.asyncScheduler),i.operate((function(t,r){var n=e.now();t.subscribe(o.createOperatorSubscriber(r,(function(t){var i=e.now(),o=i-n;n=i,r.next(new s(t,o))})))}))};var s=function(e,t){this.value=e,this.interval=t};t.TimeInterval=s},1316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(7152),i=r(4426),o=r(6097),s=r(6958),a=r(3126),c=r(7326),u=r(5267);function l(e){throw new t.TimeoutError(e)}t.TimeoutError=a.createErrorClass((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),t.timeout=function(e,t){var r=i.isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,a=r.first,f=r.each,d=r.with,h=void 0===d?l:d,p=r.scheduler,b=void 0===p?null!=t?t:n.asyncScheduler:p,m=r.meta,g=void 0===m?null:m;if(null==a&&null==f)throw new TypeError("No timeout provided.");return o.operate((function(e,t){var r,n,i=null,o=0,l=function(e){n=u.executeSchedule(t,b,(function(){try{r.unsubscribe(),s.innerFrom(h({meta:g,lastValue:i,seen:o})).subscribe(t)}catch(e){t.error(e)}}),e)};r=e.subscribe(c.createOperatorSubscriber(t,(function(e){null==n||n.unsubscribe(),o++,t.next(i=e),f>0&&l(f)}),void 0,void 0,(function(){(null==n?void 0:n.closed)||null==n||n.unsubscribe(),i=null}))),!o&&l(null!=a?"number"==typeof a?a:+a-b.now():f)}))}},4972:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(7152),i=r(4426),o=r(1316);t.timeoutWith=function(e,t,r){var s,a,c;if(r=null!=r?r:n.async,i.isValidDate(e)?s=e:"number"==typeof e&&(a=e),!t)throw new TypeError("No observable provided to switch to");if(c=function(){return t},null==s&&null==a)throw new TypeError("No timeout provided.");return o.timeout({first:s,each:a,scheduler:r,with:c})}},1275:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(9168),i=r(6269);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},9867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(8083),i=r(6097),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},7649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(5294),i=r(6097),o=r(7326),s=r(7116),a=r(6958);t.window=function(e){return i.operate((function(t,r){var i=new n.Subject;r.next(i.asObservable());var c=function(e){i.error(e),r.error(e)};return t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==i?void 0:i.next(e)}),(function(){i.complete(),r.complete()}),c)),a.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){i.complete(),r.next(i=new n.Subject)}),s.noop,c)),function(){null==i||i.unsubscribe(),i=null}}))}},5612:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowCount=void 0;var i=r(5294),o=r(6097),s=r(7326);t.windowCount=function(e,t){void 0===t&&(t=0);var r=t>0?t:e;return o.operate((function(t,o){var a=[new i.Subject],c=0;o.next(a[0].asObservable()),t.subscribe(s.createOperatorSubscriber(o,(function(t){var s,u;try{for(var l=n(a),f=l.next();!f.done;f=l.next()){f.value.next(t)}}catch(e){s={error:e}}finally{try{f&&!f.done&&(u=l.return)&&u.call(l)}finally{if(s)throw s.error}}var d=c-e+1;if(d>=0&&d%r==0&&a.shift().complete(),++c%r==0){var h=new i.Subject;a.push(h),o.next(h.asObservable())}}),(function(){for(;a.length>0;)a.shift().complete();o.complete()}),(function(e){for(;a.length>0;)a.shift().error(e);o.error(e)}),(function(){null,a=null})))}))}},9972:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(5294),i=r(7152),o=r(4666),s=r(6097),a=r(7326),c=r(1291),u=r(4544),l=r(5267);t.windowTime=function(e){for(var t,r,f=[],d=1;d=0?l.executeSchedule(r,h,f,p,!0):s=!0,f();var d=function(e){return i.slice().forEach(e)},m=function(e){d((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(a.createOperatorSubscriber(r,(function(e){d((function(t){t.window.next(e),b<=++t.seen&&u(t)}))}),(function(){return m((function(e){return e.complete()}))}),(function(e){return m((function(t){return t.error(e)}))}))),function(){i=null}}))}},9593:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowToggle=void 0;var i=r(5294),o=r(4666),s=r(6097),a=r(6958),c=r(7326),u=r(7116),l=r(1291);t.windowToggle=function(e,t){return s.operate((function(r,s){var f=[],d=function(e){for(;0{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(5294),i=r(6097),o=r(7326),s=r(6958);t.windowWhen=function(e){return i.operate((function(t,r){var i,a,c=function(e){i.error(e),r.error(e)},u=function(){var t;null==a||a.unsubscribe(),null==i||i.complete(),i=new n.Subject,r.next(i.asObservable());try{t=s.innerFrom(e())}catch(e){return void c(e)}t.subscribe(a=o.createOperatorSubscriber(r,u,u,c))};u(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return i.next(e)}),(function(){i.complete(),r.complete()}),c,(function(){null==a||a.unsubscribe(),i=null})))}))}},5512:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(4981),i=r(2208);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},7594:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(4174);t.scheduleArray=function(e,t){return new n.Observable((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}},4271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(4174),i=r(5267);t.scheduleAsyncIterable=function(e,t){if(!e)throw new Error("Iterable cannot be null");return new n.Observable((function(r){i.executeSchedule(r,t,(function(){var n=e[Symbol.asyncIterator]();i.executeSchedule(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}},2485:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(4174),i=r(7630),o=r(2935),s=r(5267);t.scheduleIterable=function(e,t){return new n.Observable((function(r){var n;return s.executeSchedule(r,t,(function(){n=e[i.iterator](),s.executeSchedule(r,t,(function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){return void r.error(e)}i?r.complete():r.next(t)}),0,!0)})),function(){return o.isFunction(null==n?void 0:n.return)&&n.return()}}))}},5892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(6958),i=r(9314),o=r(9130);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},6976:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(6958),i=r(9314),o=r(9130);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},4260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(4271),i=r(2221);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},2862:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(5892),i=r(6976),o=r(7456),s=r(2485),a=r(4271),c=r(3124),u=r(4283),l=r(5445),f=r(8131),d=r(3260),h=r(7756),p=r(2221),b=r(4260);t.scheduled=function(e,t){if(null!=e){if(c.isInteropObservable(e))return n.scheduleObservable(e,t);if(l.isArrayLike(e))return o.scheduleArray(e,t);if(u.isPromise(e))return i.schedulePromise(e,t);if(d.isAsyncIterable(e))return a.scheduleAsyncIterable(e,t);if(f.isIterable(e))return s.scheduleIterable(e,t);if(p.isReadableStreamLike(e))return b.scheduleReadableStreamLike(e,t)}throw h.createInvalidObservableTypeError(e)}},2502:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var o=function(e){function t(t,r){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(4666).Subscription);t.Action=o},2142:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationFrameAction=void 0;var o=r(9462),s=r(9015),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=s.animationFrameProvider.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var o=t.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(s.animationFrameProvider.cancelAnimationFrame(r),t._scheduled=void 0)},t}(o.AsyncAction);t.AnimationFrameAction=a},7104:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationFrameScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(r(9812).AsyncScheduler);t.AnimationFrameScheduler=o},4151:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsapAction=void 0;var o=r(9462),s=r(4409),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=s.immediateProvider.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var o=t.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(s.immediateProvider.clearImmediate(r),t._scheduled===r&&(t._scheduled=void 0))},t}(o.AsyncAction);t.AsapAction=a},4726:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsapScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(r(9812).AsyncScheduler);t.AsapScheduler=o},9462:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var o=r(2502),s=r(7549),a=r(1291),c=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return i(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),s.intervalProvider.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&s.intervalProvider.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,a.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(o.Action);t.AsyncAction=c},9812:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var o=r(6949),s=function(e){function t(t,r){void 0===r&&(r=o.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(o.Scheduler);t.AsyncScheduler=s},5336:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.QueueAction=void 0;var o=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.flush(this),0)},t}(r(9462).AsyncAction);t.QueueAction=o},3667:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.QueueScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(9812).AsyncScheduler);t.QueueScheduler=o},2929:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualAction=t.VirtualTimeScheduler=void 0;var o=r(9462),s=r(4666),a=function(e){function t(t,r){void 0===t&&(t=c),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return i(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(r(9812).AsyncScheduler);t.VirtualTimeScheduler=a;var c=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.index=n,i.active=!0,i.index=t.index=n,i}return i(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return s.Subscription.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var i=e.actions;return i.push(this),i.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(o.AsyncAction);t.VirtualAction=c},8989:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.animationFrame=t.animationFrameScheduler=void 0;var n=r(2142),i=r(7104);t.animationFrameScheduler=new i.AnimationFrameScheduler(n.AnimationFrameAction),t.animationFrame=t.animationFrameScheduler},9015:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asap=t.asapScheduler=void 0;var n=r(4151),i=r(4726);t.asapScheduler=new i.AsapScheduler(n.AsapAction),t.asap=t.asapScheduler},7152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(9462),i=r(9812);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},9168:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateTimestampProvider=void 0,t.dateTimestampProvider={now:function(){return(t.dateTimestampProvider.delegate||Date).now()},delegate:void 0}},4409:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.performanceTimestampProvider=void 0,t.performanceTimestampProvider={now:function(){return(t.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}},4093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.queue=t.queueScheduler=void 0;var n=r(5336),i=r(3667);t.queueScheduler=new i.QueueScheduler(n.QueueAction),t.queue=t.queueScheduler},1577:function(e,t){"use strict";var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(t,"__esModule",{value:!0}),t.iterator=t.getSymbolIterator=void 0,t.getSymbolIterator=r,t.iterator=r()},4595:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},2793:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9216:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(3126);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},9088:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(3126);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},998:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TestTools=t.Immediate=void 0;var r,n=1,i={};function o(e){return e in i&&(delete i[e],!0)}t.Immediate={setImmediate:function(e){var t=n++;return i[t]=!0,r||(r=Promise.resolve()),r.then((function(){return o(t)&&e()})),t},clearImmediate:function(e){o(e)}},t.TestTools={pending:function(){return Object.keys(i).length}}},5722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(3126);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},8499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(3126);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},7298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(3126);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},4043:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(3126);t.UnsubscriptionError=n.createErrorClass((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}))},4544:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(2935),i=r(9668);function o(e){return e[e.length-1]}t.popResultSelector=function(e){return n.isFunction(o(e))?e.pop():void 0},t.popScheduler=function(e){return i.isScheduler(o(e))?e.pop():void 0},t.popNumber=function(e,t){return"number"==typeof o(e)?e.pop():t}},2398:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argsArgArrayOrObject=void 0;var r=Array.isArray,n=Object.getPrototypeOf,i=Object.prototype,o=Object.keys;t.argsArgArrayOrObject=function(e){if(1===e.length){var t=e[0];if(r(t))return{args:t,keys:null};if((a=t)&&"object"==typeof a&&n(a)===i){var s=o(t);return{args:s.map((function(e){return t[e]})),keys:s}}}var a;return{args:e,keys:null}}},5034:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argsOrArgArray=void 0;var r=Array.isArray;t.argsOrArgArray=function(e){return 1===e.length&&r(e[0])?e[0]:e}},1291:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrRemove=void 0,t.arrRemove=function(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}},3126:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorClass=void 0,t.createErrorClass=function(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},4800:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createObject=void 0,t.createObject=function(e,t){return e.reduce((function(e,r,n){return e[r]=t[n],e}),{})}},5444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(9179),i=null;t.errorContext=function(e){if(n.config.useDeprecatedSynchronousErrorHandling){var t=!i;if(t&&(i={errorThrown:!1,error:null}),e(),t){var r=i,o=r.errorThrown,s=r.error;if(i=null,o)throw s}}else e()},t.captureError=function(e){n.config.useDeprecatedSynchronousErrorHandling&&i&&(i.errorThrown=!0,i.error=e)}},5267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeSchedule=void 0,t.executeSchedule=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule((function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(o),!i)return o}},8987:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},5445:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayLike=void 0,t.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},3260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(2935);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},4426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},2935:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},3124:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(4595),i=r(2935);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},8131:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(7630),i=r(2935);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},3659:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObservable=void 0;var n=r(4174),i=r(2935);t.isObservable=function(e){return!!e&&(e instanceof n.Observable||i.isFunction(e.lift)&&i.isFunction(e.subscribe))}},4283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(2935);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},2221:function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof i?Promise.resolve(r.value.v).then(u,l):f(s[0][2],r)}catch(e){f(s[0][3],e)}var r}function u(e){c("next",e)}function l(e){c("throw",e)}function f(e,t){e(t),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(t,"__esModule",{value:!0}),t.isReadableStreamLike=t.readableStreamLikeToAsyncGenerator=void 0;var s=r(2935);t.readableStreamLikeToAsyncGenerator=function(e){return o(this,arguments,(function(){var t,r,o;return n(this,(function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,i(t.read())];case 3:return r=n.sent(),o=r.value,r.done?[4,i(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,i(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))},t.isReadableStreamLike=function(e){return s.isFunction(null==e?void 0:e.getReader)}},9668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(2935);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},6097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(2935);function i(e){return n.isFunction(null==e?void 0:e.lift)}t.hasLift=i,t.operate=function(e){return function(t){if(i(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}},9364:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},8781:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.not=void 0,t.not=function(e,t){return function(r,n){return!e.call(t,r,n)}}},5250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(8987);function i(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}t.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(9179),i=r(1577);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},7756:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createInvalidObservableTypeError=void 0,t.createInvalidObservableTypeError=function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},9002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=t.merge=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.concat=t.combineLatestWith=t.combineLatest=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=void 0,t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.race=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.partition=t.pairwise=t.onErrorResumeNext=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=void 0,t.zipWith=t.zipAll=t.zip=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=void 0;var n=r(2605);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(4152);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(5149);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(3189);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(9459);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var c=r(8145);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return c.bufferToggle}});var u=r(7764);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return u.bufferWhen}});var l=r(3056);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var f=r(498);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return f.combineAll}});var d=r(7484);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var h=r(6527);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return h.combineLatest}});var p=r(4755);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var b=r(3792);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return b.concat}});var m=r(482);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return m.concatAll}});var g=r(1774);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return g.concatMap}});var v=r(3977);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return v.concatMapTo}});var y=r(7672);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return y.concatWith}});var _=r(5561);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var w=r(8259);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return w.count}});var E=r(3473);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return E.debounce}});var O=r(8390);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return O.debounceTime}});var A=r(4562);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return A.defaultIfEmpty}});var S=r(8151);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return S.delay}});var P=r(744);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return P.delayWhen}});var T=r(8590);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return T.dematerialize}});var I=r(8406);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return I.distinct}});var R=r(7300);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return R.distinctUntilChanged}});var x=r(4405);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return x.distinctUntilKeyChanged}});var M=r(2787);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return M.elementAt}});var k=r(1665);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return k.endWith}});var L=r(1511);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return L.every}});var N=r(5592);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return N.exhaust}});var C=r(2008);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return C.exhaustAll}});var j=r(4019);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return j.exhaustMap}});var D=r(9101);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return D.expand}});var U=r(7261);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return U.filter}});var B=r(5381);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return B.finalize}});var F=r(4127);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return F.find}});var K=r(9727);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return K.findIndex}});var H=r(7418);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return H.first}});var G=r(7533);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return G.groupBy}});var $=r(9186);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return $.ignoreElements}});var V=r(7757);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return V.isEmpty}});var z=r(3374);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return z.last}});var q=r(6269);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return q.map}});var W=r(5471);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return W.mapTo}});var Z=r(1160);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return Z.materialize}});var J=r(1890);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return J.max}});var Y=r(3982);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return Y.merge}});var X=r(400);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Q=r(9121);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Q.flatMap}});var ee=r(6086);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(1244);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(3699);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(8220);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(770);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(8413);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(9314);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(1899);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ce=r(1186);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ce.pairwise}});var ue=r(9857);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ue.partition}});var le=r(9532);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var fe=r(5745);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return fe.publish}});var de=r(8103);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var he=r(2610);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return he.publishLast}});var pe=r(5299);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var be=r(6699);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return be.race}});var me=r(3820);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return me.raceWith}});var ge=r(8083);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return ge.reduce}});var ve=r(2588);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return ve.repeat}});var ye=r(9249);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ye.repeatWhen}});var _e=r(4486);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var we=r(9112);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return we.retryWhen}});var Ee=r(4508);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Ee.refCount}});var Oe=r(778);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Oe.sample}});var Ae=r(7701);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Ae.sampleTime}});var Se=r(8167);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Se.scan}});var Pe=r(7821);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Pe.sequenceEqual}});var Te=r(2645);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Te.share}});var Ie=r(7566);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Ie.shareReplay}});var Re=r(4610);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Re.single}});var xe=r(5735);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return xe.skip}});var Me=r(3252);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return Me.skipLast}});var ke=r(1779);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return ke.skipUntil}});var Le=r(5454);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return Le.skipWhile}});var Ne=r(1923);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Ne.startWith}});var Ce=r(9130);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ce.subscribeOn}});var je=r(1695);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return je.switchAll}});var De=r(6649);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return De.switchMap}});var Ue=r(3054);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return Ue.switchMapTo}});var Be=r(2890);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Be.switchScan}});var Fe=r(9438);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Fe.take}});var Ke=r(4125);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Ke.takeLast}});var He=r(9008);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return He.takeUntil}});var Ge=r(5884);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ge.takeWhile}});var $e=r(5383);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return $e.tap}});var Ve=r(1016);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ve.throttle}});var ze=r(567);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return ze.throttleTime}});var qe=r(1332);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return qe.throwIfEmpty}});var We=r(1149);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return We.timeInterval}});var Ze=r(1316);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return Ze.timeout}});var Je=r(4972);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Je.timeoutWith}});var Ye=r(1275);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Ye.timestamp}});var Xe=r(9867);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Qe=r(7649);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Qe.window}});var et=r(5612);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(9972);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(9593);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(6307);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(5512);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(586);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(1221);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(7594);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},8743:e=>{e.exports=function(e){return ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e)}},227:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DeprecationError:()=>S,InvalidAddressError:()=>l,InvalidAmountError:()=>d,InvalidBlockHashError:()=>f,InvalidChainIdError:()=>w,InvalidContractAddressError:()=>_,InvalidDerivationPathError:()=>h,InvalidHexStringError:()=>p,InvalidKeyError:()=>g,InvalidKeyHashError:()=>E,InvalidMessageError:()=>b,InvalidOperationHashError:()=>O,InvalidOperationKindError:()=>A,InvalidPublicKeyError:()=>v,InvalidSignatureError:()=>y,InvalidViewParameterError:()=>m,NetworkError:()=>c,ParameterValidationError:()=>i,PermissionDeniedError:()=>u,ProhibitedActionError:()=>P,PublicKeyNotFoundError:()=>T,RpcError:()=>o,TaquitoError:()=>n,TezosToolkitConfigError:()=>s,UnsupportedActionError:()=>a});class n extends Error{}class i extends n{}class o extends n{}class s extends n{}class a extends n{}class c extends n{}class u extends n{}class l extends i{constructor(e,t){super(),this.address=e,this.errorDetail=t,this.name="InvalidAddressError",this.message=`Invalid address "${e}"`,this.message+=t?` ${t}.`:"."}}class f extends i{constructor(e,t){super(),this.blockHash=e,this.errorDetail=t,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${e}"`,this.message+=t?` ${t}.`:"."}}class d extends i{constructor(e){super(),this.amount=e,this.name="InvalidAmountError",this.message=`Invalid amount "${e}"`}}class h extends i{constructor(e,t){super(),this.derivationPath=e,this.errorDetail=t,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${e}"`,this.message+=t?` ${t}.`:"."}}class p extends i{constructor(e,t){super(),this.hexString=e,this.errorDetail=t,this.name="InvalidHexStringError",this.message=`Invalid hex string "${e}"`,this.message+=t?` ${t}.`:"."}}class b extends i{constructor(e,t){super(),this.msg=e,this.errorDetail=t,this.name="InvalidMessageError",this.message=`Invalid message "${e}"`,this.message+=t?` ${t}.`:"."}}class m extends i{constructor(e,t,r,n){super(),this.viewName=e,this.sigs=t,this.args=r,this.cause=n,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(r)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(t)}.`}}class g extends i{constructor(e){super(),this.errorDetail=e,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=e?` ${e}.`:"."}}class v extends i{constructor(e,t){super(),this.publicKey=e,this.errorDetail=t,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${e}"`,this.message+=t?` ${t}.`:"."}}class y extends i{constructor(e,t){super(),this.signature=e,this.errorDetail=t,this.name="InvalidSignatureError",this.message=`Invalid signature "${e}"`,this.message+=t?` ${t}.`:"."}}class _ extends i{constructor(e,t){super(),this.contractAddress=e,this.errorDetail=t,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${e}"`,this.message+=t?` ${t}.`:"."}}class w extends i{constructor(e,t){super(),this.chainId=e,this.errorDetail=t,this.name="InvalidChainIdError",this.message=`Invalid chain id "${e}"`,this.message+=t?` ${t}.`:"."}}class E extends i{constructor(e,t){super(),this.keyHash=e,this.errorDetail=t,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${e}"`,this.message+=t?` ${t}.`:"."}}class O extends i{constructor(e,t){super(),this.operationHash=e,this.errorDetail=t,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${e}"`,this.message+=t?` ${t}.`:"."}}class A extends i{constructor(e,t){super(),this.operationKind=e,this.errorDetail=t,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${e}"`,this.message+=t?` ${t}.`:"."}}class S extends a{constructor(e){super(),this.message=e,this.name="DeprecationError"}}class P extends a{constructor(e){super(),this.message=e,this.name="ProhibitedActionError"}}class T extends n{constructor(e,t){super(),this.pkh=e,this.cause=t,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${e}" in either wallet or contract API.`}}},5543:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HttpBackend:()=>d,HttpRequestFailed:()=>s,HttpResponseError:()=>a,HttpTimeoutError:()=>c,STATUS_CODE:()=>n,VERSION:()=>u});var n,i=r(227);function o(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s extends i.NetworkError{constructor(e,t,r){super(),this.method=e,this.url=t,this.cause=r,this.name="HttpRequestFailed",this.message=`${e} ${t} ${String(r)}`}}class a extends i.NetworkError{constructor(e,t,r,n,i){super(),this.message=e,this.status=t,this.statusText=r,this.body=n,this.url=i,this.name="HttpResponseError"}}class c extends i.NetworkError{constructor(e,t){super(),this.timeout=e,this.url=t,this.name="HttpTimeoutError",this.message=`HTTP request timeout of ${e}ms exceeded`}}!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.ALREADY_REPORTED=208]="ALREADY_REPORTED",e[e.IM_USED=226]="IM_USED",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.SWITCH_PROXY=306]="SWITCH_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(n||(n={}));const u={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"};var l;let f=null===globalThis||void 0===globalThis?void 0:globalThis.fetch;"undefined"!=typeof process&&!!(null===(l=null===process||void 0===process?void 0:process.versions)||void 0===l?void 0:l.node)&&(f=r(4986));class d{constructor(e=3e4){this.timeout=e}serialize(e){if(!e)return"";const t=[];for(const r in e)if(e.hasOwnProperty(r)&&void 0!==e[r]){const n="function"==typeof e[r].toJSON?e[r].toJSON():e[r];if(null===n){t.push(encodeURIComponent(r));continue}if(Array.isArray(n)){n.forEach((e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}));continue}t.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}const r=t.join("&");return r?`?${r}`:""}createRequest({url:e,method:t,timeout:r=this.timeout,query:n,headers:i={},json:u=!0},l){return o(this,void 0,void 0,(function*(){const o=e+this.serialize(n);i["Content-Type"]||(i["Content-Type"]="application/json");const d=new AbortController,h=setTimeout((()=>d.abort()),r);try{const e=yield f(o,{method:t,headers:i,body:JSON.stringify(l),signal:d.signal});if(void 0===e)throw new Error("Response is undefined");if(e.status>=400){const t=yield e.text();throw new a(`Http error response: (${e.status}) ${t}`,e.status,e.statusText,t,o)}return u?e.json():e.text()}catch(e){throw e instanceof Error&&"AbortError"===e.name?new c(r,o):e instanceof a?e:new s(String(t),o,e)}finally{clearTimeout(h)}}))}}},4986:(e,t,r)=>{"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},5078:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CODEC:()=>c,LocalForger:()=>je,ProtocolsHash:()=>ke,Uint8ArrayConsumer:()=>T,VERSION:()=>Le,decoders:()=>Ie,encoders:()=>Re,getCodec:()=>Ce,localForger:()=>De,opMapping:()=>u,opMappingReverse:()=>l});var n=r(4632),i=r(227),o=r(2558);const s=e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),a=(e,t=8)=>e.toString(16).padStart(t,"0");var c;!function(e){e.SECRET="secret",e.RAW="raw",e.TZ1="tz1",e.BRANCH="branch",e.ZARITH="zarith",e.PUBLIC_KEY="public_key",e.PKH="pkh",e.PKH_ARR="pkhArr",e.DELEGATE="delegate",e.SCRIPT="script",e.BALLOT_STATEMENT="ballotStmt",e.PROPOSAL="proposal",e.PROPOSAL_ARR="proposalArr",e.INT32="int32",e.INT16="int16",e.PARAMETERS="parameters",e.ADDRESS="address",e.SMART_CONTRACT_ADDRESS="smart_contract_address",e.SMART_ROLLUP_ADDRESS="smart_rollup_address",e.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",e.VALUE="value",e.PADDED_BYTES="padded_bytes",e.SMART_ROLLUP_MESSAGE="smart_rollup_message",e.MANAGER="manager",e.BLOCK_PAYLOAD_HASH="blockPayloadHash",e.ENTRYPOINT="entrypoint",e.OPERATION="operation",e.OP_ACTIVATE_ACCOUNT="activate_account",e.OP_DELEGATION="delegation",e.OP_TRANSACTION="transaction",e.OP_ORIGINATION="origination",e.OP_BALLOT="ballot",e.OP_FAILING_NOOP="failing_noop",e.OP_ATTESTATION="attestation",e.OP_ENDORSEMENT="endorsement",e.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",e.OP_REVEAL="reveal",e.OP_PROPOSALS="proposals",e.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",e.OP_TRANSFER_TICKET="transfer_ticket",e.BURN_LIMIT="burn_limit",e.OP_INCREASE_PAID_STORAGE="increase_paid_storage",e.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",e.OP_DRAIN_DELEGATE="drain_delegate",e.DEPOSITS_LIMIT="deposits_limit",e.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",e.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",e.PVM_KIND="pvm_kind",e.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",e.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message"}(c||(c={}));const u={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction_deprecated",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET_DEPRECATED",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ",94:"tx_rollup_l2_address",95:"MIN_BLOCK_TIME",96:"sapling_transaction",97:"EMIT",98:"Lambda_rec",99:"LAMBDA_REC","9a":"TICKET","9b":"BYTES","9c":"NAT"},l=(()=>{const e={};return Object.keys(u).forEach((t=>{e[u[t]]=t})),e})(),f={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",21:"attestation",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant",158:"transfer_ticket",112:"set_deposits_limit",113:"increase_paid_storage",114:"update_consensus_key",9:"drain_delegate",200:"smart_rollup_originate",201:"smart_rollup_add_messages",206:"smart_rollup_execute_outbox_message",17:"failing_noop"},d=(()=>{const e={};return Object.keys(f).forEach((t=>{const r="string"==typeof t?parseInt(t,10):t;e[f[r]]=a(r,2)})),e})(),h={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate","05":"deposit"},p=(()=>{const e={};return Object.keys(h).forEach((t=>{e[h[t]]=t})),e})();class b extends i.ParameterValidationError{constructor(e,t){super(),this.operation=e,this.errorDetail=t,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",t&&(this.message+=` ${t}.`)}}class m extends i.ParameterValidationError{constructor(e){super(),this.entrypoint=e,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${e.length}", maximum length is "31".`}}class g extends i.ParameterValidationError{constructor(e){super(),this.ballotValue=e,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${e}" expecting one of the following: "yay", "nay", "pass".`}}class v extends i.ParameterValidationError{constructor(e){super(),this.ballotValue=e,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${e}", cannot be decoded.`}}class y extends i.ParameterValidationError{constructor(e){super(),this.value=e,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${e}", unalbe to encode.`}}class _ extends i.ParameterValidationError{constructor(e){super(),this.message=e,this.name="OperationDecodingError"}}class w extends i.ParameterValidationError{constructor(e){super(),this.message=e,this.name="OperationEncodingError"}}class E extends i.ParameterValidationError{constructor(e){super(),this.op=e,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${e}", can submit an issue on our github for feature request.`}}class O extends i.ParameterValidationError{constructor(e){super(),this.pvm=e,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${e}" expecting either "arith" or "wasm_2_0_0".`}}class A extends i.ParameterValidationError{constructor(e){super(),this.pvm=e,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${e}", cannot be decoded.`}}class S extends i.ParameterValidationError{constructor(e,t){super(),this.address=e,this.errorDetail=t,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${e}"`,t&&(this.message+=` ${t}.`)}}class P extends i.ParameterValidationError{constructor(e,t){super(),this.hash=e,this.errorDetail=t,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${e}"`,t&&(this.message+=` ${t}.`)}}class T{static fromHexString(e){const t=e.toLowerCase();if(/^(([a-f]|\d){2})*$/.test(t)){const e=new Uint8Array((t.match(/([a-z]|\d){2}/g)||[]).map((e=>parseInt(e,16))));return new T(e)}throw new i.InvalidHexStringError(t)}constructor(e,t=0){this.arr=e,this.offset=t}consume(e){const t=this.arr.subarray(this.offset,this.offset+e);return this.offset+=e,t}get(e){return this.arr[this.offset+e]}length(){return this.arr.length-this.offset}slice(e,t){return new T(this.arr.slice(e,t))}}const I=e=>{if(Array.isArray(e)){const t=e.map((e=>I(e))).join(""),r=t.length/2;return`02${a(r)}${t}`}if((e=>"prim"in e)(e))return D(e);if((e=>"bytes"in e&&"string"==typeof e.bytes)(e))return M(e);if((e=>"string"in e&&"string"==typeof e.string)(e))return L(e);if((e=>"int"in e&&"string"==typeof e.int)(e))return C(e);throw new y(JSON.stringify(e))},R=e=>{const t=e.consume(1);switch(t[0]){case 10:return k(e);case 1:return N(e);case 0:return j(e);case 2:{const t=new T(x(e)),r=[];for(;t.length()>0;)r.push(R(t));return r}default:return U(e,t)}},x=(e,t=4)=>{const r=e.consume(t),n=parseInt(Buffer.from(r).toString("hex"),16);return e.consume(n)},M=e=>{if(!/^([A-Fa-f0-9]{2})*$/.test(e.bytes))throw new i.InvalidHexStringError(e.bytes);const t=e.bytes.length/2;return`0a${a(t)}${e.bytes}`},k=e=>{const t=x(e);return{bytes:Buffer.from(t).toString("hex")}},L=e=>{const t=Buffer.from(e.string,"utf8").toString("hex"),r=t.length/2;return`01${a(r)}${t}`},N=e=>{const t=x(e);return{string:Buffer.from(t).toString("utf8")}},C=({int:e})=>{const t=new o.O(e,10),r="-"===t.toString(2)[0]?"1":"0",n=t.toString(2).replace(/-/g,""),i=n.length<=6?6:(n.length-6)%7?n.length+7-(n.length-6)%7:n.length,s=n.padStart(i,"0").match(/\d{6,7}/g).reverse();s[0]=r+s[0];return`00${s.map(((e,t)=>parseInt((t===s.length-1?"0":"1")+e,2).toString(16).padStart(2,"0"))).join("")}`},j=e=>{let t=e.consume(1)[0];const r=[];for(;128&t;)r.push(t),t=e.consume(1)[0];r.push(t);const n=!!(64&r[0]);r[0]=127&r[0];const i=r.map(((e,t)=>e.toString(2).slice(0===t?-6:-7).padStart(0===t?6:7,"0"))).reverse();let s=new o.O(i.join(""),2);return n&&(s=s.times(-1)),{int:s.toFixed()}},D=e=>{const t=+Array.isArray(e.annots),r=Array.isArray(e.args)?e.args.length:0,n=a(Math.min(2*r+t+3,9),2),i=l[e.prim];let o=(e.args||[]).map((e=>I(e))).join("");const s=Array.isArray(e.annots)?K(e.annots):"";return"LAMBDA"!==e.prim&&"LAMBDA_REC"!==e.prim||!r||(o=a(o.length/2)+o+a(0)),("pair"===e.prim||"Pair"===e.prim)&&r>2&&(o=""===s?a(o.length/2)+o+a(0):a(o.length/2)+o),"view"===e.prim&&e.args&&(o=a(o.length/2)+o+a(0)),`${n}${i}${o}${s}`},U=(e,t)=>{const r=(t[0]-3)%2==1;let n=Math.floor((t[0]-3)/2);const i=e.consume(1)[0].toString(16).padStart(2,"0"),o={prim:u[i]};if("LAMBDA"!==u[i]&&"LAMBDA_REC"!==u[i]||e.consume(4),"view"===u[i])return 0!=n?B(e,o):o;let s,a;("pair"===u[i]||"Pair"===u[i])&&n>2&&(s=F(e),n=0,a=H(e));const c=new Array(n).fill(0).map((()=>R(e)));return"LAMBDA"!==u[i]&&"LAMBDA_REC"!==u[i]||e.consume(4),s?o.args=s:c.length&&(o.args=c),a&&""!==a[0]?o.annots=a:r&&(o.annots=H(e)),o},B=(e,t)=>(e.consume(4),t.args=new Array(4).fill(0).map((()=>R(e))),e.consume(4),t),F=e=>{const t=new T(x(e)),r=[];for(;t.length()>0;)r.push(R(t));return r},K=e=>{const t=e.map((e=>Buffer.from(e,"utf8").toString("hex"))).join("20"),r=t.length/2;return`${a(r)}${t}`},H=e=>{const t=e.consume(4),r=parseInt(Buffer.from(t).toString("hex"),16),n=e.consume(r);return Buffer.from(n).toString("hex").split("20").map((e=>Buffer.from(e,"hex").toString("utf8")))},G=e=>t=>(0,n.buf2hex)(Buffer.from((0,n.b58cdecode)(t,n.prefix[e]))),$=e=>t=>{const r=t.consume(n.prefixLength[e]);return(0,n.b58cencode)(r,n.prefix[e])},V=$(n.Prefix.TZ1),z=$(n.Prefix.B),q=e=>{const t=e.consume(1);return 0===t[0]?$(n.Prefix.TZ1)(e):1===t[0]?$(n.Prefix.TZ2)(e):2===t[0]?$(n.Prefix.TZ3)(e):void 0},W=G(n.Prefix.B),Z=G(n.Prefix.TZ1),J=e=>e?"ff":"00",Y=e=>G(n.Prefix.P)(e),X=e=>$(n.Prefix.P)(e),Q=e=>255===e.consume(1)[0],ee=e=>{switch(e.substring(0,3)){case n.Prefix.TZ1:return"00"+G(n.Prefix.TZ1)(e);case n.Prefix.TZ2:return"01"+G(n.Prefix.TZ2)(e);case n.Prefix.TZ3:return"02"+G(n.Prefix.TZ3)(e);case n.Prefix.TZ4:return"03"+G(n.Prefix.TZ4)(e);default:throw new n.InvalidKeyHashError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one for the following "${n.Prefix.TZ1}", "${n.Prefix.TZ2}", "${n.Prefix.TZ3}" or "${n.Prefix.TZ4}".`)}},te=e=>{const t=[];let r=new o.Z(e,10);if(r.isNaN())throw new TypeError(`Invalid zarith number ${e}`);for(;;){if(r.lt(128)){r.lt(16)&&t.push("0"),t.push(r.toString(16));break}{let e=r.mod(128);r=r.minus(e),r=r.dividedBy(128),e=e.plus(128),t.push(e.toString(16))}}return t.join("")},re=e=>{let t=0;for(;t=0;n-=1){const t=127&e.get(n);r=r.multipliedBy(128),r=r.plus(t)}return e.consume(t+1),new o.Z(r).toString()},ne=G(n.Prefix.VH),ie=$(n.Prefix.VH),oe={branch:c.BRANCH,contents:[c.OPERATION]},se={pkh:c.TZ1,secret:c.SECRET},ae={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,public_key:c.PUBLIC_KEY},ce={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,delegate:c.DELEGATE},ue={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,amount:c.ZARITH,destination:c.ADDRESS,parameters:c.PARAMETERS},le={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,balance:c.ZARITH,delegate:c.DELEGATE,script:c.SCRIPT},fe={source:c.PKH,period:c.INT32,proposal:c.PROPOSAL,ballot:c.BALLOT_STATEMENT},de={slot:c.INT16,level:c.INT32,round:c.INT32,block_payload_hash:c.BLOCK_PAYLOAD_HASH},he={slot:c.INT16,level:c.INT32,round:c.INT32,block_payload_hash:c.BLOCK_PAYLOAD_HASH},pe={level:c.INT32,nonce:c.RAW},be={source:c.PKH,period:c.INT32,proposals:c.PROPOSAL_ARR},me={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,value:c.VALUE},ge={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,ticket_contents:c.VALUE,ticket_ty:c.VALUE,ticket_ticketer:c.ADDRESS,ticket_amount:c.ZARITH,destination:c.ADDRESS,entrypoint:c.ENTRYPOINT},ve={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,amount:c.ZARITH,destination:c.SMART_CONTRACT_ADDRESS},ye={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,pk:c.PUBLIC_KEY},_e={consensus_key:c.PKH,delegate:c.PKH,destination:c.PKH},we={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,limit:c.DEPOSITS_LIMIT},Ee={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,pvm_kind:c.PVM_KIND,kernel:c.PADDED_BYTES,parameters_ty:c.VALUE,whitelist:c.PKH_ARR},Oe={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,message:c.SMART_ROLLUP_MESSAGE},Ae={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,rollup:c.SMART_ROLLUP_ADDRESS,cemented_commitment:c.SMART_ROLLUP_COMMITMENT_HASH,output_proof:c.PADDED_BYTES},Se={arbitrary:c.PADDED_BYTES},Pe=e=>t=>r=>Object.keys(t).reduce(((n,i)=>{const o=t[i];if(r&&Array.isArray(o)){const t=e[o[0]],s=r[i];if(!Array.isArray(s))throw new w(`Invalid operation value "${JSON.stringify(s)}" of key "${i}, expected value to be Array.`);return n+s.reduce(((e,r)=>e+t(r)),"")}return n+(0,e[o])(r[i])}),""),Te=e=>t=>r=>Object.keys(t).reduce(((n,i)=>{const o=t[i];if(Array.isArray(o)){const t=e[o[0]],s=[],a=r.length();for(;r.length()>0;)if(s.push(t(r)),a===r.length())throw new _("Unable to decode value");return Object.assign(Object.assign({},n),{[i]:s})}{const t=(0,e[o])(r);return void 0!==t?Object.assign(Object.assign({},n),{[i]:t}):Object.assign({},n)}}),{}),Ie={[c.SECRET]:e=>s(e.consume(20)),[c.RAW]:e=>s(e.consume(32)),[c.TZ1]:V,[c.BRANCH]:z,[c.ZARITH]:re,[c.PUBLIC_KEY]:e=>{switch(e.consume(1)[0]){case 0:return $(n.Prefix.EDPK)(e);case 1:return $(n.Prefix.SPPK)(e);case 2:return $(n.Prefix.P2PK)(e);default:throw new n.InvalidPublicKeyError(e.toString(),(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED))}},[c.PKH]:q,[c.PKH_ARR]:e=>{if(!Q(e))return;const t=[];for(e.consume(4);e.length()>0;)t.push(q(e));return t},[c.DELEGATE]:e=>{if(Q(e))return q(e)},[c.INT32]:e=>{const t=e.consume(4);let r=0;for(let e=0;e{const t=x(e),r=x(e);return{code:R(new T(t)),storage:R(new T(r))}},[c.BALLOT_STATEMENT]:e=>{const t=e.consume(1);switch(t[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new v(t[0].toString())}},[c.PROPOSAL]:X,[c.PROPOSAL_ARR]:e=>{const t=[];for(e.consume(4);e.length()>0;)t.push(X(e));return t},[c.PARAMETERS]:e=>{if(0!==e.consume(1)[0]){const t=(e=>{const t=a(e.consume(1)[0],2);if(t in h)return h[t];{const t=x(e,1),r=Buffer.from(t).toString("utf8");if(r.length>31)throw new m(r);return r}})(e),r=x(e);return{entrypoint:t,value:R(new T(r))}}},[c.ADDRESS]:e=>{switch(e.consume(1)[0]){case 0:return q(e);case 1:{const t=$(n.Prefix.KT1)(e);return e.consume(1),t}default:throw new i.InvalidAddressError(e.toString(),": Unable to decode.")}},[c.SMART_ROLLUP_ADDRESS]:e=>{const t=$(n.Prefix.SR1)(e);if(t.substring(0,3)!==n.Prefix.SR1)throw new S(t,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SR1}'.`);return t},[c.SMART_CONTRACT_ADDRESS]:e=>{if(1===e.consume(1)[0]){const t=$(n.Prefix.KT1)(e);return e.consume(1),t}throw new i.InvalidContractAddressError(e.toString(),(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED))},[c.SMART_ROLLUP_COMMITMENT_HASH]:e=>{const t=$(n.Prefix.SRC1)(e);if(t.substring(0,4)!==n.Prefix.SRC1)throw new P(t,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SRC1}'`);return t},[c.VALUE]:e=>{const t=x(e);return R(new T(t))},[c.INT16]:e=>{const t=e.consume(2);let r=0;for(let e=0;e{const t=x(e);return Buffer.from(t).toString("utf8")},[c.BURN_LIMIT]:e=>{const t=e.consume(1);if("00"!==Buffer.from(t).toString("hex"))return re(e)},[c.DEPOSITS_LIMIT]:e=>{const t=e.consume(1);if("00"!==Buffer.from(t).toString("hex"))return re(e)},[c.PVM_KIND]:e=>{const t=e.consume(1);switch(t[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new A(t[0].toString())}},[c.PADDED_BYTES]:e=>{const t=x(e);return Buffer.from(t).toString("hex")},[c.SMART_ROLLUP_MESSAGE]:e=>{const t=x(e);return((e,t=4)=>{const r=[];let n=e;for(;n.length();){const e=n.consume(t),i=parseInt(Buffer.from(e).toString("hex"),16);r.push(n.consume(i)),n=n.slice(i+t)}return r})(new T(t)).map((e=>Buffer.from(e).toString("hex")))}};Ie[c.OPERATION]=(e=>t=>{const r=t.consume(1),n=f[r[0]];if(void 0===n)throw new E(r[0].toString());const i=e[n](t);if("object"!=typeof i)throw new _("Invalid operation, cannot be decoded.");return Object.assign({kind:n},i)})(Ie),Ie[c.OP_ACTIVATE_ACCOUNT]=e=>Te(Ie)(se)(e),Ie[c.OP_FAILING_NOOP]=e=>Te(Ie)(Se)(e),Ie[c.OP_DELEGATION]=e=>Te(Ie)(ce)(e),Ie[c.OP_TRANSACTION]=e=>Te(Ie)(ue)(e),Ie[c.OP_ORIGINATION]=e=>Te(Ie)(le)(e),Ie[c.OP_BALLOT]=e=>Te(Ie)(fe)(e),Ie[c.OP_ATTESTATION]=e=>Te(Ie)(de)(e),Ie[c.OP_ENDORSEMENT]=e=>Te(Ie)(he)(e),Ie[c.OP_SEED_NONCE_REVELATION]=e=>Te(Ie)(pe)(e),Ie[c.OP_PROPOSALS]=e=>Te(Ie)(be)(e),Ie[c.OP_REVEAL]=e=>Te(Ie)(ae)(e),Ie[c.OP_REGISTER_GLOBAL_CONSTANT]=e=>Te(Ie)(me)(e),Ie[c.OP_TRANSFER_TICKET]=e=>Te(Ie)(ge)(e),Ie[c.OP_INCREASE_PAID_STORAGE]=e=>Te(Ie)(ve)(e),Ie[c.OP_UPDATE_CONSENSUS_KEY]=e=>Te(Ie)(ye)(e),Ie[c.OP_DRAIN_DELEGATE]=e=>Te(Ie)(_e)(e),Ie[c.OP_SMART_ROLLUP_ORIGINATE]=e=>Te(Ie)(Ee)(e),Ie[c.OP_SMART_ROLLUP_ADD_MESSAGES]=e=>Te(Ie)(Oe)(e),Ie[c.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=e=>Te(Ie)(Ae)(e),Ie[c.MANAGER]=Te(Ie)(oe),Ie[c.OP_SET_DEPOSITS_LIMIT]=e=>Te(Ie)(we)(e);const Re={[c.SECRET]:e=>e,[c.RAW]:e=>e,[c.TZ1]:Z,[c.BRANCH]:W,[c.ZARITH]:te,[c.PUBLIC_KEY]:e=>{switch(e.substring(0,4)){case n.Prefix.EDPK:return"00"+G(n.Prefix.EDPK)(e);case n.Prefix.SPPK:return"01"+G(n.Prefix.SPPK)(e);case n.Prefix.P2PK:return"02"+G(n.Prefix.P2PK)(e);default:throw new n.InvalidPublicKeyError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following '${n.Prefix.EDPK}', '${n.Prefix.SPPK}', '${n.Prefix.P2PK}' or '${n.Prefix.BLPK}'.`)}},[c.PKH]:ee,[c.PKH_ARR]:e=>{if(!e)return J(!1);if(0===e.length)return J(!0)+a(0);const t=e.reduce(((e,t)=>e+ee(t)),"");return J(!0)+a(t.length/2)+t},[c.DELEGATE]:e=>e?J(!0)+ee(e):J(!1),[c.SCRIPT]:e=>{const t=I(e.code),r=I(e.storage);return`${a(t.length/2,8)}${t}${a(r.length/2,8)}${r}`},[c.BALLOT_STATEMENT]:e=>{switch(e){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new g(e)}},[c.PROPOSAL]:Y,[c.PROPOSAL_ARR]:e=>a(32*e.length)+e.map((e=>Y(e))).join(""),[c.INT32]:e=>{const t=parseInt(String(e),10),r=[];for(let e=0;e<4;e++){const n=8*(4-(e+1));r.push((t&255<>n)}return Buffer.from(r).toString("hex")},[c.PARAMETERS]:e=>{if(!e||"default"===e.entrypoint&&"prim"in e.value&&"Unit"===e.value.prim)return"00";const t=(e=>{if(e in p)return`${p[e]}`;if(e.length>31)throw new m(e);return`ff${I({string:e}).slice(8)}`})(e.entrypoint),r=I(e.value);return`ff${t}${(r.length/2).toString(16).padStart(8,"0")}${r}`},[c.ADDRESS]:e=>{switch(e.substring(0,3)){case n.Prefix.TZ1:case n.Prefix.TZ2:case n.Prefix.TZ3:case n.Prefix.TZ4:return"00"+ee(e);case n.Prefix.KT1:return"01"+G(n.Prefix.KT1)(e)+"00";default:throw new i.InvalidAddressError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following prefix '${n.Prefix.TZ1}', ${n.Prefix.TZ2}', '${n.Prefix.TZ3}', '${n.Prefix.TZ4}' or '${n.Prefix.KT1}'.`)}},[c.SMART_ROLLUP_ADDRESS]:e=>{if(e.substring(0,3)!==n.Prefix.SR1)throw new S(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SR1}'.`);return G(n.Prefix.SR1)(e)},[c.SMART_CONTRACT_ADDRESS]:e=>{if(e.substring(0,3)===n.Prefix.KT1)return"01"+G(n.Prefix.KT1)(e)+"00";throw new i.InvalidContractAddressError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.KT1}'.`)},[c.SMART_ROLLUP_COMMITMENT_HASH]:e=>{if(e.substring(0,4)===n.Prefix.SRC1)return G(n.Prefix.SRC1)(e);throw new P(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SRC1}'`)},[c.VALUE]:e=>{const t=I(e);return`${a(t.length/2)}${t}`},[c.INT16]:e=>{const t=parseInt(String(e),10),r=[];for(let e=0;e<2;e++){const n=8*(2-(e+1));r.push((t&255<>n)}return Buffer.from(r).toString("hex")},[c.BLOCK_PAYLOAD_HASH]:ne,[c.ENTRYPOINT]:e=>`${I({string:e}).slice(2)}`,[c.BURN_LIMIT]:e=>e?`ff${te(e)}`:"00",[c.DEPOSITS_LIMIT]:e=>e?`ff${te(e)}`:"00",[c.PVM_KIND]:e=>{switch(e){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new O(e)}},[c.PADDED_BYTES]:(e,t=8)=>`${a(e.length/2,t)}${e}`,[c.SMART_ROLLUP_MESSAGE]:e=>{const t=e.reduce(((e,t)=>e+`${a(t.length/2)}${t}`),"");return`${a(t.length/2)}${t}`}};Re[c.OPERATION]=(e=>t=>{if(!(t.kind in e)||!(t.kind in d))throw new i.InvalidOperationKindError(t.kind);return d[t.kind]+e[t.kind](t)})(Re),Re[c.OP_ACTIVATE_ACCOUNT]=e=>Pe(Re)(se)(e),Re[c.OP_DELEGATION]=e=>Pe(Re)(ce)(e),Re[c.OP_TRANSACTION]=e=>Pe(Re)(ue)(e),Re[c.OP_ORIGINATION]=e=>Pe(Re)(le)(e),Re[c.OP_BALLOT]=e=>Pe(Re)(fe)(e),Re[c.OP_ATTESTATION]=e=>Pe(Re)(de)(e),Re[c.OP_ENDORSEMENT]=e=>Pe(Re)(he)(e),Re[c.OP_SEED_NONCE_REVELATION]=e=>Pe(Re)(pe)(e),Re[c.OP_PROPOSALS]=e=>Pe(Re)(be)(e),Re[c.OP_REVEAL]=e=>Pe(Re)(ae)(e),Re[c.OP_REGISTER_GLOBAL_CONSTANT]=e=>Pe(Re)(me)(e),Re[c.OP_TRANSFER_TICKET]=e=>Pe(Re)(ge)(e),Re[c.OP_INCREASE_PAID_STORAGE]=e=>Pe(Re)(ve)(e),Re[c.OP_UPDATE_CONSENSUS_KEY]=e=>Pe(Re)(ye)(e),Re[c.OP_DRAIN_DELEGATE]=e=>Pe(Re)(_e)(e),Re[c.OP_SMART_ROLLUP_ORIGINATE]=e=>Pe(Re)(Ee)(e),Re[c.OP_SMART_ROLLUP_ADD_MESSAGES]=e=>Pe(Re)(Oe)(e),Re[c.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=e=>Pe(Re)(Ae)(e),Re[c.MANAGER]=Pe(Re)(oe),Re[c.OP_SET_DEPOSITS_LIMIT]=e=>Pe(Re)(we)(e),Re[c.OP_FAILING_NOOP]=e=>Pe(Re)(Se)(e);const xe={activate_account:se,reveal:ae,delegation:ce,transaction:ue,origination:le,ballot:fe,attestation:de,endorsement:he,seed_nonce_revelation:pe,proposals:be,register_global_constant:me,transfer_ticket:ge,increase_paid_storage:ve,update_consensus_key:ye,drain_delegate:_e,set_deposits_limit:we,smart_rollup_originate:Ee,smart_rollup_add_messages:Oe,smart_rollup_execute_outbox_message:Ae,failing_noop:Se},Me=e=>{const t=e.kind,r=Object.keys(e),n=(i="kind",r.filter((e=>e!==i)));var i;const o=Object.keys(xe[t]);return s=n,o.filter((e=>!s.includes(e)));var s};var ke;!function(e){e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(ke||(ke={}));const Le={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"},Ne=ke.ProxfordY;function Ce(e,t){return{encoder:Re[e],decoder:t=>{const r=T.fromHexString(t);return Ie[e](r)}}}class je{constructor(e=Ne){this.protocolHash=e,this.codec=Ce(c.MANAGER,this.protocolHash)}forge(e){const t=(0,n.validateBlock)(e.branch);if(t!==n.ValidationResult.VALID)throw new i.InvalidBlockHashError(e.branch,(0,n.invalidDetail)(t));for(const t of e.contents){if(r=t.kind,!Object.keys(xe).includes(r))throw new i.InvalidOperationKindError(t.kind);const e=Me(t);if(1===e.length){if("delegation"===t.kind&&"delegate"===e[0])continue;if("origination"===t.kind&&"delegate"===e[0])continue;if("transaction"===t.kind&&"parameters"===e[0])continue;if("set_deposits_limit"===t.kind&&"limit"===e[0])continue;if("smart_rollup_originate"===t.kind&&"whitelist"===e[0])continue;throw new b(t,`missing properties "${e.join(", ")}"`)}if(e.length>1)throw new b(t,`missing properties "${e.join(", ")}"`)}var r;const o=this.codec.encoder(e).toLowerCase();return Promise.resolve(o)}parse(e){return Promise.resolve(this.codec.decoder(e))}}const De=new je},9985:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Contract:()=>nr,DefaultProtocol:()=>b,JSONParseError:()=>j,MacroError:()=>y,MichelineParseError:()=>C,MichelsonError:()=>ue,MichelsonInstructionError:()=>Ct,MichelsonTypeError:()=>fe,MichelsonValidationError:()=>ke,Parser:()=>K,ProtoGreaterOrEqual:()=>g,ProtoInferiorTo:()=>v,Protocol:()=>p,VERSION:()=>cr,assertContractValid:()=>Zt,assertDataListIfAny:()=>ot,assertDataValid:()=>Jt,assertMichelsonBigMapStorableType:()=>qe,assertMichelsonComparableType:()=>He,assertMichelsonContract:()=>Qe,assertMichelsonData:()=>Xe,assertMichelsonInstruction:()=>Ke,assertMichelsonPackableType:()=>Ge,assertMichelsonPassableType:()=>ze,assertMichelsonPushableType:()=>$e,assertMichelsonStorableType:()=>Ve,assertMichelsonType:()=>Je,assertTypeAnnotationsValid:()=>Ft,assertTypesEqual:()=>Xt,assertViewNameValid:()=>Ze,contractEntryPoint:()=>qt,contractEntryPoints:()=>Wt,contractSection:()=>$t,contractViews:()=>Vt,decodeAddressBytes:()=>kt,decodePublicKeyBytes:()=>Nt,decodePublicKeyHashBytes:()=>Lt,dummyContract:()=>ir,emitMicheline:()=>z,formatError:()=>ar,formatStack:()=>or,functionType:()=>Yt,instructionIDs:()=>Re,isContractValid:()=>er,isDataValid:()=>tr,isInstruction:()=>it,isMichelsonCode:()=>rt,isMichelsonData:()=>tt,isMichelsonError:()=>le,isMichelsonScript:()=>et,isMichelsonType:()=>nt,isTypeAnnotationsValid:()=>Qt,isTypeEqual:()=>rr,packData:()=>Pt,packDataBytes:()=>Tt,refContract:()=>h,sourceReference:()=>i,traceDumpFunc:()=>sr,unpackData:()=>xt,unpackDataBytes:()=>Mt});var n=r(227);const i=Symbol("source_reference");class o extends n.TaquitoError{constructor(e,t,r){super(),this.src=e,this.idx=t,this.message=r,this.name="ScanError"}}var s;!function(e){e[e.Comment=0]="Comment",e[e.Number=1]="Number",e[e.String=2]="String",e[e.Bytes=3]="Bytes",e[e.Ident=4]="Ident"}(s||(s={}));const a=new RegExp("\\s"),c=new RegExp("[:@%_A-Za-z]"),u=new RegExp("[@%_\\.A-Za-z0-9]"),l=new RegExp("[0-9]"),f=new RegExp("[0-9a-fA-F]");function*d(e,t=!1){let r=0;for(;r1&&"0x"===e.substring(r,r+2)){for(r+=2;r1&&"/*"===e.substring(r,r+2)){for(r+=2;r1&&"*/"===e.substring(r,r+2));)r++;if(r===e.length)throw new o(e,r,"Unterminated C style comment");r+=2,t&&(yield{t:s.Comment,v:e.slice(i,r),first:i,last:r})}else{if("("!==n&&")"!==n&&"{"!==n&&"}"!==n&&";"!==n)throw new o(e,r,`Invalid character at offset ${r}: \`${n}'`);r++,yield{t:n,v:n,first:i,last:r}}}}const h=Symbol("ref_contract");var p;!function(e){e.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",e.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",e.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",e.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(p||(p={}));const b=p.Psithaca2,m={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:12,PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw:13,PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY:13,PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg:14,PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW:15,PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc:16,PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1:16,PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf:17,ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH:19,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:20};function g(e,t){return m[e]>=m[t]}function v(e,t){return m[e][e+1,t])),i+=a,o+=u;break}case"I":o!==r.length&&(s[1]=r[o++]);break;default:throw new y(e,`${e.prim}: unexpected character: ${u}`)}return{r:n(a,c,[0,s]),n:i,an:o}}function A(e,t,r,n){const i=t[0];switch(i){case"A":return t.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},A(e,t.slice(1),[],n)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...r]}]:n.a;case"D":return t.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},A(e,t.slice(1),[],n)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...r]}]:n.d;default:throw new y(e,`${e.prim}: unexpected character: ${i}`)}}function S(e,t){let r=e.length;for(;r>0&&e[r-1]===t;)r--;return e.slice(0,r)}function P(e){const t=[],r=[];if(void 0!==e)for(const n of e)(0!==n.length&&"%"===n[0]?t:r).push(n);return{fields:t,rest:r}}function T({prim:e,annots:t,args:r}){return Object.assign(Object.assign({prim:e},t&&{annots:t}),r&&{args:r})}const I=/^P[PAI]{3,}R$/,R=/^UNP[PAI]{2,}R$/,x=/^C[AD]{2,}R$/,M=/^SET_C[AD]+R$/,k=/^MAP_C[AD]+R$/,L=/^DI{2,}P$/,N=/^DU+P$/;class C extends n.TaquitoError{constructor(e,t){super(),this.token=e,this.message=t,this.name="MichelineParseError"}}class j extends n.TaquitoError{constructor(e,t){super(),this.node=e,this.message=t,this.name="JSONParseError"}}const D=new C(null,"Unexpected EOF");function U(e){return e.t===s.Ident&&("@"===e.v[0]||"%"===e.v[0]||":"===e.v[0])}const B=new RegExp("^-?[0-9]+$"),F=new RegExp("^([0-9a-fA-F]{2})*$");class K{constructor(e){this.opt=e}expand(e){var t,r,n;if(void 0!==(null===(t=this.opt)||void 0===t?void 0:t.expandGlobalConstant)&&"constant"===e.prim){const t=function(e,t){return void 0!==e.args&&1===e.args.length&&"string"in e.args[0]&&e.args[0].string in t?t[e.args[0].string]:e}(e,this.opt.expandGlobalConstant);return t!==e&&(t[i]=Object.assign(Object.assign({},e[i]||{first:0,last:0}),{globalConstant:e})),t}if(void 0===(null===(r=this.opt)||void 0===r?void 0:r.expandMacros)||(null===(n=this.opt)||void 0===n?void 0:n.expandMacros)){const t=function(e,t){const r=(null==t?void 0:t.protocol)||b;function n(e){return void 0!==e?[{prim:"RENAME",annots:e}]:[]}switch(e.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(_(e,0))return[{prim:"COMPARE"},T({prim:e.prim.slice(3),annots:e.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(_(e,2))return[{prim:e.prim.slice(2)},T({prim:"IF",annots:e.annots,args:e.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(_(e,2))return[{prim:"COMPARE"},{prim:e.prim.slice(5)},T({prim:"IF",annots:e.annots,args:e.args})];break;case"FAIL":if(_(e,0)&&w(e))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(_(e,0)&&w(e))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(_(e,0)&&w(e))return[{prim:e.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(_(e,0)&&w(e))return[[{prim:"COMPARE"},{prim:e.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(_(e,0)&&w(e))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(_(e,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(e.annots)]}];break;case"ASSERT_LEFT":if(_(e,0))return[{prim:"IF_LEFT",args:[n(e.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(_(e,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(e.annots)]}];break;case"IF_SOME":if(_(e,2))return[T({prim:"IF_NONE",annots:e.annots,args:[e.args[1],e.args[0]]})];break;case"IF_RIGHT":if(_(e,2))return[T({prim:"IF_LEFT",annots:e.annots,args:[e.args[1],e.args[0]]})];break;case"CAR":case"CDR":if(void 0===e.args)return e;if(_(e,1)&&E(e,e.args[0])){const t=parseInt(e.args[0].int,10);return T({prim:"GET",args:[{int:"CAR"===e.prim?String(2*t+1):String(2*t)}],annots:e.annots})}}if(I.test(e.prim)&&_(e,0)){const{fields:t,rest:r}=P(e.annots),{r:n}=O(e,e.prim.slice(1),t,((e,t,r)=>[...e||[],...t||[],r]));return n.map((([e,t],i)=>{const o=[...S(t,null).map((e=>null===e?"%":e)),...0===e&&i===n.length-1?r:[]],s=T({prim:"PAIR",annots:0!==o.length?o:void 0});return 0===e?s:{prim:"DIP",args:1===e?[[s]]:[{int:String(e)},[s]]}}))}if(R.test(e.prim)){if(v(r,p.PtEdo2Zk)&&_(e,0)){const{r:t}=O(e,e.prim.slice(3),e.annots||[],((e,t,r)=>[r,...t||[],...e||[]]));return t.map((([e,t])=>{const r=[{prim:"DUP"},T({prim:"CAR",annots:null!==t[0]?[t[0]]:void 0}),{prim:"DIP",args:[[T({prim:"CDR",annots:null!==t[1]?[t[1]]:void 0})]]}];return 0===e?r:{prim:"DIP",args:1===e?[[r]]:[{int:String(e)},[r]]}}))}if("UNPAIR"===e.prim)return e;if(_(e,0)){const{r:t}=O(e,e.prim.slice(3),[],((e,t,r)=>[r,...t||[],...e||[]]));return t.map((([e])=>{const t=T({prim:"UNPAIR"});return 0===e?t:{prim:"DIP",args:1===e?[[t]]:[{int:String(e)},[t]]}}))}}if(x.test(e.prim)&&_(e,0)){const t=[...e.prim.slice(1,e.prim.length-1)];return t.map(((r,n)=>{const i=n===t.length-1?e.annots:void 0;switch(r){case"A":return T({prim:"CAR",annots:i});case"D":return T({prim:"CDR",annots:i});default:throw new y(e,`unexpected character: ${r}`)}}))}if(M.test(e.prim)&&_(e,0)){const{fields:t,rest:r}=P(e.annots);if(t.length>1)throw new y(e,`unexpected annotation on macro ${e.prim}: ${t}`);const n=0!==t.length?{a:[{prim:"DUP"},{prim:"CAR",annots:t},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[t[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:t},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",t[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return A(e,e.prim.slice(5,e.prim.length-1),r,n)}if(k.test(e.prim)&&_(e,1)){const{fields:t}=P(e.annots);if(t.length>1)throw new y(e,`unexpected annotation on macro ${e.prim}: ${t}`);const r={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[T({prim:"CAR",annots:0!==t.length?["@"+t[0].slice(1)]:void 0}),e.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[0!==t.length?t[0]:"%","%@"]}],d:[{prim:"DUP"},T({prim:"CDR",annots:0!==t.length?["@"+t[0].slice(1)]:void 0}),e.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",0!==t.length?t[0]:"%"]}]};return A(e,e.prim.slice(5,e.prim.length-1),[],r)}if(L.test(e.prim)&&_(e,1)){let t=0;for(;"I"===e.prim[1+t];)t++;return T({prim:"DIP",args:[{int:String(t)},e.args[0]]})}if(N.test(e.prim)){let t=0;for(;"U"===e.prim[1+t];)t++;if(v(r,p.PtEdo2Zk)){if(1===t){if(void 0===e.args)return e;_(e,1)&&E(e,e.args[0])&&(t=parseInt(e.args[0].int,10))}else _(e,0);return 1===t?[T({prim:"DUP",annots:e.annots})]:2===t?[{prim:"DIP",args:[[T({prim:"DUP",annots:e.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(t-1)},[T({prim:"DUP",annots:e.annots})]]},{prim:"DIG",args:[{int:String(t)}]}]}if(1===t)return e;if(_(e,0))return T({prim:"DUP",args:[{int:String(t)}],annots:e.annots})}return e}(e,this.opt);return t!==e&&(t[i]=Object.assign(Object.assign({},e[i]||{first:0,last:0}),{macro:e})),t}return e}parseListExpr(e,t){var r;const n={first:t.first,last:t.last},o="("===t.t;let a;if(o){if(a=e.next(),a.done)throw D;n.last=a.value.last}else a={value:t};if(a.value.t!==s.Ident)throw new C(a.value,`not an identifier: ${a.value.v}`);const c={prim:a.value.v,[i]:n};for(;;){const t=e.next();if(t.done){if(o)throw D;break}if(")"===t.value.t){if(!o)throw new C(t.value,"unexpected closing bracket");n.last=t.value.last;break}if(U(t.value))c.annots=c.annots||[],c.annots.push(t.value.v),n.last=t.value.last;else{c.args=c.args||[];const o=this.parseExpr(e,t.value);n.last=(null===(r=o[i])||void 0===r?void 0:r.last)||n.last,c.args.push(o)}}return this.expand(c)}parseArgs(e,t){var r;const n={first:t.first,last:t.last},o={prim:t.v,[i]:n};for(;;){const t=e.next();if(t.done||"}"===t.value.t||";"===t.value.t)return[o,t];if(U(t.value))n.last=t.value.last,o.annots=o.annots||[],o.annots.push(t.value.v);else{const s=this.parseExpr(e,t.value);n.last=(null===(r=s[i])||void 0===r?void 0:r.last)||n.last,o.args=o.args||[],o.args.push(s)}}}parseSequenceExpr(e,t){var r,n;const o={first:t.first,last:t.last},a=[];a[i]=o;const c="{"===t.t;let u="{"===t.t?null:{value:t};for(;;){if(null===u&&(u=e.next(),u.done||(o.last=u.value.last)),u.done){if(c)throw D;return a}if("}"===u.value.t){if(c)return a;throw new C(u.value,"unexpected closing bracket")}if(u.value.t===s.Ident){const[t,n]=this.parseArgs(e,u.value);o.last=(null===(r=t[i])||void 0===r?void 0:r.last)||o.last,a.push(this.expand(t)),u=n}else{const t=this.parseExpr(e,u.value);o.last=(null===(n=t[i])||void 0===n?void 0:n.last)||o.last,a.push(t),u=null}null===u&&(u=e.next(),u.done||(o.last=u.value.last)),u.done||";"!==u.value.t||(u=null)}}parseExpr(e,t){switch(t.t){case s.Ident:return this.expand({prim:t.v,[i]:{first:t.first,last:t.last}});case s.Number:return{int:t.v,[i]:{first:t.first,last:t.last}};case s.String:return{string:JSON.parse(t.v),[i]:{first:t.first,last:t.last}};case s.Bytes:return{bytes:t.v.slice(2),[i]:{first:t.first,last:t.last}};case"{":return this.parseSequenceExpr(e,t);default:return this.parseListExpr(e,t)}}parseSequence(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseSequenceExpr(t,r.value)}parseList(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseListExpr(t,r.value)}parseMichelineExpression(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseExpr(t,r.value)}parseScript(e){return this.parseSequence(e)}parseData(e){return this.parseList(e)}parseJSON(e){if("object"!=typeof e)throw new TypeError(`object type was expected, got ${typeof e} instead`);if(Array.isArray(e)){const t=[];for(const r of e){if(null===r||"object"!=typeof r)throw new j(r,`unexpected sequence element: ${r}`);t.push(this.parseJSON(r))}return t}if("prim"in e){const t=e;if("string"==typeof t.prim&&(void 0===t.annots||Array.isArray(t.annots))&&(void 0===t.args||Array.isArray(t.args))){const e={prim:t.prim};if(void 0!==t.annots){for(const e of t.annots)if("string"!=typeof e)throw new j(e,`string expected: ${e}`);e.annots=t.annots}if(void 0!==t.args){e.args=[];for(const r of t.args){if(null===r||"object"!=typeof r)throw new j(r,`unexpected argument: ${r}`);e.args.push(this.parseJSON(r))}}return this.expand(e)}throw new j(e,`malformed prim expression: ${e}`)}if("string"in e){if("string"==typeof e.string)return{string:e.string};throw new j(e,`malformed string literal: ${e}`)}if("int"in e){if("string"==typeof e.int&&B.test(e.int))return{int:e.int};throw new j(e,`malformed int literal: ${e}`)}if("bytes"in e){if("string"==typeof e.bytes&&F.test(e.bytes))return{bytes:e.bytes};throw new j(e,`malformed bytes literal: ${e}`)}throw new j(e,`unexpected object: ${e}`)}}class H{constructor(e,t=0){this.opt=e,this.lev=t}indent(e=0){var t;let r="";if(void 0!==(null===(t=this.opt)||void 0===t?void 0:t.indent))for(let t=this.lev+e;t>0;t--)r+=this.opt.indent;return r}get lf(){var e;return(null===(e=this.opt)||void 0===e?void 0:e.newline)||""}get lfsp(){var e;return(null===(e=this.opt)||void 0===e?void 0:e.newline)||" "}down(e){return new H(this.opt,this.lev+e)}}function G(e){return"prim"in e&&(void 0!==e.annots&&0!==e.annots.length||void 0!==e.args&&0!==e.args.length)}function $(e){if(void 0!==e.args)for(const t of e.args)if(Array.isArray(t)||G(t))return!0;return!1}function V(e,t,r){var n;const o=null===(n=e[i])||void 0===n?void 0:n.macro;if(r&&o)return V(o,t,r);if(Array.isArray(e))return function(e,t,r){let n="{"+t.lf,i=e.length;for(const o of e){if(n+=t.indent(1),"prim"in o){if(n+=o.prim,void 0!==o.annots)for(const e of o.annots)n+=" "+e;if(void 0!==o.args){const e=$(o);for(const i of o.args)n+=e?t.lfsp+t.indent(2)+V(i,t.down(2),r):" "+V(i,t,r)}}else n+=V(o,t.down(1),r);n+=i>1?";"+t.lfsp:t.lf,i--}return n+t.indent()+"}"}(e,t,r);if("string"in e)return JSON.stringify(e.string);if("int"in e)return e.int;if("bytes"in e)return"0x"+e.bytes;{if(!(void 0!==e.annots&&0!==e.annots.length||void 0!==e.args&&0!==e.args.length))return e.prim;let n="("+e.prim;if(void 0!==e.annots)for(const t of e.annots)n+=" "+t;if(void 0!==e.args){const i=$(e);for(const o of e.args)n+=i?t.lfsp+t.indent(1)+V(o,t.down(1),r):" "+V(o,t,r)}return n+")"}}function z(e,t,r=!1){if("object"!=typeof e)throw new TypeError(`object type was expected, got ${typeof e} instead`);return V(e,new H(t),r)}const q=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],W=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class Z extends n.TaquitoError{constructor(e){super(),this.message=e,this.name="Base58DecodingError"}}function J(e){const t=(e.length+9)%64,r=0===t?0:64-t;if(e.length>268435455)throw new n.InvalidMessageError("",`: Invalid length ${e.length} is too big -- SHA-256.`);const i=e.length<<3,o=[...e,128,...new Array(r).fill(0),0,0,0,0,i>>24&255,i>>16&255,i>>8&255,255&i];function s(e,t){return e>>>t|e<<32-t}const a=[...q],c=new Array(64),u=new Array(8);for(let e=0;e>>3,t=s(c[r-2],17)^s(c[r-2],19)^c[r-2]>>>10;c[r]=(0|t)+c[r-7]+e+c[r-16]|0,r++}for(let e=0;e<8;e++)u[e]=a[e];for(let e=0;e<64;e++){const t=s(u[0],2)^s(u[0],13)^s(u[0],22),r=s(u[4],6)^s(u[4],11)^s(u[4],25),n=u[7]+r+(u[4]&u[5]^~u[4]&u[6])+W[e]+c[e]|0,i=t+(u[0]&u[1]^u[0]&u[2]^u[1]&u[2])|0;u[7]=u[6],u[6]=u[5],u[5]=u[4],u[4]=u[3]+n|0,u[3]=u[2],u[2]=u[1],u[1]=u[0],u[0]=n+i|0}for(let e=0;e<8;e++)a[e]=a[e]+u[e]|0}const l=[];for(const e of a)l.push(e>>24&255),l.push(e>>16&255),l.push(e>>8&255),l.push(255&e);return l}const Y=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57],X=[0,1,2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73];function Q(e,t){const r=e.charCodeAt(t)-49;if(r>=Y.length||-1===Y[r])throw new Z(`Unexpected character at position ${t}: ${e[t]}`);return Y[r]}function ee(e){const t=function(e){const t=[];let r=0;for(;r0;)t.push(0);return t.reverse()}(e);if(t.length<4)throw new Z(`Data is too short ${t.length}`);const r=t.slice(0,t.length-4),n=t.slice(t.length-4),i=J(J(r));if(n[0]!==i[0]||n[1]!==i[1]||n[2]!==i[2]||n[3]!==i[3])throw new Z("Invalid checksum");return r}function te(e){const t=J(J(e));return function(e){const t=[];let r=0;for(;r0;)t.push(0);return t.reverse(),String.fromCharCode(...t.map((e=>X[e]+49)))}([...e,...t.slice(0,4)])}class re extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidMichelsonError"}}class ne extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidTypeExpressionError"}}class ie extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidDataExpressionError"}}class oe extends n.ParameterValidationError{constructor(e){super(),this.entrypoint=e,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${e}"`}}class se extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="TezosIdEncodeError"}}class ae extends n.TaquitoError{constructor(e){super(),this.message=e,this.name="LongIntegerError"}}class ce extends n.TaquitoError{constructor(e){super(),this.hexByte=e,this.name="HexParseError",this.message=`Unable to parse hex byte "${e}"`}}class ue extends n.TaquitoError{constructor(e,t){super(),this.val=e,this.message=t,this.name="MichelsonError"}}function le(e){return e instanceof ue}class fe extends ue{constructor(e,t,r){super(e,t),this.val=e,this.message=t,this.name="MichelsonTypeError",void 0!==r&&(this.data=r)}}class de{append(e){let t=0;for(;0!==e||t57)throw new ae(`unexpected character in integer constant "${e[t]}"`);this.append(r-48)}}else e<0?(this.neg=!0,this.append(-e)):this.append(e)}cmp(e){if(this.neg!==e.neg)return(e.neg?1:0)-(this.neg?1:0);{let t=0;if(this.buf.length!==e.buf.length)t=this.buf.length=0&&this.buf[r]===e.buf[r];)r--;t=r<0?0:this.buf[r]=0}catch(e){return!1}}const me=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function ge(e,t){if(Array.isArray(e))return{};let r,n,i;if(void 0!==e.annots)for(const o of e.annots)if(0!==o.length){if(!me.test(o)||!(null==t?void 0:t.specialVar)&&("@%"===o||"@%%"===o)||!(null==t?void 0:t.specialFields)&&"%@"===o)throw new ue(e,`${e.prim}: unexpected annotation: ${o}`);switch(o[0]){case"%":((null==t?void 0:t.emptyFields)||o.length>1)&&(r=r||[],r.push(o));break;case":":o.length>1&&(n=n||[],n.push(o));break;case"@":((null==t?void 0:t.emptyVar)||o.length>1)&&(i=i||[],i.push(o))}}return{f:r,t:n,v:i}}const ve={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]],RollupAddress:[20,[1,128,120,31]]};function ye(e,...t){const r=ee(e);for(const e of t){const[t,n]=ve[e];if(r.length===t+n.length){let t=0;for(;t(e>>4&15).toString(16)+(15&e).toString(16))).join("")}const Te=31,Ie={ABS:!0,ADD:!0,ADDRESS:!0,AMOUNT:!0,AND:!0,APPLY:!0,BALANCE:!0,BLAKE2B:!0,CAR:!0,CDR:!0,CHAIN_ID:!0,CHECK_SIGNATURE:!0,COMPARE:!0,CONCAT:!0,CONS:!0,EDIV:!0,EQ:!0,EXEC:!0,FAILWITH:!0,GE:!0,GET_AND_UPDATE:!0,GT:!0,HASH_KEY:!0,IMPLICIT_ACCOUNT:!0,INT:!0,ISNAT:!0,JOIN_TICKETS:!0,KECCAK:!0,LE:!0,LEVEL:!0,LSL:!0,LSR:!0,LT:!0,MEM:!0,MUL:!0,NEG:!0,NEQ:!0,NEVER:!0,NOT:!0,NOW:!0,OR:!0,PACK:!0,PAIRING_CHECK:!0,READ_TICKET:!0,SAPLING_VERIFY_UPDATE:!0,SELF:!0,SELF_ADDRESS:!0,SENDER:!0,SET_DELEGATE:!0,SHA256:!0,SHA3:!0,SHA512:!0,SIZE:!0,SLICE:!0,SOME:!0,SOURCE:!0,SPLIT_TICKET:!0,SUB:!0,SWAP:!0,TICKET:!0,TICKET_DEPRECATED:!0,TOTAL_VOTING_POWER:!0,TRANSFER_TOKENS:!0,UNIT:!0,VOTING_POWER:!0,XOR:!0,RENAME:!0,OPEN_CHEST:!0,SUB_MUTEZ:!0,MIN_BLOCK_TIME:!0,BYTES:!0,NAT:!0},Re=Object.assign({},Ie,{CONTRACT:!0,CREATE_CONTRACT:!0,DIG:!0,DIP:!0,DROP:!0,DUG:!0,DUP:!0,EMIT:!0,EMPTY_BIG_MAP:!0,EMPTY_MAP:!0,EMPTY_SET:!0,GET:!0,IF:!0,IF_CONS:!0,IF_LEFT:!0,IF_NONE:!0,ITER:!0,LAMBDA:!0,LAMBDA_REC:!0,LEFT:!0,LOOP:!0,LOOP_LEFT:!0,MAP:!0,NIL:!0,NONE:!0,PAIR:!0,PUSH:!0,RIGHT:!0,SAPLING_EMPTY_STATE:!0,UNPACK:!0,UNPAIR:!0,UPDATE:!0,CAST:!0,VIEW:!0}),xe={unit:!0,never:!0,bool:!0,int:!0,nat:!0,string:!0,chain_id:!0,bytes:!0,mutez:!0,key_hash:!0,key:!0,signature:!0,timestamp:!0,address:!0,tx_rollup_l2_address:!0},Me=Object.assign({},xe,{or:!0,pair:!0,set:!0,big_map:!0,contract:!0,lambda:!0,list:!0,map:!0,operation:!0,option:!0,bls12_381_g1:!0,bls12_381_g2:!0,bls12_381_fr:!0,sapling_transaction:!0,sapling_transaction_deprecated:!0,sapling_state:!0,ticket:!0,chest_key:!0,chest:!0});class ke extends ue{constructor(e,t){super(e,t),this.val=e,this.message=t,this.name="MichelsonValidationError"}}function Le(e){return"prim"in e}function Ne(e){if(Le(e))return!0;throw new ke(e,"prim expression expected")}function Ce(e){if(Array.isArray(e))return!0;throw new ke(e,"sequence expression expected")}function je(e){if(function(e){return Array.isArray(e)||"prim"in e}(e))return!0;throw new ke(e,"prim or sequence expression expected")}function De(e){if("-"===e.int[0])throw new ke(e,"natural number expected")}function Ue(e){if("int"in e)return!0;throw new ke(e,"int literal expected")}function Be(e){if("string"in e)return!0;throw new ke(e,"string literal expected")}function Fe(e,t){var r;if(0===t&&void 0===e.args||(null===(r=e.args)||void 0===r?void 0:r.length)===t)return!0;throw new ke(e,`${t} arguments expected`)}function Ke(e){var t,r;if(Array.isArray(e)){for(const t of e){if(!Array.isArray(t)&&!Le(t))throw new ke(e,"sequence or prim expected");Ke(t)}return!0}if(Ne(e)){if(Object.prototype.hasOwnProperty.call(Ie,e.prim))return Fe(e,0),!0;switch(e.prim){case"DROP":case"PAIR":case"UNPAIR":case"DUP":case"UPDATE":case"GET":void 0!==e.args&&Fe(e,1)&&Ue(e.args[0])&&De(e.args[0]);break;case"DIG":case"DUG":case"SAPLING_EMPTY_STATE":Fe(e,1)&&Ue(e.args[0])&&De(e.args[0]);break;case"NONE":case"LEFT":case"RIGHT":case"NIL":case"CAST":Fe(e,1)&&Je(e.args[0]);break;case"UNPACK":Fe(e,1)&&Ge(e.args[0]);break;case"CONTRACT":Fe(e,1)&&ze(e.args[0]);break;case"IF_NONE":case"IF_LEFT":case"IF_CONS":case"IF":Fe(e,2)&&(Ce(e.args[0])&&Ke(e.args[0]),Ce(e.args[1])&&Ke(e.args[1]));break;case"MAP":case"ITER":case"LOOP":case"LOOP_LEFT":Fe(e,1)&&Ke(e.args[0]);break;case"CREATE_CONTRACT":Fe(e,1)&&Qe(e.args[0]);break;case"DIP":if(2===(null===(t=e.args)||void 0===t?void 0:t.length))Ue(e.args[0])&&De(e.args[0]),Ce(e.args[1])&&Ke(e.args[1]);else{if(1!==(null===(r=e.args)||void 0===r?void 0:r.length))throw new ke(e,"1 or 2 arguments expected");Ce(e.args[0])&&Ke(e.args[0])}break;case"PUSH":Fe(e,2)&&($e(e.args[0]),Xe(e.args[1]));break;case"EMPTY_SET":Fe(e,1)&&He(e.args[0]);break;case"EMPTY_MAP":Fe(e,2)&&(He(e.args[0]),Je(e.args[1]));break;case"EMPTY_BIG_MAP":Fe(e,2)&&(He(e.args[0]),qe(e.args[1]));break;case"LAMBDA_REC":case"LAMBDA":Fe(e,3)&&(Je(e.args[0]),Je(e.args[1]),Ce(e.args[2])&&Ke(e.args[2]));break;case"VIEW":Fe(e,2)&&(Be(e.args[0])&&Ze(e.args[0]),Je(e.args[1])&&$e(e.args[1]));break;case"EMIT":e.args&&e.args.length>0?Fe(e,1):Fe(e,0);break;default:throw new ke(e,"instruction expected")}}return!0}function He(e){if(je(e))if(Array.isArray(e)||"pair"===e.prim||"or"===e.prim||"option"===e.prim)Ye(e,(e=>He(e)));else if(!Object.prototype.hasOwnProperty.call(xe,e.prim))throw new ke(e,`${e.prim}: type is not comparable`);return!0}function Ge(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim||"ticket"===e.prim)throw new ke(e,`${e.prim}: type can't be used inside PACK/UNPACK instructions`);Ye(e,(e=>Ge(e)))}return!0}function $e(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim||"ticket"===e.prim||"contract"===e.prim)throw new ke(e,`${e.prim}: type can't be pushed`);Ye(e,(e=>$e(e)))}return!0}function Ve(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"operation"===e.prim||"contract"===e.prim)throw new ke(e,`${e.prim}: type can't be used as part of a storage`);Ye(e,(e=>Ve(e)))}return!0}function ze(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"operation"===e.prim)throw new ke(e,`${e.prim}: type can't be used as part of a parameter`);Ye(e,(e=>ze(e)))}return!0}function qe(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim)throw new ke(e,`${e.prim}: type can't be used inside a big_map`);Ye(e,(e=>qe(e)))}return!0}const We=new RegExp("^[a-zA-Z0-9_.%@]*$");function Ze(e){if(e.string.length>Te)throw new ke(e,`view name too long: ${e.string}`);if(!We.test(e.string))throw new ke(e,`invalid character(s) in view name: ${e.string}`)}function Je(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim))throw new ke(e,"type expected");Ye(e,(e=>Je(e)))}return!0}function Ye(e,t){if(Array.isArray(e)||"pair"===e.prim){const r=Array.isArray(e)?e:e.args;if(void 0===r||r.length<2)throw new ke(e,"at least 2 arguments expected");return r.forEach((e=>{je(e)&&t(e)})),!0}switch(e.prim){case"option":case"list":Fe(e,1)&&je(e.args[0])&&t(e.args[0]);break;case"contract":Fe(e,1)&&ze(e.args[0]);break;case"or":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(t(e.args[0]),t(e.args[1]));break;case"lambda":Fe(e,2)&&(Je(e.args[0]),Je(e.args[1]));break;case"set":Fe(e,1)&&He(e.args[0]);break;case"map":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(He(e.args[0]),t(e.args[1]));break;case"big_map":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(He(e.args[0]),qe(e.args[1]),t(e.args[1]));break;case"ticket":Fe(e,1)&&je(e.args[0])&&He(e.args[0]);break;case"sapling_state":case"sapling_transaction":Fe(e,1)&&Ue(e.args[0]);break;default:Fe(e,0)}return!0}function Xe(e){if("int"in e||"string"in e||"bytes"in e)return!0;if(Array.isArray(e)){let t=0;for(const r of e)Le(r)&&"Elt"===r.prim?(Fe(r,2)&&(Xe(r.args[0]),Xe(r.args[1])),t++):Xe(r);if(0!==t&&t!==e.length)throw new ke(e,"data entries and map elements can't be intermixed");return!0}if(!Le(e))throw new ke(e,"data entry expected");switch(e.prim){case"Unit":case"True":case"False":case"None":Fe(e,0);break;case"Pair":if(void 0===e.args||e.args.length<2)throw new ke(e,"at least 2 arguments expected");for(const t of e.args)Xe(t);break;case"Left":case"Right":case"Some":Fe(e,1)&&Xe(e.args[0]);break;case"Lambda_rec":e.args&&Ke(e.args);break;default:if(!Object.prototype.hasOwnProperty.call(Re,e.prim))throw new ke(e,"data entry or instruction expected");Ke(e)}return!0}function Qe(e){if(Ce(e)){const t={},r={};for(const n of e)if(Ne(n)){if("view"!==n.prim){if(n.prim in t)throw new ke(e,`duplicate contract section: ${n.prim}`);t[n.prim]=!0}switch(n.prim){case"code":Fe(n,1)&&Ce(n.args[0])&&Ke(n.args[0]);break;case"parameter":if(Fe(n,1)&&ze(n.args[0]),n.annots)throw new ke(n,"Annotation must be part of the parameter type");break;case"storage":Fe(n,1)&&Ve(n.args[0]);break;case"view":if(Fe(n,4)){if(Be(n.args[0])){const t=n.args[0];if(t.string in r)throw new ke(e,`duplicate view name: ${t.string}`);r[t.string]=!0,Ze(t)}$e(n.args[1]),$e(n.args[2]),Ce(n.args[3])&&Ke(n.args[3])}break;default:throw new ke(e,`unexpected contract section: ${n.prim}`)}}}return!0}function et(e){try{return Qe(e),!0}catch(e){return!1}}function tt(e){try{return Xe(e),!0}catch(e){return!1}}function rt(e){try{return Ke(e),!0}catch(e){return!1}}function nt(e){try{return Je(e),!0}catch(e){return!1}}function it(e){return Object.prototype.hasOwnProperty.call(Re,e.prim)}function ot(e){if(!Array.isArray(e))return!1;for(const t of e)if("prim"in t){if(it(t))throw new ue(e,`Instruction outside of a lambda: ${JSON.stringify(e)}`);if("Elt"===t.prim)throw new ue(e,`Elt item outside of a map literal: ${JSON.stringify(e)}`)}return!0}"function"==typeof SuppressedError&&SuppressedError;const st=["parameter","storage","code","False","Elt","Left","None","Pair","Right","Some","True","Unit","PACK","UNPACK","BLAKE2B","SHA256","SHA512","ABS","ADD","AMOUNT","AND","BALANCE","CAR","CDR","CHECK_SIGNATURE","COMPARE","CONCAT","CONS","CREATE_ACCOUNT","CREATE_CONTRACT","IMPLICIT_ACCOUNT","DIP","DROP","DUP","EDIV","EMPTY_MAP","EMPTY_SET","EQ","EXEC","FAILWITH","GE","GET","GT","HASH_KEY","IF","IF_CONS","IF_LEFT","IF_NONE","INT","LAMBDA","LE","LEFT","LOOP","LSL","LSR","LT","MAP","MEM","MUL","NEG","NEQ","NIL","NONE","NOT","NOW","OR","PAIR","PUSH","RIGHT","SIZE","SOME","SOURCE","SENDER","SELF","STEPS_TO_QUOTA","SUB","SWAP","TRANSFER_TOKENS","SET_DELEGATE","UNIT","UPDATE","XOR","ITER","LOOP_LEFT","ADDRESS","CONTRACT","ISNAT","CAST","RENAME","bool","contract","int","key","key_hash","lambda","list","map","big_map","nat","option","or","pair","set","signature","string","bytes","mutez","timestamp","unit","operation","address","SLICE","DIG","DUG","EMPTY_BIG_MAP","APPLY","chain_id","CHAIN_ID","LEVEL","SELF_ADDRESS","never","NEVER","UNPAIR","VOTING_POWER","TOTAL_VOTING_POWER","KECCAK","SHA3","PAIRING_CHECK","bls12_381_g1","bls12_381_g2","bls12_381_fr","sapling_state","sapling_transaction_deprecated","SAPLING_EMPTY_STATE","SAPLING_VERIFY_UPDATE","ticket","TICKET_DEPRECATED","READ_TICKET","SPLIT_TICKET","JOIN_TICKETS","GET_AND_UPDATE","chest","chest_key","OPEN_CHEST","VIEW","view","constant","SUB_MUTEZ","tx_rollup_l2_address","MIN_BLOCK_TIME","sapling_transaction","EMIT","Lambda_rec","LAMBDA_REC","TICKET","BYTES","NAT"],at=Object.assign({},...st.map(((e,t)=>({[e]:t}))));var ct;!function(e){e[e.Int=0]="Int",e[e.String=1]="String",e[e.Sequence=2]="Sequence",e[e.Prim0=3]="Prim0",e[e.Prim0Annot=4]="Prim0Annot",e[e.Prim1=5]="Prim1",e[e.Prim1Annot=6]="Prim1Annot",e[e.Prim2=7]="Prim2",e[e.Prim2Annot=8]="Prim2Annot",e[e.Prim=9]="Prim",e[e.Bytes=10]="Bytes"}(ct||(ct={}));class ut{constructor(){this.buffer=[]}get length(){return this.buffer.length}writeBytes(e){this.buffer.push(...e.map((e=>255&e)))}writeUint8(e){const t=0|e;this.buffer.push(255&t)}writeUint16(e){const t=0|e;this.buffer.push(t>>8&255),this.buffer.push(255&t)}writeUint32(e){const t=0|e;this.buffer.push(t>>24&255),this.buffer.push(t>>16&255),this.buffer.push(t>>8&255),this.buffer.push(255&t)}writeInt8(e){this.writeUint8(e)}writeInt16(e){this.writeUint16(e)}writeInt32(e){this.writeUint32(e)}}const lt=new Error("bounds out of range");class ft{constructor(e,t=0,r=e.length){this.buffer=e,this.idx=t,this.cap=r}get length(){return this.cap-this.idx}readBytes(e){if(this.cap-this.idx>>0}readUint16(){if(this.cap-this.idx<2)throw lt;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readUint32(){if(this.cap-this.idx<4)throw lt;return(this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readInt8(){if(this.cap-this.idx<1)throw lt;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw lt;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])<<16>>16}readInt32(){if(this.cap-this.idx<4)throw lt;return this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++]}}var dt,ht,pt;function bt(e){let t;const r=e.readUint8();switch(r){case ht.ED25519:t="ED25519PublicKeyHash";break;case ht.SECP256K1:t="SECP256K1PublicKeyHash";break;case ht.P256:t="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${r}`)}return{type:t,hash:e.readBytes(20)}}function mt(e){let t;const r=e.readUint8();switch(r){case dt.Implicit:t=bt(e);break;case dt.Originated:t={type:"ContractHash",hash:e.readBytes(20)},e.readBytes(1);break;default:throw new Error(`unknown address tag: ${r}`)}if(0!==e.length){const r=new TextDecoder;t.entryPoint=r.decode(new Uint8Array(e.readBytes(e.length)))}return t}function gt(e,t){let r;switch(e.type){case"ED25519PublicKeyHash":r=ht.ED25519;break;case"SECP256K1PublicKeyHash":r=ht.SECP256K1;break;case"P256PublicKeyHash":r=ht.P256;break;default:throw new Error(`unexpected address type: ${e.type}`)}t.writeUint8(r),t.writeBytes(Array.from(e.hash))}function vt(e){let t,r;const n=e.readUint8();switch(n){case pt.ED25519:r="ED25519PublicKey",t=32;break;case pt.SECP256K1:r="SECP256K1PublicKey",t=33;break;case pt.P256:r="P256PublicKey",t=33;break;default:throw new Error(`unknown public key tag: ${n}`)}return{type:r,publicKey:e.readBytes(t)}}function yt(e,t,r){var n,i;const[o,s]=r(e);if(Array.isArray(o)){const e=new ut;for(const t of o){const r=s.next();if(r.done)throw new Error("REPORT ME: iterator is done");yt(t,e,r.value)}return t.writeUint8(ct.Sequence),t.writeUint32(e.length),void t.writeBytes(e.buffer)}if("string"in o){const e=(new TextEncoder).encode(o.string);return t.writeUint8(ct.String),t.writeUint32(e.length),void t.writeBytes(Array.from(e))}if("int"in o){t.writeUint8(ct.Int);let e=BigInt(o.int);const r=e<0;r&&(e=-e);let n=0;do{const i=0===n?BigInt(6):BigInt(7);let o=e&(BigInt(1)<>=i,e&&(o|=BigInt(128)),0===n&&r&&(o|=BigInt(64)),t.writeUint8(Number(o)),n++}while(e);return}if("bytes"in o){const e=function(e){const t=[];for(let r=0;r=3&&t.writeUint32(0)}function _t(e,t){function*r(){for(;;)yield Rt}const[n,i]=t,o=e.readUint8();switch(o){case ct.Int:{const t=[];let r;do{r=e.readInt8(),t.push(r)}while(0!=(128&r));let n=BigInt(0),o=!1;for(let e=t.length-1;e>=0;e--){const r=0===e?BigInt(6):BigInt(7),i=BigInt(t[e]);n<<=r,n|=i&(BigInt(1)<0;){const e=a.next();if(e.done)throw new Error("REPORT ME: iterator is done");o.push(_t(r,e.value))}a=n(o),s=e}return i(o)}default:{if(o>9)throw new Error(`Unknown tag: ${o}`);const t=e.readUint8();if(t>=st.length)throw new Error(`Unknown primitive tag: ${t}`);const s=st[t],a=o-3>>1;let c={prim:s},u=r(),l=e.copy();for(let t=0;t<2;t++){if(c={prim:s},a<3)for(let e=0;e0;){const e=u.next();if(e.done)throw new Error("REPORT ME: iterator is done");c.args.push(_t(t,e.value))}}u=n(c),l=e}if(1==(o-3&1)||3===a){const t=e.readUint32();if(0!==t){const r=e.readBytes(t),n=new TextDecoder;c.annots=n.decode(new Uint8Array(r)).split(" ")}}return i(c)}}}!function(e){e[e.Implicit=0]="Implicit",e[e.Originated=1]="Originated"}(dt||(dt={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.P256=2]="P256"}(ht||(ht={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.P256=2]="P256"}(pt||(pt={}));const wt=e=>"prim"in e&&("Left"===e.prim||"Right"===e.prim),Et=e=>"prim"in e&&("Some"===e.prim||"None"===e.prim),Ot=e=>{if(Ee(e))return t=>{if(!Oe(t))throw new fe(e,`pair expected: ${JSON.stringify(t)}`,t);ot(t);const r=we("pair",e);return[we("Pair",t),function*(){for(const e of r.args)yield Ot(e)}()]};switch(e.prim){case"or":return t=>{if(!wt(t))throw new fe(e,`or expected: ${JSON.stringify(t)}`,t);return[t,function*(){yield Ot(e.args["Left"===t.prim?0:1])}()]};case"option":return t=>{if(!Et(t))throw new fe(e,`option expected: ${JSON.stringify(t)}`,t);return[t,function*(){"Some"===t.prim&&(yield Ot(e.args[0]))}()]};case"list":case"set":return t=>{if(!Array.isArray(t))throw new fe(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const r of t)yield Ot(e.args[0])}()]};case"map":return t=>{if(!Array.isArray(t))throw new fe(e,`map expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const r of t)yield t=>{if(!("prim"in t)||"Elt"!==t.prim)throw new fe(e,`map element expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const t of e.args)yield Ot(t)}()]}}()]};case"chain_id":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`chain id expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ChainID");if(null===n)throw new fe(e,`chain id base58 expected: ${t.string}`,t);r={bytes:Pe(n[1])}}else r=t;return[r,[][Symbol.iterator]()]};case"signature":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`signature expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature");if(null===n)throw new fe(e,`signature base58 expected: ${t.string}`,t);r={bytes:Pe(n[1])}}else r=t;return[r,[][Symbol.iterator]()]};case"key_hash":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`key hash expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash");if(null===n)throw new fe(e,`key hash base58 expected: ${t.string}`,t);const i=new ut;gt({type:n[0],hash:n[1]},i),r={bytes:Pe(i.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"key":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`public key expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey");if(null===n)throw new fe(e,`public key base58 expected: ${t.string}`,t);const i=new ut;!function(e,t){let r;switch(e.type){case"ED25519PublicKey":r=pt.ED25519;break;case"SECP256K1PublicKey":r=pt.SECP256K1;break;case"P256PublicKey":r=pt.P256;break;default:throw new Error(`unexpected public key type: ${e.type}`)}t.writeUint8(r),t.writeBytes(Array.from(e.publicKey))}({type:n[0],publicKey:n[1]},i),r={bytes:Pe(i.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"address":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=t.string.split("%"),i=ye(n[0],"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash");if(null===i)throw new fe(e,`address base58 expected: ${t.string}`,t);const o=new ut;!function(e,t){if("ContractHash"===e.type?(t.writeUint8(dt.Originated),t.writeBytes(Array.from(e.hash)),t.writeUint8(0)):(t.writeUint8(dt.Implicit),gt(e,t)),void 0!==e.entryPoint&&""!==e.entryPoint&&"default"!==e.entryPoint){const r=(new TextEncoder).encode(e.entryPoint);t.writeBytes(Array.from(r))}}({type:i[0],hash:i[1],entryPoint:n.length>1?n[1]:void 0},o),r={bytes:Pe(o.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"timestamp":return t=>{if(!("string"in t)&&!("int"in t))throw new fe(e,`timestamp expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=Se(t);if(null===n)throw new fe(e,`can't parse date: ${t.string}`,t);r={int:String(Math.floor(n.getTime()/1e3))}}else r=t;return[r,[][Symbol.iterator]()]};default:return St}},At=e=>"prim"in e&&"PUSH"===e.prim,St=e=>At(e)?(Ke(e),[e,function*(){yield St,yield Ot(e.args[0])}()]):[e,function*(){for(;;)yield St}()];function Pt(e,t){const r=new ut;return r.writeUint8(5),yt(e,r,void 0!==t?Ot(t):St),r.buffer}function Tt(e,t){return{bytes:Pe(Pt(e,t))}}const It=e=>{if(Ee(e))return[t=>{if(!Oe(t))throw new fe(e,`pair expected: ${JSON.stringify(t)}`,t);const r=we("pair",e);return function*(){for(const e of r.args)yield It(e)}()},e=>e];switch(e.prim){case"or":return[t=>{if(!wt(t))throw new fe(e,`or expected: ${JSON.stringify(t)}`,t);return function*(){yield It(e.args["Left"===t.prim?0:1])}()},e=>e];case"option":return[t=>{if(!Et(t))throw new fe(e,`option expected: ${JSON.stringify(t)}`,t);return function*(){"Some"===t.prim&&(yield It(e.args[0]))}()},e=>e];case"list":case"set":return[t=>{if(!Array.isArray(t))throw new fe(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);return function*(){for(;;)yield It(e.args[0])}()},e=>e];case"map":return[t=>{if(!Array.isArray(t))throw new fe(e,`map expected: ${JSON.stringify(t)}`,t);return function*(){for(;;)yield[t=>{if(!("prim"in t)||"Elt"!==t.prim)throw new fe(e,`map element expected: ${JSON.stringify(t)}`,t);return function*(){for(const t of e.args)yield It(t)}()},e=>e]}()},e=>e];case"chain_id":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`chain id expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);return{string:_e("ChainID",r)}}];case"signature":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`signature expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);return{string:_e("GenericSignature",r)}}];case"key_hash":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`key hash expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=bt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"key":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`public key expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=vt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.publicKey)}}];case"address":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=mt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"timestamp":return[()=>[][Symbol.iterator](),t=>{if(!("int"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;return{string:new Date(1e3*parseInt(t.int,10)).toISOString().slice(0,19)+"Z"}}];default:return Rt}},Rt=[e=>At(e)?(Ke(e),function*(){yield Rt,yield It(e.args[0])}()):function*(){for(;;)yield Rt}(),e=>e];function xt(e,t){const r=new ft(e);if(5!==r.readUint8())throw new Error("incorrect packed data magic number");const n=_t(r,void 0!==t?It(t):Rt);if(Xe(n))return n;throw new Error}function Mt(e,t){const r=he(e.bytes);if(null===r)throw new Error(`can't parse bytes: "${e.bytes}"`);return xt(r,t)}function kt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return mt(new ft(new Uint8Array(t)))}function Lt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return bt(new ft(new Uint8Array(t)))}function Nt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return vt(new ft(new Uint8Array(t)))}class Ct extends ue{constructor(e,t,r){super(e,r),this.val=e,this.stackState=t,this.message=r,this.name="MichelsonInstructionError"}}function jt(e){return Array.isArray(e)?"pair":e.prim}function Dt(e){return"prim"in e?e.args:e}function Ut(e,t,r=!1){if(jt(e)!==jt(t))throw new fe(e,`types mismatch: ${jt(e)} != ${jt(t)}`,void 0);const n=[ge(e),ge(t)];if(n[0].t&&n[1].t&&n[0].t[0]!==n[1].t[0])throw new fe(e,`${jt(e)}: type names mismatch: ${n[0].t[0]} != ${n[1].t[0]}`,void 0);if(r&&n[0].f&&n[1].f&&n[0].f[0]!==n[1].f[0])throw new fe(e,`${jt(e)}: field names mismatch: ${n[0].f[0]} != ${n[1].f}`,void 0);if(Ee(e)){const r=we("pair",e),n=we("pair",t);return Ut(r.args[0],n.args[0],!0),void Ut(r.args[1],n.args[1],!0)}switch(e.prim){case"option":case"list":case"contract":case"set":case"ticket":Ut(e.args[0],t.args[0]);break;case"or":Ut(e.args[0],t.args[0],!0),Ut(e.args[1],t.args[1],!0);break;case"lambda":case"map":case"big_map":Ut(e.args[0],t.args[0]),Ut(e.args[1],t.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(e.args[0].int,10)!==parseInt(t.args[0].int,10))throw new fe(e,`${jt(e)}: type argument mismatch: ${e.args[0].int} != ${t.args[0].int}`,void 0)}}function Bt(e,t){if(e.length!==t.length)throw new fe(e,`stack length mismatch: ${e.length} != ${t.length}`,void 0);for(let r=0;r1)throw new fe(e,`${e.prim}: at most one type annotation allowed: ${e.annots}`,void 0);if(t){if(((null===(n=o.f)||void 0===n?void 0:n.length)||0)>1)throw new fe(e,`${e.prim}: at most one field annotation allowed: ${e.annots}`,void 0)}else if(((null===(i=o.f)||void 0===i?void 0:i.length)||0)>0)throw new fe(e,`${e.prim}: field annotations aren't allowed: ${e.annots}`,void 0)}if(Ee(e)){const t=Dt(e);for(const e of t)Ft(e,!0)}else switch(e.prim){case"option":case"list":case"contract":case"set":Ft(e.args[0]);break;case"or":for(const t of e.args)Ft(t,!0);break;case"lambda":case"map":case"big_map":Ft(e.args[0]),Ft(e.args[1])}}function Kt(e){if(!Array.isArray(e))return!1;for(const t of e)if(!(Array.isArray(t)&&Kt(t)||"prim"in t&&it(t)))return!1;return!0}function Ht(e,t,r){if(Ee(t)){if(Oe(e)){ot(e);const n=we("Pair",e),i=we("pair",t);return Ht(n.args[0],i.args[0],r),void Ht(n.args[1],i.args[1],r)}throw new fe(t,`pair expected: ${JSON.stringify(e)}`,e)}switch(t.prim){case"int":if("int"in e&&pe(e.int))return;throw new fe(t,`integer value expected: ${JSON.stringify(e)}`,e);case"nat":case"mutez":if("int"in e&&be(e.int))return;throw new fe(t,`natural value expected: ${JSON.stringify(e)}`,e);case"string":if("string"in e)return;throw new fe(t,`string value expected: ${JSON.stringify(e)}`,e);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in e&&null!==he(e.bytes))return;throw new fe(t,`bytes value expected: ${JSON.stringify(e)}`,e);case"bool":if("prim"in e&&("True"===e.prim||"False"===e.prim))return;throw new fe(t,`boolean value expected: ${JSON.stringify(e)}`,e);case"key_hash":if("string"in e&&null!==ye(e.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash"))return;if("bytes"in e)try{return void Lt(e)}catch(e){}throw new fe(t,`key hash expected: ${JSON.stringify(e)}`,e);case"timestamp":if(("string"in e||"int"in e)&&null!==Se(e))return;throw new fe(t,`timestamp expected: ${JSON.stringify(e)}`,e);case"address":if("string"in e){let t=e.string;const r=e.string.indexOf("%");if(r>=0&&(t=e.string.slice(0,r)),null!==ye(t,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress"))return}else if("bytes"in e)try{return void kt(e)}catch(e){}throw new fe(t,`address expected: ${JSON.stringify(e)}`,e);case"key":if("string"in e&&null!==ye(e.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey"))return;if("bytes"in e)try{return void Nt(e)}catch(e){}throw new fe(t,`public key expected: ${JSON.stringify(e)}`,e);case"unit":if("prim"in e&&"Unit"===e.prim)return;throw new fe(t,`unit value expected: ${JSON.stringify(e)}`,e);case"signature":if("bytes"in e||"string"in e&&null!==ye(e.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature"))return;throw new fe(t,`signature expected: ${JSON.stringify(e)}`,e);case"chain_id":if("bytes"in e||"string"in e){if(null!==("string"in e?ee(e.string):he(e.bytes)))return}throw new fe(t,`chain id expected: ${JSON.stringify(e)}`,e);case"option":if("prim"in e){if("None"===e.prim)return;if("Some"===e.prim)return void Ht(e.args[0],t.args[0],r)}throw new fe(t,`option expected: ${JSON.stringify(e)}`,e);case"list":case"set":if(ot(e)){for(const n of e)Ht(n,t.args[0],r);return}throw new fe(t,`${t.prim} expected: ${JSON.stringify(e)}`,e);case"or":if("prim"in e){if("Left"===e.prim)return void Ht(e.args[0],t.args[0],r);if("Right"===e.prim)return void Ht(e.args[0],t.args[1],r)}throw new fe(t,`union (or) expected: ${JSON.stringify(e)}`,e);case"lambda":if(Kt(e)){const n=Gt(e,[t.args[0]],r);if("failed"in n)throw new fe(t,`function is failed with error type: ${n.failed}`,e);if(1!==n.length)throw new fe(t,"function must return a value",e);return void Ut(t.args[1],n[0])}throw new fe(t,`function expected: ${JSON.stringify(e)}`,e);case"map":case"big_map":if(Array.isArray(e)){for(const n of e){if(!("prim"in n)||"Elt"!==n.prim)throw new fe(t,`map elements expected: ${JSON.stringify(e)}`,e);Ht(n.args[0],t.args[0],r),Ht(n.args[1],t.args[1],r)}return}throw new fe(t,`${t.prim} expected: ${JSON.stringify(e)}`,e);case"bls12_381_fr":if("int"in e&&pe(e.int)||"bytes"in e&&null!==he(e.bytes))return;throw new fe(t,`BLS12-381 element expected: ${JSON.stringify(e)}`,e);case"sapling_state":if(Array.isArray(e))return;throw new fe(t,`sapling state expected: ${JSON.stringify(e)}`,e);case"ticket":return void Ht(e,{prim:"pair",args:[{prim:"address"},t.args[0],{prim:"nat"}]},r);default:throw new fe(t,`type ${jt(t)} don't have Michelson literal representation`,e)}}function Gt(e,t,r){const n=(null==r?void 0:r.protocol)||b;if(Array.isArray(e))return function(e,t,r){let n=t,i=t,o=0;for(const t of e){const e=Gt(t,i,r);if(n=e,"failed"in e)break;i=e,o++}if("failed"in n&&0==n.level&&(!("prim"in n.failed)||"never"!==n.failed.prim)&&o!==e.length-1)throw new Ct(e,n,"FAIL must appear in a tail position");if(void 0!==(null==r?void 0:r.traceCallback)){const i={op:e,in:t,out:n};r.traceCallback(i)}return"failed"in n?{failed:n.failed,level:n.level+1}:n}(e,t,r);const i=e;function o(e,...r){if(t.length{try{return e(...r)}catch(e){throw e instanceof ue?new Ct(i,t,e.message):e}}}function a(e){return r=>{try{return e(r)}catch(e){throw e instanceof ue?new Ct(i,t,e.message):e}}}const c=s(ge),u=s(Bt),l=s(Ut),f=a(He),d=a(Ge),m=a(Ve),g=a($e),y=a(qe);function _(e,r){const n=c(i,Object.assign(Object.assign({},r),{emptyFields:void 0!==e.f&&e.f>1,emptyVar:void 0!==e.v&&e.v>1})),o=(e,r,n)=>{if(e&&e.length>(r||0))throw new Ct(i,t,`${i.prim}: at most ${r||0} ${n} annotations allowed`)};return o(n.f,e.f,"field"),o(n.t,e.t,"type"),o(n.v,e.v,"variable"),n}function w(e,t){const r=e,n=Array.isArray(r)?{prim:"pair",args:r}:r,i=c(n),o=void 0!==t.v||void 0!==t.t||void 0!==t.f?[...(null===t.v?i.v:t.v)||[],...(null===t.t?i.t:t.t)||[],...(null===t.f?i.f:t.f)||[]]:void 0,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i["@"+(e.v?e.v[0].slice(1)+".":"")+t];function I(e,t){return"failed"in e||"failed"in t?"failed"in e?t:e:(u(e,t),e)}const R=(e=>{var i,s,a,b,R;switch(e.prim){case"DUP":{const r=e.args?parseInt(e.args[0].int,10):1;if(0===r)throw new Ct(e,t,"DUP 0 is forbidden");const n=o(r-1,null)[0];if("ticket"===jt(n))throw new Ct(e,t,"ticket can't be DUPed");return[n,...t]}case"SWAP":{const e=o(0,null,null);return _({}),[e[1],e[0],...t.slice(2)]}case"SOME":return[w({prim:"option",args:[o(0,null)[0]]},_({t:1,v:1})),...t.slice(1)];case"UNIT":return[w({prim:"unit"},_({v:1,t:1})),...t];case"PAIR":{const r=e.args?parseInt(e.args[0].int,10):2;if(r<2)throw new Ct(e,t,`PAIR ${r} is forbidden`);const n=o(0,...new Array(r).fill(null)),i=_({f:r,t:1,v:1},{specialFields:!0}),s=e=>{const t=e.lastIndexOf(".");return e.slice(t>0?t+1:1)},a=n.map(((e,t)=>{var r;const n=c(e);return w(e,{v:null,t:null,f:i.f&&i.f.length>t&&"%"!==i.f[t]?"%@"===i.f[t]?n.v?["%"+s((null===(r=n.v)||void 0===r?void 0:r[0])||"")]:void 0:[i.f[t]]:void 0})}));return[w({prim:"pair",args:a},{t:i.t,v:i.v}),...t.slice(r)]}case"UNPAIR":{const r=e.args?parseInt(e.args[0].int,10):2;if(r<2)throw new Ct(e,t,`UNPAIR ${r} is forbidden`);const n=o(0,["pair"])[0],i=_({f:2,v:2},{specialVar:!0});return[...A(n,r).map(((e,t)=>O(n,e,i,t,0===t?"car":"cdr"))),...t.slice(1)]}case"CAR":case"CDR":{const r=we("pair",o(0,["pair"])[0]);return[O(r,r.args["CAR"===e.prim?0:1],_({f:1,v:1},{specialVar:!0}),0,e.prim.toLocaleLowerCase()),...t.slice(1)]}case"CONS":{const e=o(0,null,["list"]);return l(e[0],e[1].args[0]),[E({prim:"list",args:[e[1].args[0]]}),...t.slice(2)]}case"SIZE":return o(0,["string","list","set","map","bytes"]),[E({prim:"nat"}),...t.slice(1)];case"MEM":{const e=o(0,null,["set","map","big_map"]);return f(e[0]),l(e[0],e[1].args[0]),[E({prim:"bool"}),...t.slice(2)]}case"GET":if(e.args){const r=parseInt(e.args[0].int,10);return[E(S(o(0,["pair"])[0],r)),...t.slice(1)]}{const e=o(0,null,["map","big_map"]);return f(e[0]),l(e[0],e[1].args[0]),[E({prim:"option",args:[e[1].args[1]]}),...t.slice(2)]}case"UPDATE":if(e.args){const r=parseInt(e.args[0].int,10),n=o(0,null,["pair"]);return[E(P(n[1],n[0],r)),...t.slice(2)]}{const e=o(0,null,["bool","option"]);if(f(e[0]),"bool"===e[1].prim){const r=o(2,["set"]);return l(e[0],r[0].args[0]),[E({prim:"set",args:[w(e[0],{t:null})]}),...t.slice(3)]}const r=o(2,["map","big_map"]);return l(e[0],r[0].args[0]),"map"===r[0].prim?[E({prim:"map",args:[w(e[0],{t:null}),w(e[1].args[0],{t:null})]}),...t.slice(3)]:(y(e[1].args[0]),[E({prim:"big_map",args:[w(e[0],{t:null}),w(e[1].args[0],{t:null})]}),...t.slice(3)])}case"GET_AND_UPDATE":{const e=_({v:2}),r=o(0,null,["option"],["map","big_map"]);f(r[0]),l(r[0],r[2].args[0]),l(r[1].args[0],r[2].args[1]);const n=null===(i=e.v)||void 0===i?void 0:i.map((e=>"@"!==e?[e]:void 0));return"map"===r[2].prim?[w({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),w({prim:"map",args:[w(r[0],{t:null}),w(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...t.slice(3)]:(y(r[1].args[0]),[w({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),w({prim:"big_map",args:[w(r[0],{t:null}),w(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...t.slice(3)])}case"EXEC":{const e=o(0,null,["lambda"]);return l(e[0],e[1].args[0]),[E(e[1].args[1]),...t.slice(2)]}case"APPLY":{const r=o(0,null,["lambda"]);if(m(r[0]),g(r[0]),!Ee(r[1].args[0]))throw new Ct(e,t,`${e.prim}: function's argument must be a pair: ${jt(r[1].args[0])}`);const n=r[1].args[0];return l(r[0],Dt(n)[0]),[E({prim:"lambda",args:[Dt(n)[1],r[1].args[1]]}),...t.slice(2)]}case"FAILWITH":{const e=o(0,null)[0];return v(n,p.PtEdo2Zk)||d(e),{failed:e,level:0}}case"NEVER":return o(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[E(o(0,null)[0]),...t.slice(1)];case"CONCAT":{const r=o(0,["string","list","bytes"]);if("list"===r[0].prim){if("string"!==jt(r[0].args[0])&&"bytes"!==jt(r[0].args[0]))throw new Ct(e,t,`${e.prim}: can't concatenate list of ${jt(r[0].args[0])}'s`);return[E(r[0].args[0]),...t.slice(1)]}const n=o(1,["string","bytes"]);if(r[0].prim!==n[0].prim)throw new Ct(e,t,`${e.prim}: can't concatenate ${r[0].prim} with ${n[0].prim}`);return[E(n[0]),...t.slice(2)]}case"SLICE":return[E({prim:"option",args:[o(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...t.slice(3)];case"PACK":{const e=o(0,null)[0];return d(e),[E({prim:"bytes"},"@packed"),...t.slice(1)]}case"ADD":{const r=o(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("int"===r[0].prim&&"timestamp"===r[1].prim||"timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...t.slice(2)];if(("int"===r[0].prim||"nat"===r[0].prim||"mutez"===r[0].prim||"bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't add ${r[0].prim} to ${r[1].prim}`)}case"SUB":{const r=v(n,p.PsiThaCa)?o(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):o(0,["nat","int","timestamp"],["nat","int","timestamp"]);if(("nat"===r[0].prim||"int"===r[0].prim)&&("nat"===r[1].prim||"int"===r[1].prim)||"timestamp"===r[0].prim&&"timestamp"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...t.slice(2)];if("mutez"===r[0].prim&&"mutez"===r[1].prim)return[E({prim:"mutez"}),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't subtract ${r[0].prim} from ${r[1].prim}`)}case"SUB_MUTEZ":return o(0,["mutez"],["mutez"]),[E({prim:"option",args:[{prim:"mutez"}]}),...t.slice(2)];case"MUL":{const r=o(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("nat"===r[0].prim&&"mutez"===r[1].prim||"mutez"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"mutez"}),...t.slice(2)];if(("bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[0].prim||"int"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...t.slice(2)];if(("nat"===r[0].prim||"int"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[1].prim||"int"===r[1].prim)&&"bls12_381_fr"===r[0].prim)return[E({prim:"bls12_381_fr"}),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't multiply ${r[0].prim} by ${r[1].prim}`)}case"EDIV":{const r=(e,t)=>({prim:"option",args:[{prim:"pair",args:[{prim:e},{prim:t}]}]}),n=o(0,["nat","int","mutez"],["nat","int","mutez"]);if("nat"===n[0].prim&&"nat"===n[1].prim)return[E(r("nat","nat")),...t.slice(2)];if(!("nat"!==n[0].prim&&"int"!==n[0].prim||"nat"!==n[1].prim&&"int"!==n[1].prim))return[E(r("int","nat")),...t.slice(2)];if("mutez"===n[0].prim&&"nat"===n[1].prim)return[E(r("mutez","mutez")),...t.slice(2)];if("mutez"===n[0].prim&&"mutez"===n[1].prim)return[E(r("nat","mutez")),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't euclideally divide ${n[0].prim} by ${n[1].prim}`)}case"ABS":return o(0,["int"]),[E({prim:"nat"}),...t.slice(1)];case"ISNAT":return o(0,["int"]),[E({prim:"option",args:[{prim:"nat"}]}),...t.slice(1)];case"INT":return o(0,["nat","bls12_381_fr","bytes"]),[E({prim:"int"}),...t.slice(1)];case"BYTES":return o(0,["nat","int"]),[E({prim:"bytes"}),...t.slice(1)];case"NAT":return o(0,["bytes"]),[E({prim:"nat"}),...t.slice(1)];case"NEG":{const e=o(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return"nat"===e.prim||"int"===e.prim?[E({prim:"int"}),...t.slice(1)]:[E(e),...t.slice(1)]}case"LSL":case"LSR":return o(0,["nat","bytes"],["nat","bytes"]),[E({prim:"nat"}),...t.slice(2)];case"OR":case"XOR":{const r=o(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(r[0].prim!==r[1].prim)throw new Ct(e,t,`${e.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...t.slice(2)]}case"AND":{const r=o(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if(("int"!==r[0].prim||"nat"!==r[1].prim)&&r[0].prim!==r[1].prim)throw new Ct(e,t,`${e.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...t.slice(2)]}case"NOT":return"bool"===o(0,["nat","bytes","bool","int"])[0].prim?[E({prim:"bool"}),...t.slice(1)]:[E({prim:"int"}),...t.slice(1)];case"COMPARE":{const e=o(0,null,null);return f(e[0]),f(e[1]),[E({prim:"int"}),...t.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return o(0,["int"]),[E({prim:"bool"}),...t.slice(1)];case"SELF":{if(void 0===(null==r?void 0:r.contract))throw new Ct(e,t,`${e.prim}: contract required`);const n=_({f:1,v:1}),i=qt(r.contract,null===(s=n.f)||void 0===s?void 0:s[0]);if(null===i)throw new Ct(e,t,`${e.prim}: contract has no entrypoint ${i}`);return[w({prim:"contract",args:[i]},{v:n.v?n.v:["@self"]}),...t]}case"TRANSFER_TOKENS":{const e=o(0,null,["mutez"],["contract"]);return l(e[0],e[2].args[0]),[E({prim:"operation"}),...t.slice(3)]}case"SET_DELEGATE":{const r=o(0,["option"])[0];if("key_hash"!==jt(r.args[0]))throw new Ct(e,t,`${e.prim}: key hash expected: ${jt(r.args[0])}`);return[E({prim:"operation"}),...t.slice(1)]}case"IMPLICIT_ACCOUNT":return o(0,["key_hash"]),[E({prim:"contract",args:[{prim:"unit"}]}),...t.slice(1)];case"NOW":return[E({prim:"timestamp"},"@now"),...t];case"AMOUNT":return[E({prim:"mutez"},"@amount"),...t];case"BALANCE":return[E({prim:"mutez"},"@balance"),...t];case"CHECK_SIGNATURE":return o(0,["key"],["signature"],["bytes"]),[E({prim:"bool"}),...t.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return o(0,["bytes"]),[E({prim:"bytes"}),...t.slice(1)];case"HASH_KEY":return o(0,["key"]),[E({prim:"key_hash"}),...t.slice(1)];case"SOURCE":return[E({prim:"address"},"@source"),...t];case"SENDER":return[E({prim:"address"},"@sender"),...t];case"ADDRESS":{const e=o(0,["contract"])[0],r=_({v:1});return[w({prim:"address",[h]:e},{v:r.v?r.v:T(c(e),"address")}),...t.slice(1)]}case"SELF_ADDRESS":{const e={prim:"address"};return void 0!==(null==r?void 0:r.contract)&&(e[h]={prim:"contract",args:[$t(r.contract,"parameter").args[0]]}),[E(e,"@address"),...t]}case"CHAIN_ID":return[E({prim:"chain_id"}),...t];case"DROP":{_({});const r=void 0!==e.args?parseInt(e.args[0].int,10):1;return o(r-1,null),t.slice(r)}case"DIG":{_({});const r=parseInt(e.args[0].int,10);return[o(r,null)[0],...t.slice(0,r),...t.slice(r+1)]}case"DUG":{_({});const r=parseInt(e.args[0].int,10);return[...t.slice(1,r+1),o(0,null)[0],...t.slice(r+1)]}case"NONE":return Ft(e.args[0]),[w({prim:"option",args:[e.args[0]]},_({t:1,v:1})),...t];case"LEFT":case"RIGHT":{const r=o(0,null)[0],n=_({f:2,t:1,v:1},{specialFields:!0}),i=c(r),s=[w(r,{t:null,v:null,f:n.f&&n.f.length>0&&"%"!==n.f[0]?"%@"===n.f[0]?i.v?["%"+i.v[0].slice(1)]:void 0:n.f:void 0}),w(e.args[0],{t:null,f:n.f&&n.f.length>1&&"%"!==n.f[1]?n.f:void 0})];return[w({prim:"or",args:"LEFT"===e.prim?s:[s[1],s[0]]},{t:n.t,v:n.v}),...t.slice(1)]}case"NIL":return Ft(e.args[0]),[w({prim:"list",args:[e.args[0]]},_({t:1,v:1})),...t];case"UNPACK":return o(0,["bytes"]),Ft(e.args[0]),[E({prim:"option",args:[e.args[0]]},"@unpacked"),...t.slice(1)];case"CONTRACT":{const r=o(0,["address"])[0];Ft(e.args[0]);const n=_({v:1,f:1}),i=r[h];if(void 0!==i){const r=qt(i,null===(a=n.f)||void 0===a?void 0:a[0]);if(null===r)throw new Ct(e,t,`${e.prim}: contract has no entrypoint ${r}`);l(r,e.args[0])}return[w({prim:"option",args:[{prim:"contract",args:[e.args[0]]}]},{v:n.v?n.v:T(c(r),"contract")}),...t.slice(1)]}case"CAST":{_({});const r=o(0,null)[0];return Ft(e.args[0]),l(e.args[0],r),[e.args[0],...t.slice(1)]}case"IF_NONE":{_({});const n=o(0,["option"])[0],i=t.slice(1);return I(Gt(e.args[0],i,r),Gt(e.args[1],[w(n.args[0],{t:null,v:T(c(n),"some")}),...i],r))}case"IF_LEFT":{_({});const n=o(0,["or"])[0],i=c(n),s=c(n.args[0]),a=c(n.args[1]),u=t.slice(1);return I(Gt(e.args[0],[w(n.args[0],{t:null,v:T(i,s.f?s.f[0].slice(1):"left")}),...u],r),Gt(e.args[1],[w(n.args[1],{t:null,v:T(i,a.f?a.f[0].slice(1):"right")}),...u],r))}case"IF_CONS":{_({});const n=o(0,["list"])[0],i=c(n),s=t.slice(1);return I(Gt(e.args[0],[w(n.args[0],{t:null,v:T(i,"hd")}),w(n,{t:null,v:T(i,"tl")}),...s],r),Gt(e.args[1],s,r))}case"IF":{_({}),o(0,["bool"]);const n=t.slice(1);return I(Gt(e.args[0],n,r),Gt(e.args[1],n,r))}case"MAP":{const n=o(0,["list","map","option"])[0],i=t.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=Gt(e.args[0],[w(s,{t:null,v:T(c(n),"elt")}),...i],r);if("failed"in a){if(!("prim"in a.failed)||"never"!==a.failed.prim)throw new Ct(e,t,`${e.prim}: FAIL is not allowed in MAP`);return{failed:a.failed,level:a.level+1}}if(a.length<1)throw new Ct(e,t,`${e.prim}: function must return a value`);return u(a.slice(1),i),"list"===n.prim?[E({prim:"list",args:[a[0]]}),...i]:"map"===n.prim?[E({prim:"map",args:[n.args[0],a[0]]}),...i]:[E({prim:"option",args:[a[0]]}),...i]}case"ITER":{_({});const n=o(0,["set","list","map"])[0],i=t.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=Gt(e.args[0],[w(s,{t:null,v:T(c(n),"elt")}),...i],r);return"failed"in a?{failed:a.failed,level:a.level+1}:(u(a,i),i)}case"LOOP":{_({}),o(0,["bool"]);const n=t.slice(1),i=Gt(e.args[0],n,r);return"failed"in i?{failed:i.failed,level:i.level+1}:(u(i,[{prim:"bool"},...n]),n)}case"LOOP_LEFT":{_({});const n=o(0,["or"])[0],i=t.slice(1),s=Gt(e.args[0],[w(n.args[0],{t:null,v:T(c(n),"left")}),...i],r);return"failed"in s?{failed:s.failed,level:s.level+1}:(u(s,[n,...i]),[w(n.args[1],{t:null,v:_({v:1}).v}),...i])}case"DIP":{_({});const n=2===e.args.length?parseInt(e.args[0].int,10):1;o(n-1,null);const i=t.slice(0,n),s=t.slice(n),a=2===e.args.length?Gt(e.args[1],s,r):Gt(e.args[0],s,r);return"failed"in a?{failed:a.failed,level:a.level+1}:[...i,...a]}case"CREATE_CONTRACT":{const r=_({v:2}),n=o(0,["option"],["mutez"],null);if("key_hash"!==jt(n[0].args[0]))throw new Ct(e,t,`${e.prim}: key hash expected: ${jt(n[0].args[0])}`);m(n[2])&&(Zt(e.args[0]),Ut($t(e.args[0],"storage").args[0],n[2]));const i=null===(b=r.v)||void 0===b?void 0:b.map((e=>"@"!==e?[e]:void 0));return[w({prim:"operation"},{v:null==i?void 0:i[0]}),w({prim:"address",[h]:{prim:"contract",args:[$t(e.args[0],"parameter").args[0]]}},{v:null==i?void 0:i[1]}),...t.slice(3)]}case"PUSH":return Ft(e.args[0]),Ht(e.args[1],e.args[0],Object.assign(Object.assign({},r),{contract:void 0})),[E(e.args[0]),...t];case"EMPTY_SET":return Ft(e.args[0]),f(e.args[0]),[w({prim:"set",args:e.args},_({t:1,v:1})),...t];case"EMPTY_MAP":return Ft(e.args[0]),f(e.args[0]),Ft(e.args[1]),[w({prim:"map",args:e.args},_({t:1,v:1})),...t];case"EMPTY_BIG_MAP":return Ft(e.args[0]),f(e.args[0]),Ft(e.args[1]),y(e.args[0]),[w({prim:"big_map",args:e.args},_({t:1,v:1})),...t];case"LAMBDA_REC":case"LAMBDA":{Ft(e.args[0]),Ft(e.args[1]);const n=[e.args[0]];"LAMBDA_REC"===e.prim&&n.push({prim:"lambda",args:[e.args[0],e.args[1]]});const i=Gt(e.args[2],n,Object.assign(Object.assign({},r),{contract:void 0}));if("failed"in i)return{failed:i.failed,level:i.level+1};if(1!==i.length)throw new Ct(e,t,`${e.prim}: function must return a value`);return l(e.args[1],i[0]),[E({prim:"lambda",args:[e.args[0],e.args[1]]}),...t]}case"LEVEL":return[E({prim:"nat"},"@level"),...t];case"TOTAL_VOTING_POWER":case"MIN_BLOCK_TIME":return[E({prim:"nat"}),...t];case"VOTING_POWER":return o(0,["key_hash"]),[E({prim:"nat"}),...t.slice(1)];case"TICKET":{const e=o(0,null,["nat"])[0];return f(e),v(n,p.PtLimaPtL)?[w({prim:"ticket",args:[e]},_({t:1,v:1})),...t.slice(2)]:[E({prim:"option",args:[w({prim:"ticket",args:[e]},_({t:1,v:1}))]}),...t.slice(2)]}case"JOIN_TICKETS":{const r=we("pair",o(0,["pair"])[0]);if("ticket"!==jt(r.args[0]))throw new Ct(e,t,`${e.prim}: ticket expected: ${jt(r.args[0])}`);return l(r.args[0],r.args[1]),[E({prim:"option",args:[w(r.args[0],{t:null})]}),...t.slice(1)]}case"SPLIT_TICKET":{const r=o(0,["ticket"],["pair"]),n=we("pair",r[1]);if("nat"!==jt(n.args[0]))throw new Ct(e,t,`${e.prim}: nat expected: ${jt(n.args[0])}`);return l(n.args[0],n.args[1]),[E({prim:"option",args:[{prim:"pair",args:[w(r[0],{t:null}),w(r[0],{t:null})]}]}),...t.slice(2)]}case"READ_TICKET":{const e=_({v:2}),r=o(0,["ticket"])[0],n=null===(R=e.v)||void 0===R?void 0:R.map((e=>"@"!==e?[e]:void 0));return[w({prim:"pair",args:[{prim:"address"},w(r.args[0],{t:null}),{prim:"nat"}]},{v:null==n?void 0:n[0]}),w(r,{v:null==n?void 0:n[1],t:null}),...t.slice(1)]}case"PAIRING_CHECK":{const r=o(0,["list"])[0].args[0];if(!Ee(r))throw new Ct(e,t,`${e.prim}: pair expected: ${jt(r)}`);const n=we("pair",r);if("bls12_381_g1"!==jt(n.args[0]))throw new Ct(e,t,`${e.prim}: bls12_381_g1 expected: ${jt(n.args[0])}`);if("bls12_381_g2"!==jt(n.args[1]))throw new Ct(e,t,`${e.prim}: bls12_381_g2 expected: ${jt(n.args[1])}`);return[E({prim:"bool"}),...t.slice(1)]}case"SAPLING_EMPTY_STATE":return[w({prim:"sapling_state",args:[e.args[0]]},_({v:1,t:1})),...t];case"SAPLING_VERIFY_UPDATE":{const r=o(0,["sapling_transaction"],["sapling_state"]);if(parseInt(r[0].args[0].int,10)!==parseInt(r[1].args[0].int,10))throw new Ct(e,t,`${e.prim}: sapling memo size mismatch: ${r[0].args[0].int} != ${r[1].args[0].int}`);return v(n,p.PtJakarta)?[E({prim:"option",args:[{prim:"pair",args:[{prim:"int"},w(r[1],{t:null})]}]}),...t.slice(2)]:[E({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},w(r[1],{t:null})]}]}]}),...t.slice(2)]}case"OPEN_CHEST":return o(0,["chest_key"],["chest"],["nat"]),[E({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...t.slice(3)];case"VIEW":{const r=o(0,null,["address"]);return g(r[0]),[E({prim:"option",args:[e.args[1]]}),...t.slice(2)]}case"EMIT":{const r=_({f:1,t:1});if(e.args){const n=o(0,null);return l(n[0],e.args[0]),[w({prim:"operation"},r),...t.slice(1)]}return[w({prim:"operation"},r),...t.slice(1)]}default:throw new ue(e,`unexpected instruction: ${e.prim}`)}})(i);if(void 0!==(null==r?void 0:r.traceCallback)){const e={op:i,in:t,out:R};r.traceCallback(e)}return R}function $t(e,t){for(const r of e)if(r.prim===t)return r;throw new ue(e,`missing contract section: ${t}`)}function Vt(e){const t={};for(const r of e)"view"===r.prim&&(t[r.args[0].string]=r);return t}function zt(e){if(Array.isArray(e))for(const t of e)if("prim"in t&&("parameter"===t.prim||"storage"===t.prim||"code"===t.prim))return!0;return!1}function qt(e,t){t=t||"%default";const r=Wt(e).find((e=>e[0]===t));return void 0!==r?r[1]:"%default"===t?zt(e)?$t(e,"parameter").args[0]:e:null}function Wt(e){if(zt(e)){const t=$t(e,"parameter"),r=Wt(t.args[0]),n=ge(t);return n.f?[[n.f[0],t.args[0]],...r]:r}if(t=e,Array.isArray(t)||"or"===t.prim){const t=Dt(e),r=e=>{const r=ge(t[e]);if("or"===jt(t[e])){const n=Wt(t[e]);return r.f?[[r.f[0],t[e]],...n]:n}return r.f?[[r.f[0],t[e]]]:[]};return[...r(0),...r(1)]}var t;return[]}function Zt(e,t){const r=(r,n,i,o)=>{Ft(r,!0),Ft(n);const s=Gt(o,[{prim:"pair",args:[Object.assign(Object.assign({},r),{annots:["@parameter"]}),Object.assign(Object.assign({},n),{annots:["@storage"]})]}],Object.assign(Object.assign({},t),{contract:e}));if("failed"in s)return s;try{Bt(s,[i])}catch(e){throw e instanceof ue?new Ct(o,s,e.message):e}return s},n=$t(e,"parameter").args[0],i=$t(e,"storage").args[0],o=r(n,i,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},i]},$t(e,"code").args[0]);for(const t of Object.values(Vt(e)))r(t.args[1],i,t.args[2],t.args[3]);return o}function Jt(e,t,r){Ft(t),Ht(e,t,r||null)}function Yt(e,t,r){for(const e of t)Ft(e);if(void 0!==(null==r?void 0:r.contract))for(const e of["parameter","storage"]){Ft($t(r.contract,e).args[0])}return Gt(e,t,r||null)}function Xt(e,t,r=!1){if(Array.isArray(e)){for(const t of e)Ft(t);for(const e of t)Ft(e)}else Ft(e),Ft(t);Ut(e,t,r)}function Qt(e,t=!1){try{return Ft(e,t),!0}catch(e){return!1}}function er(e,t){try{return Zt(e,t)}catch(e){return null}}function tr(e,t,r){try{return Jt(e,t,r),!0}catch(e){return!1}}function rr(e,t,r=!1){try{return Xt(e,t,r),!0}catch(e){return!1}}class nr{constructor(e,t){this.contract=e,this.ctx=Object.assign({contract:e},t),this.output=Zt(e,this.ctx)}static parse(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new re("empty Michelson");if(Qe(n))return new nr(n,t)}static parseTypeExpression(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new ne("empty type expression");if(Je(n))return Ft(n),n}static parseDataExpression(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new ie("empty data expression");if(Xe(n))return n;throw void 0}section(e){return $t(this.contract,e)}entryPoints(){return Wt(this.contract)}entryPoint(e){return qt(this.contract,e)}assertDataValid(e,t){Jt(e,t,this.ctx)}isDataValid(e,t){return tr(e,t,this.ctx)}assertParameterValid(e,t){const r=this.entryPoint(e||void 0);if(null===r)throw new oe(null==e?void 0:e.toString());this.assertDataValid(t,r)}isParameterValid(e,t){try{return this.assertParameterValid(e,t),!0}catch(e){return!1}}functionType(e,t){return Yt(e,t,this.ctx)}}const ir=new nr([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);function or(e){return"failed"in e?`[FAILED: ${z(e.failed)}]`:e.map(((e,t)=>{const r=ge(e);return`[${t}${r.v?"/"+r.v[0]:""}]: ${z(e)}`})).join("\n")}function sr(e,t){return r=>{var n;if(Array.isArray(r)&&!e)return;const o=null===(n=r.op[i])||void 0===n?void 0:n.macro,s=`${o?"Macro":"Op"}: ${o?z(o,void 0,!0)+" / ":""}${z(r.op)}\nInput:\n${or(r.in)}\nOutput:\n${or(r.out)}\n`;t(s)}}function ar(e){var t;if(e instanceof Ct){const r=null===(t=e.val[i])||void 0===t?void 0:t.macro;return`${r?"Macro":"Op"}: ${r?z(r,void 0,!0)+" / ":""}${z(e.val)}\nStack:\n${or(e.stackState)}\n`}if(e instanceof fe){return`Type: ${Array.isArray(e.val)?"["+e.val.map(((e,t)=>`[${t}]: ${z(e)}`)).join("; ")+"]":z(e.val)}\n${e.data?`Data: ${z(e.data)}\n`:""}\n`}return`Value: ${z(e.val)}`}const cr={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"}},8899:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AddressValidationError:()=>T,BigMapEncodingError:()=>Fe,BigMapValidationError:()=>m,BytesValidationError:()=>U,ChainIDValidationError:()=>te,ContractValidationError:()=>k,EncodeTicketError:()=>ne,EventSchema:()=>Je,IntValidationError:()=>H,InvalidBigMapDiffError:()=>Be,InvalidBigMapSchemaError:()=>Ue,InvalidMapTypeError:()=>u,InvalidRpcResponseError:()=>De,InvalidScriptError:()=>je,KeyHashValidationError:()=>q,KeyValidationError:()=>V,ListValidationError:()=>N,MapTypecheckError:()=>f,MapValidationError:()=>R,MichelsonMap:()=>d,MissingArgumentError:()=>He,MutezValidationError:()=>j,NatValidationError:()=>A,OrValidationError:()=>v,ParameterEncodingError:()=>Ce,ParameterSchema:()=>We,SaplingStateValue:()=>Qe,Schema:()=>qe,SetValidationError:()=>Q,SignatureValidationError:()=>Z,StorageEncodingError:()=>Ke,Token:()=>p,TokenArgumentValidationError:()=>_,TokenComparisonError:()=>w,UnitValue:()=>Xe,VERSION:()=>Ye,ViewSchema:()=>Ze,deepEqual:()=>ze});var n,i=r(5695),o=r.n(i),s=r(227),a=r(2558),c=r(4632);class u extends s.TaquitoError{constructor(e,t){super(),this.mapType=e,this.reason=t,this.message=`The map type '${JSON.stringify(e)}' is invalid. Reason: ${t}.`,this.name="InvalidMapTypeError"}}const l=Symbol.for("taquito-michelson-map-type-symbol");class f extends s.TaquitoError{constructor(e,t,r,n){super(),this.value=e,this.type=t,this.reason=n,this.name="MapTypecheckError",this.message=`The ${r} provided: ${JSON.stringify(e)} is not compatible with the expected michelson type: ${JSON.stringify(t)}. Reason: ${JSON.stringify(n)}.`,this.name="MapTypecheckError"}}class d{static isMichelsonMap(e){return e&&!0===e[l]}constructor(e){this.valueMap=new Map,this.keyMap=new Map,this[n]=!0,e&&this.setType(e)}setType(e){!function(e){if(!("prim"in e))throw new u(e,"Missing 'prim' field");if(!["map","big_map"].includes(e.prim))throw new u(e,"The prim field should be 'map' or 'big_map'");if(!("args"in e))throw new u(e,"Missing 'args' field");if(!Array.isArray(e.args))throw new u(e,"The 'args' field should be an array");if(2!==e.args.length)throw new u(e,"The 'args' field should have 2 elements")}(e),this.keySchema=new qe(e.args[0]),this.valueSchema=new qe(e.args[1])}removeType(){this.keySchema=void 0,this.valueSchema=void 0}static fromLiteral(e,t){const r=new d(t);return Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}typecheckKey(e){this.keySchema&&this.keySchema.Typecheck(e)}typecheckValue(e){this.valueSchema&&this.valueSchema.Typecheck(e)}assertTypecheckValue(e){try{this.typecheckValue(e)}catch(t){throw new f(e,this.valueSchema,"value",t)}}assertTypecheckKey(e){try{this.typecheckKey(e)}catch(t){throw new f(e,this.keySchema,"key",t)}}serializeDeterministically(e){return o()(e)}*keys(){for(const[e]of this.entries())yield e}*values(){for(const[,e]of this.entries())yield e}*entries(){for(const e of this.valueMap.keys())yield[this.keyMap.get(e),this.valueMap.get(e)]}get(e){this.assertTypecheckKey(e);const t=this.serializeDeterministically(e);return this.valueMap.get(t)}set(e,t){this.assertTypecheckKey(e),this.assertTypecheckValue(t);const r=this.serializeDeterministically(e);this.keyMap.set(r,e),this.valueMap.set(r,t)}delete(e){this.assertTypecheckKey(e),this.keyMap.delete(this.serializeDeterministically(e)),this.valueMap.delete(this.serializeDeterministically(e))}has(e){this.assertTypecheckKey(e);const t=this.serializeDeterministically(e);return this.keyMap.has(t)&&this.valueMap.has(t)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(e){for(const[t,r]of this.entries())e(r,t,this)}}n=l;class h extends s.TaquitoError{constructor(e,t,r){super(),this.value=e,this.token=t,this.name="TokenValidationError";const n=this.token.annot(),i=n?`[${n}] `:"";this.message=`${i}${r}`}}class p{constructor(e,t,r){this.val=e,this.idx=t,this.fac=r,this.createToken=this.fac}typeWithoutAnnotations(){const e=t=>{if("object"==typeof t){if(Array.isArray(t)){return t.map((t=>e(t)))}const r=t;return r.args?{prim:r.prim,args:r.args.map((t=>e(t)))}:{prim:r.prim}}return t};return(t=this.val).args?{prim:t.prim,args:t.args.map((t=>e(t)))}:{prim:t.prim};var t}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.ExtractSchema()]]}}class b extends p{compare(e,t){return e===t?0:ethis.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(t.get(e))]})))}EncodeObject(e,t){const r=this.objLitToMichelsonMap(e);return this.validate(r),t&&t[g.prim]?t[g.prim](r,this.val):Array.from(r.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(r.get(e))]})))}Execute(e,t){if(t&&t[g.prim])return t[g.prim](e,this.val);if(Array.isArray(e)){const t=new d(this.val);return e.forEach((e=>{t.set(this.KeySchema.ToKey(e.args[0]),this.ValueSchema.Execute(e.args[1]))})),t}if("int"in e)return e.int;throw new m(e,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(e)}`)}findAndReturnTokens(e,t){return g.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),this.ValueSchema.findAndReturnTokens(e,t),t}}g.prim="big_map";class v extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="OrValidationError"}}class y extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Encode(e){const t=e[e.length-1],r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof y&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if(String(r.annot())!==String(t)||r instanceof y){if(String(i.annot())!==String(t)||i instanceof y){if(r instanceof y){const t=r.Encode(e);if(t)return{prim:"Left",args:[t]}}if(i instanceof y){const t=i.Encode(e);if(t)return{prim:"Right",args:[t]}}return null}return e.pop(),{prim:"Right",args:[i.Encode(e)]}}return e.pop(),{prim:"Left",args:[r.Encode(e)]}}ExtractSignature(){const e=this.createToken(this.val.args[0],this.idx);let t=1;e instanceof y&&(t=Object.keys(e.ExtractSchema()).length);const r=this.createToken(this.val.args[1],this.idx+t),n=[];if(e instanceof y)n.push(...e.ExtractSignature());else for(const t of e.ExtractSignature())n.push([e.annot(),...t]);if(r instanceof y)n.push(...r.ExtractSignature());else for(const e of r.ExtractSignature())n.push([r.annot(),...e]);return n}EncodeObject(e,t){this.validateJavascriptObject(e);const r=Object.keys(e)[0],n=this.createToken(this.val.args[0],this.idx);let i=1;n instanceof y&&(i=Object.keys(n.ExtractSchema()).length);const o=this.createToken(this.val.args[1],this.idx+i);if(String(n.annot())!==String(r)||n instanceof y){if(String(o.annot())!==String(r)||o instanceof y){if(n instanceof y){const r=n.EncodeObject(e,t);if(r)return{prim:"Left",args:[r]}}if(o instanceof y){const r=o.EncodeObject(e,t);if(r)return{prim:"Right",args:[r]}}return null}return{prim:"Right",args:[o.EncodeObject(e[r],t)]}}return{prim:"Left",args:[n.EncodeObject(e[r],t)]}}validateJavascriptObject(e){if("object"!=typeof e||Array.isArray(e)||null===e||1!==Object.keys(e).length)throw new v(e,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(e)}`)}Execute(e,t){const r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof y&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if("Right"===e.prim)return i instanceof y?i.Execute(e.args[0],t):{[i.annot()]:i.Execute(e.args[0],t)};if("Left"===e.prim)return r instanceof y?r.Execute(e.args[0],t):{[r.annot()]:r.Execute(e.args[0],t)};throw new v(e,this,`Was expecting Left or Right prim but got: ${JSON.stringify(e.prim)}`)}traversal(e,t,r){const n=this.createToken(this.val.args[0],this.idx);let i,o=1;n instanceof y?(i=e(n),o=Object.keys(n.ExtractSchema()).length):i={[n.annot()]:e(n)};const s=this.createToken(this.val.args[1],this.idx+o);let a;a=s instanceof y?t(s):{[s.annot()]:t(s)};return r(i,a)}ExtractSchema(){return this.traversal((e=>e.ExtractSchema()),(e=>e.ExtractSchema()),((e,t)=>Object.assign(Object.assign({},e),t)))}generateSchema(){return{__michelsonType:y.prim,schema:this.traversal((e=>e instanceof y?e.generateSchema().schema:e.generateSchema()),(e=>e instanceof y?e.generateSchema().schema:e.generateSchema()),((e,t)=>Object.assign(Object.assign({},e),t)))}}findToken(e){const t=this.createToken(this.val.args[0],this.idx);let r=1;t instanceof y&&(r=Object.keys(t.ExtractSchema()).length);const n=this.createToken(this.val.args[1],this.idx+r);if(String(t.annot())===String(e)&&!(t instanceof y)&&t instanceof b)return t;if(String(n.annot())===String(e)&&!(n instanceof y)&&n instanceof b)return n;if(t instanceof y){const r=t.findToken(e);if(r)return r}if(n instanceof y){const t=n.findToken(e);if(t)return t}return null}compare(e,t){const r=Object.keys(e)[0];if(r!==Object.keys(t)[0]){return JSON.stringify(this.EncodeObject(e))r.findAndReturnTokens(e,t)),(r=>r.findAndReturnTokens(e,t)),((e,t)=>Object.assign(Object.assign({},e),t))),t}}y.prim="or";class _ extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="TokenArgumentValidationError"}}class w extends s.TaquitoError{constructor(e,t){super(),this.val1=e,this.val2=t,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(e)} and ${JSON.stringify(t)} are not comparable`}}function E(e,t=O.prim){if(Array.isArray(e))return E({prim:t,args:e},t);if(void 0===e.args)throw new _(`The value ${JSON.stringify(e)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return e.args.length>2?[e.args[0],{prim:t,args:e.args.slice(1)}]:[e.args[0],e.args[1]]}class O extends b{constructor(e,t,r){super(Array.isArray(e)?{prim:O.prim,args:e}:e.prim?e:{prim:O.prim,args:e},t,r)}args(){return E(this.val)}tokens(){let e=0;return this.args().map((t=>{const r=this.createToken(t,this.idx+e);return r instanceof O?e+=Object.keys(r.ExtractSchema()).length:e++,r}))}Encode(e){return{prim:"Pair",args:this.tokens().map((t=>t.Encode(e)))}}ExtractSignature(){const e=this.args(),t=this.createToken(e[0],this.idx);let r=1;t instanceof y&&(r=Object.keys(t.ExtractSchema()).length);const n=this.createToken(e[1],this.idx+r),i=[];for(const e of t.ExtractSignature())for(const t of n.ExtractSignature())i.push([...e,...t]);return i}ToBigMapKey(e){return{key:this.EncodeObject(e),type:this.typeWithoutAnnotations()}}ToKey(e){return this.Execute(e)}EncodeObject(e,t){const[r,n]=this.tokens();let i,o;return i=r instanceof O&&!r.hasAnnotations()?e:e[r.annot()],o=n instanceof O&&!n.hasAnnotations()?e:e[n.annot()],{prim:"Pair",args:[r.EncodeObject(i,t),n.EncodeObject(o,t)]}}traversal(e,t){const r=this.args(),n=this.createToken(r[0],this.idx);let i,o=1;n instanceof O&&!n.hasAnnotations()?(i=e(n),n instanceof O&&(o=Object.keys(n.ExtractSchema()).length)):i={[n.annot()]:e(n)};const s=this.createToken(r[1],this.idx+o);let a;a=s instanceof O&&!s.hasAnnotations()?t(s):{[s.annot()]:t(s)};return Object.assign(Object.assign({},i),a)}Execute(e,t){const r=E(e,"Pair");return this.traversal((e=>e.Execute(r[0],t)),(e=>e.Execute(r[1],t)))}ExtractSchema(){return this.traversal((e=>e.ExtractSchema()),(e=>e.ExtractSchema()))}generateSchema(){return{__michelsonType:O.prim,schema:this.traversal((e=>e instanceof O&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema()),(e=>e instanceof O&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema()))}}compare(e,t){const[r,n]=this.tokens(),i=(e,t)=>e instanceof O&&!e.hasAnnotations()?t:t[e.annot()];if(r instanceof b&&n instanceof b){const o=r.compare(i(r,e),i(r,t));return 0===o?n.compare(i(n,e),i(n,t)):o}throw new w(e,t)}findAndReturnTokens(e,t){return O.prim===e&&t.push(this),this.tokens().map((r=>r.findAndReturnTokens(e,t))),t}}O.prim="pair";class A extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="NatValidationError"}}class S extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return new a.Z(e[Object.keys(e)[0]])}Encode(e){const t=e.pop();return this.validate(t),{int:new a.Z(t).toFixed()}}validate(e){const t=new a.Z(e);if(t.isNaN())throw new A(e,this,`Value is not a number: ${JSON.stringify(e)}`);if(t.isNegative())throw new A(e,this,`Value cannot be negative: ${JSON.stringify(e)}`)}EncodeObject(e,t){return this.validate(e),t&&t[S.prim]?t[S.prim](e):{int:new a.Z(e).toFixed()}}ExtractSchema(){return S.prim}generateSchema(){return{__michelsonType:S.prim,schema:S.prim}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:S.prim}}}ToKey({int:e}){return new a.Z(e)}compare(e,t){const r=Number(e),n=Number(t);return r===n?0:re.startsWith("tz"),n=r(e),i=r(t);return n&&!i?-1:i&&!n?1:super.compare(e,t)}findAndReturnTokens(e,t){return I.prim===e&&t.push(this),t}}I.prim="address";class R extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="MapValidationError"}}class x extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(e){if(!d.isMichelsonMap(e))throw new R(e,this,`Value ${JSON.stringify(e)} is not a valid MichelsonMap`)}Execute(e,t){const r=new d(this.val);return e.forEach((e=>{r.set(this.KeySchema.ToKey(e.args[0]),this.ValueSchema.Execute(e.args[1],t))})),r}objLitToMichelsonMap(e){return e instanceof d?e:"object"==typeof e?0===Object.keys(e).length?new d:d.fromLiteral(e):e}Encode(e){const t=this.objLitToMichelsonMap(e.pop());return this.validate(t),Array.from(t.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(t.get(e))]})))}EncodeObject(e,t){const r=this.objLitToMichelsonMap(e);return this.validate(r),t&&t[x.prim]?t[x.prim](r):Array.from(r.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(r.get(e))]})))}ExtractSchema(){return{map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:x.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(e,t){return x.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),this.ValueSchema.findAndReturnTokens(e,t),t}}x.prim="map";class M extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return"true"===String(e.prim).toLowerCase()}Encode(e){return{prim:e.pop()?"True":"False"}}EncodeObject(e,t){return t&&t[M.prim]?t[M.prim](e):{prim:e?"True":"False"}}ExtractSchema(){return M.prim}generateSchema(){return{__michelsonType:M.prim,schema:M.prim}}ToBigMapKey(e){return{key:this.EncodeObject(e),type:{prim:M.prim}}}ToKey(e){return this.EncodeObject(e)}compare(e,t){return e&&t||!e&&!t?0:e?1:-1}findAndReturnTokens(e,t){return M.prim===e&&t.push(this),t}}M.prim="bool";class k extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ContractValidationError"}}class L extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if((0,c.validateAddress)(e)!==c.ValidationResult.VALID)throw new k(e,this,`Value ${JSON.stringify(e)} is not a valid contract address.`);return null}Execute(e){if(e.string)return e.string;if(!e.bytes)throw new k(e,this,`Value ${JSON.stringify(e)} is not a valid contract address. must contain bytes or string.`);return(0,c.encodePubKey)(e.bytes)}Encode(e){const t=e.pop();return this.validate(t),{string:t}}EncodeObject(e,t){return this.validate(e),t&&t[L.prim]?t[L.prim](e):{string:e}}ExtractSchema(){return L.prim}generateSchema(){const e=this.createToken(this.val.args[0],0);return{__michelsonType:L.prim,schema:{parameter:this.val.args[0]?e.generateSchema():{}}}}findAndReturnTokens(e,t){return L.prim===e&&t.push(this),t}}L.prim="contract";class N extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ListValidationError"}}class C extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(e){if(!Array.isArray(e))throw new N(e,this,`Value ${JSON.stringify(e)} is not a valid array`)}Encode(e){const t=e.pop();this.validate(t);const r=this.createToken(this.val.args[0],0);return t.reduce(((e,t)=>[...e,r.EncodeObject(t)]),[])}Execute(e,t){const r=this.createToken(this.val.args[0],0);return this.validate(e),e.reduce(((e,n)=>[...e,r.Execute(n,t)]),[])}EncodeObject(e,t){const r=this.createToken(this.val.args[0],0);return this.validate(e),t&&t[C.prim]?t[C.prim](e):e.reduce(((e,t)=>[...e,r.EncodeObject(t)]),[])}ExtractSchema(){return{[C.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:C.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(e,t){return C.prim===e&&t.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(e,t),t}}C.prim="list";class j extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="MutezValidationError"}}class D extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return new a.Z(e[Object.keys(e)[0]])}ExtractSchema(){return D.prim}generateSchema(){return{__michelsonType:D.prim,schema:D.prim}}validate(e){if(new a.Z(e).isNaN())throw new j(e,this,`Value is not a number: ${e}`)}Encode(e){const t=e.pop();return this.validate(t),{int:String(t).toString()}}EncodeObject(e,t){return this.validate(e),t&&t[D.prim]?t[D.prim](e):{int:String(e).toString()}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:D.prim}}}ToKey({int:e}){return e}compare(e,t){const r=Number(e),n=Number(t);return r===n?0:rthis.KeySchema.compare(e,t))).reduce(((e,t)=>[...e,this.KeySchema.EncodeObject(t)]),[])}Execute(e,t){return e.reduce(((e,r)=>[...e,this.KeySchema.Execute(r,t)]),[])}EncodeObject(e,t){return this.validate(e),t&&t[ee.prim]?t[ee.prim](e):e.sort(((e,t)=>this.KeySchema.compare(e,t))).reduce(((e,t)=>[...e,this.KeySchema.EncodeObject(t)]),[])}ExtractSchema(){return ee.prim}generateSchema(){return{__michelsonType:ee.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(e,t){return ee.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),t}}ee.prim="set";class te extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChainIDValidationError"}}class re extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if((0,c.validateChain)(e)!==c.ValidationResult.VALID)throw new te(e,this,`Value ${JSON.stringify(e)} is not a valid ChainID`)}Execute(e){return e[Object.keys(e)[0]]}ExtractSchema(){return re.prim}generateSchema(){return{__michelsonType:re.prim,schema:re.prim}}Encode(e){const t=e.pop();return this.validate(t),{string:t}}EncodeObject(e,t){return this.validate(e),t&&t[re.prim]?t[re.prim](e):{string:e}}ToKey({string:e}){return e}ToBigMapKey(e){return{key:{string:e},type:{prim:re.prim}}}findAndReturnTokens(e,t){return re.prim===e&&t.push(this),t}}re.prim="chain_id";class ne extends s.TaquitoError{constructor(){super(),this.name="TicketEncodeError",this.message="Tickets cannot be sent to the blockchain; they are created on-chain"}}const ie={prim:"contract"},oe={prim:"int"};class se extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new ne}EncodeObject(e,t){if(t&&t[se.prim])return t[se.prim](e,this.val);throw new ne}Execute(e,t){if(t&&t[se.prim])return t[se.prim](e,this.val);const r=this.createToken(ie,this.idx),n=this.valueToken,i=this.createToken(oe,this.idx);return void 0===e.args[2]&&void 0!==e.args[1].args?{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1].args[0],t),amount:i.Execute(e.args[1].args[1],t)}:{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1],t),amount:i.Execute(e.args[2],t)}}ExtractSchema(){return{ticketer:L.prim,value:this.valueToken.ExtractSchema(),amount:G.prim}}generateSchema(){return{__michelsonType:se.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:L.prim,schema:L.prim},amount:{__michelsonType:G.prim,schema:G.prim}}}}findAndReturnTokens(e,t){return se.prim===e&&t.push(this),this.valueToken.findAndReturnTokens(e,t),t}}se.prim="ticket";class ae extends s.TaquitoError{constructor(){super(),this.name="TicketDeprecatedEncodeError",this.message="Ticket_deprecated cannot be sent to the blockchain; they are created on-chain"}}const ce={prim:"contract"},ue={prim:"int"};class le extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new ae}EncodeObject(e,t){if(t&&t[le.prim])return t[le.prim](e,this.val);throw new ae}Execute(e,t){if(t&&t[le.prim])return t[le.prim](e,this.val);const r=this.createToken(ce,this.idx),n=this.valueToken,i=this.createToken(ue,this.idx);return void 0===e.args[2]&&void 0!==e.args[1].args?{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1].args[0],t),amount:i.Execute(e.args[1].args[1],t)}:{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1],t),amount:i.Execute(e.args[2],t)}}ExtractSchema(){return{ticketer:L.prim,value:this.valueToken.ExtractSchema(),amount:G.prim}}generateSchema(){return{__michelsonType:le.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:L.prim,schema:L.prim},amount:{__michelsonType:G.prim,schema:G.prim}}}}findAndReturnTokens(e,t){return le.prim===e&&t.push(this),this.valueToken.findAndReturnTokens(e,t),t}}le.prim="ticket_deprecated";class fe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="NeverTokenError"}}class de extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Encode(e){const t=e.pop();throw new fe(t,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(t)}.`)}EncodeObject(e,t){if(t&&t[de.prim])return t[de.prim](e);throw new fe(e,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(e)}.`)}Execute(e){throw new fe(e,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(e)}.`)}ExtractSchema(){return de.prim}generateSchema(){return{__michelsonType:de.prim,schema:de.prim}}findAndReturnTokens(e,t){return de.prim===e&&t.push(this),t}}de.prim="never";class he extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingStateValidationError"}}class pe extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}isValid(e){return"object"==typeof e&&0===Object.keys(e).length}Execute(e,t){if(t&&t[pe.prim])return t[pe.prim](e,this.val);if("int"in e)return e.int;throw new he(e,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(e)}`)}Encode(e){const t=e.pop();if(this.isValid(t))return[];throw new he(t,this,`Invalid sapling_state. Received: ${JSON.stringify(t)} while expecting: {}`)}EncodeObject(e,t){if(t&&t[pe.prim])return t[pe.prim](e);if(this.isValid(e))return[];throw new he(e,this,`Invalid sapling_state. Received: ${JSON.stringify(e)} while expecting: {}`)}ExtractSchema(){return{[pe.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:pe.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return pe.prim===e&&t.push(this),t}}pe.prim="sapling_state";class be extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingTransactionValidationError"}}class me extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){throw new be(e,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const t=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(t&&t[2].length%2==0)return t[2];throw new be(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}EncodeObject(e,t){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),t&&t[me.prim]?t[me.prim](e):{bytes:String(e).toString()}}ExtractSchema(){return{[me.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:me.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return me.prim===e&&t.push(this),t}}me.prim="sapling_transaction";class ge extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingTransactionDeprecatedValidationError"}}class ve extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){throw new ge(e,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const t=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(t&&t[2].length%2==0)return t[2];throw new ge(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}EncodeObject(e,t){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),t&&t[ve.prim]?t[ve.prim](e):{bytes:String(e).toString()}}ExtractSchema(){return{[ve.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:ve.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return ve.prim===e&&t.push(this),t}}ve.prim="sapling_transaction_deprecated";class ye extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381frValidationError"}}class _e extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new ye(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return"number"==typeof t?{int:t.toString()}:(t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t})}EncodeObject(e,t){return t&&t[_e.prim]?t[_e.prim](e):"number"==typeof e?{int:e.toString()}:(e=this.convertUint8ArrayToHexString(e),this.validate(e),{bytes:e})}Execute(e){return e.bytes}ExtractSchema(){return _e.prim}generateSchema(){return{__michelsonType:_e.prim,schema:_e.prim}}findAndReturnTokens(e,t){return _e.prim===e&&t.push(this),t}}_e.prim="bls12_381_fr";class we extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381g1ValidationError"}}class Ee extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new we(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ee.prim]?t[Ee.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ee.prim}generateSchema(){return{__michelsonType:Ee.prim,schema:Ee.prim}}findAndReturnTokens(e,t){return Ee.prim===e&&t.push(this),t}}Ee.prim="bls12_381_g1";class Oe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381g2ValidationError"}}class Ae extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Oe(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ae.prim]?t[Ae.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ae.prim}generateSchema(){return{__michelsonType:Ae.prim,schema:Ae.prim}}findAndReturnTokens(e,t){return Ae.prim===e&&t.push(this),t}}Ae.prim="bls12_381_g2";class Se extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChestValidationError"}}class Pe extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Se(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Pe.prim]?t[Pe.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Pe.prim}generateSchema(){return{__michelsonType:Pe.prim,schema:Pe.prim}}findAndReturnTokens(e,t){return Pe.prim===e&&t.push(this),t}}Pe.prim="chest";class Te extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChestKeyValidationError"}}class Ie extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Te(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ie.prim]?t[Ie.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ie.prim}generateSchema(){return{__michelsonType:Ie.prim,schema:Ie.prim}}findAndReturnTokens(e,t){return Ie.prim===e&&t.push(this),t}}Ie.prim="chest_key";class Re extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="GlobalConstantEncodingError"}}class xe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="GlobalConstantDecodingError"}}class Me extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e,t){if(t&&t[Me.prim])return t[Me.prim](e,this.val);throw new xe(e,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(e){throw new Re(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(e,t){if(t&&t[Me.prim])return t[Me.prim](e);throw new Re(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}ExtractSchema(){return Me.prim}generateSchema(){return{__michelsonType:Me.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(e,t){return Me.prim===e&&t.push(this),t}}Me.prim="constant";const ke=[O,S,P,g,I,x,M,y,L,C,D,B,F,K,G,$,z,W,J,Y,X,ee,re,se,le,de,pe,me,ve,_e,Ee,Ae,Pe,Ie,Me];class Le extends s.TaquitoError{constructor(e,t){super(e),this.message=e,this.data=t,this.name="Invalid token error"}}function Ne(e,t){if(Array.isArray(e))return new O(e,t,Ne);const r=ke.find((t=>t.prim===e.prim));if(!r)throw new Le(`Malformed data: ${JSON.stringify(e)}. Expected a value with a valid prim property`,e);return new r(e,t,Ne)}class Ce extends s.InvalidViewParameterError{constructor(e,t,r,n){super(e,t,r,n),this.viewName=e,this.sigs=t,this.args=r,this.cause=n,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(r)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(t)}`}}class je extends s.TaquitoError{constructor(e,t){super(),this.script=e,this.reason=t,this.name="InvalidScriptError";let r="Invalid on-chain view found in the following script.";t&&(r+=` Reason: ${t}.`),r+=`Script: ${JSON.stringify(e)}`,this.message=r}}class De extends s.TaquitoError{constructor(e,t){super(),this.script=e,this.reason=t,this.name="InvalidRpcResponseError";let r="Invalid RPC response passed as argument(s).";t&&(r+=` Reason: ${t}.`),r+=` Received: ${JSON.stringify(e)}`,this.message=r}}class Ue extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="InvalidBigMapSchemaError"}}class Be extends s.TaquitoError{constructor(e,t){super(e),this.message=e,this.value=t,this.name="InvalidBigMapDiffError"}}class Fe extends s.TaquitoError{constructor(e,t,r,n){super(),this.details=t,this.schema=r,this.value=n,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${e}. Schema is: ${JSON.stringify(r)}. The ${e} is: ${JSON.stringify(n)}. Error details: ${t}`}}class Ke extends s.TaquitoError{constructor(e,t,r,n,i){super(),this.details=t,this.schema=r,this.value=n,this.semantics=i,this.name="StorageEncodingError",this.message=`Unable to encode ${e}. The schema is: ${JSON.stringify(r)}, the value is: ${JSON.stringify(n)}.${i?`And the semantic is: ${JSON.stringify(i)}`:""}. Error details: ${t}`}}class He extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="MissingArgumentError"}}var Ge;const $e=Symbol.for("taquito-schema-type-symbol");function Ve(e,t=O.prim){var r,n;if(Array.isArray(e))return Ve({prim:t,args:e},t);const i=e;return i.prim===t&&i.args&&i.args.length>2?Object.assign(Object.assign({},i),{args:[null===(r=i.args)||void 0===r?void 0:r[0],{prim:t,args:null===(n=i.args)||void 0===n?void 0:n.slice(1)}]}):i}function ze(e,t){if(void 0===e||void 0===t)return e===t;const r=Ve(e),n=Ve(t);return r.prim===n.prim&&(void 0===r.args&&void 0===n.args||void 0!==r.args&&void 0!==n.args&&r.args.length===n.args.length&&r.args.every(((e,t)=>{var r,i;return ze(e,null!==(i=null===(r=n.args)||void 0===r?void 0:r[t])&&void 0!==i?i:{})})))&&(void 0===r.annots&&void 0===n.annots||void 0!==r.annots&&void 0!==n.annots&&r.annots.length===n.annots.length&&r.annots.every(((e,t)=>{var r;return e===(null===(r=n.annots)||void 0===r?void 0:r[t])})))}class qe{static isSchema(e){return e&&!0===e[$e]}static fromRPCResponse(e){if(!e)throw new De(e,"the RPC response is empty");if(!e.script)throw new De(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new De(e,"The response.script.code should be an array");let t=e.script.code;for(;1===t.length&&Array.isArray(t[0]);)t=t[0];const r=t.find((e=>"prim"in e&&"storage"===e.prim));if(!r||!Array.isArray(r.args))throw new De(e,'The response.script.code has an element of type {prim: "storage"}, but its args is not an array');return new qe(r.args[0])}isExpressionExtended(e){return"prim"in e&&Array.isArray(e.args)}constructor(e){if(this.val=e,this[Ge]=!0,this.root=Ne(e,0),this.root instanceof g)this.bigMap=this.root;else if(this.isExpressionExtended(e)&&"pair"===e.prim){const t=e.args[0];this.isExpressionExtended(t)&&"big_map"===t.prim&&(this.bigMap=new g(t,0,Ne))}}removeTopLevelAnnotation(e){return(this.root instanceof O||this.root instanceof y)&&this.root.hasAnnotations()&&"object"==typeof e&&1===Object.keys(e).length?e[Object.keys(e)[0]]:e}Execute(e,t){const r=this.root.Execute(e,t);return this.removeTopLevelAnnotation(r)}Typecheck(e){this.root instanceof g&&Number.isInteger(Number(e))||this.root instanceof se&&e.ticketer&&e.value&&e.amount||this.root instanceof le&&e.ticketer&&e.value&&e.amount||this.root instanceof x&&this.root.ValueSchema instanceof g||this.root.EncodeObject(e)}ExecuteOnBigMapDiff(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");if(!Array.isArray(e))throw new Be(`Big map diff must be an array, got: ${JSON.stringify(e)}`,e);const r=e.map((({key:e,value:t})=>({args:[e,t]})));return this.bigMap.Execute(r,t)}ExecuteOnBigMapValue(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");return this.bigMap.ValueSchema.Execute(e,t)}EncodeBigMapKey(e){if(!this.bigMap)throw new Ue("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(e)}catch(t){throw new Fe("key",t,this.bigMap.KeySchema,e)}}Encode(e,t){try{return this.root.EncodeObject(e,t)}catch(r){if(r instanceof h)throw r;throw new Ke("storage object",r,this.root,e,t)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");const r=e.reduce(((e,t)=>Object.assign(Object.assign({},e),this.ExecuteOnBigMapDiff(t.contents[0].metadata.operation_result.big_map_diff))),{});return Object.assign(Object.assign({},this.Execute(t)),{[this.bigMap.annot()]:r})}FindFirstInTopLevelPair(e,t){return this.findValue(this.root.val,e,t)}findValue(e,t,r){if(ze(r,e))return t;if(Array.isArray(e)||"pair"===e.prim){const n=Ve(e),i=Ve(t,"Pair");if(void 0===n.args||void 0===i.args)throw new He("Tokens have no arguments");if(n.args[0])return this.findValue(n.args[0],i.args[0],r)||this.findValue(n.args[1],i.args[1],r)}}findToken(e){return this.root.findAndReturnTokens(e,[])}}Ge=$e;class We{static fromRPCResponse(e){if(!e)throw new De(e,"the RPC response is empty");if(!e.script)throw new De(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new De(e,"The response.script.code should be an array");const t=e.script.code.find((e=>"prim"in e&&"parameter"===e.prim));if(!t)throw new De(e,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray(t.args))throw new De(e,'The response.script.code has an element of type {prim: "parameter"}, but its args is not an array');return new We(t.args[0])}get isMultipleEntryPoint(){return this.root instanceof y||this.root instanceof F&&this.root.subToken()instanceof y}get hasAnnotation(){return!this.isMultipleEntryPoint||"0"!==Object.keys(this.ExtractSchema())[0]}constructor(e){this.root=Ne(e,0)}Execute(e,t){return this.root.Execute(e,t)}Encode(...e){try{return this.root.Encode(e.reverse())}catch(t){if(t instanceof h)throw t;throw new Ce("Unable to encode parameter",this.root,e,t)}}EncodeObject(e,t){try{return this.root.EncodeObject(e,t)}catch(t){if(t instanceof h)throw t;throw new Ce("Unable to encode parameter object",this.root,e,t)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class Ze{static fromRPCResponse(e){const t=[],r=e&&e.script&&Array.isArray(e.script.code)&&e.script.code.filter((e=>"view"===e.prim));return r&&r.forEach((e=>{t.push(new Ze(e.args))})),t}constructor(e){if(!e)throw new je(e,"the args are not defined");if(4!==e.length)throw new je(e,"there should be exactly 4 arguments");if(!("string"in e[0])||!e[0].string)throw new je(e,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=e[0].string,this.viewArgsType=e[1],this.viewReturnType=e[2],this.instructions=e[3],this.rootArgsType=Ne(this.viewArgsType,0),this.rootReturnType=Ne(this.viewReturnType,0)}encodeViewArgs(e){try{return this.rootArgsType.EncodeObject(e)}catch(t){throw new Ce(this.viewName,void 0,e,t)}}decodeViewResult(e,t){return this.rootReturnType.Execute(e,t)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}class Je{constructor(e,t){this.tag=e,this.type=t}static fromMichelineValue(e){var t,r;return new Je(null===(t=e.annots)||void 0===t?void 0:t[0],null===(r=e.args)||void 0===r?void 0:r[0])}static fromRPCResponse(e){const t=[];return e.script.code.forEach((e=>{"prim"in e&&"code"===e.prim&&"args"in e&&e.args&&t.push(...Je.extractEventsRecursively(e.args))})),Je.removeDuplicates(t)}static removeDuplicates(e){const t=[];return e.forEach((e=>{-1===t.findIndex((t=>t.tag===e.tag&&ze(t.type,e.type)))&&t.push(e)})),t}static extractEventsRecursively(e){return Array.isArray(e)?e.flatMap((e=>Je.extractEventsRecursively(e))):"prim"in e?"EMIT"===e.prim?[Je.fromMichelineValue(e)]:"args"in e&&e.args?e.args.flatMap((e=>Je.extractEventsRecursively(e))):[]:[]}}const Ye={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"},Xe=Symbol(),Qe={}},6368:(e,t,r)=>{"use strict";r.r(t),r.d(t,{METADATA_BALANCE_UPDATES_CATEGORY:()=>b,OPERATION_METADATA:()=>p,OpKind:()=>O,PvmKind:()=>m,RpcClient:()=>S,RpcClientCache:()=>h,SmartRollupInputProofKind:()=>v,SmartRollupRefutationOptions:()=>g,SmartRollupRefuteGameEndedPlayerOutcomes:()=>w,SmartRollupRefuteGameEndedReason:()=>E,SmartRollupRefuteGameStatusOptions:()=>_,SmartRollupRefuteRevealProofKind:()=>y,VERSION:()=>A,castToBigNumber:()=>d,defaultChain:()=>u,defaultRPCOptions:()=>l});var n=r(5543),i=r(2558),o=r(4632),s=r(227);function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{const r=e[t];let o;if(void 0!==r){if(Array.isArray(r))return o=d(r),void(n[t]=o);o=new i.Z(r),n[t]=o}})),n}!function(e){e.GET_BAKING_RIGHTS="getBakingRights",e.GET_BALLOTS="getBallots",e.GET_BALLOT_LIST="getBallotList",e.GET_BIG_MAP_KEY="getBigMapKey",e.GET_BIG_MAP_EXPR="getBigMapExpr",e.GET_BLOCK_HASH="getBlockHash",e.GET_BLOCK="getBlock",e.GET_BLOCK_HEADER="getBlockHeader",e.GET_BLOCK_METADATA="getBlockMetadata",e.GET_BALANCE="getBalance",e.GET_CHAIN_ID="getChainId",e.GET_CONSTANTS="getConstants",e.GET_CONTRACT="getContract",e.GET_CURRENT_PERIOD="getCurrentPeriod",e.GET_CURRENT_PROPOSAL="getCurrentProposal",e.GET_CURRENT_QUORUM="getCurrentQuorum",e.GET_DELEGATE="getDelegate",e.GET_DELEGATES="getDelegates",e.GET_VOTING_INFO="getVotingInfo",e.GET_ATTESTATION_RIGHTS="getAttestationRights",e.GET_ENDORSING_RIGHTS="getEndorsingRights",e.GET_ENTRYPOINTS="getEntrypoints",e.GET_LIVE_BLOCKS="getLiveBlocks",e.GET_MANAGER_KEY="getManagerKey",e.GET_NORMALIZED_SCRIPT="getNormalizedScript",e.GET_PROPOSALS="getProposals",e.GET_PROTOCOLS="getProtocols",e.GET_SAPLING_DIFF_BY_CONTRACT="getSaplingDiffByContract",e.GET_SAPLING_DIFF_BY_ID="getSaplingDiffById",e.GET_SCRIPT="getScript",e.GET_STORAGE="getStorage",e.GET_SUCCESSOR_PERIOD="getSuccessorPeriod",e.GET_VOTES_LISTINGS="getVotesListings",e.PACK_DATA="packData",e.GET_STORAGE_USED_SPACE="getStorageUsedSpace",e.GET_STORAGE_PAID_SPACE="getStoragePaidSpace",e.GET_TICKET_BALANCE="getTicketBalance",e.GET_ALL_TICKET_BALANCES="getAllTicketBalances",e.GET_PENDING_OPERATIONS="getPendingOperations"}(f||(f={}));class h{constructor(e,t=1e3){this.rpcClient=e,this.ttl=t,this._cache={}}getAllCachedData(){return this._cache}deleteAllCachedData(){for(const e in this._cache)delete this._cache[e]}formatCacheKey(e,t,r,n){let i="";return r.forEach((e=>{i="object"==typeof e?i+JSON.stringify(e)+"/":i+e+"/"})),n?`${e}/${t}/${i}${JSON.stringify(n)}/`:`${e}/${t}/${i}`}has(e){return e in this._cache}get(e){return this._cache[e].response}put(e,t){const r=setTimeout((()=>this.remove(e)),this.ttl);Object.assign(this._cache,{[e]:{handle:r,response:t}})}remove(e){e in this._cache&&delete this._cache[e]}validateAddress(e){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t))}validateContract(e){const t=(0,o.validateContractAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,o.invalidDetail)(t))}getBlockHash({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_HASH,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockHash({block:e});return this.put(t,r),r}}))}getLiveBlocks({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_LIVE_BLOCKS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getLiveBlocks({block:e});return this.put(t,r),r}}))}getBalance(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALANCE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBalance(e,{block:t});return this.put(r,n),n}}))}getStorage(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorage(e,{block:t});return this.put(r,n),n}}))}getScript(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SCRIPT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getScript(e,{block:t});return this.put(r,n),n}}))}getNormalizedScript(e,t={unparsing_mode:"Readable"},{block:r}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_NORMALIZED_SCRIPT,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getNormalizedScript(e,t,{block:r});return this.put(n,i),i}}))}getContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CONTRACT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getContract(e,{block:t});return this.put(r,n),n}}))}getManagerKey(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_MANAGER_KEY,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getManagerKey(e,{block:t});return this.put(r,n),n}}))}getDelegate(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_DELEGATE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegate(e,{block:t});return this.put(r,n),n}}))}getBigMapKey(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BIG_MAP_KEY,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapKey(e,t,{block:r});return this.put(n,i),i}}))}getBigMapExpr(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BIG_MAP_EXPR,[r,e,t]);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapExpr(e,t,{block:r});return this.put(n,i),i}}))}getDelegates(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_DELEGATES,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegates(e,{block:t});return this.put(r,n),n}}))}getVotingInfo(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_VOTING_INFO,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getVotingInfo(e,{block:t});return this.put(r,n),n}}))}getConstants({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CONSTANTS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getConstants({block:e});return this.put(t,r),r}}))}getBlock({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlock({block:e});return this.put(t,r),r}}))}getBlockHeader({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_HEADER,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockHeader({block:e});return this.put(t,r),r}}))}getBlockMetadata({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_METADATA,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockMetadata({block:e});return this.put(t,r),r}}))}getBakingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BAKING_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBakingRights(e,{block:t});return this.put(r,n),n}}))}getAttestationRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ATTESTATION_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getAttestationRights(e,{block:t});return this.put(r,n),n}}))}getEndorsingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ENDORSING_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEndorsingRights(e,{block:t});return this.put(r,n),n}}))}getBallotList({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALLOT_LIST,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBallotList({block:e});return this.put(t,r),r}}))}getBallots({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALLOTS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBallots({block:e});return this.put(t,r),r}}))}getCurrentProposal({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_PROPOSAL,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentProposal({block:e});return this.put(t,r),r}}))}getCurrentQuorum({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_QUORUM,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentQuorum({block:e});return this.put(t,r),r}}))}getVotesListings({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_VOTES_LISTINGS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getVotesListings({block:e});return this.put(t,r),r}}))}getProposals({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PROPOSALS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getProposals({block:e});return this.put(t,r),r}}))}forgeOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.forgeOperations(e,{block:t})}))}injectOperation(e){return c(this,void 0,void 0,(function*(){return this.rpcClient.injectOperation(e)}))}preapplyOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.preapplyOperations(e,{block:t})}))}getEntrypoints(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ENTRYPOINTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEntrypoints(e,{block:t});return this.put(r,n),n}}))}runOperation(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.runOperation(e,{block:t})}))}simulateOperation(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.simulateOperation(e,{block:t})}))}runCode(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.runCode(e,{block:t})}))}runScriptView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.rpcClient.runScriptView(Object.assign({unparsing_mode:r},n),{block:i})}))}runView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.rpcClient.runView(Object.assign({unparsing_mode:r},n),{block:i})}))}getChainId(){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CHAIN_ID,[]);if(this.has(e))return this.get(e);{const t=this.rpcClient.getChainId();return this.put(e,t),t}}))}packData(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.PACK_DATA,[t],e);if(this.has(r))return this.get(r);{const n=this.rpcClient.packData(e,{block:t});return this.put(r,n),n}}))}getRpcUrl(){return this.rpcClient.getRpcUrl()}getCurrentPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_PERIOD,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentPeriod({block:e});return this.put(t,r),r}}))}getSuccessorPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SUCCESSOR_PERIOD,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getSuccessorPeriod({block:e});return this.put(t,r),r}}))}getSaplingDiffById(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SAPLING_DIFF_BY_ID,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffById(e,{block:t});return this.put(r,n),n}}))}getSaplingDiffByContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SAPLING_DIFF_BY_CONTRACT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffByContract(e,{block:t});return this.put(r,n),n}}))}getProtocols({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PROTOCOLS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getProtocols({block:e});return this.put(t,r),r}}))}getStorageUsedSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE_USED_SPACE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorageUsedSpace(e,{block:t});return this.put(r,n),n}}))}getStoragePaidSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE_PAID_SPACE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStoragePaidSpace(e,{block:t});return this.put(r,n),n}}))}getTicketBalance(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_TICKET_BALANCE,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getTicketBalance(e,t,{block:r});return this.put(n,i),i}}))}getAllTicketBalances(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ALL_TICKET_BALANCES,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getAllTicketBalances(e,{block:t});return this.put(r,n),n}}))}getPendingOperations(e={}){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PENDING_OPERATIONS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getPendingOperations(e);return this.put(t,r),r}}))}}var p,b,m,g,v,y,_,w,E,O;!function(e){e.TOO_LARGE="too large"}(p||(p={})),function(e){e.BAKING_BONUSES="baking bonuses",e.BAKING_REWARDS="baking rewards",e.BLOCK_FEES="block fees",e.BONDS="bonds",e.BOOTSTRAP="bootstrap",e.BURNED="burned",e.COMMITMENT="commitment",e.DELEGATE_DENOMINATOR="delegate_denominator",e.DELEGATOR_NUMERATOR="delegator_numerator",e.DEPOSITS="deposits",e.ENDORSING_REWARDS="endorsing rewards",e.INVOICE="invoice",e.LOST_ENDORSING_REWARDS="lost endorsing rewards",e.MINTED="minted",e.NONCE_REVELATION_REWARDS="nonce revelation rewards",e.PUNISHMENTS="punishments",e.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",e.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",e.STORAGE_FEES="storage fees",e.SUBSIDY="subsidy",e.UNSTAKED_DEPOSITS="unstaked_deposits"}(b||(b={})),function(e){e.WASM2="wasm_2_0_0",e.ARITH="arith",e.RISCV="riscv"}(m||(m={})),function(e){e.START="start",e.MOVE="move"}(g||(g={})),function(e){e.INBOX_PROOF="inbox_proof",e.REVEAL_PROOF="reveal_proof",e.FIRST_INPUT="first_input"}(v||(v={})),function(e){e.RAW_DATA_PROOF="raw_data_proof",e.METADATA_PROOF="metadata_proof",e.DAL_PAGE_PROOF="dal_page_proof"}(y||(y={})),function(e){e.ONGOING="ongoing",e.ENDED="ended"}(_||(_={})),function(e){e.LOSER="loser",e.DRAW="draw"}(w||(w={})),function(e){e.CONFLICT_RESOLVED="conflict_resolved",e.TIMEOUT="timeout"}(E||(E={})),function(e){e.ORIGINATION="origination",e.DELEGATION="delegation",e.REVEAL="reveal",e.TRANSACTION="transaction",e.ACTIVATION="activate_account",e.ATTESTATION="attestation",e.ENDORSEMENT="endorsement",e.PREATTESTATION="preattestation",e.PREENDORSEMENT="preendorsement",e.SET_DEPOSITS_LIMIT="set_deposits_limit",e.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",e.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",e.ATTESTATION_WITH_SLOT="attestation_with_slot",e.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",e.SEED_NONCE_REVELATION="seed_nonce_revelation",e.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",e.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",e.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",e.PROPOSALS="proposals",e.BALLOT="ballot",e.FAILING_NOOP="failing_noop",e.REGISTER_GLOBAL_CONSTANT="register_global_constant",e.TRANSFER_TICKET="transfer_ticket",e.INCREASE_PAID_STORAGE="increase_paid_storage",e.UPDATE_CONSENSUS_KEY="update_consensus_key",e.DRAIN_DELEGATE="drain_delegate",e.VDF_REVELATION="vdf_revelation",e.EVENT="event",e.TICKET_UPDATES="ticket_updates",e.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",e.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",e.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",e.SMART_ROLLUP_PUBLISH="smart_rollup_publish",e.SMART_ROLLUP_CEMENT="smart_rollup_cement",e.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",e.SMART_ROLLUP_REFUTE="smart_rollup_refute",e.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout"}(O||(O={}));const A={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"};class S{constructor(e,t=u,r=new n.HttpBackend){this.url=e,this.chain=t,this.httpBackend=r}createURL(e){let t=this.url;for(;t.endsWith("/");)t=t.slice(0,-1);return`${t}${e}`}validateAddress(e){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t))}validateContract(e){const t=(0,o.validateContractAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,o.invalidDetail)(t))}getBlockHash({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/hash`),method:"GET"})}))}getLiveBlocks({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/live_blocks`),method:"GET"})}))}getBalance(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/balance`),method:"GET"});return new i.Z(r)}))}getStorage(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage`),method:"GET"})}))}getScript(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/script`),method:"GET"})}))}getNormalizedScript(e,t={unparsing_mode:"Readable"},{block:r}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/script/normalized`),method:"POST"},t)}))}getContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}`),method:"GET"});return Object.assign(Object.assign({},r),{balance:new i.Z(r.balance)})}))}getManagerKey(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/manager_key`),method:"GET"})}))}getDelegate(e,{block:t}=l){return c(this,void 0,void 0,(function*(){let r;this.validateAddress(e);try{r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/delegate`),method:"GET"})}catch(e){if(!(e instanceof n.HttpResponseError&&e.status===n.STATUS_CODE.NOT_FOUND))throw e;r=null}return r}))}getBigMapKey(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/big_map_get`),method:"POST"},t)}))}getBigMapExpr(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/big_maps/${e}/${t}`),method:"GET"})}))}getDelegates(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/delegates/${e}`),method:"GET"}),n=d(r,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance","voting_power","total_delegated_stake","staking_denominator"]);return Object.assign(Object.assign(Object.assign({},r),n),{frozen_balance_by_cycle:r.frozen_balance_by_cycle?r.frozen_balance_by_cycle.map((e=>{var{deposit:t,deposits:r,fees:n,rewards:i}=e,o=a(e,["deposit","deposits","fees","rewards"]);const s=d({deposit:t,deposits:r,fees:n,rewards:i},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},o),{deposit:s.deposit,deposits:s.deposits,fees:s.fees,rewards:s.rewards})})):void 0})}))}getVotingInfo(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/delegates/${e}/voting_info`),method:"GET"})}))}getConstants({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/constants`),method:"GET"}),r=d(t,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_endorsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round","tx_rollup_commitment_bond","vdf_difficulty","sc_rollup_stake_amount","minimal_stake"]);return Object.assign(Object.assign({},t),r)}))}getBlock({block:e,version:t}=l){return c(this,void 0,void 0,(function*(){const r={url:this.createURL(`/chains/${this.chain}/blocks/${e}`),method:"GET"};return void 0!==t&&(r.query={version:t}),yield this.httpBackend.createRequest(r)}))}getBlockHeader({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/header`),method:"GET"})}))}getBlockMetadata({block:e,version:t}=l){return c(this,void 0,void 0,(function*(){const r={url:this.createURL(`/chains/${this.chain}/blocks/${e}/metadata`),method:"GET"};return void 0!==t&&(r.query={version:t}),yield this.httpBackend.createRequest(r)}))}getBakingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/baking_rights`),method:"GET",query:e})}))}getAttestationRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/attestation_rights`),method:"GET",query:e})}))}getEndorsingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/endorsing_rights`),method:"GET",query:e})}))}getBallotList({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballot_list`),method:"GET"})}))}getBallots({block:e}=l){return c(this,void 0,void 0,(function*(){return d(yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballots`),method:"GET"}),["yay","nay","pass"])}))}getCurrentProposal({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_proposal`),method:"GET"})}))}getCurrentQuorum({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_quorum`),method:"GET"})}))}getVotesListings({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/listings`),method:"GET"});return t.map((e=>(e.voting_power&&(e.voting_power=new i.Z(e.voting_power)),e))),t}))}getProposals({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/proposals`),method:"GET"});return t.map((e=>e[1]=new i.Z(e[1]))),t}))}forgeOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/forge/operations`),method:"POST"},e)}))}injectOperation(e){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},e)}))}preapplyOperations(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/preapply/operations`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}getEntrypoints(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/entrypoints`),method:"GET"})}))}runOperation(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/run_operation`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}simulateOperation(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/simulate_operation`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}runCode(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/run_code`),method:"POST"},e)}))}runScriptView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${i}/helpers/scripts/run_script_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}runView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${i}/helpers/scripts/run_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}getChainId(){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})}))}packData(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/pack_data`),method:"POST"},e),{gas:n}=r,o=a(r,["gas"]);let s=n;const c=new i.Z(n||"");return c.isNaN()||(s=c),Object.assign({gas:s},o)}))}getRpcUrl(){return this.url}getCurrentPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_period`),method:"GET"})}))}getSuccessorPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/successor_period`),method:"GET"})}))}getSaplingDiffById(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/sapling/${e}/get_diff`),method:"GET"})}))}getSaplingDiffByContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/single_sapling_get_diff`),method:"GET"})}))}getProtocols({block:e}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/protocols`),method:"GET"})}))}getStorageUsedSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage/used_space`),method:"GET"})}))}getStoragePaidSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage/paid_space`),method:"GET"})}))}getTicketBalance(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/ticket_balance`),method:"POST"},t)}))}getAllTicketBalances(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/all_ticket_balances`),method:"GET"})}))}getPendingOperations(e={}){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/pending_operations`),method:"GET",query:e})}))}}},4632:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DeprecationError:()=>f.DeprecationError,InvalidAddressError:()=>f.InvalidAddressError,InvalidBlockHashError:()=>f.InvalidBlockHashError,InvalidChainIdError:()=>f.InvalidChainIdError,InvalidContractAddressError:()=>f.InvalidContractAddressError,InvalidHexStringError:()=>f.InvalidHexStringError,InvalidKeyError:()=>f.InvalidKeyError,InvalidKeyHashError:()=>f.InvalidKeyHashError,InvalidMessageError:()=>f.InvalidMessageError,InvalidOperationHashError:()=>f.InvalidOperationHashError,InvalidOperationKindError:()=>f.InvalidOperationKindError,InvalidProtocolHashError:()=>E,InvalidPublicKeyError:()=>f.InvalidPublicKeyError,InvalidSignatureError:()=>f.InvalidSignatureError,Prefix:()=>n,ProhibitedActionError:()=>f.ProhibitedActionError,VERSION:()=>q,ValidationResult:()=>A,ValueConversionError:()=>O,b58cdecode:()=>te,b58cencode:()=>ee,b58decode:()=>re,b58decodeL2Address:()=>ne,buf2hex:()=>fe,bytes2Char:()=>pe,char2Bytes:()=>he,encodeExpr:()=>X,encodeKey:()=>se,encodeKeyHash:()=>ae,encodeL2Address:()=>oe,encodeOpHash:()=>Q,encodePubKey:()=>ie,format:()=>Y,getPkhfromPk:()=>de,hex2Bytes:()=>be,hex2buf:()=>ce,invalidDetail:()=>V,isValidPrefix:()=>S,mergebuf:()=>ue,mic2arr:()=>le,num2PaddedHex:()=>ge,prefix:()=>g,prefixLength:()=>v,stripHexPrefix:()=>ve,toHexBuf:()=>me,validateAddress:()=>C,validateBlock:()=>G,validateChain:()=>j,validateContractAddress:()=>D,validateKeyHash:()=>U,validateOperation:()=>K,validatePkAndExtractPrefix:()=>_,validateProtocol:()=>H,validatePublicKey:()=>F,validateSignature:()=>B,validateSmartRollupAddress:()=>z,validateSpendingKey:()=>$,verifySignature:()=>y});var n,i=r(8834),o=r(7728),s=r(6851),a=r(1395),c=r.n(a),u=r(4075),l=r.n(u),f=r(227),d=r(2558),h=r(7554),p=r.n(h),b=r(8743),m=r.n(b);!function(e){e.TZ1="tz1",e.TZ2="tz2",e.TZ3="tz3",e.TZ4="tz4",e.KT="KT",e.KT1="KT1",e.EDSK2="edsk2",e.SPSK="spsk",e.P2SK="p2sk",e.EDPK="edpk",e.SPPK="sppk",e.P2PK="p2pk",e.BLPK="BLpk",e.EDESK="edesk",e.SPESK="spesk",e.P2ESK="p2esk",e.EDSK="edsk",e.EDSIG="edsig",e.SPSIG="spsig",e.P2SIG="p2sig",e.SIG="sig",e.NET="Net",e.NCE="nce",e.B="B",e.O="o",e.LO="Lo",e.LLO="LLo",e.P="P",e.CO="Co",e.ID="id",e.EXPR="expr",e.TZ="TZ",e.VH="vh",e.SASK="sask",e.ZET1="zet1",e.SR1="sr1",e.SRC1="src1"}(n||(n={}));const g={[n.TZ1]:new Uint8Array([6,161,159]),[n.TZ2]:new Uint8Array([6,161,161]),[n.TZ3]:new Uint8Array([6,161,164]),[n.TZ4]:new Uint8Array([6,161,166]),[n.KT]:new Uint8Array([2,90,121]),[n.KT1]:new Uint8Array([2,90,121]),[n.EDSK]:new Uint8Array([43,246,78,7]),[n.EDSK2]:new Uint8Array([13,15,58,7]),[n.SPSK]:new Uint8Array([17,162,224,201]),[n.P2SK]:new Uint8Array([16,81,238,189]),[n.EDPK]:new Uint8Array([13,15,37,217]),[n.SPPK]:new Uint8Array([3,254,226,86]),[n.P2PK]:new Uint8Array([3,178,139,127]),[n.BLPK]:new Uint8Array([6,149,135,204]),[n.EDESK]:new Uint8Array([7,90,60,179,41]),[n.SPESK]:new Uint8Array([9,237,241,174,150]),[n.P2ESK]:new Uint8Array([9,48,57,115,171]),[n.EDSIG]:new Uint8Array([9,245,205,134,18]),[n.SPSIG]:new Uint8Array([13,115,101,19,63]),[n.P2SIG]:new Uint8Array([54,240,44,52]),[n.SIG]:new Uint8Array([4,130,43]),[n.NET]:new Uint8Array([87,82,0]),[n.NCE]:new Uint8Array([69,220,169]),[n.B]:new Uint8Array([1,52]),[n.O]:new Uint8Array([5,116]),[n.LO]:new Uint8Array([133,233]),[n.LLO]:new Uint8Array([29,159,109]),[n.P]:new Uint8Array([2,170]),[n.CO]:new Uint8Array([79,179]),[n.ID]:new Uint8Array([153,103]),[n.EXPR]:new Uint8Array([13,44,64,27]),[n.TZ]:new Uint8Array([2,90,121]),[n.VH]:new Uint8Array([1,106,242]),[n.SASK]:new Uint8Array([11,237,20,92]),[n.ZET1]:new Uint8Array([18,71,40,223]),[n.SR1]:new Uint8Array([6,124,117]),[n.SRC1]:new Uint8Array([17,165,134,138])},v={[n.TZ1]:20,[n.TZ2]:20,[n.TZ3]:20,[n.TZ4]:20,[n.KT]:20,[n.KT1]:20,[n.EDPK]:32,[n.SPPK]:33,[n.P2PK]:33,[n.BLPK]:48,[n.EDSIG]:64,[n.SPSIG]:64,[n.P2SIG]:64,[n.SIG]:64,[n.NET]:4,[n.B]:32,[n.P]:32,[n.O]:32,[n.VH]:32,[n.SASK]:169,[n.ZET1]:43,[n.SR1]:20,[n.SRC1]:32};function y(e,t,r,i){const a=_(t),c=function(e){const t=e.startsWith("sig")?e.substring(0,3):e.substring(0,5),r=B(e);if(r!==A.VALID)throw new f.InvalidSignatureError(e,V(r));return t}(r),u=te(t,g[a]),l=te(r,g[c]);let d=ce(function(e){if(""===e)throw new f.InvalidMessageError(e,"can't be empty");return e}(e));void 0!==i&&(d=ue(i,d));const h=(0,s.vp)(d,32);return a===n.EDPK?function(e,t,r){try{return(0,o.T)(r,t,e)}catch(e){return!1}}(l,h,u):a===n.SPPK?function(e,t,r){const n=new(p().ec)("secp256k1").keyFromPublic(r);return w(e,t,n)}(l,h,u):a===n.P2PK&&function(e,t,r){const n=new(p().ec)("p256").keyFromPublic(r);return w(e,t,n)}(l,h,u)}function _(e){if(""===e)throw new f.InvalidPublicKeyError(e,"can't be empty");const t=e.substring(0,4),r=F(e);if(r!==A.VALID)throw new f.InvalidPublicKeyError(e,V(r));return t}function w(e,t,r){const n=fe(m()(e)).match(/([a-f\d]{64})/gi);if(n)try{const[e,i]=n;return r.verify(t,{r:e,s:i})}catch(e){return!1}return!1}class E extends f.ParameterValidationError{constructor(e,t){super(),this.protocolHash=e,this.errorDetails=t,this.name="InvalidProtocolHashError",this.name="InvalidProtocolHashError",this.message=`The protocol hash '${e}' is invalid`,t&&(this.message+=`: ${t}`)}}class O extends f.UnsupportedActionError{constructor(e,t){super(),this.value=e,this.desiredType=t,this.name="ValueConversionError",this.message=`Unable to convert ${e} to a ${t}`}}var A;function S(e){return"string"==typeof e&&e in g}function P(e,t){const r=new RegExp(`^(${t.join("|")})`).exec(e);if(!r||0===r.length)return A.NO_PREFIX_MATCHED;const n=r[0];if(!S(n))return A.NO_PREFIX_MATCHED;e.includes("%")&&(e=e.split("%")[0]);if(!/^(KT1\w{33})$/.test(e)&&"KT1"===n)return A.INVALID_CHECKSUM;let i=l().decodeUnsafe(e);return i?(i=i.slice(g[n].length),i.length!==v[n]?A.INVALID_LENGTH:A.VALID):A.INVALID_CHECKSUM}!function(e){e[e.NO_PREFIX_MATCHED=0]="NO_PREFIX_MATCHED",e[e.INVALID_CHECKSUM=1]="INVALID_CHECKSUM",e[e.INVALID_LENGTH=2]="INVALID_LENGTH",e[e.VALID=3]="VALID"}(A||(A={}));const T=[n.TZ1,n.TZ2,n.TZ3,n.TZ4],I=[n.KT1],R=[n.EDSIG,n.P2SIG,n.SPSIG,n.SIG],x=[n.EDPK,n.SPPK,n.P2PK,n.BLPK],M=[n.O],k=[n.P],L=[n.B],N=[n.SR1];function C(e){return P(e,[...T,...I,...N])}function j(e){return P(e,[n.NET])}function D(e){return P(e,I)}function U(e){return P(e,T)}function B(e){return P(e,R)}function F(e){return P(e,x)}function K(e){return P(e,M)}function H(e){return P(e,k)}function G(e){return P(e,L)}function $(e){return P(e,[n.SASK])}function V(e){switch(e){case A.NO_PREFIX_MATCHED:return"with unsupported prefix";case A.INVALID_CHECKSUM:return"failed checksum";case A.INVALID_LENGTH:return"with incorrect length";default:return""}}function z(e){return P(e,[...N])}const q={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"},W=6,Z=3;function J(e){switch(e){case"tz":return W;case"mtz":return Z;default:return 0}}function Y(e="mutez",t="mutez",r){const n=new d.Z(r);return n.isNaN()?r:n.multipliedBy(Math.pow(10,J(e))).dividedBy(Math.pow(10,J(t)))}function X(e){return ee(c().blake2b(ce(e),void 0,32),g.expr)}function Q(e){return ee(c().blake2b(ce(e),void 0,32),g.o)}function ee(e,t){const r="string"==typeof e?Uint8Array.from(i.lW.from(e,"hex")):e,n=new Uint8Array(t.length+r.length);return n.set(t),n.set(r,t.length),l().encode(i.lW.from(n.buffer))}const te=(e,t)=>l().decode(e).slice(t.length);function re(e){const t=l().decode(e),r={[g.tz1.toString()]:"0000",[g.tz2.toString()]:"0001",[g.tz3.toString()]:"0002"}[new Uint8Array(t.slice(0,3)).toString()];if(r){return r+fe(t.slice(3))}return"01"+fe(t.slice(3,42))+"00"}function ne(e){const t=l().decode(e);return fe(t.slice(3,42))}function ie(e){if("00"===e.substring(0,2)){const t={"0000":g.tz1,"0001":g.tz2,"0002":g.tz3};return ee(e.substring(4),t[e.substring(0,4)])}return ee(e.substring(2,42),g.KT)}function oe(e){return ee(e,g.tz4)}function se(e){if("0"===e[0]){const t={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return ee(e.substring(2),t[e.substring(0,2)])}}function ae(e){if("0"===e[0]){const t={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return ee(e.substring(2),t[e.substring(0,2)])}}const ce=e=>{if(e.length%2!=0)throw new f.InvalidHexStringError(e,": Expecting even number of characters");const t=ve(e);if(!t.match(/^([\da-f]{2})*$/gi))throw new f.InvalidHexStringError(e,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const r=new Uint8Array(t.length/2);let n=0;for(let i=0;i{const r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r},le=function e(t){let r=[];if(Object.prototype.hasOwnProperty.call(t,"prim"))"Pair"===t.prim?(r.push(e(t.args[0])),r=r.concat(e(t.args[1]))):"Elt"===t.prim?r={key:e(t.args[0]),val:e(t.args[1])}:"True"===t.prim?r=!0:"False"===t.prim&&(r=!1);else if(Array.isArray(t)){const n=t.length;for(let i=0;i{const t=[];return e.forEach((e=>{const r=`00${e.toString(16)}`.slice(-2);t.push(r)})),t.join("")},de=e=>{let t,r;const i=_(e),o=te(e,g[i]);switch(i){case n.EDPK:t=g[n.TZ1],r=v[n.TZ1];break;case n.SPPK:t=g[n.TZ2],r=v[n.TZ2];break;case n.P2PK:t=g[n.TZ3],r=v[n.TZ3];break;case n.BLPK:t=g[n.TZ4],r=v[n.TZ4]}return ee((0,s.vp)(o,r),t)};function he(e){return i.lW.from(e,"utf8").toString("hex")}function pe(e){return i.lW.from(ce(e)).toString("utf8")}function be(e){const t=ve(e);if(!t.match(/^(0x)?([\da-f]{2})*$/gi))throw new f.InvalidHexStringError(e,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return i.lW.from(t,"hex")}function me(e,t=8){return i.lW.from(ge(e,t),"hex")}function ge(e,t=8){if(new d.Z(e).isPositive()){const r=Math.ceil(t/4),n=e.toString(16);let i=n.length>=r?n.length:r;return i=i%2==0?i:i+1,function(e,t){const r="0";if(e.length>=t)return e;{const n=t-e.length;return r.repeat(n)+e}}(n,i)}return new d.Z(2).pow(t).minus(new d.Z(e).abs()).toString(16)}function ve(e){return e.startsWith("0x")?e.slice(2):e}},150:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RPCBatchProvider=t.OperationBatch=t.BATCH_KINDS=void 0;const i=r(9480),o=r(3650),s=r(6368),a=r(4632),c=r(227),u=r(6003),l=r(3793);t.BATCH_KINDS=[s.OpKind.ACTIVATION,s.OpKind.ORIGINATION,s.OpKind.TRANSACTION,s.OpKind.DELEGATION];class f extends u.Provider{constructor(e,t){super(e),this.estimator=t,this.operations=[],this.prepare=new l.PrepareProvider(this.context)}withTransfer(e){const t=(0,a.validateAddress)(e.to);if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());if(t!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:s.OpKind.TRANSACTION},e)),this}withTransferTicket(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:s.OpKind.TRANSFER_TICKET},e)),this}withContractCall(e,t={}){return this.withTransfer(e.toTransferParams(t))}withDelegation(e){var t;const r=(0,a.validateAddress)(e.source);if(e.source&&r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.delegate,(0,a.invalidDetail)(n));return this.operations.push(Object.assign({kind:s.OpKind.DELEGATION},e)),this}withActivation({pkh:e,secret:t}){const r=(0,a.validateKeyHash)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidKeyHashError(e,(0,a.invalidDetail)(r));return this.operations.push({kind:s.OpKind.ACTIVATION,pkh:e,secret:t}),this}withOrigination(e){return this.operations.push(Object.assign({kind:s.OpKind.ORIGINATION},e)),this}withRegisterGlobalConstant(e){return this.operations.push(Object.assign({kind:s.OpKind.REGISTER_GLOBAL_CONSTANT},e)),this}withIncreasePaidStorage(e){return this.operations.push(Object.assign({kind:s.OpKind.INCREASE_PAID_STORAGE},e)),this}withSmartRollupAddMessages(e){return this.operations.push(Object.assign({kind:s.OpKind.SMART_ROLLUP_ADD_MESSAGES},e)),this}withSmartRollupOriginate(e){return this.operations.push(Object.assign({kind:s.OpKind.SMART_ROLLUP_ORIGINATE},e)),this}getRPCOp(e){return n(this,void 0,void 0,(function*(){switch(e.kind){case s.OpKind.TRANSACTION:return(0,i.createTransferOperation)(Object.assign({},e));case s.OpKind.ORIGINATION:return(0,i.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign({},e)));case s.OpKind.DELEGATION:return(0,i.createSetDelegateOperation)(Object.assign({},e));case s.OpKind.REGISTER_GLOBAL_CONSTANT:return(0,i.createRegisterGlobalConstantOperation)(Object.assign({},e));case s.OpKind.INCREASE_PAID_STORAGE:return(0,i.createIncreasePaidStorageOperation)(Object.assign({},e));case s.OpKind.TRANSFER_TICKET:return(0,i.createTransferTicketOperation)(Object.assign({},e));case s.OpKind.SMART_ROLLUP_ADD_MESSAGES:return(0,i.createSmartRollupAddMessagesOperation)(Object.assign({},e));case s.OpKind.SMART_ROLLUP_ORIGINATE:return(0,i.createSmartRollupOriginateOperation)(Object.assign({},e));default:throw new c.InvalidOperationKindError(JSON.stringify(e.kind))}}))}with(e){for(const t of e)switch(t.kind){case s.OpKind.TRANSACTION:this.withTransfer(t);break;case s.OpKind.ORIGINATION:this.withOrigination(t);break;case s.OpKind.DELEGATION:this.withDelegation(t);break;case s.OpKind.ACTIVATION:this.withActivation(t);break;case s.OpKind.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant(t);break;case s.OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(t);break;case s.OpKind.TRANSFER_TICKET:this.withTransferTicket(t);break;case s.OpKind.SMART_ROLLUP_ADD_MESSAGES:this.withSmartRollupAddMessages(t);break;case s.OpKind.SMART_ROLLUP_ORIGINATE:this.withSmartRollupOriginate(t);break;default:throw new c.InvalidOperationKindError(JSON.stringify(t.kind))}return this}send(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=e&&e.source||t,n=yield this.estimator.batch(this.operations);n.length!==this.operations.length&&n.shift();const i=yield this.prepare.batch(this.operations,n),s=yield this.forge(i),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(s);return new o.BatchOperation(a,i.opOb.contents,r,u,l,c)}))}}t.OperationBatch=f;t.RPCBatchProvider=class{constructor(e,t){this.context=e,this.estimator=t}batch(e){const t=new f(this.context,this.estimator);return Array.isArray(e)&&t.with(e),t}}},4593:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.getRevealGasLimit=t.ChainIds=t.protocols=t.Protocols=t.COST_PER_BYTE=t.DEFAULT_STORAGE_LIMIT=t.DEFAULT_FEE=t.DEFAULT_GAS_LIMIT=void 0,t.DEFAULT_GAS_LIMIT={DELEGATION:10600,ORIGINATION:10600,TRANSFER:10600,REVEAL_TZ1:1e3,REVEAL_TZ2:1e3,REVEAL_TZ3:2e3,REVEAL_TZ4:2e3},t.DEFAULT_FEE={DELEGATION:1257,ORIGINATION:1e4,TRANSFER:1e4,REVEAL:374},t.DEFAULT_STORAGE_LIMIT={DELEGATION:0,ORIGINATION:257,TRANSFER:257,REVEAL:0},t.COST_PER_BYTE=250,function(e){e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(r||(t.Protocols=r={})),t.protocols={"004":[r.Pt24m4xi],"005":[r.PsBABY5H,r.PsBabyM1],"006":[r.PsCARTHA],"007":[r.PsDELPH1],"008":[r.PtEdo2Zk],"009":[r.PsFLorena],"010":[r.PtGRANADs],"011":[r.PtHangz2],"012":[r.PsiThaCa,r.Psithaca2],"013":[r.PtJakart2],"014":[r.PtKathman],"015":[r.PtLimaPtL],"016":[r.PtMumbai2],"017":[r.PtNairobi],"019":[r.ProxfordY],"020":[r.ProtoALpha]},function(e){e.MAINNET="NetXdQprcVkpaWU",e.CARTHAGENET="NetXjD3HPJJjmcd",e.DELPHINET="NetXm8tYqnMWky1",e.EDONET="NetXSgo1ZT2DRUG",e.FLORENCENET="NetXxkAx4woPLyu",e.GRANADANET="NetXz969SFaFn8k",e.HANGZHOUNET="NetXZSsxBpMQeAT",e.ITHACANET="NetXbhmtAbMukLc",e.ITHACANET2="NetXnHfVqm9iesp",e.JAKARTANET2="NetXLH1uAxK7CCh",e.KATHMANDUNET="NetXazhm4yetmff",e.LIMANET="NetXizpkH94bocH",e.MUMBAINET="NetXQw6nWSnrJ5t",e.MUMBAINET2="NetXgbcrNtXD2yA",e.NAIROBINET="NetXyuzvDo2Ugzb",e.OXFORDNET2="NetXxWsskGahzQB"}(n||(t.ChainIds=n={}));t.getRevealGasLimit=e=>Math.round(11*i(e)/10);const i=e=>{switch(e.substring(0,3)){case"tz1":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ1;case"tz2":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ2;case"tz3":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ3;case"tz4":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ4;default:throw new Error(`Cannot estimate reveal gas limit for ${e}`)}}},4984:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Context=t.defaultConfigConfirmation=void 0;const i=r(6368),o=r(5744),s=r(1067),a=r(8286),c=r(992),u=r(4782),l=r(1151),f=r(150),d=r(635),h=r(5286),p=r(6395),b=r(977),m=r(9494),g=r(259),v=r(5032),y=r(6713),_=r(2021);t.defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class w{constructor(e,r=new s.NoopSigner,n,w=new b.BehaviorSubject(Object.assign({},t.defaultConfigConfirmation)),E,O,A,S,P,T,I,R){this._rpc=e,this._signer=r,this._proto=n,this._config=w,this.providerDecorator=[],this.tz=new c.RpcTzProvider(this),this.estimate=new u.RPCEstimateProvider(this),this.contract=new l.RpcContractProvider(this,this.estimate),this.prepare=new _.PrepareProvider(this),this.batch=new f.RPCBatchProvider(this,this.estimate),this.wallet=new d.Wallet(this),this.withExtensions=()=>{let e=this.clone();return this.providerDecorator.forEach((t=>{e=t(e)})),e},"string"==typeof this._rpc?this._rpcClient=new i.RpcClient(this._rpc):this._rpcClient=this._rpc,this._forger=E||new y.TaquitoLocalForger(this),this._injector=O||new o.RpcInjector(this),this.operationFactory=new a.OperationFactory(this),this._walletProvider=S||new d.LegacyWalletProvider(this),this._parser=P||new h.MichelCodecParser(this),this._packer=A||new p.RpcPacker(this),this._globalConstantsProvider=T||new m.NoopGlobalConstantsProvider,this._readProvider=I||new g.RpcReadAdapter(this._rpcClient),this._stream=R||new v.PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(e){this._config.next(Object.assign({},e))}setPartialConfig(e){this._config.next(Object.assign(Object.assign({},this._config.getValue()),e))}get rpc(){return this._rpcClient}set rpc(e){this._rpcClient=e}get injector(){return this._injector}set injector(e){this._injector=e}get forger(){return this._forger}set forger(e){this._forger=e}get signer(){return this._signer}set signer(e){this._signer=e}get walletProvider(){return this._walletProvider}set walletProvider(e){this._walletProvider=e}set proto(e){this._proto=e}get proto(){return this._proto}get parser(){return this._parser}set parser(e){this._parser=e}get packer(){return this._packer}set packer(e){this._packer=e}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(e){this._globalConstantsProvider=e}get readProvider(){return this._readProvider}set readProvider(e){this._readProvider=e}get stream(){return this._stream}set stream(e){this._stream=e}isAnyProtocolActive(e=[]){return n(this,void 0,void 0,(function*(){if(this._proto)return e.includes(this._proto);{const t=yield this.readProvider.getNextProtocol("head");return e.includes(t)}}))}isAnySignerConfigured(){return!(this.signer instanceof s.NoopSigner)}clone(){return new w(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(e){this.providerDecorator.push(e)}}t.Context=w},5225:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BigMapAbstraction=void 0;const i=r(5543);t.BigMapAbstraction=class{constructor(e,t,r){this.id=e,this.schema=t,this.provider=r}get(e,t){return n(this,void 0,void 0,(function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),e,this.schema,t)}catch(e){if(e instanceof i.HttpResponseError&&e.status===i.STATUS_CODE.NOT_FOUND)return;throw e}}))}getMultipleValues(e,t,r=5){return n(this,void 0,void 0,(function*(){return this.provider.getBigMapKeysByID(this.id.toString(),e,this.schema,t,r)}))}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}},191:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compose=void 0,t.compose=function(e,t){return(r,n)=>t(e(r,n),n)}},2298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethodFactory=void 0;const n=r(3687),i=r(4397),o=r(3849);t.ContractMethodFactory=class{constructor(e,t){this.provider=e,this.contractAddress=t}createContractMethodFlatParams(e,t,r,n=!0,o=!1){return new i.ContractMethod(this.provider,this.contractAddress,e,t,r,n,o)}createContractMethodObjectParam(e,t,r,i=!0,o=!1){return new n.ContractMethodObject(this.provider,this.contractAddress,e,t,r,i,o)}createContractViewObjectParam(e,t,r,n,i){return new o.OnChainView(e,t,this.contractAddress,r,n,i)}}},4397:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethod=void 0;const n=r(635),i=r(1863),o=r(6700);t.ContractMethod=class{constructor(e,t,r,n,i,o=!0,s=!1){this.provider=e,this.address=t,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}validateArgs(e,t,r){const n=t.ExtractSignatures();if(!n.find((t=>t.length===e.length)))throw new o.InvalidParameterError(r,n,e)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(!this.isAnonymous){const e=this.parameterSchema.ExtractSignatures();return 1==e.length?e[0]:e}{const e=this.parameterSchema.ExtractSignatures().find((e=>e[0]===this.name));if(e)return e.shift(),e}}send(e={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}toTransferParams({fee:e,gasLimit:t,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:e,mutez:s,source:n,gasLimit:t,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.Encode(this.name,...this.args):this.parameterSchema.Encode(...this.args)}}}}},4662:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3687:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethodObject=void 0;const n=r(635),i=r(1863);t.ContractMethodObject=class{constructor(e,t,r,n,i="unit",o=!0,s=!1){this.provider=e,this.address=t,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}getSignature(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}send(e={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}toTransferParams({fee:e,gasLimit:t,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:e,mutez:s,source:n,gasLimit:t,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}},3849:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OnChainView=void 0;const i=r(4632),o=r(6700),s=r(227);t.OnChainView=class{constructor(e,t,r,n,i,o="Unit"){this._rpc=e,this._readProvider=t,this._contractAddress=r,this._smartContractViewSchema=n,this._contractStorageType=i,this._args=o}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}executeView(e){return n(this,void 0,void 0,(function*(){this.verifyContextExecution(e);const t=yield this._readProvider.getChainId(),r=this.transformArgsToMichelson(),n={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:r,chain_id:t,source:e.viewCaller};return e.source&&(n.payer=e.source),this.executeViewAndDecodeResult(n)}))}verifyContextExecution(e){if(e.source&&(0,i.validateAddress)(e.source)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${e.source}.`);if(!e.viewCaller||(0,i.validateAddress)(e.viewCaller)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${e.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(e){throw new s.InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,e)}}adaptViewCodeToContext(e,t,r){const n={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:r}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:t}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return e.forEach(((i,o)=>{i.prim in n&&(e[o]=Object(n)[i.prim]),i.args&&0!==i.args.length?this.adaptViewCodeToContext(i.args,t,r):Array.isArray(i)&&this.adaptViewCodeToContext(i,t,r)})),e}executeViewAndDecodeResult(e){return n(this,void 0,void 0,(function*(){let t;try{t=(yield this._rpc.runScriptView(e)).data}catch(e){const t=(0,o.validateAndExtractFailwith)(e);throw t?new o.ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(t)}`,this._smartContractViewSchema.viewName,t,e):e}return this._smartContractViewSchema.decodeViewResult(t)}))}}},1863:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ContractAbstraction=t.ContractView=t.DEFAULT_SMART_CONTRACT_METHOD_NAME=void 0;const i=r(8899),o=r(4632),s=r(2298),a=r(6700),c=r(227);t.DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class u{constructor(e,t,r,n,i,o,s){this.currentContract=e,this.name=t,this.callbackParametersSchema=r,this.parameterSchema=n,this.args=i,this.rpc=o,this.readProvider=s}read(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateChain)(null!=e?e:"");if((0,o.validateContractAddress)(null!=e?e:"")==o.ValidationResult.VALID)throw new c.DeprecationError("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(e&&t!==o.ValidationResult.VALID)throw new c.InvalidChainIdError(e,(0,o.invalidDetail)(t));const r=this.parameterSchema.Encode(...this.args),n=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:r,chain_id:e||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(n.data)}))}}t.ContractView=u;t.ContractAbstraction=class{constructor(e,t,r,n,o,a,c){this.address=e,this.script=t,this.storageProvider=n,this.entrypoints=o,this.rpc=a,this.readProvider=c,this.methods={},this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new s.ContractMethodFactory(r,e),this.schema=i.Schema.fromRPCResponse({script:this.script}),this.parameterSchema=i.ParameterSchema.fromRPCResponse({script:this.script}),this.viewSchema=i.ViewSchema.fromRPCResponse({script:this.script}),0!==this.viewSchema.length&&this._initializeOnChainViews(this,a,this.readProvider,this.viewSchema),this.eventSchema=i.EventSchema.fromRPCResponse({script:this.script}),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(e,r,n,o){const s=this.parameterSchema,c=Object.keys(r);if(s.isMultipleEntryPoint){c.forEach((t=>{const s=new i.ParameterSchema(r[t]);if(this.methods[t]=function(...r){return e.contractMethodFactory.createContractMethodFlatParams(s,t,r)},this.methodsObject[t]=function(r){return e.contractMethodFactory.createContractMethodObjectParam(s,t,r)},(e=>{let t=!1;if("prim"in e&&"pair"===e.prim&&e.args){const r=e.args[e.args.length-1];"prim"in r&&"contract"===r.prim&&(t=!0)}return t})(r[t])){const s=function(...s){const c=r[t].args[0],l=new i.ParameterSchema(c),f=r[t].args[1].args[0],d=new i.ParameterSchema(f);return((e,t,r)=>{const n=t.ExtractSignatures();if(!n.find((t=>t.length===e.length)))throw new a.InvalidParameterError(r,n,e)})(s,l,t),new u(e,t,d,l,s,n,o)};this.views[t]=s}}));Object.keys(s.ExtractSchema()).filter((e=>-1===Object.keys(r).indexOf(e))).forEach((t=>{this.methods[t]=function(...r){return e.contractMethodFactory.createContractMethodFlatParams(s,t,r,!1,!0)},this.methodsObject[t]=function(r){return e.contractMethodFactory.createContractMethodObjectParam(s,t,r,!1,!0)}}))}else{const r=this.parameterSchema;this.methods[t.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...n){return e.contractMethodFactory.createContractMethodFlatParams(r,t.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)},this.methodsObject[t.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(n){return e.contractMethodFactory.createContractMethodObjectParam(r,t.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)}}}_initializeOnChainViews(e,t,r,n){const i=this.schema.val;n.forEach((n=>{this.contractViews[n.viewName]=function(o){return e.contractMethodFactory.createContractViewObjectParam(t,r,n,i,o)}}))}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(e){return this.storageProvider.getBigMapKey(this.address,e,this.schema)}}},6700:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidBalanceError=t.OriginationParameterError=t.RevealOperationError=t.InvalidViewSimulationContext=t.validateAndExtractFailwith=t.ViewSimulationError=t.InvalidInitParameter=t.InvalidCodeParameter=t.InvalidDelegationSource=t.InvalidParameterError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e,t,r){super(),this.smartContractMethodName=e,this.sigs=t,this.invalidParams=r,this.name="InvalidParameterError",this.message=`${e} Received ${r.length} arguments while expecting one of the following signatures (${JSON.stringify(t)})`}}t.InvalidParameterError=i;class o extends n.ParameterValidationError{constructor(e){super(),this.source=e,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${e}. Please use the smart contract abstraction to set your delegate.`}}t.InvalidDelegationSource=o;class s extends n.ParameterValidationError{constructor(e,t){super(),this.message=e,this.data=t,this.name="InvalidCodeParameter"}}t.InvalidCodeParameter=s;class a extends n.ParameterValidationError{constructor(e,t){super(),this.message=e,this.data=t,this.name="InvalidInitParameter"}}t.InvalidInitParameter=a;class c extends n.RpcError{constructor(e,t,r,n){super(),this.message=e,this.viewName=t,this.failWith=r,this.cause=n,this.name="ViewSimulationError"}}t.ViewSimulationError=c;t.validateAndExtractFailwith=e=>{if(u(e.body)){const t=JSON.parse(e.body);if(Array.isArray(t)&&"with"in t[t.length-1])return t[t.length-1].with}};const u=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};class l extends n.ParameterValidationError{constructor(e){super(),this.info=e,this.name="InvalidViewSimulationContext",this.message=`${e} Please configure the context of the view execution in the executeView method.`}}t.InvalidViewSimulationContext=l;class f extends n.RpcError{constructor(e){super(),this.message=e,this.name="RevealOperationError"}}t.RevealOperationError=f;class d extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name}}t.OriginationParameterError=d;class h extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidBalanceError"}}t.InvalidBalanceError=h},238:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.smartContractAbstractionSemantic=t.compose=void 0,i(r(1863),t),i(r(6700),t),i(r(2619),t),i(r(4007),t),i(r(9480),t),i(r(120),t);var o=r(191);Object.defineProperty(t,"compose",{enumerable:!0,get:function(){return o.compose}}),i(r(4662),t),i(r(4397),t),i(r(3687),t),i(r(5491),t);var s=r(22);Object.defineProperty(t,"smartContractAbstractionSemantic",{enumerable:!0,get:function(){return s.smartContractAbstractionSemantic}})},2619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4007:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MANAGER_LAMBDA=void 0;t.MANAGER_LAMBDA={setDelegate:e=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:e}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],removeDelegate:()=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"NONE",args:[{prim:"key_hash"}]},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit:(e,t)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:e}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${t}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],transferToContract:(e,t)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"address"},{string:e}]},{prim:"CONTRACT",args:[{prim:"unit"}]},{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:`${t}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}]}},9480:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createSmartRollupOriginateOperation=t.createSmartRollupAddMessagesOperation=t.createUpdateConsensusKeyOperation=t.createProposalsOperation=t.createBallotOperation=t.createDrainDelegateOperation=t.createIncreasePaidStorageOperation=t.createTransferTicketOperation=t.createRegisterGlobalConstantOperation=t.createRevealOperation=t.createRegisterDelegateOperation=t.createSetDelegateOperation=t.createTransferOperation=t.createOriginationOperation=t.createActivationOperation=void 0;const i=r(8899),o=r(6368),s=r(4593),a=r(4632),c=r(6700);t.createActivationOperation=({pkh:e,secret:t})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.ACTIVATION,pkh:e,secret:t}}));t.createOriginationOperation=({code:e,init:t,balance:r="0",delegate:u,storage:l,fee:f=s.DEFAULT_FEE.ORIGINATION,gasLimit:d=s.DEFAULT_GAS_LIMIT.ORIGINATION,storageLimit:h=s.DEFAULT_STORAGE_LIMIT.ORIGINATION,mutez:p=!1})=>n(void 0,void 0,void 0,(function*(){if(void 0!==l&&void 0!==t)throw new c.OriginationParameterError("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(e))throw new c.InvalidCodeParameter("Wrong code parameter type, expected an array",e);let n;if(void 0!==l){const t=e.find((e=>"prim"in e&&"storage"===e.prim));if(void 0===(null==t?void 0:t.args))throw new c.InvalidCodeParameter("The storage section is missing from the script",e);n=new i.Schema(t.args[0]).Encode(l)}else{if(void 0===t||"object"!=typeof t)throw new c.InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",t);n=t}const s={code:e,storage:n};if(isNaN(Number(r)))throw new c.InvalidBalanceError(`Invalid Balance "${r}", cannot be converted to a number`);const b={kind:o.OpKind.ORIGINATION,fee:f,gas_limit:d,storage_limit:h,balance:p?r.toString():(0,a.format)("tz","mutez",r).toString(),script:s};return u&&(b.delegate=u),b}));t.createTransferOperation=({to:e,amount:t,parameter:r,fee:i=s.DEFAULT_FEE.TRANSFER,gasLimit:c=s.DEFAULT_GAS_LIMIT.TRANSFER,storageLimit:u=s.DEFAULT_STORAGE_LIMIT.TRANSFER,mutez:l=!1})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSACTION,fee:i,gas_limit:c,storage_limit:u,amount:l?t.toString():(0,a.format)("tz","mutez",t).toString(),destination:e,parameters:r}}));t.createSetDelegateOperation=({delegate:e,source:t,fee:r=s.DEFAULT_FEE.DELEGATION,gasLimit:i=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:a=s.DEFAULT_STORAGE_LIMIT.DELEGATION})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,source:t,fee:r,gas_limit:i,storage_limit:a,delegate:e}}));t.createRegisterDelegateOperation=({fee:e=s.DEFAULT_FEE.DELEGATION,gasLimit:t=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.DELEGATION},i)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,fee:e,gas_limit:t,storage_limit:r,delegate:i}}));t.createRevealOperation=({fee:e=s.DEFAULT_FEE.REVEAL,gasLimit:t,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.REVEAL},i,a)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REVEAL,fee:e,public_key:a,source:i,gas_limit:null!=t?t:(0,s.getRevealGasLimit)(i),storage_limit:r}}));t.createRegisterGlobalConstantOperation=({value:e,source:t,fee:r,gasLimit:i,storageLimit:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REGISTER_GLOBAL_CONSTANT,value:e,fee:r,gas_limit:i,storage_limit:s,source:t}}));t.createTransferTicketOperation=({ticketContents:e,ticketTy:t,ticketTicketer:r,ticketAmount:i,destination:s,entrypoint:a,source:c,fee:u,gasLimit:l,storageLimit:f})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSFER_TICKET,fee:u,gas_limit:l,storage_limit:f,source:c,ticket_contents:e,ticket_ty:t,ticket_ticketer:r,ticket_amount:i,destination:s,entrypoint:a}}));t.createIncreasePaidStorageOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,amount:s,destination:a})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.INCREASE_PAID_STORAGE,source:e,fee:t,gas_limit:r,storage_limit:i,amount:s,destination:a}}));t.createDrainDelegateOperation=({consensus_key:e,delegate:t,destination:r})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DRAIN_DELEGATE,consensus_key:e,delegate:t,destination:r}}));t.createBallotOperation=({source:e,proposal:t,ballot:r})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.BALLOT,source:e,proposal:t,ballot:r}}));t.createProposalsOperation=({source:e,proposals:t})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.PROPOSALS,source:e,proposals:t}}));t.createUpdateConsensusKeyOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,pk:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.UPDATE_CONSENSUS_KEY,source:e,fee:t,gas_limit:r,storage_limit:i,pk:s}}));t.createSmartRollupAddMessagesOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,message:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.SMART_ROLLUP_ADD_MESSAGES,source:e,fee:t,gas_limit:r,storage_limit:i,message:s}}));t.createSmartRollupOriginateOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,pvmKind:s,kernel:a,parametersType:c})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.SMART_ROLLUP_ORIGINATE,source:e,fee:t,gas_limit:r,storage_limit:i,pvm_kind:s,kernel:a,parameters_ty:c}}))},1151:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcContractProvider=void 0;const i=r(5543),o=r(8899),s=r(6368),a=r(4632),c=r(227),u=r(150),l=r(9785),f=r(6646),d=r(5544),h=r(2342),p=r(1846),b=r(1863),m=r(6700),g=r(22),v=r(8983),y=r(106),_=r(3729),w=r(738),E=r(7279),O=r(4384),A=r(2864),S=r(5847),P=r(6003),T=r(3793);class I extends P.Provider{constructor(e,t){super(e),this.estimator=t,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new T.PrepareProvider(this.context)}getStorage(e,t){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=yield this.context.readProvider.getScript(e,"head");let i;return t||(t=n),i=o.Schema.isSchema(t)?t:o.Schema.fromRPCResponse({script:t}),i.Execute(n.storage,(0,g.smartContractAbstractionSemantic)(this))}))}getBigMapKey(e,t,r){return n(this,void 0,void 0,(function*(){const n=(0,a.validateContractAddress)(e);if(n!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(n));let i;r||(r=(yield this.rpc.getContract(e)).script),i=o.Schema.isSchema(r)?r:o.Schema.fromRPCResponse({script:r});const s=i.EncodeBigMapKey(t),u=yield this.rpc.getBigMapKey(e,s);return i.ExecuteOnBigMapValue(u)}))}getBigMapKeyByID(e,t,r,i){return n(this,void 0,void 0,(function*(){const{key:n,type:o}=r.EncodeBigMapKey(t),{packed:s}=yield this.context.packer.packData({data:n,type:o}),c=(0,a.encodeExpr)(s),u=i?yield this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},i):yield this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},"head");return r.ExecuteOnBigMapValue(u,(0,g.smartContractAbstractionSemantic)(this))}))}getBigMapKeysByID(e,t,r,i,s=5){return n(this,void 0,void 0,(function*(){const n=yield this.getBlockForRequest(t,i),a=new o.MichelsonMap;let c=0,u=[];for(;cthis.getBigMapValueOrUndefined(t,e,r,n)));u=[...u,...yield Promise.all(i)],c+=s}for(let e=0;ee.kind===s.OpKind.ORIGINATION)),i=yield this.forge(r),{hash:o,context:a,forgedBytes:c,opResponse:u}=yield this.signAndInject(i);return new f.OriginationOperation(o,n,c,u,a,this)}))}setDelegate(e){var t;return n(this,void 0,void 0,(function*(){const r=(0,a.validateAddress)(e.source);if(e.source&&r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.delegate,(0,a.invalidDetail)(n));if(/kt1/i.test(e.source))throw new m.InvalidDelegationSource(e.source);const i=yield this.signer.publicKeyHash(),o=e.source||i,u=yield this.estimate(e,this.estimator.setDelegate.bind(this.estimator)),f=yield this.prepare.delegation(Object.assign(Object.assign({},e),u)),d=f.opOb.contents.find((e=>e.kind===s.OpKind.DELEGATION)),h=yield this.forge(f),{hash:p,context:b,forgedBytes:g,opResponse:v}=yield this.signAndInject(h);return new l.DelegateOperation(p,d,o,g,v,b)}))}registerDelegate(e){return n(this,void 0,void 0,(function*(){const t=yield this.estimate(e,this.estimator.registerDelegate.bind(this.estimator)),r=yield this.signer.publicKeyHash(),n=yield this.prepare.registerDelegate(Object.assign(Object.assign({},e),t)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.DELEGATION)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:f}=yield this.signAndInject(o);return new l.DelegateOperation(a,i,r,u,f,c)}))}transfer(e){var t;return n(this,void 0,void 0,(function*(){const r=(0,a.validateAddress)(e.to);if(r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.to,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(n));if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());const i=yield this.signer.publicKeyHash(),o=yield this.estimate(e,this.estimator.transfer.bind(this.estimator)),u=e.source||i,l=yield this.prepare.transaction(Object.assign(Object.assign({},e),o)),f=l.opOb.contents.find((e=>e.kind===s.OpKind.TRANSACTION)),d=yield this.forge(l),{hash:h,context:b,forgedBytes:m,opResponse:g}=yield this.signAndInject(d);return new p.TransactionOperation(h,f,u,m,g,b)}))}transferTicket(e){var t,r;return n(this,void 0,void 0,(function*(){const n=(0,a.validateAddress)(e.destination);if(n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.destination,(0,a.invalidDetail)(n));const i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=yield this.signer.publicKeyHash(),u=null!==(r=e.source)&&void 0!==r?r:o,l=yield this.estimate(e,this.estimator.transferTicket.bind(this.estimator)),f=yield this.prepare.transferTicket(Object.assign(Object.assign({},e),l)),d=f.opOb.contents.find((e=>e.kind===s.OpKind.TRANSFER_TICKET)),h=yield this.forge(f),{hash:p,context:b,forgedBytes:m,opResponse:g}=yield this.signAndInject(h);return new v.TransferTicketOperation(p,d,u,m,g,b)}))}reveal(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimator.reveal(e);if(r){const i=yield this.estimate(e,(()=>n(this,void 0,void 0,(function*(){return r})))),o=yield this.prepare.reveal(Object.assign(Object.assign({},e),i)),a=o.opOb.contents.find((e=>e.kind===s.OpKind.REVEAL)),c=yield this.forge(o),{hash:u,context:l,forgedBytes:f,opResponse:d}=yield this.signAndInject(c);return new h.RevealOperation(u,a,t,f,d,l)}throw new m.RevealOperationError(`The publicKeyHash '${t}' has already been revealed.`)}))}registerGlobalConstant(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.registerGlobalConstant.bind(this.estimator)),n=yield this.prepare.registerGlobalConstant(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.REGISTER_GLOBAL_CONSTANT)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new d.RegisterGlobalConstantOperation(a,i,t,u,l,c)}))}increasePaidStorage(e){return n(this,void 0,void 0,(function*(){if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.increasePaidStorage.bind(this.estimator)),n=yield this.prepare.increasePaidStorage(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.INCREASE_PAID_STORAGE)),o=yield this.forge(n),{hash:a,context:u,forgedBytes:l,opResponse:f}=yield this.signAndInject(o);return new y.IncreasePaidStorageOperation(a,i,t,l,f,u)}))}drainDelegate(e){return n(this,void 0,void 0,(function*(){const t=yield this.prepare.drainDelegate(e),r=t.opOb.contents.find((e=>e.kind===s.OpKind.DRAIN_DELEGATE)),n=yield this.forge(t),{hash:i,context:o,forgedBytes:a,opResponse:c}=yield this.signAndInject(n);return new w.DrainDelegateOperation(i,r,a,c,o)}))}ballot(e){var t,r;return n(this,void 0,void 0,(function*(){const n=yield this.signer.publicKeyHash(),i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=null!==(r=e.source)&&void 0!==r?r:n,u=yield this.prepare.ballot(Object.assign(Object.assign({},e),{source:o})),l=u.opOb.contents.find((e=>e.kind===s.OpKind.BALLOT)),f=yield this.forge(u),{hash:d,context:h,forgedBytes:p,opResponse:b}=yield this.signAndInject(f);return new _.BallotOperation(d,l,n,p,b,h)}))}proposals(e){var t,r;return n(this,void 0,void 0,(function*(){const n=yield this.signer.publicKeyHash(),i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=null!==(r=e.source)&&void 0!==r?r:n,u=yield this.prepare.proposals(Object.assign(Object.assign({},e),{source:o})),l=u.opOb.contents.find((e=>e.kind===s.OpKind.PROPOSALS)),f=yield this.forge(u),{hash:d,context:h,forgedBytes:p,opResponse:b}=yield this.signAndInject(f);return new E.ProposalsOperation(d,l,n,p,b,h)}))}updateConsensusKey(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.updateConsensusKey.bind(this.estimator)),n=yield this.prepare.updateConsensusKey(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.UPDATE_CONSENSUS_KEY)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new O.UpdateConsensusKeyOperation(a,i,t,u,l,c)}))}smartRollupAddMessages(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.smartRollupAddMessages.bind(this.estimator)),n=yield this.prepare.smartRollupAddMessages(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.SMART_ROLLUP_ADD_MESSAGES)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new A.SmartRollupAddMessagesOperation(a,i,t,u,l,c)}))}smartRollupOriginate(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.smartRollupOriginate.bind(this.estimator)),n=yield this.prepare.smartRollupOriginate(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.SMART_ROLLUP_ORIGINATE)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new S.SmartRollupOriginateOperation(a,i,t,u,l,c)}))}failingNoop(e){return n(this,void 0,void 0,(function*(){const t={kind:s.OpKind.FAILING_NOOP,arbitrary:e.arbitrary},r=yield this.context.readProvider.getBlockHash(e.basedOnBlock),n=yield this.context.forger.forge({branch:r,contents:[t]}),{prefixSig:i}=yield this.signer.sign(n,new Uint8Array([3]));return{signature:i,bytes:n,signedContent:{branch:r,contents:[{kind:s.OpKind.FAILING_NOOP,arbitrary:e.arbitrary}]}}}))}at(e,t=(e=>e)){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=this.context.withExtensions().rpc,i=this.context.withExtensions().readProvider,o=yield i.getScript(e,"head"),s=yield i.getEntrypoints(e),u=new b.ContractAbstraction(e,o,this,this,s,n,i);return t(u,this.context)}))}batch(e){const t=new u.OperationBatch(this.context,this.estimator);return Array.isArray(e)&&t.with(e),t}}t.RpcContractProvider=I},5491:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SaplingStateAbstraction=void 0;t.SaplingStateAbstraction=class{constructor(e,t){this.id=e,this.provider=t}getSaplingDiff(e){return r(this,void 0,void 0,(function*(){return this.provider.getSaplingDiffByID(this.id.toString(),e)}))}getId(){return this.id.toString()}}},22:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.smartContractAbstractionSemantic=void 0;const n=r(8899),i=r(5225),o=r(6391),s=r(5491);t.smartContractAbstractionSemantic=e=>({big_map:(t,r)=>{if(t&&"int"in t&&void 0!==t.int){const s=new n.Schema(r);return new i.BigMapAbstraction(new o.default(t.int),s,e)}return{}},sapling_state:t=>t&&"int"in t&&void 0!==t.int?new s.SaplingStateAbstraction(new o.default(t.int),e):{}})},120:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VIEW_LAMBDA=void 0;t.VIEW_LAMBDA={code:[{prim:"parameter",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},{prim:"unit"}]}]}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"UNIT"},{prim:"EXEC"}]]}],storage:"Unit"}},7642:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RPCResponseError=t.ConfirmationTimeoutError=t.InvalidConfirmationCountError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e){super(),this.invalidConfirmations=e,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${e} expecting at least 1`}}t.InvalidConfirmationCountError=i;class o extends n.NetworkError{constructor(e){super(),this.message=e,this.name="ConfirmationTimeoutError"}}t.ConfirmationTimeoutError=o;class s extends n.RpcError{constructor(e,t){super(),this.message=e,this.cause=t,this.name="RPCResponseError"}}t.RPCResponseError=s},1826:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevealEstimateError=void 0;const n=r(227);class i extends n.TaquitoError{constructor(){super(),this.name="RevealEstimateError",this.message="Public key is unknown, unable to estimate the reveal operation in Wallet API."}}t.RevealEstimateError=i},1243:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4705:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Estimate=void 0;const r=100;class n{constructor(e,t,r,n,i=100){this._milligasLimit=e,this._storageLimit=t,this.opSize=r,this.minimalFeePerStorageByteMutez=n,this.baseFeeMutez=i}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){const e=Math.max(Number(this._storageLimit),0);return e>0?e:0}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3+100)}get operationFeeMutez(){return.1*(Number(this._milligasLimit)/1e3+100)+1*Number(this.opSize)}roundUp(e){return Math.ceil(Number(e))}get minimalFeeMutez(){return this.roundUp(r+this.operationFeeMutez)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+200)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),r)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(e){let t,r=0,i=0,o=0,s=0;return e.forEach((e=>{r+=e.milligasLimit,i+=e.storageLimit,o+=e.opSize,s=Math.max(e.minimalFeePerStorageByteMutez,s),e.baseFeeMutez&&(t=t?t+e.baseFeeMutez:e.baseFeeMutez)})),new n(r,i,o,s,t)}static createArrayEstimateInstancesFromProperties(e){return e.map((e=>new n(e.milligasLimit,e.storageLimit,e.opSize,e.minimalFeePerStorageByteMutez,e.baseFeeMutez)))}}t.Estimate=n},8794:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4705),t),i(r(1243),t),i(r(4782),t),i(r(1826),t)},4782:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{a+="originated_contracts"in e&&void 0!==e.originated_contracts?e.originated_contracts.length*this.ORIGINATION_STORAGE:0,a+="allocated_destination_contract"in e?this.ALLOCATION_STORAGE:0,i+=Number(e.consumed_milligas)||0,a+="paid_storage_size_diff"in e&&Number(e.paid_storage_size_diff)||0,a+="storage_size"in e&&"global_address"in e&&Number(e.storage_size)||0,a+="genesis_commitment_hash"in e?Number(e.size):0})),(0,s.isOpWithFee)(e)?{milligasLimit:i||0,storageLimit:Number(a||0),opSize:t,minimalFeePerStorageByteMutez:r.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:t,minimalFeePerStorageByteMutez:r.toNumber(),baseFeeMutez:0}}calculateEstimates(e,t){return n(this,void 0,void 0,(function*(){const{opbytes:r,opOb:{branch:n,contents:i}}=yield this.forge(e),s={operation:{branch:n,contents:i},chain_id:yield this.context.readProvider.getChainId()},{opResponse:a}=yield this.simulate(s),{cost_per_byte:c}=t,u=[...(0,o.flattenErrors)(a,"backtracked"),...(0,o.flattenErrors)(a)];if(u.length)throw new o.TezosOperationError(u,"Error occurred during estimation",a.contents);let l=1;return Array.isArray(e.opOb.contents)&&e.opOb.contents.length>1&&(l="reveal"===a.contents[0].kind?e.opOb.contents.length-1:e.opOb.contents.length),a.contents.map((e=>this.getEstimationPropertiesFromOperationContent(e,"reveal"===e.kind?this.OP_SIZE_REVEAL/2:r.length/2/l,c)))}))}originate(e){return n(this,void 0,void 0,(function*(){const t=yield this.prepare.originate(e),r=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.calculateEstimates(t,r);return"reveal"===t.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}transfer(e){var t,{fee:r,storageLimit:o,gasLimit:s}=e,u=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.to);if(e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.to,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.source)&&void 0!==t?t:"");if(u.source&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(n));if(u.amount<0)throw new d.InvalidAmountError(u.amount.toString());const i=yield this.prepare.transaction(Object.assign({fee:r,storageLimit:o,gasLimit:s},u)),l=yield this.context.readProvider.getProtocolConstants("head"),f=yield this.calculateEstimates(i,l);return"reveal"===i.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}transferTicket(e){var t,{fee:r,storageLimit:o,gasLimit:s}=e,u=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.destination);if(e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.destination,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.source)&&void 0!==t?t:"");if(u.source&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(n));const i=yield this.context.readProvider.getProtocolConstants("head"),l=yield this.prepare.transferTicket(Object.assign({fee:r,storageLimit:o,gasLimit:s},u)),f=yield this.calculateEstimates(l,i);return"reveal"===l.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}setDelegate(e){var t,{fee:r,gasLimit:o,storageLimit:s}=e,u=i(e,["fee","gasLimit","storageLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.source);if(u.source&&e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.delegate)&&void 0!==t?t:"");if(u.delegate&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.delegate,(0,c.invalidDetail)(n));const i=yield this.prepare.delegation(Object.assign({fee:r,storageLimit:s,gasLimit:o},u)),l=yield this.context.readProvider.getProtocolConstants("head"),f=yield this.calculateEstimates(i,l);return"reveal"===i.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}batch(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.batch(e),n=yield this.calculateEstimates(r,t);return a.Estimate.createArrayEstimateInstancesFromProperties(n)}))}registerDelegate(e,t){var{fee:r,storageLimit:o,gasLimit:s}=e,c=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(yield this.getKeys()).publicKeyHash,n=yield this.context.readProvider.getProtocolConstants("head"),i=t||e,u=yield this.prepare.registerDelegate(Object.assign({fee:r,storageLimit:o,gasLimit:s},c),i),l=yield this.calculateEstimates(u,n);return"reveal"===u.opOb.contents[0].kind&&l.shift(),a.Estimate.createEstimateInstanceFromProperties(l)}))}reveal(e){return n(this,void 0,void 0,(function*(){const{publicKeyHash:t,publicKey:r}=yield this.getKeys();if(!r)throw new u.RevealEstimateError;if(yield this.isAccountRevealRequired(t)){const t=yield this.context.readProvider.getProtocolConstants("head"),r=e?yield this.prepare.reveal(e):yield this.prepare.reveal({}),n=yield this.calculateEstimates(r,t);return a.Estimate.createEstimateInstanceFromProperties(n)}}))}registerGlobalConstant(e){var{fee:t,storageLimit:r,gasLimit:o}=e,s=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=yield this.prepare.registerGlobalConstant(Object.assign({fee:t,storageLimit:r,gasLimit:o},s)),n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.calculateEstimates(e,n);return"reveal"===e.opOb.contents[0].kind&&i.shift(),a.Estimate.createEstimateInstanceFromProperties(i)}))}increasePaidStorage(e){var{fee:t,storageLimit:r,gasLimit:o}=e,s=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){if(s.amount<0)throw new d.InvalidAmountError(s.amount.toString());const e=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.prepare.increasePaidStorage(Object.assign({fee:t,storageLimit:r,gasLimit:o},s)),i=yield this.calculateEstimates(n,e);return"reveal"===n.opOb.contents[0].kind&&i.shift(),a.Estimate.createEstimateInstanceFromProperties(i)}))}updateConsensusKey(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.updateConsensusKey(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}smartRollupAddMessages(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.smartRollupAddMessages(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}smartRollupOriginate(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.smartRollupOriginate(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}contractCall(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.contractCall(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}}t.RPCEstimateProvider=h},7336:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositeForger=void 0;const i=r(3557);t.CompositeForger=class{constructor(e){if(this.forgers=e,0===e.length)throw new i.UnspecifiedForgerError}forge({branch:e,contents:t}){return n(this,void 0,void 0,(function*(){const r=yield Promise.all(this.forgers.map((r=>r.forge({branch:e,contents:t}))));if(0===r.length)throw new i.UnspecifiedForgerError;let n=r.pop();for(;r.length;){const e=r.pop();if(e!==n)throw new i.ForgingMismatchError([n,e]);n=e}return n}))}}},3557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnspecifiedForgerError=t.ForgingMismatchError=void 0;const n=r(227);class i extends n.TaquitoError{constructor(e){super(),this.results=e,this.name="ForgingMismatchError",this.message="Forging mismatch error"}}t.ForgingMismatchError=i;class o extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnspecifiedForgerError",this.message="No forger has been configured. Please configure new CompositeForger([rpcForger, localForger]) with your TezosToolkit instance."}}t.UnspecifiedForgerError=o},794:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RpcForger=void 0;t.RpcForger=class{constructor(e){this.context=e}forge({branch:e,contents:t}){return this.context.rpc.forgeOperations({branch:e,contents:t})}}},6713:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TaquitoLocalForger=void 0;const i=r(5078);t.TaquitoLocalForger=class{constructor(e){this.context=e}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const e=yield this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}))}forge({branch:e,contents:t}){return n(this,void 0,void 0,(function*(){return new i.LocalForger(yield this.getNextProto()).forge({branch:e,contents:t})}))}}},5505:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGlobalConstantsProvider=void 0;const i=r(3739);t.DefaultGlobalConstantsProvider=class{constructor(){this._globalConstantsLibrary={}}loadGlobalConstant(e){for(const t in e)Object.assign(this._globalConstantsLibrary,{[t]:e[t]})}getGlobalConstantByHash(e){return n(this,void 0,void 0,(function*(){const t=this._globalConstantsLibrary[e];if(!t)throw new i.GlobalConstantNotFound(e);return t}))}}},3739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnconfiguredGlobalConstantsProviderError=t.GlobalConstantNotFound=void 0;const n=r(227);class i extends n.TaquitoError{constructor(e){super(),this.hash=e,this.name="GlobalConstantNotFound",this.message=`Please load the value associated with the constant ${e} using the loadGlobalConstant method of the DefaultGlobalConstantsProvider.`}}t.GlobalConstantNotFound=i;class o extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredGlobalConstantsProviderError",this.message="No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."}}t.UnconfiguredGlobalConstantsProviderError=o},3171:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9494:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopGlobalConstantsProvider=void 0;const i=r(3739);t.NoopGlobalConstantsProvider=class{getGlobalConstantByHash(e){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredGlobalConstantsProviderError}))}}},5180:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatErrorMessage=void 0;const n=r(5543);t.formatErrorMessage=function(e,t){const r=JSON.parse(e.body);if(r[0]&&r[0].kind&&r[0].msg){const i=JSON.stringify({kind:r[0].kind,id:r[0].id,msg:r[0].msg.replace(t,"")});return new n.HttpResponseError(`Http error response: (${e.status}) ${i}`,e.status,e.statusText,i,e.url)}return e}},134:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5744:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcInjector=void 0;const i=r(5180),o=r(5543);t.RpcInjector=class{constructor(e){this.context=e}inject(e){return n(this,void 0,void 0,(function*(){let t;try{t=yield this.context.rpc.injectOperation(e)}catch(e){const t=". You may want to use --replace to provide adequate fee and replace it";throw e instanceof o.HttpResponseError&&e.message.includes(t)?(0,i.formatErrorMessage)(e,t):e}return t}))}}},3729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BallotOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"ballot"===e.kind));return e||void 0}get period(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}t.BallotOperation=i},3650:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchOperation=void 0;const n=r(6391),i=r(150),o=r(835),s=r(7525),a=r(807);class c extends s.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}getOriginatedContractAddresses(){const e=this.results.filter((e=>"origination"===e.kind));let t=[];for(const r of e)r.metadata.operation_result.originated_contracts&&(t=[...t,...r.metadata.operation_result.originated_contracts]);return t}get status(){return this.results.filter((e=>-1!==i.BATCH_KINDS.indexOf(e.kind))).map((e=>{if((0,a.hasMetadataWithResult)(e)){return e.metadata.operation_result.status}return"unknown"}))[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP}),new n.default(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,o.flattenOperationResult)({contents:this.results}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,o.flattenOperationResult)({contents:this.results}),"paid_storage_size_diff"))}get errors(){return(0,o.flattenErrors)({contents:this.results})}}t.BatchOperation=c},9785:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegateOperation=void 0;const n=r(6391),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"delegation"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get delegate(){return this.params.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),this.consumedMilliGas?new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.DelegateOperation=o},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DrainDelegateOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i){super(e,r,n,i),this.params=t}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"drain_delegate"===e.kind)),t=e&&e.metadata&&e.metadata.balance_updates;return t||void 0}get consensusKey(){return this.params.consensus_key}get delegate(){return this.params.delegate}get destination(){return this.params.destination}}t.DrainDelegateOperation=i},835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidEstimateValueError=t.OriginationOperationError=t.flattenErrors=t.flattenOperationResult=t.TezosPreapplyFailureError=t.TezosOperationError=void 0;const n=r(227),i=r(807);class o extends n.RpcError{constructor(e,t,r){super(),this.errors=e,this.errorDetails=t,this.operationsWithResults=r,this.name="TezosOperationError",this.lastError=e[e.length-1],this.message=`(${this.kind}) ${this.id}`,"with"in this.lastError&&(this.lastError.with.string?this.message=this.lastError.with.string:this.lastError.with.int?this.message=this.lastError.with.int:this.message=JSON.stringify(this.lastError.with))}get id(){return this.lastError.id}get kind(){return this.lastError.kind}}t.TezosOperationError=o;class s extends Error{constructor(e){super(),this.result=e,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}t.TezosPreapplyFailureError=s;t.flattenOperationResult=e=>{const t=Array.isArray(e)?e:[e],r=[];for(let e=0;er.push(e.result))))}return r};t.flattenErrors=(e,t="failed")=>{const r=Array.isArray(e)?e:[e];let n=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IncreasePaidStorageOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"increase_paid_storage"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}t.IncreasePaidStorageOperation=i},3323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=t.DrainDelegateOperation=t.BallotOperation=t.TransactionOperation=t.OriginationOperation=t.DelegateOperation=t.BatchOperation=t.InvalidEstimateValueError=t.TezosPreapplyFailureError=t.TezosOperationError=t.OpKind=void 0;var n=r(807);Object.defineProperty(t,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});var i=r(835);Object.defineProperty(t,"TezosOperationError",{enumerable:!0,get:function(){return i.TezosOperationError}}),Object.defineProperty(t,"TezosPreapplyFailureError",{enumerable:!0,get:function(){return i.TezosPreapplyFailureError}}),Object.defineProperty(t,"InvalidEstimateValueError",{enumerable:!0,get:function(){return i.InvalidEstimateValueError}});var o=r(3650);Object.defineProperty(t,"BatchOperation",{enumerable:!0,get:function(){return o.BatchOperation}});var s=r(9785);Object.defineProperty(t,"DelegateOperation",{enumerable:!0,get:function(){return s.DelegateOperation}});var a=r(6646);Object.defineProperty(t,"OriginationOperation",{enumerable:!0,get:function(){return a.OriginationOperation}});var c=r(1846);Object.defineProperty(t,"TransactionOperation",{enumerable:!0,get:function(){return c.TransactionOperation}});var u=r(3729);Object.defineProperty(t,"BallotOperation",{enumerable:!0,get:function(){return u.BallotOperation}});var l=r(738);Object.defineProperty(t,"DrainDelegateOperation",{enumerable:!0,get:function(){return l.DrainDelegateOperation}});var f=r(7525);Object.defineProperty(t,"Operation",{enumerable:!0,get:function(){return f.Operation}})},7525:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=void 0;const i=r(977),o=r(9002),s=r(807),a=r(4632),c=r(552),u=r(7642),l=r(227);t.Operation=class{get includedInBlock(){return this._foundAt}constructor(e,t,r,n){if(this.hash=e,this.raw=t,this.results=r,this.context=n,this._pollingConfig$=new i.ReplaySubject(1),this.currentHead$=this._pollingConfig$.pipe((0,o.switchMap)((e=>new i.BehaviorSubject(e).pipe((0,o.timeout)({each:1e3*e.timeout,with:()=>(0,i.throwError)((()=>new u.ConfirmationTimeoutError("Confirmation polling timed out")))})))),(0,o.switchMap)((()=>(0,i.defer)((()=>(0,c.createObservableFromSubscription)(this.context.stream.subscribeBlock("head")))).pipe((0,o.switchMap)((e=>{var t,r;const n=null!==(r=null===(t=this.lastHead)||void 0===t?void 0:t.header.level)&&void 0!==r?r:e.header.level-1;return(0,i.range)(n+1,e.header.level-n-1).pipe((0,o.concatMap)((e=>this.context.readProvider.getBlock(e))),(0,o.endWith)(e))})),(0,o.tap)((e=>this.lastHead=e))))),(0,o.shareReplay)({refCount:!0})),this.confirmed$=this.currentHead$.pipe((0,o.map)((e=>{for(let t=3;t>=0;t--)e.operations[t].forEach((t=>{t.hash===this.hash&&(this._foundAt=e.header.level)}));if(e.header.level-this._foundAt>=0)return this._foundAt})),(0,o.filter)((e=>void 0!==e)),(0,o.first)(),(0,o.shareReplay)()),this._foundAt=Number.POSITIVE_INFINITY,(0,a.validateOperation)(this.hash)!==a.ValidationResult.VALID)throw new l.InvalidOperationHashError(this.hash);this.confirmed$.pipe((0,o.first)(),(0,o.catchError)((()=>(0,i.of)(i.EMPTY)))).subscribe()}get revealOperation(){return Array.isArray(this.results)&&this.results.find((e=>"reveal"===e.kind))}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map((e=>(0,s.hasMetadataWithResult)(e)?e.metadata.operation_result.status:"unknown"))[0]||"unknown"}confirmation(e,t){return n(this,void 0,void 0,(function*(){if(void 0!==e&&e<1)throw new u.InvalidConfirmationCountError(e);const{defaultConfirmationCount:r,confirmationPollingTimeoutSecond:n}=this.context.config;this._pollingConfig$.next({timeout:t||n});const i=void 0!==e?e:r;return new Promise(((e,t)=>{this.confirmed$.pipe((0,o.switchMap)((()=>this.currentHead$)),(0,o.filter)((e=>e.header.level-this._foundAt>=i-1)),(0,o.first)()).subscribe((t=>{e(this._foundAt+(i-1))}),t)}))}))}}},6646:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OriginationOperation=void 0;const i=r(6391),o=r(835),s=r(7525),a=r(807);class c extends s.Operation{constructor(e,t,r,n,i,o){super(e,r,n,i),this.params=t,this.contractProvider=o;const s=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(s)&&(this.contractAddress=s[0])}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"origination"===e.kind)),t=e&&(0,a.hasMetadataWithResult)(e)&&e.metadata.operation_result;return t||void 0}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return i.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:i.BigNumber.ROUND_UP}),this.consumedMilliGas?new i.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get storageDiff(){const e=this.operationResults&&this.operationResults.paid_storage_size_diff;return e||void 0}get storageSize(){const e=this.operationResults&&this.operationResults.storage_size;return e||void 0}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}contract(e,t){return n(this,void 0,void 0,(function*(){if(!this.contractAddress)throw new o.OriginationOperationError("No contract was originated in this operation");return yield this.confirmation(e,t),this.contractProvider.at(this.contractAddress)}))}}t.OriginationOperation=c},7279:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProposalsOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"proposals"===e.kind));return e||void 0}get proposals(){return this.params.proposals}get period(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.period}}t.ProposalsOperation=i},5544:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegisterGlobalConstantOperation=void 0;const n=r(6391),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"register_global_constant"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get registeredExpression(){return this.params.value}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),this.consumedMilliGas?new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}}t.RegisterGlobalConstantOperation=o},2342:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevealOperation=void 0;const n=r(6391),i=r(835),o=r(7525);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"reveal"===e.kind));return e?[e]:[]}get status(){const e=this.operationResults[0];return e?e.metadata.operation_result.status:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get publicKey(){return this.params.public_key}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"storage_size"))}get errors(){return(0,i.flattenErrors)({contents:this.operationResults})}}t.RevealOperation=s},2864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartRollupAddMessagesOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"smart_rollup_add_messages"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get message(){return this.params.message}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.SmartRollupAddMessagesOperation=i},5847:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartRollupOriginateOperation=void 0;const n=r(6368),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>e.kind===n.OpKind.SMART_ROLLUP_ORIGINATE)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.SmartRollupOriginateOperation=o},1846:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOperation=void 0;const n=r(6391),i=r(835),o=r(7525);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"transaction"===e.kind));return e?[e]:[]}get status(){const e=this.operationResults[0];return e?e.metadata.operation_result.status:"unknown"}get amount(){return new n.default(this.params.amount)}get destination(){return this.params.destination}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}get consumedGas(){return n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP}),new n.default(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"storage_size"))}get errors(){return(0,i.flattenErrors)({contents:this.operationResults})}}t.TransactionOperation=s},8983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransferTicketOperation=void 0;const n=r(6368),i=r(6391),o=r(3323);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>e.kind===n.OpKind.TRANSFER_TICKET)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return i.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:i.BigNumber.ROUND_UP}),this.consumedMilliGas?new i.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}}t.TransferTicketOperation=s},807:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasMetadataWithInternalOperationResult=t.hasMetadataWithResult=t.hasMetadata=t.isSourceOp=t.isOpRequireReveal=t.isOpWithFee=t.isKind=t.findWithKind=t.attachKind=t.OpKind=void 0;var n=r(6368);Object.defineProperty(t,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});t.attachKind=(e,t)=>Object.assign(Object.assign({},e),{kind:t});t.findWithKind=(e,r)=>{if(Array.isArray(e)){const n=e.find((e=>e.kind===r));if(n&&(0,t.isKind)(n,r))return n}};t.isKind=(e,t)=>e.kind===t;t.isOpWithFee=e=>-1!==["transaction","delegation","origination","reveal","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(e.kind);t.isOpRequireReveal=e=>-1!==["transaction","delegation","origination","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(e.kind);t.isSourceOp=e=>-1!==["transaction","delegation","origination","reveal","ballot"].indexOf(e.kind);t.hasMetadata=e=>"metadata"in e;t.hasMetadataWithResult=e=>(0,t.hasMetadata)(e)&&"operation_result"in e.metadata;t.hasMetadataWithInternalOperationResult=e=>(0,t.hasMetadata)(e)&&"internal_operation_results"in e.metadata},4384:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateConsensusKeyOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"update_consensus_key"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.UpdateConsensusKeyOperation=i},4762:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9406:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MichelCodecPacker=void 0;const i=r(9985);t.MichelCodecPacker=class{packData(e){return n(this,void 0,void 0,(function*(){const{bytes:t}=(0,i.packDataBytes)(e.data,e.type);return{packed:t}}))}}},6395:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcPacker=void 0;t.RpcPacker=class{constructor(e){this.context=e}packData(e){return r(this,void 0,void 0,(function*(){return this.context.rpc.packData(e)}))}}},9813:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5286:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MichelCodecParser=void 0;const i=r(9985),o=r(6700),s=r(8899);t.MichelCodecParser=class{constructor(e){this.context=e}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const e=yield this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}))}parseScript(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseScript(e)}))}parseMichelineExpression(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseMichelineExpression(e)}))}parseJSON(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseJSON(e)}))}prepareCodeOrigination(e){return n(this,void 0,void 0,(function*(){const t=e;if(t.code=yield this.formatCodeParam(e.code),e.init)t.init=yield this.formatInitParam(e.init);else if(e.storage){const r=t.code.find((e=>"prim"in e&&"storage"===e.prim));if(!(null==r?void 0:r.args))throw new o.InvalidCodeParameter("The storage section is missing from the script",e.code);const n=new s.Schema(r.args[0]),a=yield this.findGlobalConstantsHashAndValue(n);if(0!==Object.keys(a).length){const n=new i.Parser({expandGlobalConstant:a}).parseJSON(r.args[0]),o=new s.Schema(n);t.init=o.Encode(e.storage)}else t.init=n.Encode(e.storage);delete t.storage}return t}))}formatCodeParam(e){return n(this,void 0,void 0,(function*(){let t;if("string"==typeof e){const r=yield this.parseScript(e);if(null===r)throw new o.InvalidCodeParameter("Unable to parse",e);t=r}else{const r=yield this.parseJSON(e),n=["parameter","storage","code"];t=r.sort(((e,t)=>n.indexOf(e.prim)-n.indexOf(t.prim)))}return t}))}formatInitParam(e){return n(this,void 0,void 0,(function*(){let t;if("string"==typeof e){const r=yield this.parseMichelineExpression(e);if(null===r)throw new o.InvalidInitParameter("Invalid init parameter",e);t=r}else t=yield this.parseJSON(e);return t}))}findGlobalConstantsHashAndValue(e){return n(this,void 0,void 0,(function*(){const t=e.findToken("constant"),r={};if(0!==t.length)for(const e of t){const t=e.tokenVal.args;if(t){const e=t[0];if(e.string){const t=e.string,n=yield this.context.globalConstantsProvider.getGlobalConstantByHash(t);Object.assign(r,{[t]:n})}}}return r}))}}},3259:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopParser=void 0;t.NoopParser=class{prepareCodeOrigination(e){return r(this,void 0,void 0,(function*(){return e}))}}},3793:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(8078),t),i(r(2021),t)},8078:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2021:function(e,t,r){"use strict";var n,i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},s=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{var r,n,i;return{fee:null!==(r=e.fee)&&void 0!==r?r:t.fee,gasLimit:null!==(n=e.gasLimit)&&void 0!==n?n:t.gasLimit,storageLimit:null!==(i=e.storageLimit)&&void 0!==i?i:t.storageLimit}};class g extends p.Provider{constructor(e){super(e),this.context=e,n.set(this,void 0),o(this,n,{},"f")}getBlockHash(e){return i(this,void 0,void 0,(function*(){return this.context.readProvider.getBlockHash(null!=e?e:"head~2")}))}getProtocolHash(){return i(this,void 0,void 0,(function*(){return this.context.readProvider.getNextProtocol("head")}))}getHeadCounter(e){var t;return i(this,void 0,void 0,(function*(){return null!==(t=this.context.readProvider.getCounter(e,"head"))&&void 0!==t?t:"0"}))}adjustGasForBatchOperation(e,t,r){return b.default.min(t,e.div(r+1))}getAccountLimits(e,t,r){return i(this,void 0,void 0,(function*(){const n=yield this.context.readProvider.getBalance(e,"head"),{hard_gas_limit_per_operation:i,hard_gas_limit_per_block:o,hard_storage_limit_per_operation:s,cost_per_byte:a}=t;return{fee:0,gasLimit:r?Math.floor(this.adjustGasForBatchOperation(o,i,r).toNumber()):i.toNumber(),storageLimit:Math.floor(b.default.min(n.dividedBy(a),s).toNumber())}}))}getFee(e,t,r){(!s(this,n,"f")[t]||s(this,n,"f")[t]{switch(e.kind){case c.OpKind.ACTIVATION:case c.OpKind.DRAIN_DELEGATE:return Object.assign({},e);case c.OpKind.ORIGINATION:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{balance:void 0!==e.balance?`${e.balance}`:"0"}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.TRANSACTION:{const i=Object.assign(Object.assign(Object.assign(Object.assign({},e),{amount:void 0!==e.amount?`${e.amount}`:"0"}),this.getSource(e,r,n)),this.getFee(e,r,t));if(i.source.toLowerCase().startsWith("kt1"))throw new d.DeprecationError(`KT1 addresses are not supported as source since ${l.Protocols.PsBabyM1}`);return i}case c.OpKind.REVEAL:case c.OpKind.DELEGATION:case c.OpKind.REGISTER_GLOBAL_CONSTANT:case c.OpKind.UPDATE_CONSENSUS_KEY:case c.OpKind.SMART_ROLLUP_ADD_MESSAGES:case c.OpKind.SMART_ROLLUP_ORIGINATE:return Object.assign(Object.assign(Object.assign({},e),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.TRANSFER_TICKET:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ticket_amount:`${e.ticket_amount}`}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.INCREASE_PAID_STORAGE:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{amount:`${e.amount}`}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.BALLOT:case c.OpKind.PROPOSALS:if(void 0===i)throw new f.RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},e),{period:null==i?void 0:i.voting_period.index});default:throw new d.InvalidOperationKindError(e.kind)}}))}activate({pkh:e,secret:t}){return i(this,void 0,void 0,(function*(){const r=yield(0,h.createActivationOperation)({pkh:e,secret:t}),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:s,contents:this.constructOpContents(i,c,e),protocol:a},counter:c}}))}reveal({fee:e,gasLimit:t,storageLimit:r}){return i(this,void 0,void 0,(function*(){const{pkh:i,publicKey:s}=yield this.getKeys();if(!s)throw new d.PublicKeyNotFoundError(i);const a=yield this.context.readProvider.getProtocolConstants("head"),c=yield this.getAccountLimits(i,a),u=m({fee:e,storageLimit:r,gasLimit:t},c),l=yield(0,h.createRevealOperation)({fee:u.fee,gasLimit:u.gasLimit,storageLimit:u.storageLimit},i,s),f=this.convertIntoArray(l),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(i),10);return{opOb:{branch:p,contents:this.constructOpContents(f,g,i),protocol:b},counter:g}}))}originate(e,t){var{fee:r,storageLimit:s,gasLimit:c}=e,u=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),l=yield(0,h.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},u),m({fee:r,storageLimit:s,gasLimit:c},a)))),f=yield this.addRevealOperationIfNeeded(l,e),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,e,t),protocol:b},counter:g}}))}transaction(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createTransferOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}delegation(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSetDelegateOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}registerDelegate({fee:e,storageLimit:t,gasLimit:r},s){return i(this,void 0,void 0,(function*(){const{pkh:i}=yield this.getKeys(),a=yield this.context.readProvider.getProtocolConstants("head"),c=yield this.getAccountLimits(i,a),u=m({fee:e,storageLimit:t,gasLimit:r},c),l=yield(0,h.createRegisterDelegateOperation)({fee:u.fee,storageLimit:u.storageLimit,gasLimit:u.gasLimit},i),f=yield this.addRevealOperationIfNeeded(l,i),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(i),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,i,s),protocol:b},counter:g}}))}registerGlobalConstant(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createRegisterGlobalConstantOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}updateConsensusKey(e,t){var{fee:r,storageLimit:s,gasLimit:c}=e,u=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),l=yield(0,h.createUpdateConsensusKeyOperation)(Object.assign(Object.assign({},u),m({fee:r,storageLimit:s,gasLimit:c},a))),f=yield this.addRevealOperationIfNeeded(l,e),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,e,t),protocol:b},counter:g}}))}increasePaidStorage(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createIncreasePaidStorageOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}ballot(e){return i(this,void 0,void 0,(function*(){const{pkh:t}=yield this.getKeys(),r=yield(0,h.createBallotOperation)(Object.assign({},e)),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(t),10);let u;try{u=yield this.rpc.getCurrentPeriod()}catch(e){throw new f.RPCResponseError("Failed to get the current voting period index")}return{opOb:{branch:s,contents:this.constructOpContents(i,c,t,void 0,u),protocol:a},counter:c}}))}proposals(e){return i(this,void 0,void 0,(function*(){const{pkh:t}=yield this.getKeys(),r=yield(0,h.createProposalsOperation)(Object.assign({},e)),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(t),10);let u;try{u=yield this.rpc.getCurrentPeriod()}catch(e){throw new f.RPCResponseError("Failed to get the current voting period index")}return{opOb:{branch:s,contents:this.constructOpContents(i,c,t,void 0,u),protocol:a},counter:c}}))}drainDelegate(e,t){return i(this,void 0,void 0,(function*(){const{pkh:r}=yield this.getKeys(),i=yield(0,h.createDrainDelegateOperation)(Object.assign({},e)),s=this.convertIntoArray(i),a=yield this.getBlockHash(),c=yield this.getProtocolHash();o(this,n,{},"f");const u=parseInt(yield this.getHeadCounter(r),10);return{opOb:{branch:a,contents:this.constructOpContents(s,u,r,t),protocol:c},counter:u}}))}transferTicket(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createTransferTicketOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}smartRollupAddMessages(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSmartRollupAddMessagesOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}smartRollupOriginate(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSmartRollupOriginateOperation)(Object.assign(Object.assign({},m({fee:t,storageLimit:r,gasLimit:s},a)),c)),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}batch(e,t){return i(this,void 0,void 0,(function*(){const{pkh:r,publicKey:i}=yield this.getKeys(),s=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(r,s,e.length),c=yield this.isRevealOpNeeded(e,r),f=[];if(t)for(const r of e)if((0,u.isOpWithFee)(r)){const e=t.shift(),n=m(r,{fee:e.suggestedFeeMutez,storageLimit:e.storageLimit,gasLimit:e.gasLimit});f.push(yield this.getRPCOp(Object.assign(Object.assign({},r),n)))}else f.push(Object.assign({},r));else for(const t of e)if((0,u.isOpWithFee)(t)){const e=m(t,a);f.push(yield this.getRPCOp(Object.assign(Object.assign({},t),e)))}else f.push(Object.assign({},t));if(c){if(!i)throw new d.PublicKeyNotFoundError(r);f.unshift(yield(0,h.createRevealOperation)({fee:l.DEFAULT_FEE.REVEAL,storageLimit:l.DEFAULT_STORAGE_LIMIT.REVEAL,gasLimit:(0,l.getRevealGasLimit)(r)},r,i))}const p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(r),10);return{opOb:{branch:p,contents:this.constructOpContents(f,g,r),protocol:b},counter:g}}))}contractCall(e){var t,r,s;return i(this,void 0,void 0,(function*(){const i=yield this.getBlockHash(),a=yield this.getProtocolHash(),{pkh:u}=yield this.getKeys();o(this,n,{},"f");const l=parseInt(yield this.getHeadCounter(u),10),f=e.toTransferParams(),d=yield this.context.readProvider.getProtocolConstants("head"),h=yield this.getAccountLimits(u,d),p=m({fee:f.fee,storageLimit:f.storageLimit,gasLimit:f.gasLimit},h),b={kind:c.OpKind.TRANSACTION,fee:null!==(t=f.fee)&&void 0!==t?t:p.fee,gas_limit:null!==(r=f.gasLimit)&&void 0!==r?r:p.gasLimit,storage_limit:null!==(s=f.storageLimit)&&void 0!==s?s:p.storageLimit,amount:String(f.amount),destination:f.to,parameters:f.parameter},g=yield this.addRevealOperationIfNeeded(b,u),v=this.convertIntoArray(g);return{opOb:{branch:i,contents:this.constructOpContents(v,l,u),protocol:a},counter:l}}))}toPreapply(e){return i(this,void 0,void 0,(function*(){const{opOb:{contents:t,branch:r,protocol:n}}=e,i=this.toForge(e),o=yield this.context.forger.forge(i);return[{contents:t,branch:r,protocol:n,signature:(yield this.context.signer.sign(o,new Uint8Array([3]))).prefixSig}]}))}toForge({opOb:{contents:e,branch:t}}){return{branch:t,contents:e}}}t.PrepareProvider=g,n=new WeakMap},6003:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnconfiguredSignerError=void 0;const n=r(227);class i extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredSignerError",this.message="No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance."}}t.UnconfiguredSignerError=i},1527:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1067:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopSigner=void 0;const i=r(7591);t.NoopSigner=class{publicKey(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}publicKeyHash(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}secretKey(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}sign(e,t){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}}},552:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createObservableFromSubscription=void 0;const n=r(977);t.createObservableFromSubscription=function(e){return new n.Observable((t=>(e.on("data",(e=>{t.next(e)})),e.on("error",(e=>{t.error(e)})),e.on("close",(()=>{t.complete()})),()=>{e.close()})))}},3320:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidFilterExpressionError=t.UnsupportedEventError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e){super(),this.type=e,this.name="UnsupportedEventError",this.message=`Unsupported event type "${e}" expecting one of the "data", "error", or "close".`}}t.UnsupportedEventError=i;class o extends n.ParameterValidationError{constructor(e){super(),this.invalidExpression=e,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}t.InvalidFilterExpressionError=o},8176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFilter=t.evaluateExpression=t.evaluateOpFilter=t.eventFilter=void 0;const n=r(3320);t.eventFilter=(e,t,r,n)=>"event"===e.kind&&((!r||e.tag===r)&&((!t||e.source===t)&&(!n||"applied"===e.result.status)));t.evaluateOpFilter=(e,t)=>"opHash"in t?((e,t)=>e.hash===t.opHash)(e,t):"source"in t?((e,t)=>{switch(e.kind){case"attestation":case"endorsement":return"metadata"in e&&e.metadata.delegate===t.source;case"activate_account":return"metadata"in e&&e.pkh===t.source;default:return"source"in e&&e.source===t.source}})(e,t):"kind"in t?((e,t)=>"kind"in e&&e.kind===t.kind)(e,t):"destination"in t&&((e,t)=>{switch(e.kind){case"delegation":return e.delegate===t.destination;case"origination":if("metadata"in e&&"operation_result"in e.metadata&&"originated_contracts"in e.metadata.operation_result&&Array.isArray(e.metadata.operation_result.originated_contracts))return e.metadata.operation_result.originated_contracts.some((e=>e===t.destination));break;case"transaction":return e.destination===t.destination;default:return!1}})(e,t);t.evaluateExpression=(e,r)=>{if(Array.isArray(r.and))return r.and.every((r=>(0,t.evaluateFilter)(e,r)));if(Array.isArray(r.or))return r.or.some((r=>(0,t.evaluateFilter)(e,r)));throw new n.InvalidFilterExpressionError(r)};t.evaluateFilter=(e,r)=>{const n=[];return Array.isArray(r)?n.push(...r):n.push(r),n.every((r=>"and"in r||"or"in r?(0,t.evaluateExpression)(e,r):(0,t.evaluateOpFilter)(e,r)))}},440:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservableSubscription=t.UnsupportedEventError=void 0;const n=r(977),i=r(9002),o=r(3320);var s=r(3320);Object.defineProperty(t,"UnsupportedEventError",{enumerable:!0,get:function(){return s.UnsupportedEventError}});t.ObservableSubscription=class{constructor(e,t=!1,r=(0,i.retry)()){this.shouldRetry=t,this.operatorFunction=r,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new n.Subject,e.pipe((0,i.takeUntil)(this.completed$),(0,i.tap)((e=>{this.call(this.messageListeners,e)}),(e=>{this.call(this.errorListeners,e)}),(()=>{this.call(this.closeListeners)})),this.shouldRetry?r:(0,i.tap)(),(0,i.catchError)((()=>n.NEVER))).subscribe()}call(e,t){for(const r of e)try{r(t)}catch(e){console.error(e)}}remove(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}on(e,t){switch(e){case"data":this.messageListeners.push(t);break;case"error":this.errorListeners.push(t);break;case"close":this.closeListeners.push(t);break;default:throw new o.UnsupportedEventError(e)}}off(e,t){switch(e){case"data":this.remove(this.messageListeners,t);break;case"error":this.remove(this.errorListeners,t);break;case"close":this.remove(this.closeListeners,t);break;default:throw new o.UnsupportedEventError(e)}}close(){this.completed$.next()}}},5032:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PollingSubscribeProvider=t.defaultConfigStreamer=void 0;const i=r(977),o=r(9002),s=r(8176),a=r(4435),c=r(6391);t.defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:(0,o.retry)()};t.PollingSubscribeProvider=class{constructor(e,r={}){this.context=e,this._config$=new i.BehaviorSubject(Object.assign(Object.assign({},t.defaultConfigStreamer),r)),this.timer$=this._config$.pipe((0,o.pluck)("pollingIntervalMilliseconds"),(0,o.switchMap)((e=>e?(0,i.timer)(0,e):(0,i.from)(this.getConfirmationPollingInterval()).pipe((0,o.switchMap)((e=>(0,i.timer)(0,e))))))),this.newBlock$=this.timer$.pipe((0,o.switchMap)((()=>(e=>(0,i.from)(e.rpc.getBlock()).pipe((0,o.first)()))(this.context))),(0,o.distinctUntilKeyChanged)("hash"),(0,o.publish)(),(0,o.refCount)())}get config(){return this._config$.getValue()}getConfirmationPollingInterval(){return n(this,void 0,void 0,(function*(){if(!this.config.pollingIntervalMilliseconds){const e=5e3,t=1e3;try{const r=yield this.context.readProvider.getProtocolConstants("head"),n=(r.minimal_block_delay?r.minimal_block_delay.multipliedBy(1e3):r.time_between_blocks?r.time_between_blocks[0].multipliedBy(1e3):new c.default(e)).dividedBy(3);this.config.pollingIntervalMilliseconds=0===n.toNumber()?t:n.toNumber()}catch(t){return e}}return this.config.pollingIntervalMilliseconds}))}subscribeBlock(e){return new a.ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(e){return new a.ObservableSubscription(this.newBlock$.pipe((0,o.pluck)("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(e){return new a.ObservableSubscription(this.newBlock$.pipe((e=>(0,o.concatMap)((t=>new i.Observable((r=>{for(const n of t.operations)for(const t of n)for(const n of t.contents)(0,s.evaluateFilter)(Object.assign({hash:t.hash},n),e)&&r.next(Object.assign({hash:t.hash},n));r.complete()})))))(e)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(e){return new a.ObservableSubscription(this.newBlock$.pipe((t=e,(0,o.concatMap)((e=>new i.Observable((r=>{for(const n of e.operations)for(const i of n)for(const n of i.contents){const o=n.metadata.internal_operation_results;if(o)for(const n of o)(0,s.eventFilter)(n,null==t?void 0:t.address,null==t?void 0:t.tag,null==t?void 0:t.excludeFailedOperations)&&r.next(Object.assign({opHash:i.hash,blockHash:e.hash,level:e.header.level},n))}r.complete()})))))),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction);var t}}},2353:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.TezosToolkit=t.TaquitoLocalForger=t.RpcReadAdapter=t.ObservableSubscription=t.PollingSubscribeProvider=t.OperationBatch=t.RpcForger=t.CompositeForger=t.UnitValue=t.MichelsonMap=void 0;const o=r(6368),s=r(4984),a=r(4632),c=r(9494),u=r(6395),l=r(259),f=r(1067),d=r(5032),h=r(8023),p=r(635),b=r(6713),m=r(5286),g=r(5744);var v=r(8899);Object.defineProperty(t,"MichelsonMap",{enumerable:!0,get:function(){return v.MichelsonMap}}),Object.defineProperty(t,"UnitValue",{enumerable:!0,get:function(){return v.UnitValue}}),i(r(4593),t),i(r(4984),t),i(r(238),t),i(r(5225),t);var y=r(7336);Object.defineProperty(t,"CompositeForger",{enumerable:!0,get:function(){return y.CompositeForger}});var _=r(794);Object.defineProperty(t,"RpcForger",{enumerable:!0,get:function(){return _.RpcForger}}),i(r(3323),t);var w=r(150);Object.defineProperty(t,"OperationBatch",{enumerable:!0,get:function(){return w.OperationBatch}}),i(r(1527),t),i(r(440),t);var E=r(5032);Object.defineProperty(t,"PollingSubscribeProvider",{enumerable:!0,get:function(){return E.PollingSubscribeProvider}});var O=r(4435);Object.defineProperty(t,"ObservableSubscription",{enumerable:!0,get:function(){return O.ObservableSubscription}}),i(r(4946),t),i(r(635),t),i(r(134),t),i(r(5744),t),i(r(9813),t),i(r(5286),t),i(r(3259),t),i(r(4762),t),i(r(9406),t),i(r(6395),t),i(r(5505),t),i(r(3739),t),i(r(3171),t);var A=r(259);Object.defineProperty(t,"RpcReadAdapter",{enumerable:!0,get:function(){return A.RpcReadAdapter}}),i(r(8794),t);var S=r(6713);Object.defineProperty(t,"TaquitoLocalForger",{enumerable:!0,get:function(){return S.TaquitoLocalForger}}),i(r(3793),t);t.TezosToolkit=class{constructor(e){this._rpc=e,this._options={},this.format=a.format,"string"==typeof this._rpc?this._rpcClient=new o.RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new s.Context(e),this._wallet=new p.Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:e,stream:t,signer:r,protocol:n,config:i,forger:o,wallet:s,packer:a,globalConstantsProvider:c,readProvider:u,parserProvider:l,injectorProvider:f}){this.setRpcProvider(e),this.setStreamProvider(t),this.setSignerProvider(r),this.setForgerProvider(o),this.setWalletProvider(s),this.setPackerProvider(a),this.setGlobalConstantsProvider(c),this.setReadProvider(u),this.setParserProvider(l),this.setInjectorProvider(f),this._context.proto=n,i&&this._context.setPartialConfig(i)}setSignerProvider(e){this._options.signer||void 0!==e?void 0!==e&&(this._context.signer=e,this._options.signer=e):(this._context.signer=new f.NoopSigner,this._options.signer=e)}setRpcProvider(e){"string"==typeof e?this._rpcClient=new o.RpcClient(e):void 0===e||(this._rpcClient=e),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(e){if(void 0!==e)this._options.forger=e,this._context.forger=e;else if(void 0===this._options.forger){const e=this.getFactory(b.TaquitoLocalForger)();this._options.forger=e,this._context.forger=e}}setStreamProvider(e){if("string"==typeof e){const t=new d.PollingSubscribeProvider(new s.Context(new o.RpcClient(e)));this._options.stream=t,this._context.stream=t}else if(void 0!==e)this._options.stream=e,this._context.stream=e;else if(void 0===this._options.stream){const e=this.getFactory(d.PollingSubscribeProvider)();this._options.stream=e,this._context.stream=e}}setWalletProvider(e){if(this._options.wallet||void 0!==e)void 0!==e&&(this._options.wallet=e,this._context.walletProvider=e);else{const e=this.getFactory(p.LegacyWalletProvider)();this._options.wallet=e,this._context.walletProvider=e}}setPackerProvider(e){if(this._options.packer||void 0!==e)void 0!==e&&(this._context.packer=e,this._options.packer=e);else{const e=this.getFactory(u.RpcPacker)();this._context.packer=e,this._options.packer=e}}setGlobalConstantsProvider(e){if(this._options.globalConstantsProvider||void 0!==e)void 0!==e&&(this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e);else{const e=new c.NoopGlobalConstantsProvider;this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e}}setReadProvider(e){const t=e||new l.RpcReadAdapter(this._context.rpc);this._options.readProvider=t,this._context.readProvider=t}setParserProvider(e){if(this._options.parserProvider||void 0!==e)void 0!==e&&(this._context.parser=e,this._options.parserProvider=e);else{const e=new m.MichelCodecParser(this._context);this._context.parser=e,this._options.parserProvider=e}}setInjectorProvider(e){if(this._options.injectorProvider||void 0!==e)void 0!==e&&(this._context.injector=e,this._options.injectorProvider=e);else{const e=new g.RpcInjector(this._context);this._context.injector=e,this._options.injectorProvider=e}}get tz(){return this._context.tz}get contract(){return this._context.contract}get prepare(){return this._context.prepare}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}get globalConstants(){return this._context.globalConstantsProvider}addExtension(e){Array.isArray(e)?e.forEach((e=>e.configureContext(this._context))):e.configureContext(this._context)}getFactory(e){return(...t)=>new e(this._context,...t)}getVersionInfo(){return h.VERSION}}},4946:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},992:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcTzProvider=void 0;const i=r(7525),o=r(4632),s=r(227),a=r(6003),c=r(3793);class u extends a.Provider{constructor(e){super(e),this.prepare=new c.PrepareProvider(this.context)}getBalance(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t));return this.context.readProvider.getBalance(e,"head")}))}getDelegate(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t));return this.context.readProvider.getDelegate(e,"head")}))}activate(e,t){return n(this,void 0,void 0,(function*(){const r=(0,o.validateKeyHash)(e);if(r!==o.ValidationResult.VALID)throw new o.InvalidKeyHashError(e,(0,o.invalidDetail)(r));const n=yield this.prepare.activate({pkh:e,secret:t}),s=yield this.forge(n),a=`${s.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new i.Operation(yield this.rpc.injectOperation(a),Object.assign(Object.assign({},s),{opbytes:a}),[],this.context.clone())}))}}t.RpcTzProvider=u},8023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,t.VERSION={commitHash:"fc66aa741c240cb367082d1294ef915654c341a6",version:"19.0.1"}},1626:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BatchWalletOperation=void 0;const i=r(6368),o=r(150),s=r(807),a=r(2809),c=r(2323);class u extends a.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t,this.getOriginatedContractAddresses=()=>n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e){const t=e.filter((e=>"origination"===e.kind));let r=[];for(const e of t)e.metadata.operation_result.originated_contracts&&(r=[...r,...e.metadata.operation_result.originated_contracts]);return r}throw new c.ObservableError("Unable to fetch operation results")}))}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.REVEAL));throw new c.ObservableError("Unable to fetch operation results")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.operationResults();if(e)return e.filter((e=>-1!==o.BATCH_KINDS.indexOf(e.kind))).map((e=>{if((0,s.hasMetadataWithResult)(e)){return e.metadata.operation_result.status}return"unknown"}))[0]||"unknown";throw new c.ObservableError("Unable to fetch operation results")}))}}t.BatchWalletOperation=u},4364:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationWalletOperation=void 0;const i=r(6368),o=r(2809),s=r(2323);class a extends o.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.REVEAL));throw new s.ObservableError("Unable to fetch operation result")}))}delegationOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.DELEGATION));throw new s.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.delegationOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.DelegationWalletOperation=a},2323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservableError=t.ConfirmationUndefinedError=void 0;const n=r(227);class i extends n.TezosToolkitConfigError{constructor(){super(),this.name="ConfirmationUndefinedError",this.message="Default confirmation count can not be undefined"}}t.ConfirmationUndefinedError=i;class o extends n.NetworkError{constructor(e){super(),this.message=e,this.name="ObservableError"}}t.ObservableError=o},7832:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.IncreasePaidStorageWalletOperation=void 0;const i=r(2809),o=r(6368),s=r(2323);class a extends i.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===o.OpKind.REVEAL));throw new s.ObservableError("Unable to fetch operation result")}))}increasePaidStorageOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===o.OpKind.INCREASE_PAID_STORAGE));throw new s.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.increasePaidStorageOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.IncreasePaidStorageWalletOperation=a},635:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5277),t),i(r(2809),t),i(r(4685),t),i(r(7654),t),i(r(4364),t),i(r(7432),t),i(r(8562),t)},7432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8562:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyWalletProvider=void 0;const i=r(807);t.LegacyWalletProvider=class{constructor(e){this.context=e}getPKH(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKeyHash()}))}getPK(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKey()}))}mapTransferParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.TRANSACTION)}))}mapOriginateParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.ORIGINATION)}))}mapDelegateParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.DELEGATION)}))}mapIncreasePaidStorageWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.INCREASE_PAID_STORAGE)}))}sendOperations(e){return n(this,void 0,void 0,(function*(){return(yield this.context.batch.batch(e).send()).hash}))}sign(e,t){return n(this,void 0,void 0,(function*(){const{prefixSig:r}=yield this.context.signer.sign(e,t);return r}))}}},8286:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OperationFactory=t.createNewPollingBasedHeadObservable=t.timeoutAfter=void 0;const i=r(977),o=r(9002),s=r(552),a=r(1626),c=r(4364),u=r(7832),l=r(2809),f=r(7654),d=r(4685),h=r(7642);function p(e){return function(t){return new i.BehaviorSubject(null).pipe((0,o.timeout)({each:e,with:()=>(0,i.throwError)((()=>new h.ConfirmationTimeoutError("Confirmation polling timed out")))}),(0,o.mergeMap)((()=>t)))}}t.timeoutAfter=p;t.createNewPollingBasedHeadObservable=(e,t,r)=>e.pipe(p(1e3*t.config.confirmationPollingTimeoutSecond),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1}));t.OperationFactory=class{constructor(e){this.context=e,this.sharedHeadObs=(0,i.defer)((()=>(0,s.createObservableFromSubscription)(this.context.stream.subscribeBlock("head"))))}createNewHeadObservable(){return n(this,void 0,void 0,(function*(){return(0,t.createNewPollingBasedHeadObservable)(this.sharedHeadObs,this.context)}))}createPastBlockWalker(e,t=1){return(0,i.from)(this.context.readProvider.getBlock(e)).pipe((0,o.switchMap)((e=>1===t?(0,i.of)(e):(0,i.range)(e.header.level,t-1).pipe((0,o.startWith)(e),(0,o.concatMap)((e=>n(this,void 0,void 0,(function*(){return this.context.readProvider.getBlock("number"==typeof e?e:e.header.level)}))))))))}createHeadObservableFromConfig({blockIdentifier:e}){return n(this,void 0,void 0,(function*(){const t=[];return e&&t.push(this.createPastBlockWalker(e)),t.push(yield this.createNewHeadObservable()),(0,i.concat)(...t)}))}createOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new l.WalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createBatchOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new a.BatchWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createTransactionOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new d.TransactionWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createDelegationOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new c.DelegationWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createOriginationOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new f.OriginationWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createIncreasePaidStorageOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new u.IncreasePaidStorageWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}}},2809:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.WalletOperation=void 0;const i=r(977),o=r(9002),s=r(6298),a=r(4632),c=r(7642),u=r(2323),l=r(227);t.WalletOperation=class{operationResults(){return n(this,void 0,void 0,(function*(){return this._operationResult.pipe((0,o.first)()).toPromise()}))}receipt(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new u.ObservableError("Unable to get operation results");return(0,s.receiptFromOperation)(e)}))}constructor(e,t,r){if(this.opHash=e,this.context=t,this._newHead$=r,this._operationResult=new i.ReplaySubject(1),this._includedInBlock=new i.ReplaySubject(1),this._included=!1,this.newHead$=this._newHead$.pipe((0,o.switchMap)((e=>{var t,r;const n=null!==(r=null===(t=this.lastHead)||void 0===t?void 0:t.header.level)&&void 0!==r?r:e.header.level-1;return(0,i.range)(n+1,e.header.level-n-1).pipe((0,o.concatMap)((e=>this.context.readProvider.getBlock(e))),(0,o.endWith)(e))})),(0,o.tap)((e=>this.lastHead=e)),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),this.confirmed$=this.newHead$.pipe((0,o.map)((e=>{for(const t of e.operations)for(const r of t)if(r.hash===this.opHash)return this._included=!0,this._includedInBlock.next(e),this._operationResult.next(r.contents),e})),(0,o.filter)((e=>void 0!==e)),(0,o.first)(),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),(0,a.validateOperation)(this.opHash)!==a.ValidationResult.VALID)throw new l.InvalidOperationHashError(this.opHash);this.confirmed$.pipe((0,o.first)(),(0,o.catchError)((()=>(0,i.of)(void 0)))).subscribe()}getCurrentConfirmation(){return n(this,void 0,void 0,(function*(){return this._included?(0,i.combineLatest)([this._includedInBlock,(0,i.from)(this.context.readProvider.getBlock("head"))]).pipe((0,o.map)((([e,t])=>t.header.level-e.header.level+1)),(0,o.first)()).toPromise():0}))}isInCurrentBranch(e="head"){return n(this,void 0,void 0,(function*(){if(!this._included)return!0;const t=yield this.context.readProvider.getBlockLevel(e),r=yield this._includedInBlock.pipe((0,o.first)()).toPromise();if(!r)throw new u.ObservableError("Inclusion block is undefined");const n=t-r.header.level;if(n<=0)return!0;const i=Math.min(r.header.level+n,r.header.level+60);return new Set(yield this.context.readProvider.getLiveBlocks(i)).has(r.hash)}))}confirmationObservable(e){if(void 0!==e&&e<1)throw new c.InvalidConfirmationCountError(e);const{defaultConfirmationCount:t}=this.context.config,r=void 0!==e?e:t;if(void 0===r)throw new u.ConfirmationUndefinedError;return(0,i.combineLatest)([this._includedInBlock,this.newHead$]).pipe((0,o.distinctUntilChanged)((([,e],[,t])=>e.hash===t.hash)),(0,o.map)((([e,t])=>({block:t,expectedConfirmation:r,currentConfirmation:t.header.level-e.header.level+1,completed:t.header.level-e.header.level>=r-1,isInCurrentBranch:()=>this.isInCurrentBranch(t.hash)}))),(0,o.takeWhile)((({completed:e})=>!e),!0))}confirmation(e){return this.confirmationObservable(e).toPromise()}}},7654:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OriginationWalletOperation=void 0;const i=r(6368),o=r(807),s=r(2809),a=r(2323);class c extends s.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}originationOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return(0,o.findWithKind)(e,i.OpKind.ORIGINATION);throw new a.ObservableError("Unable to fetch operation result")}))}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return(0,o.findWithKind)(e,i.OpKind.REVEAL);throw new a.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.originationOperation();return e?e.metadata.operation_result.status:"unknown"}))}contract(){return n(this,void 0,void 0,(function*(){const e=yield this.originationOperation(),t=((null==e?void 0:e.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at(t)}))}}t.OriginationWalletOperation=c},6298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.receiptFromOperation=void 0;const n=r(6391),i=r(4593),o=r(835);t.receiptFromOperation=(e,{ALLOCATION_BURN:t,ORIGINATION_BURN:r}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP});const s=(0,o.flattenOperationResult)({contents:e});let a=new n.default(0),c=new n.default(0),u=new n.default(0),l=new n.default(0),f=new n.default(0),d=new n.default(0);return s.forEach((e=>{u=u.plus(e.fee||0),l=l.plus(Array.isArray(e.originated_contracts)?e.originated_contracts.length*r:0),f=f.plus("allocated_destination_contract"in e?t:0),a=a.plus(e.consumed_milligas||0),d=d.plus("paid_storage_size_diff"in e&&Number(e.paid_storage_size_diff)||0)})),c=c.plus(f).plus(l).plus(d),{totalFee:u,totalMilliGas:a,totalGas:a.dividedBy(1e3),totalStorage:c,totalAllocationBurn:f,totalOriginationBurn:l,totalPaidStorageDiff:d,totalStorageBurn:new n.default(c.multipliedBy(i.COST_PER_BYTE))}}},4685:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionWalletOperation=void 0;const i=r(2809),o=r(6368),s=r(2323);class a extends i.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new s.ObservableError("operationResult returned undefined");return e.find((e=>e.kind===o.OpKind.REVEAL))}))}transactionOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new s.ObservableError("operationResult returned undefined");return e.find((e=>e.kind===o.OpKind.TRANSACTION))}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.transactionOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.TransactionWalletOperation=a},5277:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Wallet=t.WalletOperationBatch=void 0;const i=r(238),o=r(807),s=r(227),a=r(4632);class c{constructor(e,t){this.walletProvider=e,this.context=t,this.operations=[]}withTransfer(e){const t=(0,a.validateAddress)(e.to);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:o.OpKind.TRANSACTION},e)),this}withContractCall(e,t={}){return this.withTransfer(e.toTransferParams(t))}withDelegation(e){var t;const r=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&r!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.delegate,(0,a.invalidDetail)(r));return this.operations.push(Object.assign({kind:o.OpKind.DELEGATION},e)),this}withOrigination(e){return this.operations.push(Object.assign({kind:o.OpKind.ORIGINATION},e)),this}withIncreasePaidStorage(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:o.OpKind.INCREASE_PAID_STORAGE},e)),this}mapOperation(e){return n(this,void 0,void 0,(function*(){switch(e.kind){case o.OpKind.TRANSACTION:return this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));case o.OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},e))}))));case o.OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));case o.OpKind.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));default:throw new s.InvalidOperationKindError(JSON.stringify(e.kind))}}))}with(e){for(const t of e)switch(t.kind){case o.OpKind.TRANSACTION:this.withTransfer(t);break;case o.OpKind.ORIGINATION:this.withOrigination(t);break;case o.OpKind.DELEGATION:this.withDelegation(t);break;case o.OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(t);break;default:throw new s.InvalidOperationKindError(JSON.stringify(t.kind))}return this}send(){return n(this,void 0,void 0,(function*(){const e=[];for(const t of this.operations)e.push(yield this.mapOperation(t));const t=yield this.walletProvider.sendOperations(e);return this.context.operationFactory.createBatchOperation(t)}))}}t.WalletOperationBatch=c;t.Wallet=class{constructor(e){this.context=e,this.walletCommand=e=>({send:e})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:e}={}){return n(this,void 0,void 0,(function*(){return this._pkh&&!e||(this._pkh=yield this.walletProvider.getPKH()),this._pkh}))}pk({forceRefetch:e}={}){return n(this,void 0,void 0,(function*(){return this._pk&&!e||(this._pk=yield this.walletProvider.getPK()),this._pk}))}originate(e){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapOriginateParamsToWalletParams((()=>this.context.parser.prepareCodeOrigination(Object.assign({},e)))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createOriginationOperation(r)}))))}setDelegate(e){var t;const r=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&r!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.delegate,(0,a.invalidDetail)(r));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createDelegationOperation(r)}))))}signFailingNoop(e){return n(this,void 0,void 0,(function*(){const t={kind:o.OpKind.FAILING_NOOP,arbitrary:e.arbitrary},r=yield this.context.readProvider.getBlockHash(e.basedOnBlock),n=yield this.context.forger.forge({branch:r,contents:[t]});return{signature:yield this.walletProvider.sign(n,Uint8Array.from([3])),bytes:n,signedContent:{branch:r,contents:[{kind:o.OpKind.FAILING_NOOP,arbitrary:e.arbitrary}]}}}))}registerDelegate(){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const e=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return{delegate:yield this.pkh()}})))),t=yield this.walletProvider.sendOperations([e]);return this.context.operationFactory.createDelegationOperation(t)}))))}transfer(e){const t=(0,a.validateAddress)(e.to);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createTransactionOperation(r)}))))}increasePaidStorage(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapIncreasePaidStorageWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createIncreasePaidStorageOperation(r)}))))}batch(e){const t=new c(this.walletProvider,this.context);return Array.isArray(e)&&t.with(e),t}at(e,t=(e=>e)){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=this.context.withExtensions().rpc,o=this.context.withExtensions().readProvider,c=yield o.getScript(e,"head"),u=yield o.getEntrypoints(e),l=new i.ContractAbstraction(e,c,this,this.context.contract,u,n,o);return t(l,this.context)}))}getPK(){return n(this,void 0,void 0,(function*(){return yield this.pk()}))}}},5477:()=>{},3196:()=>{},8087:()=>{},2558:(e,t,r)=>{"use strict";r.d(t,{O:()=>w,Z:()=>E});var n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function b(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function g(e,t,r,n){if(er||e!==o(e))throw Error(s+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function v(e){var t=e.c.length-1;return p(e.e/u)==t&&e.c[t]%2!=0}function y(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?b.c=b.e=null:e.e=10;f/=10,c++);return void(c>D?b.c=b.e=null:(b.e=c,b.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return E(b,p,d);b.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(c<0&&(c=f),c+=+p.slice(f+1),p=p.substring(0,f)):c<0&&(c=p.length)}else{if(g(t,2,H.length,"Base"),10==t&&G)return W(b=new $(e),k+b.e+1,L);if(p=String(e),d="number"==typeof e){if(0*e!=0)return E(b,p,d,t);if(b.s=1/e<0?(p=p.slice(1),-1):1,$.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else b.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=H.slice(0,t),c=f=0,h=p.length;fc){c=h;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,f=-1,c=0;continue}return E(b,String(e),d,t)}d=!1,(c=(p=w(p,t,10,b.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(f=0;48===p.charCodeAt(f);f++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(f,++h)){if(h-=f,d&&$.DEBUG&&h>15&&(e>l||e!==o(e)))throw Error(a+b.s*e);if((c=c-f-1)>D)b.c=b.e=null;else if(c=C)?y(c,s):_(c,s,"0");else if(o=(e=W(new $(e),t,r)).e,a=(c=b(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function z(e,t){for(var r,n,i=1,o=new $(e[0]);i=10;i/=10,n++);return(r=n+r*u-1)>D?e.c=e.e=null:r=10;d/=10,s++);if((a=t-s)<0)a+=u,l=t,h=m[p=0],b=o(h/g[s-l-1]%10);else if((p=i((a+1)/u))>=m.length){if(!n)break e;for(;m.length<=p;m.push(0));h=b=0,s=1,l=(a%=u)-u+1}else{for(h=d=m[p],s=1;d>=10;d/=10,s++);b=(l=(a%=u)-u+s)<0?0:o(h/g[s-l-1]%10)}if(n=n||t<0||null!=m[p+1]||(l<0?h:h%g[s-l-1]),n=r<4?(b||n)&&(0==r||r==(e.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(a>0?l>0?h/g[s-l]:0:m[p-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(u-t%u)%u],e.e=-t||0):m[0]=e.e=0,e;if(0==a?(m.length=p,d=1,p--):(m.length=p+1,d=g[u-a],m[p]=l>0?o(h/g[s-l]%g[l])*d:0),n)for(;;){if(0==p){for(a=1,l=m[0];l>=10;l/=10,a++);for(l=m[0]+=d,d=1;l>=10;l/=10,d++);a!=d&&(e.e++,m[0]==c&&(m[0]=1));break}if(m[p]+=d,m[p]!=c)break;m[p--]=0,d=1}for(a=m.length;0===m[--a];m.pop());}e.e>D?e.c=e.e=null:e.e=C?y(t,r):_(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(g(r=e[t],0,h,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(g(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(g(r[0],-h,0,t),g(r[1],0,h,t),N=r[0],C=r[1]):(g(r,-h,h,t),N=-(C=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)g(r[0],-h,-1,t),g(r[1],1,h,t),j=r[0],D=r[1];else{if(g(r,-h,h,t),!r)throw Error(s+t+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(s+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(g(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(g(r=e[t],0,h,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);G="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,C],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:K,ALPHABET:H}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-h&&i<=h&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t=c||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return z(arguments,-1)},$.minimum=$.min=function(){return z(arguments,1)},$.random=(O=9007199254740992,A=Math.random()*O&2097151?function(){return o(Math.random()*O)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,a,c,l=0,d=[],p=new $(M);if(null==e?e=k:g(e,0,h),a=i(e/u),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(a*=2));l>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(d.push(c%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw U=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(a*=7);l=9e15?crypto.randomBytes(7).copy(t,l):(d.push(c%1e14),l+=7);l=a/7}if(!U)for(;l=10;c/=10,l++);lr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,f,d,h,p,m,g=n.indexOf("."),v=k,y=L;for(g>=0&&(f=F,F=0,n=n.replace(".",""),h=(m=new $(i)).pow(n.length-g),F=f,m.c=t(_(b(h.c),h.e,"0"),10,o,e),m.e=m.c.length),l=f=(p=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(g<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=r(h,m,v,y,o)).c,d=h.r,l=h.e),g=p[u=l+v+1],f=o/2,d=d||u<0||null!=p[u+1],d=y<4?(null!=g||d)&&(0==y||y==(h.s<0?3:2)):g>f||g==f&&(4==y||d||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])n=d?_(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(f=p.length;!p[--f];);for(g=0,n="";g<=f;n+=c.charAt(p[g++]));n=_(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%d,l=t/d|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%d)+(n=l*o+(s=e[c]/d|0)*u)%d*d+a)/r|0)+(n/d|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,s,a,l){var f,d,h,b,m,g,v,y,_,w,E,O,A,S,P,T,I,R=n.s==i.s?1:-1,x=n.c,M=i.c;if(!(x&&x[0]&&M&&M[0]))return new $(n.s&&i.s&&(x?!M||x[0]!=M[0]:M)?x&&0==x[0]||!M?0*R:R/0:NaN);for(_=(y=new $(R)).c=[],R=s+(d=n.e-i.e)+1,l||(l=c,d=p(n.e/u)-p(i.e/u),R=R/u|0),h=0;M[h]==(x[h]||0);h++);if(M[h]>(x[h]||0)&&d--,R<0)_.push(1),b=!0;else{for(S=x.length,T=M.length,h=0,R+=2,(m=o(l/(M[0]+1)))>1&&(M=e(M,m,l),x=e(x,m,l),T=M.length,S=x.length),A=T,E=(w=x.slice(0,T)).length;E=l/2&&P++;do{if(m=0,(f=t(M,w,T,E))<0){if(O=w[0],T!=E&&(O=O*l+(w[1]||0)),(m=o(O/P))>1)for(m>=l&&(m=l-1),v=(g=e(M,m,l)).length,E=w.length;1==t(g,w,v,E);)m--,r(g,T=10;R/=10,h++);W(y,s+(y.e=h+d*u-1)+1,a,b)}else y.e=d,y.r=+b;return y}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(P,"$1").replace(T,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return m(this,new $(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return g(e,0,h),null==t?t=L:g(t,0,8),W(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-p(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new $(e,t),k,L)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new $(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,a,c,l,f,d,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+Z(e));if(null!=t&&(t=new $(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Z(p),l?e.s*(2-v(e)):+Z(e))),t?h.mod(t):h;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&v(e)?-0:0,p.e>-1&&(c=1/c),new $(f?1/c:c);F&&(c=i(F/u+2))}for(l?(r=new $(.5),f&&(e.s=1),d=v(e)):d=(a=Math.abs(+Z(e)))%2,h=new $(M);;){if(d){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(a){if(0===(a=o(a/2)))break;d=a%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)d=v(e);else{if(0===(a=+Z(e)))break;d=a%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):n&&(p=p.mod(t))}return n?h:(f&&(h=M.div(h)),t?h.mod(t):c?W(h,F,L,undefined):h)},x.integerValue=function(e){var t=new $(this);return null==e?e=L:g(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===m(this,new $(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return m(this,new $(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=m(this,new $(e,t)))||0===t},x.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return m(this,new $(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=m(this,new $(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/u,f=e.e/u,d=s.c,h=e.c;if(!l||!f){if(!d||!h)return d?(e.s=-t,e):new $(h?s:NaN);if(!d[0]||!h[0])return h[0]?(e.s=-t,e):new $(d[0]?s:3==L?-0:0)}if(l=p(l),f=p(f),d=d.slice(),a=l-f){for((o=a<0)?(a=-a,i=d):(f=l,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=d.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;d[r++]=0);for(t=c-1;n>a;){if(d[--n]=0;){for(r=0,m=O[i]%_,g=O[i]/_|0,o=i+(s=l);o>i;)r=((f=m*(f=E[--s]%_)+(a=g*f+(h=E[s]/_|0)*m)%_*_+v[o]+r)/y|0)+(a/_|0)+g*h,v[o--]=f%y;v[o]=r}return r?++n:v.splice(0,1),q(e,v,n)},x.negated=function(){var e=new $(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/u,s=e.e/u,a=n.c,l=e.c;if(!o||!s){if(!a||!l)return new $(i/0);if(!a[0]||!l[0])return l[0]?e:new $(a[0]?n:0*i)}if(o=p(o),s=p(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=l):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=l.length)<0&&(r=l,l=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/c|0,a[t]=c===a[t]?0:a[t]%c;return i&&(a=[i].concat(a),++s),q(e,a,s)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return g(e,1,h),null==t?t=L:g(t,0,8),W(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return g(e,-9007199254740991,l),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=k+4,f=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Z(s)))||c==1/0?(((t=b(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),n=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(s,o,l,1))),b(o.c).slice(0,c)===(t=b(n.c)).slice(0,c)){if(n.e0&&b>0){for(o=b%c||c,f=p.substr(0,o);o0&&(f+=l+p.slice(o)),h&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,a,c,l,d,h,p,m,g,v=this,y=v.c;if(null!=e&&(!(l=new $(e)).isInteger()&&(l.c||1!==l.s)||l.lt(M)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Z(l));if(!y)return new $(v);for(t=new $(M),h=n=new $(M),i=d=new $(M),g=b(y),a=t.e=g.length-v.e-1,t.c[0]=f[(c=a%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?a>0?t:h:l,c=D,D=1/0,l=new $(g),d.c[0]=0;p=r(l,t,0,1),1!=(o=n.plus(p.times(i))).comparedTo(e);)n=i,i=o,h=d.plus(p.times(o=h)),d=o,t=l.minus(p.times(o=t)),l=o;return o=r(e.minus(n),i,0,1),d=d.plus(o.times(h)),n=n.plus(o.times(i)),d.s=h.s=v.s,m=r(h,i,a*=2,L).minus(v).abs().comparedTo(r(d,n,a,L).minus(v).abs())<1?[h,i]:[d,n],D=c,m},x.toNumber=function(){return+Z(this)},x.toPrecision=function(e,t){return null!=e&&g(e,1,h),V(this,e,t,2)},x.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=N||i>=C?y(b(r.c),i):_(b(r.c),i,"0"):10===e&&G?t=_(b((r=W(new $(r),k+i+1,L)).c),r.e,"0"):(g(e,2,H.length,"Base"),t=w(_(b(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf,null!=t&&$.set(t),$}();const E=w},763:e=>{"use strict";e.exports={i8:"6.5.4"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r(2353)})())); +-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.taquito=t():e.taquito=t()}(self,(()=>(()=>{var e={3525:(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function i(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){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 a(e,t){i(e);const r=t.outputLen;if(e.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r(3525),i=r(64);class o extends i.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:r,blockLen:o}=this,s=(e=(0,i.toBytes)(e)).length;for(let n=0;no-a&&(this.process(r,0),a=0);for(let e=a;e>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const c=(0,i.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},6053:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r(9350),i=r(64),o=(e,t,r)=>e&t^e&r^t&r,s=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;c[e]=o+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:u,E:l,F:f,G:d,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,i.rotr)(l,6)^(0,i.rotr)(l,11)^(0,i.rotr)(l,25))+((p=l)&f^~p&d)+s[e]+c[e]|0,b=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+o(r,n,a)|0;h=d,d=f,f=l,l=u+t|0,u=a,a=n,n=r,r=t+b|0}var p;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,f=f+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,n,a,u,l,f,d,h)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends u{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}}t.sha256=(0,i.wrapConstructor)((()=>new u)),t.sha224=(0,i.wrapConstructor)((()=>new l))},64:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r(825);t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){if(!i(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=s._0&&e<=s._9?e-s._0:e>=s._A&&e<=s._F?e-(s._A-10):e>=s._a&&e<=s._f?e-(s._a-10):void 0}t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t{},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let o=0;o=0&&ee().update(u(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(u(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(u(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},9437:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5457);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e/4294967296>>>0,t,r),l(e>>>0,t,r+4),t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),f(e>>>0,t,r),f(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=f,t.writeInt32LE=f,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=h,t.writeInt64LE=h,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";var n=r(9437),i=r(2887);t.cn=128,t.k=64,t.Cv=64,t.fg=16,t.fe=16,t.zS=Math.pow(2,32)-1,t.d=255,t.lV=255;var o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),s=[[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6],[22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8],[14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16],[18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26],[4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18],[24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22],[26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20],[12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10],[20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0],[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6]],a=function(){function e(e,r){if(void 0===e&&(e=64),this.digestLength=e,this.blockSize=t.cn,this._state=new Int32Array(o),this._buffer=new Uint8Array(t.cn),this._bufferLength=0,this._ctr=new Uint32Array(4),this._flag=new Uint32Array(4),this._lastNode=!1,this._finished=!1,this._vtmp=new Uint32Array(32),this._mtmp=new Uint32Array(32),e<1||e>t.k)throw new Error("blake2b: wrong digest length");r&&this.validateConfig(r);var i=0;r&&r.key&&(i=r.key.length);var s=1,a=1;r&&r.tree&&(s=r.tree.fanout,a=r.tree.maxDepth),this._state[0]^=e|i<<8|s<<16|a<<24,r&&r.tree&&(this._state[1]^=r.tree.leafSize,this._state[2]^=r.tree.nodeOffsetLowBits,this._state[3]^=r.tree.nodeOffsetHighBits,this._state[4]^=r.tree.nodeDepth|r.tree.innerDigestLength<<8,this._lastNode=r.tree.lastNode),r&&r.salt&&(this._state[8]^=n.readUint32LE(r.salt,0),this._state[9]^=n.readUint32LE(r.salt,4),this._state[10]^=n.readUint32LE(r.salt,8),this._state[11]^=n.readUint32LE(r.salt,12)),r&&r.personalization&&(this._state[12]^=n.readUint32LE(r.personalization,0),this._state[13]^=n.readUint32LE(r.personalization,4),this._state[14]^=n.readUint32LE(r.personalization,8),this._state[15]^=n.readUint32LE(r.personalization,12)),this._initialState=new Uint32Array(this._state),r&&r.key&&i>0&&(this._paddedKey=new Uint8Array(t.cn),this._paddedKey.set(r.key),this._buffer.set(this._paddedKey),this._bufferLength=t.cn)}return e.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=t.cn):this._bufferLength=0,i.wipe(this._ctr),i.wipe(this._flag),this._finished=!1,this},e.prototype.validateConfig=function(e){if(e.key&&e.key.length>t.Cv)throw new Error("blake2b: wrong key length");if(e.salt&&e.salt.length!==t.fe)throw new Error("blake2b: wrong salt length");if(e.personalization&&e.personalization.length!==t.fg)throw new Error("blake2b: wrong personalization length");if(e.tree){if(e.tree.fanout<0||e.tree.fanout>t.d)throw new Error("blake2b: wrong tree fanout");if(e.tree.maxDepth<0||e.tree.maxDepth>t.lV)throw new Error("blake2b: wrong tree depth");if(e.tree.leafSize<0||e.tree.leafSize>t.zS)throw new Error("blake2b: wrong leaf size");if(e.tree.innerDigestLength<0||e.tree.innerDigestLength>t.k)throw new Error("blake2b: wrong tree inner digest length")}},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var n=t.cn-this._bufferLength,i=0;if(0===r)return this;if(r>n){for(var o=0;ot.cn;){for(o=0;o>>16,O=65535&p,A=p>>>16;E+=b>>>16,O+=65535&m,A+=m>>>16,O+=(E+=(w+=65535&b)>>>16)>>>16,w=65535&(h=65535&w|E<<16),E=h>>>16,O=65535&(p=65535&O|(A+=O>>>16)<<16),A=p>>>16,E+=u>>>16,O+=65535&l,A+=l>>>16,h=65535&(w+=65535&u)|(E+=w>>>16)<<16,w=_^=p=65535&(O+=E>>>16)|(A+=O>>>16)<<16,_=y^=h,y=w,w=65535&g,E=g>>>16,O=65535&v,A=v>>>16,E+=y>>>16,O+=65535&_,A+=_>>>16,w=(b^=g=65535&(w+=65535&y)|(E+=w>>>16)<<16)<<8|(m^=v=65535&(O+=E>>>16)|(A+=O>>>16)<<16)>>>24,b=m<<8|b>>>24,m=w,w=65535&h,E=h>>>16,O=65535&p,A=p>>>16,E+=b>>>16,O+=65535&m,A+=m>>>16,O+=(E+=(w+=65535&b)>>>16)>>>16,w=65535&(h=65535&w|E<<16),E=h>>>16,O=65535&(p=65535&O|(A+=O>>>16)<<16),A=p>>>16,E+=f>>>16,O+=65535&d,A+=d>>>16,w=(y^=h=65535&(w+=65535&f)|(E+=w>>>16)<<16)<<16|(_^=p=65535&(O+=E>>>16)|(A+=O>>>16)<<16)>>>16,y=_<<16|y>>>16,_=w,w=65535&g,E=g>>>16,O=65535&v,A=v>>>16,E+=y>>>16,O+=65535&_,A+=_>>>16,w=(m^=v=65535&(O+=(E+=(w+=65535&y)>>>16)>>>16)|(A+=O>>>16)<<16)<<1|(b^=g=65535&w|E<<16)>>>31,b=b<<1|m>>>31,m=w,e[t]=h,e[o]=p,e[r]=b,e[s]=m,e[n]=g,e[a]=v,e[i]=y,e[c]=_},e.prototype._incrementCounter=function(e){for(var t=0;t<3;t++){var r=this._ctr[t]+e;if(this._ctr[t]=r>>>0,this._ctr[t]===r)return;e=1}},e.prototype._processBlock=function(e){this._incrementCounter(e);var t=this._vtmp;t.set(this._state),t.set(o,16),t[24]^=this._ctr[0],t[25]^=this._ctr[1],t[26]^=this._ctr[2],t[27]^=this._ctr[3],t[28]^=this._flag[0],t[29]^=this._flag[1],t[30]^=this._flag[2],t[31]^=this._flag[3];for(var r=this._mtmp,i=0;i<32;i++)r[i]=n.readUint32LE(this._buffer,4*i);for(var a=0;a<12;a++)this._G(t,0,8,16,24,1,9,17,25,r[s[a][0]],r[s[a][0]+1],r[s[a][1]],r[s[a][1]+1]),this._G(t,2,10,18,26,3,11,19,27,r[s[a][2]],r[s[a][2]+1],r[s[a][3]],r[s[a][3]+1]),this._G(t,4,12,20,28,5,13,21,29,r[s[a][4]],r[s[a][4]+1],r[s[a][5]],r[s[a][5]+1]),this._G(t,6,14,22,30,7,15,23,31,r[s[a][6]],r[s[a][6]+1],r[s[a][7]],r[s[a][7]+1]),this._G(t,0,10,20,30,1,11,21,31,r[s[a][8]],r[s[a][8]+1],r[s[a][9]],r[s[a][9]+1]),this._G(t,2,12,22,24,3,13,23,25,r[s[a][10]],r[s[a][10]+1],r[s[a][11]],r[s[a][11]+1]),this._G(t,4,14,16,26,5,15,17,27,r[s[a][12]],r[s[a][12]+1],r[s[a][13]],r[s[a][13]+1]),this._G(t,6,8,18,28,7,9,19,29,r[s[a][14]],r[s[a][14]+1],r[s[a][15]],r[s[a][15]+1]);for(i=0;i<16;i++)this._state[i]^=t[i]^t[i+16]},e}();t.vp=function(e,r,n){void 0===r&&(r=t.k);var i=new a(r,n);i.update(e);var o=i.digest();return i.clean(),o}},7728:(e,t,r)=>{"use strict";t.T=t.aP=t.KS=t.jQ=void 0;const n=r(1293),i=r(6756),o=r(2887);function s(e){const t=new Float64Array(16);if(e)for(let r=0;r>16&1),r[e-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,m(n,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&n[t],e[2*t+1]=n[t]>>8}function v(e,t){let r=0;for(let n=0;n<32;n++)r|=e[n]^t[n];return(1&r-1>>>8)-1}function y(e,t){const r=new Uint8Array(32),n=new Uint8Array(32);return g(r,e),g(n,t),v(r,n)}function _(e){const t=new Uint8Array(32);return g(t,e),1&t[0]}function w(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function E(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function O(e,t,r){let n,i,o=0,s=0,a=0,c=0,u=0,l=0,f=0,d=0,h=0,p=0,b=0,m=0,g=0,v=0,y=0,_=0,w=0,E=0,O=0,A=0,S=0,P=0,T=0,I=0,R=0,x=0,M=0,k=0,L=0,N=0,C=0,j=r[0],D=r[1],U=r[2],B=r[3],F=r[4],K=r[5],H=r[6],G=r[7],$=r[8],V=r[9],z=r[10],q=r[11],W=r[12],Z=r[13],J=r[14],Y=r[15];n=t[0],o+=n*j,s+=n*D,a+=n*U,c+=n*B,u+=n*F,l+=n*K,f+=n*H,d+=n*G,h+=n*$,p+=n*V,b+=n*z,m+=n*q,g+=n*W,v+=n*Z,y+=n*J,_+=n*Y,n=t[1],s+=n*j,a+=n*D,c+=n*U,u+=n*B,l+=n*F,f+=n*K,d+=n*H,h+=n*G,p+=n*$,b+=n*V,m+=n*z,g+=n*q,v+=n*W,y+=n*Z,_+=n*J,w+=n*Y,n=t[2],a+=n*j,c+=n*D,u+=n*U,l+=n*B,f+=n*F,d+=n*K,h+=n*H,p+=n*G,b+=n*$,m+=n*V,g+=n*z,v+=n*q,y+=n*W,_+=n*Z,w+=n*J,E+=n*Y,n=t[3],c+=n*j,u+=n*D,l+=n*U,f+=n*B,d+=n*F,h+=n*K,p+=n*H,b+=n*G,m+=n*$,g+=n*V,v+=n*z,y+=n*q,_+=n*W,w+=n*Z,E+=n*J,O+=n*Y,n=t[4],u+=n*j,l+=n*D,f+=n*U,d+=n*B,h+=n*F,p+=n*K,b+=n*H,m+=n*G,g+=n*$,v+=n*V,y+=n*z,_+=n*q,w+=n*W,E+=n*Z,O+=n*J,A+=n*Y,n=t[5],l+=n*j,f+=n*D,d+=n*U,h+=n*B,p+=n*F,b+=n*K,m+=n*H,g+=n*G,v+=n*$,y+=n*V,_+=n*z,w+=n*q,E+=n*W,O+=n*Z,A+=n*J,S+=n*Y,n=t[6],f+=n*j,d+=n*D,h+=n*U,p+=n*B,b+=n*F,m+=n*K,g+=n*H,v+=n*G,y+=n*$,_+=n*V,w+=n*z,E+=n*q,O+=n*W,A+=n*Z,S+=n*J,P+=n*Y,n=t[7],d+=n*j,h+=n*D,p+=n*U,b+=n*B,m+=n*F,g+=n*K,v+=n*H,y+=n*G,_+=n*$,w+=n*V,E+=n*z,O+=n*q,A+=n*W,S+=n*Z,P+=n*J,T+=n*Y,n=t[8],h+=n*j,p+=n*D,b+=n*U,m+=n*B,g+=n*F,v+=n*K,y+=n*H,_+=n*G,w+=n*$,E+=n*V,O+=n*z,A+=n*q,S+=n*W,P+=n*Z,T+=n*J,I+=n*Y,n=t[9],p+=n*j,b+=n*D,m+=n*U,g+=n*B,v+=n*F,y+=n*K,_+=n*H,w+=n*G,E+=n*$,O+=n*V,A+=n*z,S+=n*q,P+=n*W,T+=n*Z,I+=n*J,R+=n*Y,n=t[10],b+=n*j,m+=n*D,g+=n*U,v+=n*B,y+=n*F,_+=n*K,w+=n*H,E+=n*G,O+=n*$,A+=n*V,S+=n*z,P+=n*q,T+=n*W,I+=n*Z,R+=n*J,x+=n*Y,n=t[11],m+=n*j,g+=n*D,v+=n*U,y+=n*B,_+=n*F,w+=n*K,E+=n*H,O+=n*G,A+=n*$,S+=n*V,P+=n*z,T+=n*q,I+=n*W,R+=n*Z,x+=n*J,M+=n*Y,n=t[12],g+=n*j,v+=n*D,y+=n*U,_+=n*B,w+=n*F,E+=n*K,O+=n*H,A+=n*G,S+=n*$,P+=n*V,T+=n*z,I+=n*q,R+=n*W,x+=n*Z,M+=n*J,k+=n*Y,n=t[13],v+=n*j,y+=n*D,_+=n*U,w+=n*B,E+=n*F,O+=n*K,A+=n*H,S+=n*G,P+=n*$,T+=n*V,I+=n*z,R+=n*q,x+=n*W,M+=n*Z,k+=n*J,L+=n*Y,n=t[14],y+=n*j,_+=n*D,w+=n*U,E+=n*B,O+=n*F,A+=n*K,S+=n*H,P+=n*G,T+=n*$,I+=n*V,R+=n*z,x+=n*q,M+=n*W,k+=n*Z,L+=n*J,N+=n*Y,n=t[15],_+=n*j,w+=n*D,E+=n*U,O+=n*B,A+=n*F,S+=n*K,P+=n*H,T+=n*G,I+=n*$,R+=n*V,x+=n*z,M+=n*q,k+=n*W,L+=n*Z,N+=n*J,C+=n*Y,o+=38*w,s+=38*E,a+=38*O,c+=38*A,u+=38*S,l+=38*P,f+=38*T,d+=38*I,h+=38*R,p+=38*x,b+=38*M,m+=38*k,g+=38*L,v+=38*N,y+=38*C,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=f,e[7]=d,e[8]=h,e[9]=p,e[10]=b,e[11]=m,e[12]=g,e[13]=v,e[14]=y,e[15]=_}function A(e,t){O(e,t,t)}function S(e,t){const r=s();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)A(r,r),2!==n&&4!==n&&O(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}function P(e,t){const r=s(),n=s(),i=s(),o=s(),a=s(),c=s(),u=s(),f=s(),d=s();E(r,e[1],e[0]),E(d,t[1],t[0]),O(r,r,d),w(n,e[0],e[1]),w(d,t[0],t[1]),O(n,n,d),O(i,e[3],t[3]),O(i,i,l),O(o,e[2],t[2]),w(o,o,o),E(a,n,r),E(c,o,i),w(u,o,i),w(f,n,r),O(e[0],a,c),O(e[1],f,u),O(e[2],u,c),O(e[3],a,f)}function T(e,t,r){for(let n=0;n<4;n++)m(e[n],t[n],r)}function I(e,t){const r=s(),n=s(),i=s();S(i,t[2]),O(r,t[0],i),O(n,t[1],i),g(e,n),e[31]^=_(r)<<7}function R(e,t,r){p(e[0],a),p(e[1],c),p(e[2],c),p(e[3],a);for(let n=255;n>=0;--n){const i=r[n/8|0]>>(7&n)&1;T(e,t,i),P(t,e),P(e,e),T(e,t,i)}}function x(e,t){const r=[s(),s(),s(),s()];p(r[0],f),p(r[1],d),p(r[2],c),O(r[3],f,d),R(e,r,t)}function M(e){if(e.length!==t.aP)throw new Error(`ed25519: seed must be ${t.aP} bytes`);const r=(0,i.hash)(e);r[0]&=248,r[31]&=127,r[31]|=64;const n=new Uint8Array(32),o=[s(),s(),s(),s()];x(o,r),I(n,o);const a=new Uint8Array(64);return a.set(e),a.set(n,32),{publicKey:n,secretKey:a}}const k=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function L(e,t){let r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*k[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*k[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function N(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let t=0;t<64;t++)e[t]=0;L(e,t)}function C(e,t){const r=s(),n=s(),i=s(),o=s(),l=s(),f=s(),d=s();return p(e[2],c),function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),A(i,e[1]),O(o,i,u),E(i,i,e[2]),w(o,e[2],o),A(l,o),A(f,l),O(d,f,l),O(r,d,i),O(r,r,o),function(e,t){const r=s();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=250;n>=0;n--)A(r,r),1!==n&&O(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(r,r),O(r,r,i),O(r,r,o),O(r,r,o),O(e[0],r,o),A(n,e[0]),O(n,n,o),y(n,i)&&O(e[0],e[0],h),A(n,e[0]),O(n,n,o),y(n,i)?-1:(_(e[0])===t[31]>>7&&E(e[0],a,e[0]),O(e[3],e[0],e[1]),0)}t.T=function(e,r,n){const o=new Uint8Array(32),a=[s(),s(),s(),s()],c=[s(),s(),s(),s()];if(n.length!==t.jQ)throw new Error(`ed25519: signature must be ${t.jQ} bytes`);if(C(c,e))return!1;const u=new i.SHA512;u.update(n.subarray(0,32)),u.update(e),u.update(r);const l=u.digest();return N(l),R(a,c,l),x(c,n.subarray(32)),P(a,c),I(o,a),!v(n,o)}},5457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},1293:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(5147),i=r(9437),o=r(2887);function s(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(e=t.defaultRandomSource){const r=s(4,e),n=(0,i.readUint32LE)(r);return(0,o.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r=a,n=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const c=r.length,u=256-256%c;for(;e>0;){const t=s(Math.ceil(256*e/u),n);for(let n=0;n0;n++){const o=t[n];o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(2887);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5477);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(2017),i=r(7879);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},6756:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9437),i=r(2887);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%128<112?128:256;this._buffer[r]=128;for(var c=r+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.stateHi),i.wipe(e.stateLo),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=o;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(e,t,r,i,o,a,c){for(var u,l,f,d,h,p,b,m,g=r[0],v=r[1],y=r[2],_=r[3],w=r[4],E=r[5],O=r[6],A=r[7],S=i[0],P=i[1],T=i[2],I=i[3],R=i[4],x=i[5],M=i[6],k=i[7];c>=128;){for(var L=0;L<16;L++){var N=8*L+a;e[L]=n.readUint32BE(o,N),t[L]=n.readUint32BE(o,N+4)}for(L=0;L<80;L++){var C,j,D=g,U=v,B=y,F=_,K=w,H=E,G=O,$=S,V=P,z=T,q=I,W=R,Z=x,J=M;if(h=65535&(l=k),p=l>>>16,b=65535&(u=A),m=u>>>16,h+=65535&(l=(R>>>14|w<<18)^(R>>>18|w<<14)^(w>>>9|R<<23)),p+=l>>>16,b+=65535&(u=(w>>>14|R<<18)^(w>>>18|R<<14)^(R>>>9|w<<23)),m+=u>>>16,h+=65535&(l=R&x^~R&M),p+=l>>>16,b+=65535&(u=w&E^~w&O),m+=u>>>16,u=s[2*L],h+=65535&(l=s[2*L+1]),p+=l>>>16,b+=65535&u,m+=u>>>16,u=e[L%16],p+=(l=t[L%16])>>>16,b+=65535&u,m+=u>>>16,b+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=d=65535&h|p<<16),p=l>>>16,b=65535&(u=f=65535&b|(m+=b>>>16)<<16),m=u>>>16,h+=65535&(l=(S>>>28|g<<4)^(g>>>2|S<<30)^(g>>>7|S<<25)),p+=l>>>16,b+=65535&(u=(g>>>28|S<<4)^(S>>>2|g<<30)^(S>>>7|g<<25)),m+=u>>>16,p+=(l=S&P^S&T^P&T)>>>16,b+=65535&(u=g&v^g&y^v&y),m+=u>>>16,C=65535&(b+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=b>>>16)<<16,j=65535&h|p<<16,h=65535&(l=q),p=l>>>16,b=65535&(u=F),m=u>>>16,p+=(l=d)>>>16,b+=65535&(u=f),m+=u>>>16,v=D,y=U,_=B,w=F=65535&(b+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=b>>>16)<<16,E=K,O=H,A=G,g=C,P=$,T=V,I=z,R=q=65535&h|p<<16,x=W,M=Z,k=J,S=j,L%16==15)for(N=0;N<16;N++)u=e[N],h=65535&(l=t[N]),p=l>>>16,b=65535&u,m=u>>>16,u=e[(N+9)%16],h+=65535&(l=t[(N+9)%16]),p+=l>>>16,b+=65535&u,m+=u>>>16,f=e[(N+1)%16],h+=65535&(l=((d=t[(N+1)%16])>>>1|f<<31)^(d>>>8|f<<24)^(d>>>7|f<<25)),p+=l>>>16,b+=65535&(u=(f>>>1|d<<31)^(f>>>8|d<<24)^f>>>7),m+=u>>>16,f=e[(N+14)%16],p+=(l=((d=t[(N+14)%16])>>>19|f<<13)^(f>>>29|d<<3)^(d>>>6|f<<26))>>>16,b+=65535&(u=(f>>>19|d<<13)^(d>>>29|f<<3)^f>>>6),m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[N]=65535&b|m<<16,t[N]=65535&h|p<<16}h=65535&(l=S),p=l>>>16,b=65535&(u=g),m=u>>>16,u=r[0],p+=(l=i[0])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[0]=g=65535&b|m<<16,i[0]=S=65535&h|p<<16,h=65535&(l=P),p=l>>>16,b=65535&(u=v),m=u>>>16,u=r[1],p+=(l=i[1])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[1]=v=65535&b|m<<16,i[1]=P=65535&h|p<<16,h=65535&(l=T),p=l>>>16,b=65535&(u=y),m=u>>>16,u=r[2],p+=(l=i[2])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[2]=y=65535&b|m<<16,i[2]=T=65535&h|p<<16,h=65535&(l=I),p=l>>>16,b=65535&(u=_),m=u>>>16,u=r[3],p+=(l=i[3])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[3]=_=65535&b|m<<16,i[3]=I=65535&h|p<<16,h=65535&(l=R),p=l>>>16,b=65535&(u=w),m=u>>>16,u=r[4],p+=(l=i[4])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[4]=w=65535&b|m<<16,i[4]=R=65535&h|p<<16,h=65535&(l=x),p=l>>>16,b=65535&(u=E),m=u>>>16,u=r[5],p+=(l=i[5])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[5]=E=65535&b|m<<16,i[5]=x=65535&h|p<<16,h=65535&(l=M),p=l>>>16,b=65535&(u=O),m=u>>>16,u=r[6],p+=(l=i[6])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[6]=O=65535&b|m<<16,i[6]=M=65535&h|p<<16,h=65535&(l=k),p=l>>>16,b=65535&(u=A),m=u>>>16,u=r[7],p+=(l=i[7])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[7]=A=65535&b|m<<16,i[7]=k=65535&h|p<<16,a+=128,c-=128}return a}t.hash=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},2887:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,u=new Uint8Array(o);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var f=0,d=o-1;(0!==l||f>>0,u[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,r++}for(var h=o-i;h!==o&&0===u[h];)h++;for(var p=new Uint8Array(n+(o-h)),b=n;h!==o;)p[b++]=u[h++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var c=(o-i)*u+1>>>0,l=new Uint8Array(c);i!==o;){for(var f=t[i],d=0,h=c-1;(0!==f||d>>0,l[h]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=d,i++}for(var p=c-n;p!==c&&0===l[p];)p++;for(var b=a.repeat(r);p{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),l=0,f=c>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,u=n-i;au?u:a+s));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},6391:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",f=1e14,d=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,m=1e9;function g(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function _(e,t,r,n){if(er||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return g(e.e/d)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function O(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?g.c=g.e=null:e.e=10;f/=10,u++);return void(u>D?g.c=g.e=null:(g.e=u,g.c=[e]))}m=String(e)}else{if(!s.test(m=String(e)))return i(g,m,p);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(f=m.search(/e/i))>0?(u<0&&(u=f),u+=+m.slice(f+1),m=m.substring(0,f)):u<0&&(u=m.length)}else{if(_(t,2,H.length,"Base"),10==t&&G)return W(g=new $(e),k+g.e+1,L);if(m=String(e),p="number"==typeof e){if(0*e!=0)return i(g,m,p,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,$.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=H.slice(0,t),u=f=0,b=m.length;fu){u=b;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,f=-1,u=0;continue}return i(g,String(e),p,t)}p=!1,(u=(m=n(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(f=0;48===m.charCodeAt(f);f++);for(b=m.length;48===m.charCodeAt(--b););if(m=m.slice(f,++b)){if(b-=f,p&&$.DEBUG&&b>15&&(e>h||e!==c(e)))throw Error(l+g.s*e);if((u=u-f-1)>D)g.c=g.e=null;else if(u=C)?E(c,s):O(c,s,"0");else if(o=(e=W(new $(e),t,r)).e,a=(c=v(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function z(e,t){for(var r,n,i=1,o=new $(e[0]);i=10;i/=10,n++);return(r=n+r*d-1)>D?e.c=e.e=null:r=10;u/=10,i++);if((o=t-i)<0)o+=d,s=t,l=m[h=0],b=c(l/g[i-s-1]%10);else if((h=a((o+1)/d))>=m.length){if(!n)break e;for(;m.length<=h;m.push(0));l=b=0,i=1,s=(o%=d)-d+1}else{for(l=u=m[h],i=1;u>=10;u/=10,i++);b=(s=(o%=d)-d+i)<0?0:c(l/g[i-s-1]%10)}if(n=n||t<0||null!=m[h+1]||(s<0?l:l%g[i-s-1]),n=r<4?(b||n)&&(0==r||r==(e.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?l/g[i-s]:0:m[h-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(d-t%d)%d],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=h,u=1,h--):(m.length=h+1,u=g[d-o],m[h]=s>0?c(l/g[i-s]%g[s])*u:0),n)for(;;){if(0==h){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,m[0]==f&&(m[0]=1));break}if(m[h]+=u,m[h]!=f)break;m[h--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}e.e>D?e.c=e.e=null:e.e=C?E(t,r):O(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,m,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-m,0,t),_(r[1],0,m,t),N=r[0],C=r[1]):(_(r,-m,m,t),N=-(C=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-m,-1,t),_(r[1],1,m,t),j=r[0],D=r[1];else{if(_(r,-m,m,t),!r)throw Error(u+t+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,m,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);G="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,C],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:K,ALPHABET:H}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%d)<1&&(t+=d),String(n[0]).length==t){for(t=0;t=f||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return z(arguments,-1)},$.minimum=$.min=function(){return z(arguments,1)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,l=[],f=new $(M);if(null==e?e=k:_(e,0,m),i=a(e/d),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(l.push(o%1e14),s+=7);s=i/7}if(!U)for(;s=10;o/=10,s++);sr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,f,d,h,p,b,m=n.indexOf("."),g=k,y=L;for(m>=0&&(f=F,F=0,n=n.replace(".",""),h=(b=new $(i)).pow(n.length-m),F=f,b.c=t(O(v(h.c),h.e,"0"),10,o,e),b.e=b.c.length),l=f=(p=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=r(h,b,g,y,o)).c,d=h.r,l=h.e),m=p[u=l+g+1],f=o/2,d=d||u<0||null!=p[u+1],d=y<4?(null!=m||d)&&(0==y||y==(h.s<0?3:2)):m>f||m==f&&(4==y||d||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])n=d?O(c.charAt(1),-g,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(f=p.length;!p[--f];);for(m=0,n="";m<=f;n+=c.charAt(p[m++]));n=O(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%b,l=t/b|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%b)+(n=l*o+(s=e[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,s,a){var u,l,h,p,b,m,v,y,_,w,E,O,A,S,P,T,I,R=n.s==i.s?1:-1,x=n.c,M=i.c;if(!(x&&x[0]&&M&&M[0]))return new $(n.s&&i.s&&(x?!M||x[0]!=M[0]:M)?x&&0==x[0]||!M?0*R:R/0:NaN);for(_=(y=new $(R)).c=[],R=o+(l=n.e-i.e)+1,a||(a=f,l=g(n.e/d)-g(i.e/d),R=R/d|0),h=0;M[h]==(x[h]||0);h++);if(M[h]>(x[h]||0)&&l--,R<0)_.push(1),p=!0;else{for(S=x.length,T=M.length,h=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=e(M,b,a),x=e(x,b,a),T=M.length,S=x.length),A=T,E=(w=x.slice(0,T)).length;E=a/2&&P++;do{if(b=0,(u=t(M,w,T,E))<0){if(O=w[0],T!=E&&(O=O*a+(w[1]||0)),(b=c(O/P))>1)for(b>=a&&(b=a-1),v=(m=e(M,b,a)).length,E=w.length;1==t(m,w,v,E);)b--,r(m,T=10;R/=10,h++);W(y,o+(y.e=h+l*d-1)+1,s,p)}else y.e=l,y.r=+p;return y}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(P,"$1").replace(T,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return y(this,new $(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return _(e,0,m),null==t?t=L:_(t,0,8),W(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-g(this.e/d))*d,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new $(e,t),k,L)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new $(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,i,o,s,l,f,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Z(e));if(null!=t&&(t=new $(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Z(p),s?e.s*(2-w(e)):+Z(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&w(e)?-0:0,p.e>-1&&(o=1/o),new $(l?1/o:o);F&&(o=a(F/d+2))}for(s?(r=new $(.5),l&&(e.s=1),f=w(e)):f=(i=Math.abs(+Z(e)))%2,h=new $(M);;){if(f){if(!(h=h.times(p)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}if(i){if(0===(i=c(i/2)))break;f=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)f=w(e);else{if(0===(i=+Z(e)))break;f=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?h:(l&&(h=M.div(h)),t?h.mod(t):o?W(h,F,L,undefined):h)},x.integerValue=function(e){var t=new $(this);return null==e?e=L:_(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===y(this,new $(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return y(this,new $(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=y(this,new $(e,t)))||0===t},x.isInteger=function(){return!!this.c&&g(this.e/d)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return y(this,new $(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=y(this,new $(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/d,u=e.e/d,l=s.c,h=e.c;if(!c||!u){if(!l||!h)return l?(e.s=-t,e):new $(h?s:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new $(l[0]?s:3==L?-0:0)}if(c=g(c),u=g(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=l.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;l[r++]=0);for(t=f-1;n>a;){if(l[--n]=0;){for(r=0,p=O[i]%_,m=O[i]/_|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%_)+(a=m*u+(l=E[s]/_|0)*p)%_*_+v[o]+r)/y|0)+(a/_|0)+m*l,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(e,v,n)},x.negated=function(){var e=new $(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/d,s=e.e/d,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?e:new $(a[0]?n:0*i)}if(o=g(o),s=g(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/f|0,a[t]=f===a[t]?0:a[t]%f;return i&&(a=[i].concat(a),++s),q(e,a,s)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return _(e,1,m),null==t?t=L:_(t,0,8),W(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*d+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return _(e,-9007199254740991,h),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=k+4,f=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Z(s)))||c==1/0?(((t=v(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=g((u+1)/2)-(u<0||u%2),n=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(s,o,l,1))),v(o.c).slice(0,c)===(t=v(n.c)).slice(0,c)){if(n.e0&&b>0){for(o=b%a||a,f=p.substr(0,o);o0&&(f+=l+p.slice(o)),h&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,s,a,c,l,f,h,b,m,g=this,y=g.c;if(null!=e&&(!(c=new $(e)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!y)return new $(g);for(t=new $(M),f=n=new $(M),i=l=new $(M),m=v(y),s=t.e=m.length-g.e-1,t.c[0]=p[(a=s%d)<0?d+a:a],e=!e||c.comparedTo(t)>0?s>0?t:f:c,a=D,D=1/0,c=new $(m),l.c[0]=0;h=r(c,t,0,1),1!=(o=n.plus(h.times(i))).comparedTo(e);)n=i,i=o,f=l.plus(h.times(o=f)),l=o,t=c.minus(h.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),l=l.plus(o.times(f)),n=n.plus(o.times(i)),l.s=f.s=g.s,b=r(f,i,s*=2,L).minus(g).abs().comparedTo(r(l,n,s,L).minus(g).abs())<1?[f,i]:[l,n],D=a,b},x.toNumber=function(){return+Z(this)},x.toPrecision=function(e,t){return null!=e&&_(e,1,m),V(this,e,t,2)},x.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=N||o>=C?E(v(r.c),o):O(v(r.c),o,"0"):10===e&&G?t=O(v((r=W(new $(r),k+o+1,L)).c),r.e,"0"):(_(e,2,H.length,"Base"),t=n(O(v(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,null!=t&&$.set(t),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},651:(e,t,r)=>{const n=r(7967);function i(e,t,r){const n=e[t]+e[r];let i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function o(e,t,r,n){let i=e[t]+r;r<0&&(i+=4294967296);let o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,s,a){const c=f[s],u=f[s+1],d=f[a],h=f[a+1];i(l,e,t),o(l,e,c,u);let p=l[n]^l[e],b=l[n+1]^l[e+1];l[n]=b,l[n+1]=p,i(l,r,n),p=l[t]^l[r],b=l[t+1]^l[r+1],l[t]=p>>>24^b<<8,l[t+1]=b>>>24^p<<8,i(l,e,t),o(l,e,d,h),p=l[n]^l[e],b=l[n+1]^l[e+1],l[n]=p>>>16^b<<16,l[n+1]=b>>>16^p<<16,i(l,r,n),p=l[t]^l[r],b=l[t+1]^l[r+1],l[t]=b>>>31^p<<1,l[t+1]=p>>>31^b<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),f=new Uint32Array(32);function d(e,t){let r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=c[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)f[r]=s(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,u[16*r+0],u[16*r+1]),a(2,10,18,26,u[16*r+2],u[16*r+3]),a(4,12,20,28,u[16*r+4],u[16*r+5]),a(6,14,22,30,u[16*r+6],u[16*r+7]),a(0,10,20,30,u[16*r+8],u[16*r+9]),a(2,12,22,24,u[16*r+10],u[16*r+11]),a(4,14,16,26,u[16*r+12],u[16*r+13]),a(6,8,18,28,u[16*r+14],u[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^l[r]^l[r+16]}const h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,r,n){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&16!==r.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(n&&16!==n.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};h.fill(0),h[0]=e,t&&(h[1]=t.length),h[2]=1,h[3]=1,r&&h.set(r,32),n&&h.set(n,48);for(let e=0;e<16;e++)i.h[e]=c[e]^s(h,4*e);return t&&(b(i,t),i.c=128),i}function b(e,t){for(let r=0;r>2]>>8*(3&r);return t}function g(e,t,r,i,o){r=r||64,e=n.normalizeInput(e),i&&(i=n.normalizeInput(i)),o&&(o=n.normalizeInput(o));const s=p(r,t,i,o);return b(s,e),m(s)}e.exports={blake2b:g,blake2bHex:function(e,t,r,i,o){const s=g(e,t,r,i,o);return n.toHex(s)},blake2bInit:p,blake2bUpdate:b,blake2bFinal:m}},9962:(e,t,r)=>{const n=r(7967);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,r,n,i,o){u[e]=u[e]+u[t]+i,u[n]=s(u[n]^u[e],16),u[r]=u[r]+u[n],u[t]=s(u[t]^u[r],12),u[e]=u[e]+u[t]+o,u[n]=s(u[n]^u[e],8),u[r]=u[r]+u[n],u[t]=s(u[t]^u[r],7)}function s(e,t){return e>>>t^e<<32-t}const a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),u=new Uint32Array(16),l=new Uint32Array(16);function f(e,t){let r=0;for(r=0;r<8;r++)u[r]=e.h[r],u[r+8]=a[r];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),r=0;r<16;r++)l[r]=i(e.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,l[c[16*r+0]],l[c[16*r+1]]),o(1,5,9,13,l[c[16*r+2]],l[c[16*r+3]]),o(2,6,10,14,l[c[16*r+4]],l[c[16*r+5]]),o(3,7,11,15,l[c[16*r+6]],l[c[16*r+7]]),o(0,5,10,15,l[c[16*r+8]],l[c[16*r+9]]),o(1,6,11,12,l[c[16*r+10]],l[c[16*r+11]]),o(2,7,8,13,l[c[16*r+12]],l[c[16*r+13]]),o(3,4,9,14,l[c[16*r+14]],l[c[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=u[r]^u[r+8]}function d(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");const r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");const n={h:new Uint32Array(a),b:new Uint8Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(h(n,t),n.c=64),n}function h(e,t){for(let r=0;r>2]>>8*(3&r)&255;return t}function b(e,t,r){r=r||32,e=n.normalizeInput(e);const i=d(r,t);return h(i,e),p(i)}e.exports={blake2s:b,blake2sHex:function(e,t,r){const i=b(e,t,r);return n.toHex(i)},blake2sInit:d,blake2sUpdate:h,blake2sFinal:p}},1395:(e,t,r)=>{const n=r(651),i=r(9962);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},7967:e=>{function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,r,n){let i="\n"+e+" = ";for(let o=0;o=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.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++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=c(e,t,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var l=["","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"],f=[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],d=[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,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.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>>24-i&16777215)||s!==this.length-1?l[6-c.length]+c+r:c+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 u=f[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?b+r:l[u-b.length]+b+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")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){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"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.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;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.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<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,b=h>>>13,m=0|s[2],g=8191&m,v=m>>>13,y=0|s[3],_=8191&y,w=y>>>13,E=0|s[4],O=8191&E,A=E>>>13,S=0|s[5],P=8191&S,T=S>>>13,I=0|s[6],R=8191&I,x=I>>>13,M=0|s[7],k=8191&M,L=M>>>13,N=0|s[8],C=8191&N,j=N>>>13,D=0|s[9],U=8191&D,B=D>>>13,F=0|a[0],K=8191&F,H=F>>>13,G=0|a[1],$=8191&G,V=G>>>13,z=0|a[2],q=8191&z,W=z>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],fe=8191&le,de=le>>>13,he=0|a[9],pe=8191&he,be=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(f,K))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(d,K)|0))<<13)|0;u=((o=Math.imul(d,H))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,K),i=(i=Math.imul(p,H))+Math.imul(b,K)|0,o=Math.imul(b,H);var ge=(u+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,K),i=(i=Math.imul(g,H))+Math.imul(v,K)|0,o=Math.imul(v,H),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,V)|0;var ve=(u+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,q)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(_,K),i=(i=Math.imul(_,H))+Math.imul(w,K)|0,o=Math.imul(w,H),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,W)|0;var ye=(u+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,J)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(O,K),i=(i=Math.imul(O,H))+Math.imul(A,K)|0,o=Math.imul(A,H),n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0;var _e=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,K),i=(i=Math.imul(P,H))+Math.imul(T,K)|0,o=Math.imul(T,H),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(_,q)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var we=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,K),i=(i=Math.imul(R,H))+Math.imul(x,K)|0,o=Math.imul(x,H),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Ee=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(k,K),i=(i=Math.imul(k,H))+Math.imul(L,K)|0,o=Math.imul(L,H),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var Oe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(C,K),i=(i=Math.imul(C,H))+Math.imul(j,K)|0,o=Math.imul(j,H),n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0;var Ae=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,K),i=(i=Math.imul(U,H))+Math.imul(B,K)|0,o=Math.imul(B,H),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,se)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(v,ce)|0,o=o+Math.imul(v,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,fe)|0,o=o+Math.imul(b,de)|0;var Se=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,be)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,V))+Math.imul(B,$)|0,o=Math.imul(B,V),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,W)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,fe)|0,o=o+Math.imul(v,de)|0;var Pe=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(B,q)|0,o=Math.imul(B,W),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,n=n+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(_,fe)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,de)|0;var Te=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,be)|0)+Math.imul(v,pe)|0))<<13)|0;u=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Y))+Math.imul(B,J)|0,o=Math.imul(B,Y),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,ue)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(A,fe)|0,o=o+Math.imul(A,de)|0;var Ie=(u+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,be)|0)+Math.imul(w,pe)|0))<<13)|0;u=((o=o+Math.imul(w,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(B,Q)|0,o=Math.imul(B,ee),n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,n=n+Math.imul(P,fe)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(T,fe)|0,o=o+Math.imul(T,de)|0;var Re=(u+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,be)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(B,re)|0,o=Math.imul(B,ne),n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,se)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,de)|0;var xe=(u+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(T,pe)|0))<<13)|0;u=((o=o+Math.imul(T,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(B,oe)|0,o=Math.imul(B,se),n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(j,ce)|0,o=o+Math.imul(j,ue)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(L,fe)|0,o=o+Math.imul(L,de)|0;var Me=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(B,ce)|0,o=Math.imul(B,ue),n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(j,fe)|0,o=o+Math.imul(j,de)|0;var ke=(u+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,fe),i=(i=Math.imul(U,de))+Math.imul(B,fe)|0,o=Math.imul(B,de);var Le=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(j,pe)|0))<<13)|0;u=((o=o+Math.imul(j,be)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ne=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,be))+Math.imul(B,pe)|0))<<13)|0;return u=((o=Math.imul(B,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Ee,c[7]=Oe,c[8]=Ae,c[9]=Se,c[10]=Pe,c[11]=Te,c[12]=Ie,c[13]=Re,c[14]=xe,c[15]=Me,c[16]=ke,c[17]=Le,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):n<63?h(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):b(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=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>>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=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=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<=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},o.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>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=d)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,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 o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.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 i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(f)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(c)):(r.isub(t),a.isub(i),c.isub(s))}return{a,b:c,gcd:r.iushln(u)}},o.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 i,s=new o(1),a=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new O(e)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(e){if("string"==typeof e){var t=o._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 A(e){O.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},i(y,v),y.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new _;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return g[e]=t,t},O.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},O.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")},O.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},O.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},O.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},O.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},O.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},O.prototype.isqr=function(e){return this.imul(e,e.clone())},O.prototype.sqr=function(e){return this.mul(e,e)},O.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 o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var b=h,m=0;0!==b.cmp(a);m++)b=b.redSqr();n(m=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},O.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},O.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,O),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},2745:(e,t,r)=>{var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{const n=r(8166);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8616:(e,t,r)=>{"use strict";var n=r(7022);e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),i=e(r),o=r.length+4,s=new Uint8Array(o);return s.set(r,0),s.set(i.subarray(0,4),r.length),n.encode(s,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},4075:(e,t,r)=>{"use strict";var{sha256:n}=r(6053),i=r(8616);e.exports=i((function(e){return n(n(e))}))},8834:(e,t,r)=>{"use strict";const n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|b(e,t);let n=a(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(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(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?a(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 c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(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 f(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function b(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(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 r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=b,c.prototype._isBuffer=!0,c.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;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function C(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||k(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||k(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||k(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||k(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||k(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||k(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeBigUInt64LE=X((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=X((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=r-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+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeBigInt64LE=X((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=X((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function H(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||$(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=K(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=K(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},7554:(e,t,r)=>{"use strict";var n=t;n.version=r(763).i8,n.utils=r(8288),n.rand=r(2745),n.curve=r(8610),n.curves=r(1479),n.ec=r(8596),n.eddsa=r(9208)},8919:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+n[l];u.push(c)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var f=s[u];a(0!==f),c="affine"===e.type?f>0?c.mixedAdd(i[f-1>>1]):c.mixedAdd(i[-f-1>>1].neg()):f>0?c.add(i[f-1>>1]):c.add(i[-f-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){var a,c,u,l=this._wnafT1,f=this._wnafT2,d=this._wnafT3,h=0;for(a=0;a=1;a-=2){var b=a-1,m=a;if(1===l[b]&&1===l[m]){var g=[t[b],null,null,t[m]];0===t[b].y.cmp(t[m].y)?(g[1]=t[b].add(t[m]),g[2]=t[b].toJ().mixedAdd(t[m].neg())):0===t[b].y.cmp(t[m].y.redNeg())?(g[1]=t[b].toJ().mixedAdd(t[m]),g[2]=t[b].add(t[m].neg())):(g[1]=t[b].toJ().mixedAdd(t[m]),g[2]=t[b].toJ().mixedAdd(t[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=s(r[b],r[m]);for(h=Math.max(y[0].length,h),d[b]=new Array(h),d[m]=new Array(h),c=0;c=0;a--){for(var A=0;a>=0;){var S=!0;for(c=0;c=0&&A++,E=E.dblp(A),a<0)break;for(c=0;c0?u=f[c][P-1>>1]:P<0&&(u=f[c][-P-1>>1].neg()),E="affine"===u.type?E.mixedAdd(u):E.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{"use strict";var n=r(8288),i=r(2197),o=r(1285),s=r(8919),a=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,s.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,o){s.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,s),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},o(u,s.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),f=s.redMul(o);return this.curve.point(c,u,f,l)},u.prototype._projDbl=function(){var e,t,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(a.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(t),u=o.redMul(s),l=a.redMul(c),f=o.redMul(c),d=s.redMul(a);return this.curve.point(u,l,d,f)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),f=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(f,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},8610:(e,t,r)=>{"use strict";var n=t;n.base=r(8919),n.short=r(7715),n.mont=r(5125),n.edwards=r(7105)},5125:(e,t,r)=>{"use strict";var n=r(2197),i=r(1285),o=r(8919),s=r(8288);function a(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},7715:(e,t,r)=>{"use strict";var n=r(8288),i=r(2197),o=r(1285),s=r(8919),a=n.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,o,s,a,c,u,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),p=new i(1),b=new i(0),m=new i(0),g=new i(1),v=0;0!==d.cmpn(0);){var y=h.div(d);u=h.sub(y.mul(d)),l=m.sub(y.mul(p));var _=g.sub(y.mul(b));if(!n&&u.cmp(f)<0)t=c.neg(),r=p,n=u.neg(),o=l;else if(n&&2==++v)break;c=u,h=d,d=u,m=p,p=l,g=b,b=_}s=u.neg(),a=l;var w=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(w)>=0&&(s=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=r.redMul(c),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),d=a.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(f,d,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1479:(e,t,r)=>{"use strict";var n,i=t,o=r(4485),s=r(8610),a=r(8288).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(7983)}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},8596:(e,t,r)=>{"use strict";var n=r(2197),i=r(8873),o=r(8288),s=r(1479),a=r(2745),c=o.assert,u=r(2307),l=r(1798);function f(e){if(!(this instanceof f))return new f(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=f,f.prototype.keyPair=function(e){return new u(this,e)},f.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},f.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},f.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(t.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},f.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},f.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new n(1)),d=0;;d++){var h=o.k?o.k(d):new n(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var g=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),v^=1),new l({r:m,s:g,recoveryParam:v})}}}}}},f.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),f)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),f)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new n(e),a=t.r,u=t.s,f=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),b=u.mul(h).umod(o);return this.g.mulAdd(p,a,b)},f.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new l(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},2307:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},1798:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;var u=e.slice(r.place,s+r.place);if(r.place+=s,2!==e[r.place++])return!1;var l=c(e,r);if(!1===l)return!1;if(e.length!==l+r.place)return!1;var f=e.slice(r.place,l+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new n(u),this.s=new n(f),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,t.length),(n=n.concat(t)).push(2),l(n,r.length);var o=n.concat(r),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},9208:(e,t,r)=>{"use strict";var n=r(4485),i=r(1479),o=r(8288),s=o.assert,a=o.parseBytes,c=r(851),u=r(6117);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t{"use strict";var n=r(8288),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},6117:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}s(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},7983:e=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},8288:(e,t,r)=>{"use strict";var n=t,i=r(2197),o=r(9561),s=r(3022);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0==(1&c)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(s),a=0==(1&u)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},5695:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var r,n="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(r=t.cmp,function(e){return function(t,n){var i={key:t,value:e[t]},o={key:n,value:e[n]};return r(i,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var r,s;if(Array.isArray(t)){for(s="[",r=0;r{var n=t;n.utils=r(212),n.common=r(4495),n.sha=r(5530),n.ripemd=r(1396),n.hmac=r(5047),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},4495:(e,t,r)=>{"use strict";var n=r(212),i=r(9561);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(212),i=r(9561);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(212),i=r(4495),o=n.rotl32,s=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function l(){if(!(this instanceof l))return new l;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function h(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(l,u),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],l=this.h[4],v=r,y=n,_=i,w=u,E=l,O=0;O<80;O++){var A=s(o(c(r,f(O,n,i,u),e[p[O]+t],d(O)),m[O]),l);r=l,l=u,u=o(i,10),i=n,n=A,A=s(o(c(v,f(79-O,y,_,w),e[b[O]+t],h(O)),g[O]),E),v=E,E=w,w=o(_,10),_=y,y=A}A=a(this.h[1],i,w),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],l,v),this.h[3]=a(this.h[4],r,y),this.h[4]=a(this.h[0],n,_),this.h[0]=A},l.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},5530:(e,t,r)=>{"use strict";t.sha1=r(5079),t.sha224=r(3823),t.sha256=r(8032),t.sha384=r(5328),t.sha512=r(168)},5079:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,l),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212),i=r(8032);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},8032:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=r(9561),a=n.sum32,c=n.sum32_4,u=n.sum32_5,l=o.ch32,f=o.maj32,d=o.s0_256,h=o.s1_256,p=o.g0_256,b=o.g1_256,m=i.BlockHash,g=[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];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(v,m),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212),i=r(168);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},168:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(9561),s=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,l=n.sum64,f=n.sum64_hi,d=n.sum64_lo,h=n.sum64_4_hi,p=n.sum64_4_lo,b=n.sum64_5_hi,m=n.sum64_5_lo,g=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function _(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function w(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function E(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function O(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function A(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(y,g),e.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},212:(e,t,r)=>{"use strict";var n=r(9561),i=r(1285);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,c,u){return t+n+o+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},8873:(e,t,r)=>{"use strict";var n=r(4485),i=r(3022),o=r(9561);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,l=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=u}return(h?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,b=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=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<0;e[r+h]=255&s,h+=p,s/=256,u-=8);e[r+h-p]|=128*b}},1285:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},9561:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},3022:(e,t)=>{"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},977:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.interval=t.iif=t.generate=t.fromEventPattern=t.fromEvent=t.from=t.forkJoin=t.empty=t.defer=t.connectable=t.concat=t.combineLatest=t.bindNodeCallback=t.bindCallback=t.UnsubscriptionError=t.TimeoutError=t.SequenceError=t.ObjectUnsubscribedError=t.NotFoundError=t.EmptyError=t.ArgumentOutOfRangeError=t.firstValueFrom=t.lastValueFrom=t.isObservable=t.identity=t.noop=t.pipe=t.NotificationKind=t.Notification=t.Subscriber=t.Subscription=t.Scheduler=t.VirtualAction=t.VirtualTimeScheduler=t.animationFrameScheduler=t.animationFrame=t.queueScheduler=t.queue=t.asyncScheduler=t.async=t.asapScheduler=t.asap=t.AsyncSubject=t.ReplaySubject=t.BehaviorSubject=t.Subject=t.animationFrames=t.observable=t.ConnectableObservable=t.Observable=void 0,t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.combineLatestWith=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=t.config=t.NEVER=t.EMPTY=t.scheduled=t.zip=t.using=t.timer=t.throwError=t.range=t.race=t.partition=t.pairs=t.onErrorResumeNext=t.of=t.never=t.merge=void 0,t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.pairwise=t.onErrorResumeNextWith=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=t.mergeAll=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=void 0,t.zipWith=t.zipAll=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=void 0;var o=r(4174);Object.defineProperty(t,"Observable",{enumerable:!0,get:function(){return o.Observable}});var s=r(7165);Object.defineProperty(t,"ConnectableObservable",{enumerable:!0,get:function(){return s.ConnectableObservable}});var a=r(4595);Object.defineProperty(t,"observable",{enumerable:!0,get:function(){return a.observable}});var c=r(2447);Object.defineProperty(t,"animationFrames",{enumerable:!0,get:function(){return c.animationFrames}});var u=r(5294);Object.defineProperty(t,"Subject",{enumerable:!0,get:function(){return u.Subject}});var l=r(8114);Object.defineProperty(t,"BehaviorSubject",{enumerable:!0,get:function(){return l.BehaviorSubject}});var f=r(8806);Object.defineProperty(t,"ReplaySubject",{enumerable:!0,get:function(){return f.ReplaySubject}});var d=r(9960);Object.defineProperty(t,"AsyncSubject",{enumerable:!0,get:function(){return d.AsyncSubject}});var h=r(3769);Object.defineProperty(t,"asap",{enumerable:!0,get:function(){return h.asap}}),Object.defineProperty(t,"asapScheduler",{enumerable:!0,get:function(){return h.asapScheduler}});var p=r(7152);Object.defineProperty(t,"async",{enumerable:!0,get:function(){return p.async}}),Object.defineProperty(t,"asyncScheduler",{enumerable:!0,get:function(){return p.asyncScheduler}});var b=r(4093);Object.defineProperty(t,"queue",{enumerable:!0,get:function(){return b.queue}}),Object.defineProperty(t,"queueScheduler",{enumerable:!0,get:function(){return b.queueScheduler}});var m=r(8989);Object.defineProperty(t,"animationFrame",{enumerable:!0,get:function(){return m.animationFrame}}),Object.defineProperty(t,"animationFrameScheduler",{enumerable:!0,get:function(){return m.animationFrameScheduler}});var g=r(2929);Object.defineProperty(t,"VirtualTimeScheduler",{enumerable:!0,get:function(){return g.VirtualTimeScheduler}}),Object.defineProperty(t,"VirtualAction",{enumerable:!0,get:function(){return g.VirtualAction}});var v=r(6949);Object.defineProperty(t,"Scheduler",{enumerable:!0,get:function(){return v.Scheduler}});var y=r(4666);Object.defineProperty(t,"Subscription",{enumerable:!0,get:function(){return y.Subscription}});var _=r(7747);Object.defineProperty(t,"Subscriber",{enumerable:!0,get:function(){return _.Subscriber}});var w=r(9828);Object.defineProperty(t,"Notification",{enumerable:!0,get:function(){return w.Notification}}),Object.defineProperty(t,"NotificationKind",{enumerable:!0,get:function(){return w.NotificationKind}});var E=r(5250);Object.defineProperty(t,"pipe",{enumerable:!0,get:function(){return E.pipe}});var O=r(7116);Object.defineProperty(t,"noop",{enumerable:!0,get:function(){return O.noop}});var A=r(8987);Object.defineProperty(t,"identity",{enumerable:!0,get:function(){return A.identity}});var S=r(3659);Object.defineProperty(t,"isObservable",{enumerable:!0,get:function(){return S.isObservable}});var P=r(4798);Object.defineProperty(t,"lastValueFrom",{enumerable:!0,get:function(){return P.lastValueFrom}});var T=r(7327);Object.defineProperty(t,"firstValueFrom",{enumerable:!0,get:function(){return T.firstValueFrom}});var I=r(9216);Object.defineProperty(t,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return I.ArgumentOutOfRangeError}});var R=r(9088);Object.defineProperty(t,"EmptyError",{enumerable:!0,get:function(){return R.EmptyError}});var x=r(5722);Object.defineProperty(t,"NotFoundError",{enumerable:!0,get:function(){return x.NotFoundError}});var M=r(8499);Object.defineProperty(t,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return M.ObjectUnsubscribedError}});var k=r(7298);Object.defineProperty(t,"SequenceError",{enumerable:!0,get:function(){return k.SequenceError}});var L=r(1316);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return L.TimeoutError}});var N=r(4043);Object.defineProperty(t,"UnsubscriptionError",{enumerable:!0,get:function(){return N.UnsubscriptionError}});var C=r(6238);Object.defineProperty(t,"bindCallback",{enumerable:!0,get:function(){return C.bindCallback}});var j=r(2375);Object.defineProperty(t,"bindNodeCallback",{enumerable:!0,get:function(){return j.bindNodeCallback}});var D=r(508);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return D.combineLatest}});var U=r(3364);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return U.concat}});var B=r(5360);Object.defineProperty(t,"connectable",{enumerable:!0,get:function(){return B.connectable}});var F=r(9623);Object.defineProperty(t,"defer",{enumerable:!0,get:function(){return F.defer}});var K=r(6929);Object.defineProperty(t,"empty",{enumerable:!0,get:function(){return K.empty}});var H=r(9220);Object.defineProperty(t,"forkJoin",{enumerable:!0,get:function(){return H.forkJoin}});var G=r(4417);Object.defineProperty(t,"from",{enumerable:!0,get:function(){return G.from}});var $=r(9671);Object.defineProperty(t,"fromEvent",{enumerable:!0,get:function(){return $.fromEvent}});var V=r(7357);Object.defineProperty(t,"fromEventPattern",{enumerable:!0,get:function(){return V.fromEventPattern}});var z=r(3482);Object.defineProperty(t,"generate",{enumerable:!0,get:function(){return z.generate}});var q=r(550);Object.defineProperty(t,"iif",{enumerable:!0,get:function(){return q.iif}});var W=r(3154);Object.defineProperty(t,"interval",{enumerable:!0,get:function(){return W.interval}});var Z=r(2039);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return Z.merge}});var J=r(2980);Object.defineProperty(t,"never",{enumerable:!0,get:function(){return J.never}});var Y=r(1377);Object.defineProperty(t,"of",{enumerable:!0,get:function(){return Y.of}});var X=r(8362);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return X.onErrorResumeNext}});var Q=r(968);Object.defineProperty(t,"pairs",{enumerable:!0,get:function(){return Q.pairs}});var ee=r(6394);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ee.partition}});var te=r(6849);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return te.race}});var re=r(7284);Object.defineProperty(t,"range",{enumerable:!0,get:function(){return re.range}});var ne=r(40);Object.defineProperty(t,"throwError",{enumerable:!0,get:function(){return ne.throwError}});var ie=r(8069);Object.defineProperty(t,"timer",{enumerable:!0,get:function(){return ie.timer}});var oe=r(3348);Object.defineProperty(t,"using",{enumerable:!0,get:function(){return oe.using}});var se=r(4981);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return se.zip}});var ae=r(2862);Object.defineProperty(t,"scheduled",{enumerable:!0,get:function(){return ae.scheduled}});var ce=r(6929);Object.defineProperty(t,"EMPTY",{enumerable:!0,get:function(){return ce.EMPTY}});var ue=r(2980);Object.defineProperty(t,"NEVER",{enumerable:!0,get:function(){return ue.NEVER}}),i(r(2793),t);var le=r(9179);Object.defineProperty(t,"config",{enumerable:!0,get:function(){return le.config}});var fe=r(2605);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return fe.audit}});var de=r(4152);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return de.auditTime}});var he=r(5149);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return he.buffer}});var pe=r(3189);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return pe.bufferCount}});var be=r(9459);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return be.bufferTime}});var me=r(8145);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return me.bufferToggle}});var ge=r(7764);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return ge.bufferWhen}});var ve=r(3056);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return ve.catchError}});var ye=r(498);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return ye.combineAll}});var _e=r(7484);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return _e.combineLatestAll}});var we=r(4755);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return we.combineLatestWith}});var Ee=r(482);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return Ee.concatAll}});var Oe=r(1774);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return Oe.concatMap}});var Ae=r(3977);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return Ae.concatMapTo}});var Se=r(7672);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return Se.concatWith}});var Pe=r(5561);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return Pe.connect}});var Te=r(8259);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return Te.count}});var Ie=r(3473);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return Ie.debounce}});var Re=r(8390);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return Re.debounceTime}});var xe=r(4562);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return xe.defaultIfEmpty}});var Me=r(8151);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return Me.delay}});var ke=r(744);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return ke.delayWhen}});var Le=r(8590);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return Le.dematerialize}});var Ne=r(8406);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return Ne.distinct}});var Ce=r(7300);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return Ce.distinctUntilChanged}});var je=r(4405);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return je.distinctUntilKeyChanged}});var De=r(2787);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return De.elementAt}});var Ue=r(1665);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return Ue.endWith}});var Be=r(1511);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return Be.every}});var Fe=r(5592);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return Fe.exhaust}});var Ke=r(2008);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return Ke.exhaustAll}});var He=r(4019);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return He.exhaustMap}});var Ge=r(9101);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return Ge.expand}});var $e=r(7261);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return $e.filter}});var Ve=r(5381);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return Ve.finalize}});var ze=r(4127);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return ze.find}});var qe=r(9727);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return qe.findIndex}});var We=r(7418);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return We.first}});var Ze=r(7533);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return Ze.groupBy}});var Je=r(9186);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return Je.ignoreElements}});var Ye=r(7757);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Ye.isEmpty}});var Xe=r(3374);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return Xe.last}});var Qe=r(6269);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return Qe.map}});var et=r(5471);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return et.mapTo}});var tt=r(1160);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return tt.materialize}});var rt=r(1890);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return rt.max}});var nt=r(400);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return nt.mergeAll}});var it=r(9121);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return it.flatMap}});var ot=r(6086);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ot.mergeMap}});var st=r(1244);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return st.mergeMapTo}});var at=r(3699);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return at.mergeScan}});var ct=r(8220);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ct.mergeWith}});var ut=r(770);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ut.min}});var lt=r(8413);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return lt.multicast}});var ft=r(9314);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return ft.observeOn}});var dt=r(1899);Object.defineProperty(t,"onErrorResumeNextWith",{enumerable:!0,get:function(){return dt.onErrorResumeNextWith}});var ht=r(1186);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ht.pairwise}});var pt=r(9532);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return pt.pluck}});var bt=r(5745);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return bt.publish}});var mt=r(8103);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return mt.publishBehavior}});var gt=r(2610);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return gt.publishLast}});var vt=r(5299);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return vt.publishReplay}});var yt=r(3820);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return yt.raceWith}});var _t=r(8083);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return _t.reduce}});var wt=r(2588);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return wt.repeat}});var Et=r(9249);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return Et.repeatWhen}});var Ot=r(4486);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return Ot.retry}});var At=r(9112);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return At.retryWhen}});var St=r(4508);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return St.refCount}});var Pt=r(778);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Pt.sample}});var Tt=r(7701);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Tt.sampleTime}});var It=r(8167);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return It.scan}});var Rt=r(7821);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Rt.sequenceEqual}});var xt=r(2645);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return xt.share}});var Mt=r(7566);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Mt.shareReplay}});var kt=r(4610);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return kt.single}});var Lt=r(5735);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return Lt.skip}});var Nt=r(3252);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return Nt.skipLast}});var Ct=r(1779);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return Ct.skipUntil}});var jt=r(5454);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return jt.skipWhile}});var Dt=r(1923);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Dt.startWith}});var Ut=r(9130);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ut.subscribeOn}});var Bt=r(1695);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Bt.switchAll}});var Ft=r(6649);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Ft.switchMap}});var Kt=r(3054);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return Kt.switchMapTo}});var Ht=r(2890);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Ht.switchScan}});var Gt=r(9438);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Gt.take}});var $t=r(4125);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return $t.takeLast}});var Vt=r(9008);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Vt.takeUntil}});var zt=r(5884);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return zt.takeWhile}});var qt=r(5383);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return qt.tap}});var Wt=r(1016);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Wt.throttle}});var Zt=r(567);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return Zt.throttleTime}});var Jt=r(1332);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return Jt.throwIfEmpty}});var Yt=r(1149);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Yt.timeInterval}});var Xt=r(1316);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return Xt.timeout}});var Qt=r(4972);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Qt.timeoutWith}});var er=r(1275);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return er.timestamp}});var tr=r(9867);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return tr.toArray}});var rr=r(7649);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return rr.window}});var nr=r(5612);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return nr.windowCount}});var ir=r(9972);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return ir.windowTime}});var or=r(9593);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return or.windowToggle}});var sr=r(6307);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return sr.windowWhen}});var ar=r(5512);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return ar.withLatestFrom}});var cr=r(1221);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return cr.zipAll}});var ur=r(7594);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return ur.zipWith}})},9960:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return i(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,a=t._isComplete;r?e.error(o):(s||a)&&(n&&e.next(i),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))},t}(r(5294).Subject);t.AsyncSubject=o},8114:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var o=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(r(5294).Subject);t.BehaviorSubject=o},9828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n=r(6929),i=r(1377),o=r(40),s=r(2935);!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(t.NotificationKind||(t.NotificationKind={}));var a=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){return c(this,e)},e.prototype.do=function(e,t,r){var n=this,i=n.kind,o=n.value,s=n.error;return"N"===i?null==e?void 0:e(o):"E"===i?null==t?void 0:t(s):null==r?void 0:r()},e.prototype.accept=function(e,t,r){var n;return s.isFunction(null===(n=e)||void 0===n?void 0:n.next)?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){var e=this,t=e.kind,r=e.value,s=e.error,a="N"===t?i.of(r):"E"===t?o.throwError((function(){return s})):"C"===t?n.EMPTY:0;if(!a)throw new TypeError("Unexpected notification kind "+t);return a},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function c(e,t){var r,n,i,o=e,s=o.kind,a=o.value,c=o.error;if("string"!=typeof s)throw new TypeError('Invalid notification, missing "kind"');"N"===s?null===(r=t.next)||void 0===r||r.call(t,a):"E"===s?null===(n=t.error)||void 0===n||n.call(t,c):null===(i=t.complete)||void 0===i||i.call(t)}t.Notification=a,t.observeNotification=c},3005:(e,t)=>{"use strict";function r(e,t,r){return{kind:e,value:t,error:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.createNotification=t.nextNotification=t.errorNotification=t.COMPLETE_NOTIFICATION=void 0,t.COMPLETE_NOTIFICATION=r("C",void 0,void 0),t.errorNotification=function(e){return r("E",void 0,e)},t.nextNotification=function(e){return r("N",e,void 0)},t.createNotification=r},4174:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(7747),i=r(4666),o=r(4595),s=r(5250),a=r(9179),c=r(2935),u=r(5444),l=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,s=this,a=(o=e)&&o instanceof n.Subscriber||function(e){return e&&c.isFunction(e.next)&&c.isFunction(e.error)&&c.isFunction(e.complete)}(o)&&i.isSubscription(o)?e:new n.SafeSubscriber(e,t,r);return u.errorContext((function(){var e=s,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?s._subscribe(a):s._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=f(t))((function(t,i){var o=new n.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),o.unsubscribe()}},error:i,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(9168),i=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=n.dateTimestampProvider.now,e}();t.Scheduler=i},5294:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSubject=t.Subject=void 0;var s=r(4174),a=r(4666),c=r(8499),u=r(1291),l=r(5444),f=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(t,e),t.prototype.lift=function(e){var t=new d(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new c.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;l.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),s=i.next();!s.done;s=i.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;l.errorContext((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;l.errorContext((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?a.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new a.Subscription((function(){t.currentObservers=null,u.arrRemove(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new s.Observable;return e.source=this,e},t.create=function(e,t){return new d(e,t)},t}(s.Observable);t.Subject=f;var d=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:a.EMPTY_SUBSCRIPTION},t}(f);t.AnonymousSubject=d},7747:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var o=r(2935),s=r(4666),a=r(9179),c=r(1600),u=r(7116),l=r(3005),f=r(1577),d=r(5444),h=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,s.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return i(r,e),r.create=function(e,t,r){return new g(e,t,r)},r.prototype.next=function(e){this.isStopped?y(l.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?y(l.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?y(l.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(e){this.destination.next(e)},r.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(s.Subscription);t.Subscriber=h;var p=Function.prototype.bind;function b(e,t){return p.call(e,t)}var m=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){v(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){v(e)}else v(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){v(e)}},e}(),g=function(e){function t(t,r,n){var i,s,c=e.call(this)||this;o.isFunction(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:c&&a.config.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return c.unsubscribe()},i={next:t.next&&b(t.next,s),error:t.error&&b(t.error,s),complete:t.complete&&b(t.complete,s)}):i=t;return c.destination=new m(i),c}return i(t,e),t}(h);function v(e){a.config.useDeprecatedSynchronousErrorHandling?d.captureError(e):c.reportUnhandledError(e)}function y(e,t){var r=a.config.onStoppedNotification;r&&f.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=g,t.EMPTY_OBSERVER={closed:!0,next:u.noop,error:function(e){throw e},complete:u.noop}},4666:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=void 0,t.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},7327:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.firstValueFrom=void 0;var n=r(9088),i=r(7747);t.firstValueFrom=function(e,t){var r="object"==typeof t;return new Promise((function(o,s){var a=new i.SafeSubscriber({next:function(e){o(e),a.unsubscribe()},error:s,complete:function(){r?o(t.defaultValue):s(new n.EmptyError)}});e.subscribe(a)}))}},4798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lastValueFrom=void 0;var n=r(9088);t.lastValueFrom=function(e,t){var r="object"==typeof t;return new Promise((function(i,o){var s,a=!1;e.subscribe({next:function(e){s=e,a=!0},error:o,complete:function(){a?i(s):r?i(t.defaultValue):o(new n.EmptyError)}})}))}},7165:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var o=r(4174),s=r(4666),a=r(4508),c=r(7326),u=r(6097),l=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,u.hasLift(t)&&(n.lift=t.lift),n}return i(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new s.Subscription;var r=this.getSubject();t.add(this.source.subscribe(c.createOperatorSubscriber(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=s.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return a.refCount()(this)},t}(o.Observable);t.ConnectableObservable=l},6238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindCallback=void 0;var n=r(9706);t.bindCallback=function(e,t,r){return n.bindCallbackInternals(!1,e,t,r)}},9706:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindNodeCallback=void 0;var n=r(9706);t.bindNodeCallback=function(e,t,r){return n.bindCallbackInternals(!0,e,t,r)}},508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(4174),i=r(2398),o=r(4417),s=r(8987),a=r(9364),c=r(4544),u=r(4800),l=r(7326),f=r(5267);function d(e,t,r){return void 0===r&&(r=s.identity),function(n){h(t,(function(){for(var i=e.length,s=new Array(i),a=i,c=i,u=function(i){h(t,(function(){var u=o.from(e[i],t),f=!1;u.subscribe(l.createOperatorSubscriber(n,(function(e){s[i]=e,f||(f=!0,c--),c||n.next(r(s.slice()))}),(function(){--a||n.complete()})))}),n)},f=0;f{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(482),i=r(4544),o=r(4417);t.concat=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connectable=void 0;var n=r(5294),i=r(4174),o=r(9623),s={connector:function(){return new n.Subject},resetOnDisconnect:!0};t.connectable=function(e,t){void 0===t&&(t=s);var r=null,n=t.connector,a=t.resetOnDisconnect,c=void 0===a||a,u=n(),l=new i.Observable((function(e){return u.subscribe(e)}));return l.connect=function(){return r&&!r.closed||(r=o.defer((function(){return e})).subscribe(u),c&&r.add((function(){return u=n()}))),r},l}},9623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defer=void 0;var n=r(4174),i=r(6958);t.defer=function(e){return new n.Observable((function(t){i.innerFrom(e()).subscribe(t)}))}},2447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.animationFrames=void 0;var n=r(4174),i=r(2261),o=r(9015);function s(e){return new n.Observable((function(t){var r=e||i.performanceTimestampProvider,n=r.now(),s=0,a=function(){t.closed||(s=o.animationFrameProvider.requestAnimationFrame((function(i){s=0;var o=r.now();t.next({timestamp:e?o:i,elapsed:o-n}),a()})))};return a(),function(){s&&o.animationFrameProvider.cancelAnimationFrame(s)}}))}t.animationFrames=function(e){return e?s(e):a};var a=s()},6929:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(4174);t.EMPTY=new n.Observable((function(e){return e.complete()})),t.empty=function(e){return e?function(e){return new n.Observable((function(t){return e.schedule((function(){return t.complete()}))}))}(e):t.EMPTY}},9220:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.forkJoin=void 0;var n=r(4174),i=r(2398),o=r(6958),s=r(4544),a=r(7326),c=r(9364),u=r(4800);t.forkJoin=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(2862),i=r(6958);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},9671:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.fromEvent=void 0;var i=r(6958),o=r(4174),s=r(6086),a=r(5445),c=r(2935),u=r(9364),l=["addListener","removeListener"],f=["addEventListener","removeEventListener"],d=["on","off"];function h(e,t){return function(r){return function(n){return e[r](t,n)}}}t.fromEvent=function e(t,r,p,b){if(c.isFunction(p)&&(b=p,p=void 0),b)return e(t,r,p).pipe(u.mapOneOrManyArgs(b));var m=n(function(e){return c.isFunction(e.addEventListener)&&c.isFunction(e.removeEventListener)}(t)?f.map((function(e){return function(n){return t[e](r,n,p)}})):function(e){return c.isFunction(e.addListener)&&c.isFunction(e.removeListener)}(t)?l.map(h(t,r)):function(e){return c.isFunction(e.on)&&c.isFunction(e.off)}(t)?d.map(h(t,r)):[],2),g=m[0],v=m[1];if(!g&&a.isArrayLike(t))return s.mergeMap((function(t){return e(t,r,p)}))(i.innerFrom(t));if(!g)throw new TypeError("Invalid event target");return new o.Observable((function(e){var t=function(){for(var t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromEventPattern=void 0;var n=r(4174),i=r(2935),o=r(9364);t.fromEventPattern=function e(t,r,s){return s?e(t,r).pipe(o.mapOneOrManyArgs(s)):new n.Observable((function(e){var n=function(){for(var t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(4174);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},3482:function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iif=void 0;var n=r(9623);t.iif=function(e,t,r){return n.defer((function(){return e()?t:r}))}},6958:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.fromReadableStreamLike=t.fromAsyncIterable=t.fromIterable=t.fromPromise=t.fromArrayLike=t.fromInteropObservable=t.innerFrom=void 0;var a=r(5445),c=r(4283),u=r(4174),l=r(3124),f=r(3260),d=r(7756),h=r(8131),p=r(2221),b=r(2935),m=r(1600),g=r(4595);function v(e){return new u.Observable((function(t){var r=e[g.observable]();if(b.isFunction(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}))}function y(e){return new u.Observable((function(t){for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(7152),i=r(8069);t.interval=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=n.asyncScheduler),e<0&&(e=0),i.timer(e,e,t)}},2039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;var n=r(400),i=r(6958),o=r(6929),s=r(4544),a=r(4417);t.merge=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.never=t.NEVER=void 0;var n=r(4174),i=r(7116);t.NEVER=new n.Observable(i.noop),t.never=function(){return t.NEVER}},1377:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(4544),i=r(4417);t.of=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(4174),i=r(5034),o=r(7326),s=r(7116),a=r(6958);t.onErrorResumeNext=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairs=void 0;var n=r(4417);t.pairs=function(e,t){return n.from(Object.entries(e),t)}},6394:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(8781),i=r(7261),o=r(6958);t.partition=function(e,t,r){return[i.filter(t,r)(o.innerFrom(e)),i.filter(n.not(t,r))(o.innerFrom(e))]}},6849:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(4174),i=r(6958),o=r(5034),s=r(7326);function a(e){return function(t){for(var r=[],n=function(n){r.push(i.innerFrom(e[n]).subscribe(s.createOperatorSubscriber(t,(function(e){if(r){for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range=void 0;var n=r(4174),i=r(6929);t.range=function(e,t,r){if(null==t&&(t=e,e=0),t<=0)return i.EMPTY;var o=t+e;return new n.Observable(r?function(t){var n=e;return r.schedule((function(){n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(4174),i=r(2935);t.throwError=function(e,t){var r=i.isFunction(e)?e:function(){return e},o=function(e){return e.error(r())};return new n.Observable(t?function(e){return t.schedule(o,0,e)}:o)}},8069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(4174),i=r(7152),o=r(9668),s=r(4426);t.timer=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r=i.async);var a=-1;return null!=t&&(o.isScheduler(t)?r=t:a=t),new n.Observable((function(t){var n=s.isValidDate(e)?+e-r.now():e;n<0&&(n=0);var i=0;return r.schedule((function(){t.closed||(t.next(i++),0<=a?this.schedule(void 0,a):t.complete())}),n)}))}},3348:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.using=void 0;var n=r(4174),i=r(6958),o=r(6929);t.using=function(e,t){return new n.Observable((function(r){var n=e(),s=t(n);return(s?i.innerFrom(s):o.EMPTY).subscribe(r),function(){n&&n.unsubscribe()}}))}},4981:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(6097),i=r(6958),o=r(7326);t.audit=function(e){return n.operate((function(t,r){var n=!1,s=null,a=null,c=!1,u=function(){if(null==a||a.unsubscribe(),a=null,n){n=!1;var e=s;s=null,r.next(e)}c&&r.complete()},l=function(){a=null,c&&r.complete()};t.subscribe(o.createOperatorSubscriber(r,(function(t){n=!0,s=t,a||i.innerFrom(e(t)).subscribe(a=o.createOperatorSubscriber(r,u,l))}),(function(){c=!0,(!n||!a||a.closed)&&r.complete()})))}))}},4152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(7152),i=r(2605),o=r(8069);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},5149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.buffer=function(e){return n.operate((function(t,r){var n=[];return t.subscribe(o.createOperatorSubscriber(r,(function(e){return n.push(e)}),(function(){r.next(n),r.complete()}))),s.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){var e=n;n=[],r.next(e)}),i.noop)),function(){n=null}}))}},3189:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferCount=void 0;var i=r(6097),o=r(7326),s=r(1291);t.bufferCount=function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,i.operate((function(r,i){var a=[],c=0;r.subscribe(o.createOperatorSubscriber(i,(function(r){var o,u,l,f,d=null;c++%t==0&&a.push([]);try{for(var h=n(a),p=h.next();!p.done;p=h.next()){(g=p.value).push(r),e<=g.length&&(d=null!=d?d:[]).push(g)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(u=h.return)&&u.call(h)}finally{if(o)throw o.error}}if(d)try{for(var b=n(d),m=b.next();!m.done;m=b.next()){var g=m.value;s.arrRemove(a,g),i.next(g)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(f=b.return)&&f.call(b)}finally{if(l)throw l.error}}}),(function(){var e,t;try{for(var r=n(a),o=r.next();!o.done;o=r.next()){var s=o.value;i.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.complete()}),void 0,(function(){a=null})))}))}},9459:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferTime=void 0;var i=r(4666),o=r(6097),s=r(7326),a=r(1291),c=r(7152),u=r(4544),l=r(5267);t.bufferTime=function(e){for(var t,r,f=[],d=1;d=0?l.executeSchedule(r,h,f,p,!0):c=!0,f();var d=s.createOperatorSubscriber(r,(function(e){var t,r,i=o.slice();try{for(var s=n(i),a=s.next();!a.done;a=s.next()){var c=a.value,l=c.buffer;l.push(e),b<=l.length&&u(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}),(function(){for(;null==o?void 0:o.length;)r.next(o.shift().buffer);null==d||d.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return o=null}));t.subscribe(d)}))}},8145:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToggle=void 0;var i=r(4666),o=r(6097),s=r(6958),a=r(7326),c=r(7116),u=r(1291);t.bufferToggle=function(e,t){return o.operate((function(r,o){var l=[];s.innerFrom(e).subscribe(a.createOperatorSubscriber(o,(function(e){var r=[];l.push(r);var n=new i.Subscription;n.add(s.innerFrom(t(e)).subscribe(a.createOperatorSubscriber(o,(function(){u.arrRemove(l,r),o.next(r),n.unsubscribe()}),c.noop)))}),c.noop)),r.subscribe(a.createOperatorSubscriber(o,(function(e){var t,r;try{for(var i=n(l),o=i.next();!o.done;o=i.next()){o.value.push(e)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}),(function(){for(;l.length>0;)o.next(l.shift());o.complete()})))}))}},7764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.bufferWhen=function(e){return n.operate((function(t,r){var n=null,a=null,c=function(){null==a||a.unsubscribe();var t=n;n=[],t&&r.next(t),s.innerFrom(e()).subscribe(a=o.createOperatorSubscriber(r,c,i.noop))};c(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=a=null})))}))}},3056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(6958),i=r(7326),o=r(6097);t.catchError=function e(t){return o.operate((function(r,o){var s,a=null,c=!1;a=r.subscribe(i.createOperatorSubscriber(o,void 0,void 0,(function(i){s=n.innerFrom(t(i,e(t)(r))),a?(a.unsubscribe(),a=null,s.subscribe(o)):c=!0}))),c&&(a.unsubscribe(),a=null,s.subscribe(o))}))}},498:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(7484);t.combineAll=n.combineLatestAll},6527:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(508),i=r(2208);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},4755:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(400);t.concatAll=function(){return n.mergeAll(1)}},1774:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(6086),i=r(2935);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},3977:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1774),i=r(2935);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},7672:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(5294),i=r(6958),o=r(6097),s=r(6884),a={connector:function(){return new n.Subject}};t.connect=function(e,t){void 0===t&&(t=a);var r=t.connector;return o.operate((function(t,n){var o=r();i.innerFrom(e(s.fromSubscribable(o))).subscribe(n),n.add(t.subscribe(o))}))}},8259:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(8083);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},3473:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.debounce=function(e){return n.operate((function(t,r){var n=!1,a=null,c=null,u=function(){if(null==c||c.unsubscribe(),c=null,n){n=!1;var e=a;a=null,r.next(e)}};t.subscribe(o.createOperatorSubscriber(r,(function(t){null==c||c.unsubscribe(),n=!0,a=t,c=o.createOperatorSubscriber(r,u,i.noop),s.innerFrom(e(t)).subscribe(c)}),(function(){u(),r.complete()}),void 0,(function(){a=c=null})))}))}},8390:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(7152),i=r(6097),o=r(7326);t.debounceTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.operate((function(r,n){var i=null,s=null,a=null,c=function(){if(i){i.unsubscribe(),i=null;var e=s;s=null,n.next(e)}};function u(){var r=a+e,o=t.now();if(o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(6097),i=r(7326);t.defaultIfEmpty=function(e){return n.operate((function(t,r){var n=!1;t.subscribe(i.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){n||r.next(e),r.complete()})))}))}},8151:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(7152),i=r(744),o=r(8069);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(3364),i=r(9438),o=r(9186),s=r(5471),a=r(6086),c=r(6958);t.delayWhen=function e(t,r){return r?function(s){return n.concat(r.pipe(i.take(1),o.ignoreElements()),s.pipe(e(t)))}:a.mergeMap((function(e,r){return c.innerFrom(t(e,r)).pipe(i.take(1),s.mapTo(e))}))}},8590:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(9828),i=r(6097),o=r(7326);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},8406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(6097),i=r(7326),o=r(7116),s=r(6958);t.distinct=function(e,t){return n.operate((function(r,n){var a=new Set;r.subscribe(i.createOperatorSubscriber(n,(function(t){var r=e?e(t):t;a.has(r)||(a.add(r),n.next(t))}))),t&&s.innerFrom(t).subscribe(i.createOperatorSubscriber(n,(function(){return a.clear()}),o.noop))}))}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(8987),i=r(6097),o=r(7326);function s(e,t){return e===t}t.distinctUntilChanged=function(e,t){return void 0===t&&(t=n.identity),e=null!=e?e:s,i.operate((function(r,n){var i,s=!0;r.subscribe(o.createOperatorSubscriber(n,(function(r){var o=t(r);!s&&e(i,o)||(s=!1,i=o,n.next(r))})))}))}},4405:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(7300);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},2787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(9216),i=r(7261),o=r(1332),s=r(4562),a=r(9438);t.elementAt=function(e,t){if(e<0)throw new n.ArgumentOutOfRangeError;var r=arguments.length>=2;return function(c){return c.pipe(i.filter((function(t,r){return r===e})),a.take(1),r?s.defaultIfEmpty(t):o.throwIfEmpty((function(){return new n.ArgumentOutOfRangeError})))}}},1665:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(6097),i=r(7326);t.every=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(i){e.call(t,i,o++,r)||(n.next(!1),n.complete())}),(function(){n.next(!0),n.complete()})))}))}},5592:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(2008);t.exhaust=n.exhaustAll},2008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(4019),i=r(8987);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},4019:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(6269),i=r(6958),o=r(6097),s=r(7326);t.exhaustMap=function e(t,r){return r?function(o){return o.pipe(e((function(e,o){return i.innerFrom(t(e,o)).pipe(n.map((function(t,n){return r(e,t,o,n)})))})))}:o.operate((function(e,r){var n=0,o=null,a=!1;e.subscribe(s.createOperatorSubscriber(r,(function(e){o||(o=s.createOperatorSubscriber(r,void 0,(function(){o=null,a&&r.complete()})),i.innerFrom(t(e,n++)).subscribe(o))}),(function(){a=!0,!o&&r.complete()})))}))}},9101:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(6097),i=r(5926);t.expand=function(e,t,r){return void 0===t&&(t=1/0),t=(t||0)<1?1/0:t,n.operate((function(n,o){return i.mergeInternals(n,o,e,t,void 0,!0,r)}))}},7261:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(6097),i=r(7326);t.filter=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}},5381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(6097);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},4127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(6097),i=r(7326);function o(e,t,r){var n="index"===r;return function(r,o){var s=0;r.subscribe(i.createOperatorSubscriber(o,(function(i){var a=s++;e.call(t,i,a,r)&&(o.next(n?a:i),o.complete())}),(function(){o.next(n?-1:void 0),o.complete()})))}}t.find=function(e,t){return n.operate(o(e,t,"value"))},t.createFind=o},9727:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(6097),i=r(4127);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},7418:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(9088),i=r(7261),o=r(9438),s=r(4562),a=r(1332),c=r(8987);t.first=function(e,t){var r=arguments.length>=2;return function(u){return u.pipe(e?i.filter((function(t,r){return e(t,r,u)})):c.identity,o.take(1),r?s.defaultIfEmpty(t):a.throwIfEmpty((function(){return new n.EmptyError})))}}},9121:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(6086);t.flatMap=n.mergeMap},7533:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(4174),i=r(6958),o=r(5294),s=r(6097),a=r(7326);t.groupBy=function(e,t,r,c){return s.operate((function(s,u){var l;t&&"function"!=typeof t?(r=t.duration,l=t.element,c=t.connector):l=t;var f=new Map,d=function(e){f.forEach(e),e(u)},h=function(e){return d((function(t){return t.error(e)}))},p=0,b=!1,m=new a.OperatorSubscriber(u,(function(t){try{var s=e(t),d=f.get(s);if(!d){f.set(s,d=c?c():new o.Subject);var g=(y=s,_=d,(w=new n.Observable((function(e){p++;var t=_.subscribe(e);return function(){t.unsubscribe(),0==--p&&b&&m.unsubscribe()}}))).key=y,w);if(u.next(g),r){var v=a.createOperatorSubscriber(d,(function(){d.complete(),null==v||v.unsubscribe()}),void 0,void 0,(function(){return f.delete(s)}));m.add(i.innerFrom(r(g)).subscribe(v))}}d.next(l?l(t):t)}catch(e){h(e)}var y,_,w}),(function(){return d((function(e){return e.complete()}))}),h,(function(){return f.clear()}),(function(){return b=!0,0===p}));s.subscribe(m)}))}},9186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(6097),i=r(7326),o=r(7116);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},7757:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(6097),i=r(7326);t.isEmpty=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}},2208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(8987),i=r(9364),o=r(5250),s=r(6086),a=r(9867);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},3374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(9088),i=r(7261),o=r(4125),s=r(1332),a=r(4562),c=r(8987);t.last=function(e,t){var r=arguments.length>=2;return function(u){return u.pipe(e?i.filter((function(t,r){return e(t,r,u)})):c.identity,o.takeLast(1),r?a.defaultIfEmpty(t):s.throwIfEmpty((function(){return new n.EmptyError})))}}},6269:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(6097),i=r(7326);t.map=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){n.next(e.call(t,r,o++))})))}))}},5471:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(6269);t.mapTo=function(e){return n.map((function(){return e}))}},1160:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(9828),i=r(6097),o=r(7326);t.materialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){t.next(n.Notification.createNext(e))}),(function(){t.next(n.Notification.createComplete()),t.complete()}),(function(e){t.next(n.Notification.createError(e)),t.complete()})))}))}},1890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(8083),i=r(2935);t.max=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}},3982:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(6086),i=r(8987);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},5926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(6958),i=r(5267),o=r(7326);t.mergeInternals=function(e,t,r,s,a,c,u,l){var f=[],d=0,h=0,p=!1,b=function(){!p||f.length||d||t.complete()},m=function(e){return d{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(6269),i=r(6958),o=r(6097),s=r(5926),a=r(2935);t.mergeMap=function e(t,r,c){return void 0===c&&(c=1/0),a.isFunction(r)?e((function(e,o){return n.map((function(t,n){return r(e,t,o,n)}))(i.innerFrom(t(e,o)))}),c):("number"==typeof r&&(c=r),o.operate((function(e,r){return s.mergeInternals(e,r,t,c)})))}},1244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(6086),i=r(2935);t.mergeMapTo=function(e,t,r){return void 0===r&&(r=1/0),i.isFunction(t)?n.mergeMap((function(){return e}),t,r):("number"==typeof t&&(r=t),n.mergeMap((function(){return e}),r))}},3699:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(6097),i=r(5926);t.mergeScan=function(e,t,r){return void 0===r&&(r=1/0),n.operate((function(n,o){var s=t;return i.mergeInternals(n,o,(function(t,r){return e(s,t,r)}),r,(function(e){s=e}),!1,void 0,(function(){return s=null}))}))}},8220:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(8083),i=r(2935);t.min=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)<0?t:r}:function(e,t){return e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(7165),i=r(2935),o=r(5561);t.multicast=function(e,t){var r=i.isFunction(e)?e:function(){return e};return i.isFunction(t)?o.connect(t,{connector:r}):function(e){return new n.ConnectableObservable(e,r)}}},9314:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5267),i=r(6097),o=r(7326);t.observeOn=function(e,t){return void 0===t&&(t=0),i.operate((function(r,i){r.subscribe(o.createOperatorSubscriber(i,(function(r){return n.executeSchedule(i,e,(function(){return i.next(r)}),t)}),(function(){return n.executeSchedule(i,e,(function(){return i.complete()}),t)}),(function(r){return n.executeSchedule(i,e,(function(){return i.error(r)}),t)})))}))}},1899:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(6097),i=r(7326);t.pairwise=function(){return n.operate((function(e,t){var r,n=!1;e.subscribe(i.createOperatorSubscriber(t,(function(e){var i=r;r=e,n&&t.next([i,e]),n=!0})))}))}},9857:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(8781),i=r(7261);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},9532:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(6269);t.pluck=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(5294),i=r(8413),o=r(5561);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},8103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(8114),i=r(7165);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},2610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(9960),i=r(7165);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},5299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(8806),i=r(8413),o=r(2935);t.publishReplay=function(e,t,r,s){r&&!o.isFunction(r)&&(s=r);var a=o.isFunction(r)?r:void 0;return function(r){return i.multicast(new n.ReplaySubject(e,t,s),a)(r)}}},6699:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(7235),i=r(6097);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},4508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(6097),i=r(7326);t.refCount=function(){return n.operate((function(e,t){var r=null;e._refCount++;var n=i.createOperatorSubscriber(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))}},2588:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(6929),i=r(6097),o=r(7326),s=r(6958),a=r(8069);t.repeat=function(e){var t,r,c=1/0;return null!=e&&("object"==typeof e?(t=e.count,c=void 0===t?1/0:t,r=e.delay):c=e),c<=0?function(){return n.EMPTY}:i.operate((function(e,t){var n,i=0,u=function(){if(null==n||n.unsubscribe(),n=null,null!=r){var e="number"==typeof r?a.timer(r):s.innerFrom(r(i)),c=o.createOperatorSubscriber(t,(function(){c.unsubscribe(),l()}));e.subscribe(c)}else l()},l=function(){var r=!1;n=e.subscribe(o.createOperatorSubscriber(t,void 0,(function(){++i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(6958),i=r(5294),o=r(6097),s=r(7326);t.repeatWhen=function(e){return o.operate((function(t,r){var o,a,c=!1,u=!1,l=!1,f=function(){return l&&u&&(r.complete(),!0)},d=function(){l=!1,o=t.subscribe(s.createOperatorSubscriber(r,void 0,(function(){l=!0,!f()&&(a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){o?d():c=!0}),(function(){u=!0,f()})))),a).next()}))),c&&(o.unsubscribe(),o=null,c=!1,d())};d()}))}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(6097),i=r(7326),o=r(8987),s=r(8069),a=r(6958);t.retry=function(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,c=void 0===r?1/0:r,u=t.delay,l=t.resetOnSuccess,f=void 0!==l&&l;return c<=0?o.identity:n.operate((function(e,t){var r,n=0,o=function(){var l=!1;r=e.subscribe(i.createOperatorSubscriber(t,(function(e){f&&(n=0),t.next(e)}),void 0,(function(e){if(n++{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(6958),i=r(5294),o=r(6097),s=r(7326);t.retryWhen=function(e){return o.operate((function(t,r){var o,a,c=!1,u=function(){o=t.subscribe(s.createOperatorSubscriber(r,void 0,void 0,(function(t){a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){return o?u():c=!0})))),a&&a.next(t)}))),c&&(o.unsubscribe(),o=null,c=!1,u())};u()}))}},778:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(6958),i=r(6097),o=r(7116),s=r(7326);t.sample=function(e){return i.operate((function(t,r){var i=!1,a=null;t.subscribe(s.createOperatorSubscriber(r,(function(e){i=!0,a=e}))),n.innerFrom(e).subscribe(s.createOperatorSubscriber(r,(function(){if(i){i=!1;var e=a;a=null,r.next(e)}}),o.noop))}))}},7701:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(7152),i=r(778),o=r(3154);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},8167:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(6097),i=r(7235);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},7235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(7326);t.scanInternals=function(e,t,r,i,o){return function(s,a){var c=r,u=t,l=0;s.subscribe(n.createOperatorSubscriber(a,(function(t){var r=l++;u=c?e(u,t,r):(c=!0,t),i&&a.next(u)}),o&&function(){c&&a.next(u),a.complete()}))}}},7821:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(6097),i=r(7326),o=r(6958);t.sequenceEqual=function(e,t){return void 0===t&&(t=function(e,t){return e===t}),n.operate((function(r,n){var s={buffer:[],complete:!1},a={buffer:[],complete:!1},c=function(e){n.next(e),n.complete()},u=function(e,r){var o=i.createOperatorSubscriber(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?c(!1):e.buffer.push(n):!t(n,i.shift())&&c(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&c(0===n.length),null==o||o.unsubscribe()}));return o};r.subscribe(u(s,a)),o.innerFrom(e).subscribe(u(a,s))}))}},2645:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0&&(t=new a.SafeSubscriber({next:function(e){return v.next(e)},error:function(e){p=!0,b(),n=u(m,i,e),v.error(e)},complete:function(){d=!0,b(),n=u(m,f),v.complete()}}),o.innerFrom(e).subscribe(t))}))(e)}}},7566:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(8806),i=r(2645);t.shareReplay=function(e,t,r){var o,s,a,c,u=!1;return e&&"object"==typeof e?(o=e.bufferSize,c=void 0===o?1/0:o,s=e.windowTime,t=void 0===s?1/0:s,u=void 0!==(a=e.refCount)&&a,r=e.scheduler):c=null!=e?e:1/0,i.share({connector:function(){return new n.ReplaySubject(c,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}},4610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(9088),i=r(7298),o=r(5722),s=r(6097),a=r(7326);t.single=function(e){return s.operate((function(t,r){var s,c=!1,u=!1,l=0;t.subscribe(a.createOperatorSubscriber(r,(function(n){u=!0,e&&!e(n,l++,t)||(c&&r.error(new i.SequenceError("Too many matching values")),c=!0,s=n)}),(function(){c?(r.next(s),r.complete()):r.error(u?new o.NotFoundError("No matching values"):new n.EmptyError)})))}))}},5735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(7261);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},3252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(8987),i=r(6097),o=r(7326);t.skipLast=function(e){return e<=0?n.identity:i.operate((function(t,r){var n=new Array(e),i=0;return t.subscribe(o.createOperatorSubscriber(r,(function(t){var o=i++;if(o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(6097),i=r(7326),o=r(6958),s=r(7116);t.skipUntil=function(e){return n.operate((function(t,r){var n=!1,a=i.createOperatorSubscriber(r,(function(){null==a||a.unsubscribe(),n=!0}),s.noop);o.innerFrom(e).subscribe(a),t.subscribe(i.createOperatorSubscriber(r,(function(e){return n&&r.next(e)})))}))}},5454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(6097),i=r(7326);t.skipWhile=function(e){return n.operate((function(t,r){var n=!1,o=0;t.subscribe(i.createOperatorSubscriber(r,(function(t){return(n||(n=!e(t,o++)))&&r.next(t)})))}))}},1923:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(3364),i=r(4544),o=r(6097);t.startWith=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(6097);t.subscribeOn=function(e,t){return void 0===t&&(t=0),n.operate((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}},1695:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(6649),i=r(8987);t.switchAll=function(){return n.switchMap(i.identity)}},6649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(6958),i=r(6097),o=r(7326);t.switchMap=function(e,t){return i.operate((function(r,i){var s=null,a=0,c=!1,u=function(){return c&&!s&&i.complete()};r.subscribe(o.createOperatorSubscriber(i,(function(r){null==s||s.unsubscribe();var c=0,l=a++;n.innerFrom(e(r,l)).subscribe(s=o.createOperatorSubscriber(i,(function(e){return i.next(t?t(r,e,l,c++):e)}),(function(){s=null,u()})))}),(function(){c=!0,u()})))}))}},3054:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(6649),i=r(2935);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},2890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(6649),i=r(6097);t.switchScan=function(e,t){return i.operate((function(r,i){var o=t;return n.switchMap((function(t,r){return e(o,t,r)}),(function(e,t){return o=t,t}))(r).subscribe(i),function(){o=null}}))}},9438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(6929),i=r(6097),o=r(7326);t.take=function(e){return e<=0?function(){return n.EMPTY}:i.operate((function(t,r){var n=0;t.subscribe(o.createOperatorSubscriber(r,(function(t){++n<=e&&(r.next(t),e<=n&&r.complete())})))}))}},4125:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.takeLast=void 0;var i=r(6929),o=r(6097),s=r(7326);t.takeLast=function(e){return e<=0?function(){return i.EMPTY}:o.operate((function(t,r){var i=[];t.subscribe(s.createOperatorSubscriber(r,(function(t){i.push(t),e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(6097),i=r(7326),o=r(6958),s=r(7116);t.takeUntil=function(e){return n.operate((function(t,r){o.innerFrom(e).subscribe(i.createOperatorSubscriber(r,(function(){return r.complete()}),s.noop)),!r.closed&&t.subscribe(r)}))}},5884:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(6097),i=r(7326);t.takeWhile=function(e,t){return void 0===t&&(t=!1),n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){var i=e(r,o++);(i||t)&&n.next(r),!i&&n.complete()})))}))}},5383:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(2935),i=r(6097),o=r(7326),s=r(8987);t.tap=function(e,t,r){var a=n.isFunction(e)||t||r?{next:e,error:t,complete:r}:e;return a?i.operate((function(e,t){var r;null===(r=a.subscribe)||void 0===r||r.call(a);var n=!0;e.subscribe(o.createOperatorSubscriber(t,(function(e){var r;null===(r=a.next)||void 0===r||r.call(a,e),t.next(e)}),(function(){var e;n=!1,null===(e=a.complete)||void 0===e||e.call(a),t.complete()}),(function(e){var r;n=!1,null===(r=a.error)||void 0===r||r.call(a,e),t.error(e)}),(function(){var e,t;n&&(null===(e=a.unsubscribe)||void 0===e||e.call(a)),null===(t=a.finalize)||void 0===t||t.call(a)})))})):s.identity}},1016:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(6097),i=r(7326),o=r(6958);t.throttle=function(e,t){return n.operate((function(r,n){var s=null!=t?t:{},a=s.leading,c=void 0===a||a,u=s.trailing,l=void 0!==u&&u,f=!1,d=null,h=null,p=!1,b=function(){null==h||h.unsubscribe(),h=null,l&&(v(),p&&n.complete())},m=function(){h=null,p&&n.complete()},g=function(t){return h=o.innerFrom(e(t)).subscribe(i.createOperatorSubscriber(n,b,m))},v=function(){if(f){f=!1;var e=d;d=null,n.next(e),!p&&g(e)}};r.subscribe(i.createOperatorSubscriber(n,(function(e){f=!0,d=e,(!h||h.closed)&&(c?v():g(e))}),(function(){p=!0,(!(l&&f&&h)||h.closed)&&n.complete()})))}))}},567:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(7152),i=r(1016),o=r(8069);t.throttleTime=function(e,t,r){void 0===t&&(t=n.asyncScheduler);var s=o.timer(e,t);return i.throttle((function(){return s}),r)}},1332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(9088),i=r(6097),o=r(7326);function s(){return new n.EmptyError}t.throwIfEmpty=function(e){return void 0===e&&(e=s),i.operate((function(t,r){var n=!1;t.subscribe(o.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){return n?r.complete():r.error(e())})))}))}},1149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(7152),i=r(6097),o=r(7326);t.timeInterval=function(e){return void 0===e&&(e=n.asyncScheduler),i.operate((function(t,r){var n=e.now();t.subscribe(o.createOperatorSubscriber(r,(function(t){var i=e.now(),o=i-n;n=i,r.next(new s(t,o))})))}))};var s=function(e,t){this.value=e,this.interval=t};t.TimeInterval=s},1316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(7152),i=r(4426),o=r(6097),s=r(6958),a=r(3126),c=r(7326),u=r(5267);function l(e){throw new t.TimeoutError(e)}t.TimeoutError=a.createErrorClass((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),t.timeout=function(e,t){var r=i.isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,a=r.first,f=r.each,d=r.with,h=void 0===d?l:d,p=r.scheduler,b=void 0===p?null!=t?t:n.asyncScheduler:p,m=r.meta,g=void 0===m?null:m;if(null==a&&null==f)throw new TypeError("No timeout provided.");return o.operate((function(e,t){var r,n,i=null,o=0,l=function(e){n=u.executeSchedule(t,b,(function(){try{r.unsubscribe(),s.innerFrom(h({meta:g,lastValue:i,seen:o})).subscribe(t)}catch(e){t.error(e)}}),e)};r=e.subscribe(c.createOperatorSubscriber(t,(function(e){null==n||n.unsubscribe(),o++,t.next(i=e),f>0&&l(f)}),void 0,void 0,(function(){(null==n?void 0:n.closed)||null==n||n.unsubscribe(),i=null}))),!o&&l(null!=a?"number"==typeof a?a:+a-b.now():f)}))}},4972:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(7152),i=r(4426),o=r(1316);t.timeoutWith=function(e,t,r){var s,a,c;if(r=null!=r?r:n.async,i.isValidDate(e)?s=e:"number"==typeof e&&(a=e),!t)throw new TypeError("No observable provided to switch to");if(c=function(){return t},null==s&&null==a)throw new TypeError("No timeout provided.");return o.timeout({first:s,each:a,scheduler:r,with:c})}},1275:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(9168),i=r(6269);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},9867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(8083),i=r(6097),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},7649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(5294),i=r(6097),o=r(7326),s=r(7116),a=r(6958);t.window=function(e){return i.operate((function(t,r){var i=new n.Subject;r.next(i.asObservable());var c=function(e){i.error(e),r.error(e)};return t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==i?void 0:i.next(e)}),(function(){i.complete(),r.complete()}),c)),a.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){i.complete(),r.next(i=new n.Subject)}),s.noop,c)),function(){null==i||i.unsubscribe(),i=null}}))}},5612:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowCount=void 0;var i=r(5294),o=r(6097),s=r(7326);t.windowCount=function(e,t){void 0===t&&(t=0);var r=t>0?t:e;return o.operate((function(t,o){var a=[new i.Subject],c=0;o.next(a[0].asObservable()),t.subscribe(s.createOperatorSubscriber(o,(function(t){var s,u;try{for(var l=n(a),f=l.next();!f.done;f=l.next()){f.value.next(t)}}catch(e){s={error:e}}finally{try{f&&!f.done&&(u=l.return)&&u.call(l)}finally{if(s)throw s.error}}var d=c-e+1;if(d>=0&&d%r==0&&a.shift().complete(),++c%r==0){var h=new i.Subject;a.push(h),o.next(h.asObservable())}}),(function(){for(;a.length>0;)a.shift().complete();o.complete()}),(function(e){for(;a.length>0;)a.shift().error(e);o.error(e)}),(function(){null,a=null})))}))}},9972:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(5294),i=r(7152),o=r(4666),s=r(6097),a=r(7326),c=r(1291),u=r(4544),l=r(5267);t.windowTime=function(e){for(var t,r,f=[],d=1;d=0?l.executeSchedule(r,h,f,p,!0):s=!0,f();var d=function(e){return i.slice().forEach(e)},m=function(e){d((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(a.createOperatorSubscriber(r,(function(e){d((function(t){t.window.next(e),b<=++t.seen&&u(t)}))}),(function(){return m((function(e){return e.complete()}))}),(function(e){return m((function(t){return t.error(e)}))}))),function(){i=null}}))}},9593:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowToggle=void 0;var i=r(5294),o=r(4666),s=r(6097),a=r(6958),c=r(7326),u=r(7116),l=r(1291);t.windowToggle=function(e,t){return s.operate((function(r,s){var f=[],d=function(e){for(;0{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(5294),i=r(6097),o=r(7326),s=r(6958);t.windowWhen=function(e){return i.operate((function(t,r){var i,a,c=function(e){i.error(e),r.error(e)},u=function(){var t;null==a||a.unsubscribe(),null==i||i.complete(),i=new n.Subject,r.next(i.asObservable());try{t=s.innerFrom(e())}catch(e){return void c(e)}t.subscribe(a=o.createOperatorSubscriber(r,u,u,c))};u(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return i.next(e)}),(function(){i.complete(),r.complete()}),c,(function(){null==a||a.unsubscribe(),i=null})))}))}},5512:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(4981),i=r(2208);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},7594:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(4174);t.scheduleArray=function(e,t){return new n.Observable((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}},4271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(4174),i=r(5267);t.scheduleAsyncIterable=function(e,t){if(!e)throw new Error("Iterable cannot be null");return new n.Observable((function(r){i.executeSchedule(r,t,(function(){var n=e[Symbol.asyncIterator]();i.executeSchedule(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}},2485:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(4174),i=r(7630),o=r(2935),s=r(5267);t.scheduleIterable=function(e,t){return new n.Observable((function(r){var n;return s.executeSchedule(r,t,(function(){n=e[i.iterator](),s.executeSchedule(r,t,(function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){return void r.error(e)}i?r.complete():r.next(t)}),0,!0)})),function(){return o.isFunction(null==n?void 0:n.return)&&n.return()}}))}},5892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(6958),i=r(9314),o=r(9130);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},6976:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(6958),i=r(9314),o=r(9130);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},4260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(4271),i=r(2221);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},2862:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(5892),i=r(6976),o=r(7456),s=r(2485),a=r(4271),c=r(3124),u=r(4283),l=r(5445),f=r(8131),d=r(3260),h=r(7756),p=r(2221),b=r(4260);t.scheduled=function(e,t){if(null!=e){if(c.isInteropObservable(e))return n.scheduleObservable(e,t);if(l.isArrayLike(e))return o.scheduleArray(e,t);if(u.isPromise(e))return i.schedulePromise(e,t);if(d.isAsyncIterable(e))return a.scheduleAsyncIterable(e,t);if(f.isIterable(e))return s.scheduleIterable(e,t);if(p.isReadableStreamLike(e))return b.scheduleReadableStreamLike(e,t)}throw h.createInvalidObservableTypeError(e)}},2502:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var o=function(e){function t(t,r){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(4666).Subscription);t.Action=o},2142:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationFrameAction=void 0;var o=r(9462),s=r(9015),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=s.animationFrameProvider.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var o=t.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(s.animationFrameProvider.cancelAnimationFrame(r),t._scheduled=void 0)},t}(o.AsyncAction);t.AnimationFrameAction=a},7104:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationFrameScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(r(9812).AsyncScheduler);t.AnimationFrameScheduler=o},4151:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsapAction=void 0;var o=r(9462),s=r(4409),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=s.immediateProvider.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var o=t.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(s.immediateProvider.clearImmediate(r),t._scheduled===r&&(t._scheduled=void 0))},t}(o.AsyncAction);t.AsapAction=a},4726:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsapScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(r(9812).AsyncScheduler);t.AsapScheduler=o},9462:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var o=r(2502),s=r(7549),a=r(1291),c=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return i(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),s.intervalProvider.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&s.intervalProvider.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,a.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(o.Action);t.AsyncAction=c},9812:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var o=r(6949),s=function(e){function t(t,r){void 0===r&&(r=o.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(o.Scheduler);t.AsyncScheduler=s},5336:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.QueueAction=void 0;var o=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.flush(this),0)},t}(r(9462).AsyncAction);t.QueueAction=o},3667:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.QueueScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(9812).AsyncScheduler);t.QueueScheduler=o},2929:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualAction=t.VirtualTimeScheduler=void 0;var o=r(9462),s=r(4666),a=function(e){function t(t,r){void 0===t&&(t=c),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return i(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(r(9812).AsyncScheduler);t.VirtualTimeScheduler=a;var c=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.index=n,i.active=!0,i.index=t.index=n,i}return i(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return s.Subscription.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var i=e.actions;return i.push(this),i.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(o.AsyncAction);t.VirtualAction=c},8989:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.animationFrame=t.animationFrameScheduler=void 0;var n=r(2142),i=r(7104);t.animationFrameScheduler=new i.AnimationFrameScheduler(n.AnimationFrameAction),t.animationFrame=t.animationFrameScheduler},9015:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asap=t.asapScheduler=void 0;var n=r(4151),i=r(4726);t.asapScheduler=new i.AsapScheduler(n.AsapAction),t.asap=t.asapScheduler},7152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(9462),i=r(9812);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},9168:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateTimestampProvider=void 0,t.dateTimestampProvider={now:function(){return(t.dateTimestampProvider.delegate||Date).now()},delegate:void 0}},4409:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.performanceTimestampProvider=void 0,t.performanceTimestampProvider={now:function(){return(t.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}},4093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.queue=t.queueScheduler=void 0;var n=r(5336),i=r(3667);t.queueScheduler=new i.QueueScheduler(n.QueueAction),t.queue=t.queueScheduler},1577:function(e,t){"use strict";var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(t,"__esModule",{value:!0}),t.iterator=t.getSymbolIterator=void 0,t.getSymbolIterator=r,t.iterator=r()},4595:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},2793:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9216:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(3126);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},9088:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(3126);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},998:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TestTools=t.Immediate=void 0;var r,n=1,i={};function o(e){return e in i&&(delete i[e],!0)}t.Immediate={setImmediate:function(e){var t=n++;return i[t]=!0,r||(r=Promise.resolve()),r.then((function(){return o(t)&&e()})),t},clearImmediate:function(e){o(e)}},t.TestTools={pending:function(){return Object.keys(i).length}}},5722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(3126);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},8499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(3126);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},7298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(3126);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},4043:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(3126);t.UnsubscriptionError=n.createErrorClass((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}))},4544:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(2935),i=r(9668);function o(e){return e[e.length-1]}t.popResultSelector=function(e){return n.isFunction(o(e))?e.pop():void 0},t.popScheduler=function(e){return i.isScheduler(o(e))?e.pop():void 0},t.popNumber=function(e,t){return"number"==typeof o(e)?e.pop():t}},2398:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argsArgArrayOrObject=void 0;var r=Array.isArray,n=Object.getPrototypeOf,i=Object.prototype,o=Object.keys;t.argsArgArrayOrObject=function(e){if(1===e.length){var t=e[0];if(r(t))return{args:t,keys:null};if((a=t)&&"object"==typeof a&&n(a)===i){var s=o(t);return{args:s.map((function(e){return t[e]})),keys:s}}}var a;return{args:e,keys:null}}},5034:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argsOrArgArray=void 0;var r=Array.isArray;t.argsOrArgArray=function(e){return 1===e.length&&r(e[0])?e[0]:e}},1291:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrRemove=void 0,t.arrRemove=function(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}},3126:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorClass=void 0,t.createErrorClass=function(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},4800:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createObject=void 0,t.createObject=function(e,t){return e.reduce((function(e,r,n){return e[r]=t[n],e}),{})}},5444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(9179),i=null;t.errorContext=function(e){if(n.config.useDeprecatedSynchronousErrorHandling){var t=!i;if(t&&(i={errorThrown:!1,error:null}),e(),t){var r=i,o=r.errorThrown,s=r.error;if(i=null,o)throw s}}else e()},t.captureError=function(e){n.config.useDeprecatedSynchronousErrorHandling&&i&&(i.errorThrown=!0,i.error=e)}},5267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeSchedule=void 0,t.executeSchedule=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule((function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(o),!i)return o}},8987:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},5445:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayLike=void 0,t.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},3260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(2935);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},4426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},2935:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},3124:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(4595),i=r(2935);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},8131:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(7630),i=r(2935);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},3659:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObservable=void 0;var n=r(4174),i=r(2935);t.isObservable=function(e){return!!e&&(e instanceof n.Observable||i.isFunction(e.lift)&&i.isFunction(e.subscribe))}},4283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(2935);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},2221:function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof i?Promise.resolve(r.value.v).then(u,l):f(s[0][2],r)}catch(e){f(s[0][3],e)}var r}function u(e){c("next",e)}function l(e){c("throw",e)}function f(e,t){e(t),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(t,"__esModule",{value:!0}),t.isReadableStreamLike=t.readableStreamLikeToAsyncGenerator=void 0;var s=r(2935);t.readableStreamLikeToAsyncGenerator=function(e){return o(this,arguments,(function(){var t,r,o;return n(this,(function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,i(t.read())];case 3:return r=n.sent(),o=r.value,r.done?[4,i(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,i(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))},t.isReadableStreamLike=function(e){return s.isFunction(null==e?void 0:e.getReader)}},9668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(2935);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},6097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(2935);function i(e){return n.isFunction(null==e?void 0:e.lift)}t.hasLift=i,t.operate=function(e){return function(t){if(i(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}},9364:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},8781:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.not=void 0,t.not=function(e,t){return function(r,n){return!e.call(t,r,n)}}},5250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(8987);function i(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}t.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(9179),i=r(1577);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},7756:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createInvalidObservableTypeError=void 0,t.createInvalidObservableTypeError=function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},9002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=t.merge=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.concat=t.combineLatestWith=t.combineLatest=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=void 0,t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.race=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.partition=t.pairwise=t.onErrorResumeNext=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=void 0,t.zipWith=t.zipAll=t.zip=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=void 0;var n=r(2605);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(4152);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(5149);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(3189);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(9459);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var c=r(8145);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return c.bufferToggle}});var u=r(7764);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return u.bufferWhen}});var l=r(3056);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var f=r(498);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return f.combineAll}});var d=r(7484);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var h=r(6527);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return h.combineLatest}});var p=r(4755);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var b=r(3792);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return b.concat}});var m=r(482);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return m.concatAll}});var g=r(1774);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return g.concatMap}});var v=r(3977);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return v.concatMapTo}});var y=r(7672);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return y.concatWith}});var _=r(5561);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var w=r(8259);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return w.count}});var E=r(3473);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return E.debounce}});var O=r(8390);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return O.debounceTime}});var A=r(4562);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return A.defaultIfEmpty}});var S=r(8151);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return S.delay}});var P=r(744);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return P.delayWhen}});var T=r(8590);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return T.dematerialize}});var I=r(8406);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return I.distinct}});var R=r(7300);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return R.distinctUntilChanged}});var x=r(4405);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return x.distinctUntilKeyChanged}});var M=r(2787);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return M.elementAt}});var k=r(1665);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return k.endWith}});var L=r(1511);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return L.every}});var N=r(5592);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return N.exhaust}});var C=r(2008);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return C.exhaustAll}});var j=r(4019);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return j.exhaustMap}});var D=r(9101);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return D.expand}});var U=r(7261);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return U.filter}});var B=r(5381);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return B.finalize}});var F=r(4127);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return F.find}});var K=r(9727);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return K.findIndex}});var H=r(7418);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return H.first}});var G=r(7533);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return G.groupBy}});var $=r(9186);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return $.ignoreElements}});var V=r(7757);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return V.isEmpty}});var z=r(3374);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return z.last}});var q=r(6269);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return q.map}});var W=r(5471);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return W.mapTo}});var Z=r(1160);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return Z.materialize}});var J=r(1890);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return J.max}});var Y=r(3982);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return Y.merge}});var X=r(400);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Q=r(9121);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Q.flatMap}});var ee=r(6086);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(1244);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(3699);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(8220);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(770);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(8413);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(9314);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(1899);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ce=r(1186);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ce.pairwise}});var ue=r(9857);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ue.partition}});var le=r(9532);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var fe=r(5745);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return fe.publish}});var de=r(8103);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var he=r(2610);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return he.publishLast}});var pe=r(5299);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var be=r(6699);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return be.race}});var me=r(3820);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return me.raceWith}});var ge=r(8083);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return ge.reduce}});var ve=r(2588);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return ve.repeat}});var ye=r(9249);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ye.repeatWhen}});var _e=r(4486);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var we=r(9112);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return we.retryWhen}});var Ee=r(4508);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Ee.refCount}});var Oe=r(778);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Oe.sample}});var Ae=r(7701);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Ae.sampleTime}});var Se=r(8167);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Se.scan}});var Pe=r(7821);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Pe.sequenceEqual}});var Te=r(2645);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Te.share}});var Ie=r(7566);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Ie.shareReplay}});var Re=r(4610);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Re.single}});var xe=r(5735);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return xe.skip}});var Me=r(3252);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return Me.skipLast}});var ke=r(1779);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return ke.skipUntil}});var Le=r(5454);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return Le.skipWhile}});var Ne=r(1923);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Ne.startWith}});var Ce=r(9130);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ce.subscribeOn}});var je=r(1695);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return je.switchAll}});var De=r(6649);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return De.switchMap}});var Ue=r(3054);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return Ue.switchMapTo}});var Be=r(2890);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Be.switchScan}});var Fe=r(9438);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Fe.take}});var Ke=r(4125);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Ke.takeLast}});var He=r(9008);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return He.takeUntil}});var Ge=r(5884);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ge.takeWhile}});var $e=r(5383);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return $e.tap}});var Ve=r(1016);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ve.throttle}});var ze=r(567);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return ze.throttleTime}});var qe=r(1332);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return qe.throwIfEmpty}});var We=r(1149);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return We.timeInterval}});var Ze=r(1316);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return Ze.timeout}});var Je=r(4972);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Je.timeoutWith}});var Ye=r(1275);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Ye.timestamp}});var Xe=r(9867);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Qe=r(7649);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Qe.window}});var et=r(5612);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(9972);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(9593);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(6307);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(5512);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(586);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(1221);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(7594);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},8743:e=>{e.exports=function(e){return ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e)}},227:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DeprecationError:()=>S,InvalidAddressError:()=>l,InvalidAmountError:()=>d,InvalidBlockHashError:()=>f,InvalidChainIdError:()=>w,InvalidContractAddressError:()=>_,InvalidDerivationPathError:()=>h,InvalidHexStringError:()=>p,InvalidKeyError:()=>g,InvalidKeyHashError:()=>E,InvalidMessageError:()=>b,InvalidOperationHashError:()=>O,InvalidOperationKindError:()=>A,InvalidPublicKeyError:()=>v,InvalidSignatureError:()=>y,InvalidViewParameterError:()=>m,NetworkError:()=>c,ParameterValidationError:()=>i,PermissionDeniedError:()=>u,ProhibitedActionError:()=>P,PublicKeyNotFoundError:()=>T,RpcError:()=>o,TaquitoError:()=>n,TezosToolkitConfigError:()=>s,UnsupportedActionError:()=>a});class n extends Error{}class i extends n{}class o extends n{}class s extends n{}class a extends n{}class c extends n{}class u extends n{}class l extends i{constructor(e,t){super(),this.address=e,this.errorDetail=t,this.name="InvalidAddressError",this.message=`Invalid address "${e}"`,this.message+=t?` ${t}.`:"."}}class f extends i{constructor(e,t){super(),this.blockHash=e,this.errorDetail=t,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${e}"`,this.message+=t?` ${t}.`:"."}}class d extends i{constructor(e){super(),this.amount=e,this.name="InvalidAmountError",this.message=`Invalid amount "${e}"`}}class h extends i{constructor(e,t){super(),this.derivationPath=e,this.errorDetail=t,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${e}"`,this.message+=t?` ${t}.`:"."}}class p extends i{constructor(e,t){super(),this.hexString=e,this.errorDetail=t,this.name="InvalidHexStringError",this.message=`Invalid hex string "${e}"`,this.message+=t?` ${t}.`:"."}}class b extends i{constructor(e,t){super(),this.msg=e,this.errorDetail=t,this.name="InvalidMessageError",this.message=`Invalid message "${e}"`,this.message+=t?` ${t}.`:"."}}class m extends i{constructor(e,t,r,n){super(),this.viewName=e,this.sigs=t,this.args=r,this.cause=n,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(r)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(t)}.`}}class g extends i{constructor(e){super(),this.errorDetail=e,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=e?` ${e}.`:"."}}class v extends i{constructor(e,t){super(),this.publicKey=e,this.errorDetail=t,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${e}"`,this.message+=t?` ${t}.`:"."}}class y extends i{constructor(e,t){super(),this.signature=e,this.errorDetail=t,this.name="InvalidSignatureError",this.message=`Invalid signature "${e}"`,this.message+=t?` ${t}.`:"."}}class _ extends i{constructor(e,t){super(),this.contractAddress=e,this.errorDetail=t,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${e}"`,this.message+=t?` ${t}.`:"."}}class w extends i{constructor(e,t){super(),this.chainId=e,this.errorDetail=t,this.name="InvalidChainIdError",this.message=`Invalid chain id "${e}"`,this.message+=t?` ${t}.`:"."}}class E extends i{constructor(e,t){super(),this.keyHash=e,this.errorDetail=t,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${e}"`,this.message+=t?` ${t}.`:"."}}class O extends i{constructor(e,t){super(),this.operationHash=e,this.errorDetail=t,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${e}"`,this.message+=t?` ${t}.`:"."}}class A extends i{constructor(e,t){super(),this.operationKind=e,this.errorDetail=t,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${e}"`,this.message+=t?` ${t}.`:"."}}class S extends a{constructor(e){super(),this.message=e,this.name="DeprecationError"}}class P extends a{constructor(e){super(),this.message=e,this.name="ProhibitedActionError"}}class T extends n{constructor(e,t){super(),this.pkh=e,this.cause=t,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${e}" in either wallet or contract API.`}}},5543:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HttpBackend:()=>d,HttpRequestFailed:()=>s,HttpResponseError:()=>a,HttpTimeoutError:()=>c,STATUS_CODE:()=>n,VERSION:()=>u});var n,i=r(227);function o(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s extends i.NetworkError{constructor(e,t,r){super(),this.method=e,this.url=t,this.cause=r,this.name="HttpRequestFailed",this.message=`${e} ${t} ${String(r)}`}}class a extends i.NetworkError{constructor(e,t,r,n,i){super(),this.message=e,this.status=t,this.statusText=r,this.body=n,this.url=i,this.name="HttpResponseError"}}class c extends i.NetworkError{constructor(e,t){super(),this.timeout=e,this.url=t,this.name="HttpTimeoutError",this.message=`HTTP request timeout of ${e}ms exceeded`}}!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.ALREADY_REPORTED=208]="ALREADY_REPORTED",e[e.IM_USED=226]="IM_USED",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.SWITCH_PROXY=306]="SWITCH_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(n||(n={}));const u={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"};var l;let f=null===globalThis||void 0===globalThis?void 0:globalThis.fetch;"undefined"!=typeof process&&!!(null===(l=null===process||void 0===process?void 0:process.versions)||void 0===l?void 0:l.node)&&(f=r(4986));class d{constructor(e=3e4){this.timeout=e}serialize(e){if(!e)return"";const t=[];for(const r in e)if(e.hasOwnProperty(r)&&void 0!==e[r]){const n="function"==typeof e[r].toJSON?e[r].toJSON():e[r];if(null===n){t.push(encodeURIComponent(r));continue}if(Array.isArray(n)){n.forEach((e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}));continue}t.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}const r=t.join("&");return r?`?${r}`:""}createRequest({url:e,method:t,timeout:r=this.timeout,query:n,headers:i={},json:u=!0},l){return o(this,void 0,void 0,(function*(){const o=e+this.serialize(n);i["Content-Type"]||(i["Content-Type"]="application/json");const d=new AbortController,h=setTimeout((()=>d.abort()),r);try{const e=yield f(o,{method:t,headers:i,body:JSON.stringify(l),signal:d.signal});if(void 0===e)throw new Error("Response is undefined");if(e.status>=400){const t=yield e.text();throw new a(`Http error response: (${e.status}) ${t}`,e.status,e.statusText,t,o)}return u?e.json():e.text()}catch(e){throw e instanceof Error&&"AbortError"===e.name?new c(r,o):e instanceof a?e:new s(String(t),o,e)}finally{clearTimeout(h)}}))}}},4986:(e,t,r)=>{"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},5078:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CODEC:()=>c,LocalForger:()=>je,ProtocolsHash:()=>ke,Uint8ArrayConsumer:()=>T,VERSION:()=>Le,decoders:()=>Ie,encoders:()=>Re,getCodec:()=>Ce,localForger:()=>De,opMapping:()=>u,opMappingReverse:()=>l});var n=r(4632),i=r(227),o=r(2558);const s=e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),a=(e,t=8)=>e.toString(16).padStart(t,"0");var c;!function(e){e.SECRET="secret",e.RAW="raw",e.TZ1="tz1",e.BRANCH="branch",e.ZARITH="zarith",e.PUBLIC_KEY="public_key",e.PKH="pkh",e.PKH_ARR="pkhArr",e.DELEGATE="delegate",e.SCRIPT="script",e.BALLOT_STATEMENT="ballotStmt",e.PROPOSAL="proposal",e.PROPOSAL_ARR="proposalArr",e.INT32="int32",e.INT16="int16",e.PARAMETERS="parameters",e.ADDRESS="address",e.SMART_CONTRACT_ADDRESS="smart_contract_address",e.SMART_ROLLUP_ADDRESS="smart_rollup_address",e.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",e.VALUE="value",e.PADDED_BYTES="padded_bytes",e.SMART_ROLLUP_MESSAGE="smart_rollup_message",e.MANAGER="manager",e.BLOCK_PAYLOAD_HASH="blockPayloadHash",e.ENTRYPOINT="entrypoint",e.OPERATION="operation",e.OP_ACTIVATE_ACCOUNT="activate_account",e.OP_DELEGATION="delegation",e.OP_TRANSACTION="transaction",e.OP_ORIGINATION="origination",e.OP_BALLOT="ballot",e.OP_FAILING_NOOP="failing_noop",e.OP_ATTESTATION="attestation",e.OP_ENDORSEMENT="endorsement",e.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",e.OP_REVEAL="reveal",e.OP_PROPOSALS="proposals",e.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",e.OP_TRANSFER_TICKET="transfer_ticket",e.BURN_LIMIT="burn_limit",e.OP_INCREASE_PAID_STORAGE="increase_paid_storage",e.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",e.OP_DRAIN_DELEGATE="drain_delegate",e.DEPOSITS_LIMIT="deposits_limit",e.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",e.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",e.PVM_KIND="pvm_kind",e.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",e.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message"}(c||(c={}));const u={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction_deprecated",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET_DEPRECATED",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ",94:"tx_rollup_l2_address",95:"MIN_BLOCK_TIME",96:"sapling_transaction",97:"EMIT",98:"Lambda_rec",99:"LAMBDA_REC","9a":"TICKET","9b":"BYTES","9c":"NAT"},l=(()=>{const e={};return Object.keys(u).forEach((t=>{e[u[t]]=t})),e})(),f={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",21:"attestation",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant",158:"transfer_ticket",112:"set_deposits_limit",113:"increase_paid_storage",114:"update_consensus_key",9:"drain_delegate",200:"smart_rollup_originate",201:"smart_rollup_add_messages",206:"smart_rollup_execute_outbox_message",17:"failing_noop"},d=(()=>{const e={};return Object.keys(f).forEach((t=>{const r="string"==typeof t?parseInt(t,10):t;e[f[r]]=a(r,2)})),e})(),h={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate","05":"deposit"},p=(()=>{const e={};return Object.keys(h).forEach((t=>{e[h[t]]=t})),e})();class b extends i.ParameterValidationError{constructor(e,t){super(),this.operation=e,this.errorDetail=t,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",t&&(this.message+=` ${t}.`)}}class m extends i.ParameterValidationError{constructor(e){super(),this.entrypoint=e,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${e.length}", maximum length is "31".`}}class g extends i.ParameterValidationError{constructor(e){super(),this.ballotValue=e,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${e}" expecting one of the following: "yay", "nay", "pass".`}}class v extends i.ParameterValidationError{constructor(e){super(),this.ballotValue=e,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${e}", cannot be decoded.`}}class y extends i.ParameterValidationError{constructor(e){super(),this.value=e,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${e}", unalbe to encode.`}}class _ extends i.ParameterValidationError{constructor(e){super(),this.message=e,this.name="OperationDecodingError"}}class w extends i.ParameterValidationError{constructor(e){super(),this.message=e,this.name="OperationEncodingError"}}class E extends i.ParameterValidationError{constructor(e){super(),this.op=e,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${e}", can submit an issue on our github for feature request.`}}class O extends i.ParameterValidationError{constructor(e){super(),this.pvm=e,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${e}" expecting either "arith" or "wasm_2_0_0".`}}class A extends i.ParameterValidationError{constructor(e){super(),this.pvm=e,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${e}", cannot be decoded.`}}class S extends i.ParameterValidationError{constructor(e,t){super(),this.address=e,this.errorDetail=t,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${e}"`,t&&(this.message+=` ${t}.`)}}class P extends i.ParameterValidationError{constructor(e,t){super(),this.hash=e,this.errorDetail=t,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${e}"`,t&&(this.message+=` ${t}.`)}}class T{static fromHexString(e){const t=e.toLowerCase();if(/^(([a-f]|\d){2})*$/.test(t)){const e=new Uint8Array((t.match(/([a-z]|\d){2}/g)||[]).map((e=>parseInt(e,16))));return new T(e)}throw new i.InvalidHexStringError(t)}constructor(e,t=0){this.arr=e,this.offset=t}consume(e){const t=this.arr.subarray(this.offset,this.offset+e);return this.offset+=e,t}get(e){return this.arr[this.offset+e]}length(){return this.arr.length-this.offset}slice(e,t){return new T(this.arr.slice(e,t))}}const I=e=>{if(Array.isArray(e)){const t=e.map((e=>I(e))).join(""),r=t.length/2;return`02${a(r)}${t}`}if((e=>"prim"in e)(e))return D(e);if((e=>"bytes"in e&&"string"==typeof e.bytes)(e))return M(e);if((e=>"string"in e&&"string"==typeof e.string)(e))return L(e);if((e=>"int"in e&&"string"==typeof e.int)(e))return C(e);throw new y(JSON.stringify(e))},R=e=>{const t=e.consume(1);switch(t[0]){case 10:return k(e);case 1:return N(e);case 0:return j(e);case 2:{const t=new T(x(e)),r=[];for(;t.length()>0;)r.push(R(t));return r}default:return U(e,t)}},x=(e,t=4)=>{const r=e.consume(t),n=parseInt(Buffer.from(r).toString("hex"),16);return e.consume(n)},M=e=>{if(!/^([A-Fa-f0-9]{2})*$/.test(e.bytes))throw new i.InvalidHexStringError(e.bytes);const t=e.bytes.length/2;return`0a${a(t)}${e.bytes}`},k=e=>{const t=x(e);return{bytes:Buffer.from(t).toString("hex")}},L=e=>{const t=Buffer.from(e.string,"utf8").toString("hex"),r=t.length/2;return`01${a(r)}${t}`},N=e=>{const t=x(e);return{string:Buffer.from(t).toString("utf8")}},C=({int:e})=>{const t=new o.O(e,10),r="-"===t.toString(2)[0]?"1":"0",n=t.toString(2).replace(/-/g,""),i=n.length<=6?6:(n.length-6)%7?n.length+7-(n.length-6)%7:n.length,s=n.padStart(i,"0").match(/\d{6,7}/g).reverse();s[0]=r+s[0];return`00${s.map(((e,t)=>parseInt((t===s.length-1?"0":"1")+e,2).toString(16).padStart(2,"0"))).join("")}`},j=e=>{let t=e.consume(1)[0];const r=[];for(;128&t;)r.push(t),t=e.consume(1)[0];r.push(t);const n=!!(64&r[0]);r[0]=127&r[0];const i=r.map(((e,t)=>e.toString(2).slice(0===t?-6:-7).padStart(0===t?6:7,"0"))).reverse();let s=new o.O(i.join(""),2);return n&&(s=s.times(-1)),{int:s.toFixed()}},D=e=>{const t=+Array.isArray(e.annots),r=Array.isArray(e.args)?e.args.length:0,n=a(Math.min(2*r+t+3,9),2),i=l[e.prim];let o=(e.args||[]).map((e=>I(e))).join("");const s=Array.isArray(e.annots)?K(e.annots):"";return"LAMBDA"!==e.prim&&"LAMBDA_REC"!==e.prim||!r||(o=a(o.length/2)+o+a(0)),("pair"===e.prim||"Pair"===e.prim)&&r>2&&(o=""===s?a(o.length/2)+o+a(0):a(o.length/2)+o),"view"===e.prim&&e.args&&(o=a(o.length/2)+o+a(0)),`${n}${i}${o}${s}`},U=(e,t)=>{const r=(t[0]-3)%2==1;let n=Math.floor((t[0]-3)/2);const i=e.consume(1)[0].toString(16).padStart(2,"0"),o={prim:u[i]};if("LAMBDA"!==u[i]&&"LAMBDA_REC"!==u[i]||e.consume(4),"view"===u[i])return 0!=n?B(e,o):o;let s,a;("pair"===u[i]||"Pair"===u[i])&&n>2&&(s=F(e),n=0,a=H(e));const c=new Array(n).fill(0).map((()=>R(e)));return"LAMBDA"!==u[i]&&"LAMBDA_REC"!==u[i]||e.consume(4),s?o.args=s:c.length&&(o.args=c),a&&""!==a[0]?o.annots=a:r&&(o.annots=H(e)),o},B=(e,t)=>(e.consume(4),t.args=new Array(4).fill(0).map((()=>R(e))),e.consume(4),t),F=e=>{const t=new T(x(e)),r=[];for(;t.length()>0;)r.push(R(t));return r},K=e=>{const t=e.map((e=>Buffer.from(e,"utf8").toString("hex"))).join("20"),r=t.length/2;return`${a(r)}${t}`},H=e=>{const t=e.consume(4),r=parseInt(Buffer.from(t).toString("hex"),16),n=e.consume(r);return Buffer.from(n).toString("hex").split("20").map((e=>Buffer.from(e,"hex").toString("utf8")))},G=e=>t=>(0,n.buf2hex)(Buffer.from((0,n.b58cdecode)(t,n.prefix[e]))),$=e=>t=>{const r=t.consume(n.prefixLength[e]);return(0,n.b58cencode)(r,n.prefix[e])},V=$(n.Prefix.TZ1),z=$(n.Prefix.B),q=e=>{const t=e.consume(1);return 0===t[0]?$(n.Prefix.TZ1)(e):1===t[0]?$(n.Prefix.TZ2)(e):2===t[0]?$(n.Prefix.TZ3)(e):void 0},W=G(n.Prefix.B),Z=G(n.Prefix.TZ1),J=e=>e?"ff":"00",Y=e=>G(n.Prefix.P)(e),X=e=>$(n.Prefix.P)(e),Q=e=>255===e.consume(1)[0],ee=e=>{switch(e.substring(0,3)){case n.Prefix.TZ1:return"00"+G(n.Prefix.TZ1)(e);case n.Prefix.TZ2:return"01"+G(n.Prefix.TZ2)(e);case n.Prefix.TZ3:return"02"+G(n.Prefix.TZ3)(e);case n.Prefix.TZ4:return"03"+G(n.Prefix.TZ4)(e);default:throw new n.InvalidKeyHashError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one for the following "${n.Prefix.TZ1}", "${n.Prefix.TZ2}", "${n.Prefix.TZ3}" or "${n.Prefix.TZ4}".`)}},te=e=>{const t=[];let r=new o.Z(e,10);if(r.isNaN())throw new TypeError(`Invalid zarith number ${e}`);for(;;){if(r.lt(128)){r.lt(16)&&t.push("0"),t.push(r.toString(16));break}{let e=r.mod(128);r=r.minus(e),r=r.dividedBy(128),e=e.plus(128),t.push(e.toString(16))}}return t.join("")},re=e=>{let t=0;for(;t=0;n-=1){const t=127&e.get(n);r=r.multipliedBy(128),r=r.plus(t)}return e.consume(t+1),new o.Z(r).toString()},ne=G(n.Prefix.VH),ie=$(n.Prefix.VH),oe={branch:c.BRANCH,contents:[c.OPERATION]},se={pkh:c.TZ1,secret:c.SECRET},ae={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,public_key:c.PUBLIC_KEY},ce={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,delegate:c.DELEGATE},ue={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,amount:c.ZARITH,destination:c.ADDRESS,parameters:c.PARAMETERS},le={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,balance:c.ZARITH,delegate:c.DELEGATE,script:c.SCRIPT},fe={source:c.PKH,period:c.INT32,proposal:c.PROPOSAL,ballot:c.BALLOT_STATEMENT},de={slot:c.INT16,level:c.INT32,round:c.INT32,block_payload_hash:c.BLOCK_PAYLOAD_HASH},he={slot:c.INT16,level:c.INT32,round:c.INT32,block_payload_hash:c.BLOCK_PAYLOAD_HASH},pe={level:c.INT32,nonce:c.RAW},be={source:c.PKH,period:c.INT32,proposals:c.PROPOSAL_ARR},me={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,value:c.VALUE},ge={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,ticket_contents:c.VALUE,ticket_ty:c.VALUE,ticket_ticketer:c.ADDRESS,ticket_amount:c.ZARITH,destination:c.ADDRESS,entrypoint:c.ENTRYPOINT},ve={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,amount:c.ZARITH,destination:c.SMART_CONTRACT_ADDRESS},ye={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,pk:c.PUBLIC_KEY},_e={consensus_key:c.PKH,delegate:c.PKH,destination:c.PKH},we={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,limit:c.DEPOSITS_LIMIT},Ee={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,pvm_kind:c.PVM_KIND,kernel:c.PADDED_BYTES,parameters_ty:c.VALUE,whitelist:c.PKH_ARR},Oe={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,message:c.SMART_ROLLUP_MESSAGE},Ae={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,rollup:c.SMART_ROLLUP_ADDRESS,cemented_commitment:c.SMART_ROLLUP_COMMITMENT_HASH,output_proof:c.PADDED_BYTES},Se={arbitrary:c.PADDED_BYTES},Pe=e=>t=>r=>Object.keys(t).reduce(((n,i)=>{const o=t[i];if(r&&Array.isArray(o)){const t=e[o[0]],s=r[i];if(!Array.isArray(s))throw new w(`Invalid operation value "${JSON.stringify(s)}" of key "${i}, expected value to be Array.`);return n+s.reduce(((e,r)=>e+t(r)),"")}return n+(0,e[o])(r[i])}),""),Te=e=>t=>r=>Object.keys(t).reduce(((n,i)=>{const o=t[i];if(Array.isArray(o)){const t=e[o[0]],s=[],a=r.length();for(;r.length()>0;)if(s.push(t(r)),a===r.length())throw new _("Unable to decode value");return Object.assign(Object.assign({},n),{[i]:s})}{const t=(0,e[o])(r);return void 0!==t?Object.assign(Object.assign({},n),{[i]:t}):Object.assign({},n)}}),{}),Ie={[c.SECRET]:e=>s(e.consume(20)),[c.RAW]:e=>s(e.consume(32)),[c.TZ1]:V,[c.BRANCH]:z,[c.ZARITH]:re,[c.PUBLIC_KEY]:e=>{switch(e.consume(1)[0]){case 0:return $(n.Prefix.EDPK)(e);case 1:return $(n.Prefix.SPPK)(e);case 2:return $(n.Prefix.P2PK)(e);default:throw new n.InvalidPublicKeyError(e.toString(),(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED))}},[c.PKH]:q,[c.PKH_ARR]:e=>{if(!Q(e))return;const t=[];for(e.consume(4);e.length()>0;)t.push(q(e));return t},[c.DELEGATE]:e=>{if(Q(e))return q(e)},[c.INT32]:e=>{const t=e.consume(4);let r=0;for(let e=0;e{const t=x(e),r=x(e);return{code:R(new T(t)),storage:R(new T(r))}},[c.BALLOT_STATEMENT]:e=>{const t=e.consume(1);switch(t[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new v(t[0].toString())}},[c.PROPOSAL]:X,[c.PROPOSAL_ARR]:e=>{const t=[];for(e.consume(4);e.length()>0;)t.push(X(e));return t},[c.PARAMETERS]:e=>{if(0!==e.consume(1)[0]){const t=(e=>{const t=a(e.consume(1)[0],2);if(t in h)return h[t];{const t=x(e,1),r=Buffer.from(t).toString("utf8");if(r.length>31)throw new m(r);return r}})(e),r=x(e);return{entrypoint:t,value:R(new T(r))}}},[c.ADDRESS]:e=>{switch(e.consume(1)[0]){case 0:return q(e);case 1:{const t=$(n.Prefix.KT1)(e);return e.consume(1),t}default:throw new i.InvalidAddressError(e.toString(),": Unable to decode.")}},[c.SMART_ROLLUP_ADDRESS]:e=>{const t=$(n.Prefix.SR1)(e);if(t.substring(0,3)!==n.Prefix.SR1)throw new S(t,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SR1}'.`);return t},[c.SMART_CONTRACT_ADDRESS]:e=>{if(1===e.consume(1)[0]){const t=$(n.Prefix.KT1)(e);return e.consume(1),t}throw new i.InvalidContractAddressError(e.toString(),(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED))},[c.SMART_ROLLUP_COMMITMENT_HASH]:e=>{const t=$(n.Prefix.SRC1)(e);if(t.substring(0,4)!==n.Prefix.SRC1)throw new P(t,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SRC1}'`);return t},[c.VALUE]:e=>{const t=x(e);return R(new T(t))},[c.INT16]:e=>{const t=e.consume(2);let r=0;for(let e=0;e{const t=x(e);return Buffer.from(t).toString("utf8")},[c.BURN_LIMIT]:e=>{const t=e.consume(1);if("00"!==Buffer.from(t).toString("hex"))return re(e)},[c.DEPOSITS_LIMIT]:e=>{const t=e.consume(1);if("00"!==Buffer.from(t).toString("hex"))return re(e)},[c.PVM_KIND]:e=>{const t=e.consume(1);switch(t[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new A(t[0].toString())}},[c.PADDED_BYTES]:e=>{const t=x(e);return Buffer.from(t).toString("hex")},[c.SMART_ROLLUP_MESSAGE]:e=>{const t=x(e);return((e,t=4)=>{const r=[];let n=e;for(;n.length();){const e=n.consume(t),i=parseInt(Buffer.from(e).toString("hex"),16);r.push(n.consume(i)),n=n.slice(i+t)}return r})(new T(t)).map((e=>Buffer.from(e).toString("hex")))}};Ie[c.OPERATION]=(e=>t=>{const r=t.consume(1),n=f[r[0]];if(void 0===n)throw new E(r[0].toString());const i=e[n](t);if("object"!=typeof i)throw new _("Invalid operation, cannot be decoded.");return Object.assign({kind:n},i)})(Ie),Ie[c.OP_ACTIVATE_ACCOUNT]=e=>Te(Ie)(se)(e),Ie[c.OP_FAILING_NOOP]=e=>Te(Ie)(Se)(e),Ie[c.OP_DELEGATION]=e=>Te(Ie)(ce)(e),Ie[c.OP_TRANSACTION]=e=>Te(Ie)(ue)(e),Ie[c.OP_ORIGINATION]=e=>Te(Ie)(le)(e),Ie[c.OP_BALLOT]=e=>Te(Ie)(fe)(e),Ie[c.OP_ATTESTATION]=e=>Te(Ie)(de)(e),Ie[c.OP_ENDORSEMENT]=e=>Te(Ie)(he)(e),Ie[c.OP_SEED_NONCE_REVELATION]=e=>Te(Ie)(pe)(e),Ie[c.OP_PROPOSALS]=e=>Te(Ie)(be)(e),Ie[c.OP_REVEAL]=e=>Te(Ie)(ae)(e),Ie[c.OP_REGISTER_GLOBAL_CONSTANT]=e=>Te(Ie)(me)(e),Ie[c.OP_TRANSFER_TICKET]=e=>Te(Ie)(ge)(e),Ie[c.OP_INCREASE_PAID_STORAGE]=e=>Te(Ie)(ve)(e),Ie[c.OP_UPDATE_CONSENSUS_KEY]=e=>Te(Ie)(ye)(e),Ie[c.OP_DRAIN_DELEGATE]=e=>Te(Ie)(_e)(e),Ie[c.OP_SMART_ROLLUP_ORIGINATE]=e=>Te(Ie)(Ee)(e),Ie[c.OP_SMART_ROLLUP_ADD_MESSAGES]=e=>Te(Ie)(Oe)(e),Ie[c.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=e=>Te(Ie)(Ae)(e),Ie[c.MANAGER]=Te(Ie)(oe),Ie[c.OP_SET_DEPOSITS_LIMIT]=e=>Te(Ie)(we)(e);const Re={[c.SECRET]:e=>e,[c.RAW]:e=>e,[c.TZ1]:Z,[c.BRANCH]:W,[c.ZARITH]:te,[c.PUBLIC_KEY]:e=>{switch(e.substring(0,4)){case n.Prefix.EDPK:return"00"+G(n.Prefix.EDPK)(e);case n.Prefix.SPPK:return"01"+G(n.Prefix.SPPK)(e);case n.Prefix.P2PK:return"02"+G(n.Prefix.P2PK)(e);default:throw new n.InvalidPublicKeyError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following '${n.Prefix.EDPK}', '${n.Prefix.SPPK}', '${n.Prefix.P2PK}' or '${n.Prefix.BLPK}'.`)}},[c.PKH]:ee,[c.PKH_ARR]:e=>{if(!e)return J(!1);if(0===e.length)return J(!0)+a(0);const t=e.reduce(((e,t)=>e+ee(t)),"");return J(!0)+a(t.length/2)+t},[c.DELEGATE]:e=>e?J(!0)+ee(e):J(!1),[c.SCRIPT]:e=>{const t=I(e.code),r=I(e.storage);return`${a(t.length/2,8)}${t}${a(r.length/2,8)}${r}`},[c.BALLOT_STATEMENT]:e=>{switch(e){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new g(e)}},[c.PROPOSAL]:Y,[c.PROPOSAL_ARR]:e=>a(32*e.length)+e.map((e=>Y(e))).join(""),[c.INT32]:e=>{const t=parseInt(String(e),10),r=[];for(let e=0;e<4;e++){const n=8*(4-(e+1));r.push((t&255<>n)}return Buffer.from(r).toString("hex")},[c.PARAMETERS]:e=>{if(!e||"default"===e.entrypoint&&"prim"in e.value&&"Unit"===e.value.prim)return"00";const t=(e=>{if(e in p)return`${p[e]}`;if(e.length>31)throw new m(e);return`ff${I({string:e}).slice(8)}`})(e.entrypoint),r=I(e.value);return`ff${t}${(r.length/2).toString(16).padStart(8,"0")}${r}`},[c.ADDRESS]:e=>{switch(e.substring(0,3)){case n.Prefix.TZ1:case n.Prefix.TZ2:case n.Prefix.TZ3:case n.Prefix.TZ4:return"00"+ee(e);case n.Prefix.KT1:return"01"+G(n.Prefix.KT1)(e)+"00";default:throw new i.InvalidAddressError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following prefix '${n.Prefix.TZ1}', ${n.Prefix.TZ2}', '${n.Prefix.TZ3}', '${n.Prefix.TZ4}' or '${n.Prefix.KT1}'.`)}},[c.SMART_ROLLUP_ADDRESS]:e=>{if(e.substring(0,3)!==n.Prefix.SR1)throw new S(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SR1}'.`);return G(n.Prefix.SR1)(e)},[c.SMART_CONTRACT_ADDRESS]:e=>{if(e.substring(0,3)===n.Prefix.KT1)return"01"+G(n.Prefix.KT1)(e)+"00";throw new i.InvalidContractAddressError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.KT1}'.`)},[c.SMART_ROLLUP_COMMITMENT_HASH]:e=>{if(e.substring(0,4)===n.Prefix.SRC1)return G(n.Prefix.SRC1)(e);throw new P(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SRC1}'`)},[c.VALUE]:e=>{const t=I(e);return`${a(t.length/2)}${t}`},[c.INT16]:e=>{const t=parseInt(String(e),10),r=[];for(let e=0;e<2;e++){const n=8*(2-(e+1));r.push((t&255<>n)}return Buffer.from(r).toString("hex")},[c.BLOCK_PAYLOAD_HASH]:ne,[c.ENTRYPOINT]:e=>`${I({string:e}).slice(2)}`,[c.BURN_LIMIT]:e=>e?`ff${te(e)}`:"00",[c.DEPOSITS_LIMIT]:e=>e?`ff${te(e)}`:"00",[c.PVM_KIND]:e=>{switch(e){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new O(e)}},[c.PADDED_BYTES]:(e,t=8)=>`${a(e.length/2,t)}${e}`,[c.SMART_ROLLUP_MESSAGE]:e=>{const t=e.reduce(((e,t)=>e+`${a(t.length/2)}${t}`),"");return`${a(t.length/2)}${t}`}};Re[c.OPERATION]=(e=>t=>{if(!(t.kind in e)||!(t.kind in d))throw new i.InvalidOperationKindError(t.kind);return d[t.kind]+e[t.kind](t)})(Re),Re[c.OP_ACTIVATE_ACCOUNT]=e=>Pe(Re)(se)(e),Re[c.OP_DELEGATION]=e=>Pe(Re)(ce)(e),Re[c.OP_TRANSACTION]=e=>Pe(Re)(ue)(e),Re[c.OP_ORIGINATION]=e=>Pe(Re)(le)(e),Re[c.OP_BALLOT]=e=>Pe(Re)(fe)(e),Re[c.OP_ATTESTATION]=e=>Pe(Re)(de)(e),Re[c.OP_ENDORSEMENT]=e=>Pe(Re)(he)(e),Re[c.OP_SEED_NONCE_REVELATION]=e=>Pe(Re)(pe)(e),Re[c.OP_PROPOSALS]=e=>Pe(Re)(be)(e),Re[c.OP_REVEAL]=e=>Pe(Re)(ae)(e),Re[c.OP_REGISTER_GLOBAL_CONSTANT]=e=>Pe(Re)(me)(e),Re[c.OP_TRANSFER_TICKET]=e=>Pe(Re)(ge)(e),Re[c.OP_INCREASE_PAID_STORAGE]=e=>Pe(Re)(ve)(e),Re[c.OP_UPDATE_CONSENSUS_KEY]=e=>Pe(Re)(ye)(e),Re[c.OP_DRAIN_DELEGATE]=e=>Pe(Re)(_e)(e),Re[c.OP_SMART_ROLLUP_ORIGINATE]=e=>Pe(Re)(Ee)(e),Re[c.OP_SMART_ROLLUP_ADD_MESSAGES]=e=>Pe(Re)(Oe)(e),Re[c.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=e=>Pe(Re)(Ae)(e),Re[c.MANAGER]=Pe(Re)(oe),Re[c.OP_SET_DEPOSITS_LIMIT]=e=>Pe(Re)(we)(e),Re[c.OP_FAILING_NOOP]=e=>Pe(Re)(Se)(e);const xe={activate_account:se,reveal:ae,delegation:ce,transaction:ue,origination:le,ballot:fe,attestation:de,endorsement:he,seed_nonce_revelation:pe,proposals:be,register_global_constant:me,transfer_ticket:ge,increase_paid_storage:ve,update_consensus_key:ye,drain_delegate:_e,set_deposits_limit:we,smart_rollup_originate:Ee,smart_rollup_add_messages:Oe,smart_rollup_execute_outbox_message:Ae,failing_noop:Se},Me=e=>{const t=e.kind,r=Object.keys(e),n=(i="kind",r.filter((e=>e!==i)));var i;const o=Object.keys(xe[t]);return s=n,o.filter((e=>!s.includes(e)));var s};var ke;!function(e){e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(ke||(ke={}));const Le={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"},Ne=ke.ProxfordY;function Ce(e,t){return{encoder:Re[e],decoder:t=>{const r=T.fromHexString(t);return Ie[e](r)}}}class je{constructor(e=Ne){this.protocolHash=e,this.codec=Ce(c.MANAGER,this.protocolHash)}forge(e){const t=(0,n.validateBlock)(e.branch);if(t!==n.ValidationResult.VALID)throw new i.InvalidBlockHashError(e.branch,(0,n.invalidDetail)(t));for(const t of e.contents){if(r=t.kind,!Object.keys(xe).includes(r))throw new i.InvalidOperationKindError(t.kind);const e=Me(t);if(1===e.length){if("delegation"===t.kind&&"delegate"===e[0])continue;if("origination"===t.kind&&"delegate"===e[0])continue;if("transaction"===t.kind&&"parameters"===e[0])continue;if("set_deposits_limit"===t.kind&&"limit"===e[0])continue;if("smart_rollup_originate"===t.kind&&"whitelist"===e[0])continue;throw new b(t,`missing properties "${e.join(", ")}"`)}if(e.length>1)throw new b(t,`missing properties "${e.join(", ")}"`)}var r;const o=this.codec.encoder(e).toLowerCase();return Promise.resolve(o)}parse(e){return Promise.resolve(this.codec.decoder(e))}}const De=new je},9985:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Contract:()=>nr,DefaultProtocol:()=>b,JSONParseError:()=>j,MacroError:()=>y,MichelineParseError:()=>C,MichelsonError:()=>ue,MichelsonInstructionError:()=>Ct,MichelsonTypeError:()=>fe,MichelsonValidationError:()=>ke,Parser:()=>K,ProtoGreaterOrEqual:()=>g,ProtoInferiorTo:()=>v,Protocol:()=>p,VERSION:()=>cr,assertContractValid:()=>Zt,assertDataListIfAny:()=>ot,assertDataValid:()=>Jt,assertMichelsonBigMapStorableType:()=>qe,assertMichelsonComparableType:()=>He,assertMichelsonContract:()=>Qe,assertMichelsonData:()=>Xe,assertMichelsonInstruction:()=>Ke,assertMichelsonPackableType:()=>Ge,assertMichelsonPassableType:()=>ze,assertMichelsonPushableType:()=>$e,assertMichelsonStorableType:()=>Ve,assertMichelsonType:()=>Je,assertTypeAnnotationsValid:()=>Ft,assertTypesEqual:()=>Xt,assertViewNameValid:()=>Ze,contractEntryPoint:()=>qt,contractEntryPoints:()=>Wt,contractSection:()=>$t,contractViews:()=>Vt,decodeAddressBytes:()=>kt,decodePublicKeyBytes:()=>Nt,decodePublicKeyHashBytes:()=>Lt,dummyContract:()=>ir,emitMicheline:()=>z,formatError:()=>ar,formatStack:()=>or,functionType:()=>Yt,instructionIDs:()=>Re,isContractValid:()=>er,isDataValid:()=>tr,isInstruction:()=>it,isMichelsonCode:()=>rt,isMichelsonData:()=>tt,isMichelsonError:()=>le,isMichelsonScript:()=>et,isMichelsonType:()=>nt,isTypeAnnotationsValid:()=>Qt,isTypeEqual:()=>rr,packData:()=>Pt,packDataBytes:()=>Tt,refContract:()=>h,sourceReference:()=>i,traceDumpFunc:()=>sr,unpackData:()=>xt,unpackDataBytes:()=>Mt});var n=r(227);const i=Symbol("source_reference");class o extends n.TaquitoError{constructor(e,t,r){super(),this.src=e,this.idx=t,this.message=r,this.name="ScanError"}}var s;!function(e){e[e.Comment=0]="Comment",e[e.Number=1]="Number",e[e.String=2]="String",e[e.Bytes=3]="Bytes",e[e.Ident=4]="Ident"}(s||(s={}));const a=new RegExp("\\s"),c=new RegExp("[:@%_A-Za-z]"),u=new RegExp("[@%_\\.A-Za-z0-9]"),l=new RegExp("[0-9]"),f=new RegExp("[0-9a-fA-F]");function*d(e,t=!1){let r=0;for(;r1&&"0x"===e.substring(r,r+2)){for(r+=2;r1&&"/*"===e.substring(r,r+2)){for(r+=2;r1&&"*/"===e.substring(r,r+2));)r++;if(r===e.length)throw new o(e,r,"Unterminated C style comment");r+=2,t&&(yield{t:s.Comment,v:e.slice(i,r),first:i,last:r})}else{if("("!==n&&")"!==n&&"{"!==n&&"}"!==n&&";"!==n)throw new o(e,r,`Invalid character at offset ${r}: \`${n}'`);r++,yield{t:n,v:n,first:i,last:r}}}}const h=Symbol("ref_contract");var p;!function(e){e.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",e.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",e.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",e.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(p||(p={}));const b=p.Psithaca2,m={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:12,PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw:13,PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY:13,PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg:14,PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW:15,PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc:16,PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1:16,PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf:17,ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH:19,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:20};function g(e,t){return m[e]>=m[t]}function v(e,t){return m[e][e+1,t])),i+=a,o+=u;break}case"I":o!==r.length&&(s[1]=r[o++]);break;default:throw new y(e,`${e.prim}: unexpected character: ${u}`)}return{r:n(a,c,[0,s]),n:i,an:o}}function A(e,t,r,n){const i=t[0];switch(i){case"A":return t.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},A(e,t.slice(1),[],n)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...r]}]:n.a;case"D":return t.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},A(e,t.slice(1),[],n)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...r]}]:n.d;default:throw new y(e,`${e.prim}: unexpected character: ${i}`)}}function S(e,t){let r=e.length;for(;r>0&&e[r-1]===t;)r--;return e.slice(0,r)}function P(e){const t=[],r=[];if(void 0!==e)for(const n of e)(0!==n.length&&"%"===n[0]?t:r).push(n);return{fields:t,rest:r}}function T({prim:e,annots:t,args:r}){return Object.assign(Object.assign({prim:e},t&&{annots:t}),r&&{args:r})}const I=/^P[PAI]{3,}R$/,R=/^UNP[PAI]{2,}R$/,x=/^C[AD]{2,}R$/,M=/^SET_C[AD]+R$/,k=/^MAP_C[AD]+R$/,L=/^DI{2,}P$/,N=/^DU+P$/;class C extends n.TaquitoError{constructor(e,t){super(),this.token=e,this.message=t,this.name="MichelineParseError"}}class j extends n.TaquitoError{constructor(e,t){super(),this.node=e,this.message=t,this.name="JSONParseError"}}const D=new C(null,"Unexpected EOF");function U(e){return e.t===s.Ident&&("@"===e.v[0]||"%"===e.v[0]||":"===e.v[0])}const B=new RegExp("^-?[0-9]+$"),F=new RegExp("^([0-9a-fA-F]{2})*$");class K{constructor(e){this.opt=e}expand(e){var t,r,n;if(void 0!==(null===(t=this.opt)||void 0===t?void 0:t.expandGlobalConstant)&&"constant"===e.prim){const t=function(e,t){return void 0!==e.args&&1===e.args.length&&"string"in e.args[0]&&e.args[0].string in t?t[e.args[0].string]:e}(e,this.opt.expandGlobalConstant);return t!==e&&(t[i]=Object.assign(Object.assign({},e[i]||{first:0,last:0}),{globalConstant:e})),t}if(void 0===(null===(r=this.opt)||void 0===r?void 0:r.expandMacros)||(null===(n=this.opt)||void 0===n?void 0:n.expandMacros)){const t=function(e,t){const r=(null==t?void 0:t.protocol)||b;function n(e){return void 0!==e?[{prim:"RENAME",annots:e}]:[]}switch(e.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(_(e,0))return[{prim:"COMPARE"},T({prim:e.prim.slice(3),annots:e.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(_(e,2))return[{prim:e.prim.slice(2)},T({prim:"IF",annots:e.annots,args:e.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(_(e,2))return[{prim:"COMPARE"},{prim:e.prim.slice(5)},T({prim:"IF",annots:e.annots,args:e.args})];break;case"FAIL":if(_(e,0)&&w(e))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(_(e,0)&&w(e))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(_(e,0)&&w(e))return[{prim:e.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(_(e,0)&&w(e))return[[{prim:"COMPARE"},{prim:e.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(_(e,0)&&w(e))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(_(e,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(e.annots)]}];break;case"ASSERT_LEFT":if(_(e,0))return[{prim:"IF_LEFT",args:[n(e.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(_(e,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(e.annots)]}];break;case"IF_SOME":if(_(e,2))return[T({prim:"IF_NONE",annots:e.annots,args:[e.args[1],e.args[0]]})];break;case"IF_RIGHT":if(_(e,2))return[T({prim:"IF_LEFT",annots:e.annots,args:[e.args[1],e.args[0]]})];break;case"CAR":case"CDR":if(void 0===e.args)return e;if(_(e,1)&&E(e,e.args[0])){const t=parseInt(e.args[0].int,10);return T({prim:"GET",args:[{int:"CAR"===e.prim?String(2*t+1):String(2*t)}],annots:e.annots})}}if(I.test(e.prim)&&_(e,0)){const{fields:t,rest:r}=P(e.annots),{r:n}=O(e,e.prim.slice(1),t,((e,t,r)=>[...e||[],...t||[],r]));return n.map((([e,t],i)=>{const o=[...S(t,null).map((e=>null===e?"%":e)),...0===e&&i===n.length-1?r:[]],s=T({prim:"PAIR",annots:0!==o.length?o:void 0});return 0===e?s:{prim:"DIP",args:1===e?[[s]]:[{int:String(e)},[s]]}}))}if(R.test(e.prim)){if(v(r,p.PtEdo2Zk)&&_(e,0)){const{r:t}=O(e,e.prim.slice(3),e.annots||[],((e,t,r)=>[r,...t||[],...e||[]]));return t.map((([e,t])=>{const r=[{prim:"DUP"},T({prim:"CAR",annots:null!==t[0]?[t[0]]:void 0}),{prim:"DIP",args:[[T({prim:"CDR",annots:null!==t[1]?[t[1]]:void 0})]]}];return 0===e?r:{prim:"DIP",args:1===e?[[r]]:[{int:String(e)},[r]]}}))}if("UNPAIR"===e.prim)return e;if(_(e,0)){const{r:t}=O(e,e.prim.slice(3),[],((e,t,r)=>[r,...t||[],...e||[]]));return t.map((([e])=>{const t=T({prim:"UNPAIR"});return 0===e?t:{prim:"DIP",args:1===e?[[t]]:[{int:String(e)},[t]]}}))}}if(x.test(e.prim)&&_(e,0)){const t=[...e.prim.slice(1,e.prim.length-1)];return t.map(((r,n)=>{const i=n===t.length-1?e.annots:void 0;switch(r){case"A":return T({prim:"CAR",annots:i});case"D":return T({prim:"CDR",annots:i});default:throw new y(e,`unexpected character: ${r}`)}}))}if(M.test(e.prim)&&_(e,0)){const{fields:t,rest:r}=P(e.annots);if(t.length>1)throw new y(e,`unexpected annotation on macro ${e.prim}: ${t}`);const n=0!==t.length?{a:[{prim:"DUP"},{prim:"CAR",annots:t},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[t[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:t},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",t[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return A(e,e.prim.slice(5,e.prim.length-1),r,n)}if(k.test(e.prim)&&_(e,1)){const{fields:t}=P(e.annots);if(t.length>1)throw new y(e,`unexpected annotation on macro ${e.prim}: ${t}`);const r={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[T({prim:"CAR",annots:0!==t.length?["@"+t[0].slice(1)]:void 0}),e.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[0!==t.length?t[0]:"%","%@"]}],d:[{prim:"DUP"},T({prim:"CDR",annots:0!==t.length?["@"+t[0].slice(1)]:void 0}),e.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",0!==t.length?t[0]:"%"]}]};return A(e,e.prim.slice(5,e.prim.length-1),[],r)}if(L.test(e.prim)&&_(e,1)){let t=0;for(;"I"===e.prim[1+t];)t++;return T({prim:"DIP",args:[{int:String(t)},e.args[0]]})}if(N.test(e.prim)){let t=0;for(;"U"===e.prim[1+t];)t++;if(v(r,p.PtEdo2Zk)){if(1===t){if(void 0===e.args)return e;_(e,1)&&E(e,e.args[0])&&(t=parseInt(e.args[0].int,10))}else _(e,0);return 1===t?[T({prim:"DUP",annots:e.annots})]:2===t?[{prim:"DIP",args:[[T({prim:"DUP",annots:e.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(t-1)},[T({prim:"DUP",annots:e.annots})]]},{prim:"DIG",args:[{int:String(t)}]}]}if(1===t)return e;if(_(e,0))return T({prim:"DUP",args:[{int:String(t)}],annots:e.annots})}return e}(e,this.opt);return t!==e&&(t[i]=Object.assign(Object.assign({},e[i]||{first:0,last:0}),{macro:e})),t}return e}parseListExpr(e,t){var r;const n={first:t.first,last:t.last},o="("===t.t;let a;if(o){if(a=e.next(),a.done)throw D;n.last=a.value.last}else a={value:t};if(a.value.t!==s.Ident)throw new C(a.value,`not an identifier: ${a.value.v}`);const c={prim:a.value.v,[i]:n};for(;;){const t=e.next();if(t.done){if(o)throw D;break}if(")"===t.value.t){if(!o)throw new C(t.value,"unexpected closing bracket");n.last=t.value.last;break}if(U(t.value))c.annots=c.annots||[],c.annots.push(t.value.v),n.last=t.value.last;else{c.args=c.args||[];const o=this.parseExpr(e,t.value);n.last=(null===(r=o[i])||void 0===r?void 0:r.last)||n.last,c.args.push(o)}}return this.expand(c)}parseArgs(e,t){var r;const n={first:t.first,last:t.last},o={prim:t.v,[i]:n};for(;;){const t=e.next();if(t.done||"}"===t.value.t||";"===t.value.t)return[o,t];if(U(t.value))n.last=t.value.last,o.annots=o.annots||[],o.annots.push(t.value.v);else{const s=this.parseExpr(e,t.value);n.last=(null===(r=s[i])||void 0===r?void 0:r.last)||n.last,o.args=o.args||[],o.args.push(s)}}}parseSequenceExpr(e,t){var r,n;const o={first:t.first,last:t.last},a=[];a[i]=o;const c="{"===t.t;let u="{"===t.t?null:{value:t};for(;;){if(null===u&&(u=e.next(),u.done||(o.last=u.value.last)),u.done){if(c)throw D;return a}if("}"===u.value.t){if(c)return a;throw new C(u.value,"unexpected closing bracket")}if(u.value.t===s.Ident){const[t,n]=this.parseArgs(e,u.value);o.last=(null===(r=t[i])||void 0===r?void 0:r.last)||o.last,a.push(this.expand(t)),u=n}else{const t=this.parseExpr(e,u.value);o.last=(null===(n=t[i])||void 0===n?void 0:n.last)||o.last,a.push(t),u=null}null===u&&(u=e.next(),u.done||(o.last=u.value.last)),u.done||";"!==u.value.t||(u=null)}}parseExpr(e,t){switch(t.t){case s.Ident:return this.expand({prim:t.v,[i]:{first:t.first,last:t.last}});case s.Number:return{int:t.v,[i]:{first:t.first,last:t.last}};case s.String:return{string:JSON.parse(t.v),[i]:{first:t.first,last:t.last}};case s.Bytes:return{bytes:t.v.slice(2),[i]:{first:t.first,last:t.last}};case"{":return this.parseSequenceExpr(e,t);default:return this.parseListExpr(e,t)}}parseSequence(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseSequenceExpr(t,r.value)}parseList(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseListExpr(t,r.value)}parseMichelineExpression(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseExpr(t,r.value)}parseScript(e){return this.parseSequence(e)}parseData(e){return this.parseList(e)}parseJSON(e){if("object"!=typeof e)throw new TypeError(`object type was expected, got ${typeof e} instead`);if(Array.isArray(e)){const t=[];for(const r of e){if(null===r||"object"!=typeof r)throw new j(r,`unexpected sequence element: ${r}`);t.push(this.parseJSON(r))}return t}if("prim"in e){const t=e;if("string"==typeof t.prim&&(void 0===t.annots||Array.isArray(t.annots))&&(void 0===t.args||Array.isArray(t.args))){const e={prim:t.prim};if(void 0!==t.annots){for(const e of t.annots)if("string"!=typeof e)throw new j(e,`string expected: ${e}`);e.annots=t.annots}if(void 0!==t.args){e.args=[];for(const r of t.args){if(null===r||"object"!=typeof r)throw new j(r,`unexpected argument: ${r}`);e.args.push(this.parseJSON(r))}}return this.expand(e)}throw new j(e,`malformed prim expression: ${e}`)}if("string"in e){if("string"==typeof e.string)return{string:e.string};throw new j(e,`malformed string literal: ${e}`)}if("int"in e){if("string"==typeof e.int&&B.test(e.int))return{int:e.int};throw new j(e,`malformed int literal: ${e}`)}if("bytes"in e){if("string"==typeof e.bytes&&F.test(e.bytes))return{bytes:e.bytes};throw new j(e,`malformed bytes literal: ${e}`)}throw new j(e,`unexpected object: ${e}`)}}class H{constructor(e,t=0){this.opt=e,this.lev=t}indent(e=0){var t;let r="";if(void 0!==(null===(t=this.opt)||void 0===t?void 0:t.indent))for(let t=this.lev+e;t>0;t--)r+=this.opt.indent;return r}get lf(){var e;return(null===(e=this.opt)||void 0===e?void 0:e.newline)||""}get lfsp(){var e;return(null===(e=this.opt)||void 0===e?void 0:e.newline)||" "}down(e){return new H(this.opt,this.lev+e)}}function G(e){return"prim"in e&&(void 0!==e.annots&&0!==e.annots.length||void 0!==e.args&&0!==e.args.length)}function $(e){if(void 0!==e.args)for(const t of e.args)if(Array.isArray(t)||G(t))return!0;return!1}function V(e,t,r){var n;const o=null===(n=e[i])||void 0===n?void 0:n.macro;if(r&&o)return V(o,t,r);if(Array.isArray(e))return function(e,t,r){let n="{"+t.lf,i=e.length;for(const o of e){if(n+=t.indent(1),"prim"in o){if(n+=o.prim,void 0!==o.annots)for(const e of o.annots)n+=" "+e;if(void 0!==o.args){const e=$(o);for(const i of o.args)n+=e?t.lfsp+t.indent(2)+V(i,t.down(2),r):" "+V(i,t,r)}}else n+=V(o,t.down(1),r);n+=i>1?";"+t.lfsp:t.lf,i--}return n+t.indent()+"}"}(e,t,r);if("string"in e)return JSON.stringify(e.string);if("int"in e)return e.int;if("bytes"in e)return"0x"+e.bytes;{if(!(void 0!==e.annots&&0!==e.annots.length||void 0!==e.args&&0!==e.args.length))return e.prim;let n="("+e.prim;if(void 0!==e.annots)for(const t of e.annots)n+=" "+t;if(void 0!==e.args){const i=$(e);for(const o of e.args)n+=i?t.lfsp+t.indent(1)+V(o,t.down(1),r):" "+V(o,t,r)}return n+")"}}function z(e,t,r=!1){if("object"!=typeof e)throw new TypeError(`object type was expected, got ${typeof e} instead`);return V(e,new H(t),r)}const q=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],W=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class Z extends n.TaquitoError{constructor(e){super(),this.message=e,this.name="Base58DecodingError"}}function J(e){const t=(e.length+9)%64,r=0===t?0:64-t;if(e.length>268435455)throw new n.InvalidMessageError("",`: Invalid length ${e.length} is too big -- SHA-256.`);const i=e.length<<3,o=[...e,128,...new Array(r).fill(0),0,0,0,0,i>>24&255,i>>16&255,i>>8&255,255&i];function s(e,t){return e>>>t|e<<32-t}const a=[...q],c=new Array(64),u=new Array(8);for(let e=0;e>>3,t=s(c[r-2],17)^s(c[r-2],19)^c[r-2]>>>10;c[r]=(0|t)+c[r-7]+e+c[r-16]|0,r++}for(let e=0;e<8;e++)u[e]=a[e];for(let e=0;e<64;e++){const t=s(u[0],2)^s(u[0],13)^s(u[0],22),r=s(u[4],6)^s(u[4],11)^s(u[4],25),n=u[7]+r+(u[4]&u[5]^~u[4]&u[6])+W[e]+c[e]|0,i=t+(u[0]&u[1]^u[0]&u[2]^u[1]&u[2])|0;u[7]=u[6],u[6]=u[5],u[5]=u[4],u[4]=u[3]+n|0,u[3]=u[2],u[2]=u[1],u[1]=u[0],u[0]=n+i|0}for(let e=0;e<8;e++)a[e]=a[e]+u[e]|0}const l=[];for(const e of a)l.push(e>>24&255),l.push(e>>16&255),l.push(e>>8&255),l.push(255&e);return l}const Y=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57],X=[0,1,2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73];function Q(e,t){const r=e.charCodeAt(t)-49;if(r>=Y.length||-1===Y[r])throw new Z(`Unexpected character at position ${t}: ${e[t]}`);return Y[r]}function ee(e){const t=function(e){const t=[];let r=0;for(;r0;)t.push(0);return t.reverse()}(e);if(t.length<4)throw new Z(`Data is too short ${t.length}`);const r=t.slice(0,t.length-4),n=t.slice(t.length-4),i=J(J(r));if(n[0]!==i[0]||n[1]!==i[1]||n[2]!==i[2]||n[3]!==i[3])throw new Z("Invalid checksum");return r}function te(e){const t=J(J(e));return function(e){const t=[];let r=0;for(;r0;)t.push(0);return t.reverse(),String.fromCharCode(...t.map((e=>X[e]+49)))}([...e,...t.slice(0,4)])}class re extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidMichelsonError"}}class ne extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidTypeExpressionError"}}class ie extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidDataExpressionError"}}class oe extends n.ParameterValidationError{constructor(e){super(),this.entrypoint=e,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${e}"`}}class se extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="TezosIdEncodeError"}}class ae extends n.TaquitoError{constructor(e){super(),this.message=e,this.name="LongIntegerError"}}class ce extends n.TaquitoError{constructor(e){super(),this.hexByte=e,this.name="HexParseError",this.message=`Unable to parse hex byte "${e}"`}}class ue extends n.TaquitoError{constructor(e,t){super(),this.val=e,this.message=t,this.name="MichelsonError"}}function le(e){return e instanceof ue}class fe extends ue{constructor(e,t,r){super(e,t),this.val=e,this.message=t,this.name="MichelsonTypeError",void 0!==r&&(this.data=r)}}class de{append(e){let t=0;for(;0!==e||t57)throw new ae(`unexpected character in integer constant "${e[t]}"`);this.append(r-48)}}else e<0?(this.neg=!0,this.append(-e)):this.append(e)}cmp(e){if(this.neg!==e.neg)return(e.neg?1:0)-(this.neg?1:0);{let t=0;if(this.buf.length!==e.buf.length)t=this.buf.length=0&&this.buf[r]===e.buf[r];)r--;t=r<0?0:this.buf[r]=0}catch(e){return!1}}const me=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function ge(e,t){if(Array.isArray(e))return{};let r,n,i;if(void 0!==e.annots)for(const o of e.annots)if(0!==o.length){if(!me.test(o)||!(null==t?void 0:t.specialVar)&&("@%"===o||"@%%"===o)||!(null==t?void 0:t.specialFields)&&"%@"===o)throw new ue(e,`${e.prim}: unexpected annotation: ${o}`);switch(o[0]){case"%":((null==t?void 0:t.emptyFields)||o.length>1)&&(r=r||[],r.push(o));break;case":":o.length>1&&(n=n||[],n.push(o));break;case"@":((null==t?void 0:t.emptyVar)||o.length>1)&&(i=i||[],i.push(o))}}return{f:r,t:n,v:i}}const ve={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]],RollupAddress:[20,[1,128,120,31]]};function ye(e,...t){const r=ee(e);for(const e of t){const[t,n]=ve[e];if(r.length===t+n.length){let t=0;for(;t(e>>4&15).toString(16)+(15&e).toString(16))).join("")}const Te=31,Ie={ABS:!0,ADD:!0,ADDRESS:!0,AMOUNT:!0,AND:!0,APPLY:!0,BALANCE:!0,BLAKE2B:!0,CAR:!0,CDR:!0,CHAIN_ID:!0,CHECK_SIGNATURE:!0,COMPARE:!0,CONCAT:!0,CONS:!0,EDIV:!0,EQ:!0,EXEC:!0,FAILWITH:!0,GE:!0,GET_AND_UPDATE:!0,GT:!0,HASH_KEY:!0,IMPLICIT_ACCOUNT:!0,INT:!0,ISNAT:!0,JOIN_TICKETS:!0,KECCAK:!0,LE:!0,LEVEL:!0,LSL:!0,LSR:!0,LT:!0,MEM:!0,MUL:!0,NEG:!0,NEQ:!0,NEVER:!0,NOT:!0,NOW:!0,OR:!0,PACK:!0,PAIRING_CHECK:!0,READ_TICKET:!0,SAPLING_VERIFY_UPDATE:!0,SELF:!0,SELF_ADDRESS:!0,SENDER:!0,SET_DELEGATE:!0,SHA256:!0,SHA3:!0,SHA512:!0,SIZE:!0,SLICE:!0,SOME:!0,SOURCE:!0,SPLIT_TICKET:!0,SUB:!0,SWAP:!0,TICKET:!0,TICKET_DEPRECATED:!0,TOTAL_VOTING_POWER:!0,TRANSFER_TOKENS:!0,UNIT:!0,VOTING_POWER:!0,XOR:!0,RENAME:!0,OPEN_CHEST:!0,SUB_MUTEZ:!0,MIN_BLOCK_TIME:!0,BYTES:!0,NAT:!0},Re=Object.assign({},Ie,{CONTRACT:!0,CREATE_CONTRACT:!0,DIG:!0,DIP:!0,DROP:!0,DUG:!0,DUP:!0,EMIT:!0,EMPTY_BIG_MAP:!0,EMPTY_MAP:!0,EMPTY_SET:!0,GET:!0,IF:!0,IF_CONS:!0,IF_LEFT:!0,IF_NONE:!0,ITER:!0,LAMBDA:!0,LAMBDA_REC:!0,LEFT:!0,LOOP:!0,LOOP_LEFT:!0,MAP:!0,NIL:!0,NONE:!0,PAIR:!0,PUSH:!0,RIGHT:!0,SAPLING_EMPTY_STATE:!0,UNPACK:!0,UNPAIR:!0,UPDATE:!0,CAST:!0,VIEW:!0}),xe={unit:!0,never:!0,bool:!0,int:!0,nat:!0,string:!0,chain_id:!0,bytes:!0,mutez:!0,key_hash:!0,key:!0,signature:!0,timestamp:!0,address:!0,tx_rollup_l2_address:!0},Me=Object.assign({},xe,{or:!0,pair:!0,set:!0,big_map:!0,contract:!0,lambda:!0,list:!0,map:!0,operation:!0,option:!0,bls12_381_g1:!0,bls12_381_g2:!0,bls12_381_fr:!0,sapling_transaction:!0,sapling_transaction_deprecated:!0,sapling_state:!0,ticket:!0,chest_key:!0,chest:!0});class ke extends ue{constructor(e,t){super(e,t),this.val=e,this.message=t,this.name="MichelsonValidationError"}}function Le(e){return"prim"in e}function Ne(e){if(Le(e))return!0;throw new ke(e,"prim expression expected")}function Ce(e){if(Array.isArray(e))return!0;throw new ke(e,"sequence expression expected")}function je(e){if(function(e){return Array.isArray(e)||"prim"in e}(e))return!0;throw new ke(e,"prim or sequence expression expected")}function De(e){if("-"===e.int[0])throw new ke(e,"natural number expected")}function Ue(e){if("int"in e)return!0;throw new ke(e,"int literal expected")}function Be(e){if("string"in e)return!0;throw new ke(e,"string literal expected")}function Fe(e,t){var r;if(0===t&&void 0===e.args||(null===(r=e.args)||void 0===r?void 0:r.length)===t)return!0;throw new ke(e,`${t} arguments expected`)}function Ke(e){var t,r;if(Array.isArray(e)){for(const t of e){if(!Array.isArray(t)&&!Le(t))throw new ke(e,"sequence or prim expected");Ke(t)}return!0}if(Ne(e)){if(Object.prototype.hasOwnProperty.call(Ie,e.prim))return Fe(e,0),!0;switch(e.prim){case"DROP":case"PAIR":case"UNPAIR":case"DUP":case"UPDATE":case"GET":void 0!==e.args&&Fe(e,1)&&Ue(e.args[0])&&De(e.args[0]);break;case"DIG":case"DUG":case"SAPLING_EMPTY_STATE":Fe(e,1)&&Ue(e.args[0])&&De(e.args[0]);break;case"NONE":case"LEFT":case"RIGHT":case"NIL":case"CAST":Fe(e,1)&&Je(e.args[0]);break;case"UNPACK":Fe(e,1)&&Ge(e.args[0]);break;case"CONTRACT":Fe(e,1)&&ze(e.args[0]);break;case"IF_NONE":case"IF_LEFT":case"IF_CONS":case"IF":Fe(e,2)&&(Ce(e.args[0])&&Ke(e.args[0]),Ce(e.args[1])&&Ke(e.args[1]));break;case"MAP":case"ITER":case"LOOP":case"LOOP_LEFT":Fe(e,1)&&Ke(e.args[0]);break;case"CREATE_CONTRACT":Fe(e,1)&&Qe(e.args[0]);break;case"DIP":if(2===(null===(t=e.args)||void 0===t?void 0:t.length))Ue(e.args[0])&&De(e.args[0]),Ce(e.args[1])&&Ke(e.args[1]);else{if(1!==(null===(r=e.args)||void 0===r?void 0:r.length))throw new ke(e,"1 or 2 arguments expected");Ce(e.args[0])&&Ke(e.args[0])}break;case"PUSH":Fe(e,2)&&($e(e.args[0]),Xe(e.args[1]));break;case"EMPTY_SET":Fe(e,1)&&He(e.args[0]);break;case"EMPTY_MAP":Fe(e,2)&&(He(e.args[0]),Je(e.args[1]));break;case"EMPTY_BIG_MAP":Fe(e,2)&&(He(e.args[0]),qe(e.args[1]));break;case"LAMBDA_REC":case"LAMBDA":Fe(e,3)&&(Je(e.args[0]),Je(e.args[1]),Ce(e.args[2])&&Ke(e.args[2]));break;case"VIEW":Fe(e,2)&&(Be(e.args[0])&&Ze(e.args[0]),Je(e.args[1])&&$e(e.args[1]));break;case"EMIT":e.args&&e.args.length>0?Fe(e,1):Fe(e,0);break;default:throw new ke(e,"instruction expected")}}return!0}function He(e){if(je(e))if(Array.isArray(e)||"pair"===e.prim||"or"===e.prim||"option"===e.prim)Ye(e,(e=>He(e)));else if(!Object.prototype.hasOwnProperty.call(xe,e.prim))throw new ke(e,`${e.prim}: type is not comparable`);return!0}function Ge(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim||"ticket"===e.prim)throw new ke(e,`${e.prim}: type can't be used inside PACK/UNPACK instructions`);Ye(e,(e=>Ge(e)))}return!0}function $e(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim||"ticket"===e.prim||"contract"===e.prim)throw new ke(e,`${e.prim}: type can't be pushed`);Ye(e,(e=>$e(e)))}return!0}function Ve(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"operation"===e.prim||"contract"===e.prim)throw new ke(e,`${e.prim}: type can't be used as part of a storage`);Ye(e,(e=>Ve(e)))}return!0}function ze(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"operation"===e.prim)throw new ke(e,`${e.prim}: type can't be used as part of a parameter`);Ye(e,(e=>ze(e)))}return!0}function qe(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim)throw new ke(e,`${e.prim}: type can't be used inside a big_map`);Ye(e,(e=>qe(e)))}return!0}const We=new RegExp("^[a-zA-Z0-9_.%@]*$");function Ze(e){if(e.string.length>Te)throw new ke(e,`view name too long: ${e.string}`);if(!We.test(e.string))throw new ke(e,`invalid character(s) in view name: ${e.string}`)}function Je(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim))throw new ke(e,"type expected");Ye(e,(e=>Je(e)))}return!0}function Ye(e,t){if(Array.isArray(e)||"pair"===e.prim){const r=Array.isArray(e)?e:e.args;if(void 0===r||r.length<2)throw new ke(e,"at least 2 arguments expected");return r.forEach((e=>{je(e)&&t(e)})),!0}switch(e.prim){case"option":case"list":Fe(e,1)&&je(e.args[0])&&t(e.args[0]);break;case"contract":Fe(e,1)&&ze(e.args[0]);break;case"or":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(t(e.args[0]),t(e.args[1]));break;case"lambda":Fe(e,2)&&(Je(e.args[0]),Je(e.args[1]));break;case"set":Fe(e,1)&&He(e.args[0]);break;case"map":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(He(e.args[0]),t(e.args[1]));break;case"big_map":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(He(e.args[0]),qe(e.args[1]),t(e.args[1]));break;case"ticket":Fe(e,1)&&je(e.args[0])&&He(e.args[0]);break;case"sapling_state":case"sapling_transaction":Fe(e,1)&&Ue(e.args[0]);break;default:Fe(e,0)}return!0}function Xe(e){if("int"in e||"string"in e||"bytes"in e)return!0;if(Array.isArray(e)){let t=0;for(const r of e)Le(r)&&"Elt"===r.prim?(Fe(r,2)&&(Xe(r.args[0]),Xe(r.args[1])),t++):Xe(r);if(0!==t&&t!==e.length)throw new ke(e,"data entries and map elements can't be intermixed");return!0}if(!Le(e))throw new ke(e,"data entry expected");switch(e.prim){case"Unit":case"True":case"False":case"None":Fe(e,0);break;case"Pair":if(void 0===e.args||e.args.length<2)throw new ke(e,"at least 2 arguments expected");for(const t of e.args)Xe(t);break;case"Left":case"Right":case"Some":Fe(e,1)&&Xe(e.args[0]);break;case"Lambda_rec":e.args&&Ke(e.args);break;default:if(!Object.prototype.hasOwnProperty.call(Re,e.prim))throw new ke(e,"data entry or instruction expected");Ke(e)}return!0}function Qe(e){if(Ce(e)){const t={},r={};for(const n of e)if(Ne(n)){if("view"!==n.prim){if(n.prim in t)throw new ke(e,`duplicate contract section: ${n.prim}`);t[n.prim]=!0}switch(n.prim){case"code":Fe(n,1)&&Ce(n.args[0])&&Ke(n.args[0]);break;case"parameter":if(Fe(n,1)&&ze(n.args[0]),n.annots)throw new ke(n,"Annotation must be part of the parameter type");break;case"storage":Fe(n,1)&&Ve(n.args[0]);break;case"view":if(Fe(n,4)){if(Be(n.args[0])){const t=n.args[0];if(t.string in r)throw new ke(e,`duplicate view name: ${t.string}`);r[t.string]=!0,Ze(t)}$e(n.args[1]),$e(n.args[2]),Ce(n.args[3])&&Ke(n.args[3])}break;default:throw new ke(e,`unexpected contract section: ${n.prim}`)}}}return!0}function et(e){try{return Qe(e),!0}catch(e){return!1}}function tt(e){try{return Xe(e),!0}catch(e){return!1}}function rt(e){try{return Ke(e),!0}catch(e){return!1}}function nt(e){try{return Je(e),!0}catch(e){return!1}}function it(e){return Object.prototype.hasOwnProperty.call(Re,e.prim)}function ot(e){if(!Array.isArray(e))return!1;for(const t of e)if("prim"in t){if(it(t))throw new ue(e,`Instruction outside of a lambda: ${JSON.stringify(e)}`);if("Elt"===t.prim)throw new ue(e,`Elt item outside of a map literal: ${JSON.stringify(e)}`)}return!0}"function"==typeof SuppressedError&&SuppressedError;const st=["parameter","storage","code","False","Elt","Left","None","Pair","Right","Some","True","Unit","PACK","UNPACK","BLAKE2B","SHA256","SHA512","ABS","ADD","AMOUNT","AND","BALANCE","CAR","CDR","CHECK_SIGNATURE","COMPARE","CONCAT","CONS","CREATE_ACCOUNT","CREATE_CONTRACT","IMPLICIT_ACCOUNT","DIP","DROP","DUP","EDIV","EMPTY_MAP","EMPTY_SET","EQ","EXEC","FAILWITH","GE","GET","GT","HASH_KEY","IF","IF_CONS","IF_LEFT","IF_NONE","INT","LAMBDA","LE","LEFT","LOOP","LSL","LSR","LT","MAP","MEM","MUL","NEG","NEQ","NIL","NONE","NOT","NOW","OR","PAIR","PUSH","RIGHT","SIZE","SOME","SOURCE","SENDER","SELF","STEPS_TO_QUOTA","SUB","SWAP","TRANSFER_TOKENS","SET_DELEGATE","UNIT","UPDATE","XOR","ITER","LOOP_LEFT","ADDRESS","CONTRACT","ISNAT","CAST","RENAME","bool","contract","int","key","key_hash","lambda","list","map","big_map","nat","option","or","pair","set","signature","string","bytes","mutez","timestamp","unit","operation","address","SLICE","DIG","DUG","EMPTY_BIG_MAP","APPLY","chain_id","CHAIN_ID","LEVEL","SELF_ADDRESS","never","NEVER","UNPAIR","VOTING_POWER","TOTAL_VOTING_POWER","KECCAK","SHA3","PAIRING_CHECK","bls12_381_g1","bls12_381_g2","bls12_381_fr","sapling_state","sapling_transaction_deprecated","SAPLING_EMPTY_STATE","SAPLING_VERIFY_UPDATE","ticket","TICKET_DEPRECATED","READ_TICKET","SPLIT_TICKET","JOIN_TICKETS","GET_AND_UPDATE","chest","chest_key","OPEN_CHEST","VIEW","view","constant","SUB_MUTEZ","tx_rollup_l2_address","MIN_BLOCK_TIME","sapling_transaction","EMIT","Lambda_rec","LAMBDA_REC","TICKET","BYTES","NAT"],at=Object.assign({},...st.map(((e,t)=>({[e]:t}))));var ct;!function(e){e[e.Int=0]="Int",e[e.String=1]="String",e[e.Sequence=2]="Sequence",e[e.Prim0=3]="Prim0",e[e.Prim0Annot=4]="Prim0Annot",e[e.Prim1=5]="Prim1",e[e.Prim1Annot=6]="Prim1Annot",e[e.Prim2=7]="Prim2",e[e.Prim2Annot=8]="Prim2Annot",e[e.Prim=9]="Prim",e[e.Bytes=10]="Bytes"}(ct||(ct={}));class ut{constructor(){this.buffer=[]}get length(){return this.buffer.length}writeBytes(e){this.buffer.push(...e.map((e=>255&e)))}writeUint8(e){const t=0|e;this.buffer.push(255&t)}writeUint16(e){const t=0|e;this.buffer.push(t>>8&255),this.buffer.push(255&t)}writeUint32(e){const t=0|e;this.buffer.push(t>>24&255),this.buffer.push(t>>16&255),this.buffer.push(t>>8&255),this.buffer.push(255&t)}writeInt8(e){this.writeUint8(e)}writeInt16(e){this.writeUint16(e)}writeInt32(e){this.writeUint32(e)}}const lt=new Error("bounds out of range");class ft{constructor(e,t=0,r=e.length){this.buffer=e,this.idx=t,this.cap=r}get length(){return this.cap-this.idx}readBytes(e){if(this.cap-this.idx>>0}readUint16(){if(this.cap-this.idx<2)throw lt;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readUint32(){if(this.cap-this.idx<4)throw lt;return(this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readInt8(){if(this.cap-this.idx<1)throw lt;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw lt;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])<<16>>16}readInt32(){if(this.cap-this.idx<4)throw lt;return this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++]}}var dt,ht,pt;function bt(e){let t;const r=e.readUint8();switch(r){case ht.ED25519:t="ED25519PublicKeyHash";break;case ht.SECP256K1:t="SECP256K1PublicKeyHash";break;case ht.P256:t="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${r}`)}return{type:t,hash:e.readBytes(20)}}function mt(e){let t;const r=e.readUint8();switch(r){case dt.Implicit:t=bt(e);break;case dt.Originated:t={type:"ContractHash",hash:e.readBytes(20)},e.readBytes(1);break;default:throw new Error(`unknown address tag: ${r}`)}if(0!==e.length){const r=new TextDecoder;t.entryPoint=r.decode(new Uint8Array(e.readBytes(e.length)))}return t}function gt(e,t){let r;switch(e.type){case"ED25519PublicKeyHash":r=ht.ED25519;break;case"SECP256K1PublicKeyHash":r=ht.SECP256K1;break;case"P256PublicKeyHash":r=ht.P256;break;default:throw new Error(`unexpected address type: ${e.type}`)}t.writeUint8(r),t.writeBytes(Array.from(e.hash))}function vt(e){let t,r;const n=e.readUint8();switch(n){case pt.ED25519:r="ED25519PublicKey",t=32;break;case pt.SECP256K1:r="SECP256K1PublicKey",t=33;break;case pt.P256:r="P256PublicKey",t=33;break;default:throw new Error(`unknown public key tag: ${n}`)}return{type:r,publicKey:e.readBytes(t)}}function yt(e,t,r){var n,i;const[o,s]=r(e);if(Array.isArray(o)){const e=new ut;for(const t of o){const r=s.next();if(r.done)throw new Error("REPORT ME: iterator is done");yt(t,e,r.value)}return t.writeUint8(ct.Sequence),t.writeUint32(e.length),void t.writeBytes(e.buffer)}if("string"in o){const e=(new TextEncoder).encode(o.string);return t.writeUint8(ct.String),t.writeUint32(e.length),void t.writeBytes(Array.from(e))}if("int"in o){t.writeUint8(ct.Int);let e=BigInt(o.int);const r=e<0;r&&(e=-e);let n=0;do{const i=0===n?BigInt(6):BigInt(7);let o=e&(BigInt(1)<>=i,e&&(o|=BigInt(128)),0===n&&r&&(o|=BigInt(64)),t.writeUint8(Number(o)),n++}while(e);return}if("bytes"in o){const e=function(e){const t=[];for(let r=0;r=3&&t.writeUint32(0)}function _t(e,t){function*r(){for(;;)yield Rt}const[n,i]=t,o=e.readUint8();switch(o){case ct.Int:{const t=[];let r;do{r=e.readInt8(),t.push(r)}while(0!=(128&r));let n=BigInt(0),o=!1;for(let e=t.length-1;e>=0;e--){const r=0===e?BigInt(6):BigInt(7),i=BigInt(t[e]);n<<=r,n|=i&(BigInt(1)<0;){const e=a.next();if(e.done)throw new Error("REPORT ME: iterator is done");o.push(_t(r,e.value))}a=n(o),s=e}return i(o)}default:{if(o>9)throw new Error(`Unknown tag: ${o}`);const t=e.readUint8();if(t>=st.length)throw new Error(`Unknown primitive tag: ${t}`);const s=st[t],a=o-3>>1;let c={prim:s},u=r(),l=e.copy();for(let t=0;t<2;t++){if(c={prim:s},a<3)for(let e=0;e0;){const e=u.next();if(e.done)throw new Error("REPORT ME: iterator is done");c.args.push(_t(t,e.value))}}u=n(c),l=e}if(1==(o-3&1)||3===a){const t=e.readUint32();if(0!==t){const r=e.readBytes(t),n=new TextDecoder;c.annots=n.decode(new Uint8Array(r)).split(" ")}}return i(c)}}}!function(e){e[e.Implicit=0]="Implicit",e[e.Originated=1]="Originated"}(dt||(dt={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.P256=2]="P256"}(ht||(ht={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.P256=2]="P256"}(pt||(pt={}));const wt=e=>"prim"in e&&("Left"===e.prim||"Right"===e.prim),Et=e=>"prim"in e&&("Some"===e.prim||"None"===e.prim),Ot=e=>{if(Ee(e))return t=>{if(!Oe(t))throw new fe(e,`pair expected: ${JSON.stringify(t)}`,t);ot(t);const r=we("pair",e);return[we("Pair",t),function*(){for(const e of r.args)yield Ot(e)}()]};switch(e.prim){case"or":return t=>{if(!wt(t))throw new fe(e,`or expected: ${JSON.stringify(t)}`,t);return[t,function*(){yield Ot(e.args["Left"===t.prim?0:1])}()]};case"option":return t=>{if(!Et(t))throw new fe(e,`option expected: ${JSON.stringify(t)}`,t);return[t,function*(){"Some"===t.prim&&(yield Ot(e.args[0]))}()]};case"list":case"set":return t=>{if(!Array.isArray(t))throw new fe(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const r of t)yield Ot(e.args[0])}()]};case"map":return t=>{if(!Array.isArray(t))throw new fe(e,`map expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const r of t)yield t=>{if(!("prim"in t)||"Elt"!==t.prim)throw new fe(e,`map element expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const t of e.args)yield Ot(t)}()]}}()]};case"chain_id":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`chain id expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ChainID");if(null===n)throw new fe(e,`chain id base58 expected: ${t.string}`,t);r={bytes:Pe(n[1])}}else r=t;return[r,[][Symbol.iterator]()]};case"signature":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`signature expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature");if(null===n)throw new fe(e,`signature base58 expected: ${t.string}`,t);r={bytes:Pe(n[1])}}else r=t;return[r,[][Symbol.iterator]()]};case"key_hash":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`key hash expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash");if(null===n)throw new fe(e,`key hash base58 expected: ${t.string}`,t);const i=new ut;gt({type:n[0],hash:n[1]},i),r={bytes:Pe(i.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"key":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`public key expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey");if(null===n)throw new fe(e,`public key base58 expected: ${t.string}`,t);const i=new ut;!function(e,t){let r;switch(e.type){case"ED25519PublicKey":r=pt.ED25519;break;case"SECP256K1PublicKey":r=pt.SECP256K1;break;case"P256PublicKey":r=pt.P256;break;default:throw new Error(`unexpected public key type: ${e.type}`)}t.writeUint8(r),t.writeBytes(Array.from(e.publicKey))}({type:n[0],publicKey:n[1]},i),r={bytes:Pe(i.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"address":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=t.string.split("%"),i=ye(n[0],"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash");if(null===i)throw new fe(e,`address base58 expected: ${t.string}`,t);const o=new ut;!function(e,t){if("ContractHash"===e.type?(t.writeUint8(dt.Originated),t.writeBytes(Array.from(e.hash)),t.writeUint8(0)):(t.writeUint8(dt.Implicit),gt(e,t)),void 0!==e.entryPoint&&""!==e.entryPoint&&"default"!==e.entryPoint){const r=(new TextEncoder).encode(e.entryPoint);t.writeBytes(Array.from(r))}}({type:i[0],hash:i[1],entryPoint:n.length>1?n[1]:void 0},o),r={bytes:Pe(o.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"timestamp":return t=>{if(!("string"in t)&&!("int"in t))throw new fe(e,`timestamp expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=Se(t);if(null===n)throw new fe(e,`can't parse date: ${t.string}`,t);r={int:String(Math.floor(n.getTime()/1e3))}}else r=t;return[r,[][Symbol.iterator]()]};default:return St}},At=e=>"prim"in e&&"PUSH"===e.prim,St=e=>At(e)?(Ke(e),[e,function*(){yield St,yield Ot(e.args[0])}()]):[e,function*(){for(;;)yield St}()];function Pt(e,t){const r=new ut;return r.writeUint8(5),yt(e,r,void 0!==t?Ot(t):St),r.buffer}function Tt(e,t){return{bytes:Pe(Pt(e,t))}}const It=e=>{if(Ee(e))return[t=>{if(!Oe(t))throw new fe(e,`pair expected: ${JSON.stringify(t)}`,t);const r=we("pair",e);return function*(){for(const e of r.args)yield It(e)}()},e=>e];switch(e.prim){case"or":return[t=>{if(!wt(t))throw new fe(e,`or expected: ${JSON.stringify(t)}`,t);return function*(){yield It(e.args["Left"===t.prim?0:1])}()},e=>e];case"option":return[t=>{if(!Et(t))throw new fe(e,`option expected: ${JSON.stringify(t)}`,t);return function*(){"Some"===t.prim&&(yield It(e.args[0]))}()},e=>e];case"list":case"set":return[t=>{if(!Array.isArray(t))throw new fe(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);return function*(){for(;;)yield It(e.args[0])}()},e=>e];case"map":return[t=>{if(!Array.isArray(t))throw new fe(e,`map expected: ${JSON.stringify(t)}`,t);return function*(){for(;;)yield[t=>{if(!("prim"in t)||"Elt"!==t.prim)throw new fe(e,`map element expected: ${JSON.stringify(t)}`,t);return function*(){for(const t of e.args)yield It(t)}()},e=>e]}()},e=>e];case"chain_id":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`chain id expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);return{string:_e("ChainID",r)}}];case"signature":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`signature expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);return{string:_e("GenericSignature",r)}}];case"key_hash":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`key hash expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=bt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"key":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`public key expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=vt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.publicKey)}}];case"address":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=mt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"timestamp":return[()=>[][Symbol.iterator](),t=>{if(!("int"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;return{string:new Date(1e3*parseInt(t.int,10)).toISOString().slice(0,19)+"Z"}}];default:return Rt}},Rt=[e=>At(e)?(Ke(e),function*(){yield Rt,yield It(e.args[0])}()):function*(){for(;;)yield Rt}(),e=>e];function xt(e,t){const r=new ft(e);if(5!==r.readUint8())throw new Error("incorrect packed data magic number");const n=_t(r,void 0!==t?It(t):Rt);if(Xe(n))return n;throw new Error}function Mt(e,t){const r=he(e.bytes);if(null===r)throw new Error(`can't parse bytes: "${e.bytes}"`);return xt(r,t)}function kt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return mt(new ft(new Uint8Array(t)))}function Lt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return bt(new ft(new Uint8Array(t)))}function Nt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return vt(new ft(new Uint8Array(t)))}class Ct extends ue{constructor(e,t,r){super(e,r),this.val=e,this.stackState=t,this.message=r,this.name="MichelsonInstructionError"}}function jt(e){return Array.isArray(e)?"pair":e.prim}function Dt(e){return"prim"in e?e.args:e}function Ut(e,t,r=!1){if(jt(e)!==jt(t))throw new fe(e,`types mismatch: ${jt(e)} != ${jt(t)}`,void 0);const n=[ge(e),ge(t)];if(n[0].t&&n[1].t&&n[0].t[0]!==n[1].t[0])throw new fe(e,`${jt(e)}: type names mismatch: ${n[0].t[0]} != ${n[1].t[0]}`,void 0);if(r&&n[0].f&&n[1].f&&n[0].f[0]!==n[1].f[0])throw new fe(e,`${jt(e)}: field names mismatch: ${n[0].f[0]} != ${n[1].f}`,void 0);if(Ee(e)){const r=we("pair",e),n=we("pair",t);return Ut(r.args[0],n.args[0],!0),void Ut(r.args[1],n.args[1],!0)}switch(e.prim){case"option":case"list":case"contract":case"set":case"ticket":Ut(e.args[0],t.args[0]);break;case"or":Ut(e.args[0],t.args[0],!0),Ut(e.args[1],t.args[1],!0);break;case"lambda":case"map":case"big_map":Ut(e.args[0],t.args[0]),Ut(e.args[1],t.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(e.args[0].int,10)!==parseInt(t.args[0].int,10))throw new fe(e,`${jt(e)}: type argument mismatch: ${e.args[0].int} != ${t.args[0].int}`,void 0)}}function Bt(e,t){if(e.length!==t.length)throw new fe(e,`stack length mismatch: ${e.length} != ${t.length}`,void 0);for(let r=0;r1)throw new fe(e,`${e.prim}: at most one type annotation allowed: ${e.annots}`,void 0);if(t){if(((null===(n=o.f)||void 0===n?void 0:n.length)||0)>1)throw new fe(e,`${e.prim}: at most one field annotation allowed: ${e.annots}`,void 0)}else if(((null===(i=o.f)||void 0===i?void 0:i.length)||0)>0)throw new fe(e,`${e.prim}: field annotations aren't allowed: ${e.annots}`,void 0)}if(Ee(e)){const t=Dt(e);for(const e of t)Ft(e,!0)}else switch(e.prim){case"option":case"list":case"contract":case"set":Ft(e.args[0]);break;case"or":for(const t of e.args)Ft(t,!0);break;case"lambda":case"map":case"big_map":Ft(e.args[0]),Ft(e.args[1])}}function Kt(e){if(!Array.isArray(e))return!1;for(const t of e)if(!(Array.isArray(t)&&Kt(t)||"prim"in t&&it(t)))return!1;return!0}function Ht(e,t,r){if(Ee(t)){if(Oe(e)){ot(e);const n=we("Pair",e),i=we("pair",t);return Ht(n.args[0],i.args[0],r),void Ht(n.args[1],i.args[1],r)}throw new fe(t,`pair expected: ${JSON.stringify(e)}`,e)}switch(t.prim){case"int":if("int"in e&&pe(e.int))return;throw new fe(t,`integer value expected: ${JSON.stringify(e)}`,e);case"nat":case"mutez":if("int"in e&&be(e.int))return;throw new fe(t,`natural value expected: ${JSON.stringify(e)}`,e);case"string":if("string"in e)return;throw new fe(t,`string value expected: ${JSON.stringify(e)}`,e);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in e&&null!==he(e.bytes))return;throw new fe(t,`bytes value expected: ${JSON.stringify(e)}`,e);case"bool":if("prim"in e&&("True"===e.prim||"False"===e.prim))return;throw new fe(t,`boolean value expected: ${JSON.stringify(e)}`,e);case"key_hash":if("string"in e&&null!==ye(e.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash"))return;if("bytes"in e)try{return void Lt(e)}catch(e){}throw new fe(t,`key hash expected: ${JSON.stringify(e)}`,e);case"timestamp":if(("string"in e||"int"in e)&&null!==Se(e))return;throw new fe(t,`timestamp expected: ${JSON.stringify(e)}`,e);case"address":if("string"in e){let t=e.string;const r=e.string.indexOf("%");if(r>=0&&(t=e.string.slice(0,r)),null!==ye(t,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress"))return}else if("bytes"in e)try{return void kt(e)}catch(e){}throw new fe(t,`address expected: ${JSON.stringify(e)}`,e);case"key":if("string"in e&&null!==ye(e.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey"))return;if("bytes"in e)try{return void Nt(e)}catch(e){}throw new fe(t,`public key expected: ${JSON.stringify(e)}`,e);case"unit":if("prim"in e&&"Unit"===e.prim)return;throw new fe(t,`unit value expected: ${JSON.stringify(e)}`,e);case"signature":if("bytes"in e||"string"in e&&null!==ye(e.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature"))return;throw new fe(t,`signature expected: ${JSON.stringify(e)}`,e);case"chain_id":if("bytes"in e||"string"in e){if(null!==("string"in e?ee(e.string):he(e.bytes)))return}throw new fe(t,`chain id expected: ${JSON.stringify(e)}`,e);case"option":if("prim"in e){if("None"===e.prim)return;if("Some"===e.prim)return void Ht(e.args[0],t.args[0],r)}throw new fe(t,`option expected: ${JSON.stringify(e)}`,e);case"list":case"set":if(ot(e)){for(const n of e)Ht(n,t.args[0],r);return}throw new fe(t,`${t.prim} expected: ${JSON.stringify(e)}`,e);case"or":if("prim"in e){if("Left"===e.prim)return void Ht(e.args[0],t.args[0],r);if("Right"===e.prim)return void Ht(e.args[0],t.args[1],r)}throw new fe(t,`union (or) expected: ${JSON.stringify(e)}`,e);case"lambda":if(Kt(e)){const n=Gt(e,[t.args[0]],r);if("failed"in n)throw new fe(t,`function is failed with error type: ${n.failed}`,e);if(1!==n.length)throw new fe(t,"function must return a value",e);return void Ut(t.args[1],n[0])}throw new fe(t,`function expected: ${JSON.stringify(e)}`,e);case"map":case"big_map":if(Array.isArray(e)){for(const n of e){if(!("prim"in n)||"Elt"!==n.prim)throw new fe(t,`map elements expected: ${JSON.stringify(e)}`,e);Ht(n.args[0],t.args[0],r),Ht(n.args[1],t.args[1],r)}return}throw new fe(t,`${t.prim} expected: ${JSON.stringify(e)}`,e);case"bls12_381_fr":if("int"in e&&pe(e.int)||"bytes"in e&&null!==he(e.bytes))return;throw new fe(t,`BLS12-381 element expected: ${JSON.stringify(e)}`,e);case"sapling_state":if(Array.isArray(e))return;throw new fe(t,`sapling state expected: ${JSON.stringify(e)}`,e);case"ticket":return void Ht(e,{prim:"pair",args:[{prim:"address"},t.args[0],{prim:"nat"}]},r);default:throw new fe(t,`type ${jt(t)} don't have Michelson literal representation`,e)}}function Gt(e,t,r){const n=(null==r?void 0:r.protocol)||b;if(Array.isArray(e))return function(e,t,r){let n=t,i=t,o=0;for(const t of e){const e=Gt(t,i,r);if(n=e,"failed"in e)break;i=e,o++}if("failed"in n&&0==n.level&&(!("prim"in n.failed)||"never"!==n.failed.prim)&&o!==e.length-1)throw new Ct(e,n,"FAIL must appear in a tail position");if(void 0!==(null==r?void 0:r.traceCallback)){const i={op:e,in:t,out:n};r.traceCallback(i)}return"failed"in n?{failed:n.failed,level:n.level+1}:n}(e,t,r);const i=e;function o(e,...r){if(t.length{try{return e(...r)}catch(e){throw e instanceof ue?new Ct(i,t,e.message):e}}}function a(e){return r=>{try{return e(r)}catch(e){throw e instanceof ue?new Ct(i,t,e.message):e}}}const c=s(ge),u=s(Bt),l=s(Ut),f=a(He),d=a(Ge),m=a(Ve),g=a($e),y=a(qe);function _(e,r){const n=c(i,Object.assign(Object.assign({},r),{emptyFields:void 0!==e.f&&e.f>1,emptyVar:void 0!==e.v&&e.v>1})),o=(e,r,n)=>{if(e&&e.length>(r||0))throw new Ct(i,t,`${i.prim}: at most ${r||0} ${n} annotations allowed`)};return o(n.f,e.f,"field"),o(n.t,e.t,"type"),o(n.v,e.v,"variable"),n}function w(e,t){const r=e,n=Array.isArray(r)?{prim:"pair",args:r}:r,i=c(n),o=void 0!==t.v||void 0!==t.t||void 0!==t.f?[...(null===t.v?i.v:t.v)||[],...(null===t.t?i.t:t.t)||[],...(null===t.f?i.f:t.f)||[]]:void 0,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i["@"+(e.v?e.v[0].slice(1)+".":"")+t];function I(e,t){return"failed"in e||"failed"in t?"failed"in e?t:e:(u(e,t),e)}const R=(e=>{var i,s,a,b,R;switch(e.prim){case"DUP":{const r=e.args?parseInt(e.args[0].int,10):1;if(0===r)throw new Ct(e,t,"DUP 0 is forbidden");const n=o(r-1,null)[0];if("ticket"===jt(n))throw new Ct(e,t,"ticket can't be DUPed");return[n,...t]}case"SWAP":{const e=o(0,null,null);return _({}),[e[1],e[0],...t.slice(2)]}case"SOME":return[w({prim:"option",args:[o(0,null)[0]]},_({t:1,v:1})),...t.slice(1)];case"UNIT":return[w({prim:"unit"},_({v:1,t:1})),...t];case"PAIR":{const r=e.args?parseInt(e.args[0].int,10):2;if(r<2)throw new Ct(e,t,`PAIR ${r} is forbidden`);const n=o(0,...new Array(r).fill(null)),i=_({f:r,t:1,v:1},{specialFields:!0}),s=e=>{const t=e.lastIndexOf(".");return e.slice(t>0?t+1:1)},a=n.map(((e,t)=>{var r;const n=c(e);return w(e,{v:null,t:null,f:i.f&&i.f.length>t&&"%"!==i.f[t]?"%@"===i.f[t]?n.v?["%"+s((null===(r=n.v)||void 0===r?void 0:r[0])||"")]:void 0:[i.f[t]]:void 0})}));return[w({prim:"pair",args:a},{t:i.t,v:i.v}),...t.slice(r)]}case"UNPAIR":{const r=e.args?parseInt(e.args[0].int,10):2;if(r<2)throw new Ct(e,t,`UNPAIR ${r} is forbidden`);const n=o(0,["pair"])[0],i=_({f:2,v:2},{specialVar:!0});return[...A(n,r).map(((e,t)=>O(n,e,i,t,0===t?"car":"cdr"))),...t.slice(1)]}case"CAR":case"CDR":{const r=we("pair",o(0,["pair"])[0]);return[O(r,r.args["CAR"===e.prim?0:1],_({f:1,v:1},{specialVar:!0}),0,e.prim.toLocaleLowerCase()),...t.slice(1)]}case"CONS":{const e=o(0,null,["list"]);return l(e[0],e[1].args[0]),[E({prim:"list",args:[e[1].args[0]]}),...t.slice(2)]}case"SIZE":return o(0,["string","list","set","map","bytes"]),[E({prim:"nat"}),...t.slice(1)];case"MEM":{const e=o(0,null,["set","map","big_map"]);return f(e[0]),l(e[0],e[1].args[0]),[E({prim:"bool"}),...t.slice(2)]}case"GET":if(e.args){const r=parseInt(e.args[0].int,10);return[E(S(o(0,["pair"])[0],r)),...t.slice(1)]}{const e=o(0,null,["map","big_map"]);return f(e[0]),l(e[0],e[1].args[0]),[E({prim:"option",args:[e[1].args[1]]}),...t.slice(2)]}case"UPDATE":if(e.args){const r=parseInt(e.args[0].int,10),n=o(0,null,["pair"]);return[E(P(n[1],n[0],r)),...t.slice(2)]}{const e=o(0,null,["bool","option"]);if(f(e[0]),"bool"===e[1].prim){const r=o(2,["set"]);return l(e[0],r[0].args[0]),[E({prim:"set",args:[w(e[0],{t:null})]}),...t.slice(3)]}const r=o(2,["map","big_map"]);return l(e[0],r[0].args[0]),"map"===r[0].prim?[E({prim:"map",args:[w(e[0],{t:null}),w(e[1].args[0],{t:null})]}),...t.slice(3)]:(y(e[1].args[0]),[E({prim:"big_map",args:[w(e[0],{t:null}),w(e[1].args[0],{t:null})]}),...t.slice(3)])}case"GET_AND_UPDATE":{const e=_({v:2}),r=o(0,null,["option"],["map","big_map"]);f(r[0]),l(r[0],r[2].args[0]),l(r[1].args[0],r[2].args[1]);const n=null===(i=e.v)||void 0===i?void 0:i.map((e=>"@"!==e?[e]:void 0));return"map"===r[2].prim?[w({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),w({prim:"map",args:[w(r[0],{t:null}),w(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...t.slice(3)]:(y(r[1].args[0]),[w({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),w({prim:"big_map",args:[w(r[0],{t:null}),w(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...t.slice(3)])}case"EXEC":{const e=o(0,null,["lambda"]);return l(e[0],e[1].args[0]),[E(e[1].args[1]),...t.slice(2)]}case"APPLY":{const r=o(0,null,["lambda"]);if(m(r[0]),g(r[0]),!Ee(r[1].args[0]))throw new Ct(e,t,`${e.prim}: function's argument must be a pair: ${jt(r[1].args[0])}`);const n=r[1].args[0];return l(r[0],Dt(n)[0]),[E({prim:"lambda",args:[Dt(n)[1],r[1].args[1]]}),...t.slice(2)]}case"FAILWITH":{const e=o(0,null)[0];return v(n,p.PtEdo2Zk)||d(e),{failed:e,level:0}}case"NEVER":return o(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[E(o(0,null)[0]),...t.slice(1)];case"CONCAT":{const r=o(0,["string","list","bytes"]);if("list"===r[0].prim){if("string"!==jt(r[0].args[0])&&"bytes"!==jt(r[0].args[0]))throw new Ct(e,t,`${e.prim}: can't concatenate list of ${jt(r[0].args[0])}'s`);return[E(r[0].args[0]),...t.slice(1)]}const n=o(1,["string","bytes"]);if(r[0].prim!==n[0].prim)throw new Ct(e,t,`${e.prim}: can't concatenate ${r[0].prim} with ${n[0].prim}`);return[E(n[0]),...t.slice(2)]}case"SLICE":return[E({prim:"option",args:[o(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...t.slice(3)];case"PACK":{const e=o(0,null)[0];return d(e),[E({prim:"bytes"},"@packed"),...t.slice(1)]}case"ADD":{const r=o(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("int"===r[0].prim&&"timestamp"===r[1].prim||"timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...t.slice(2)];if(("int"===r[0].prim||"nat"===r[0].prim||"mutez"===r[0].prim||"bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't add ${r[0].prim} to ${r[1].prim}`)}case"SUB":{const r=v(n,p.PsiThaCa)?o(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):o(0,["nat","int","timestamp"],["nat","int","timestamp"]);if(("nat"===r[0].prim||"int"===r[0].prim)&&("nat"===r[1].prim||"int"===r[1].prim)||"timestamp"===r[0].prim&&"timestamp"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...t.slice(2)];if("mutez"===r[0].prim&&"mutez"===r[1].prim)return[E({prim:"mutez"}),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't subtract ${r[0].prim} from ${r[1].prim}`)}case"SUB_MUTEZ":return o(0,["mutez"],["mutez"]),[E({prim:"option",args:[{prim:"mutez"}]}),...t.slice(2)];case"MUL":{const r=o(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("nat"===r[0].prim&&"mutez"===r[1].prim||"mutez"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"mutez"}),...t.slice(2)];if(("bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[0].prim||"int"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...t.slice(2)];if(("nat"===r[0].prim||"int"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[1].prim||"int"===r[1].prim)&&"bls12_381_fr"===r[0].prim)return[E({prim:"bls12_381_fr"}),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't multiply ${r[0].prim} by ${r[1].prim}`)}case"EDIV":{const r=(e,t)=>({prim:"option",args:[{prim:"pair",args:[{prim:e},{prim:t}]}]}),n=o(0,["nat","int","mutez"],["nat","int","mutez"]);if("nat"===n[0].prim&&"nat"===n[1].prim)return[E(r("nat","nat")),...t.slice(2)];if(!("nat"!==n[0].prim&&"int"!==n[0].prim||"nat"!==n[1].prim&&"int"!==n[1].prim))return[E(r("int","nat")),...t.slice(2)];if("mutez"===n[0].prim&&"nat"===n[1].prim)return[E(r("mutez","mutez")),...t.slice(2)];if("mutez"===n[0].prim&&"mutez"===n[1].prim)return[E(r("nat","mutez")),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't euclideally divide ${n[0].prim} by ${n[1].prim}`)}case"ABS":return o(0,["int"]),[E({prim:"nat"}),...t.slice(1)];case"ISNAT":return o(0,["int"]),[E({prim:"option",args:[{prim:"nat"}]}),...t.slice(1)];case"INT":return o(0,["nat","bls12_381_fr","bytes"]),[E({prim:"int"}),...t.slice(1)];case"BYTES":return o(0,["nat","int"]),[E({prim:"bytes"}),...t.slice(1)];case"NAT":return o(0,["bytes"]),[E({prim:"nat"}),...t.slice(1)];case"NEG":{const e=o(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return"nat"===e.prim||"int"===e.prim?[E({prim:"int"}),...t.slice(1)]:[E(e),...t.slice(1)]}case"LSL":case"LSR":return o(0,["nat","bytes"],["nat","bytes"]),[E({prim:"nat"}),...t.slice(2)];case"OR":case"XOR":{const r=o(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(r[0].prim!==r[1].prim)throw new Ct(e,t,`${e.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...t.slice(2)]}case"AND":{const r=o(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if(("int"!==r[0].prim||"nat"!==r[1].prim)&&r[0].prim!==r[1].prim)throw new Ct(e,t,`${e.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...t.slice(2)]}case"NOT":return"bool"===o(0,["nat","bytes","bool","int"])[0].prim?[E({prim:"bool"}),...t.slice(1)]:[E({prim:"int"}),...t.slice(1)];case"COMPARE":{const e=o(0,null,null);return f(e[0]),f(e[1]),[E({prim:"int"}),...t.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return o(0,["int"]),[E({prim:"bool"}),...t.slice(1)];case"SELF":{if(void 0===(null==r?void 0:r.contract))throw new Ct(e,t,`${e.prim}: contract required`);const n=_({f:1,v:1}),i=qt(r.contract,null===(s=n.f)||void 0===s?void 0:s[0]);if(null===i)throw new Ct(e,t,`${e.prim}: contract has no entrypoint ${i}`);return[w({prim:"contract",args:[i]},{v:n.v?n.v:["@self"]}),...t]}case"TRANSFER_TOKENS":{const e=o(0,null,["mutez"],["contract"]);return l(e[0],e[2].args[0]),[E({prim:"operation"}),...t.slice(3)]}case"SET_DELEGATE":{const r=o(0,["option"])[0];if("key_hash"!==jt(r.args[0]))throw new Ct(e,t,`${e.prim}: key hash expected: ${jt(r.args[0])}`);return[E({prim:"operation"}),...t.slice(1)]}case"IMPLICIT_ACCOUNT":return o(0,["key_hash"]),[E({prim:"contract",args:[{prim:"unit"}]}),...t.slice(1)];case"NOW":return[E({prim:"timestamp"},"@now"),...t];case"AMOUNT":return[E({prim:"mutez"},"@amount"),...t];case"BALANCE":return[E({prim:"mutez"},"@balance"),...t];case"CHECK_SIGNATURE":return o(0,["key"],["signature"],["bytes"]),[E({prim:"bool"}),...t.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return o(0,["bytes"]),[E({prim:"bytes"}),...t.slice(1)];case"HASH_KEY":return o(0,["key"]),[E({prim:"key_hash"}),...t.slice(1)];case"SOURCE":return[E({prim:"address"},"@source"),...t];case"SENDER":return[E({prim:"address"},"@sender"),...t];case"ADDRESS":{const e=o(0,["contract"])[0],r=_({v:1});return[w({prim:"address",[h]:e},{v:r.v?r.v:T(c(e),"address")}),...t.slice(1)]}case"SELF_ADDRESS":{const e={prim:"address"};return void 0!==(null==r?void 0:r.contract)&&(e[h]={prim:"contract",args:[$t(r.contract,"parameter").args[0]]}),[E(e,"@address"),...t]}case"CHAIN_ID":return[E({prim:"chain_id"}),...t];case"DROP":{_({});const r=void 0!==e.args?parseInt(e.args[0].int,10):1;return o(r-1,null),t.slice(r)}case"DIG":{_({});const r=parseInt(e.args[0].int,10);return[o(r,null)[0],...t.slice(0,r),...t.slice(r+1)]}case"DUG":{_({});const r=parseInt(e.args[0].int,10);return[...t.slice(1,r+1),o(0,null)[0],...t.slice(r+1)]}case"NONE":return Ft(e.args[0]),[w({prim:"option",args:[e.args[0]]},_({t:1,v:1})),...t];case"LEFT":case"RIGHT":{const r=o(0,null)[0],n=_({f:2,t:1,v:1},{specialFields:!0}),i=c(r),s=[w(r,{t:null,v:null,f:n.f&&n.f.length>0&&"%"!==n.f[0]?"%@"===n.f[0]?i.v?["%"+i.v[0].slice(1)]:void 0:n.f:void 0}),w(e.args[0],{t:null,f:n.f&&n.f.length>1&&"%"!==n.f[1]?n.f:void 0})];return[w({prim:"or",args:"LEFT"===e.prim?s:[s[1],s[0]]},{t:n.t,v:n.v}),...t.slice(1)]}case"NIL":return Ft(e.args[0]),[w({prim:"list",args:[e.args[0]]},_({t:1,v:1})),...t];case"UNPACK":return o(0,["bytes"]),Ft(e.args[0]),[E({prim:"option",args:[e.args[0]]},"@unpacked"),...t.slice(1)];case"CONTRACT":{const r=o(0,["address"])[0];Ft(e.args[0]);const n=_({v:1,f:1}),i=r[h];if(void 0!==i){const r=qt(i,null===(a=n.f)||void 0===a?void 0:a[0]);if(null===r)throw new Ct(e,t,`${e.prim}: contract has no entrypoint ${r}`);l(r,e.args[0])}return[w({prim:"option",args:[{prim:"contract",args:[e.args[0]]}]},{v:n.v?n.v:T(c(r),"contract")}),...t.slice(1)]}case"CAST":{_({});const r=o(0,null)[0];return Ft(e.args[0]),l(e.args[0],r),[e.args[0],...t.slice(1)]}case"IF_NONE":{_({});const n=o(0,["option"])[0],i=t.slice(1);return I(Gt(e.args[0],i,r),Gt(e.args[1],[w(n.args[0],{t:null,v:T(c(n),"some")}),...i],r))}case"IF_LEFT":{_({});const n=o(0,["or"])[0],i=c(n),s=c(n.args[0]),a=c(n.args[1]),u=t.slice(1);return I(Gt(e.args[0],[w(n.args[0],{t:null,v:T(i,s.f?s.f[0].slice(1):"left")}),...u],r),Gt(e.args[1],[w(n.args[1],{t:null,v:T(i,a.f?a.f[0].slice(1):"right")}),...u],r))}case"IF_CONS":{_({});const n=o(0,["list"])[0],i=c(n),s=t.slice(1);return I(Gt(e.args[0],[w(n.args[0],{t:null,v:T(i,"hd")}),w(n,{t:null,v:T(i,"tl")}),...s],r),Gt(e.args[1],s,r))}case"IF":{_({}),o(0,["bool"]);const n=t.slice(1);return I(Gt(e.args[0],n,r),Gt(e.args[1],n,r))}case"MAP":{const n=o(0,["list","map","option"])[0],i=t.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=Gt(e.args[0],[w(s,{t:null,v:T(c(n),"elt")}),...i],r);if("failed"in a){if(!("prim"in a.failed)||"never"!==a.failed.prim)throw new Ct(e,t,`${e.prim}: FAIL is not allowed in MAP`);return{failed:a.failed,level:a.level+1}}if(a.length<1)throw new Ct(e,t,`${e.prim}: function must return a value`);return u(a.slice(1),i),"list"===n.prim?[E({prim:"list",args:[a[0]]}),...i]:"map"===n.prim?[E({prim:"map",args:[n.args[0],a[0]]}),...i]:[E({prim:"option",args:[a[0]]}),...i]}case"ITER":{_({});const n=o(0,["set","list","map"])[0],i=t.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=Gt(e.args[0],[w(s,{t:null,v:T(c(n),"elt")}),...i],r);return"failed"in a?{failed:a.failed,level:a.level+1}:(u(a,i),i)}case"LOOP":{_({}),o(0,["bool"]);const n=t.slice(1),i=Gt(e.args[0],n,r);return"failed"in i?{failed:i.failed,level:i.level+1}:(u(i,[{prim:"bool"},...n]),n)}case"LOOP_LEFT":{_({});const n=o(0,["or"])[0],i=t.slice(1),s=Gt(e.args[0],[w(n.args[0],{t:null,v:T(c(n),"left")}),...i],r);return"failed"in s?{failed:s.failed,level:s.level+1}:(u(s,[n,...i]),[w(n.args[1],{t:null,v:_({v:1}).v}),...i])}case"DIP":{_({});const n=2===e.args.length?parseInt(e.args[0].int,10):1;o(n-1,null);const i=t.slice(0,n),s=t.slice(n),a=2===e.args.length?Gt(e.args[1],s,r):Gt(e.args[0],s,r);return"failed"in a?{failed:a.failed,level:a.level+1}:[...i,...a]}case"CREATE_CONTRACT":{const r=_({v:2}),n=o(0,["option"],["mutez"],null);if("key_hash"!==jt(n[0].args[0]))throw new Ct(e,t,`${e.prim}: key hash expected: ${jt(n[0].args[0])}`);m(n[2])&&(Zt(e.args[0]),Ut($t(e.args[0],"storage").args[0],n[2]));const i=null===(b=r.v)||void 0===b?void 0:b.map((e=>"@"!==e?[e]:void 0));return[w({prim:"operation"},{v:null==i?void 0:i[0]}),w({prim:"address",[h]:{prim:"contract",args:[$t(e.args[0],"parameter").args[0]]}},{v:null==i?void 0:i[1]}),...t.slice(3)]}case"PUSH":return Ft(e.args[0]),Ht(e.args[1],e.args[0],Object.assign(Object.assign({},r),{contract:void 0})),[E(e.args[0]),...t];case"EMPTY_SET":return Ft(e.args[0]),f(e.args[0]),[w({prim:"set",args:e.args},_({t:1,v:1})),...t];case"EMPTY_MAP":return Ft(e.args[0]),f(e.args[0]),Ft(e.args[1]),[w({prim:"map",args:e.args},_({t:1,v:1})),...t];case"EMPTY_BIG_MAP":return Ft(e.args[0]),f(e.args[0]),Ft(e.args[1]),y(e.args[0]),[w({prim:"big_map",args:e.args},_({t:1,v:1})),...t];case"LAMBDA_REC":case"LAMBDA":{Ft(e.args[0]),Ft(e.args[1]);const n=[e.args[0]];"LAMBDA_REC"===e.prim&&n.push({prim:"lambda",args:[e.args[0],e.args[1]]});const i=Gt(e.args[2],n,Object.assign(Object.assign({},r),{contract:void 0}));if("failed"in i)return{failed:i.failed,level:i.level+1};if(1!==i.length)throw new Ct(e,t,`${e.prim}: function must return a value`);return l(e.args[1],i[0]),[E({prim:"lambda",args:[e.args[0],e.args[1]]}),...t]}case"LEVEL":return[E({prim:"nat"},"@level"),...t];case"TOTAL_VOTING_POWER":case"MIN_BLOCK_TIME":return[E({prim:"nat"}),...t];case"VOTING_POWER":return o(0,["key_hash"]),[E({prim:"nat"}),...t.slice(1)];case"TICKET":{const e=o(0,null,["nat"])[0];return f(e),v(n,p.PtLimaPtL)?[w({prim:"ticket",args:[e]},_({t:1,v:1})),...t.slice(2)]:[E({prim:"option",args:[w({prim:"ticket",args:[e]},_({t:1,v:1}))]}),...t.slice(2)]}case"JOIN_TICKETS":{const r=we("pair",o(0,["pair"])[0]);if("ticket"!==jt(r.args[0]))throw new Ct(e,t,`${e.prim}: ticket expected: ${jt(r.args[0])}`);return l(r.args[0],r.args[1]),[E({prim:"option",args:[w(r.args[0],{t:null})]}),...t.slice(1)]}case"SPLIT_TICKET":{const r=o(0,["ticket"],["pair"]),n=we("pair",r[1]);if("nat"!==jt(n.args[0]))throw new Ct(e,t,`${e.prim}: nat expected: ${jt(n.args[0])}`);return l(n.args[0],n.args[1]),[E({prim:"option",args:[{prim:"pair",args:[w(r[0],{t:null}),w(r[0],{t:null})]}]}),...t.slice(2)]}case"READ_TICKET":{const e=_({v:2}),r=o(0,["ticket"])[0],n=null===(R=e.v)||void 0===R?void 0:R.map((e=>"@"!==e?[e]:void 0));return[w({prim:"pair",args:[{prim:"address"},w(r.args[0],{t:null}),{prim:"nat"}]},{v:null==n?void 0:n[0]}),w(r,{v:null==n?void 0:n[1],t:null}),...t.slice(1)]}case"PAIRING_CHECK":{const r=o(0,["list"])[0].args[0];if(!Ee(r))throw new Ct(e,t,`${e.prim}: pair expected: ${jt(r)}`);const n=we("pair",r);if("bls12_381_g1"!==jt(n.args[0]))throw new Ct(e,t,`${e.prim}: bls12_381_g1 expected: ${jt(n.args[0])}`);if("bls12_381_g2"!==jt(n.args[1]))throw new Ct(e,t,`${e.prim}: bls12_381_g2 expected: ${jt(n.args[1])}`);return[E({prim:"bool"}),...t.slice(1)]}case"SAPLING_EMPTY_STATE":return[w({prim:"sapling_state",args:[e.args[0]]},_({v:1,t:1})),...t];case"SAPLING_VERIFY_UPDATE":{const r=o(0,["sapling_transaction"],["sapling_state"]);if(parseInt(r[0].args[0].int,10)!==parseInt(r[1].args[0].int,10))throw new Ct(e,t,`${e.prim}: sapling memo size mismatch: ${r[0].args[0].int} != ${r[1].args[0].int}`);return v(n,p.PtJakarta)?[E({prim:"option",args:[{prim:"pair",args:[{prim:"int"},w(r[1],{t:null})]}]}),...t.slice(2)]:[E({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},w(r[1],{t:null})]}]}]}),...t.slice(2)]}case"OPEN_CHEST":return o(0,["chest_key"],["chest"],["nat"]),[E({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...t.slice(3)];case"VIEW":{const r=o(0,null,["address"]);return g(r[0]),[E({prim:"option",args:[e.args[1]]}),...t.slice(2)]}case"EMIT":{const r=_({f:1,t:1});if(e.args){const n=o(0,null);return l(n[0],e.args[0]),[w({prim:"operation"},r),...t.slice(1)]}return[w({prim:"operation"},r),...t.slice(1)]}default:throw new ue(e,`unexpected instruction: ${e.prim}`)}})(i);if(void 0!==(null==r?void 0:r.traceCallback)){const e={op:i,in:t,out:R};r.traceCallback(e)}return R}function $t(e,t){for(const r of e)if(r.prim===t)return r;throw new ue(e,`missing contract section: ${t}`)}function Vt(e){const t={};for(const r of e)"view"===r.prim&&(t[r.args[0].string]=r);return t}function zt(e){if(Array.isArray(e))for(const t of e)if("prim"in t&&("parameter"===t.prim||"storage"===t.prim||"code"===t.prim))return!0;return!1}function qt(e,t){t=t||"%default";const r=Wt(e).find((e=>e[0]===t));return void 0!==r?r[1]:"%default"===t?zt(e)?$t(e,"parameter").args[0]:e:null}function Wt(e){if(zt(e)){const t=$t(e,"parameter"),r=Wt(t.args[0]),n=ge(t);return n.f?[[n.f[0],t.args[0]],...r]:r}if(t=e,Array.isArray(t)||"or"===t.prim){const t=Dt(e),r=e=>{const r=ge(t[e]);if("or"===jt(t[e])){const n=Wt(t[e]);return r.f?[[r.f[0],t[e]],...n]:n}return r.f?[[r.f[0],t[e]]]:[]};return[...r(0),...r(1)]}var t;return[]}function Zt(e,t){const r=(r,n,i,o)=>{Ft(r,!0),Ft(n);const s=Gt(o,[{prim:"pair",args:[Object.assign(Object.assign({},r),{annots:["@parameter"]}),Object.assign(Object.assign({},n),{annots:["@storage"]})]}],Object.assign(Object.assign({},t),{contract:e}));if("failed"in s)return s;try{Bt(s,[i])}catch(e){throw e instanceof ue?new Ct(o,s,e.message):e}return s},n=$t(e,"parameter").args[0],i=$t(e,"storage").args[0],o=r(n,i,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},i]},$t(e,"code").args[0]);for(const t of Object.values(Vt(e)))r(t.args[1],i,t.args[2],t.args[3]);return o}function Jt(e,t,r){Ft(t),Ht(e,t,r||null)}function Yt(e,t,r){for(const e of t)Ft(e);if(void 0!==(null==r?void 0:r.contract))for(const e of["parameter","storage"]){Ft($t(r.contract,e).args[0])}return Gt(e,t,r||null)}function Xt(e,t,r=!1){if(Array.isArray(e)){for(const t of e)Ft(t);for(const e of t)Ft(e)}else Ft(e),Ft(t);Ut(e,t,r)}function Qt(e,t=!1){try{return Ft(e,t),!0}catch(e){return!1}}function er(e,t){try{return Zt(e,t)}catch(e){return null}}function tr(e,t,r){try{return Jt(e,t,r),!0}catch(e){return!1}}function rr(e,t,r=!1){try{return Xt(e,t,r),!0}catch(e){return!1}}class nr{constructor(e,t){this.contract=e,this.ctx=Object.assign({contract:e},t),this.output=Zt(e,this.ctx)}static parse(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new re("empty Michelson");if(Qe(n))return new nr(n,t)}static parseTypeExpression(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new ne("empty type expression");if(Je(n))return Ft(n),n}static parseDataExpression(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new ie("empty data expression");if(Xe(n))return n;throw void 0}section(e){return $t(this.contract,e)}entryPoints(){return Wt(this.contract)}entryPoint(e){return qt(this.contract,e)}assertDataValid(e,t){Jt(e,t,this.ctx)}isDataValid(e,t){return tr(e,t,this.ctx)}assertParameterValid(e,t){const r=this.entryPoint(e||void 0);if(null===r)throw new oe(null==e?void 0:e.toString());this.assertDataValid(t,r)}isParameterValid(e,t){try{return this.assertParameterValid(e,t),!0}catch(e){return!1}}functionType(e,t){return Yt(e,t,this.ctx)}}const ir=new nr([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);function or(e){return"failed"in e?`[FAILED: ${z(e.failed)}]`:e.map(((e,t)=>{const r=ge(e);return`[${t}${r.v?"/"+r.v[0]:""}]: ${z(e)}`})).join("\n")}function sr(e,t){return r=>{var n;if(Array.isArray(r)&&!e)return;const o=null===(n=r.op[i])||void 0===n?void 0:n.macro,s=`${o?"Macro":"Op"}: ${o?z(o,void 0,!0)+" / ":""}${z(r.op)}\nInput:\n${or(r.in)}\nOutput:\n${or(r.out)}\n`;t(s)}}function ar(e){var t;if(e instanceof Ct){const r=null===(t=e.val[i])||void 0===t?void 0:t.macro;return`${r?"Macro":"Op"}: ${r?z(r,void 0,!0)+" / ":""}${z(e.val)}\nStack:\n${or(e.stackState)}\n`}if(e instanceof fe){return`Type: ${Array.isArray(e.val)?"["+e.val.map(((e,t)=>`[${t}]: ${z(e)}`)).join("; ")+"]":z(e.val)}\n${e.data?`Data: ${z(e.data)}\n`:""}\n`}return`Value: ${z(e.val)}`}const cr={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"}},8899:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AddressValidationError:()=>T,BigMapEncodingError:()=>Fe,BigMapValidationError:()=>m,BytesValidationError:()=>U,ChainIDValidationError:()=>te,ContractValidationError:()=>k,EncodeTicketError:()=>ne,EventSchema:()=>Je,IntValidationError:()=>H,InvalidBigMapDiffError:()=>Be,InvalidBigMapSchemaError:()=>Ue,InvalidMapTypeError:()=>u,InvalidRpcResponseError:()=>De,InvalidScriptError:()=>je,KeyHashValidationError:()=>q,KeyValidationError:()=>V,ListValidationError:()=>N,MapTypecheckError:()=>f,MapValidationError:()=>R,MichelsonMap:()=>d,MissingArgumentError:()=>He,MutezValidationError:()=>j,NatValidationError:()=>A,OrValidationError:()=>v,ParameterEncodingError:()=>Ce,ParameterSchema:()=>We,SaplingStateValue:()=>Qe,Schema:()=>qe,SetValidationError:()=>Q,SignatureValidationError:()=>Z,StorageEncodingError:()=>Ke,Token:()=>p,TokenArgumentValidationError:()=>_,TokenComparisonError:()=>w,UnitValue:()=>Xe,VERSION:()=>Ye,ViewSchema:()=>Ze,deepEqual:()=>ze});var n,i=r(5695),o=r.n(i),s=r(227),a=r(2558),c=r(4632);class u extends s.TaquitoError{constructor(e,t){super(),this.mapType=e,this.reason=t,this.message=`The map type '${JSON.stringify(e)}' is invalid. Reason: ${t}.`,this.name="InvalidMapTypeError"}}const l=Symbol.for("taquito-michelson-map-type-symbol");class f extends s.TaquitoError{constructor(e,t,r,n){super(),this.value=e,this.type=t,this.reason=n,this.name="MapTypecheckError",this.message=`The ${r} provided: ${JSON.stringify(e)} is not compatible with the expected michelson type: ${JSON.stringify(t)}. Reason: ${JSON.stringify(n)}.`,this.name="MapTypecheckError"}}class d{static isMichelsonMap(e){return e&&!0===e[l]}constructor(e){this.valueMap=new Map,this.keyMap=new Map,this[n]=!0,e&&this.setType(e)}setType(e){!function(e){if(!("prim"in e))throw new u(e,"Missing 'prim' field");if(!["map","big_map"].includes(e.prim))throw new u(e,"The prim field should be 'map' or 'big_map'");if(!("args"in e))throw new u(e,"Missing 'args' field");if(!Array.isArray(e.args))throw new u(e,"The 'args' field should be an array");if(2!==e.args.length)throw new u(e,"The 'args' field should have 2 elements")}(e),this.keySchema=new qe(e.args[0]),this.valueSchema=new qe(e.args[1])}removeType(){this.keySchema=void 0,this.valueSchema=void 0}static fromLiteral(e,t){const r=new d(t);return Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}typecheckKey(e){this.keySchema&&this.keySchema.Typecheck(e)}typecheckValue(e){this.valueSchema&&this.valueSchema.Typecheck(e)}assertTypecheckValue(e){try{this.typecheckValue(e)}catch(t){throw new f(e,this.valueSchema,"value",t)}}assertTypecheckKey(e){try{this.typecheckKey(e)}catch(t){throw new f(e,this.keySchema,"key",t)}}serializeDeterministically(e){return o()(e)}*keys(){for(const[e]of this.entries())yield e}*values(){for(const[,e]of this.entries())yield e}*entries(){for(const e of this.valueMap.keys())yield[this.keyMap.get(e),this.valueMap.get(e)]}get(e){this.assertTypecheckKey(e);const t=this.serializeDeterministically(e);return this.valueMap.get(t)}set(e,t){this.assertTypecheckKey(e),this.assertTypecheckValue(t);const r=this.serializeDeterministically(e);this.keyMap.set(r,e),this.valueMap.set(r,t)}delete(e){this.assertTypecheckKey(e),this.keyMap.delete(this.serializeDeterministically(e)),this.valueMap.delete(this.serializeDeterministically(e))}has(e){this.assertTypecheckKey(e);const t=this.serializeDeterministically(e);return this.keyMap.has(t)&&this.valueMap.has(t)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(e){for(const[t,r]of this.entries())e(r,t,this)}}n=l;class h extends s.TaquitoError{constructor(e,t,r){super(),this.value=e,this.token=t,this.name="TokenValidationError";const n=this.token.annot(),i=n?`[${n}] `:"";this.message=`${i}${r}`}}class p{constructor(e,t,r){this.val=e,this.idx=t,this.fac=r,this.createToken=this.fac}typeWithoutAnnotations(){const e=t=>{if("object"==typeof t){if(Array.isArray(t)){return t.map((t=>e(t)))}const r=t;return r.args?{prim:r.prim,args:r.args.map((t=>e(t)))}:{prim:r.prim}}return t};return(t=this.val).args?{prim:t.prim,args:t.args.map((t=>e(t)))}:{prim:t.prim};var t}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.ExtractSchema()]]}}class b extends p{compare(e,t){return e===t?0:ethis.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(t.get(e))]})))}EncodeObject(e,t){const r=this.objLitToMichelsonMap(e);return this.validate(r),t&&t[g.prim]?t[g.prim](r,this.val):Array.from(r.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(r.get(e))]})))}Execute(e,t){if(t&&t[g.prim])return t[g.prim](e,this.val);if(Array.isArray(e)){const t=new d(this.val);return e.forEach((e=>{t.set(this.KeySchema.ToKey(e.args[0]),this.ValueSchema.Execute(e.args[1]))})),t}if("int"in e)return e.int;throw new m(e,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(e)}`)}findAndReturnTokens(e,t){return g.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),this.ValueSchema.findAndReturnTokens(e,t),t}}g.prim="big_map";class v extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="OrValidationError"}}class y extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Encode(e){const t=e[e.length-1],r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof y&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if(String(r.annot())!==String(t)||r instanceof y){if(String(i.annot())!==String(t)||i instanceof y){if(r instanceof y){const t=r.Encode(e);if(t)return{prim:"Left",args:[t]}}if(i instanceof y){const t=i.Encode(e);if(t)return{prim:"Right",args:[t]}}return null}return e.pop(),{prim:"Right",args:[i.Encode(e)]}}return e.pop(),{prim:"Left",args:[r.Encode(e)]}}ExtractSignature(){const e=this.createToken(this.val.args[0],this.idx);let t=1;e instanceof y&&(t=Object.keys(e.ExtractSchema()).length);const r=this.createToken(this.val.args[1],this.idx+t),n=[];if(e instanceof y)n.push(...e.ExtractSignature());else for(const t of e.ExtractSignature())n.push([e.annot(),...t]);if(r instanceof y)n.push(...r.ExtractSignature());else for(const e of r.ExtractSignature())n.push([r.annot(),...e]);return n}EncodeObject(e,t){this.validateJavascriptObject(e);const r=Object.keys(e)[0],n=this.createToken(this.val.args[0],this.idx);let i=1;n instanceof y&&(i=Object.keys(n.ExtractSchema()).length);const o=this.createToken(this.val.args[1],this.idx+i);if(String(n.annot())!==String(r)||n instanceof y){if(String(o.annot())!==String(r)||o instanceof y){if(n instanceof y){const r=n.EncodeObject(e,t);if(r)return{prim:"Left",args:[r]}}if(o instanceof y){const r=o.EncodeObject(e,t);if(r)return{prim:"Right",args:[r]}}return null}return{prim:"Right",args:[o.EncodeObject(e[r],t)]}}return{prim:"Left",args:[n.EncodeObject(e[r],t)]}}validateJavascriptObject(e){if("object"!=typeof e||Array.isArray(e)||null===e||1!==Object.keys(e).length)throw new v(e,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(e)}`)}Execute(e,t){const r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof y&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if("Right"===e.prim)return i instanceof y?i.Execute(e.args[0],t):{[i.annot()]:i.Execute(e.args[0],t)};if("Left"===e.prim)return r instanceof y?r.Execute(e.args[0],t):{[r.annot()]:r.Execute(e.args[0],t)};throw new v(e,this,`Was expecting Left or Right prim but got: ${JSON.stringify(e.prim)}`)}traversal(e,t,r){const n=this.createToken(this.val.args[0],this.idx);let i,o=1;n instanceof y?(i=e(n),o=Object.keys(n.ExtractSchema()).length):i={[n.annot()]:e(n)};const s=this.createToken(this.val.args[1],this.idx+o);let a;a=s instanceof y?t(s):{[s.annot()]:t(s)};return r(i,a)}ExtractSchema(){return this.traversal((e=>e.ExtractSchema()),(e=>e.ExtractSchema()),((e,t)=>Object.assign(Object.assign({},e),t)))}generateSchema(){return{__michelsonType:y.prim,schema:this.traversal((e=>e instanceof y?e.generateSchema().schema:e.generateSchema()),(e=>e instanceof y?e.generateSchema().schema:e.generateSchema()),((e,t)=>Object.assign(Object.assign({},e),t)))}}findToken(e){const t=this.createToken(this.val.args[0],this.idx);let r=1;t instanceof y&&(r=Object.keys(t.ExtractSchema()).length);const n=this.createToken(this.val.args[1],this.idx+r);if(String(t.annot())===String(e)&&!(t instanceof y)&&t instanceof b)return t;if(String(n.annot())===String(e)&&!(n instanceof y)&&n instanceof b)return n;if(t instanceof y){const r=t.findToken(e);if(r)return r}if(n instanceof y){const t=n.findToken(e);if(t)return t}return null}compare(e,t){const r=Object.keys(e)[0];if(r!==Object.keys(t)[0]){return JSON.stringify(this.EncodeObject(e))r.findAndReturnTokens(e,t)),(r=>r.findAndReturnTokens(e,t)),((e,t)=>Object.assign(Object.assign({},e),t))),t}}y.prim="or";class _ extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="TokenArgumentValidationError"}}class w extends s.TaquitoError{constructor(e,t){super(),this.val1=e,this.val2=t,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(e)} and ${JSON.stringify(t)} are not comparable`}}function E(e,t=O.prim){if(Array.isArray(e))return E({prim:t,args:e},t);if(void 0===e.args)throw new _(`The value ${JSON.stringify(e)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return e.args.length>2?[e.args[0],{prim:t,args:e.args.slice(1)}]:[e.args[0],e.args[1]]}class O extends b{constructor(e,t,r){super(Array.isArray(e)?{prim:O.prim,args:e}:e.prim?e:{prim:O.prim,args:e},t,r)}args(){return E(this.val)}tokens(){let e=0;return this.args().map((t=>{const r=this.createToken(t,this.idx+e);return r instanceof O?e+=Object.keys(r.ExtractSchema()).length:e++,r}))}Encode(e){return{prim:"Pair",args:this.tokens().map((t=>t.Encode(e)))}}ExtractSignature(){const e=this.args(),t=this.createToken(e[0],this.idx);let r=1;t instanceof y&&(r=Object.keys(t.ExtractSchema()).length);const n=this.createToken(e[1],this.idx+r),i=[];for(const e of t.ExtractSignature())for(const t of n.ExtractSignature())i.push([...e,...t]);return i}ToBigMapKey(e){return{key:this.EncodeObject(e),type:this.typeWithoutAnnotations()}}ToKey(e){return this.Execute(e)}EncodeObject(e,t){const[r,n]=this.tokens();let i,o;return i=r instanceof O&&!r.hasAnnotations()?e:e[r.annot()],o=n instanceof O&&!n.hasAnnotations()?e:e[n.annot()],{prim:"Pair",args:[r.EncodeObject(i,t),n.EncodeObject(o,t)]}}traversal(e,t){const r=this.args(),n=this.createToken(r[0],this.idx);let i,o=1;n instanceof O&&!n.hasAnnotations()?(i=e(n),n instanceof O&&(o=Object.keys(n.ExtractSchema()).length)):i={[n.annot()]:e(n)};const s=this.createToken(r[1],this.idx+o);let a;a=s instanceof O&&!s.hasAnnotations()?t(s):{[s.annot()]:t(s)};return Object.assign(Object.assign({},i),a)}Execute(e,t){const r=E(e,"Pair");return this.traversal((e=>e.Execute(r[0],t)),(e=>e.Execute(r[1],t)))}ExtractSchema(){return this.traversal((e=>e.ExtractSchema()),(e=>e.ExtractSchema()))}generateSchema(){return{__michelsonType:O.prim,schema:this.traversal((e=>e instanceof O&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema()),(e=>e instanceof O&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema()))}}compare(e,t){const[r,n]=this.tokens(),i=(e,t)=>e instanceof O&&!e.hasAnnotations()?t:t[e.annot()];if(r instanceof b&&n instanceof b){const o=r.compare(i(r,e),i(r,t));return 0===o?n.compare(i(n,e),i(n,t)):o}throw new w(e,t)}findAndReturnTokens(e,t){return O.prim===e&&t.push(this),this.tokens().map((r=>r.findAndReturnTokens(e,t))),t}}O.prim="pair";class A extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="NatValidationError"}}class S extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return new a.Z(e[Object.keys(e)[0]])}Encode(e){const t=e.pop();return this.validate(t),{int:new a.Z(t).toFixed()}}validate(e){const t=new a.Z(e);if(t.isNaN())throw new A(e,this,`Value is not a number: ${JSON.stringify(e)}`);if(t.isNegative())throw new A(e,this,`Value cannot be negative: ${JSON.stringify(e)}`)}EncodeObject(e,t){return this.validate(e),t&&t[S.prim]?t[S.prim](e):{int:new a.Z(e).toFixed()}}ExtractSchema(){return S.prim}generateSchema(){return{__michelsonType:S.prim,schema:S.prim}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:S.prim}}}ToKey({int:e}){return new a.Z(e)}compare(e,t){const r=Number(e),n=Number(t);return r===n?0:re.startsWith("tz"),n=r(e),i=r(t);return n&&!i?-1:i&&!n?1:super.compare(e,t)}findAndReturnTokens(e,t){return I.prim===e&&t.push(this),t}}I.prim="address";class R extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="MapValidationError"}}class x extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(e){if(!d.isMichelsonMap(e))throw new R(e,this,`Value ${JSON.stringify(e)} is not a valid MichelsonMap`)}Execute(e,t){const r=new d(this.val);return e.forEach((e=>{r.set(this.KeySchema.ToKey(e.args[0]),this.ValueSchema.Execute(e.args[1],t))})),r}objLitToMichelsonMap(e){return e instanceof d?e:"object"==typeof e?0===Object.keys(e).length?new d:d.fromLiteral(e):e}Encode(e){const t=this.objLitToMichelsonMap(e.pop());return this.validate(t),Array.from(t.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(t.get(e))]})))}EncodeObject(e,t){const r=this.objLitToMichelsonMap(e);return this.validate(r),t&&t[x.prim]?t[x.prim](r):Array.from(r.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(r.get(e))]})))}ExtractSchema(){return{map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:x.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(e,t){return x.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),this.ValueSchema.findAndReturnTokens(e,t),t}}x.prim="map";class M extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return"true"===String(e.prim).toLowerCase()}Encode(e){return{prim:e.pop()?"True":"False"}}EncodeObject(e,t){return t&&t[M.prim]?t[M.prim](e):{prim:e?"True":"False"}}ExtractSchema(){return M.prim}generateSchema(){return{__michelsonType:M.prim,schema:M.prim}}ToBigMapKey(e){return{key:this.EncodeObject(e),type:{prim:M.prim}}}ToKey(e){return this.EncodeObject(e)}compare(e,t){return e&&t||!e&&!t?0:e?1:-1}findAndReturnTokens(e,t){return M.prim===e&&t.push(this),t}}M.prim="bool";class k extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ContractValidationError"}}class L extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if((0,c.validateAddress)(e)!==c.ValidationResult.VALID)throw new k(e,this,`Value ${JSON.stringify(e)} is not a valid contract address.`);return null}Execute(e){if(e.string)return e.string;if(!e.bytes)throw new k(e,this,`Value ${JSON.stringify(e)} is not a valid contract address. must contain bytes or string.`);return(0,c.encodePubKey)(e.bytes)}Encode(e){const t=e.pop();return this.validate(t),{string:t}}EncodeObject(e,t){return this.validate(e),t&&t[L.prim]?t[L.prim](e):{string:e}}ExtractSchema(){return L.prim}generateSchema(){const e=this.createToken(this.val.args[0],0);return{__michelsonType:L.prim,schema:{parameter:this.val.args[0]?e.generateSchema():{}}}}findAndReturnTokens(e,t){return L.prim===e&&t.push(this),t}}L.prim="contract";class N extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ListValidationError"}}class C extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(e){if(!Array.isArray(e))throw new N(e,this,`Value ${JSON.stringify(e)} is not a valid array`)}Encode(e){const t=e.pop();this.validate(t);const r=this.createToken(this.val.args[0],0);return t.reduce(((e,t)=>[...e,r.EncodeObject(t)]),[])}Execute(e,t){const r=this.createToken(this.val.args[0],0);return this.validate(e),e.reduce(((e,n)=>[...e,r.Execute(n,t)]),[])}EncodeObject(e,t){const r=this.createToken(this.val.args[0],0);return this.validate(e),t&&t[C.prim]?t[C.prim](e):e.reduce(((e,t)=>[...e,r.EncodeObject(t)]),[])}ExtractSchema(){return{[C.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:C.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(e,t){return C.prim===e&&t.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(e,t),t}}C.prim="list";class j extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="MutezValidationError"}}class D extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return new a.Z(e[Object.keys(e)[0]])}ExtractSchema(){return D.prim}generateSchema(){return{__michelsonType:D.prim,schema:D.prim}}validate(e){if(new a.Z(e).isNaN())throw new j(e,this,`Value is not a number: ${e}`)}Encode(e){const t=e.pop();return this.validate(t),{int:String(t).toString()}}EncodeObject(e,t){return this.validate(e),t&&t[D.prim]?t[D.prim](e):{int:String(e).toString()}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:D.prim}}}ToKey({int:e}){return e}compare(e,t){const r=Number(e),n=Number(t);return r===n?0:rthis.KeySchema.compare(e,t))).reduce(((e,t)=>[...e,this.KeySchema.EncodeObject(t)]),[])}Execute(e,t){return e.reduce(((e,r)=>[...e,this.KeySchema.Execute(r,t)]),[])}EncodeObject(e,t){return this.validate(e),t&&t[ee.prim]?t[ee.prim](e):e.sort(((e,t)=>this.KeySchema.compare(e,t))).reduce(((e,t)=>[...e,this.KeySchema.EncodeObject(t)]),[])}ExtractSchema(){return ee.prim}generateSchema(){return{__michelsonType:ee.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(e,t){return ee.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),t}}ee.prim="set";class te extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChainIDValidationError"}}class re extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if((0,c.validateChain)(e)!==c.ValidationResult.VALID)throw new te(e,this,`Value ${JSON.stringify(e)} is not a valid ChainID`)}Execute(e){return e[Object.keys(e)[0]]}ExtractSchema(){return re.prim}generateSchema(){return{__michelsonType:re.prim,schema:re.prim}}Encode(e){const t=e.pop();return this.validate(t),{string:t}}EncodeObject(e,t){return this.validate(e),t&&t[re.prim]?t[re.prim](e):{string:e}}ToKey({string:e}){return e}ToBigMapKey(e){return{key:{string:e},type:{prim:re.prim}}}findAndReturnTokens(e,t){return re.prim===e&&t.push(this),t}}re.prim="chain_id";class ne extends s.TaquitoError{constructor(){super(),this.name="TicketEncodeError",this.message="Tickets cannot be sent to the blockchain; they are created on-chain"}}const ie={prim:"contract"},oe={prim:"int"};class se extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new ne}EncodeObject(e,t){if(t&&t[se.prim])return t[se.prim](e,this.val);throw new ne}Execute(e,t){if(t&&t[se.prim])return t[se.prim](e,this.val);const r=this.createToken(ie,this.idx),n=this.valueToken,i=this.createToken(oe,this.idx);return void 0===e.args[2]&&void 0!==e.args[1].args?{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1].args[0],t),amount:i.Execute(e.args[1].args[1],t)}:{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1],t),amount:i.Execute(e.args[2],t)}}ExtractSchema(){return{ticketer:L.prim,value:this.valueToken.ExtractSchema(),amount:G.prim}}generateSchema(){return{__michelsonType:se.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:L.prim,schema:L.prim},amount:{__michelsonType:G.prim,schema:G.prim}}}}findAndReturnTokens(e,t){return se.prim===e&&t.push(this),this.valueToken.findAndReturnTokens(e,t),t}}se.prim="ticket";class ae extends s.TaquitoError{constructor(){super(),this.name="TicketDeprecatedEncodeError",this.message="Ticket_deprecated cannot be sent to the blockchain; they are created on-chain"}}const ce={prim:"contract"},ue={prim:"int"};class le extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new ae}EncodeObject(e,t){if(t&&t[le.prim])return t[le.prim](e,this.val);throw new ae}Execute(e,t){if(t&&t[le.prim])return t[le.prim](e,this.val);const r=this.createToken(ce,this.idx),n=this.valueToken,i=this.createToken(ue,this.idx);return void 0===e.args[2]&&void 0!==e.args[1].args?{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1].args[0],t),amount:i.Execute(e.args[1].args[1],t)}:{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1],t),amount:i.Execute(e.args[2],t)}}ExtractSchema(){return{ticketer:L.prim,value:this.valueToken.ExtractSchema(),amount:G.prim}}generateSchema(){return{__michelsonType:le.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:L.prim,schema:L.prim},amount:{__michelsonType:G.prim,schema:G.prim}}}}findAndReturnTokens(e,t){return le.prim===e&&t.push(this),this.valueToken.findAndReturnTokens(e,t),t}}le.prim="ticket_deprecated";class fe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="NeverTokenError"}}class de extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Encode(e){const t=e.pop();throw new fe(t,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(t)}.`)}EncodeObject(e,t){if(t&&t[de.prim])return t[de.prim](e);throw new fe(e,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(e)}.`)}Execute(e){throw new fe(e,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(e)}.`)}ExtractSchema(){return de.prim}generateSchema(){return{__michelsonType:de.prim,schema:de.prim}}findAndReturnTokens(e,t){return de.prim===e&&t.push(this),t}}de.prim="never";class he extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingStateValidationError"}}class pe extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}isValid(e){return"object"==typeof e&&0===Object.keys(e).length}Execute(e,t){if(t&&t[pe.prim])return t[pe.prim](e,this.val);if("int"in e)return e.int;throw new he(e,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(e)}`)}Encode(e){const t=e.pop();if(this.isValid(t))return[];throw new he(t,this,`Invalid sapling_state. Received: ${JSON.stringify(t)} while expecting: {}`)}EncodeObject(e,t){if(t&&t[pe.prim])return t[pe.prim](e);if(this.isValid(e))return[];throw new he(e,this,`Invalid sapling_state. Received: ${JSON.stringify(e)} while expecting: {}`)}ExtractSchema(){return{[pe.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:pe.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return pe.prim===e&&t.push(this),t}}pe.prim="sapling_state";class be extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingTransactionValidationError"}}class me extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){throw new be(e,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const t=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(t&&t[2].length%2==0)return t[2];throw new be(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}EncodeObject(e,t){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),t&&t[me.prim]?t[me.prim](e):{bytes:String(e).toString()}}ExtractSchema(){return{[me.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:me.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return me.prim===e&&t.push(this),t}}me.prim="sapling_transaction";class ge extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingTransactionDeprecatedValidationError"}}class ve extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){throw new ge(e,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const t=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(t&&t[2].length%2==0)return t[2];throw new ge(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}EncodeObject(e,t){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),t&&t[ve.prim]?t[ve.prim](e):{bytes:String(e).toString()}}ExtractSchema(){return{[ve.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:ve.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return ve.prim===e&&t.push(this),t}}ve.prim="sapling_transaction_deprecated";class ye extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381frValidationError"}}class _e extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new ye(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return"number"==typeof t?{int:t.toString()}:(t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t})}EncodeObject(e,t){return t&&t[_e.prim]?t[_e.prim](e):"number"==typeof e?{int:e.toString()}:(e=this.convertUint8ArrayToHexString(e),this.validate(e),{bytes:e})}Execute(e){return e.bytes}ExtractSchema(){return _e.prim}generateSchema(){return{__michelsonType:_e.prim,schema:_e.prim}}findAndReturnTokens(e,t){return _e.prim===e&&t.push(this),t}}_e.prim="bls12_381_fr";class we extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381g1ValidationError"}}class Ee extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new we(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ee.prim]?t[Ee.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ee.prim}generateSchema(){return{__michelsonType:Ee.prim,schema:Ee.prim}}findAndReturnTokens(e,t){return Ee.prim===e&&t.push(this),t}}Ee.prim="bls12_381_g1";class Oe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381g2ValidationError"}}class Ae extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Oe(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ae.prim]?t[Ae.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ae.prim}generateSchema(){return{__michelsonType:Ae.prim,schema:Ae.prim}}findAndReturnTokens(e,t){return Ae.prim===e&&t.push(this),t}}Ae.prim="bls12_381_g2";class Se extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChestValidationError"}}class Pe extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Se(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Pe.prim]?t[Pe.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Pe.prim}generateSchema(){return{__michelsonType:Pe.prim,schema:Pe.prim}}findAndReturnTokens(e,t){return Pe.prim===e&&t.push(this),t}}Pe.prim="chest";class Te extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChestKeyValidationError"}}class Ie extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Te(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ie.prim]?t[Ie.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ie.prim}generateSchema(){return{__michelsonType:Ie.prim,schema:Ie.prim}}findAndReturnTokens(e,t){return Ie.prim===e&&t.push(this),t}}Ie.prim="chest_key";class Re extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="GlobalConstantEncodingError"}}class xe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="GlobalConstantDecodingError"}}class Me extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e,t){if(t&&t[Me.prim])return t[Me.prim](e,this.val);throw new xe(e,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(e){throw new Re(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(e,t){if(t&&t[Me.prim])return t[Me.prim](e);throw new Re(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}ExtractSchema(){return Me.prim}generateSchema(){return{__michelsonType:Me.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(e,t){return Me.prim===e&&t.push(this),t}}Me.prim="constant";const ke=[O,S,P,g,I,x,M,y,L,C,D,B,F,K,G,$,z,W,J,Y,X,ee,re,se,le,de,pe,me,ve,_e,Ee,Ae,Pe,Ie,Me];class Le extends s.TaquitoError{constructor(e,t){super(e),this.message=e,this.data=t,this.name="Invalid token error"}}function Ne(e,t){if(Array.isArray(e))return new O(e,t,Ne);const r=ke.find((t=>t.prim===e.prim));if(!r)throw new Le(`Malformed data: ${JSON.stringify(e)}. Expected a value with a valid prim property`,e);return new r(e,t,Ne)}class Ce extends s.InvalidViewParameterError{constructor(e,t,r,n){super(e,t,r,n),this.viewName=e,this.sigs=t,this.args=r,this.cause=n,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(r)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(t)}`}}class je extends s.TaquitoError{constructor(e,t){super(),this.script=e,this.reason=t,this.name="InvalidScriptError";let r="Invalid on-chain view found in the following script.";t&&(r+=` Reason: ${t}.`),r+=`Script: ${JSON.stringify(e)}`,this.message=r}}class De extends s.TaquitoError{constructor(e,t){super(),this.script=e,this.reason=t,this.name="InvalidRpcResponseError";let r="Invalid RPC response passed as argument(s).";t&&(r+=` Reason: ${t}.`),r+=` Received: ${JSON.stringify(e)}`,this.message=r}}class Ue extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="InvalidBigMapSchemaError"}}class Be extends s.TaquitoError{constructor(e,t){super(e),this.message=e,this.value=t,this.name="InvalidBigMapDiffError"}}class Fe extends s.TaquitoError{constructor(e,t,r,n){super(),this.details=t,this.schema=r,this.value=n,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${e}. Schema is: ${JSON.stringify(r)}. The ${e} is: ${JSON.stringify(n)}. Error details: ${t}`}}class Ke extends s.TaquitoError{constructor(e,t,r,n,i){super(),this.details=t,this.schema=r,this.value=n,this.semantics=i,this.name="StorageEncodingError",this.message=`Unable to encode ${e}. The schema is: ${JSON.stringify(r)}, the value is: ${JSON.stringify(n)}.${i?`And the semantic is: ${JSON.stringify(i)}`:""}. Error details: ${t}`}}class He extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="MissingArgumentError"}}var Ge;const $e=Symbol.for("taquito-schema-type-symbol");function Ve(e,t=O.prim){var r,n;if(Array.isArray(e))return Ve({prim:t,args:e},t);const i=e;return i.prim===t&&i.args&&i.args.length>2?Object.assign(Object.assign({},i),{args:[null===(r=i.args)||void 0===r?void 0:r[0],{prim:t,args:null===(n=i.args)||void 0===n?void 0:n.slice(1)}]}):i}function ze(e,t){if(void 0===e||void 0===t)return e===t;const r=Ve(e),n=Ve(t);return r.prim===n.prim&&(void 0===r.args&&void 0===n.args||void 0!==r.args&&void 0!==n.args&&r.args.length===n.args.length&&r.args.every(((e,t)=>{var r,i;return ze(e,null!==(i=null===(r=n.args)||void 0===r?void 0:r[t])&&void 0!==i?i:{})})))&&(void 0===r.annots&&void 0===n.annots||void 0!==r.annots&&void 0!==n.annots&&r.annots.length===n.annots.length&&r.annots.every(((e,t)=>{var r;return e===(null===(r=n.annots)||void 0===r?void 0:r[t])})))}class qe{static isSchema(e){return e&&!0===e[$e]}static fromRPCResponse(e){if(!e)throw new De(e,"the RPC response is empty");if(!e.script)throw new De(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new De(e,"The response.script.code should be an array");let t=e.script.code;for(;1===t.length&&Array.isArray(t[0]);)t=t[0];const r=t.find((e=>"prim"in e&&"storage"===e.prim));if(!r||!Array.isArray(r.args))throw new De(e,'The response.script.code has an element of type {prim: "storage"}, but its args is not an array');return new qe(r.args[0])}isExpressionExtended(e){return"prim"in e&&Array.isArray(e.args)}constructor(e){if(this.val=e,this[Ge]=!0,this.root=Ne(e,0),this.root instanceof g)this.bigMap=this.root;else if(this.isExpressionExtended(e)&&"pair"===e.prim){const t=e.args[0];this.isExpressionExtended(t)&&"big_map"===t.prim&&(this.bigMap=new g(t,0,Ne))}}removeTopLevelAnnotation(e){return(this.root instanceof O||this.root instanceof y)&&this.root.hasAnnotations()&&"object"==typeof e&&1===Object.keys(e).length?e[Object.keys(e)[0]]:e}Execute(e,t){const r=this.root.Execute(e,t);return this.removeTopLevelAnnotation(r)}Typecheck(e){this.root instanceof g&&Number.isInteger(Number(e))||this.root instanceof se&&e.ticketer&&e.value&&e.amount||this.root instanceof le&&e.ticketer&&e.value&&e.amount||this.root instanceof x&&this.root.ValueSchema instanceof g||this.root.EncodeObject(e)}ExecuteOnBigMapDiff(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");if(!Array.isArray(e))throw new Be(`Big map diff must be an array, got: ${JSON.stringify(e)}`,e);const r=e.map((({key:e,value:t})=>({args:[e,t]})));return this.bigMap.Execute(r,t)}ExecuteOnBigMapValue(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");return this.bigMap.ValueSchema.Execute(e,t)}EncodeBigMapKey(e){if(!this.bigMap)throw new Ue("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(e)}catch(t){throw new Fe("key",t,this.bigMap.KeySchema,e)}}Encode(e,t){try{return this.root.EncodeObject(e,t)}catch(r){if(r instanceof h)throw r;throw new Ke("storage object",r,this.root,e,t)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");const r=e.reduce(((e,t)=>Object.assign(Object.assign({},e),this.ExecuteOnBigMapDiff(t.contents[0].metadata.operation_result.big_map_diff))),{});return Object.assign(Object.assign({},this.Execute(t)),{[this.bigMap.annot()]:r})}FindFirstInTopLevelPair(e,t){return this.findValue(this.root.val,e,t)}findValue(e,t,r){if(ze(r,e))return t;if(Array.isArray(e)||"pair"===e.prim){const n=Ve(e),i=Ve(t,"Pair");if(void 0===n.args||void 0===i.args)throw new He("Tokens have no arguments");if(n.args[0])return this.findValue(n.args[0],i.args[0],r)||this.findValue(n.args[1],i.args[1],r)}}findToken(e){return this.root.findAndReturnTokens(e,[])}}Ge=$e;class We{static fromRPCResponse(e){if(!e)throw new De(e,"the RPC response is empty");if(!e.script)throw new De(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new De(e,"The response.script.code should be an array");const t=e.script.code.find((e=>"prim"in e&&"parameter"===e.prim));if(!t)throw new De(e,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray(t.args))throw new De(e,'The response.script.code has an element of type {prim: "parameter"}, but its args is not an array');return new We(t.args[0])}get isMultipleEntryPoint(){return this.root instanceof y||this.root instanceof F&&this.root.subToken()instanceof y}get hasAnnotation(){return!this.isMultipleEntryPoint||"0"!==Object.keys(this.ExtractSchema())[0]}constructor(e){this.root=Ne(e,0)}Execute(e,t){return this.root.Execute(e,t)}Encode(...e){try{return this.root.Encode(e.reverse())}catch(t){if(t instanceof h)throw t;throw new Ce("Unable to encode parameter",this.root,e,t)}}EncodeObject(e,t){try{return this.root.EncodeObject(e,t)}catch(t){if(t instanceof h)throw t;throw new Ce("Unable to encode parameter object",this.root,e,t)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class Ze{static fromRPCResponse(e){const t=[],r=e&&e.script&&Array.isArray(e.script.code)&&e.script.code.filter((e=>"view"===e.prim));return r&&r.forEach((e=>{t.push(new Ze(e.args))})),t}constructor(e){if(!e)throw new je(e,"the args are not defined");if(4!==e.length)throw new je(e,"there should be exactly 4 arguments");if(!("string"in e[0])||!e[0].string)throw new je(e,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=e[0].string,this.viewArgsType=e[1],this.viewReturnType=e[2],this.instructions=e[3],this.rootArgsType=Ne(this.viewArgsType,0),this.rootReturnType=Ne(this.viewReturnType,0)}encodeViewArgs(e){try{return this.rootArgsType.EncodeObject(e)}catch(t){throw new Ce(this.viewName,void 0,e,t)}}decodeViewResult(e,t){return this.rootReturnType.Execute(e,t)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}class Je{constructor(e,t){this.tag=e,this.type=t}static fromMichelineValue(e){var t,r;return new Je(null===(t=e.annots)||void 0===t?void 0:t[0],null===(r=e.args)||void 0===r?void 0:r[0])}static fromRPCResponse(e){const t=[];return e.script.code.forEach((e=>{"prim"in e&&"code"===e.prim&&"args"in e&&e.args&&t.push(...Je.extractEventsRecursively(e.args))})),Je.removeDuplicates(t)}static removeDuplicates(e){const t=[];return e.forEach((e=>{-1===t.findIndex((t=>t.tag===e.tag&&ze(t.type,e.type)))&&t.push(e)})),t}static extractEventsRecursively(e){return Array.isArray(e)?e.flatMap((e=>Je.extractEventsRecursively(e))):"prim"in e?"EMIT"===e.prim?[Je.fromMichelineValue(e)]:"args"in e&&e.args?e.args.flatMap((e=>Je.extractEventsRecursively(e))):[]:[]}}const Ye={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"},Xe=Symbol(),Qe={}},6368:(e,t,r)=>{"use strict";r.r(t),r.d(t,{METADATA_BALANCE_UPDATES_CATEGORY:()=>b,OPERATION_METADATA:()=>p,OpKind:()=>O,PvmKind:()=>m,RpcClient:()=>S,RpcClientCache:()=>h,SmartRollupInputProofKind:()=>v,SmartRollupRefutationOptions:()=>g,SmartRollupRefuteGameEndedPlayerOutcomes:()=>w,SmartRollupRefuteGameEndedReason:()=>E,SmartRollupRefuteGameStatusOptions:()=>_,SmartRollupRefuteRevealProofKind:()=>y,VERSION:()=>A,castToBigNumber:()=>d,defaultChain:()=>u,defaultRPCOptions:()=>l});var n=r(5543),i=r(2558),o=r(4632),s=r(227);function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{const r=e[t];let o;if(void 0!==r){if(Array.isArray(r))return o=d(r),void(n[t]=o);o=new i.Z(r),n[t]=o}})),n}!function(e){e.GET_BAKING_RIGHTS="getBakingRights",e.GET_BALLOTS="getBallots",e.GET_BALLOT_LIST="getBallotList",e.GET_BIG_MAP_KEY="getBigMapKey",e.GET_BIG_MAP_EXPR="getBigMapExpr",e.GET_BLOCK_HASH="getBlockHash",e.GET_BLOCK="getBlock",e.GET_BLOCK_HEADER="getBlockHeader",e.GET_BLOCK_METADATA="getBlockMetadata",e.GET_BALANCE="getBalance",e.GET_CHAIN_ID="getChainId",e.GET_CONSTANTS="getConstants",e.GET_CONTRACT="getContract",e.GET_CURRENT_PERIOD="getCurrentPeriod",e.GET_CURRENT_PROPOSAL="getCurrentProposal",e.GET_CURRENT_QUORUM="getCurrentQuorum",e.GET_DELEGATE="getDelegate",e.GET_DELEGATES="getDelegates",e.GET_VOTING_INFO="getVotingInfo",e.GET_ATTESTATION_RIGHTS="getAttestationRights",e.GET_ENDORSING_RIGHTS="getEndorsingRights",e.GET_ENTRYPOINTS="getEntrypoints",e.GET_LIVE_BLOCKS="getLiveBlocks",e.GET_MANAGER_KEY="getManagerKey",e.GET_NORMALIZED_SCRIPT="getNormalizedScript",e.GET_PROPOSALS="getProposals",e.GET_PROTOCOLS="getProtocols",e.GET_SAPLING_DIFF_BY_CONTRACT="getSaplingDiffByContract",e.GET_SAPLING_DIFF_BY_ID="getSaplingDiffById",e.GET_SCRIPT="getScript",e.GET_STORAGE="getStorage",e.GET_SUCCESSOR_PERIOD="getSuccessorPeriod",e.GET_VOTES_LISTINGS="getVotesListings",e.PACK_DATA="packData",e.GET_STORAGE_USED_SPACE="getStorageUsedSpace",e.GET_STORAGE_PAID_SPACE="getStoragePaidSpace",e.GET_TICKET_BALANCE="getTicketBalance",e.GET_ALL_TICKET_BALANCES="getAllTicketBalances",e.GET_PENDING_OPERATIONS="getPendingOperations"}(f||(f={}));class h{constructor(e,t=1e3){this.rpcClient=e,this.ttl=t,this._cache={}}getAllCachedData(){return this._cache}deleteAllCachedData(){for(const e in this._cache)delete this._cache[e]}formatCacheKey(e,t,r,n){let i="";return r.forEach((e=>{i="object"==typeof e?i+JSON.stringify(e)+"/":i+e+"/"})),n?`${e}/${t}/${i}${JSON.stringify(n)}/`:`${e}/${t}/${i}`}has(e){return e in this._cache}get(e){return this._cache[e].response}put(e,t){const r=setTimeout((()=>this.remove(e)),this.ttl);Object.assign(this._cache,{[e]:{handle:r,response:t}})}remove(e){e in this._cache&&delete this._cache[e]}validateAddress(e){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t))}validateContract(e){const t=(0,o.validateContractAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,o.invalidDetail)(t))}getBlockHash({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_HASH,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockHash({block:e});return this.put(t,r),r}}))}getLiveBlocks({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_LIVE_BLOCKS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getLiveBlocks({block:e});return this.put(t,r),r}}))}getBalance(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALANCE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBalance(e,{block:t});return this.put(r,n),n}}))}getStorage(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorage(e,{block:t});return this.put(r,n),n}}))}getScript(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SCRIPT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getScript(e,{block:t});return this.put(r,n),n}}))}getNormalizedScript(e,t={unparsing_mode:"Readable"},{block:r}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_NORMALIZED_SCRIPT,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getNormalizedScript(e,t,{block:r});return this.put(n,i),i}}))}getContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CONTRACT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getContract(e,{block:t});return this.put(r,n),n}}))}getManagerKey(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_MANAGER_KEY,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getManagerKey(e,{block:t});return this.put(r,n),n}}))}getDelegate(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_DELEGATE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegate(e,{block:t});return this.put(r,n),n}}))}getBigMapKey(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BIG_MAP_KEY,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapKey(e,t,{block:r});return this.put(n,i),i}}))}getBigMapExpr(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BIG_MAP_EXPR,[r,e,t]);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapExpr(e,t,{block:r});return this.put(n,i),i}}))}getDelegates(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_DELEGATES,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegates(e,{block:t});return this.put(r,n),n}}))}getVotingInfo(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_VOTING_INFO,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getVotingInfo(e,{block:t});return this.put(r,n),n}}))}getConstants({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CONSTANTS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getConstants({block:e});return this.put(t,r),r}}))}getBlock({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlock({block:e});return this.put(t,r),r}}))}getBlockHeader({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_HEADER,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockHeader({block:e});return this.put(t,r),r}}))}getBlockMetadata({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_METADATA,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockMetadata({block:e});return this.put(t,r),r}}))}getBakingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BAKING_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBakingRights(e,{block:t});return this.put(r,n),n}}))}getAttestationRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ATTESTATION_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getAttestationRights(e,{block:t});return this.put(r,n),n}}))}getEndorsingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ENDORSING_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEndorsingRights(e,{block:t});return this.put(r,n),n}}))}getBallotList({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALLOT_LIST,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBallotList({block:e});return this.put(t,r),r}}))}getBallots({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALLOTS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBallots({block:e});return this.put(t,r),r}}))}getCurrentProposal({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_PROPOSAL,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentProposal({block:e});return this.put(t,r),r}}))}getCurrentQuorum({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_QUORUM,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentQuorum({block:e});return this.put(t,r),r}}))}getVotesListings({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_VOTES_LISTINGS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getVotesListings({block:e});return this.put(t,r),r}}))}getProposals({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PROPOSALS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getProposals({block:e});return this.put(t,r),r}}))}forgeOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.forgeOperations(e,{block:t})}))}injectOperation(e){return c(this,void 0,void 0,(function*(){return this.rpcClient.injectOperation(e)}))}preapplyOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.preapplyOperations(e,{block:t})}))}getEntrypoints(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ENTRYPOINTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEntrypoints(e,{block:t});return this.put(r,n),n}}))}runOperation(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.runOperation(e,{block:t})}))}simulateOperation(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.simulateOperation(e,{block:t})}))}runCode(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.runCode(e,{block:t})}))}runScriptView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.rpcClient.runScriptView(Object.assign({unparsing_mode:r},n),{block:i})}))}runView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.rpcClient.runView(Object.assign({unparsing_mode:r},n),{block:i})}))}getChainId(){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CHAIN_ID,[]);if(this.has(e))return this.get(e);{const t=this.rpcClient.getChainId();return this.put(e,t),t}}))}packData(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.PACK_DATA,[t],e);if(this.has(r))return this.get(r);{const n=this.rpcClient.packData(e,{block:t});return this.put(r,n),n}}))}getRpcUrl(){return this.rpcClient.getRpcUrl()}getCurrentPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_PERIOD,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentPeriod({block:e});return this.put(t,r),r}}))}getSuccessorPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SUCCESSOR_PERIOD,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getSuccessorPeriod({block:e});return this.put(t,r),r}}))}getSaplingDiffById(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SAPLING_DIFF_BY_ID,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffById(e,{block:t});return this.put(r,n),n}}))}getSaplingDiffByContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SAPLING_DIFF_BY_CONTRACT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffByContract(e,{block:t});return this.put(r,n),n}}))}getProtocols({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PROTOCOLS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getProtocols({block:e});return this.put(t,r),r}}))}getStorageUsedSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE_USED_SPACE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorageUsedSpace(e,{block:t});return this.put(r,n),n}}))}getStoragePaidSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE_PAID_SPACE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStoragePaidSpace(e,{block:t});return this.put(r,n),n}}))}getTicketBalance(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_TICKET_BALANCE,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getTicketBalance(e,t,{block:r});return this.put(n,i),i}}))}getAllTicketBalances(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ALL_TICKET_BALANCES,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getAllTicketBalances(e,{block:t});return this.put(r,n),n}}))}getPendingOperations(e={}){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PENDING_OPERATIONS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getPendingOperations(e);return this.put(t,r),r}}))}}var p,b,m,g,v,y,_,w,E,O;!function(e){e.TOO_LARGE="too large"}(p||(p={})),function(e){e.BAKING_BONUSES="baking bonuses",e.BAKING_REWARDS="baking rewards",e.BLOCK_FEES="block fees",e.BONDS="bonds",e.BOOTSTRAP="bootstrap",e.BURNED="burned",e.COMMITMENT="commitment",e.DELEGATE_DENOMINATOR="delegate_denominator",e.DELEGATOR_NUMERATOR="delegator_numerator",e.DEPOSITS="deposits",e.ENDORSING_REWARDS="endorsing rewards",e.INVOICE="invoice",e.LOST_ENDORSING_REWARDS="lost endorsing rewards",e.MINTED="minted",e.NONCE_REVELATION_REWARDS="nonce revelation rewards",e.PUNISHMENTS="punishments",e.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",e.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",e.STORAGE_FEES="storage fees",e.SUBSIDY="subsidy",e.UNSTAKED_DEPOSITS="unstaked_deposits"}(b||(b={})),function(e){e.WASM2="wasm_2_0_0",e.ARITH="arith",e.RISCV="riscv"}(m||(m={})),function(e){e.START="start",e.MOVE="move"}(g||(g={})),function(e){e.INBOX_PROOF="inbox_proof",e.REVEAL_PROOF="reveal_proof",e.FIRST_INPUT="first_input"}(v||(v={})),function(e){e.RAW_DATA_PROOF="raw_data_proof",e.METADATA_PROOF="metadata_proof",e.DAL_PAGE_PROOF="dal_page_proof"}(y||(y={})),function(e){e.ONGOING="ongoing",e.ENDED="ended"}(_||(_={})),function(e){e.LOSER="loser",e.DRAW="draw"}(w||(w={})),function(e){e.CONFLICT_RESOLVED="conflict_resolved",e.TIMEOUT="timeout"}(E||(E={})),function(e){e.ORIGINATION="origination",e.DELEGATION="delegation",e.REVEAL="reveal",e.TRANSACTION="transaction",e.ACTIVATION="activate_account",e.ATTESTATION="attestation",e.ENDORSEMENT="endorsement",e.PREATTESTATION="preattestation",e.PREENDORSEMENT="preendorsement",e.SET_DEPOSITS_LIMIT="set_deposits_limit",e.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",e.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",e.ATTESTATION_WITH_SLOT="attestation_with_slot",e.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",e.SEED_NONCE_REVELATION="seed_nonce_revelation",e.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",e.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",e.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",e.PROPOSALS="proposals",e.BALLOT="ballot",e.FAILING_NOOP="failing_noop",e.REGISTER_GLOBAL_CONSTANT="register_global_constant",e.TRANSFER_TICKET="transfer_ticket",e.INCREASE_PAID_STORAGE="increase_paid_storage",e.UPDATE_CONSENSUS_KEY="update_consensus_key",e.DRAIN_DELEGATE="drain_delegate",e.VDF_REVELATION="vdf_revelation",e.EVENT="event",e.TICKET_UPDATES="ticket_updates",e.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",e.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",e.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",e.SMART_ROLLUP_PUBLISH="smart_rollup_publish",e.SMART_ROLLUP_CEMENT="smart_rollup_cement",e.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",e.SMART_ROLLUP_REFUTE="smart_rollup_refute",e.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout"}(O||(O={}));const A={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"};class S{constructor(e,t=u,r=new n.HttpBackend){this.url=e,this.chain=t,this.httpBackend=r}createURL(e){let t=this.url;for(;t.endsWith("/");)t=t.slice(0,-1);return`${t}${e}`}validateAddress(e){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t))}validateContract(e){const t=(0,o.validateContractAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,o.invalidDetail)(t))}getBlockHash({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/hash`),method:"GET"})}))}getLiveBlocks({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/live_blocks`),method:"GET"})}))}getBalance(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/balance`),method:"GET"});return new i.Z(r)}))}getStorage(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage`),method:"GET"})}))}getScript(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/script`),method:"GET"})}))}getNormalizedScript(e,t={unparsing_mode:"Readable"},{block:r}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/script/normalized`),method:"POST"},t)}))}getContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}`),method:"GET"});return Object.assign(Object.assign({},r),{balance:new i.Z(r.balance)})}))}getManagerKey(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/manager_key`),method:"GET"})}))}getDelegate(e,{block:t}=l){return c(this,void 0,void 0,(function*(){let r;this.validateAddress(e);try{r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/delegate`),method:"GET"})}catch(e){if(!(e instanceof n.HttpResponseError&&e.status===n.STATUS_CODE.NOT_FOUND))throw e;r=null}return r}))}getBigMapKey(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/big_map_get`),method:"POST"},t)}))}getBigMapExpr(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/big_maps/${e}/${t}`),method:"GET"})}))}getDelegates(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/delegates/${e}`),method:"GET"}),n=d(r,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance","voting_power","total_delegated_stake","staking_denominator"]);return Object.assign(Object.assign(Object.assign({},r),n),{frozen_balance_by_cycle:r.frozen_balance_by_cycle?r.frozen_balance_by_cycle.map((e=>{var{deposit:t,deposits:r,fees:n,rewards:i}=e,o=a(e,["deposit","deposits","fees","rewards"]);const s=d({deposit:t,deposits:r,fees:n,rewards:i},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},o),{deposit:s.deposit,deposits:s.deposits,fees:s.fees,rewards:s.rewards})})):void 0})}))}getVotingInfo(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/delegates/${e}/voting_info`),method:"GET"})}))}getConstants({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/constants`),method:"GET"}),r=d(t,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_endorsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round","tx_rollup_commitment_bond","vdf_difficulty","sc_rollup_stake_amount","minimal_stake"]);return Object.assign(Object.assign({},t),r)}))}getBlock({block:e,version:t}=l){return c(this,void 0,void 0,(function*(){const r={url:this.createURL(`/chains/${this.chain}/blocks/${e}`),method:"GET"};return void 0!==t&&(r.query={version:t}),yield this.httpBackend.createRequest(r)}))}getBlockHeader({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/header`),method:"GET"})}))}getBlockMetadata({block:e,version:t}=l){return c(this,void 0,void 0,(function*(){const r={url:this.createURL(`/chains/${this.chain}/blocks/${e}/metadata`),method:"GET"};return void 0!==t&&(r.query={version:t}),yield this.httpBackend.createRequest(r)}))}getBakingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/baking_rights`),method:"GET",query:e})}))}getAttestationRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/attestation_rights`),method:"GET",query:e})}))}getEndorsingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/endorsing_rights`),method:"GET",query:e})}))}getBallotList({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballot_list`),method:"GET"})}))}getBallots({block:e}=l){return c(this,void 0,void 0,(function*(){return d(yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballots`),method:"GET"}),["yay","nay","pass"])}))}getCurrentProposal({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_proposal`),method:"GET"})}))}getCurrentQuorum({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_quorum`),method:"GET"})}))}getVotesListings({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/listings`),method:"GET"});return t.map((e=>(e.voting_power&&(e.voting_power=new i.Z(e.voting_power)),e))),t}))}getProposals({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/proposals`),method:"GET"});return t.map((e=>e[1]=new i.Z(e[1]))),t}))}forgeOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/forge/operations`),method:"POST"},e)}))}injectOperation(e){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},e)}))}preapplyOperations(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/preapply/operations`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}getEntrypoints(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/entrypoints`),method:"GET"})}))}runOperation(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/run_operation`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}simulateOperation(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/simulate_operation`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}runCode(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/run_code`),method:"POST"},e)}))}runScriptView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${i}/helpers/scripts/run_script_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}runView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${i}/helpers/scripts/run_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}getChainId(){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})}))}packData(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/pack_data`),method:"POST"},e),{gas:n}=r,o=a(r,["gas"]);let s=n;const c=new i.Z(n||"");return c.isNaN()||(s=c),Object.assign({gas:s},o)}))}getRpcUrl(){return this.url}getCurrentPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_period`),method:"GET"})}))}getSuccessorPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/successor_period`),method:"GET"})}))}getSaplingDiffById(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/sapling/${e}/get_diff`),method:"GET"})}))}getSaplingDiffByContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/single_sapling_get_diff`),method:"GET"})}))}getProtocols({block:e}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/protocols`),method:"GET"})}))}getStorageUsedSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage/used_space`),method:"GET"})}))}getStoragePaidSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage/paid_space`),method:"GET"})}))}getTicketBalance(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/ticket_balance`),method:"POST"},t)}))}getAllTicketBalances(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/all_ticket_balances`),method:"GET"})}))}getPendingOperations(e={}){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/pending_operations`),method:"GET",query:e})}))}}},4632:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DeprecationError:()=>f.DeprecationError,InvalidAddressError:()=>f.InvalidAddressError,InvalidBlockHashError:()=>f.InvalidBlockHashError,InvalidChainIdError:()=>f.InvalidChainIdError,InvalidContractAddressError:()=>f.InvalidContractAddressError,InvalidHexStringError:()=>f.InvalidHexStringError,InvalidKeyError:()=>f.InvalidKeyError,InvalidKeyHashError:()=>f.InvalidKeyHashError,InvalidMessageError:()=>f.InvalidMessageError,InvalidOperationHashError:()=>f.InvalidOperationHashError,InvalidOperationKindError:()=>f.InvalidOperationKindError,InvalidProtocolHashError:()=>E,InvalidPublicKeyError:()=>f.InvalidPublicKeyError,InvalidSignatureError:()=>f.InvalidSignatureError,Prefix:()=>n,ProhibitedActionError:()=>f.ProhibitedActionError,VERSION:()=>q,ValidationResult:()=>A,ValueConversionError:()=>O,b58cdecode:()=>te,b58cencode:()=>ee,b58decode:()=>re,b58decodeL2Address:()=>ne,buf2hex:()=>fe,bytes2Char:()=>pe,char2Bytes:()=>he,encodeExpr:()=>X,encodeKey:()=>se,encodeKeyHash:()=>ae,encodeL2Address:()=>oe,encodeOpHash:()=>Q,encodePubKey:()=>ie,format:()=>Y,getPkhfromPk:()=>de,hex2Bytes:()=>be,hex2buf:()=>ce,invalidDetail:()=>V,isValidPrefix:()=>S,mergebuf:()=>ue,mic2arr:()=>le,num2PaddedHex:()=>ge,prefix:()=>g,prefixLength:()=>v,stripHexPrefix:()=>ve,toHexBuf:()=>me,validateAddress:()=>C,validateBlock:()=>G,validateChain:()=>j,validateContractAddress:()=>D,validateKeyHash:()=>U,validateOperation:()=>K,validatePkAndExtractPrefix:()=>_,validateProtocol:()=>H,validatePublicKey:()=>F,validateSignature:()=>B,validateSmartRollupAddress:()=>z,validateSpendingKey:()=>$,verifySignature:()=>y});var n,i=r(8834),o=r(7728),s=r(6851),a=r(1395),c=r.n(a),u=r(4075),l=r.n(u),f=r(227),d=r(2558),h=r(7554),p=r.n(h),b=r(8743),m=r.n(b);!function(e){e.TZ1="tz1",e.TZ2="tz2",e.TZ3="tz3",e.TZ4="tz4",e.KT="KT",e.KT1="KT1",e.EDSK2="edsk2",e.SPSK="spsk",e.P2SK="p2sk",e.EDPK="edpk",e.SPPK="sppk",e.P2PK="p2pk",e.BLPK="BLpk",e.EDESK="edesk",e.SPESK="spesk",e.P2ESK="p2esk",e.EDSK="edsk",e.EDSIG="edsig",e.SPSIG="spsig",e.P2SIG="p2sig",e.SIG="sig",e.NET="Net",e.NCE="nce",e.B="B",e.O="o",e.LO="Lo",e.LLO="LLo",e.P="P",e.CO="Co",e.ID="id",e.EXPR="expr",e.TZ="TZ",e.VH="vh",e.SASK="sask",e.ZET1="zet1",e.SR1="sr1",e.SRC1="src1"}(n||(n={}));const g={[n.TZ1]:new Uint8Array([6,161,159]),[n.TZ2]:new Uint8Array([6,161,161]),[n.TZ3]:new Uint8Array([6,161,164]),[n.TZ4]:new Uint8Array([6,161,166]),[n.KT]:new Uint8Array([2,90,121]),[n.KT1]:new Uint8Array([2,90,121]),[n.EDSK]:new Uint8Array([43,246,78,7]),[n.EDSK2]:new Uint8Array([13,15,58,7]),[n.SPSK]:new Uint8Array([17,162,224,201]),[n.P2SK]:new Uint8Array([16,81,238,189]),[n.EDPK]:new Uint8Array([13,15,37,217]),[n.SPPK]:new Uint8Array([3,254,226,86]),[n.P2PK]:new Uint8Array([3,178,139,127]),[n.BLPK]:new Uint8Array([6,149,135,204]),[n.EDESK]:new Uint8Array([7,90,60,179,41]),[n.SPESK]:new Uint8Array([9,237,241,174,150]),[n.P2ESK]:new Uint8Array([9,48,57,115,171]),[n.EDSIG]:new Uint8Array([9,245,205,134,18]),[n.SPSIG]:new Uint8Array([13,115,101,19,63]),[n.P2SIG]:new Uint8Array([54,240,44,52]),[n.SIG]:new Uint8Array([4,130,43]),[n.NET]:new Uint8Array([87,82,0]),[n.NCE]:new Uint8Array([69,220,169]),[n.B]:new Uint8Array([1,52]),[n.O]:new Uint8Array([5,116]),[n.LO]:new Uint8Array([133,233]),[n.LLO]:new Uint8Array([29,159,109]),[n.P]:new Uint8Array([2,170]),[n.CO]:new Uint8Array([79,179]),[n.ID]:new Uint8Array([153,103]),[n.EXPR]:new Uint8Array([13,44,64,27]),[n.TZ]:new Uint8Array([2,90,121]),[n.VH]:new Uint8Array([1,106,242]),[n.SASK]:new Uint8Array([11,237,20,92]),[n.ZET1]:new Uint8Array([18,71,40,223]),[n.SR1]:new Uint8Array([6,124,117]),[n.SRC1]:new Uint8Array([17,165,134,138])},v={[n.TZ1]:20,[n.TZ2]:20,[n.TZ3]:20,[n.TZ4]:20,[n.KT]:20,[n.KT1]:20,[n.EDPK]:32,[n.SPPK]:33,[n.P2PK]:33,[n.BLPK]:48,[n.EDSIG]:64,[n.SPSIG]:64,[n.P2SIG]:64,[n.SIG]:64,[n.NET]:4,[n.B]:32,[n.P]:32,[n.O]:32,[n.VH]:32,[n.SASK]:169,[n.ZET1]:43,[n.SR1]:20,[n.SRC1]:32};function y(e,t,r,i){const a=_(t),c=function(e){const t=e.startsWith("sig")?e.substring(0,3):e.substring(0,5),r=B(e);if(r!==A.VALID)throw new f.InvalidSignatureError(e,V(r));return t}(r),u=te(t,g[a]),l=te(r,g[c]);let d=ce(function(e){if(""===e)throw new f.InvalidMessageError(e,"can't be empty");return e}(e));void 0!==i&&(d=ue(i,d));const h=(0,s.vp)(d,32);return a===n.EDPK?function(e,t,r){try{return(0,o.T)(r,t,e)}catch(e){return!1}}(l,h,u):a===n.SPPK?function(e,t,r){const n=new(p().ec)("secp256k1").keyFromPublic(r);return w(e,t,n)}(l,h,u):a===n.P2PK&&function(e,t,r){const n=new(p().ec)("p256").keyFromPublic(r);return w(e,t,n)}(l,h,u)}function _(e){if(""===e)throw new f.InvalidPublicKeyError(e,"can't be empty");const t=e.substring(0,4),r=F(e);if(r!==A.VALID)throw new f.InvalidPublicKeyError(e,V(r));return t}function w(e,t,r){const n=fe(m()(e)).match(/([a-f\d]{64})/gi);if(n)try{const[e,i]=n;return r.verify(t,{r:e,s:i})}catch(e){return!1}return!1}class E extends f.ParameterValidationError{constructor(e,t){super(),this.protocolHash=e,this.errorDetails=t,this.name="InvalidProtocolHashError",this.name="InvalidProtocolHashError",this.message=`The protocol hash '${e}' is invalid`,t&&(this.message+=`: ${t}`)}}class O extends f.UnsupportedActionError{constructor(e,t){super(),this.value=e,this.desiredType=t,this.name="ValueConversionError",this.message=`Unable to convert ${e} to a ${t}`}}var A;function S(e){return"string"==typeof e&&e in g}function P(e,t){const r=new RegExp(`^(${t.join("|")})`).exec(e);if(!r||0===r.length)return A.NO_PREFIX_MATCHED;const n=r[0];if(!S(n))return A.NO_PREFIX_MATCHED;e.includes("%")&&(e=e.split("%")[0]);if(!/^(KT1\w{33})$/.test(e)&&"KT1"===n)return A.INVALID_CHECKSUM;let i=l().decodeUnsafe(e);return i?(i=i.slice(g[n].length),i.length!==v[n]?A.INVALID_LENGTH:A.VALID):A.INVALID_CHECKSUM}!function(e){e[e.NO_PREFIX_MATCHED=0]="NO_PREFIX_MATCHED",e[e.INVALID_CHECKSUM=1]="INVALID_CHECKSUM",e[e.INVALID_LENGTH=2]="INVALID_LENGTH",e[e.VALID=3]="VALID"}(A||(A={}));const T=[n.TZ1,n.TZ2,n.TZ3,n.TZ4],I=[n.KT1],R=[n.EDSIG,n.P2SIG,n.SPSIG,n.SIG],x=[n.EDPK,n.SPPK,n.P2PK,n.BLPK],M=[n.O],k=[n.P],L=[n.B],N=[n.SR1];function C(e){return P(e,[...T,...I,...N])}function j(e){return P(e,[n.NET])}function D(e){return P(e,I)}function U(e){return P(e,T)}function B(e){return P(e,R)}function F(e){return P(e,x)}function K(e){return P(e,M)}function H(e){return P(e,k)}function G(e){return P(e,L)}function $(e){return P(e,[n.SASK])}function V(e){switch(e){case A.NO_PREFIX_MATCHED:return"with unsupported prefix";case A.INVALID_CHECKSUM:return"failed checksum";case A.INVALID_LENGTH:return"with incorrect length";default:return""}}function z(e){return P(e,[...N])}const q={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"},W=6,Z=3;function J(e){switch(e){case"tz":return W;case"mtz":return Z;default:return 0}}function Y(e="mutez",t="mutez",r){const n=new d.Z(r);return n.isNaN()?r:n.multipliedBy(Math.pow(10,J(e))).dividedBy(Math.pow(10,J(t)))}function X(e){return ee(c().blake2b(ce(e),void 0,32),g.expr)}function Q(e){return ee(c().blake2b(ce(e),void 0,32),g.o)}function ee(e,t){const r="string"==typeof e?Uint8Array.from(i.lW.from(e,"hex")):e,n=new Uint8Array(t.length+r.length);return n.set(t),n.set(r,t.length),l().encode(i.lW.from(n.buffer))}const te=(e,t)=>l().decode(e).slice(t.length);function re(e){const t=l().decode(e),r={[g.tz1.toString()]:"0000",[g.tz2.toString()]:"0001",[g.tz3.toString()]:"0002"}[new Uint8Array(t.slice(0,3)).toString()];if(r){return r+fe(t.slice(3))}return"01"+fe(t.slice(3,42))+"00"}function ne(e){const t=l().decode(e);return fe(t.slice(3,42))}function ie(e){if("00"===e.substring(0,2)){const t={"0000":g.tz1,"0001":g.tz2,"0002":g.tz3};return ee(e.substring(4),t[e.substring(0,4)])}return ee(e.substring(2,42),g.KT)}function oe(e){return ee(e,g.tz4)}function se(e){if("0"===e[0]){const t={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return ee(e.substring(2),t[e.substring(0,2)])}}function ae(e){if("0"===e[0]){const t={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return ee(e.substring(2),t[e.substring(0,2)])}}const ce=e=>{if(e.length%2!=0)throw new f.InvalidHexStringError(e,": Expecting even number of characters");const t=ve(e);if(!t.match(/^([\da-f]{2})*$/gi))throw new f.InvalidHexStringError(e,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const r=new Uint8Array(t.length/2);let n=0;for(let i=0;i{const r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r},le=function e(t){let r=[];if(Object.prototype.hasOwnProperty.call(t,"prim"))"Pair"===t.prim?(r.push(e(t.args[0])),r=r.concat(e(t.args[1]))):"Elt"===t.prim?r={key:e(t.args[0]),val:e(t.args[1])}:"True"===t.prim?r=!0:"False"===t.prim&&(r=!1);else if(Array.isArray(t)){const n=t.length;for(let i=0;i{const t=[];return e.forEach((e=>{const r=`00${e.toString(16)}`.slice(-2);t.push(r)})),t.join("")},de=e=>{let t,r;const i=_(e),o=te(e,g[i]);switch(i){case n.EDPK:t=g[n.TZ1],r=v[n.TZ1];break;case n.SPPK:t=g[n.TZ2],r=v[n.TZ2];break;case n.P2PK:t=g[n.TZ3],r=v[n.TZ3];break;case n.BLPK:t=g[n.TZ4],r=v[n.TZ4]}return ee((0,s.vp)(o,r),t)};function he(e){return i.lW.from(e,"utf8").toString("hex")}function pe(e){return i.lW.from(ce(e)).toString("utf8")}function be(e){const t=ve(e);if(!t.match(/^(0x)?([\da-f]{2})*$/gi))throw new f.InvalidHexStringError(e,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return i.lW.from(t,"hex")}function me(e,t=8){return i.lW.from(ge(e,t),"hex")}function ge(e,t=8){if(new d.Z(e).isPositive()){const r=Math.ceil(t/4),n=e.toString(16);let i=n.length>=r?n.length:r;return i=i%2==0?i:i+1,function(e,t){const r="0";if(e.length>=t)return e;{const n=t-e.length;return r.repeat(n)+e}}(n,i)}return new d.Z(2).pow(t).minus(new d.Z(e).abs()).toString(16)}function ve(e){return e.startsWith("0x")?e.slice(2):e}},150:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RPCBatchProvider=t.OperationBatch=t.BATCH_KINDS=void 0;const i=r(9480),o=r(3650),s=r(6368),a=r(4632),c=r(227),u=r(6003),l=r(3793);t.BATCH_KINDS=[s.OpKind.ACTIVATION,s.OpKind.ORIGINATION,s.OpKind.TRANSACTION,s.OpKind.DELEGATION];class f extends u.Provider{constructor(e,t){super(e),this.estimator=t,this.operations=[],this.prepare=new l.PrepareProvider(this.context)}withTransfer(e){const t=(0,a.validateAddress)(e.to);if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());if(t!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:s.OpKind.TRANSACTION},e)),this}withTransferTicket(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:s.OpKind.TRANSFER_TICKET},e)),this}withContractCall(e,t={}){return this.withTransfer(e.toTransferParams(t))}withDelegation(e){var t;const r=(0,a.validateAddress)(e.source);if(e.source&&r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.delegate,(0,a.invalidDetail)(n));return this.operations.push(Object.assign({kind:s.OpKind.DELEGATION},e)),this}withActivation({pkh:e,secret:t}){const r=(0,a.validateKeyHash)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidKeyHashError(e,(0,a.invalidDetail)(r));return this.operations.push({kind:s.OpKind.ACTIVATION,pkh:e,secret:t}),this}withOrigination(e){return this.operations.push(Object.assign({kind:s.OpKind.ORIGINATION},e)),this}withRegisterGlobalConstant(e){return this.operations.push(Object.assign({kind:s.OpKind.REGISTER_GLOBAL_CONSTANT},e)),this}withIncreasePaidStorage(e){return this.operations.push(Object.assign({kind:s.OpKind.INCREASE_PAID_STORAGE},e)),this}withSmartRollupAddMessages(e){return this.operations.push(Object.assign({kind:s.OpKind.SMART_ROLLUP_ADD_MESSAGES},e)),this}withSmartRollupOriginate(e){return this.operations.push(Object.assign({kind:s.OpKind.SMART_ROLLUP_ORIGINATE},e)),this}getRPCOp(e){return n(this,void 0,void 0,(function*(){switch(e.kind){case s.OpKind.TRANSACTION:return(0,i.createTransferOperation)(Object.assign({},e));case s.OpKind.ORIGINATION:return(0,i.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign({},e)));case s.OpKind.DELEGATION:return(0,i.createSetDelegateOperation)(Object.assign({},e));case s.OpKind.REGISTER_GLOBAL_CONSTANT:return(0,i.createRegisterGlobalConstantOperation)(Object.assign({},e));case s.OpKind.INCREASE_PAID_STORAGE:return(0,i.createIncreasePaidStorageOperation)(Object.assign({},e));case s.OpKind.TRANSFER_TICKET:return(0,i.createTransferTicketOperation)(Object.assign({},e));case s.OpKind.SMART_ROLLUP_ADD_MESSAGES:return(0,i.createSmartRollupAddMessagesOperation)(Object.assign({},e));case s.OpKind.SMART_ROLLUP_ORIGINATE:return(0,i.createSmartRollupOriginateOperation)(Object.assign({},e));default:throw new c.InvalidOperationKindError(JSON.stringify(e.kind))}}))}with(e){for(const t of e)switch(t.kind){case s.OpKind.TRANSACTION:this.withTransfer(t);break;case s.OpKind.ORIGINATION:this.withOrigination(t);break;case s.OpKind.DELEGATION:this.withDelegation(t);break;case s.OpKind.ACTIVATION:this.withActivation(t);break;case s.OpKind.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant(t);break;case s.OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(t);break;case s.OpKind.TRANSFER_TICKET:this.withTransferTicket(t);break;case s.OpKind.SMART_ROLLUP_ADD_MESSAGES:this.withSmartRollupAddMessages(t);break;case s.OpKind.SMART_ROLLUP_ORIGINATE:this.withSmartRollupOriginate(t);break;default:throw new c.InvalidOperationKindError(JSON.stringify(t.kind))}return this}send(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=e&&e.source||t,n=yield this.estimator.batch(this.operations);n.length!==this.operations.length&&n.shift();const i=yield this.prepare.batch(this.operations,n),s=yield this.forge(i),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(s);return new o.BatchOperation(a,i.opOb.contents,r,u,l,c)}))}}t.OperationBatch=f;t.RPCBatchProvider=class{constructor(e,t){this.context=e,this.estimator=t}batch(e){const t=new f(this.context,this.estimator);return Array.isArray(e)&&t.with(e),t}}},4593:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.getRevealGasLimit=t.ChainIds=t.protocols=t.Protocols=t.COST_PER_BYTE=t.DEFAULT_STORAGE_LIMIT=t.DEFAULT_FEE=t.DEFAULT_GAS_LIMIT=void 0,t.DEFAULT_GAS_LIMIT={DELEGATION:10600,ORIGINATION:10600,TRANSFER:10600,REVEAL_TZ1:1e3,REVEAL_TZ2:1e3,REVEAL_TZ3:2e3,REVEAL_TZ4:2e3},t.DEFAULT_FEE={DELEGATION:1257,ORIGINATION:1e4,TRANSFER:1e4,REVEAL:374},t.DEFAULT_STORAGE_LIMIT={DELEGATION:0,ORIGINATION:257,TRANSFER:257,REVEAL:0},t.COST_PER_BYTE=250,function(e){e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(r||(t.Protocols=r={})),t.protocols={"004":[r.Pt24m4xi],"005":[r.PsBABY5H,r.PsBabyM1],"006":[r.PsCARTHA],"007":[r.PsDELPH1],"008":[r.PtEdo2Zk],"009":[r.PsFLorena],"010":[r.PtGRANADs],"011":[r.PtHangz2],"012":[r.PsiThaCa,r.Psithaca2],"013":[r.PtJakart2],"014":[r.PtKathman],"015":[r.PtLimaPtL],"016":[r.PtMumbai2],"017":[r.PtNairobi],"019":[r.ProxfordY],"020":[r.ProtoALpha]},function(e){e.MAINNET="NetXdQprcVkpaWU",e.CARTHAGENET="NetXjD3HPJJjmcd",e.DELPHINET="NetXm8tYqnMWky1",e.EDONET="NetXSgo1ZT2DRUG",e.FLORENCENET="NetXxkAx4woPLyu",e.GRANADANET="NetXz969SFaFn8k",e.HANGZHOUNET="NetXZSsxBpMQeAT",e.ITHACANET="NetXbhmtAbMukLc",e.ITHACANET2="NetXnHfVqm9iesp",e.JAKARTANET2="NetXLH1uAxK7CCh",e.KATHMANDUNET="NetXazhm4yetmff",e.LIMANET="NetXizpkH94bocH",e.MUMBAINET="NetXQw6nWSnrJ5t",e.MUMBAINET2="NetXgbcrNtXD2yA",e.NAIROBINET="NetXyuzvDo2Ugzb",e.OXFORDNET2="NetXxWsskGahzQB"}(n||(t.ChainIds=n={}));t.getRevealGasLimit=e=>Math.round(11*i(e)/10);const i=e=>{switch(e.substring(0,3)){case"tz1":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ1;case"tz2":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ2;case"tz3":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ3;case"tz4":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ4;default:throw new Error(`Cannot estimate reveal gas limit for ${e}`)}}},4984:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Context=t.defaultConfigConfirmation=void 0;const i=r(6368),o=r(5744),s=r(1067),a=r(8286),c=r(992),u=r(4782),l=r(1151),f=r(150),d=r(635),h=r(5286),p=r(6395),b=r(977),m=r(9494),g=r(259),v=r(5032),y=r(6713),_=r(2021);t.defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class w{constructor(e,r=new s.NoopSigner,n,w=new b.BehaviorSubject(Object.assign({},t.defaultConfigConfirmation)),E,O,A,S,P,T,I,R){this._rpc=e,this._signer=r,this._proto=n,this._config=w,this.providerDecorator=[],this.tz=new c.RpcTzProvider(this),this.estimate=new u.RPCEstimateProvider(this),this.contract=new l.RpcContractProvider(this,this.estimate),this.prepare=new _.PrepareProvider(this),this.batch=new f.RPCBatchProvider(this,this.estimate),this.wallet=new d.Wallet(this),this.withExtensions=()=>{let e=this.clone();return this.providerDecorator.forEach((t=>{e=t(e)})),e},"string"==typeof this._rpc?this._rpcClient=new i.RpcClient(this._rpc):this._rpcClient=this._rpc,this._forger=E||new y.TaquitoLocalForger(this),this._injector=O||new o.RpcInjector(this),this.operationFactory=new a.OperationFactory(this),this._walletProvider=S||new d.LegacyWalletProvider(this),this._parser=P||new h.MichelCodecParser(this),this._packer=A||new p.RpcPacker(this),this._globalConstantsProvider=T||new m.NoopGlobalConstantsProvider,this._readProvider=I||new g.RpcReadAdapter(this._rpcClient),this._stream=R||new v.PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(e){this._config.next(Object.assign({},e))}setPartialConfig(e){this._config.next(Object.assign(Object.assign({},this._config.getValue()),e))}get rpc(){return this._rpcClient}set rpc(e){this._rpcClient=e}get injector(){return this._injector}set injector(e){this._injector=e}get forger(){return this._forger}set forger(e){this._forger=e}get signer(){return this._signer}set signer(e){this._signer=e}get walletProvider(){return this._walletProvider}set walletProvider(e){this._walletProvider=e}set proto(e){this._proto=e}get proto(){return this._proto}get parser(){return this._parser}set parser(e){this._parser=e}get packer(){return this._packer}set packer(e){this._packer=e}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(e){this._globalConstantsProvider=e}get readProvider(){return this._readProvider}set readProvider(e){this._readProvider=e}get stream(){return this._stream}set stream(e){this._stream=e}isAnyProtocolActive(e=[]){return n(this,void 0,void 0,(function*(){if(this._proto)return e.includes(this._proto);{const t=yield this.readProvider.getNextProtocol("head");return e.includes(t)}}))}isAnySignerConfigured(){return!(this.signer instanceof s.NoopSigner)}clone(){return new w(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(e){this.providerDecorator.push(e)}}t.Context=w},5225:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BigMapAbstraction=void 0;const i=r(5543);t.BigMapAbstraction=class{constructor(e,t,r){this.id=e,this.schema=t,this.provider=r}get(e,t){return n(this,void 0,void 0,(function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),e,this.schema,t)}catch(e){if(e instanceof i.HttpResponseError&&e.status===i.STATUS_CODE.NOT_FOUND)return;throw e}}))}getMultipleValues(e,t,r=5){return n(this,void 0,void 0,(function*(){return this.provider.getBigMapKeysByID(this.id.toString(),e,this.schema,t,r)}))}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}},191:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compose=void 0,t.compose=function(e,t){return(r,n)=>t(e(r,n),n)}},2298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethodFactory=void 0;const n=r(3687),i=r(4397),o=r(3849);t.ContractMethodFactory=class{constructor(e,t){this.provider=e,this.contractAddress=t}createContractMethodFlatParams(e,t,r,n=!0,o=!1){return new i.ContractMethod(this.provider,this.contractAddress,e,t,r,n,o)}createContractMethodObjectParam(e,t,r,i=!0,o=!1){return new n.ContractMethodObject(this.provider,this.contractAddress,e,t,r,i,o)}createContractViewObjectParam(e,t,r,n,i){return new o.OnChainView(e,t,this.contractAddress,r,n,i)}}},4397:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethod=void 0;const n=r(635),i=r(1863),o=r(6700);t.ContractMethod=class{constructor(e,t,r,n,i,o=!0,s=!1){this.provider=e,this.address=t,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}validateArgs(e,t,r){const n=t.ExtractSignatures();if(!n.find((t=>t.length===e.length)))throw new o.InvalidParameterError(r,n,e)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(!this.isAnonymous){const e=this.parameterSchema.ExtractSignatures();return 1==e.length?e[0]:e}{const e=this.parameterSchema.ExtractSignatures().find((e=>e[0]===this.name));if(e)return e.shift(),e}}send(e={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}toTransferParams({fee:e,gasLimit:t,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:e,mutez:s,source:n,gasLimit:t,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.Encode(this.name,...this.args):this.parameterSchema.Encode(...this.args)}}}}},4662:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3687:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethodObject=void 0;const n=r(635),i=r(1863);t.ContractMethodObject=class{constructor(e,t,r,n,i="unit",o=!0,s=!1){this.provider=e,this.address=t,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}getSignature(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}send(e={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}toTransferParams({fee:e,gasLimit:t,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:e,mutez:s,source:n,gasLimit:t,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}},3849:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OnChainView=void 0;const i=r(4632),o=r(6700),s=r(227);t.OnChainView=class{constructor(e,t,r,n,i,o="Unit"){this._rpc=e,this._readProvider=t,this._contractAddress=r,this._smartContractViewSchema=n,this._contractStorageType=i,this._args=o}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}executeView(e){return n(this,void 0,void 0,(function*(){this.verifyContextExecution(e);const t=yield this._readProvider.getChainId(),r=this.transformArgsToMichelson(),n={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:r,chain_id:t,source:e.viewCaller};return e.source&&(n.payer=e.source),this.executeViewAndDecodeResult(n)}))}verifyContextExecution(e){if(e.source&&(0,i.validateAddress)(e.source)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${e.source}.`);if(!e.viewCaller||(0,i.validateAddress)(e.viewCaller)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${e.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(e){throw new s.InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,e)}}adaptViewCodeToContext(e,t,r){const n={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:r}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:t}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return e.forEach(((i,o)=>{i.prim in n&&(e[o]=Object(n)[i.prim]),i.args&&0!==i.args.length?this.adaptViewCodeToContext(i.args,t,r):Array.isArray(i)&&this.adaptViewCodeToContext(i,t,r)})),e}executeViewAndDecodeResult(e){return n(this,void 0,void 0,(function*(){let t;try{t=(yield this._rpc.runScriptView(e)).data}catch(e){const t=(0,o.validateAndExtractFailwith)(e);throw t?new o.ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(t)}`,this._smartContractViewSchema.viewName,t,e):e}return this._smartContractViewSchema.decodeViewResult(t)}))}}},1863:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ContractAbstraction=t.ContractView=t.DEFAULT_SMART_CONTRACT_METHOD_NAME=void 0;const i=r(8899),o=r(4632),s=r(2298),a=r(6700),c=r(227);t.DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class u{constructor(e,t,r,n,i,o,s){this.currentContract=e,this.name=t,this.callbackParametersSchema=r,this.parameterSchema=n,this.args=i,this.rpc=o,this.readProvider=s}read(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateChain)(null!=e?e:"");if((0,o.validateContractAddress)(null!=e?e:"")==o.ValidationResult.VALID)throw new c.DeprecationError("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(e&&t!==o.ValidationResult.VALID)throw new c.InvalidChainIdError(e,(0,o.invalidDetail)(t));const r=this.parameterSchema.Encode(...this.args),n=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:r,chain_id:e||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(n.data)}))}}t.ContractView=u;t.ContractAbstraction=class{constructor(e,t,r,n,o,a,c){this.address=e,this.script=t,this.storageProvider=n,this.entrypoints=o,this.rpc=a,this.readProvider=c,this.methods={},this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new s.ContractMethodFactory(r,e),this.schema=i.Schema.fromRPCResponse({script:this.script}),this.parameterSchema=i.ParameterSchema.fromRPCResponse({script:this.script}),this.viewSchema=i.ViewSchema.fromRPCResponse({script:this.script}),0!==this.viewSchema.length&&this._initializeOnChainViews(this,a,this.readProvider,this.viewSchema),this.eventSchema=i.EventSchema.fromRPCResponse({script:this.script}),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(e,r,n,o){const s=this.parameterSchema,c=Object.keys(r);if(s.isMultipleEntryPoint){c.forEach((t=>{const s=new i.ParameterSchema(r[t]);if(this.methods[t]=function(...r){return e.contractMethodFactory.createContractMethodFlatParams(s,t,r)},this.methodsObject[t]=function(r){return e.contractMethodFactory.createContractMethodObjectParam(s,t,r)},(e=>{let t=!1;if("prim"in e&&"pair"===e.prim&&e.args){const r=e.args[e.args.length-1];"prim"in r&&"contract"===r.prim&&(t=!0)}return t})(r[t])){const s=function(...s){const c=r[t].args[0],l=new i.ParameterSchema(c),f=r[t].args[1].args[0],d=new i.ParameterSchema(f);return((e,t,r)=>{const n=t.ExtractSignatures();if(!n.find((t=>t.length===e.length)))throw new a.InvalidParameterError(r,n,e)})(s,l,t),new u(e,t,d,l,s,n,o)};this.views[t]=s}}));Object.keys(s.ExtractSchema()).filter((e=>-1===Object.keys(r).indexOf(e))).forEach((t=>{this.methods[t]=function(...r){return e.contractMethodFactory.createContractMethodFlatParams(s,t,r,!1,!0)},this.methodsObject[t]=function(r){return e.contractMethodFactory.createContractMethodObjectParam(s,t,r,!1,!0)}}))}else{const r=this.parameterSchema;this.methods[t.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...n){return e.contractMethodFactory.createContractMethodFlatParams(r,t.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)},this.methodsObject[t.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(n){return e.contractMethodFactory.createContractMethodObjectParam(r,t.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)}}}_initializeOnChainViews(e,t,r,n){const i=this.schema.val;n.forEach((n=>{this.contractViews[n.viewName]=function(o){return e.contractMethodFactory.createContractViewObjectParam(t,r,n,i,o)}}))}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(e){return this.storageProvider.getBigMapKey(this.address,e,this.schema)}}},6700:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidBalanceError=t.OriginationParameterError=t.RevealOperationError=t.InvalidViewSimulationContext=t.validateAndExtractFailwith=t.ViewSimulationError=t.InvalidInitParameter=t.InvalidCodeParameter=t.InvalidDelegationSource=t.InvalidParameterError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e,t,r){super(),this.smartContractMethodName=e,this.sigs=t,this.invalidParams=r,this.name="InvalidParameterError",this.message=`${e} Received ${r.length} arguments while expecting one of the following signatures (${JSON.stringify(t)})`}}t.InvalidParameterError=i;class o extends n.ParameterValidationError{constructor(e){super(),this.source=e,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${e}. Please use the smart contract abstraction to set your delegate.`}}t.InvalidDelegationSource=o;class s extends n.ParameterValidationError{constructor(e,t){super(),this.message=e,this.data=t,this.name="InvalidCodeParameter"}}t.InvalidCodeParameter=s;class a extends n.ParameterValidationError{constructor(e,t){super(),this.message=e,this.data=t,this.name="InvalidInitParameter"}}t.InvalidInitParameter=a;class c extends n.RpcError{constructor(e,t,r,n){super(),this.message=e,this.viewName=t,this.failWith=r,this.cause=n,this.name="ViewSimulationError"}}t.ViewSimulationError=c;t.validateAndExtractFailwith=e=>{if(u(e.body)){const t=JSON.parse(e.body);if(Array.isArray(t)&&"with"in t[t.length-1])return t[t.length-1].with}};const u=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};class l extends n.ParameterValidationError{constructor(e){super(),this.info=e,this.name="InvalidViewSimulationContext",this.message=`${e} Please configure the context of the view execution in the executeView method.`}}t.InvalidViewSimulationContext=l;class f extends n.RpcError{constructor(e){super(),this.message=e,this.name="RevealOperationError"}}t.RevealOperationError=f;class d extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name}}t.OriginationParameterError=d;class h extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidBalanceError"}}t.InvalidBalanceError=h},238:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.smartContractAbstractionSemantic=t.compose=void 0,i(r(1863),t),i(r(6700),t),i(r(2619),t),i(r(4007),t),i(r(9480),t),i(r(120),t);var o=r(191);Object.defineProperty(t,"compose",{enumerable:!0,get:function(){return o.compose}}),i(r(4662),t),i(r(4397),t),i(r(3687),t),i(r(5491),t);var s=r(22);Object.defineProperty(t,"smartContractAbstractionSemantic",{enumerable:!0,get:function(){return s.smartContractAbstractionSemantic}})},2619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4007:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MANAGER_LAMBDA=void 0;t.MANAGER_LAMBDA={setDelegate:e=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:e}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],removeDelegate:()=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"NONE",args:[{prim:"key_hash"}]},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit:(e,t)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:e}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${t}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],transferToContract:(e,t)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"address"},{string:e}]},{prim:"CONTRACT",args:[{prim:"unit"}]},{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:`${t}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}]}},9480:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createSmartRollupOriginateOperation=t.createSmartRollupAddMessagesOperation=t.createUpdateConsensusKeyOperation=t.createProposalsOperation=t.createBallotOperation=t.createDrainDelegateOperation=t.createIncreasePaidStorageOperation=t.createTransferTicketOperation=t.createRegisterGlobalConstantOperation=t.createRevealOperation=t.createRegisterDelegateOperation=t.createSetDelegateOperation=t.createTransferOperation=t.createOriginationOperation=t.createActivationOperation=void 0;const i=r(8899),o=r(6368),s=r(4593),a=r(4632),c=r(6700);t.createActivationOperation=({pkh:e,secret:t})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.ACTIVATION,pkh:e,secret:t}}));t.createOriginationOperation=({code:e,init:t,balance:r="0",delegate:u,storage:l,fee:f=s.DEFAULT_FEE.ORIGINATION,gasLimit:d=s.DEFAULT_GAS_LIMIT.ORIGINATION,storageLimit:h=s.DEFAULT_STORAGE_LIMIT.ORIGINATION,mutez:p=!1})=>n(void 0,void 0,void 0,(function*(){if(void 0!==l&&void 0!==t)throw new c.OriginationParameterError("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(e))throw new c.InvalidCodeParameter("Wrong code parameter type, expected an array",e);let n;if(void 0!==l){const t=e.find((e=>"prim"in e&&"storage"===e.prim));if(void 0===(null==t?void 0:t.args))throw new c.InvalidCodeParameter("The storage section is missing from the script",e);n=new i.Schema(t.args[0]).Encode(l)}else{if(void 0===t||"object"!=typeof t)throw new c.InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",t);n=t}const s={code:e,storage:n};if(isNaN(Number(r)))throw new c.InvalidBalanceError(`Invalid Balance "${r}", cannot be converted to a number`);const b={kind:o.OpKind.ORIGINATION,fee:f,gas_limit:d,storage_limit:h,balance:p?r.toString():(0,a.format)("tz","mutez",r).toString(),script:s};return u&&(b.delegate=u),b}));t.createTransferOperation=({to:e,amount:t,parameter:r,fee:i=s.DEFAULT_FEE.TRANSFER,gasLimit:c=s.DEFAULT_GAS_LIMIT.TRANSFER,storageLimit:u=s.DEFAULT_STORAGE_LIMIT.TRANSFER,mutez:l=!1})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSACTION,fee:i,gas_limit:c,storage_limit:u,amount:l?t.toString():(0,a.format)("tz","mutez",t).toString(),destination:e,parameters:r}}));t.createSetDelegateOperation=({delegate:e,source:t,fee:r=s.DEFAULT_FEE.DELEGATION,gasLimit:i=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:a=s.DEFAULT_STORAGE_LIMIT.DELEGATION})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,source:t,fee:r,gas_limit:i,storage_limit:a,delegate:e}}));t.createRegisterDelegateOperation=({fee:e=s.DEFAULT_FEE.DELEGATION,gasLimit:t=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.DELEGATION},i)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,fee:e,gas_limit:t,storage_limit:r,delegate:i}}));t.createRevealOperation=({fee:e=s.DEFAULT_FEE.REVEAL,gasLimit:t,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.REVEAL},i,a)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REVEAL,fee:e,public_key:a,source:i,gas_limit:null!=t?t:(0,s.getRevealGasLimit)(i),storage_limit:r}}));t.createRegisterGlobalConstantOperation=({value:e,source:t,fee:r,gasLimit:i,storageLimit:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REGISTER_GLOBAL_CONSTANT,value:e,fee:r,gas_limit:i,storage_limit:s,source:t}}));t.createTransferTicketOperation=({ticketContents:e,ticketTy:t,ticketTicketer:r,ticketAmount:i,destination:s,entrypoint:a,source:c,fee:u,gasLimit:l,storageLimit:f})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSFER_TICKET,fee:u,gas_limit:l,storage_limit:f,source:c,ticket_contents:e,ticket_ty:t,ticket_ticketer:r,ticket_amount:i,destination:s,entrypoint:a}}));t.createIncreasePaidStorageOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,amount:s,destination:a})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.INCREASE_PAID_STORAGE,source:e,fee:t,gas_limit:r,storage_limit:i,amount:s,destination:a}}));t.createDrainDelegateOperation=({consensus_key:e,delegate:t,destination:r})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DRAIN_DELEGATE,consensus_key:e,delegate:t,destination:r}}));t.createBallotOperation=({source:e,proposal:t,ballot:r})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.BALLOT,source:e,proposal:t,ballot:r}}));t.createProposalsOperation=({source:e,proposals:t})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.PROPOSALS,source:e,proposals:t}}));t.createUpdateConsensusKeyOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,pk:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.UPDATE_CONSENSUS_KEY,source:e,fee:t,gas_limit:r,storage_limit:i,pk:s}}));t.createSmartRollupAddMessagesOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,message:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.SMART_ROLLUP_ADD_MESSAGES,source:e,fee:t,gas_limit:r,storage_limit:i,message:s}}));t.createSmartRollupOriginateOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,pvmKind:s,kernel:a,parametersType:c})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.SMART_ROLLUP_ORIGINATE,source:e,fee:t,gas_limit:r,storage_limit:i,pvm_kind:s,kernel:a,parameters_ty:c}}))},1151:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcContractProvider=void 0;const i=r(5543),o=r(8899),s=r(6368),a=r(4632),c=r(227),u=r(150),l=r(9785),f=r(6646),d=r(5544),h=r(2342),p=r(1846),b=r(1863),m=r(6700),g=r(22),v=r(8983),y=r(106),_=r(3729),w=r(738),E=r(7279),O=r(4384),A=r(2864),S=r(5847),P=r(6003),T=r(3793);class I extends P.Provider{constructor(e,t){super(e),this.estimator=t,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new T.PrepareProvider(this.context)}getStorage(e,t){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=yield this.context.readProvider.getScript(e,"head");let i;return t||(t=n),i=o.Schema.isSchema(t)?t:o.Schema.fromRPCResponse({script:t}),i.Execute(n.storage,(0,g.smartContractAbstractionSemantic)(this))}))}getBigMapKey(e,t,r){return n(this,void 0,void 0,(function*(){const n=(0,a.validateContractAddress)(e);if(n!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(n));let i;r||(r=(yield this.rpc.getContract(e)).script),i=o.Schema.isSchema(r)?r:o.Schema.fromRPCResponse({script:r});const s=i.EncodeBigMapKey(t),u=yield this.rpc.getBigMapKey(e,s);return i.ExecuteOnBigMapValue(u)}))}getBigMapKeyByID(e,t,r,i){return n(this,void 0,void 0,(function*(){const{key:n,type:o}=r.EncodeBigMapKey(t),{packed:s}=yield this.context.packer.packData({data:n,type:o}),c=(0,a.encodeExpr)(s),u=i?yield this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},i):yield this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},"head");return r.ExecuteOnBigMapValue(u,(0,g.smartContractAbstractionSemantic)(this))}))}getBigMapKeysByID(e,t,r,i,s=5){return n(this,void 0,void 0,(function*(){const n=yield this.getBlockForRequest(t,i),a=new o.MichelsonMap;let c=0,u=[];for(;cthis.getBigMapValueOrUndefined(t,e,r,n)));u=[...u,...yield Promise.all(i)],c+=s}for(let e=0;ee.kind===s.OpKind.ORIGINATION)),i=yield this.forge(r),{hash:o,context:a,forgedBytes:c,opResponse:u}=yield this.signAndInject(i);return new f.OriginationOperation(o,n,c,u,a,this)}))}setDelegate(e){var t;return n(this,void 0,void 0,(function*(){const r=(0,a.validateAddress)(e.source);if(e.source&&r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.delegate,(0,a.invalidDetail)(n));if(/kt1/i.test(e.source))throw new m.InvalidDelegationSource(e.source);const i=yield this.signer.publicKeyHash(),o=e.source||i,u=yield this.estimate(e,this.estimator.setDelegate.bind(this.estimator)),f=yield this.prepare.delegation(Object.assign(Object.assign({},e),u)),d=f.opOb.contents.find((e=>e.kind===s.OpKind.DELEGATION)),h=yield this.forge(f),{hash:p,context:b,forgedBytes:g,opResponse:v}=yield this.signAndInject(h);return new l.DelegateOperation(p,d,o,g,v,b)}))}registerDelegate(e){return n(this,void 0,void 0,(function*(){const t=yield this.estimate(e,this.estimator.registerDelegate.bind(this.estimator)),r=yield this.signer.publicKeyHash(),n=yield this.prepare.registerDelegate(Object.assign(Object.assign({},e),t)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.DELEGATION)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:f}=yield this.signAndInject(o);return new l.DelegateOperation(a,i,r,u,f,c)}))}transfer(e){var t;return n(this,void 0,void 0,(function*(){const r=(0,a.validateAddress)(e.to);if(r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.to,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(n));if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());const i=yield this.signer.publicKeyHash(),o=yield this.estimate(e,this.estimator.transfer.bind(this.estimator)),u=e.source||i,l=yield this.prepare.transaction(Object.assign(Object.assign({},e),o)),f=l.opOb.contents.find((e=>e.kind===s.OpKind.TRANSACTION)),d=yield this.forge(l),{hash:h,context:b,forgedBytes:m,opResponse:g}=yield this.signAndInject(d);return new p.TransactionOperation(h,f,u,m,g,b)}))}transferTicket(e){var t,r;return n(this,void 0,void 0,(function*(){const n=(0,a.validateAddress)(e.destination);if(n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.destination,(0,a.invalidDetail)(n));const i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=yield this.signer.publicKeyHash(),u=null!==(r=e.source)&&void 0!==r?r:o,l=yield this.estimate(e,this.estimator.transferTicket.bind(this.estimator)),f=yield this.prepare.transferTicket(Object.assign(Object.assign({},e),l)),d=f.opOb.contents.find((e=>e.kind===s.OpKind.TRANSFER_TICKET)),h=yield this.forge(f),{hash:p,context:b,forgedBytes:m,opResponse:g}=yield this.signAndInject(h);return new v.TransferTicketOperation(p,d,u,m,g,b)}))}reveal(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimator.reveal(e);if(r){const i=yield this.estimate(e,(()=>n(this,void 0,void 0,(function*(){return r})))),o=yield this.prepare.reveal(Object.assign(Object.assign({},e),i)),a=o.opOb.contents.find((e=>e.kind===s.OpKind.REVEAL)),c=yield this.forge(o),{hash:u,context:l,forgedBytes:f,opResponse:d}=yield this.signAndInject(c);return new h.RevealOperation(u,a,t,f,d,l)}throw new m.RevealOperationError(`The publicKeyHash '${t}' has already been revealed.`)}))}registerGlobalConstant(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.registerGlobalConstant.bind(this.estimator)),n=yield this.prepare.registerGlobalConstant(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.REGISTER_GLOBAL_CONSTANT)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new d.RegisterGlobalConstantOperation(a,i,t,u,l,c)}))}increasePaidStorage(e){return n(this,void 0,void 0,(function*(){if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.increasePaidStorage.bind(this.estimator)),n=yield this.prepare.increasePaidStorage(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.INCREASE_PAID_STORAGE)),o=yield this.forge(n),{hash:a,context:u,forgedBytes:l,opResponse:f}=yield this.signAndInject(o);return new y.IncreasePaidStorageOperation(a,i,t,l,f,u)}))}drainDelegate(e){return n(this,void 0,void 0,(function*(){const t=yield this.prepare.drainDelegate(e),r=t.opOb.contents.find((e=>e.kind===s.OpKind.DRAIN_DELEGATE)),n=yield this.forge(t),{hash:i,context:o,forgedBytes:a,opResponse:c}=yield this.signAndInject(n);return new w.DrainDelegateOperation(i,r,a,c,o)}))}ballot(e){var t,r;return n(this,void 0,void 0,(function*(){const n=yield this.signer.publicKeyHash(),i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=null!==(r=e.source)&&void 0!==r?r:n,u=yield this.prepare.ballot(Object.assign(Object.assign({},e),{source:o})),l=u.opOb.contents.find((e=>e.kind===s.OpKind.BALLOT)),f=yield this.forge(u),{hash:d,context:h,forgedBytes:p,opResponse:b}=yield this.signAndInject(f);return new _.BallotOperation(d,l,n,p,b,h)}))}proposals(e){var t,r;return n(this,void 0,void 0,(function*(){const n=yield this.signer.publicKeyHash(),i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=null!==(r=e.source)&&void 0!==r?r:n,u=yield this.prepare.proposals(Object.assign(Object.assign({},e),{source:o})),l=u.opOb.contents.find((e=>e.kind===s.OpKind.PROPOSALS)),f=yield this.forge(u),{hash:d,context:h,forgedBytes:p,opResponse:b}=yield this.signAndInject(f);return new E.ProposalsOperation(d,l,n,p,b,h)}))}updateConsensusKey(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.updateConsensusKey.bind(this.estimator)),n=yield this.prepare.updateConsensusKey(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.UPDATE_CONSENSUS_KEY)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new O.UpdateConsensusKeyOperation(a,i,t,u,l,c)}))}smartRollupAddMessages(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.smartRollupAddMessages.bind(this.estimator)),n=yield this.prepare.smartRollupAddMessages(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.SMART_ROLLUP_ADD_MESSAGES)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new A.SmartRollupAddMessagesOperation(a,i,t,u,l,c)}))}smartRollupOriginate(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.smartRollupOriginate.bind(this.estimator)),n=yield this.prepare.smartRollupOriginate(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.SMART_ROLLUP_ORIGINATE)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new S.SmartRollupOriginateOperation(a,i,t,u,l,c)}))}failingNoop(e){return n(this,void 0,void 0,(function*(){const t={kind:s.OpKind.FAILING_NOOP,arbitrary:e.arbitrary},r=yield this.context.readProvider.getBlockHash(e.basedOnBlock),n=yield this.context.forger.forge({branch:r,contents:[t]}),{prefixSig:i}=yield this.signer.sign(n,new Uint8Array([3]));return{signature:i,bytes:n,signedContent:{branch:r,contents:[{kind:s.OpKind.FAILING_NOOP,arbitrary:e.arbitrary}]}}}))}at(e,t=(e=>e)){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=this.context.withExtensions().rpc,i=this.context.withExtensions().readProvider,o=yield i.getScript(e,"head"),s=yield i.getEntrypoints(e),u=new b.ContractAbstraction(e,o,this,this,s,n,i);return t(u,this.context)}))}batch(e){const t=new u.OperationBatch(this.context,this.estimator);return Array.isArray(e)&&t.with(e),t}}t.RpcContractProvider=I},5491:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SaplingStateAbstraction=void 0;t.SaplingStateAbstraction=class{constructor(e,t){this.id=e,this.provider=t}getSaplingDiff(e){return r(this,void 0,void 0,(function*(){return this.provider.getSaplingDiffByID(this.id.toString(),e)}))}getId(){return this.id.toString()}}},22:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.smartContractAbstractionSemantic=void 0;const n=r(8899),i=r(5225),o=r(6391),s=r(5491);t.smartContractAbstractionSemantic=e=>({big_map:(t,r)=>{if(t&&"int"in t&&void 0!==t.int){const s=new n.Schema(r);return new i.BigMapAbstraction(new o.default(t.int),s,e)}return{}},sapling_state:t=>t&&"int"in t&&void 0!==t.int?new s.SaplingStateAbstraction(new o.default(t.int),e):{}})},120:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VIEW_LAMBDA=void 0;t.VIEW_LAMBDA={code:[{prim:"parameter",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},{prim:"unit"}]}]}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"UNIT"},{prim:"EXEC"}]]}],storage:"Unit"}},7642:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RPCResponseError=t.ConfirmationTimeoutError=t.InvalidConfirmationCountError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e){super(),this.invalidConfirmations=e,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${e} expecting at least 1`}}t.InvalidConfirmationCountError=i;class o extends n.NetworkError{constructor(e){super(),this.message=e,this.name="ConfirmationTimeoutError"}}t.ConfirmationTimeoutError=o;class s extends n.RpcError{constructor(e,t){super(),this.message=e,this.cause=t,this.name="RPCResponseError"}}t.RPCResponseError=s},1826:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevealEstimateError=void 0;const n=r(227);class i extends n.TaquitoError{constructor(){super(),this.name="RevealEstimateError",this.message="Public key is unknown, unable to estimate the reveal operation in Wallet API."}}t.RevealEstimateError=i},1243:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4705:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Estimate=void 0;const r=100;class n{constructor(e,t,r,n,i=100){this._milligasLimit=e,this._storageLimit=t,this.opSize=r,this.minimalFeePerStorageByteMutez=n,this.baseFeeMutez=i}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){const e=Math.max(Number(this._storageLimit),0);return e>0?e:0}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3+100)}get operationFeeMutez(){return.1*(Number(this._milligasLimit)/1e3+100)+1*Number(this.opSize)}roundUp(e){return Math.ceil(Number(e))}get minimalFeeMutez(){return this.roundUp(r+this.operationFeeMutez)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+200)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),r)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(e){let t,r=0,i=0,o=0,s=0;return e.forEach((e=>{r+=e.milligasLimit,i+=e.storageLimit,o+=e.opSize,s=Math.max(e.minimalFeePerStorageByteMutez,s),e.baseFeeMutez&&(t=t?t+e.baseFeeMutez:e.baseFeeMutez)})),new n(r,i,o,s,t)}static createArrayEstimateInstancesFromProperties(e){return e.map((e=>new n(e.milligasLimit,e.storageLimit,e.opSize,e.minimalFeePerStorageByteMutez,e.baseFeeMutez)))}}t.Estimate=n},8794:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4705),t),i(r(1243),t),i(r(4782),t),i(r(1826),t)},4782:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{a+="originated_contracts"in e&&void 0!==e.originated_contracts?e.originated_contracts.length*this.ORIGINATION_STORAGE:0,a+="allocated_destination_contract"in e?this.ALLOCATION_STORAGE:0,i+=Number(e.consumed_milligas)||0,a+="paid_storage_size_diff"in e&&Number(e.paid_storage_size_diff)||0,a+="storage_size"in e&&"global_address"in e&&Number(e.storage_size)||0,a+="genesis_commitment_hash"in e?Number(e.size):0})),(0,s.isOpWithFee)(e)?{milligasLimit:i||0,storageLimit:Number(a||0),opSize:t,minimalFeePerStorageByteMutez:r.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:t,minimalFeePerStorageByteMutez:r.toNumber(),baseFeeMutez:0}}calculateEstimates(e,t){return n(this,void 0,void 0,(function*(){const{opbytes:r,opOb:{branch:n,contents:i}}=yield this.forge(e),s={operation:{branch:n,contents:i},chain_id:yield this.context.readProvider.getChainId()},{opResponse:a}=yield this.simulate(s),{cost_per_byte:c}=t,u=[...(0,o.flattenErrors)(a,"backtracked"),...(0,o.flattenErrors)(a)];if(u.length)throw new o.TezosOperationError(u,"Error occurred during estimation",a.contents);let l=1;return Array.isArray(e.opOb.contents)&&e.opOb.contents.length>1&&(l="reveal"===a.contents[0].kind?e.opOb.contents.length-1:e.opOb.contents.length),a.contents.map((e=>this.getEstimationPropertiesFromOperationContent(e,"reveal"===e.kind?this.OP_SIZE_REVEAL/2:r.length/2/l,c)))}))}originate(e){return n(this,void 0,void 0,(function*(){const t=yield this.prepare.originate(e),r=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.calculateEstimates(t,r);return"reveal"===t.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}transfer(e){var t,{fee:r,storageLimit:o,gasLimit:s}=e,u=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.to);if(e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.to,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.source)&&void 0!==t?t:"");if(u.source&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(n));if(u.amount<0)throw new d.InvalidAmountError(u.amount.toString());const i=yield this.prepare.transaction(Object.assign({fee:r,storageLimit:o,gasLimit:s},u)),l=yield this.context.readProvider.getProtocolConstants("head"),f=yield this.calculateEstimates(i,l);return"reveal"===i.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}transferTicket(e){var t,{fee:r,storageLimit:o,gasLimit:s}=e,u=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.destination);if(e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.destination,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.source)&&void 0!==t?t:"");if(u.source&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(n));const i=yield this.context.readProvider.getProtocolConstants("head"),l=yield this.prepare.transferTicket(Object.assign({fee:r,storageLimit:o,gasLimit:s},u)),f=yield this.calculateEstimates(l,i);return"reveal"===l.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}setDelegate(e){var t,{fee:r,gasLimit:o,storageLimit:s}=e,u=i(e,["fee","gasLimit","storageLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.source);if(u.source&&e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.delegate)&&void 0!==t?t:"");if(u.delegate&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.delegate,(0,c.invalidDetail)(n));const i=yield this.prepare.delegation(Object.assign({fee:r,storageLimit:s,gasLimit:o},u)),l=yield this.context.readProvider.getProtocolConstants("head"),f=yield this.calculateEstimates(i,l);return"reveal"===i.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}batch(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.batch(e),n=yield this.calculateEstimates(r,t);return a.Estimate.createArrayEstimateInstancesFromProperties(n)}))}registerDelegate(e,t){var{fee:r,storageLimit:o,gasLimit:s}=e,c=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(yield this.getKeys()).publicKeyHash,n=yield this.context.readProvider.getProtocolConstants("head"),i=t||e,u=yield this.prepare.registerDelegate(Object.assign({fee:r,storageLimit:o,gasLimit:s},c),i),l=yield this.calculateEstimates(u,n);return"reveal"===u.opOb.contents[0].kind&&l.shift(),a.Estimate.createEstimateInstanceFromProperties(l)}))}reveal(e){return n(this,void 0,void 0,(function*(){const{publicKeyHash:t,publicKey:r}=yield this.getKeys();if(!r)throw new u.RevealEstimateError;if(yield this.isAccountRevealRequired(t)){const t=yield this.context.readProvider.getProtocolConstants("head"),r=e?yield this.prepare.reveal(e):yield this.prepare.reveal({}),n=yield this.calculateEstimates(r,t);return a.Estimate.createEstimateInstanceFromProperties(n)}}))}registerGlobalConstant(e){var{fee:t,storageLimit:r,gasLimit:o}=e,s=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=yield this.prepare.registerGlobalConstant(Object.assign({fee:t,storageLimit:r,gasLimit:o},s)),n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.calculateEstimates(e,n);return"reveal"===e.opOb.contents[0].kind&&i.shift(),a.Estimate.createEstimateInstanceFromProperties(i)}))}increasePaidStorage(e){var{fee:t,storageLimit:r,gasLimit:o}=e,s=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){if(s.amount<0)throw new d.InvalidAmountError(s.amount.toString());const e=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.prepare.increasePaidStorage(Object.assign({fee:t,storageLimit:r,gasLimit:o},s)),i=yield this.calculateEstimates(n,e);return"reveal"===n.opOb.contents[0].kind&&i.shift(),a.Estimate.createEstimateInstanceFromProperties(i)}))}updateConsensusKey(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.updateConsensusKey(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}smartRollupAddMessages(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.smartRollupAddMessages(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}smartRollupOriginate(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.smartRollupOriginate(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}contractCall(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.contractCall(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}}t.RPCEstimateProvider=h},7336:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositeForger=void 0;const i=r(3557);t.CompositeForger=class{constructor(e){if(this.forgers=e,0===e.length)throw new i.UnspecifiedForgerError}forge({branch:e,contents:t}){return n(this,void 0,void 0,(function*(){const r=yield Promise.all(this.forgers.map((r=>r.forge({branch:e,contents:t}))));if(0===r.length)throw new i.UnspecifiedForgerError;let n=r.pop();for(;r.length;){const e=r.pop();if(e!==n)throw new i.ForgingMismatchError([n,e]);n=e}return n}))}}},3557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnspecifiedForgerError=t.ForgingMismatchError=void 0;const n=r(227);class i extends n.TaquitoError{constructor(e){super(),this.results=e,this.name="ForgingMismatchError",this.message="Forging mismatch error"}}t.ForgingMismatchError=i;class o extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnspecifiedForgerError",this.message="No forger has been configured. Please configure new CompositeForger([rpcForger, localForger]) with your TezosToolkit instance."}}t.UnspecifiedForgerError=o},794:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RpcForger=void 0;t.RpcForger=class{constructor(e){this.context=e}forge({branch:e,contents:t}){return this.context.rpc.forgeOperations({branch:e,contents:t})}}},6713:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TaquitoLocalForger=void 0;const i=r(5078);t.TaquitoLocalForger=class{constructor(e){this.context=e}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const e=yield this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}))}forge({branch:e,contents:t}){return n(this,void 0,void 0,(function*(){return new i.LocalForger(yield this.getNextProto()).forge({branch:e,contents:t})}))}}},5505:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGlobalConstantsProvider=void 0;const i=r(3739);t.DefaultGlobalConstantsProvider=class{constructor(){this._globalConstantsLibrary={}}loadGlobalConstant(e){for(const t in e)Object.assign(this._globalConstantsLibrary,{[t]:e[t]})}getGlobalConstantByHash(e){return n(this,void 0,void 0,(function*(){const t=this._globalConstantsLibrary[e];if(!t)throw new i.GlobalConstantNotFound(e);return t}))}}},3739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnconfiguredGlobalConstantsProviderError=t.GlobalConstantNotFound=void 0;const n=r(227);class i extends n.TaquitoError{constructor(e){super(),this.hash=e,this.name="GlobalConstantNotFound",this.message=`Please load the value associated with the constant ${e} using the loadGlobalConstant method of the DefaultGlobalConstantsProvider.`}}t.GlobalConstantNotFound=i;class o extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredGlobalConstantsProviderError",this.message="No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."}}t.UnconfiguredGlobalConstantsProviderError=o},3171:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9494:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopGlobalConstantsProvider=void 0;const i=r(3739);t.NoopGlobalConstantsProvider=class{getGlobalConstantByHash(e){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredGlobalConstantsProviderError}))}}},5180:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatErrorMessage=void 0;const n=r(5543);t.formatErrorMessage=function(e,t){const r=JSON.parse(e.body);if(r[0]&&r[0].kind&&r[0].msg){const i=JSON.stringify({kind:r[0].kind,id:r[0].id,msg:r[0].msg.replace(t,"")});return new n.HttpResponseError(`Http error response: (${e.status}) ${i}`,e.status,e.statusText,i,e.url)}return e}},134:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5744:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcInjector=void 0;const i=r(5180),o=r(5543);t.RpcInjector=class{constructor(e){this.context=e}inject(e){return n(this,void 0,void 0,(function*(){let t;try{t=yield this.context.rpc.injectOperation(e)}catch(e){const t=". You may want to use --replace to provide adequate fee and replace it";throw e instanceof o.HttpResponseError&&e.message.includes(t)?(0,i.formatErrorMessage)(e,t):e}return t}))}}},3729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BallotOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"ballot"===e.kind));return e||void 0}get period(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}t.BallotOperation=i},3650:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchOperation=void 0;const n=r(6391),i=r(150),o=r(835),s=r(7525),a=r(807);class c extends s.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}getOriginatedContractAddresses(){const e=this.results.filter((e=>"origination"===e.kind));let t=[];for(const r of e)r.metadata.operation_result.originated_contracts&&(t=[...t,...r.metadata.operation_result.originated_contracts]);return t}get status(){return this.results.filter((e=>-1!==i.BATCH_KINDS.indexOf(e.kind))).map((e=>{if((0,a.hasMetadataWithResult)(e)){return e.metadata.operation_result.status}return"unknown"}))[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP}),new n.default(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,o.flattenOperationResult)({contents:this.results}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,o.flattenOperationResult)({contents:this.results}),"paid_storage_size_diff"))}get errors(){return(0,o.flattenErrors)({contents:this.results})}}t.BatchOperation=c},9785:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegateOperation=void 0;const n=r(6391),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"delegation"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get delegate(){return this.params.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),this.consumedMilliGas?new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.DelegateOperation=o},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DrainDelegateOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i){super(e,r,n,i),this.params=t}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"drain_delegate"===e.kind)),t=e&&e.metadata&&e.metadata.balance_updates;return t||void 0}get consensusKey(){return this.params.consensus_key}get delegate(){return this.params.delegate}get destination(){return this.params.destination}}t.DrainDelegateOperation=i},835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidEstimateValueError=t.OriginationOperationError=t.flattenErrors=t.flattenOperationResult=t.TezosPreapplyFailureError=t.TezosOperationError=void 0;const n=r(227),i=r(807);class o extends n.RpcError{constructor(e,t,r){super(),this.errors=e,this.errorDetails=t,this.operationsWithResults=r,this.name="TezosOperationError",this.lastError=e[e.length-1],this.message=`(${this.kind}) ${this.id}`,"with"in this.lastError&&(this.lastError.with.string?this.message=this.lastError.with.string:this.lastError.with.int?this.message=this.lastError.with.int:this.message=JSON.stringify(this.lastError.with))}get id(){return this.lastError.id}get kind(){return this.lastError.kind}}t.TezosOperationError=o;class s extends Error{constructor(e){super(),this.result=e,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}t.TezosPreapplyFailureError=s;t.flattenOperationResult=e=>{const t=Array.isArray(e)?e:[e],r=[];for(let e=0;er.push(e.result))))}return r};t.flattenErrors=(e,t="failed")=>{const r=Array.isArray(e)?e:[e];let n=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IncreasePaidStorageOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"increase_paid_storage"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}t.IncreasePaidStorageOperation=i},3323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=t.DrainDelegateOperation=t.BallotOperation=t.TransactionOperation=t.OriginationOperation=t.DelegateOperation=t.BatchOperation=t.InvalidEstimateValueError=t.TezosPreapplyFailureError=t.TezosOperationError=t.OpKind=void 0;var n=r(807);Object.defineProperty(t,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});var i=r(835);Object.defineProperty(t,"TezosOperationError",{enumerable:!0,get:function(){return i.TezosOperationError}}),Object.defineProperty(t,"TezosPreapplyFailureError",{enumerable:!0,get:function(){return i.TezosPreapplyFailureError}}),Object.defineProperty(t,"InvalidEstimateValueError",{enumerable:!0,get:function(){return i.InvalidEstimateValueError}});var o=r(3650);Object.defineProperty(t,"BatchOperation",{enumerable:!0,get:function(){return o.BatchOperation}});var s=r(9785);Object.defineProperty(t,"DelegateOperation",{enumerable:!0,get:function(){return s.DelegateOperation}});var a=r(6646);Object.defineProperty(t,"OriginationOperation",{enumerable:!0,get:function(){return a.OriginationOperation}});var c=r(1846);Object.defineProperty(t,"TransactionOperation",{enumerable:!0,get:function(){return c.TransactionOperation}});var u=r(3729);Object.defineProperty(t,"BallotOperation",{enumerable:!0,get:function(){return u.BallotOperation}});var l=r(738);Object.defineProperty(t,"DrainDelegateOperation",{enumerable:!0,get:function(){return l.DrainDelegateOperation}});var f=r(7525);Object.defineProperty(t,"Operation",{enumerable:!0,get:function(){return f.Operation}})},7525:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=void 0;const i=r(977),o=r(9002),s=r(807),a=r(4632),c=r(552),u=r(7642),l=r(227);t.Operation=class{get includedInBlock(){return this._foundAt}constructor(e,t,r,n){if(this.hash=e,this.raw=t,this.results=r,this.context=n,this._pollingConfig$=new i.ReplaySubject(1),this.currentHead$=this._pollingConfig$.pipe((0,o.switchMap)((e=>new i.BehaviorSubject(e).pipe((0,o.timeout)({each:1e3*e.timeout,with:()=>(0,i.throwError)((()=>new u.ConfirmationTimeoutError("Confirmation polling timed out")))})))),(0,o.switchMap)((()=>(0,i.defer)((()=>(0,c.createObservableFromSubscription)(this.context.stream.subscribeBlock("head")))).pipe((0,o.switchMap)((e=>{var t,r;const n=null!==(r=null===(t=this.lastHead)||void 0===t?void 0:t.header.level)&&void 0!==r?r:e.header.level-1;return(0,i.range)(n+1,e.header.level-n-1).pipe((0,o.concatMap)((e=>this.context.readProvider.getBlock(e))),(0,o.endWith)(e))})),(0,o.tap)((e=>this.lastHead=e))))),(0,o.shareReplay)({refCount:!0})),this.confirmed$=this.currentHead$.pipe((0,o.map)((e=>{for(let t=3;t>=0;t--)e.operations[t].forEach((t=>{t.hash===this.hash&&(this._foundAt=e.header.level)}));if(e.header.level-this._foundAt>=0)return this._foundAt})),(0,o.filter)((e=>void 0!==e)),(0,o.first)(),(0,o.shareReplay)()),this._foundAt=Number.POSITIVE_INFINITY,(0,a.validateOperation)(this.hash)!==a.ValidationResult.VALID)throw new l.InvalidOperationHashError(this.hash);this.confirmed$.pipe((0,o.first)(),(0,o.catchError)((()=>(0,i.of)(i.EMPTY)))).subscribe()}get revealOperation(){return Array.isArray(this.results)&&this.results.find((e=>"reveal"===e.kind))}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map((e=>(0,s.hasMetadataWithResult)(e)?e.metadata.operation_result.status:"unknown"))[0]||"unknown"}confirmation(e,t){return n(this,void 0,void 0,(function*(){if(void 0!==e&&e<1)throw new u.InvalidConfirmationCountError(e);const{defaultConfirmationCount:r,confirmationPollingTimeoutSecond:n}=this.context.config;this._pollingConfig$.next({timeout:t||n});const i=void 0!==e?e:r;return new Promise(((e,t)=>{this.confirmed$.pipe((0,o.switchMap)((()=>this.currentHead$)),(0,o.filter)((e=>e.header.level-this._foundAt>=i-1)),(0,o.first)()).subscribe((t=>{e(this._foundAt+(i-1))}),t)}))}))}}},6646:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OriginationOperation=void 0;const i=r(6391),o=r(835),s=r(7525),a=r(807);class c extends s.Operation{constructor(e,t,r,n,i,o){super(e,r,n,i),this.params=t,this.contractProvider=o;const s=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(s)&&(this.contractAddress=s[0])}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"origination"===e.kind)),t=e&&(0,a.hasMetadataWithResult)(e)&&e.metadata.operation_result;return t||void 0}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return i.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:i.BigNumber.ROUND_UP}),this.consumedMilliGas?new i.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get storageDiff(){const e=this.operationResults&&this.operationResults.paid_storage_size_diff;return e||void 0}get storageSize(){const e=this.operationResults&&this.operationResults.storage_size;return e||void 0}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}contract(e,t){return n(this,void 0,void 0,(function*(){if(!this.contractAddress)throw new o.OriginationOperationError("No contract was originated in this operation");return yield this.confirmation(e,t),this.contractProvider.at(this.contractAddress)}))}}t.OriginationOperation=c},7279:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProposalsOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"proposals"===e.kind));return e||void 0}get proposals(){return this.params.proposals}get period(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.period}}t.ProposalsOperation=i},5544:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegisterGlobalConstantOperation=void 0;const n=r(6391),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"register_global_constant"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get registeredExpression(){return this.params.value}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),this.consumedMilliGas?new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}}t.RegisterGlobalConstantOperation=o},2342:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevealOperation=void 0;const n=r(6391),i=r(835),o=r(7525);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"reveal"===e.kind));return e?[e]:[]}get status(){const e=this.operationResults[0];return e?e.metadata.operation_result.status:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get publicKey(){return this.params.public_key}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"storage_size"))}get errors(){return(0,i.flattenErrors)({contents:this.operationResults})}}t.RevealOperation=s},2864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartRollupAddMessagesOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"smart_rollup_add_messages"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get message(){return this.params.message}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.SmartRollupAddMessagesOperation=i},5847:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartRollupOriginateOperation=void 0;const n=r(6368),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>e.kind===n.OpKind.SMART_ROLLUP_ORIGINATE)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.SmartRollupOriginateOperation=o},1846:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOperation=void 0;const n=r(6391),i=r(835),o=r(7525);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"transaction"===e.kind));return e?[e]:[]}get status(){const e=this.operationResults[0];return e?e.metadata.operation_result.status:"unknown"}get amount(){return new n.default(this.params.amount)}get destination(){return this.params.destination}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}get consumedGas(){return n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP}),new n.default(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"storage_size"))}get errors(){return(0,i.flattenErrors)({contents:this.operationResults})}}t.TransactionOperation=s},8983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransferTicketOperation=void 0;const n=r(6368),i=r(6391),o=r(3323);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>e.kind===n.OpKind.TRANSFER_TICKET)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return i.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:i.BigNumber.ROUND_UP}),this.consumedMilliGas?new i.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}}t.TransferTicketOperation=s},807:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasMetadataWithInternalOperationResult=t.hasMetadataWithResult=t.hasMetadata=t.isSourceOp=t.isOpRequireReveal=t.isOpWithFee=t.isKind=t.findWithKind=t.attachKind=t.OpKind=void 0;var n=r(6368);Object.defineProperty(t,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});t.attachKind=(e,t)=>Object.assign(Object.assign({},e),{kind:t});t.findWithKind=(e,r)=>{if(Array.isArray(e)){const n=e.find((e=>e.kind===r));if(n&&(0,t.isKind)(n,r))return n}};t.isKind=(e,t)=>e.kind===t;t.isOpWithFee=e=>-1!==["transaction","delegation","origination","reveal","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(e.kind);t.isOpRequireReveal=e=>-1!==["transaction","delegation","origination","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(e.kind);t.isSourceOp=e=>-1!==["transaction","delegation","origination","reveal","ballot"].indexOf(e.kind);t.hasMetadata=e=>"metadata"in e;t.hasMetadataWithResult=e=>(0,t.hasMetadata)(e)&&"operation_result"in e.metadata;t.hasMetadataWithInternalOperationResult=e=>(0,t.hasMetadata)(e)&&"internal_operation_results"in e.metadata},4384:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateConsensusKeyOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"update_consensus_key"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.UpdateConsensusKeyOperation=i},4762:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9406:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MichelCodecPacker=void 0;const i=r(9985);t.MichelCodecPacker=class{packData(e){return n(this,void 0,void 0,(function*(){const{bytes:t}=(0,i.packDataBytes)(e.data,e.type);return{packed:t}}))}}},6395:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcPacker=void 0;t.RpcPacker=class{constructor(e){this.context=e}packData(e){return r(this,void 0,void 0,(function*(){return this.context.rpc.packData(e)}))}}},9813:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5286:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MichelCodecParser=void 0;const i=r(9985),o=r(6700),s=r(8899);t.MichelCodecParser=class{constructor(e){this.context=e}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const e=yield this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}))}parseScript(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseScript(e)}))}parseMichelineExpression(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseMichelineExpression(e)}))}parseJSON(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseJSON(e)}))}prepareCodeOrigination(e){return n(this,void 0,void 0,(function*(){const t=e;if(t.code=yield this.formatCodeParam(e.code),e.init)t.init=yield this.formatInitParam(e.init);else if(e.storage){const r=t.code.find((e=>"prim"in e&&"storage"===e.prim));if(!(null==r?void 0:r.args))throw new o.InvalidCodeParameter("The storage section is missing from the script",e.code);const n=new s.Schema(r.args[0]),a=yield this.findGlobalConstantsHashAndValue(n);if(0!==Object.keys(a).length){const n=new i.Parser({expandGlobalConstant:a}).parseJSON(r.args[0]),o=new s.Schema(n);t.init=o.Encode(e.storage)}else t.init=n.Encode(e.storage);delete t.storage}return t}))}formatCodeParam(e){return n(this,void 0,void 0,(function*(){let t;if("string"==typeof e){const r=yield this.parseScript(e);if(null===r)throw new o.InvalidCodeParameter("Unable to parse",e);t=r}else{const r=yield this.parseJSON(e),n=["parameter","storage","code"];t=r.sort(((e,t)=>n.indexOf(e.prim)-n.indexOf(t.prim)))}return t}))}formatInitParam(e){return n(this,void 0,void 0,(function*(){let t;if("string"==typeof e){const r=yield this.parseMichelineExpression(e);if(null===r)throw new o.InvalidInitParameter("Invalid init parameter",e);t=r}else t=yield this.parseJSON(e);return t}))}findGlobalConstantsHashAndValue(e){return n(this,void 0,void 0,(function*(){const t=e.findToken("constant"),r={};if(0!==t.length)for(const e of t){const t=e.tokenVal.args;if(t){const e=t[0];if(e.string){const t=e.string,n=yield this.context.globalConstantsProvider.getGlobalConstantByHash(t);Object.assign(r,{[t]:n})}}}return r}))}}},3259:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopParser=void 0;t.NoopParser=class{prepareCodeOrigination(e){return r(this,void 0,void 0,(function*(){return e}))}}},3793:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(8078),t),i(r(2021),t)},8078:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2021:function(e,t,r){"use strict";var n,i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},s=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{var r,n,i;return{fee:null!==(r=e.fee)&&void 0!==r?r:t.fee,gasLimit:null!==(n=e.gasLimit)&&void 0!==n?n:t.gasLimit,storageLimit:null!==(i=e.storageLimit)&&void 0!==i?i:t.storageLimit}};class g extends p.Provider{constructor(e){super(e),this.context=e,n.set(this,void 0),o(this,n,{},"f")}getBlockHash(e){return i(this,void 0,void 0,(function*(){return this.context.readProvider.getBlockHash(null!=e?e:"head~2")}))}getProtocolHash(){return i(this,void 0,void 0,(function*(){return this.context.readProvider.getNextProtocol("head")}))}getHeadCounter(e){var t;return i(this,void 0,void 0,(function*(){return null!==(t=this.context.readProvider.getCounter(e,"head"))&&void 0!==t?t:"0"}))}adjustGasForBatchOperation(e,t,r){return b.default.min(t,e.div(r+1))}getAccountLimits(e,t,r){return i(this,void 0,void 0,(function*(){const n=yield this.context.readProvider.getBalance(e,"head"),{hard_gas_limit_per_operation:i,hard_gas_limit_per_block:o,hard_storage_limit_per_operation:s,cost_per_byte:a}=t;return{fee:0,gasLimit:r?Math.floor(this.adjustGasForBatchOperation(o,i,r).toNumber()):i.toNumber(),storageLimit:Math.floor(b.default.min(n.dividedBy(a),s).toNumber())}}))}getFee(e,t,r){(!s(this,n,"f")[t]||s(this,n,"f")[t]{switch(e.kind){case c.OpKind.ACTIVATION:case c.OpKind.DRAIN_DELEGATE:return Object.assign({},e);case c.OpKind.ORIGINATION:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{balance:void 0!==e.balance?`${e.balance}`:"0"}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.TRANSACTION:{const i=Object.assign(Object.assign(Object.assign(Object.assign({},e),{amount:void 0!==e.amount?`${e.amount}`:"0"}),this.getSource(e,r,n)),this.getFee(e,r,t));if(i.source.toLowerCase().startsWith("kt1"))throw new d.DeprecationError(`KT1 addresses are not supported as source since ${l.Protocols.PsBabyM1}`);return i}case c.OpKind.REVEAL:case c.OpKind.DELEGATION:case c.OpKind.REGISTER_GLOBAL_CONSTANT:case c.OpKind.UPDATE_CONSENSUS_KEY:case c.OpKind.SMART_ROLLUP_ADD_MESSAGES:case c.OpKind.SMART_ROLLUP_ORIGINATE:return Object.assign(Object.assign(Object.assign({},e),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.TRANSFER_TICKET:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ticket_amount:`${e.ticket_amount}`}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.INCREASE_PAID_STORAGE:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{amount:`${e.amount}`}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.BALLOT:case c.OpKind.PROPOSALS:if(void 0===i)throw new f.RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},e),{period:null==i?void 0:i.voting_period.index});default:throw new d.InvalidOperationKindError(e.kind)}}))}activate({pkh:e,secret:t}){return i(this,void 0,void 0,(function*(){const r=yield(0,h.createActivationOperation)({pkh:e,secret:t}),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:s,contents:this.constructOpContents(i,c,e),protocol:a},counter:c}}))}reveal({fee:e,gasLimit:t,storageLimit:r}){return i(this,void 0,void 0,(function*(){const{pkh:i,publicKey:s}=yield this.getKeys();if(!s)throw new d.PublicKeyNotFoundError(i);const a=yield this.context.readProvider.getProtocolConstants("head"),c=yield this.getAccountLimits(i,a),u=m({fee:e,storageLimit:r,gasLimit:t},c),l=yield(0,h.createRevealOperation)({fee:u.fee,gasLimit:u.gasLimit,storageLimit:u.storageLimit},i,s),f=this.convertIntoArray(l),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(i),10);return{opOb:{branch:p,contents:this.constructOpContents(f,g,i),protocol:b},counter:g}}))}originate(e,t){var{fee:r,storageLimit:s,gasLimit:c}=e,u=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),l=yield(0,h.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},u),m({fee:r,storageLimit:s,gasLimit:c},a)))),f=yield this.addRevealOperationIfNeeded(l,e),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,e,t),protocol:b},counter:g}}))}transaction(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createTransferOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}delegation(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSetDelegateOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}registerDelegate({fee:e,storageLimit:t,gasLimit:r},s){return i(this,void 0,void 0,(function*(){const{pkh:i}=yield this.getKeys(),a=yield this.context.readProvider.getProtocolConstants("head"),c=yield this.getAccountLimits(i,a),u=m({fee:e,storageLimit:t,gasLimit:r},c),l=yield(0,h.createRegisterDelegateOperation)({fee:u.fee,storageLimit:u.storageLimit,gasLimit:u.gasLimit},i),f=yield this.addRevealOperationIfNeeded(l,i),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(i),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,i,s),protocol:b},counter:g}}))}registerGlobalConstant(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createRegisterGlobalConstantOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}updateConsensusKey(e,t){var{fee:r,storageLimit:s,gasLimit:c}=e,u=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),l=yield(0,h.createUpdateConsensusKeyOperation)(Object.assign(Object.assign({},u),m({fee:r,storageLimit:s,gasLimit:c},a))),f=yield this.addRevealOperationIfNeeded(l,e),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,e,t),protocol:b},counter:g}}))}increasePaidStorage(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createIncreasePaidStorageOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}ballot(e){return i(this,void 0,void 0,(function*(){const{pkh:t}=yield this.getKeys(),r=yield(0,h.createBallotOperation)(Object.assign({},e)),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(t),10);let u;try{u=yield this.rpc.getCurrentPeriod()}catch(e){throw new f.RPCResponseError("Failed to get the current voting period index")}return{opOb:{branch:s,contents:this.constructOpContents(i,c,t,void 0,u),protocol:a},counter:c}}))}proposals(e){return i(this,void 0,void 0,(function*(){const{pkh:t}=yield this.getKeys(),r=yield(0,h.createProposalsOperation)(Object.assign({},e)),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(t),10);let u;try{u=yield this.rpc.getCurrentPeriod()}catch(e){throw new f.RPCResponseError("Failed to get the current voting period index")}return{opOb:{branch:s,contents:this.constructOpContents(i,c,t,void 0,u),protocol:a},counter:c}}))}drainDelegate(e,t){return i(this,void 0,void 0,(function*(){const{pkh:r}=yield this.getKeys(),i=yield(0,h.createDrainDelegateOperation)(Object.assign({},e)),s=this.convertIntoArray(i),a=yield this.getBlockHash(),c=yield this.getProtocolHash();o(this,n,{},"f");const u=parseInt(yield this.getHeadCounter(r),10);return{opOb:{branch:a,contents:this.constructOpContents(s,u,r,t),protocol:c},counter:u}}))}transferTicket(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createTransferTicketOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}smartRollupAddMessages(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSmartRollupAddMessagesOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}smartRollupOriginate(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSmartRollupOriginateOperation)(Object.assign(Object.assign({},m({fee:t,storageLimit:r,gasLimit:s},a)),c)),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}batch(e,t){return i(this,void 0,void 0,(function*(){const{pkh:r,publicKey:i}=yield this.getKeys(),s=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(r,s,e.length),c=yield this.isRevealOpNeeded(e,r),f=[];if(t)for(const r of e)if((0,u.isOpWithFee)(r)){const e=t.shift(),n=m(r,{fee:e.suggestedFeeMutez,storageLimit:e.storageLimit,gasLimit:e.gasLimit});f.push(yield this.getRPCOp(Object.assign(Object.assign({},r),n)))}else f.push(Object.assign({},r));else for(const t of e)if((0,u.isOpWithFee)(t)){const e=m(t,a);f.push(yield this.getRPCOp(Object.assign(Object.assign({},t),e)))}else f.push(Object.assign({},t));if(c){if(!i)throw new d.PublicKeyNotFoundError(r);f.unshift(yield(0,h.createRevealOperation)({fee:l.DEFAULT_FEE.REVEAL,storageLimit:l.DEFAULT_STORAGE_LIMIT.REVEAL,gasLimit:(0,l.getRevealGasLimit)(r)},r,i))}const p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(r),10);return{opOb:{branch:p,contents:this.constructOpContents(f,g,r),protocol:b},counter:g}}))}contractCall(e){var t,r,s;return i(this,void 0,void 0,(function*(){const i=yield this.getBlockHash(),a=yield this.getProtocolHash(),{pkh:u}=yield this.getKeys();o(this,n,{},"f");const l=parseInt(yield this.getHeadCounter(u),10),f=e.toTransferParams(),d=yield this.context.readProvider.getProtocolConstants("head"),h=yield this.getAccountLimits(u,d),p=m({fee:f.fee,storageLimit:f.storageLimit,gasLimit:f.gasLimit},h),b={kind:c.OpKind.TRANSACTION,fee:null!==(t=f.fee)&&void 0!==t?t:p.fee,gas_limit:null!==(r=f.gasLimit)&&void 0!==r?r:p.gasLimit,storage_limit:null!==(s=f.storageLimit)&&void 0!==s?s:p.storageLimit,amount:String(f.amount),destination:f.to,parameters:f.parameter},g=yield this.addRevealOperationIfNeeded(b,u),v=this.convertIntoArray(g);return{opOb:{branch:i,contents:this.constructOpContents(v,l,u),protocol:a},counter:l}}))}toPreapply(e){return i(this,void 0,void 0,(function*(){const{opOb:{contents:t,branch:r,protocol:n}}=e,i=this.toForge(e),o=yield this.context.forger.forge(i);return[{contents:t,branch:r,protocol:n,signature:(yield this.context.signer.sign(o,new Uint8Array([3]))).prefixSig}]}))}toForge({opOb:{contents:e,branch:t}}){return{branch:t,contents:e}}}t.PrepareProvider=g,n=new WeakMap},6003:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnconfiguredSignerError=void 0;const n=r(227);class i extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredSignerError",this.message="No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance."}}t.UnconfiguredSignerError=i},1527:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1067:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopSigner=void 0;const i=r(7591);t.NoopSigner=class{publicKey(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}publicKeyHash(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}secretKey(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}sign(e,t){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}}},552:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createObservableFromSubscription=void 0;const n=r(977);t.createObservableFromSubscription=function(e){return new n.Observable((t=>(e.on("data",(e=>{t.next(e)})),e.on("error",(e=>{t.error(e)})),e.on("close",(()=>{t.complete()})),()=>{e.close()})))}},3320:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidFilterExpressionError=t.UnsupportedEventError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e){super(),this.type=e,this.name="UnsupportedEventError",this.message=`Unsupported event type "${e}" expecting one of the "data", "error", or "close".`}}t.UnsupportedEventError=i;class o extends n.ParameterValidationError{constructor(e){super(),this.invalidExpression=e,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}t.InvalidFilterExpressionError=o},8176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFilter=t.evaluateExpression=t.evaluateOpFilter=t.eventFilter=void 0;const n=r(3320);t.eventFilter=(e,t,r,n)=>"event"===e.kind&&((!r||e.tag===r)&&((!t||e.source===t)&&(!n||"applied"===e.result.status)));t.evaluateOpFilter=(e,t)=>"opHash"in t?((e,t)=>e.hash===t.opHash)(e,t):"source"in t?((e,t)=>{switch(e.kind){case"attestation":case"endorsement":return"metadata"in e&&e.metadata.delegate===t.source;case"activate_account":return"metadata"in e&&e.pkh===t.source;default:return"source"in e&&e.source===t.source}})(e,t):"kind"in t?((e,t)=>"kind"in e&&e.kind===t.kind)(e,t):"destination"in t&&((e,t)=>{switch(e.kind){case"delegation":return e.delegate===t.destination;case"origination":if("metadata"in e&&"operation_result"in e.metadata&&"originated_contracts"in e.metadata.operation_result&&Array.isArray(e.metadata.operation_result.originated_contracts))return e.metadata.operation_result.originated_contracts.some((e=>e===t.destination));break;case"transaction":return e.destination===t.destination;default:return!1}})(e,t);t.evaluateExpression=(e,r)=>{if(Array.isArray(r.and))return r.and.every((r=>(0,t.evaluateFilter)(e,r)));if(Array.isArray(r.or))return r.or.some((r=>(0,t.evaluateFilter)(e,r)));throw new n.InvalidFilterExpressionError(r)};t.evaluateFilter=(e,r)=>{const n=[];return Array.isArray(r)?n.push(...r):n.push(r),n.every((r=>"and"in r||"or"in r?(0,t.evaluateExpression)(e,r):(0,t.evaluateOpFilter)(e,r)))}},440:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservableSubscription=t.UnsupportedEventError=void 0;const n=r(977),i=r(9002),o=r(3320);var s=r(3320);Object.defineProperty(t,"UnsupportedEventError",{enumerable:!0,get:function(){return s.UnsupportedEventError}});t.ObservableSubscription=class{constructor(e,t=!1,r=(0,i.retry)()){this.shouldRetry=t,this.operatorFunction=r,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new n.Subject,e.pipe((0,i.takeUntil)(this.completed$),(0,i.tap)((e=>{this.call(this.messageListeners,e)}),(e=>{this.call(this.errorListeners,e)}),(()=>{this.call(this.closeListeners)})),this.shouldRetry?r:(0,i.tap)(),(0,i.catchError)((()=>n.NEVER))).subscribe()}call(e,t){for(const r of e)try{r(t)}catch(e){console.error(e)}}remove(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}on(e,t){switch(e){case"data":this.messageListeners.push(t);break;case"error":this.errorListeners.push(t);break;case"close":this.closeListeners.push(t);break;default:throw new o.UnsupportedEventError(e)}}off(e,t){switch(e){case"data":this.remove(this.messageListeners,t);break;case"error":this.remove(this.errorListeners,t);break;case"close":this.remove(this.closeListeners,t);break;default:throw new o.UnsupportedEventError(e)}}close(){this.completed$.next()}}},5032:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PollingSubscribeProvider=t.defaultConfigStreamer=void 0;const i=r(977),o=r(9002),s=r(8176),a=r(4435),c=r(6391);t.defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:(0,o.retry)()};t.PollingSubscribeProvider=class{constructor(e,r={}){this.context=e,this._config$=new i.BehaviorSubject(Object.assign(Object.assign({},t.defaultConfigStreamer),r)),this.timer$=this._config$.pipe((0,o.pluck)("pollingIntervalMilliseconds"),(0,o.switchMap)((e=>e?(0,i.timer)(0,e):(0,i.from)(this.getConfirmationPollingInterval()).pipe((0,o.switchMap)((e=>(0,i.timer)(0,e))))))),this.newBlock$=this.timer$.pipe((0,o.switchMap)((()=>(e=>(0,i.from)(e.rpc.getBlock()).pipe((0,o.first)()))(this.context))),(0,o.distinctUntilKeyChanged)("hash"),(0,o.publish)(),(0,o.refCount)())}get config(){return this._config$.getValue()}getConfirmationPollingInterval(){return n(this,void 0,void 0,(function*(){if(!this.config.pollingIntervalMilliseconds){const e=5e3,t=1e3;try{const r=yield this.context.readProvider.getProtocolConstants("head"),n=(r.minimal_block_delay?r.minimal_block_delay.multipliedBy(1e3):r.time_between_blocks?r.time_between_blocks[0].multipliedBy(1e3):new c.default(e)).dividedBy(3);this.config.pollingIntervalMilliseconds=0===n.toNumber()?t:n.toNumber()}catch(t){return e}}return this.config.pollingIntervalMilliseconds}))}subscribeBlock(e){return new a.ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(e){return new a.ObservableSubscription(this.newBlock$.pipe((0,o.pluck)("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(e){return new a.ObservableSubscription(this.newBlock$.pipe((e=>(0,o.concatMap)((t=>new i.Observable((r=>{for(const n of t.operations)for(const t of n)for(const n of t.contents)(0,s.evaluateFilter)(Object.assign({hash:t.hash},n),e)&&r.next(Object.assign({hash:t.hash},n));r.complete()})))))(e)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(e){return new a.ObservableSubscription(this.newBlock$.pipe((t=e,(0,o.concatMap)((e=>new i.Observable((r=>{for(const n of e.operations)for(const i of n)for(const n of i.contents){const o=n.metadata.internal_operation_results;if(o)for(const n of o)(0,s.eventFilter)(n,null==t?void 0:t.address,null==t?void 0:t.tag,null==t?void 0:t.excludeFailedOperations)&&r.next(Object.assign({opHash:i.hash,blockHash:e.hash,level:e.header.level},n))}r.complete()})))))),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction);var t}}},2353:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.TezosToolkit=t.TaquitoLocalForger=t.RpcReadAdapter=t.ObservableSubscription=t.PollingSubscribeProvider=t.OperationBatch=t.RpcForger=t.CompositeForger=t.UnitValue=t.MichelsonMap=void 0;const o=r(6368),s=r(4984),a=r(4632),c=r(9494),u=r(6395),l=r(259),f=r(1067),d=r(5032),h=r(8023),p=r(635),b=r(6713),m=r(5286),g=r(5744);var v=r(8899);Object.defineProperty(t,"MichelsonMap",{enumerable:!0,get:function(){return v.MichelsonMap}}),Object.defineProperty(t,"UnitValue",{enumerable:!0,get:function(){return v.UnitValue}}),i(r(4593),t),i(r(4984),t),i(r(238),t),i(r(5225),t);var y=r(7336);Object.defineProperty(t,"CompositeForger",{enumerable:!0,get:function(){return y.CompositeForger}});var _=r(794);Object.defineProperty(t,"RpcForger",{enumerable:!0,get:function(){return _.RpcForger}}),i(r(3323),t);var w=r(150);Object.defineProperty(t,"OperationBatch",{enumerable:!0,get:function(){return w.OperationBatch}}),i(r(1527),t),i(r(440),t);var E=r(5032);Object.defineProperty(t,"PollingSubscribeProvider",{enumerable:!0,get:function(){return E.PollingSubscribeProvider}});var O=r(4435);Object.defineProperty(t,"ObservableSubscription",{enumerable:!0,get:function(){return O.ObservableSubscription}}),i(r(4946),t),i(r(635),t),i(r(134),t),i(r(5744),t),i(r(9813),t),i(r(5286),t),i(r(3259),t),i(r(4762),t),i(r(9406),t),i(r(6395),t),i(r(5505),t),i(r(3739),t),i(r(3171),t);var A=r(259);Object.defineProperty(t,"RpcReadAdapter",{enumerable:!0,get:function(){return A.RpcReadAdapter}}),i(r(8794),t);var S=r(6713);Object.defineProperty(t,"TaquitoLocalForger",{enumerable:!0,get:function(){return S.TaquitoLocalForger}}),i(r(3793),t);t.TezosToolkit=class{constructor(e){this._rpc=e,this._options={},this.format=a.format,"string"==typeof this._rpc?this._rpcClient=new o.RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new s.Context(e),this._wallet=new p.Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:e,stream:t,signer:r,protocol:n,config:i,forger:o,wallet:s,packer:a,globalConstantsProvider:c,readProvider:u,parserProvider:l,injectorProvider:f}){this.setRpcProvider(e),this.setStreamProvider(t),this.setSignerProvider(r),this.setForgerProvider(o),this.setWalletProvider(s),this.setPackerProvider(a),this.setGlobalConstantsProvider(c),this.setReadProvider(u),this.setParserProvider(l),this.setInjectorProvider(f),this._context.proto=n,i&&this._context.setPartialConfig(i)}setSignerProvider(e){this._options.signer||void 0!==e?void 0!==e&&(this._context.signer=e,this._options.signer=e):(this._context.signer=new f.NoopSigner,this._options.signer=e)}setRpcProvider(e){"string"==typeof e?this._rpcClient=new o.RpcClient(e):void 0===e||(this._rpcClient=e),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(e){if(void 0!==e)this._options.forger=e,this._context.forger=e;else if(void 0===this._options.forger){const e=this.getFactory(b.TaquitoLocalForger)();this._options.forger=e,this._context.forger=e}}setStreamProvider(e){if("string"==typeof e){const t=new d.PollingSubscribeProvider(new s.Context(new o.RpcClient(e)));this._options.stream=t,this._context.stream=t}else if(void 0!==e)this._options.stream=e,this._context.stream=e;else if(void 0===this._options.stream){const e=this.getFactory(d.PollingSubscribeProvider)();this._options.stream=e,this._context.stream=e}}setWalletProvider(e){if(this._options.wallet||void 0!==e)void 0!==e&&(this._options.wallet=e,this._context.walletProvider=e);else{const e=this.getFactory(p.LegacyWalletProvider)();this._options.wallet=e,this._context.walletProvider=e}}setPackerProvider(e){if(this._options.packer||void 0!==e)void 0!==e&&(this._context.packer=e,this._options.packer=e);else{const e=this.getFactory(u.RpcPacker)();this._context.packer=e,this._options.packer=e}}setGlobalConstantsProvider(e){if(this._options.globalConstantsProvider||void 0!==e)void 0!==e&&(this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e);else{const e=new c.NoopGlobalConstantsProvider;this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e}}setReadProvider(e){const t=e||new l.RpcReadAdapter(this._context.rpc);this._options.readProvider=t,this._context.readProvider=t}setParserProvider(e){if(this._options.parserProvider||void 0!==e)void 0!==e&&(this._context.parser=e,this._options.parserProvider=e);else{const e=new m.MichelCodecParser(this._context);this._context.parser=e,this._options.parserProvider=e}}setInjectorProvider(e){if(this._options.injectorProvider||void 0!==e)void 0!==e&&(this._context.injector=e,this._options.injectorProvider=e);else{const e=new g.RpcInjector(this._context);this._context.injector=e,this._options.injectorProvider=e}}get tz(){return this._context.tz}get contract(){return this._context.contract}get prepare(){return this._context.prepare}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}get globalConstants(){return this._context.globalConstantsProvider}addExtension(e){Array.isArray(e)?e.forEach((e=>e.configureContext(this._context))):e.configureContext(this._context)}getFactory(e){return(...t)=>new e(this._context,...t)}getVersionInfo(){return h.VERSION}}},4946:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},992:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcTzProvider=void 0;const i=r(7525),o=r(4632),s=r(227),a=r(6003),c=r(3793);class u extends a.Provider{constructor(e){super(e),this.prepare=new c.PrepareProvider(this.context)}getBalance(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t));return this.context.readProvider.getBalance(e,"head")}))}getDelegate(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t));return this.context.readProvider.getDelegate(e,"head")}))}activate(e,t){return n(this,void 0,void 0,(function*(){const r=(0,o.validateKeyHash)(e);if(r!==o.ValidationResult.VALID)throw new o.InvalidKeyHashError(e,(0,o.invalidDetail)(r));const n=yield this.prepare.activate({pkh:e,secret:t}),s=yield this.forge(n),a=`${s.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new i.Operation(yield this.rpc.injectOperation(a),Object.assign(Object.assign({},s),{opbytes:a}),[],this.context.clone())}))}}t.RpcTzProvider=u},8023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,t.VERSION={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"}},1626:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BatchWalletOperation=void 0;const i=r(6368),o=r(150),s=r(807),a=r(2809),c=r(2323);class u extends a.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t,this.getOriginatedContractAddresses=()=>n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e){const t=e.filter((e=>"origination"===e.kind));let r=[];for(const e of t)e.metadata.operation_result.originated_contracts&&(r=[...r,...e.metadata.operation_result.originated_contracts]);return r}throw new c.ObservableError("Unable to fetch operation results")}))}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.REVEAL));throw new c.ObservableError("Unable to fetch operation results")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.operationResults();if(e)return e.filter((e=>-1!==o.BATCH_KINDS.indexOf(e.kind))).map((e=>{if((0,s.hasMetadataWithResult)(e)){return e.metadata.operation_result.status}return"unknown"}))[0]||"unknown";throw new c.ObservableError("Unable to fetch operation results")}))}}t.BatchWalletOperation=u},4364:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationWalletOperation=void 0;const i=r(6368),o=r(2809),s=r(2323);class a extends o.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.REVEAL));throw new s.ObservableError("Unable to fetch operation result")}))}delegationOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.DELEGATION));throw new s.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.delegationOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.DelegationWalletOperation=a},2323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservableError=t.ConfirmationUndefinedError=void 0;const n=r(227);class i extends n.TezosToolkitConfigError{constructor(){super(),this.name="ConfirmationUndefinedError",this.message="Default confirmation count can not be undefined"}}t.ConfirmationUndefinedError=i;class o extends n.NetworkError{constructor(e){super(),this.message=e,this.name="ObservableError"}}t.ObservableError=o},7832:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.IncreasePaidStorageWalletOperation=void 0;const i=r(2809),o=r(6368),s=r(2323);class a extends i.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===o.OpKind.REVEAL));throw new s.ObservableError("Unable to fetch operation result")}))}increasePaidStorageOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===o.OpKind.INCREASE_PAID_STORAGE));throw new s.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.increasePaidStorageOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.IncreasePaidStorageWalletOperation=a},635:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5277),t),i(r(2809),t),i(r(4685),t),i(r(7654),t),i(r(4364),t),i(r(7432),t),i(r(8562),t)},7432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8562:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyWalletProvider=void 0;const i=r(807);t.LegacyWalletProvider=class{constructor(e){this.context=e}getPKH(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKeyHash()}))}getPK(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKey()}))}mapTransferParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.TRANSACTION)}))}mapOriginateParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.ORIGINATION)}))}mapDelegateParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.DELEGATION)}))}mapIncreasePaidStorageWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.INCREASE_PAID_STORAGE)}))}sendOperations(e){return n(this,void 0,void 0,(function*(){return(yield this.context.batch.batch(e).send()).hash}))}sign(e,t){return n(this,void 0,void 0,(function*(){const{prefixSig:r}=yield this.context.signer.sign(e,t);return r}))}}},8286:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OperationFactory=t.createNewPollingBasedHeadObservable=t.timeoutAfter=void 0;const i=r(977),o=r(9002),s=r(552),a=r(1626),c=r(4364),u=r(7832),l=r(2809),f=r(7654),d=r(4685),h=r(7642);function p(e){return function(t){return new i.BehaviorSubject(null).pipe((0,o.timeout)({each:e,with:()=>(0,i.throwError)((()=>new h.ConfirmationTimeoutError("Confirmation polling timed out")))}),(0,o.mergeMap)((()=>t)))}}t.timeoutAfter=p;t.createNewPollingBasedHeadObservable=(e,t,r)=>e.pipe(p(1e3*t.config.confirmationPollingTimeoutSecond),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1}));t.OperationFactory=class{constructor(e){this.context=e,this.sharedHeadObs=(0,i.defer)((()=>(0,s.createObservableFromSubscription)(this.context.stream.subscribeBlock("head"))))}createNewHeadObservable(){return n(this,void 0,void 0,(function*(){return(0,t.createNewPollingBasedHeadObservable)(this.sharedHeadObs,this.context)}))}createPastBlockWalker(e,t=1){return(0,i.from)(this.context.readProvider.getBlock(e)).pipe((0,o.switchMap)((e=>1===t?(0,i.of)(e):(0,i.range)(e.header.level,t-1).pipe((0,o.startWith)(e),(0,o.concatMap)((e=>n(this,void 0,void 0,(function*(){return this.context.readProvider.getBlock("number"==typeof e?e:e.header.level)}))))))))}createHeadObservableFromConfig({blockIdentifier:e}){return n(this,void 0,void 0,(function*(){const t=[];return e&&t.push(this.createPastBlockWalker(e)),t.push(yield this.createNewHeadObservable()),(0,i.concat)(...t)}))}createOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new l.WalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createBatchOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new a.BatchWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createTransactionOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new d.TransactionWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createDelegationOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new c.DelegationWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createOriginationOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new f.OriginationWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createIncreasePaidStorageOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new u.IncreasePaidStorageWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}}},2809:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.WalletOperation=void 0;const i=r(977),o=r(9002),s=r(6298),a=r(4632),c=r(7642),u=r(2323),l=r(227);t.WalletOperation=class{operationResults(){return n(this,void 0,void 0,(function*(){return this._operationResult.pipe((0,o.first)()).toPromise()}))}receipt(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new u.ObservableError("Unable to get operation results");return(0,s.receiptFromOperation)(e)}))}constructor(e,t,r){if(this.opHash=e,this.context=t,this._newHead$=r,this._operationResult=new i.ReplaySubject(1),this._includedInBlock=new i.ReplaySubject(1),this._included=!1,this.newHead$=this._newHead$.pipe((0,o.switchMap)((e=>{var t,r;const n=null!==(r=null===(t=this.lastHead)||void 0===t?void 0:t.header.level)&&void 0!==r?r:e.header.level-1;return(0,i.range)(n+1,e.header.level-n-1).pipe((0,o.concatMap)((e=>this.context.readProvider.getBlock(e))),(0,o.endWith)(e))})),(0,o.tap)((e=>this.lastHead=e)),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),this.confirmed$=this.newHead$.pipe((0,o.map)((e=>{for(const t of e.operations)for(const r of t)if(r.hash===this.opHash)return this._included=!0,this._includedInBlock.next(e),this._operationResult.next(r.contents),e})),(0,o.filter)((e=>void 0!==e)),(0,o.first)(),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),(0,a.validateOperation)(this.opHash)!==a.ValidationResult.VALID)throw new l.InvalidOperationHashError(this.opHash);this.confirmed$.pipe((0,o.first)(),(0,o.catchError)((()=>(0,i.of)(void 0)))).subscribe()}getCurrentConfirmation(){return n(this,void 0,void 0,(function*(){return this._included?(0,i.combineLatest)([this._includedInBlock,(0,i.from)(this.context.readProvider.getBlock("head"))]).pipe((0,o.map)((([e,t])=>t.header.level-e.header.level+1)),(0,o.first)()).toPromise():0}))}isInCurrentBranch(e="head"){return n(this,void 0,void 0,(function*(){if(!this._included)return!0;const t=yield this.context.readProvider.getBlockLevel(e),r=yield this._includedInBlock.pipe((0,o.first)()).toPromise();if(!r)throw new u.ObservableError("Inclusion block is undefined");const n=t-r.header.level;if(n<=0)return!0;const i=Math.min(r.header.level+n,r.header.level+60);return new Set(yield this.context.readProvider.getLiveBlocks(i)).has(r.hash)}))}confirmationObservable(e){if(void 0!==e&&e<1)throw new c.InvalidConfirmationCountError(e);const{defaultConfirmationCount:t}=this.context.config,r=void 0!==e?e:t;if(void 0===r)throw new u.ConfirmationUndefinedError;return(0,i.combineLatest)([this._includedInBlock,this.newHead$]).pipe((0,o.distinctUntilChanged)((([,e],[,t])=>e.hash===t.hash)),(0,o.map)((([e,t])=>({block:t,expectedConfirmation:r,currentConfirmation:t.header.level-e.header.level+1,completed:t.header.level-e.header.level>=r-1,isInCurrentBranch:()=>this.isInCurrentBranch(t.hash)}))),(0,o.takeWhile)((({completed:e})=>!e),!0))}confirmation(e){return this.confirmationObservable(e).toPromise()}}},7654:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OriginationWalletOperation=void 0;const i=r(6368),o=r(807),s=r(2809),a=r(2323);class c extends s.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}originationOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return(0,o.findWithKind)(e,i.OpKind.ORIGINATION);throw new a.ObservableError("Unable to fetch operation result")}))}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return(0,o.findWithKind)(e,i.OpKind.REVEAL);throw new a.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.originationOperation();return e?e.metadata.operation_result.status:"unknown"}))}contract(){return n(this,void 0,void 0,(function*(){const e=yield this.originationOperation(),t=((null==e?void 0:e.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at(t)}))}}t.OriginationWalletOperation=c},6298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.receiptFromOperation=void 0;const n=r(6391),i=r(4593),o=r(835);t.receiptFromOperation=(e,{ALLOCATION_BURN:t,ORIGINATION_BURN:r}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP});const s=(0,o.flattenOperationResult)({contents:e});let a=new n.default(0),c=new n.default(0),u=new n.default(0),l=new n.default(0),f=new n.default(0),d=new n.default(0);return s.forEach((e=>{u=u.plus(e.fee||0),l=l.plus(Array.isArray(e.originated_contracts)?e.originated_contracts.length*r:0),f=f.plus("allocated_destination_contract"in e?t:0),a=a.plus(e.consumed_milligas||0),d=d.plus("paid_storage_size_diff"in e&&Number(e.paid_storage_size_diff)||0)})),c=c.plus(f).plus(l).plus(d),{totalFee:u,totalMilliGas:a,totalGas:a.dividedBy(1e3),totalStorage:c,totalAllocationBurn:f,totalOriginationBurn:l,totalPaidStorageDiff:d,totalStorageBurn:new n.default(c.multipliedBy(i.COST_PER_BYTE))}}},4685:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionWalletOperation=void 0;const i=r(2809),o=r(6368),s=r(2323);class a extends i.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new s.ObservableError("operationResult returned undefined");return e.find((e=>e.kind===o.OpKind.REVEAL))}))}transactionOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new s.ObservableError("operationResult returned undefined");return e.find((e=>e.kind===o.OpKind.TRANSACTION))}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.transactionOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.TransactionWalletOperation=a},5277:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Wallet=t.WalletOperationBatch=void 0;const i=r(238),o=r(807),s=r(227),a=r(4632);class c{constructor(e,t){this.walletProvider=e,this.context=t,this.operations=[]}withTransfer(e){const t=(0,a.validateAddress)(e.to);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:o.OpKind.TRANSACTION},e)),this}withContractCall(e,t={}){return this.withTransfer(e.toTransferParams(t))}withDelegation(e){var t;const r=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&r!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.delegate,(0,a.invalidDetail)(r));return this.operations.push(Object.assign({kind:o.OpKind.DELEGATION},e)),this}withOrigination(e){return this.operations.push(Object.assign({kind:o.OpKind.ORIGINATION},e)),this}withIncreasePaidStorage(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:o.OpKind.INCREASE_PAID_STORAGE},e)),this}mapOperation(e){return n(this,void 0,void 0,(function*(){switch(e.kind){case o.OpKind.TRANSACTION:return this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));case o.OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},e))}))));case o.OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));case o.OpKind.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));default:throw new s.InvalidOperationKindError(JSON.stringify(e.kind))}}))}with(e){for(const t of e)switch(t.kind){case o.OpKind.TRANSACTION:this.withTransfer(t);break;case o.OpKind.ORIGINATION:this.withOrigination(t);break;case o.OpKind.DELEGATION:this.withDelegation(t);break;case o.OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(t);break;default:throw new s.InvalidOperationKindError(JSON.stringify(t.kind))}return this}send(){return n(this,void 0,void 0,(function*(){const e=[];for(const t of this.operations)e.push(yield this.mapOperation(t));const t=yield this.walletProvider.sendOperations(e);return this.context.operationFactory.createBatchOperation(t)}))}}t.WalletOperationBatch=c;t.Wallet=class{constructor(e){this.context=e,this.walletCommand=e=>({send:e})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:e}={}){return n(this,void 0,void 0,(function*(){return this._pkh&&!e||(this._pkh=yield this.walletProvider.getPKH()),this._pkh}))}pk({forceRefetch:e}={}){return n(this,void 0,void 0,(function*(){return this._pk&&!e||(this._pk=yield this.walletProvider.getPK()),this._pk}))}originate(e){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapOriginateParamsToWalletParams((()=>this.context.parser.prepareCodeOrigination(Object.assign({},e)))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createOriginationOperation(r)}))))}setDelegate(e){var t;const r=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&r!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.delegate,(0,a.invalidDetail)(r));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createDelegationOperation(r)}))))}signFailingNoop(e){return n(this,void 0,void 0,(function*(){const t={kind:o.OpKind.FAILING_NOOP,arbitrary:e.arbitrary},r=yield this.context.readProvider.getBlockHash(e.basedOnBlock),n=yield this.context.forger.forge({branch:r,contents:[t]});return{signature:yield this.walletProvider.sign(n,Uint8Array.from([3])),bytes:n,signedContent:{branch:r,contents:[{kind:o.OpKind.FAILING_NOOP,arbitrary:e.arbitrary}]}}}))}registerDelegate(){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const e=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return{delegate:yield this.pkh()}})))),t=yield this.walletProvider.sendOperations([e]);return this.context.operationFactory.createDelegationOperation(t)}))))}transfer(e){const t=(0,a.validateAddress)(e.to);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createTransactionOperation(r)}))))}increasePaidStorage(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapIncreasePaidStorageWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createIncreasePaidStorageOperation(r)}))))}batch(e){const t=new c(this.walletProvider,this.context);return Array.isArray(e)&&t.with(e),t}at(e,t=(e=>e)){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=this.context.withExtensions().rpc,o=this.context.withExtensions().readProvider,c=yield o.getScript(e,"head"),u=yield o.getEntrypoints(e),l=new i.ContractAbstraction(e,c,this,this.context.contract,u,n,o);return t(l,this.context)}))}getPK(){return n(this,void 0,void 0,(function*(){return yield this.pk()}))}}},5477:()=>{},3196:()=>{},8087:()=>{},2558:(e,t,r)=>{"use strict";r.d(t,{O:()=>w,Z:()=>E});var n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function b(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function g(e,t,r,n){if(er||e!==o(e))throw Error(s+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function v(e){var t=e.c.length-1;return p(e.e/u)==t&&e.c[t]%2!=0}function y(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?b.c=b.e=null:e.e=10;f/=10,c++);return void(c>D?b.c=b.e=null:(b.e=c,b.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return E(b,p,d);b.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(c<0&&(c=f),c+=+p.slice(f+1),p=p.substring(0,f)):c<0&&(c=p.length)}else{if(g(t,2,H.length,"Base"),10==t&&G)return W(b=new $(e),k+b.e+1,L);if(p=String(e),d="number"==typeof e){if(0*e!=0)return E(b,p,d,t);if(b.s=1/e<0?(p=p.slice(1),-1):1,$.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else b.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=H.slice(0,t),c=f=0,h=p.length;fc){c=h;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,f=-1,c=0;continue}return E(b,String(e),d,t)}d=!1,(c=(p=w(p,t,10,b.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(f=0;48===p.charCodeAt(f);f++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(f,++h)){if(h-=f,d&&$.DEBUG&&h>15&&(e>l||e!==o(e)))throw Error(a+b.s*e);if((c=c-f-1)>D)b.c=b.e=null;else if(c=C)?y(c,s):_(c,s,"0");else if(o=(e=W(new $(e),t,r)).e,a=(c=b(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function z(e,t){for(var r,n,i=1,o=new $(e[0]);i=10;i/=10,n++);return(r=n+r*u-1)>D?e.c=e.e=null:r=10;d/=10,s++);if((a=t-s)<0)a+=u,l=t,h=m[p=0],b=o(h/g[s-l-1]%10);else if((p=i((a+1)/u))>=m.length){if(!n)break e;for(;m.length<=p;m.push(0));h=b=0,s=1,l=(a%=u)-u+1}else{for(h=d=m[p],s=1;d>=10;d/=10,s++);b=(l=(a%=u)-u+s)<0?0:o(h/g[s-l-1]%10)}if(n=n||t<0||null!=m[p+1]||(l<0?h:h%g[s-l-1]),n=r<4?(b||n)&&(0==r||r==(e.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(a>0?l>0?h/g[s-l]:0:m[p-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(u-t%u)%u],e.e=-t||0):m[0]=e.e=0,e;if(0==a?(m.length=p,d=1,p--):(m.length=p+1,d=g[u-a],m[p]=l>0?o(h/g[s-l]%g[l])*d:0),n)for(;;){if(0==p){for(a=1,l=m[0];l>=10;l/=10,a++);for(l=m[0]+=d,d=1;l>=10;l/=10,d++);a!=d&&(e.e++,m[0]==c&&(m[0]=1));break}if(m[p]+=d,m[p]!=c)break;m[p--]=0,d=1}for(a=m.length;0===m[--a];m.pop());}e.e>D?e.c=e.e=null:e.e=C?y(t,r):_(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(g(r=e[t],0,h,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(g(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(g(r[0],-h,0,t),g(r[1],0,h,t),N=r[0],C=r[1]):(g(r,-h,h,t),N=-(C=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)g(r[0],-h,-1,t),g(r[1],1,h,t),j=r[0],D=r[1];else{if(g(r,-h,h,t),!r)throw Error(s+t+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(s+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(g(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(g(r=e[t],0,h,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);G="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,C],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:K,ALPHABET:H}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-h&&i<=h&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t=c||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return z(arguments,-1)},$.minimum=$.min=function(){return z(arguments,1)},$.random=(O=9007199254740992,A=Math.random()*O&2097151?function(){return o(Math.random()*O)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,a,c,l=0,d=[],p=new $(M);if(null==e?e=k:g(e,0,h),a=i(e/u),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(a*=2));l>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(d.push(c%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw U=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(a*=7);l=9e15?crypto.randomBytes(7).copy(t,l):(d.push(c%1e14),l+=7);l=a/7}if(!U)for(;l=10;c/=10,l++);lr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,f,d,h,p,m,g=n.indexOf("."),v=k,y=L;for(g>=0&&(f=F,F=0,n=n.replace(".",""),h=(m=new $(i)).pow(n.length-g),F=f,m.c=t(_(b(h.c),h.e,"0"),10,o,e),m.e=m.c.length),l=f=(p=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(g<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=r(h,m,v,y,o)).c,d=h.r,l=h.e),g=p[u=l+v+1],f=o/2,d=d||u<0||null!=p[u+1],d=y<4?(null!=g||d)&&(0==y||y==(h.s<0?3:2)):g>f||g==f&&(4==y||d||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])n=d?_(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(f=p.length;!p[--f];);for(g=0,n="";g<=f;n+=c.charAt(p[g++]));n=_(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%d,l=t/d|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%d)+(n=l*o+(s=e[c]/d|0)*u)%d*d+a)/r|0)+(n/d|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,s,a,l){var f,d,h,b,m,g,v,y,_,w,E,O,A,S,P,T,I,R=n.s==i.s?1:-1,x=n.c,M=i.c;if(!(x&&x[0]&&M&&M[0]))return new $(n.s&&i.s&&(x?!M||x[0]!=M[0]:M)?x&&0==x[0]||!M?0*R:R/0:NaN);for(_=(y=new $(R)).c=[],R=s+(d=n.e-i.e)+1,l||(l=c,d=p(n.e/u)-p(i.e/u),R=R/u|0),h=0;M[h]==(x[h]||0);h++);if(M[h]>(x[h]||0)&&d--,R<0)_.push(1),b=!0;else{for(S=x.length,T=M.length,h=0,R+=2,(m=o(l/(M[0]+1)))>1&&(M=e(M,m,l),x=e(x,m,l),T=M.length,S=x.length),A=T,E=(w=x.slice(0,T)).length;E=l/2&&P++;do{if(m=0,(f=t(M,w,T,E))<0){if(O=w[0],T!=E&&(O=O*l+(w[1]||0)),(m=o(O/P))>1)for(m>=l&&(m=l-1),v=(g=e(M,m,l)).length,E=w.length;1==t(g,w,v,E);)m--,r(g,T=10;R/=10,h++);W(y,s+(y.e=h+d*u-1)+1,a,b)}else y.e=d,y.r=+b;return y}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(P,"$1").replace(T,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return m(this,new $(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return g(e,0,h),null==t?t=L:g(t,0,8),W(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-p(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new $(e,t),k,L)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new $(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,a,c,l,f,d,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+Z(e));if(null!=t&&(t=new $(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Z(p),l?e.s*(2-v(e)):+Z(e))),t?h.mod(t):h;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&v(e)?-0:0,p.e>-1&&(c=1/c),new $(f?1/c:c);F&&(c=i(F/u+2))}for(l?(r=new $(.5),f&&(e.s=1),d=v(e)):d=(a=Math.abs(+Z(e)))%2,h=new $(M);;){if(d){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(a){if(0===(a=o(a/2)))break;d=a%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)d=v(e);else{if(0===(a=+Z(e)))break;d=a%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):n&&(p=p.mod(t))}return n?h:(f&&(h=M.div(h)),t?h.mod(t):c?W(h,F,L,undefined):h)},x.integerValue=function(e){var t=new $(this);return null==e?e=L:g(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===m(this,new $(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return m(this,new $(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=m(this,new $(e,t)))||0===t},x.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return m(this,new $(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=m(this,new $(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/u,f=e.e/u,d=s.c,h=e.c;if(!l||!f){if(!d||!h)return d?(e.s=-t,e):new $(h?s:NaN);if(!d[0]||!h[0])return h[0]?(e.s=-t,e):new $(d[0]?s:3==L?-0:0)}if(l=p(l),f=p(f),d=d.slice(),a=l-f){for((o=a<0)?(a=-a,i=d):(f=l,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=d.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;d[r++]=0);for(t=c-1;n>a;){if(d[--n]=0;){for(r=0,m=O[i]%_,g=O[i]/_|0,o=i+(s=l);o>i;)r=((f=m*(f=E[--s]%_)+(a=g*f+(h=E[s]/_|0)*m)%_*_+v[o]+r)/y|0)+(a/_|0)+g*h,v[o--]=f%y;v[o]=r}return r?++n:v.splice(0,1),q(e,v,n)},x.negated=function(){var e=new $(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/u,s=e.e/u,a=n.c,l=e.c;if(!o||!s){if(!a||!l)return new $(i/0);if(!a[0]||!l[0])return l[0]?e:new $(a[0]?n:0*i)}if(o=p(o),s=p(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=l):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=l.length)<0&&(r=l,l=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/c|0,a[t]=c===a[t]?0:a[t]%c;return i&&(a=[i].concat(a),++s),q(e,a,s)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return g(e,1,h),null==t?t=L:g(t,0,8),W(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return g(e,-9007199254740991,l),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=k+4,f=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Z(s)))||c==1/0?(((t=b(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),n=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(s,o,l,1))),b(o.c).slice(0,c)===(t=b(n.c)).slice(0,c)){if(n.e0&&b>0){for(o=b%c||c,f=p.substr(0,o);o0&&(f+=l+p.slice(o)),h&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,a,c,l,d,h,p,m,g,v=this,y=v.c;if(null!=e&&(!(l=new $(e)).isInteger()&&(l.c||1!==l.s)||l.lt(M)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Z(l));if(!y)return new $(v);for(t=new $(M),h=n=new $(M),i=d=new $(M),g=b(y),a=t.e=g.length-v.e-1,t.c[0]=f[(c=a%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?a>0?t:h:l,c=D,D=1/0,l=new $(g),d.c[0]=0;p=r(l,t,0,1),1!=(o=n.plus(p.times(i))).comparedTo(e);)n=i,i=o,h=d.plus(p.times(o=h)),d=o,t=l.minus(p.times(o=t)),l=o;return o=r(e.minus(n),i,0,1),d=d.plus(o.times(h)),n=n.plus(o.times(i)),d.s=h.s=v.s,m=r(h,i,a*=2,L).minus(v).abs().comparedTo(r(d,n,a,L).minus(v).abs())<1?[h,i]:[d,n],D=c,m},x.toNumber=function(){return+Z(this)},x.toPrecision=function(e,t){return null!=e&&g(e,1,h),V(this,e,t,2)},x.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=N||i>=C?y(b(r.c),i):_(b(r.c),i,"0"):10===e&&G?t=_(b((r=W(new $(r),k+i+1,L)).c),r.e,"0"):(g(e,2,H.length,"Base"),t=w(_(b(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf,null!=t&&$.set(t),$}();const E=w},763:e=>{"use strict";e.exports={i8:"6.5.4"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r(2353)})())); \ No newline at end of file diff --git a/node_modules/@taquito/taquito/dist/taquito.min.js.LICENSE.txt b/node_modules/@taquito/taquito/dist/taquito.min.js.LICENSE.txt deleted file mode 100644 @@ -823,10 +823,10 @@ index 9aa9943..8b725ab 100644 // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! const VERSION = { -- "commitHash": "fc66aa741c240cb367082d1294ef915654c341a6", -- "version": "19.0.1" -+ commitHash: 'fc66aa741c240cb367082d1294ef915654c341a6', -+ version: '19.0.1', +- "commitHash": "13a12ab7cf442043526745db2bbf4ef3b089c34a", +- "version": "19.0.2" ++ commitHash: '13a12ab7cf442043526745db2bbf4ef3b089c34a', ++ version: '19.0.2', }; /** diff --git a/src/utils/etherlinkUtils.ts b/src/utils/etherlinkUtils.ts index 9ec089d..84a4b6f 100644 --- a/src/utils/etherlinkUtils.ts +++ b/src/utils/etherlinkUtils.ts @@ -1,4 +1,4 @@ -import { utils } from 'web3'; +import * as web3Utils from 'web3-utils'; import * as web3Validator from 'web3-validator'; export const isAddress = (address: string): boolean => web3Validator.isAddress(address, true); @@ -6,7 +6,7 @@ export const isAddress = (address: string): boolean => web3Validator.isAddress(a const isTransactionRegex = /^0x[0-9a-f]{64}$/; export const isTransaction = (transactionHash: string) => isTransactionRegex.test(transactionHash); -export const toChecksumAddress = (address: string): string => utils.toChecksumAddress(address); +export const toChecksumAddress = (address: string): string => web3Utils.toChecksumAddress(address); export const prepareHexPrefix = (value: string, addOrRemove: boolean): string => { return value.startsWith('0x') From 1b17e2b06306ff880bd9bcc691c54e477f5db861 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 4 Mar 2024 13:35:17 +0300 Subject: [PATCH 05/20] Fix tests --- integration/tests/withdrawal.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/tests/withdrawal.test.ts b/integration/tests/withdrawal.test.ts index 47cf499..906fc0e 100644 --- a/integration/tests/withdrawal.test.ts +++ b/integration/tests/withdrawal.test.ts @@ -35,8 +35,8 @@ describe('Withdrawal', () => { tokenBridge = createTestTokenBridge({ testConfig, tezosToolkit, etherlinkToolkit }); const connectedAddresses = await Promise.all([ - await tokenBridge.getTezosConnectedAddress(), - await tokenBridge.getEtherlinkConnectedAddress() + await tokenBridge.getTezosSignerAddress(), + await tokenBridge.getEtherlinkSignerAddress() ]); testTezosAccountAddress = connectedAddresses[0]; testEtherlinkAccountAddress = connectedAddresses[1]; From f69b325b0e32edc6267b228ae726cb788d8a5ac8 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 4 Mar 2024 13:40:42 +0300 Subject: [PATCH 06/20] Update the taquito packages; Remove the patches --- package-lock.json | 324 ++----- package.json | 10 +- patches/@taquito+taquito+19.0.2.patch | 1172 ------------------------- 3 files changed, 55 insertions(+), 1451 deletions(-) delete mode 100644 patches/@taquito+taquito+19.0.2.patch diff --git a/package-lock.json b/package-lock.json index 5f6917e..b675af7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,16 +7,15 @@ "": { "name": "@baking-bad/tezos-etherlink-bridge-sdk", "version": "0.1.1", - "hasInstallScript": true, "license": "MIT", "dependencies": { - "@taquito/utils": "^19.0.2", + "@taquito/utils": "^19.1.0-beta-RC.0", "web3-utils": "^4.2.0", "web3-validator": "^2.0.4" }, "devDependencies": { - "@taquito/signer": "^19.0.2", - "@taquito/taquito": "^19.0.2", + "@taquito/signer": "^19.1.0-beta-RC.0", + "@taquito/taquito": "^19.1.0-beta-RC.0", "@types/jest": "^29.5.11", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", @@ -25,7 +24,6 @@ "eslint": "^8.56.0", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", - "patch-package": "^8.0.0", "ts-jest": "^29.1.2", "typescript": "^5.3.3", "web3": "^4.4.0", @@ -1952,9 +1950,9 @@ } }, "node_modules/@taquito/core": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/core/-/core-19.0.2.tgz", - "integrity": "sha512-SJiFqUkB2KnlZO6B7+70T13jlzmVM43qg6bOvV9jYT3bed3Up/OsydkLGbLnL5/Chxqt8y4PYQY8QL8wpQTO0Q==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/core/-/core-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-HkZsqMskL7DWpYOPaSQnHLn0Q21DK3KiT/lEeNhBcGKtvLaJjVjduZ9A6TQR+GfAO+x+CkHILjuGaH/mht69cA==", "dependencies": { "json-stringify-safe": "^5.0.1" }, @@ -1963,12 +1961,12 @@ } }, "node_modules/@taquito/http-utils": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-19.0.2.tgz", - "integrity": "sha512-JhUM0Qop6T6VJkX5TBS+fOpj44oVkuRU0rOfQknsA9NBfIRuR1EbGaSXPno45oe2yrM3eSfMLnJ5eVlbaZybLw==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-/NYSY4fVfPPnwA6pVN3TMQaoop3xU0q5CXZ7u5vmDUV2GOTtP6noUeJuvNX5pabwjJZxLwdYLWXCvXZq9qI5AQ==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", "node-fetch": "^2.7.0" }, "engines": { @@ -1976,13 +1974,13 @@ } }, "node_modules/@taquito/local-forging": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-19.0.2.tgz", - "integrity": "sha512-Sjrw9xShRYaCrAkbDolpvGhAhpSM9kanVFrGjl2RKxIIQRRBNIvUHniyPNKqGgGt88dUJWFkcCrJL6CNBw/kSw==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-e/Lc3PqdX7POKIxDA5JiCKdLlvr8htIAzyqYhrEZMeqdGHVR2ZFjTnGxcGZiTncpN9NfhY46U/z9NT2bmqp4aw==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.2", - "@taquito/utils": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0-beta-RC.0", "bignumber.js": "^9.1.2" }, "engines": { @@ -1990,26 +1988,26 @@ } }, "node_modules/@taquito/michel-codec": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-19.0.2.tgz", - "integrity": "sha512-x7duslF4krOS44PpP+BWQgwQxUs0i6q/J5OEh4WXZ9SI4gLT0xji+vmU5ohjvoj1Tv9V19OcYatSPMD0M5V4SQ==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-z6DhwsQmyaijopQs9brw/V1mLu2j74uL8q38jY8OVS8bRKIUSvsunDBd8dJGbLARcHG2JncOGLrFZ5E631VuSw==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.2" + "@taquito/core": "^19.1.0-beta-RC.0" }, "engines": { "node": ">=18" } }, "node_modules/@taquito/michelson-encoder": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-19.0.2.tgz", - "integrity": "sha512-Ctwu1pPi1fTdXvS0G3lq6R2sldOYUesDr8LlUJQ09ks6odHYuwz28DQgka+S0XH5yxNs03T1DP5cyjM+l/NwqQ==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-XAwUhcTzahPVk8rcipLaG/RNjTXS/KNM5eHhi7RSH+37e5fgaCiRa7+cASFlWG605/zmwg7Ro2VZVZTZTt7vbg==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.2", - "@taquito/rpc": "^19.0.2", - "@taquito/utils": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/rpc": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0-beta-RC.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -2018,14 +2016,14 @@ } }, "node_modules/@taquito/rpc": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-19.0.2.tgz", - "integrity": "sha512-Jsued1kqAFU8jKYGDmg+cZ0vQHdDr5wGFWDhlUpFTpuU5yIrkplDu5jnckC64og6VEPaiieiRe9LItpNfUDBvg==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-EcphrNCM3Wbyuv+CdETyrv+M9B+DHTOXluI+E99jH0H2Bo8fxKJBU/hSJS2Kk/Y59UMGu/4Rs8yAnBNYRzSCyA==", "dev": true, "dependencies": { - "@taquito/core": "^19.0.2", - "@taquito/http-utils": "^19.0.2", - "@taquito/utils": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/http-utils": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0-beta-RC.0", "bignumber.js": "^9.1.2" }, "engines": { @@ -2033,9 +2031,9 @@ } }, "node_modules/@taquito/signer": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-19.0.2.tgz", - "integrity": "sha512-qX5CueWC88xL47NeJ/TMaasQNMiojf9cd4jpgPHsqDGW8g/E6qoTdYeeFKG3dexE7ziTx+ZBaFOO2/zVSAF+Rg==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-wy2SoAEQ6V/WpMN8622cztzFNRt9EuB25TzVY0UyI66or5cBFzWAVig1tYw0sOFpSzgODP2JgMNaX9qVKn19AQ==", "dev": true, "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -2044,9 +2042,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^19.0.2", - "@taquito/taquito": "^19.0.2", - "@taquito/utils": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/taquito": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0-beta-RC.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -2058,19 +2056,19 @@ } }, "node_modules/@taquito/taquito": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-19.0.2.tgz", - "integrity": "sha512-kVwJqnn45VVgu5uFjd4dZKZjdmrSipFZg8N2HE6SGc757pzLhDItQJ8z9cKKZUYlrTe73N3wGij4kr7CZ5r//g==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-3L3jpfLbMjXBjyJJ995SaED9d8LI2WsH7SSGEj0s2ir+bOUR93cQfCD+I7CE6RQl4x5ejjPxFre0lVqeTxQ/ZA==", "dev": true, "hasInstallScript": true, "dependencies": { - "@taquito/core": "^19.0.2", - "@taquito/http-utils": "^19.0.2", - "@taquito/local-forging": "^19.0.2", - "@taquito/michel-codec": "^19.0.2", - "@taquito/michelson-encoder": "^19.0.2", - "@taquito/rpc": "^19.0.2", - "@taquito/utils": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/http-utils": "^19.1.0-beta-RC.0", + "@taquito/local-forging": "^19.1.0-beta-RC.0", + "@taquito/michel-codec": "^19.1.0-beta-RC.0", + "@taquito/michelson-encoder": "^19.1.0-beta-RC.0", + "@taquito/rpc": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0-beta-RC.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -2079,13 +2077,13 @@ } }, "node_modules/@taquito/utils": { - "version": "19.0.2", - "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-19.0.2.tgz", - "integrity": "sha512-p8GHJuny8l9Wa7KQY62wiTroLNtcLZxvGKvIKIODiV/LuLlCexnqfDdT3AsK4aiy/MjKew24JBe++REXXowAug==", + "version": "19.1.0-beta-RC.0", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-19.1.0-beta-RC.0.tgz", + "integrity": "sha512-7YmWeNVJ6Sh+Yy/Oyv/ch6ScAw8CuEoecnuJNusbkKn4eJI3xP4TEW5tqhnFrFT829Z2Wizi4kHoykz8W4I07A==", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.0.2", + "@taquito/core": "^19.1.0-beta-RC.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", @@ -2451,12 +2449,6 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, - "node_modules/@yarnpkg/lockfile": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", - "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", - "dev": true - }, "node_modules/abitype": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.7.1.tgz", @@ -2696,15 +2688,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -4062,15 +4045,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-yarn-workspace-root": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", - "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", - "dev": true, - "dependencies": { - "micromatch": "^4.0.2" - } - }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -4099,21 +4073,6 @@ "is-callable": "^1.1.3" } }, - "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4691,21 +4650,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -4900,18 +4844,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -5602,24 +5534,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "node_modules/json-stable-stringify": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", - "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "isarray": "^2.0.5", - "jsonify": "^0.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -5643,27 +5557,6 @@ "node": ">=6" } }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsonify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", - "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -5673,15 +5566,6 @@ "json-buffer": "3.0.1" } }, - "node_modules/klaw-sync": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", - "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.11" - } - }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -6038,22 +5922,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/open": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", - "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0", - "is-wsl": "^2.1.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -6071,15 +5939,6 @@ "node": ">= 0.8.0" } }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -6149,57 +6008,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/patch-package": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", - "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", - "dev": true, - "dependencies": { - "@yarnpkg/lockfile": "^1.1.0", - "chalk": "^4.1.2", - "ci-info": "^3.7.0", - "cross-spawn": "^7.0.3", - "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^9.0.0", - "json-stable-stringify": "^1.0.2", - "klaw-sync": "^6.0.0", - "minimist": "^1.2.6", - "open": "^7.4.2", - "rimraf": "^2.6.3", - "semver": "^7.5.3", - "slash": "^2.0.0", - "tmp": "^0.0.33", - "yaml": "^2.2.2" - }, - "bin": { - "patch-package": "index.js" - }, - "engines": { - "node": ">=14", - "npm": ">5" - } - }, - "node_modules/patch-package/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/patch-package/node_modules/slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -7038,18 +6846,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -7327,15 +7123,6 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -7870,15 +7657,6 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, - "node_modules/yaml": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", - "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", - "dev": true, - "engines": { - "node": ">= 14" - } - }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index 8760e7b..18c48a8 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "default": "./dist/node/index.js" }, "dependencies": { - "@taquito/utils": "^19.0.2", + "@taquito/utils": "^19.1.0-beta-RC.0", "web3-utils": "^4.2.0", "web3-validator": "^2.0.4" }, @@ -51,8 +51,8 @@ } }, "devDependencies": { - "@taquito/signer": "^19.0.2", - "@taquito/taquito": "^19.0.2", + "@taquito/signer": "^19.1.0-beta-RC.0", + "@taquito/taquito": "^19.1.0-beta-RC.0", "@types/jest": "^29.5.11", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", @@ -61,7 +61,6 @@ "eslint": "^8.56.0", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", - "patch-package": "^8.0.0", "ts-jest": "^29.1.2", "typescript": "^5.3.3", "web3": "^4.4.0", @@ -75,8 +74,7 @@ "jest": "jest", "watch": "npm run build -- -w", "check:types": "tsc -p tsconfig.json", - "lint": "eslint . --ext .ts", - "postinstall": "patch-package" + "lint": "eslint . --ext .ts" }, "keywords": [ "tezos", diff --git a/patches/@taquito+taquito+19.0.2.patch b/patches/@taquito+taquito+19.0.2.patch deleted file mode 100644 index ba97fdb..0000000 --- a/patches/@taquito+taquito+19.0.2.patch +++ /dev/null @@ -1,1172 +0,0 @@ -diff --git a/node_modules/@taquito/taquito/dist/lib/batch/rpc-batch-provider.js b/node_modules/@taquito/taquito/dist/lib/batch/rpc-batch-provider.js -index 6963edc..399608d 100644 ---- a/node_modules/@taquito/taquito/dist/lib/batch/rpc-batch-provider.js -+++ b/node_modules/@taquito/taquito/dist/lib/batch/rpc-batch-provider.js -@@ -155,6 +155,16 @@ class OperationBatch extends provider_1.Provider { - this.operations.push(Object.assign({ kind: rpc_1.OpKind.SMART_ROLLUP_ORIGINATE }, params)); - return this; - } -+ /** -+ * -+ * @description Add a smart rollup execute outbox message to the batch -+ * -+ * @param params Smart Rollup Execute Outbox Message operation parameter -+ */ -+ withSmartRollupExecuteOutboxMessage(params) { -+ this.operations.push(Object.assign({ kind: rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE }, params)); -+ return this; -+ } - getRPCOp(param) { - return __awaiter(this, void 0, void 0, function* () { - switch (param.kind) { -@@ -174,6 +184,8 @@ class OperationBatch extends provider_1.Provider { - return (0, prepare_1.createSmartRollupAddMessagesOperation)(Object.assign({}, param)); - case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE: - return (0, prepare_1.createSmartRollupOriginateOperation)(Object.assign({}, param)); -+ case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ return (0, prepare_1.createSmartRollupExecuteOutboxMessageOperation)(Object.assign({}, param)); - default: - throw new core_1.InvalidOperationKindError(JSON.stringify(param.kind)); - } -@@ -216,6 +228,9 @@ class OperationBatch extends provider_1.Provider { - case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE: - this.withSmartRollupOriginate(param); - break; -+ case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ this.withSmartRollupExecuteOutboxMessage(param); -+ break; - default: - throw new core_1.InvalidOperationKindError(JSON.stringify(param.kind)); - } -diff --git a/node_modules/@taquito/taquito/dist/lib/contract/prepare.js b/node_modules/@taquito/taquito/dist/lib/contract/prepare.js -index 3e86166..6f34110 100644 ---- a/node_modules/@taquito/taquito/dist/lib/contract/prepare.js -+++ b/node_modules/@taquito/taquito/dist/lib/contract/prepare.js -@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); --exports.createSmartRollupOriginateOperation = exports.createSmartRollupAddMessagesOperation = exports.createUpdateConsensusKeyOperation = exports.createProposalsOperation = exports.createBallotOperation = exports.createDrainDelegateOperation = exports.createIncreasePaidStorageOperation = exports.createTransferTicketOperation = exports.createRegisterGlobalConstantOperation = exports.createRevealOperation = exports.createRegisterDelegateOperation = exports.createSetDelegateOperation = exports.createTransferOperation = exports.createOriginationOperation = exports.createActivationOperation = void 0; -+exports.createSmartRollupExecuteOutboxMessageOperation = exports.createSmartRollupOriginateOperation = exports.createSmartRollupAddMessagesOperation = exports.createUpdateConsensusKeyOperation = exports.createProposalsOperation = exports.createBallotOperation = exports.createDrainDelegateOperation = exports.createIncreasePaidStorageOperation = exports.createTransferTicketOperation = exports.createRegisterGlobalConstantOperation = exports.createRevealOperation = exports.createRegisterDelegateOperation = exports.createSetDelegateOperation = exports.createTransferOperation = exports.createOriginationOperation = exports.createActivationOperation = void 0; - const michelson_encoder_1 = require("@taquito/michelson-encoder"); - const rpc_1 = require("@taquito/rpc"); - const constants_1 = require("../constants"); -@@ -212,3 +212,16 @@ const createSmartRollupOriginateOperation = ({ source, fee, gasLimit, storageLim - }; - }); - exports.createSmartRollupOriginateOperation = createSmartRollupOriginateOperation; -+const createSmartRollupExecuteOutboxMessageOperation = ({ source, fee, gasLimit, storageLimit, rollup, cementedCommitment, outputProof, }) => __awaiter(void 0, void 0, void 0, function* () { -+ return { -+ kind: rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE, -+ source, -+ fee, -+ gas_limit: gasLimit, -+ storage_limit: storageLimit, -+ rollup, -+ cemented_commitment: cementedCommitment, -+ output_proof: outputProof, -+ }; -+}); -+exports.createSmartRollupExecuteOutboxMessageOperation = createSmartRollupExecuteOutboxMessageOperation; -diff --git a/node_modules/@taquito/taquito/dist/lib/contract/rpc-contract-provider.js b/node_modules/@taquito/taquito/dist/lib/contract/rpc-contract-provider.js -index 24faf81..d812223 100644 ---- a/node_modules/@taquito/taquito/dist/lib/contract/rpc-contract-provider.js -+++ b/node_modules/@taquito/taquito/dist/lib/contract/rpc-contract-provider.js -@@ -32,6 +32,7 @@ const proposals_operation_1 = require("../operations/proposals-operation"); - const update_consensus_key_operation_1 = require("../operations/update-consensus-key-operation"); - const smart_rollup_add_messages_operation_1 = require("../operations/smart-rollup-add-messages-operation"); - const smart_rollup_originate_operation_1 = require("../operations/smart-rollup-originate-operation"); -+const smart_rollup_execute_outbox_message_operation_1 = require("../operations/smart-rollup-execute-outbox-message-operation"); - const provider_1 = require("../provider"); - const prepare_1 = require("../prepare"); - class RpcContractProvider extends provider_1.Provider { -@@ -512,6 +513,22 @@ class RpcContractProvider extends provider_1.Provider { - return new smart_rollup_originate_operation_1.SmartRollupOriginateOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context); - }); - } -+ /** -+ * @description Execute a message from a smart rollup's outbox of a cemented commitment -+ * @param SmartRollupExecuteOutboxMessageParams -+ * @returns An operation handle with results from the RPC node -+ */ -+ smartRollupExecuteOutboxMessage(params) { -+ return __awaiter(this, void 0, void 0, function* () { -+ const publicKeyHash = yield this.signer.publicKeyHash(); -+ const estimate = yield this.estimate(params, this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)); -+ const prepared = yield this.prepare.smartRollupExecuteOutboxMessage(Object.assign(Object.assign({}, params), estimate)); -+ const content = prepared.opOb.contents.find((op) => op.kind === rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); -+ const opBytes = yield this.forge(prepared); -+ const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes); -+ return new smart_rollup_execute_outbox_message_operation_1.SmartRollupExecuteOutboxMessageOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context); -+ }); -+ } - /** - * - * @description A failing_noop operation that is guaranteed to fail. -diff --git a/node_modules/@taquito/taquito/dist/lib/estimate/rpc-estimate-provider.js b/node_modules/@taquito/taquito/dist/lib/estimate/rpc-estimate-provider.js -index d1fdcfd..3b3517f 100644 ---- a/node_modules/@taquito/taquito/dist/lib/estimate/rpc-estimate-provider.js -+++ b/node_modules/@taquito/taquito/dist/lib/estimate/rpc-estimate-provider.js -@@ -392,6 +392,25 @@ class RPCEstimateProvider extends provider_1.Provider { - return estimate_1.Estimate.createEstimateInstanceFromProperties(estimateProperties); - }); - } -+ /** -+ * -+ * @description Estimate gasLimit, storageLimit and fees for a smart_rollup_execute_outbox_message operation -+ * -+ * @returns An estimation of gasLimit, storageLimit and fees for the operation -+ * -+ * @param Estimate -+ */ -+ smartRollupExecuteOutboxMessage(params) { -+ return __awaiter(this, void 0, void 0, function* () { -+ const protocolConstants = yield this.context.readProvider.getProtocolConstants('head'); -+ const preparedOperation = yield this.prepare.smartRollupExecuteOutboxMessage(params); -+ const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants); -+ if (preparedOperation.opOb.contents[0].kind === 'reveal') { -+ estimateProperties.shift(); -+ } -+ return estimate_1.Estimate.createEstimateInstanceFromProperties(estimateProperties); -+ }); -+ } - /** - * - * @description Estimate gasLimit, storageLimit and fees for contract call -diff --git a/node_modules/@taquito/taquito/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js b/node_modules/@taquito/taquito/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js -new file mode 100644 -index 0000000..01afe59 ---- /dev/null -+++ b/node_modules/@taquito/taquito/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js -@@ -0,0 +1,56 @@ -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.SmartRollupExecuteOutboxMessageOperation = void 0; -+const rpc_1 = require("@taquito/rpc"); -+const operations_1 = require("./operations"); -+/** -+ * -+ * @description SmartRollupExecuteOutboxMessage Operation provides utility to fetch properties for Operation of kind SmartRollupExecuteOutboxMessage -+ * -+ */ -+class SmartRollupExecuteOutboxMessageOperation extends operations_1.Operation { -+ constructor(hash, params, source, raw, results, context) { -+ super(hash, raw, results, context); -+ this.params = params; -+ this.source = source; -+ } -+ get operationResults() { -+ const smartRollupExecuteOutboxMessageOp = Array.isArray(this.results) && -+ this.results.find((op) => op.kind === rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); -+ const result = smartRollupExecuteOutboxMessageOp && -+ smartRollupExecuteOutboxMessageOp.metadata && -+ smartRollupExecuteOutboxMessageOp.metadata.operation_result; -+ return result ? result : undefined; -+ } -+ get status() { -+ var _a, _b; -+ return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown'; -+ } -+ get rollup() { -+ return this.params.rollup; -+ } -+ get cementedCommitment() { -+ return this.params.cemented_commitment; -+ } -+ get outputProof() { -+ return this.params.output_proof; -+ } -+ get fee() { -+ return Number(this.params.fee); -+ } -+ get gasLimit() { -+ return Number(this.params.gas_limit); -+ } -+ get storageLimit() { -+ return Number(this.params.storage_limit); -+ } -+ get consumedMilliGas() { -+ var _a; -+ return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas; -+ } -+ get errors() { -+ var _a; -+ return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors; -+ } -+} -+exports.SmartRollupExecuteOutboxMessageOperation = SmartRollupExecuteOutboxMessageOperation; -diff --git a/node_modules/@taquito/taquito/dist/lib/operations/types.js b/node_modules/@taquito/taquito/dist/lib/operations/types.js -index 5c4c332..835c924 100644 ---- a/node_modules/@taquito/taquito/dist/lib/operations/types.js -+++ b/node_modules/@taquito/taquito/dist/lib/operations/types.js -@@ -32,6 +32,7 @@ const isOpWithFee = (op) => { - 'update_consensus_key', - 'smart_rollup_add_messages', - 'smart_rollup_originate', -+ 'smart_rollup_execute_outbox_message', - ].indexOf(op.kind) !== -1); - }; - exports.isOpWithFee = isOpWithFee; -@@ -46,6 +47,7 @@ const isOpRequireReveal = (op) => { - 'update_consensus_key', - 'smart_rollup_add_messages', - 'smart_rollup_originate', -+ 'smart_rollup_execute_outbox_message', - ].indexOf(op.kind) !== -1); - }; - exports.isOpRequireReveal = isOpRequireReveal; -diff --git a/node_modules/@taquito/taquito/dist/lib/prepare/prepare-provider.js b/node_modules/@taquito/taquito/dist/lib/prepare/prepare-provider.js -index b29af58..60ca185 100644 ---- a/node_modules/@taquito/taquito/dist/lib/prepare/prepare-provider.js -+++ b/node_modules/@taquito/taquito/dist/lib/prepare/prepare-provider.js -@@ -166,6 +166,7 @@ class PrepareProvider extends provider_1.Provider { - case rpc_1.OpKind.UPDATE_CONSENSUS_KEY: - case rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES: - case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE: -+ case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: - return Object.assign(Object.assign(Object.assign({}, op), this.getSource(op, pkh, source)), this.getFee(op, pkh, headCounter)); - case rpc_1.OpKind.TRANSFER_TICKET: - return Object.assign(Object.assign(Object.assign(Object.assign({}, op), { ticket_amount: `${op.ticket_amount}` }), this.getSource(op, pkh, source)), this.getFee(op, pkh, headCounter)); -@@ -657,6 +658,37 @@ class PrepareProvider extends provider_1.Provider { - }; - }); - } -+ /** -+ * -+ * @description Method to prepare a smart_rollup_execute_outbox_message operation -+ * @param operation RPCOperation object or RPCOperation array -+ * @param source string or undefined source pkh -+ * @returns a PreparedOperation object -+ */ -+ smartRollupExecuteOutboxMessage(_a) { -+ var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]); -+ return __awaiter(this, void 0, void 0, function* () { -+ const { pkh } = yield this.getKeys(); -+ const protocolConstants = yield this.context.readProvider.getProtocolConstants('head'); -+ const DEFAULT_PARAMS = yield this.getAccountLimits(pkh, protocolConstants); -+ const op = yield (0, contract_1.createSmartRollupExecuteOutboxMessageOperation)(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS))); -+ const operation = yield this.addRevealOperationIfNeeded(op, pkh); -+ const ops = this.convertIntoArray(operation); -+ const hash = yield this.getBlockHash(); -+ const protocol = yield this.getProtocolHash(); -+ __classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f"); -+ const headCounter = parseInt(yield this.getHeadCounter(pkh), 10); -+ const contents = this.constructOpContents(ops, headCounter, pkh, rest.source); -+ return { -+ opOb: { -+ branch: hash, -+ contents, -+ protocol, -+ }, -+ counter: headCounter, -+ }; -+ }); -+ } - /** - * - * @description Method to prepare a batch operation -diff --git a/node_modules/@taquito/taquito/dist/lib/provider.js b/node_modules/@taquito/taquito/dist/lib/provider.js -index ae4dccf..988077b 100644 ---- a/node_modules/@taquito/taquito/dist/lib/provider.js -+++ b/node_modules/@taquito/taquito/dist/lib/provider.js -@@ -97,6 +97,8 @@ class Provider { - return (0, prepare_1.createSmartRollupAddMessagesOperation)(Object.assign({}, param)); - case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE: - return (0, prepare_1.createSmartRollupOriginateOperation)(Object.assign({}, param)); -+ case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ return (0, prepare_1.createSmartRollupExecuteOutboxMessageOperation)(Object.assign({}, param)); - default: - throw new utils_1.InvalidOperationKindError(param.kind); - } -diff --git a/node_modules/@taquito/taquito/dist/lib/version.js b/node_modules/@taquito/taquito/dist/lib/version.js -index 38c4253..1a3c91c 100644 ---- a/node_modules/@taquito/taquito/dist/lib/version.js -+++ b/node_modules/@taquito/taquito/dist/lib/version.js -@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.VERSION = void 0; - // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! - exports.VERSION = { -- "commitHash": "13a12ab7cf442043526745db2bbf4ef3b089c34a", -- "version": "19.0.2" -+ commitHash: '13a12ab7cf442043526745db2bbf4ef3b089c34a', -+ version: '19.0.2', - }; -diff --git a/node_modules/@taquito/taquito/dist/taquito.es6.js b/node_modules/@taquito/taquito/dist/taquito.es6.js -index 9f474b4..81603f5 100644 ---- a/node_modules/@taquito/taquito/dist/taquito.es6.js -+++ b/node_modules/@taquito/taquito/dist/taquito.es6.js -@@ -576,6 +576,18 @@ const createSmartRollupOriginateOperation = ({ source, fee, gasLimit, storageLim - parameters_ty: parametersType, - }; - }); -+const createSmartRollupExecuteOutboxMessageOperation = ({ source, fee, gasLimit, storageLimit, rollup, cementedCommitment, outputProof, }) => __awaiter(void 0, void 0, void 0, function* () { -+ return { -+ kind: OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE, -+ source, -+ fee, -+ gas_limit: gasLimit, -+ storage_limit: storageLimit, -+ rollup, -+ cemented_commitment: cementedCommitment, -+ output_proof: outputProof, -+ }; -+}); - - const attachKind = (op, kind) => { - return Object.assign(Object.assign({}, op), { kind }); -@@ -603,6 +615,7 @@ const isOpWithFee = (op) => { - 'update_consensus_key', - 'smart_rollup_add_messages', - 'smart_rollup_originate', -+ 'smart_rollup_execute_outbox_message', - ].indexOf(op.kind) !== -1); - }; - const isOpRequireReveal = (op) => { -@@ -616,6 +629,7 @@ const isOpRequireReveal = (op) => { - 'update_consensus_key', - 'smart_rollup_add_messages', - 'smart_rollup_originate', -+ 'smart_rollup_execute_outbox_message', - ].indexOf(op.kind) !== -1); - }; - const hasMetadata = (op) => { -@@ -1016,6 +1030,8 @@ class Provider { - return createSmartRollupAddMessagesOperation(Object.assign({}, param)); - case OpKind.SMART_ROLLUP_ORIGINATE: - return createSmartRollupOriginateOperation(Object.assign({}, param)); -+ case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ return createSmartRollupExecuteOutboxMessageOperation(Object.assign({}, param)); - default: - throw new InvalidOperationKindError(param.kind); - } -@@ -2592,6 +2608,7 @@ class PrepareProvider extends Provider { - case OpKind.UPDATE_CONSENSUS_KEY: - case OpKind.SMART_ROLLUP_ADD_MESSAGES: - case OpKind.SMART_ROLLUP_ORIGINATE: -+ case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: - return Object.assign(Object.assign(Object.assign({}, op), this.getSource(op, pkh, source)), this.getFee(op, pkh, headCounter)); - case OpKind.TRANSFER_TICKET: - return Object.assign(Object.assign(Object.assign(Object.assign({}, op), { ticket_amount: `${op.ticket_amount}` }), this.getSource(op, pkh, source)), this.getFee(op, pkh, headCounter)); -@@ -3083,6 +3100,37 @@ class PrepareProvider extends Provider { - }; - }); - } -+ /** -+ * -+ * @description Method to prepare a smart_rollup_execute_outbox_message operation -+ * @param operation RPCOperation object or RPCOperation array -+ * @param source string or undefined source pkh -+ * @returns a PreparedOperation object -+ */ -+ smartRollupExecuteOutboxMessage(_a) { -+ var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]); -+ return __awaiter(this, void 0, void 0, function* () { -+ const { pkh } = yield this.getKeys(); -+ const protocolConstants = yield this.context.readProvider.getProtocolConstants('head'); -+ const DEFAULT_PARAMS = yield this.getAccountLimits(pkh, protocolConstants); -+ const op = yield createSmartRollupExecuteOutboxMessageOperation(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS))); -+ const operation = yield this.addRevealOperationIfNeeded(op, pkh); -+ const ops = this.convertIntoArray(operation); -+ const hash = yield this.getBlockHash(); -+ const protocol = yield this.getProtocolHash(); -+ __classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f"); -+ const headCounter = parseInt(yield this.getHeadCounter(pkh), 10); -+ const contents = this.constructOpContents(ops, headCounter, pkh, rest.source); -+ return { -+ opOb: { -+ branch: hash, -+ contents, -+ protocol, -+ }, -+ counter: headCounter, -+ }; -+ }); -+ } - /** - * - * @description Method to prepare a batch operation -@@ -3360,6 +3408,16 @@ class OperationBatch extends Provider { - this.operations.push(Object.assign({ kind: OpKind.SMART_ROLLUP_ORIGINATE }, params)); - return this; - } -+ /** -+ * -+ * @description Add a smart rollup execute outbox message to the batch -+ * -+ * @param params Smart Rollup Execute Outbox Message operation parameter -+ */ -+ withSmartRollupExecuteOutboxMessage(params) { -+ this.operations.push(Object.assign({ kind: OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE }, params)); -+ return this; -+ } - getRPCOp(param) { - return __awaiter(this, void 0, void 0, function* () { - switch (param.kind) { -@@ -3379,6 +3437,8 @@ class OperationBatch extends Provider { - return createSmartRollupAddMessagesOperation(Object.assign({}, param)); - case OpKind.SMART_ROLLUP_ORIGINATE: - return createSmartRollupOriginateOperation(Object.assign({}, param)); -+ case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ return createSmartRollupExecuteOutboxMessageOperation(Object.assign({}, param)); - default: - throw new InvalidOperationKindError$1(JSON.stringify(param.kind)); - } -@@ -3421,6 +3481,9 @@ class OperationBatch extends Provider { - case OpKind.SMART_ROLLUP_ORIGINATE: - this.withSmartRollupOriginate(param); - break; -+ case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ this.withSmartRollupExecuteOutboxMessage(param); -+ break; - default: - throw new InvalidOperationKindError$1(JSON.stringify(param.kind)); - } -@@ -4192,6 +4255,25 @@ class RPCEstimateProvider extends Provider { - return Estimate.createEstimateInstanceFromProperties(estimateProperties); - }); - } -+ /** -+ * -+ * @description Estimate gasLimit, storageLimit and fees for a smart_rollup_execute_outbox_message operation -+ * -+ * @returns An estimation of gasLimit, storageLimit and fees for the operation -+ * -+ * @param Estimate -+ */ -+ smartRollupExecuteOutboxMessage(params) { -+ return __awaiter(this, void 0, void 0, function* () { -+ const protocolConstants = yield this.context.readProvider.getProtocolConstants('head'); -+ const preparedOperation = yield this.prepare.smartRollupExecuteOutboxMessage(params); -+ const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants); -+ if (preparedOperation.opOb.contents[0].kind === 'reveal') { -+ estimateProperties.shift(); -+ } -+ return Estimate.createEstimateInstanceFromProperties(estimateProperties); -+ }); -+ } - /** - * - * @description Estimate gasLimit, storageLimit and fees for contract call -@@ -4820,6 +4902,57 @@ class SmartRollupOriginateOperation extends Operation { - } - } - -+/** -+ * -+ * @description SmartRollupExecuteOutboxMessage Operation provides utility to fetch properties for Operation of kind SmartRollupExecuteOutboxMessage -+ * -+ */ -+class SmartRollupExecuteOutboxMessageOperation extends Operation { -+ constructor(hash, params, source, raw, results, context) { -+ super(hash, raw, results, context); -+ this.params = params; -+ this.source = source; -+ } -+ get operationResults() { -+ const smartRollupExecuteOutboxMessageOp = Array.isArray(this.results) && -+ this.results.find((op) => op.kind === OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); -+ const result = smartRollupExecuteOutboxMessageOp && -+ smartRollupExecuteOutboxMessageOp.metadata && -+ smartRollupExecuteOutboxMessageOp.metadata.operation_result; -+ return result ? result : undefined; -+ } -+ get status() { -+ var _a, _b; -+ return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown'; -+ } -+ get rollup() { -+ return this.params.rollup; -+ } -+ get cementedCommitment() { -+ return this.params.cemented_commitment; -+ } -+ get outputProof() { -+ return this.params.output_proof; -+ } -+ get fee() { -+ return Number(this.params.fee); -+ } -+ get gasLimit() { -+ return Number(this.params.gas_limit); -+ } -+ get storageLimit() { -+ return Number(this.params.storage_limit); -+ } -+ get consumedMilliGas() { -+ var _a; -+ return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas; -+ } -+ get errors() { -+ var _a; -+ return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors; -+ } -+} -+ - class RpcContractProvider extends Provider { - constructor(context, estimator) { - super(context); -@@ -5298,6 +5431,22 @@ class RpcContractProvider extends Provider { - return new SmartRollupOriginateOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context); - }); - } -+ /** -+ * @description Execute a message from a smart rollup's outbox of a cemented commitment -+ * @param SmartRollupExecuteOutboxMessageParams -+ * @returns An operation handle with results from the RPC node -+ */ -+ smartRollupExecuteOutboxMessage(params) { -+ return __awaiter(this, void 0, void 0, function* () { -+ const publicKeyHash = yield this.signer.publicKeyHash(); -+ const estimate = yield this.estimate(params, this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)); -+ const prepared = yield this.prepare.smartRollupExecuteOutboxMessage(Object.assign(Object.assign({}, params), estimate)); -+ const content = prepared.opOb.contents.find((op) => op.kind === OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); -+ const opBytes = yield this.forge(prepared); -+ const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes); -+ return new SmartRollupExecuteOutboxMessageOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context); -+ }); -+ } - /** - * - * @description A failing_noop operation that is guaranteed to fail. -@@ -6195,8 +6344,8 @@ class Context { - - // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! - const VERSION = { -- "commitHash": "13a12ab7cf442043526745db2bbf4ef3b089c34a", -- "version": "19.0.2" -+ commitHash: '13a12ab7cf442043526745db2bbf4ef3b089c34a', -+ version: '19.0.2', - }; - - /** -@@ -6637,5 +6786,5 @@ class TezosToolkit { - } - } - --export { BallotOperation, BatchOperation, BigMapAbstraction, COST_PER_BYTE, ChainIds, CompositeForger, Context, ContractAbstraction, ContractMethod, ContractMethodObject, ContractView, DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_SMART_CONTRACT_METHOD_NAME, DEFAULT_STORAGE_LIMIT, DefaultGlobalConstantsProvider, DelegateOperation, DelegationWalletOperation, DrainDelegateOperation, Estimate, GlobalConstantNotFound, InvalidBalanceError, InvalidCodeParameter, InvalidDelegationSource, InvalidEstimateValueError, InvalidInitParameter, InvalidParameterError, InvalidViewSimulationContext, LegacyWalletProvider, MANAGER_LAMBDA, MichelCodecPacker, MichelCodecParser, NoopParser, ObservableSubscription, Operation, OperationBatch, OriginationOperation, OriginationParameterError, OriginationWalletOperation, PollingSubscribeProvider, PrepareProvider, Protocols, RPCEstimateProvider, RevealEstimateError, RevealOperationError, RpcForger, RpcInjector, RpcPacker, RpcReadAdapter, SaplingStateAbstraction, TaquitoLocalForger, TezosOperationError, TezosPreapplyFailureError, TezosToolkit, TransactionOperation, TransactionWalletOperation, UnconfiguredGlobalConstantsProviderError, VIEW_LAMBDA, ViewSimulationError, Wallet, WalletOperation, WalletOperationBatch, compose, createActivationOperation, createBallotOperation, createDrainDelegateOperation, createIncreasePaidStorageOperation, createOriginationOperation, createProposalsOperation, createRegisterDelegateOperation, createRegisterGlobalConstantOperation, createRevealOperation, createSetDelegateOperation, createSmartRollupAddMessagesOperation, createSmartRollupOriginateOperation, createTransferOperation, createTransferTicketOperation, createUpdateConsensusKeyOperation, defaultConfigConfirmation, getRevealGasLimit, protocols, smartContractAbstractionSemantic, validateAndExtractFailwith }; -+export { BallotOperation, BatchOperation, BigMapAbstraction, COST_PER_BYTE, ChainIds, CompositeForger, Context, ContractAbstraction, ContractMethod, ContractMethodObject, ContractView, DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_SMART_CONTRACT_METHOD_NAME, DEFAULT_STORAGE_LIMIT, DefaultGlobalConstantsProvider, DelegateOperation, DelegationWalletOperation, DrainDelegateOperation, Estimate, GlobalConstantNotFound, InvalidBalanceError, InvalidCodeParameter, InvalidDelegationSource, InvalidEstimateValueError, InvalidInitParameter, InvalidParameterError, InvalidViewSimulationContext, LegacyWalletProvider, MANAGER_LAMBDA, MichelCodecPacker, MichelCodecParser, NoopParser, ObservableSubscription, Operation, OperationBatch, OriginationOperation, OriginationParameterError, OriginationWalletOperation, PollingSubscribeProvider, PrepareProvider, Protocols, RPCEstimateProvider, RevealEstimateError, RevealOperationError, RpcForger, RpcInjector, RpcPacker, RpcReadAdapter, SaplingStateAbstraction, TaquitoLocalForger, TezosOperationError, TezosPreapplyFailureError, TezosToolkit, TransactionOperation, TransactionWalletOperation, UnconfiguredGlobalConstantsProviderError, VIEW_LAMBDA, ViewSimulationError, Wallet, WalletOperation, WalletOperationBatch, compose, createActivationOperation, createBallotOperation, createDrainDelegateOperation, createIncreasePaidStorageOperation, createOriginationOperation, createProposalsOperation, createRegisterDelegateOperation, createRegisterGlobalConstantOperation, createRevealOperation, createSetDelegateOperation, createSmartRollupAddMessagesOperation, createSmartRollupExecuteOutboxMessageOperation, createSmartRollupOriginateOperation, createTransferOperation, createTransferTicketOperation, createUpdateConsensusKeyOperation, defaultConfigConfirmation, getRevealGasLimit, protocols, smartContractAbstractionSemantic, validateAndExtractFailwith }; - //# sourceMappingURL=taquito.es6.js.map -diff --git a/node_modules/@taquito/taquito/dist/taquito.es6.js.map b/node_modules/@taquito/taquito/dist/taquito.es6.js.map -index 54a685b..62871b3 100644 ---- a/node_modules/@taquito/taquito/dist/taquito.es6.js.map -+++ b/node_modules/@taquito/taquito/dist/taquito.es6.js.map -@@ -1 +1 @@ --{"version":3,"file":"taquito.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} -\ No newline at end of file -+{"version":3,"file":"taquito.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} -\ No newline at end of file -diff --git a/node_modules/@taquito/taquito/dist/taquito.min.js b/node_modules/@taquito/taquito/dist/taquito.min.js -deleted file mode 100644 -index e11f979..0000000 ---- a/node_modules/@taquito/taquito/dist/taquito.min.js -+++ /dev/null -@@ -1,2 +0,0 @@ --/*! For license information please see taquito.min.js.LICENSE.txt */ --!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.taquito=t():e.taquito=t()}(self,(()=>(()=>{var e={3525:(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function i(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){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 a(e,t){i(e);const r=t.outputLen;if(e.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r(3525),i=r(64);class o extends i.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:r,blockLen:o}=this,s=(e=(0,i.toBytes)(e)).length;for(let n=0;no-a&&(this.process(r,0),a=0);for(let e=a;e>i&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const c=(0,i.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},6053:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r(9350),i=r(64),o=(e,t,r)=>e&t^e&r^t&r,s=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;c[e]=o+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:u,E:l,F:f,G:d,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,i.rotr)(l,6)^(0,i.rotr)(l,11)^(0,i.rotr)(l,25))+((p=l)&f^~p&d)+s[e]+c[e]|0,b=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+o(r,n,a)|0;h=d,d=f,f=l,l=u+t|0,u=a,a=n,n=r,r=t+b|0}var p;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,f=f+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,n,a,u,l,f,d,h)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends u{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}}t.sha256=(0,i.wrapConstructor)((()=>new u)),t.sha224=(0,i.wrapConstructor)((()=>new l))},64:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r(825);t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){if(!i(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=s._0&&e<=s._9?e-s._0:e>=s._A&&e<=s._F?e-(s._A-10):e>=s._a&&e<=s._f?e-(s._a-10):void 0}t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t{},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let o=0;o=0&&ee().update(u(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(u(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(u(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},9437:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5457);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e/4294967296>>>0,t,r),l(e>>>0,t,r+4),t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),f(e>>>0,t,r),f(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=f,t.writeInt32LE=f,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=h,t.writeInt64LE=h,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";var n=r(9437),i=r(2887);t.cn=128,t.k=64,t.Cv=64,t.fg=16,t.fe=16,t.zS=Math.pow(2,32)-1,t.d=255,t.lV=255;var o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),s=[[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6],[22,16,24,0,10,4,30,26,20,28,6,12,14,2,18,8],[14,18,6,2,26,24,22,28,4,12,10,20,8,0,30,16],[18,0,10,14,4,8,20,30,28,2,22,24,12,16,6,26],[4,24,12,20,0,22,16,6,8,26,14,10,30,28,2,18],[24,10,2,30,28,26,8,20,0,14,12,6,18,4,16,22],[26,22,14,28,24,2,6,18,10,0,30,8,16,12,4,20],[12,30,28,18,22,6,0,16,24,4,26,14,2,8,20,10],[20,4,16,8,14,12,2,10,30,22,18,28,6,24,26,0],[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30],[28,20,8,16,18,30,26,12,2,24,0,4,22,14,10,6]],a=function(){function e(e,r){if(void 0===e&&(e=64),this.digestLength=e,this.blockSize=t.cn,this._state=new Int32Array(o),this._buffer=new Uint8Array(t.cn),this._bufferLength=0,this._ctr=new Uint32Array(4),this._flag=new Uint32Array(4),this._lastNode=!1,this._finished=!1,this._vtmp=new Uint32Array(32),this._mtmp=new Uint32Array(32),e<1||e>t.k)throw new Error("blake2b: wrong digest length");r&&this.validateConfig(r);var i=0;r&&r.key&&(i=r.key.length);var s=1,a=1;r&&r.tree&&(s=r.tree.fanout,a=r.tree.maxDepth),this._state[0]^=e|i<<8|s<<16|a<<24,r&&r.tree&&(this._state[1]^=r.tree.leafSize,this._state[2]^=r.tree.nodeOffsetLowBits,this._state[3]^=r.tree.nodeOffsetHighBits,this._state[4]^=r.tree.nodeDepth|r.tree.innerDigestLength<<8,this._lastNode=r.tree.lastNode),r&&r.salt&&(this._state[8]^=n.readUint32LE(r.salt,0),this._state[9]^=n.readUint32LE(r.salt,4),this._state[10]^=n.readUint32LE(r.salt,8),this._state[11]^=n.readUint32LE(r.salt,12)),r&&r.personalization&&(this._state[12]^=n.readUint32LE(r.personalization,0),this._state[13]^=n.readUint32LE(r.personalization,4),this._state[14]^=n.readUint32LE(r.personalization,8),this._state[15]^=n.readUint32LE(r.personalization,12)),this._initialState=new Uint32Array(this._state),r&&r.key&&i>0&&(this._paddedKey=new Uint8Array(t.cn),this._paddedKey.set(r.key),this._buffer.set(this._paddedKey),this._bufferLength=t.cn)}return e.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=t.cn):this._bufferLength=0,i.wipe(this._ctr),i.wipe(this._flag),this._finished=!1,this},e.prototype.validateConfig=function(e){if(e.key&&e.key.length>t.Cv)throw new Error("blake2b: wrong key length");if(e.salt&&e.salt.length!==t.fe)throw new Error("blake2b: wrong salt length");if(e.personalization&&e.personalization.length!==t.fg)throw new Error("blake2b: wrong personalization length");if(e.tree){if(e.tree.fanout<0||e.tree.fanout>t.d)throw new Error("blake2b: wrong tree fanout");if(e.tree.maxDepth<0||e.tree.maxDepth>t.lV)throw new Error("blake2b: wrong tree depth");if(e.tree.leafSize<0||e.tree.leafSize>t.zS)throw new Error("blake2b: wrong leaf size");if(e.tree.innerDigestLength<0||e.tree.innerDigestLength>t.k)throw new Error("blake2b: wrong tree inner digest length")}},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var n=t.cn-this._bufferLength,i=0;if(0===r)return this;if(r>n){for(var o=0;ot.cn;){for(o=0;o>>16,O=65535&p,A=p>>>16;E+=b>>>16,O+=65535&m,A+=m>>>16,O+=(E+=(w+=65535&b)>>>16)>>>16,w=65535&(h=65535&w|E<<16),E=h>>>16,O=65535&(p=65535&O|(A+=O>>>16)<<16),A=p>>>16,E+=u>>>16,O+=65535&l,A+=l>>>16,h=65535&(w+=65535&u)|(E+=w>>>16)<<16,w=_^=p=65535&(O+=E>>>16)|(A+=O>>>16)<<16,_=y^=h,y=w,w=65535&g,E=g>>>16,O=65535&v,A=v>>>16,E+=y>>>16,O+=65535&_,A+=_>>>16,w=(b^=g=65535&(w+=65535&y)|(E+=w>>>16)<<16)<<8|(m^=v=65535&(O+=E>>>16)|(A+=O>>>16)<<16)>>>24,b=m<<8|b>>>24,m=w,w=65535&h,E=h>>>16,O=65535&p,A=p>>>16,E+=b>>>16,O+=65535&m,A+=m>>>16,O+=(E+=(w+=65535&b)>>>16)>>>16,w=65535&(h=65535&w|E<<16),E=h>>>16,O=65535&(p=65535&O|(A+=O>>>16)<<16),A=p>>>16,E+=f>>>16,O+=65535&d,A+=d>>>16,w=(y^=h=65535&(w+=65535&f)|(E+=w>>>16)<<16)<<16|(_^=p=65535&(O+=E>>>16)|(A+=O>>>16)<<16)>>>16,y=_<<16|y>>>16,_=w,w=65535&g,E=g>>>16,O=65535&v,A=v>>>16,E+=y>>>16,O+=65535&_,A+=_>>>16,w=(m^=v=65535&(O+=(E+=(w+=65535&y)>>>16)>>>16)|(A+=O>>>16)<<16)<<1|(b^=g=65535&w|E<<16)>>>31,b=b<<1|m>>>31,m=w,e[t]=h,e[o]=p,e[r]=b,e[s]=m,e[n]=g,e[a]=v,e[i]=y,e[c]=_},e.prototype._incrementCounter=function(e){for(var t=0;t<3;t++){var r=this._ctr[t]+e;if(this._ctr[t]=r>>>0,this._ctr[t]===r)return;e=1}},e.prototype._processBlock=function(e){this._incrementCounter(e);var t=this._vtmp;t.set(this._state),t.set(o,16),t[24]^=this._ctr[0],t[25]^=this._ctr[1],t[26]^=this._ctr[2],t[27]^=this._ctr[3],t[28]^=this._flag[0],t[29]^=this._flag[1],t[30]^=this._flag[2],t[31]^=this._flag[3];for(var r=this._mtmp,i=0;i<32;i++)r[i]=n.readUint32LE(this._buffer,4*i);for(var a=0;a<12;a++)this._G(t,0,8,16,24,1,9,17,25,r[s[a][0]],r[s[a][0]+1],r[s[a][1]],r[s[a][1]+1]),this._G(t,2,10,18,26,3,11,19,27,r[s[a][2]],r[s[a][2]+1],r[s[a][3]],r[s[a][3]+1]),this._G(t,4,12,20,28,5,13,21,29,r[s[a][4]],r[s[a][4]+1],r[s[a][5]],r[s[a][5]+1]),this._G(t,6,14,22,30,7,15,23,31,r[s[a][6]],r[s[a][6]+1],r[s[a][7]],r[s[a][7]+1]),this._G(t,0,10,20,30,1,11,21,31,r[s[a][8]],r[s[a][8]+1],r[s[a][9]],r[s[a][9]+1]),this._G(t,2,12,22,24,3,13,23,25,r[s[a][10]],r[s[a][10]+1],r[s[a][11]],r[s[a][11]+1]),this._G(t,4,14,16,26,5,15,17,27,r[s[a][12]],r[s[a][12]+1],r[s[a][13]],r[s[a][13]+1]),this._G(t,6,8,18,28,7,9,19,29,r[s[a][14]],r[s[a][14]+1],r[s[a][15]],r[s[a][15]+1]);for(i=0;i<16;i++)this._state[i]^=t[i]^t[i+16]},e}();t.vp=function(e,r,n){void 0===r&&(r=t.k);var i=new a(r,n);i.update(e);var o=i.digest();return i.clean(),o}},7728:(e,t,r)=>{"use strict";t.T=t.aP=t.KS=t.jQ=void 0;const n=r(1293),i=r(6756),o=r(2887);function s(e){const t=new Float64Array(16);if(e)for(let r=0;r>16&1),r[e-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,m(n,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&n[t],e[2*t+1]=n[t]>>8}function v(e,t){let r=0;for(let n=0;n<32;n++)r|=e[n]^t[n];return(1&r-1>>>8)-1}function y(e,t){const r=new Uint8Array(32),n=new Uint8Array(32);return g(r,e),g(n,t),v(r,n)}function _(e){const t=new Uint8Array(32);return g(t,e),1&t[0]}function w(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function E(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function O(e,t,r){let n,i,o=0,s=0,a=0,c=0,u=0,l=0,f=0,d=0,h=0,p=0,b=0,m=0,g=0,v=0,y=0,_=0,w=0,E=0,O=0,A=0,S=0,P=0,T=0,I=0,R=0,x=0,M=0,k=0,L=0,N=0,C=0,j=r[0],D=r[1],U=r[2],B=r[3],F=r[4],K=r[5],H=r[6],G=r[7],$=r[8],V=r[9],z=r[10],q=r[11],W=r[12],Z=r[13],J=r[14],Y=r[15];n=t[0],o+=n*j,s+=n*D,a+=n*U,c+=n*B,u+=n*F,l+=n*K,f+=n*H,d+=n*G,h+=n*$,p+=n*V,b+=n*z,m+=n*q,g+=n*W,v+=n*Z,y+=n*J,_+=n*Y,n=t[1],s+=n*j,a+=n*D,c+=n*U,u+=n*B,l+=n*F,f+=n*K,d+=n*H,h+=n*G,p+=n*$,b+=n*V,m+=n*z,g+=n*q,v+=n*W,y+=n*Z,_+=n*J,w+=n*Y,n=t[2],a+=n*j,c+=n*D,u+=n*U,l+=n*B,f+=n*F,d+=n*K,h+=n*H,p+=n*G,b+=n*$,m+=n*V,g+=n*z,v+=n*q,y+=n*W,_+=n*Z,w+=n*J,E+=n*Y,n=t[3],c+=n*j,u+=n*D,l+=n*U,f+=n*B,d+=n*F,h+=n*K,p+=n*H,b+=n*G,m+=n*$,g+=n*V,v+=n*z,y+=n*q,_+=n*W,w+=n*Z,E+=n*J,O+=n*Y,n=t[4],u+=n*j,l+=n*D,f+=n*U,d+=n*B,h+=n*F,p+=n*K,b+=n*H,m+=n*G,g+=n*$,v+=n*V,y+=n*z,_+=n*q,w+=n*W,E+=n*Z,O+=n*J,A+=n*Y,n=t[5],l+=n*j,f+=n*D,d+=n*U,h+=n*B,p+=n*F,b+=n*K,m+=n*H,g+=n*G,v+=n*$,y+=n*V,_+=n*z,w+=n*q,E+=n*W,O+=n*Z,A+=n*J,S+=n*Y,n=t[6],f+=n*j,d+=n*D,h+=n*U,p+=n*B,b+=n*F,m+=n*K,g+=n*H,v+=n*G,y+=n*$,_+=n*V,w+=n*z,E+=n*q,O+=n*W,A+=n*Z,S+=n*J,P+=n*Y,n=t[7],d+=n*j,h+=n*D,p+=n*U,b+=n*B,m+=n*F,g+=n*K,v+=n*H,y+=n*G,_+=n*$,w+=n*V,E+=n*z,O+=n*q,A+=n*W,S+=n*Z,P+=n*J,T+=n*Y,n=t[8],h+=n*j,p+=n*D,b+=n*U,m+=n*B,g+=n*F,v+=n*K,y+=n*H,_+=n*G,w+=n*$,E+=n*V,O+=n*z,A+=n*q,S+=n*W,P+=n*Z,T+=n*J,I+=n*Y,n=t[9],p+=n*j,b+=n*D,m+=n*U,g+=n*B,v+=n*F,y+=n*K,_+=n*H,w+=n*G,E+=n*$,O+=n*V,A+=n*z,S+=n*q,P+=n*W,T+=n*Z,I+=n*J,R+=n*Y,n=t[10],b+=n*j,m+=n*D,g+=n*U,v+=n*B,y+=n*F,_+=n*K,w+=n*H,E+=n*G,O+=n*$,A+=n*V,S+=n*z,P+=n*q,T+=n*W,I+=n*Z,R+=n*J,x+=n*Y,n=t[11],m+=n*j,g+=n*D,v+=n*U,y+=n*B,_+=n*F,w+=n*K,E+=n*H,O+=n*G,A+=n*$,S+=n*V,P+=n*z,T+=n*q,I+=n*W,R+=n*Z,x+=n*J,M+=n*Y,n=t[12],g+=n*j,v+=n*D,y+=n*U,_+=n*B,w+=n*F,E+=n*K,O+=n*H,A+=n*G,S+=n*$,P+=n*V,T+=n*z,I+=n*q,R+=n*W,x+=n*Z,M+=n*J,k+=n*Y,n=t[13],v+=n*j,y+=n*D,_+=n*U,w+=n*B,E+=n*F,O+=n*K,A+=n*H,S+=n*G,P+=n*$,T+=n*V,I+=n*z,R+=n*q,x+=n*W,M+=n*Z,k+=n*J,L+=n*Y,n=t[14],y+=n*j,_+=n*D,w+=n*U,E+=n*B,O+=n*F,A+=n*K,S+=n*H,P+=n*G,T+=n*$,I+=n*V,R+=n*z,x+=n*q,M+=n*W,k+=n*Z,L+=n*J,N+=n*Y,n=t[15],_+=n*j,w+=n*D,E+=n*U,O+=n*B,A+=n*F,S+=n*K,P+=n*H,T+=n*G,I+=n*$,R+=n*V,x+=n*z,M+=n*q,k+=n*W,L+=n*Z,N+=n*J,C+=n*Y,o+=38*w,s+=38*E,a+=38*O,c+=38*A,u+=38*S,l+=38*P,f+=38*T,d+=38*I,h+=38*R,p+=38*x,b+=38*M,m+=38*k,g+=38*L,v+=38*N,y+=38*C,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=_+i+65535,i=Math.floor(n/65536),_=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=f,e[7]=d,e[8]=h,e[9]=p,e[10]=b,e[11]=m,e[12]=g,e[13]=v,e[14]=y,e[15]=_}function A(e,t){O(e,t,t)}function S(e,t){const r=s();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)A(r,r),2!==n&&4!==n&&O(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}function P(e,t){const r=s(),n=s(),i=s(),o=s(),a=s(),c=s(),u=s(),f=s(),d=s();E(r,e[1],e[0]),E(d,t[1],t[0]),O(r,r,d),w(n,e[0],e[1]),w(d,t[0],t[1]),O(n,n,d),O(i,e[3],t[3]),O(i,i,l),O(o,e[2],t[2]),w(o,o,o),E(a,n,r),E(c,o,i),w(u,o,i),w(f,n,r),O(e[0],a,c),O(e[1],f,u),O(e[2],u,c),O(e[3],a,f)}function T(e,t,r){for(let n=0;n<4;n++)m(e[n],t[n],r)}function I(e,t){const r=s(),n=s(),i=s();S(i,t[2]),O(r,t[0],i),O(n,t[1],i),g(e,n),e[31]^=_(r)<<7}function R(e,t,r){p(e[0],a),p(e[1],c),p(e[2],c),p(e[3],a);for(let n=255;n>=0;--n){const i=r[n/8|0]>>(7&n)&1;T(e,t,i),P(t,e),P(e,e),T(e,t,i)}}function x(e,t){const r=[s(),s(),s(),s()];p(r[0],f),p(r[1],d),p(r[2],c),O(r[3],f,d),R(e,r,t)}function M(e){if(e.length!==t.aP)throw new Error(`ed25519: seed must be ${t.aP} bytes`);const r=(0,i.hash)(e);r[0]&=248,r[31]&=127,r[31]|=64;const n=new Uint8Array(32),o=[s(),s(),s(),s()];x(o,r),I(n,o);const a=new Uint8Array(64);return a.set(e),a.set(n,32),{publicKey:n,secretKey:a}}const k=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function L(e,t){let r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*k[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*k[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function N(e){const t=new Float64Array(64);for(let r=0;r<64;r++)t[r]=e[r];for(let t=0;t<64;t++)e[t]=0;L(e,t)}function C(e,t){const r=s(),n=s(),i=s(),o=s(),l=s(),f=s(),d=s();return p(e[2],c),function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),A(i,e[1]),O(o,i,u),E(i,i,e[2]),w(o,e[2],o),A(l,o),A(f,l),O(d,f,l),O(r,d,i),O(r,r,o),function(e,t){const r=s();let n;for(n=0;n<16;n++)r[n]=t[n];for(n=250;n>=0;n--)A(r,r),1!==n&&O(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(r,r),O(r,r,i),O(r,r,o),O(r,r,o),O(e[0],r,o),A(n,e[0]),O(n,n,o),y(n,i)&&O(e[0],e[0],h),A(n,e[0]),O(n,n,o),y(n,i)?-1:(_(e[0])===t[31]>>7&&E(e[0],a,e[0]),O(e[3],e[0],e[1]),0)}t.T=function(e,r,n){const o=new Uint8Array(32),a=[s(),s(),s(),s()],c=[s(),s(),s(),s()];if(n.length!==t.jQ)throw new Error(`ed25519: signature must be ${t.jQ} bytes`);if(C(c,e))return!1;const u=new i.SHA512;u.update(n.subarray(0,32)),u.update(e),u.update(r);const l=u.digest();return N(l),R(a,c,l),x(c,n.subarray(32)),P(a,c),I(o,a),!v(n,o)}},5457:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},1293:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(5147),i=r(9437),o=r(2887);function s(e,r=t.defaultRandomSource){return r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(e=t.defaultRandomSource){const r=s(4,e),n=(0,i.readUint32LE)(r);return(0,o.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r=a,n=t.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const c=r.length,u=256-256%c;for(;e>0;){const t=s(Math.ceil(256*e/u),n);for(let n=0;n0;n++){const o=t[n];o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(2887);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5477);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(2017),i=r(7879);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},6756:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9437),i=r(2887);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,r){if(void 0===r&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%128<112?128:256;this._buffer[r]=128;for(var c=r+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.stateHi),i.wipe(e.stateLo),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=o;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(e,t,r,i,o,a,c){for(var u,l,f,d,h,p,b,m,g=r[0],v=r[1],y=r[2],_=r[3],w=r[4],E=r[5],O=r[6],A=r[7],S=i[0],P=i[1],T=i[2],I=i[3],R=i[4],x=i[5],M=i[6],k=i[7];c>=128;){for(var L=0;L<16;L++){var N=8*L+a;e[L]=n.readUint32BE(o,N),t[L]=n.readUint32BE(o,N+4)}for(L=0;L<80;L++){var C,j,D=g,U=v,B=y,F=_,K=w,H=E,G=O,$=S,V=P,z=T,q=I,W=R,Z=x,J=M;if(h=65535&(l=k),p=l>>>16,b=65535&(u=A),m=u>>>16,h+=65535&(l=(R>>>14|w<<18)^(R>>>18|w<<14)^(w>>>9|R<<23)),p+=l>>>16,b+=65535&(u=(w>>>14|R<<18)^(w>>>18|R<<14)^(R>>>9|w<<23)),m+=u>>>16,h+=65535&(l=R&x^~R&M),p+=l>>>16,b+=65535&(u=w&E^~w&O),m+=u>>>16,u=s[2*L],h+=65535&(l=s[2*L+1]),p+=l>>>16,b+=65535&u,m+=u>>>16,u=e[L%16],p+=(l=t[L%16])>>>16,b+=65535&u,m+=u>>>16,b+=(p+=(h+=65535&l)>>>16)>>>16,h=65535&(l=d=65535&h|p<<16),p=l>>>16,b=65535&(u=f=65535&b|(m+=b>>>16)<<16),m=u>>>16,h+=65535&(l=(S>>>28|g<<4)^(g>>>2|S<<30)^(g>>>7|S<<25)),p+=l>>>16,b+=65535&(u=(g>>>28|S<<4)^(S>>>2|g<<30)^(S>>>7|g<<25)),m+=u>>>16,p+=(l=S&P^S&T^P&T)>>>16,b+=65535&(u=g&v^g&y^v&y),m+=u>>>16,C=65535&(b+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=b>>>16)<<16,j=65535&h|p<<16,h=65535&(l=q),p=l>>>16,b=65535&(u=F),m=u>>>16,p+=(l=d)>>>16,b+=65535&(u=f),m+=u>>>16,v=D,y=U,_=B,w=F=65535&(b+=(p+=(h+=65535&l)>>>16)>>>16)|(m+=b>>>16)<<16,E=K,O=H,A=G,g=C,P=$,T=V,I=z,R=q=65535&h|p<<16,x=W,M=Z,k=J,S=j,L%16==15)for(N=0;N<16;N++)u=e[N],h=65535&(l=t[N]),p=l>>>16,b=65535&u,m=u>>>16,u=e[(N+9)%16],h+=65535&(l=t[(N+9)%16]),p+=l>>>16,b+=65535&u,m+=u>>>16,f=e[(N+1)%16],h+=65535&(l=((d=t[(N+1)%16])>>>1|f<<31)^(d>>>8|f<<24)^(d>>>7|f<<25)),p+=l>>>16,b+=65535&(u=(f>>>1|d<<31)^(f>>>8|d<<24)^f>>>7),m+=u>>>16,f=e[(N+14)%16],p+=(l=((d=t[(N+14)%16])>>>19|f<<13)^(f>>>29|d<<3)^(d>>>6|f<<26))>>>16,b+=65535&(u=(f>>>19|d<<13)^(d>>>29|f<<3)^f>>>6),m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,e[N]=65535&b|m<<16,t[N]=65535&h|p<<16}h=65535&(l=S),p=l>>>16,b=65535&(u=g),m=u>>>16,u=r[0],p+=(l=i[0])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[0]=g=65535&b|m<<16,i[0]=S=65535&h|p<<16,h=65535&(l=P),p=l>>>16,b=65535&(u=v),m=u>>>16,u=r[1],p+=(l=i[1])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[1]=v=65535&b|m<<16,i[1]=P=65535&h|p<<16,h=65535&(l=T),p=l>>>16,b=65535&(u=y),m=u>>>16,u=r[2],p+=(l=i[2])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[2]=y=65535&b|m<<16,i[2]=T=65535&h|p<<16,h=65535&(l=I),p=l>>>16,b=65535&(u=_),m=u>>>16,u=r[3],p+=(l=i[3])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[3]=_=65535&b|m<<16,i[3]=I=65535&h|p<<16,h=65535&(l=R),p=l>>>16,b=65535&(u=w),m=u>>>16,u=r[4],p+=(l=i[4])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[4]=w=65535&b|m<<16,i[4]=R=65535&h|p<<16,h=65535&(l=x),p=l>>>16,b=65535&(u=E),m=u>>>16,u=r[5],p+=(l=i[5])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[5]=E=65535&b|m<<16,i[5]=x=65535&h|p<<16,h=65535&(l=M),p=l>>>16,b=65535&(u=O),m=u>>>16,u=r[6],p+=(l=i[6])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[6]=O=65535&b|m<<16,i[6]=M=65535&h|p<<16,h=65535&(l=k),p=l>>>16,b=65535&(u=A),m=u>>>16,u=r[7],p+=(l=i[7])>>>16,b+=65535&u,m+=u>>>16,m+=(b+=(p+=(h+=65535&l)>>>16)>>>16)>>>16,r[7]=A=65535&b|m<<16,i[7]=k=65535&h|p<<16,a+=128,c-=128}return a}t.hash=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},2887:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,u=new Uint8Array(o);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var f=0,d=o-1;(0!==l||f>>0,u[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,r++}for(var h=o-i;h!==o&&0===u[h];)h++;for(var p=new Uint8Array(n+(o-h)),b=n;h!==o;)p[b++]=u[h++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var c=(o-i)*u+1>>>0,l=new Uint8Array(c);i!==o;){for(var f=t[i],d=0,h=c-1;(0!==f||d>>0,l[h]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=d,i++}for(var p=c-n;p!==c&&0===l[p];)p++;for(var b=a.repeat(r);p{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],c=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),l=0,f=c>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,u=n-i;au?u:a+s));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},6391:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",f=1e14,d=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],b=1e7,m=1e9;function g(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function _(e,t,r,n){if(er||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return g(e.e/d)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function O(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?g.c=g.e=null:e.e=10;f/=10,u++);return void(u>D?g.c=g.e=null:(g.e=u,g.c=[e]))}m=String(e)}else{if(!s.test(m=String(e)))return i(g,m,p);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(u=m.indexOf("."))>-1&&(m=m.replace(".","")),(f=m.search(/e/i))>0?(u<0&&(u=f),u+=+m.slice(f+1),m=m.substring(0,f)):u<0&&(u=m.length)}else{if(_(t,2,H.length,"Base"),10==t&&G)return W(g=new $(e),k+g.e+1,L);if(m=String(e),p="number"==typeof e){if(0*e!=0)return i(g,m,p,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,$.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=H.slice(0,t),u=f=0,b=m.length;fu){u=b;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,f=-1,u=0;continue}return i(g,String(e),p,t)}p=!1,(u=(m=n(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):u=m.length}for(f=0;48===m.charCodeAt(f);f++);for(b=m.length;48===m.charCodeAt(--b););if(m=m.slice(f,++b)){if(b-=f,p&&$.DEBUG&&b>15&&(e>h||e!==c(e)))throw Error(l+g.s*e);if((u=u-f-1)>D)g.c=g.e=null;else if(u=C)?E(c,s):O(c,s,"0");else if(o=(e=W(new $(e),t,r)).e,a=(c=v(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function z(e,t){for(var r,n,i=1,o=new $(e[0]);i=10;i/=10,n++);return(r=n+r*d-1)>D?e.c=e.e=null:r=10;u/=10,i++);if((o=t-i)<0)o+=d,s=t,l=m[h=0],b=c(l/g[i-s-1]%10);else if((h=a((o+1)/d))>=m.length){if(!n)break e;for(;m.length<=h;m.push(0));l=b=0,i=1,s=(o%=d)-d+1}else{for(l=u=m[h],i=1;u>=10;u/=10,i++);b=(s=(o%=d)-d+i)<0?0:c(l/g[i-s-1]%10)}if(n=n||t<0||null!=m[h+1]||(s<0?l:l%g[i-s-1]),n=r<4?(b||n)&&(0==r||r==(e.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(o>0?s>0?l/g[i-s]:0:m[h-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(d-t%d)%d],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=h,u=1,h--):(m.length=h+1,u=g[d-o],m[h]=s>0?c(l/g[i-s]%g[s])*u:0),n)for(;;){if(0==h){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,m[0]==f&&(m[0]=1));break}if(m[h]+=u,m[h]!=f)break;m[h--]=0,u=1}for(o=m.length;0===m[--o];m.pop());}e.e>D?e.c=e.e=null:e.e=C?E(t,r):O(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,m,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-m,0,t),_(r[1],0,m,t),N=r[0],C=r[1]):(_(r,-m,m,t),N=-(C=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-m,-1,t),_(r[1],1,m,t),j=r[0],D=r[1];else{if(_(r,-m,m,t),!r)throw Error(u+t+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(u+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,m,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);G="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,C],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:K,ALPHABET:H}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%d)<1&&(t+=d),String(n[0]).length==t){for(t=0;t=f||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return z(arguments,-1)},$.minimum=$.min=function(){return z(arguments,1)},$.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,l=[],f=new $(M);if(null==e?e=k:_(e,0,m),i=a(e/d),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw U=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(l.push(o%1e14),s+=7);s=i/7}if(!U)for(;s=10;o/=10,s++);sr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,f,d,h,p,b,m=n.indexOf("."),g=k,y=L;for(m>=0&&(f=F,F=0,n=n.replace(".",""),h=(b=new $(i)).pow(n.length-m),F=f,b.c=t(O(v(h.c),h.e,"0"),10,o,e),b.e=b.c.length),l=f=(p=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(m<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=r(h,b,g,y,o)).c,d=h.r,l=h.e),m=p[u=l+g+1],f=o/2,d=d||u<0||null!=p[u+1],d=y<4?(null!=m||d)&&(0==y||y==(h.s<0?3:2)):m>f||m==f&&(4==y||d||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])n=d?O(c.charAt(1),-g,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(f=p.length;!p[--f];);for(m=0,n="";m<=f;n+=c.charAt(p[m++]));n=O(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%b,l=t/b|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%b)+(n=l*o+(s=e[c]/b|0)*u)%b*b+a)/r|0)+(n/b|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,s,a){var u,l,h,p,b,m,v,y,_,w,E,O,A,S,P,T,I,R=n.s==i.s?1:-1,x=n.c,M=i.c;if(!(x&&x[0]&&M&&M[0]))return new $(n.s&&i.s&&(x?!M||x[0]!=M[0]:M)?x&&0==x[0]||!M?0*R:R/0:NaN);for(_=(y=new $(R)).c=[],R=o+(l=n.e-i.e)+1,a||(a=f,l=g(n.e/d)-g(i.e/d),R=R/d|0),h=0;M[h]==(x[h]||0);h++);if(M[h]>(x[h]||0)&&l--,R<0)_.push(1),p=!0;else{for(S=x.length,T=M.length,h=0,R+=2,(b=c(a/(M[0]+1)))>1&&(M=e(M,b,a),x=e(x,b,a),T=M.length,S=x.length),A=T,E=(w=x.slice(0,T)).length;E=a/2&&P++;do{if(b=0,(u=t(M,w,T,E))<0){if(O=w[0],T!=E&&(O=O*a+(w[1]||0)),(b=c(O/P))>1)for(b>=a&&(b=a-1),v=(m=e(M,b,a)).length,E=w.length;1==t(m,w,v,E);)b--,r(m,T=10;R/=10,h++);W(y,o+(y.e=h+l*d-1)+1,s,p)}else y.e=l,y.r=+p;return y}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(P,"$1").replace(T,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return y(this,new $(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return _(e,0,m),null==t?t=L:_(t,0,8),W(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-g(this.e/d))*d,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new $(e,t),k,L)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new $(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,i,o,s,l,f,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Z(e));if(null!=t&&(t=new $(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Z(p),s?e.s*(2-w(e)):+Z(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!l&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&w(e)?-0:0,p.e>-1&&(o=1/o),new $(l?1/o:o);F&&(o=a(F/d+2))}for(s?(r=new $(.5),l&&(e.s=1),f=w(e)):f=(i=Math.abs(+Z(e)))%2,h=new $(M);;){if(f){if(!(h=h.times(p)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}if(i){if(0===(i=c(i/2)))break;f=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)f=w(e);else{if(0===(i=+Z(e)))break;f=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?h:(l&&(h=M.div(h)),t?h.mod(t):o?W(h,F,L,undefined):h)},x.integerValue=function(e){var t=new $(this);return null==e?e=L:_(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===y(this,new $(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return y(this,new $(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=y(this,new $(e,t)))||0===t},x.isInteger=function(){return!!this.c&&g(this.e/d)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return y(this,new $(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=y(this,new $(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/d,u=e.e/d,l=s.c,h=e.c;if(!c||!u){if(!l||!h)return l?(e.s=-t,e):new $(h?s:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new $(l[0]?s:3==L?-0:0)}if(c=g(c),u=g(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=l.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;l[r++]=0);for(t=f-1;n>a;){if(l[--n]=0;){for(r=0,p=O[i]%_,m=O[i]/_|0,o=i+(s=c);o>i;)r=((u=p*(u=E[--s]%_)+(a=m*u+(l=E[s]/_|0)*p)%_*_+v[o]+r)/y|0)+(a/_|0)+m*l,v[o--]=u%y;v[o]=r}return r?++n:v.splice(0,1),q(e,v,n)},x.negated=function(){var e=new $(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/d,s=e.e/d,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new $(i/0);if(!a[0]||!c[0])return c[0]?e:new $(a[0]?n:0*i)}if(o=g(o),s=g(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/f|0,a[t]=f===a[t]?0:a[t]%f;return i&&(a=[i].concat(a),++s),q(e,a,s)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return _(e,1,m),null==t?t=L:_(t,0,8),W(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*d+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return _(e,-9007199254740991,h),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=k+4,f=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Z(s)))||c==1/0?(((t=v(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=g((u+1)/2)-(u<0||u%2),n=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(s,o,l,1))),v(o.c).slice(0,c)===(t=v(n.c)).slice(0,c)){if(n.e0&&b>0){for(o=b%a||a,f=p.substr(0,o);o0&&(f+=l+p.slice(o)),h&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,s,a,c,l,f,h,b,m,g=this,y=g.c;if(null!=e&&(!(c=new $(e)).isInteger()&&(c.c||1!==c.s)||c.lt(M)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!y)return new $(g);for(t=new $(M),f=n=new $(M),i=l=new $(M),m=v(y),s=t.e=m.length-g.e-1,t.c[0]=p[(a=s%d)<0?d+a:a],e=!e||c.comparedTo(t)>0?s>0?t:f:c,a=D,D=1/0,c=new $(m),l.c[0]=0;h=r(c,t,0,1),1!=(o=n.plus(h.times(i))).comparedTo(e);)n=i,i=o,f=l.plus(h.times(o=f)),l=o,t=c.minus(h.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),l=l.plus(o.times(f)),n=n.plus(o.times(i)),l.s=f.s=g.s,b=r(f,i,s*=2,L).minus(g).abs().comparedTo(r(l,n,s,L).minus(g).abs())<1?[f,i]:[l,n],D=a,b},x.toNumber=function(){return+Z(this)},x.toPrecision=function(e,t){return null!=e&&_(e,1,m),V(this,e,t,2)},x.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=N||o>=C?E(v(r.c),o):O(v(r.c),o,"0"):10===e&&G?t=O(v((r=W(new $(r),k+o+1,L)).c),r.e,"0"):(_(e,2,H.length,"Base"),t=n(O(v(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,null!=t&&$.set(t),$}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},651:(e,t,r)=>{const n=r(7967);function i(e,t,r){const n=e[t]+e[r];let i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function o(e,t,r,n){let i=e[t]+r;r<0&&(i+=4294967296);let o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,s,a){const c=f[s],u=f[s+1],d=f[a],h=f[a+1];i(l,e,t),o(l,e,c,u);let p=l[n]^l[e],b=l[n+1]^l[e+1];l[n]=b,l[n+1]=p,i(l,r,n),p=l[t]^l[r],b=l[t+1]^l[r+1],l[t]=p>>>24^b<<8,l[t+1]=b>>>24^p<<8,i(l,e,t),o(l,e,d,h),p=l[n]^l[e],b=l[n+1]^l[e+1],l[n]=p>>>16^b<<16,l[n+1]=b>>>16^p<<16,i(l,r,n),p=l[t]^l[r],b=l[t+1]^l[r+1],l[t]=b>>>31^p<<1,l[t+1]=p>>>31^b<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),f=new Uint32Array(32);function d(e,t){let r=0;for(r=0;r<16;r++)l[r]=e.h[r],l[r+16]=c[r];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),r=0;r<32;r++)f[r]=s(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,u[16*r+0],u[16*r+1]),a(2,10,18,26,u[16*r+2],u[16*r+3]),a(4,12,20,28,u[16*r+4],u[16*r+5]),a(6,14,22,30,u[16*r+6],u[16*r+7]),a(0,10,20,30,u[16*r+8],u[16*r+9]),a(2,12,22,24,u[16*r+10],u[16*r+11]),a(4,14,16,26,u[16*r+12],u[16*r+13]),a(6,8,18,28,u[16*r+14],u[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^l[r]^l[r+16]}const h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,r,n){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&16!==r.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(n&&16!==n.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};h.fill(0),h[0]=e,t&&(h[1]=t.length),h[2]=1,h[3]=1,r&&h.set(r,32),n&&h.set(n,48);for(let e=0;e<16;e++)i.h[e]=c[e]^s(h,4*e);return t&&(b(i,t),i.c=128),i}function b(e,t){for(let r=0;r>2]>>8*(3&r);return t}function g(e,t,r,i,o){r=r||64,e=n.normalizeInput(e),i&&(i=n.normalizeInput(i)),o&&(o=n.normalizeInput(o));const s=p(r,t,i,o);return b(s,e),m(s)}e.exports={blake2b:g,blake2bHex:function(e,t,r,i,o){const s=g(e,t,r,i,o);return n.toHex(s)},blake2bInit:p,blake2bUpdate:b,blake2bFinal:m}},9962:(e,t,r)=>{const n=r(7967);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,r,n,i,o){u[e]=u[e]+u[t]+i,u[n]=s(u[n]^u[e],16),u[r]=u[r]+u[n],u[t]=s(u[t]^u[r],12),u[e]=u[e]+u[t]+o,u[n]=s(u[n]^u[e],8),u[r]=u[r]+u[n],u[t]=s(u[t]^u[r],7)}function s(e,t){return e>>>t^e<<32-t}const a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),u=new Uint32Array(16),l=new Uint32Array(16);function f(e,t){let r=0;for(r=0;r<8;r++)u[r]=e.h[r],u[r+8]=a[r];for(u[12]^=e.t,u[13]^=e.t/4294967296,t&&(u[14]=~u[14]),r=0;r<16;r++)l[r]=i(e.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,l[c[16*r+0]],l[c[16*r+1]]),o(1,5,9,13,l[c[16*r+2]],l[c[16*r+3]]),o(2,6,10,14,l[c[16*r+4]],l[c[16*r+5]]),o(3,7,11,15,l[c[16*r+6]],l[c[16*r+7]]),o(0,5,10,15,l[c[16*r+8]],l[c[16*r+9]]),o(1,6,11,12,l[c[16*r+10]],l[c[16*r+11]]),o(2,7,8,13,l[c[16*r+12]],l[c[16*r+13]]),o(3,4,9,14,l[c[16*r+14]],l[c[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=u[r]^u[r+8]}function d(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");const r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");const n={h:new Uint32Array(a),b:new Uint8Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(h(n,t),n.c=64),n}function h(e,t){for(let r=0;r>2]>>8*(3&r)&255;return t}function b(e,t,r){r=r||32,e=n.normalizeInput(e);const i=d(r,t);return h(i,e),p(i)}e.exports={blake2s:b,blake2sHex:function(e,t,r){const i=b(e,t,r);return n.toHex(i)},blake2sInit:d,blake2sUpdate:h,blake2sFinal:p}},1395:(e,t,r)=>{const n=r(651),i=r(9962);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},7967:e=>{function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,r,n){let i="\n"+e+" = ";for(let o=0;o=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.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++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=c(e,t,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var l=["","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"],f=[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],d=[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,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&s}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.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>>24-i&16777215)||s!==this.length-1?l[6-c.length]+c+r:c+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 u=f[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?b+r:l[u-b.length]+b+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")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){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"),this.strip();var s,a,c="le"===t,u=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.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;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.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<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,h=0|s[1],p=8191&h,b=h>>>13,m=0|s[2],g=8191&m,v=m>>>13,y=0|s[3],_=8191&y,w=y>>>13,E=0|s[4],O=8191&E,A=E>>>13,S=0|s[5],P=8191&S,T=S>>>13,I=0|s[6],R=8191&I,x=I>>>13,M=0|s[7],k=8191&M,L=M>>>13,N=0|s[8],C=8191&N,j=N>>>13,D=0|s[9],U=8191&D,B=D>>>13,F=0|a[0],K=8191&F,H=F>>>13,G=0|a[1],$=8191&G,V=G>>>13,z=0|a[2],q=8191&z,W=z>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],fe=8191&le,de=le>>>13,he=0|a[9],pe=8191&he,be=he>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(u+(n=Math.imul(f,K))|0)+((8191&(i=(i=Math.imul(f,H))+Math.imul(d,K)|0))<<13)|0;u=((o=Math.imul(d,H))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,K),i=(i=Math.imul(p,H))+Math.imul(b,K)|0,o=Math.imul(b,H);var ge=(u+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,K),i=(i=Math.imul(g,H))+Math.imul(v,K)|0,o=Math.imul(v,H),n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,V)|0;var ve=(u+(n=n+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,q)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(_,K),i=(i=Math.imul(_,H))+Math.imul(w,K)|0,o=Math.imul(w,H),n=n+Math.imul(g,$)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(b,q)|0,o=o+Math.imul(b,W)|0;var ye=(u+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,J)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(O,K),i=(i=Math.imul(O,H))+Math.imul(A,K)|0,o=Math.imul(A,H),n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,V)|0,n=n+Math.imul(g,q)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Y)|0;var _e=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,K),i=(i=Math.imul(P,H))+Math.imul(T,K)|0,o=Math.imul(T,H),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(_,q)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(g,J)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var we=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(R,K),i=(i=Math.imul(R,H))+Math.imul(x,K)|0,o=Math.imul(x,H),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(A,q)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(w,J)|0,o=o+Math.imul(w,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Ee=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,se)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(k,K),i=(i=Math.imul(k,H))+Math.imul(L,K)|0,o=Math.imul(L,H),n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var Oe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(C,K),i=(i=Math.imul(C,H))+Math.imul(j,K)|0,o=Math.imul(j,H),n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,V)|0,n=n+Math.imul(R,q)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,W)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0;var Ae=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,K),i=(i=Math.imul(U,H))+Math.imul(B,K)|0,o=Math.imul(B,H),n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,V)|0,n=n+Math.imul(k,q)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(R,J)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,se)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(v,ce)|0,o=o+Math.imul(v,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,fe)|0,o=o+Math.imul(b,de)|0;var Se=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,be)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,V))+Math.imul(B,$)|0,o=Math.imul(B,V),n=n+Math.imul(C,q)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,W)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Y)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(w,ce)|0,o=o+Math.imul(w,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,fe)|0,o=o+Math.imul(v,de)|0;var Pe=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(B,q)|0,o=Math.imul(B,W),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,n=n+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(_,fe)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,de)|0;var Te=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,be)|0)+Math.imul(v,pe)|0))<<13)|0;u=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,J),i=(i=Math.imul(U,Y))+Math.imul(B,J)|0,o=Math.imul(B,Y),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,n=n+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,ue)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,ue)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(A,fe)|0,o=o+Math.imul(A,de)|0;var Ie=(u+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,be)|0)+Math.imul(w,pe)|0))<<13)|0;u=((o=o+Math.imul(w,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(B,Q)|0,o=Math.imul(B,ee),n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,ue)|0,n=n+Math.imul(P,fe)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(T,fe)|0,o=o+Math.imul(T,de)|0;var Re=(u+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,be)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(B,re)|0,o=Math.imul(B,ne),n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,se)|0,n=n+Math.imul(k,ce)|0,i=(i=i+Math.imul(k,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,de)|0;var xe=(u+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,be)|0)+Math.imul(T,pe)|0))<<13)|0;u=((o=o+Math.imul(T,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(B,oe)|0,o=Math.imul(B,se),n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(j,ce)|0,o=o+Math.imul(j,ue)|0,n=n+Math.imul(k,fe)|0,i=(i=i+Math.imul(k,de)|0)+Math.imul(L,fe)|0,o=o+Math.imul(L,de)|0;var Me=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(x,pe)|0))<<13)|0;u=((o=o+Math.imul(x,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(B,ce)|0,o=Math.imul(B,ue),n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(j,fe)|0,o=o+Math.imul(j,de)|0;var ke=(u+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,be)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,be)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,fe),i=(i=Math.imul(U,de))+Math.imul(B,fe)|0,o=Math.imul(B,de);var Le=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(j,pe)|0))<<13)|0;u=((o=o+Math.imul(j,be)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ne=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,be))+Math.imul(B,pe)|0))<<13)|0;return u=((o=Math.imul(B,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=me,c[1]=ge,c[2]=ve,c[3]=ye,c[4]=_e,c[5]=we,c[6]=Ee,c[7]=Oe,c[8]=Ae,c[9]=Se,c[10]=Pe,c[11]=Te,c[12]=Ie,c[13]=Re,c[14]=xe,c[15]=Me,c[16]=ke,c[17]=Le,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):n<63?h(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):b(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=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>>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=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=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<=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},o.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>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(d=Math.min(d/s|0,67108863),n._ishlnsubmul(i,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);a&&(a.words[f]=d)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,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 o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.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 i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(f)),i.iushrn(1),s.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(f)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(c)):(r.isub(t),a.isub(i),c.isub(s))}return{a,b:c,gcd:r.iushln(u)}},o.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 i,s=new o(1),a=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var f=0,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.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:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new O(e)},o.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)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(e){if("string"==typeof e){var t=o._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 A(e){O.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}v.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},i(y,v),y.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new _;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return g[e]=t,t},O.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},O.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")},O.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},O.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},O.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},O.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},O.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},O.prototype.isqr=function(e){return this.imul(e,e.clone())},O.prototype.sqr=function(e){return this.mul(e,e)},O.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 o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var b=h,m=0;0!==b.cmp(a);m++)b=b.redSqr();n(m=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==s?(s<<=1,s|=f,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},O.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},O.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,O),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},2745:(e,t,r)=>{var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{const n=r(8166);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8616:(e,t,r)=>{"use strict";var n=r(7022);e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),i=e(r),o=r.length+4,s=new Uint8Array(o);return s.set(r,0),s.set(i.subarray(0,4),r.length),n.encode(s,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},4075:(e,t,r)=>{"use strict";var{sha256:n}=r(6053),i=r(8616);e.exports=i((function(e){return n(n(e))}))},8834:(e,t,r)=>{"use strict";const n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|b(e,t);let n=a(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(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(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?a(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 c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(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 f(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function b(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(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 r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=b,c.prototype._isBuffer=!0,c.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;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.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===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function C(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||j(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||k(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||k(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||k(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||k(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||k(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||k(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||k(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||k(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||k(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){L(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeBigUInt64LE=X((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=X((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=r-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+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(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},c.prototype.writeBigInt64LE=X((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=X((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function H(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||$(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=K(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=K(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},7554:(e,t,r)=>{"use strict";var n=t;n.version=r(763).i8,n.utils=r(8288),n.rand=r(2745),n.curve=r(8610),n.curves=r(1479),n.ec=r(8596),n.eddsa=r(9208)},8919:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength),i=(1<=s;l--)c=(c<<1)+n[l];u.push(c)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=i;h>0;h--){for(s=0;s=0;u--){for(var l=0;u>=0&&0===s[u];u--)l++;if(u>=0&&l++,c=c.dblp(l),u<0)break;var f=s[u];a(0!==f),c="affine"===e.type?f>0?c.mixedAdd(i[f-1>>1]):c.mixedAdd(i[-f-1>>1].neg()):f>0?c.add(i[f-1>>1]):c.add(i[-f-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){var a,c,u,l=this._wnafT1,f=this._wnafT2,d=this._wnafT3,h=0;for(a=0;a=1;a-=2){var b=a-1,m=a;if(1===l[b]&&1===l[m]){var g=[t[b],null,null,t[m]];0===t[b].y.cmp(t[m].y)?(g[1]=t[b].add(t[m]),g[2]=t[b].toJ().mixedAdd(t[m].neg())):0===t[b].y.cmp(t[m].y.redNeg())?(g[1]=t[b].toJ().mixedAdd(t[m]),g[2]=t[b].add(t[m].neg())):(g[1]=t[b].toJ().mixedAdd(t[m]),g[2]=t[b].toJ().mixedAdd(t[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=s(r[b],r[m]);for(h=Math.max(y[0].length,h),d[b]=new Array(h),d[m]=new Array(h),c=0;c=0;a--){for(var A=0;a>=0;){var S=!0;for(c=0;c=0&&A++,E=E.dblp(A),a<0)break;for(c=0;c0?u=f[c][P-1>>1]:P<0&&(u=f[c][-P-1>>1].neg()),E="affine"===u.type?E.mixedAdd(u):E.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{"use strict";var n=r(8288),i=r(2197),o=r(1285),s=r(8919),a=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,s.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,o){s.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,s),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},o(u,s.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),c=i.redMul(s),u=o.redMul(a),l=i.redMul(a),f=s.redMul(o);return this.curve.point(c,u,f,l)},u.prototype._projDbl=function(){var e,t,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(a.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(t),u=o.redMul(s),l=a.redMul(c),f=o.redMul(c),d=s.redMul(a);return this.curve.point(u,l,d,f)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),f=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(f,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},8610:(e,t,r)=>{"use strict";var n=t;n.base=r(8919),n.short=r(7715),n.mont=r(5125),n.edwards=r(7105)},5125:(e,t,r)=>{"use strict";var n=r(2197),i=r(1285),o=r(8919),s=r(8288);function a(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},7715:(e,t,r)=>{"use strict";var n=r(8288),i=r(2197),o=r(1285),s=r(8919),a=n.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,o,s,a,c,u,l,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),p=new i(1),b=new i(0),m=new i(0),g=new i(1),v=0;0!==d.cmpn(0);){var y=h.div(d);u=h.sub(y.mul(d)),l=m.sub(y.mul(p));var _=g.sub(y.mul(b));if(!n&&u.cmp(f)<0)t=c.neg(),r=p,n=u.neg(),o=l;else if(n&&2==++v)break;c=u,h=d,d=u,m=p,p=l,g=b,b=_}s=u.neg(),a=l;var w=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(w)>=0&&(s=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,s.BasePoint),c.prototype.jpoint=function(e,t,r){return new l(this,e,t,r)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,h,p)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=r.redMul(c),f=a.redSqr().redIAdd(u).redISub(l).redISub(l),d=a.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(s);return this.curve.jpoint(f,d,h)},l.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},1479:(e,t,r)=>{"use strict";var n,i=t,o=r(4485),s=r(8610),a=r(8288).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(7983)}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},8596:(e,t,r)=>{"use strict";var n=r(2197),i=r(8873),o=r(8288),s=r(1479),a=r(2745),c=o.assert,u=r(2307),l=r(1798);function f(e){if(!(this instanceof f))return new f(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=f,f.prototype.keyPair=function(e){return new u(this,e)},f.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},f.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},f.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(t.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},f.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},f.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),f=this.n.sub(new n(1)),d=0;;d++){var h=o.k?o.k(d):new n(u.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(f)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var g=h.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(0!==(g=g.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return o.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),v^=1),new l({r:m,s:g,recoveryParam:v})}}}}}},f.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new l(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),f)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),f)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new l(t,i);var o=this.n,s=new n(e),a=t.r,u=t.s,f=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var h=t.r.invm(o),p=o.sub(s).mul(h).umod(o),b=u.mul(h).umod(o);return this.g.mulAdd(p,a,b)},f.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new l(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},2307:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},1798:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;var u=e.slice(r.place,s+r.place);if(r.place+=s,2!==e[r.place++])return!1;var l=c(e,r);if(!1===l)return!1;if(e.length!==l+r.place)return!1;var f=e.slice(r.place,l+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new n(u),this.s=new n(f),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,t.length),(n=n.concat(t)).push(2),l(n,r.length);var o=n.concat(r),s=[48];return l(s,o.length),s=s.concat(o),i.encode(s,e)}},9208:(e,t,r)=>{"use strict";var n=r(4485),i=r(1479),o=r(8288),s=o.assert,a=o.parseBytes,c=r(851),u=r(6117);function l(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=l,l.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},l.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t{"use strict";var n=r(8288),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},6117:(e,t,r)=>{"use strict";var n=r(2197),i=r(8288),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}s(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},7983:e=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},8288:(e,t,r)=>{"use strict";var n=t,i=r(2197),o=r(9561),s=r(3022);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0==(1&c)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(s),a=0==(1&u)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},5695:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var r,n="boolean"==typeof t.cycles&&t.cycles,i=t.cmp&&(r=t.cmp,function(e){return function(t,n){var i={key:t,value:e[t]},o={key:n,value:e[n]};return r(i,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var r,s;if(Array.isArray(t)){for(s="[",r=0;r{var n=t;n.utils=r(212),n.common=r(4495),n.sha=r(5530),n.ripemd=r(1396),n.hmac=r(5047),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},4495:(e,t,r)=>{"use strict";var n=r(212),i=r(9561);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(212),i=r(9561);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(212),i=r(4495),o=n.rotl32,s=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function l(){if(!(this instanceof l))return new l;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function h(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(l,u),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],l=this.h[4],v=r,y=n,_=i,w=u,E=l,O=0;O<80;O++){var A=s(o(c(r,f(O,n,i,u),e[p[O]+t],d(O)),m[O]),l);r=l,l=u,u=o(i,10),i=n,n=A,A=s(o(c(v,f(79-O,y,_,w),e[b[O]+t],h(O)),g[O]),E),v=E,E=w,w=o(_,10),_=y,y=A}A=a(this.h[1],i,w),this.h[1]=a(this.h[2],u,E),this.h[2]=a(this.h[3],l,v),this.h[3]=a(this.h[4],r,y),this.h[4]=a(this.h[0],n,_),this.h[0]=A},l.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},5530:(e,t,r)=>{"use strict";t.sha1=r(5079),t.sha224=r(3823),t.sha256=r(8032),t.sha384=r(5328),t.sha512=r(168)},5079:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,l=i.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(d,l),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212),i=r(8032);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},8032:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(713),s=r(9561),a=n.sum32,c=n.sum32_4,u=n.sum32_5,l=o.ch32,f=o.maj32,d=o.s0_256,h=o.s1_256,p=o.g0_256,b=o.g1_256,m=i.BlockHash,g=[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];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}n.inherits(v,m),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212),i=r(168);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},168:(e,t,r)=>{"use strict";var n=r(212),i=r(4495),o=r(9561),s=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,l=n.sum64,f=n.sum64_hi,d=n.sum64_lo,h=n.sum64_4_hi,p=n.sum64_4_lo,b=n.sum64_5_hi,m=n.sum64_5_lo,g=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function _(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function w(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function E(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function O(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function A(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function I(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(y,g),e.exports=y,y.blockSize=1024,y.outSize=512,y.hmacStrength=192,y.padLength=128,y.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(212).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},212:(e,t,r)=>{"use strict";var n=r(9561),i=r(1285);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,c,u){return t+n+o+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},8873:(e,t,r)=>{"use strict";var n=r(4485),i=r(3022),o=r(9561);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,l=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=u}return(h?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,b=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=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=p,a/=256,i-=8);for(s=s<0;e[r+h]=255&s,h+=p,s/=256,u-=8);e[r+h-p]|=128*b}},1285:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},9561:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},3022:(e,t)=>{"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},977:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.interval=t.iif=t.generate=t.fromEventPattern=t.fromEvent=t.from=t.forkJoin=t.empty=t.defer=t.connectable=t.concat=t.combineLatest=t.bindNodeCallback=t.bindCallback=t.UnsubscriptionError=t.TimeoutError=t.SequenceError=t.ObjectUnsubscribedError=t.NotFoundError=t.EmptyError=t.ArgumentOutOfRangeError=t.firstValueFrom=t.lastValueFrom=t.isObservable=t.identity=t.noop=t.pipe=t.NotificationKind=t.Notification=t.Subscriber=t.Subscription=t.Scheduler=t.VirtualAction=t.VirtualTimeScheduler=t.animationFrameScheduler=t.animationFrame=t.queueScheduler=t.queue=t.asyncScheduler=t.async=t.asapScheduler=t.asap=t.AsyncSubject=t.ReplaySubject=t.BehaviorSubject=t.Subject=t.animationFrames=t.observable=t.ConnectableObservable=t.Observable=void 0,t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.combineLatestWith=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=t.config=t.NEVER=t.EMPTY=t.scheduled=t.zip=t.using=t.timer=t.throwError=t.range=t.race=t.partition=t.pairs=t.onErrorResumeNext=t.of=t.never=t.merge=void 0,t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.pairwise=t.onErrorResumeNextWith=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=t.mergeAll=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=void 0,t.zipWith=t.zipAll=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=void 0;var o=r(4174);Object.defineProperty(t,"Observable",{enumerable:!0,get:function(){return o.Observable}});var s=r(7165);Object.defineProperty(t,"ConnectableObservable",{enumerable:!0,get:function(){return s.ConnectableObservable}});var a=r(4595);Object.defineProperty(t,"observable",{enumerable:!0,get:function(){return a.observable}});var c=r(2447);Object.defineProperty(t,"animationFrames",{enumerable:!0,get:function(){return c.animationFrames}});var u=r(5294);Object.defineProperty(t,"Subject",{enumerable:!0,get:function(){return u.Subject}});var l=r(8114);Object.defineProperty(t,"BehaviorSubject",{enumerable:!0,get:function(){return l.BehaviorSubject}});var f=r(8806);Object.defineProperty(t,"ReplaySubject",{enumerable:!0,get:function(){return f.ReplaySubject}});var d=r(9960);Object.defineProperty(t,"AsyncSubject",{enumerable:!0,get:function(){return d.AsyncSubject}});var h=r(3769);Object.defineProperty(t,"asap",{enumerable:!0,get:function(){return h.asap}}),Object.defineProperty(t,"asapScheduler",{enumerable:!0,get:function(){return h.asapScheduler}});var p=r(7152);Object.defineProperty(t,"async",{enumerable:!0,get:function(){return p.async}}),Object.defineProperty(t,"asyncScheduler",{enumerable:!0,get:function(){return p.asyncScheduler}});var b=r(4093);Object.defineProperty(t,"queue",{enumerable:!0,get:function(){return b.queue}}),Object.defineProperty(t,"queueScheduler",{enumerable:!0,get:function(){return b.queueScheduler}});var m=r(8989);Object.defineProperty(t,"animationFrame",{enumerable:!0,get:function(){return m.animationFrame}}),Object.defineProperty(t,"animationFrameScheduler",{enumerable:!0,get:function(){return m.animationFrameScheduler}});var g=r(2929);Object.defineProperty(t,"VirtualTimeScheduler",{enumerable:!0,get:function(){return g.VirtualTimeScheduler}}),Object.defineProperty(t,"VirtualAction",{enumerable:!0,get:function(){return g.VirtualAction}});var v=r(6949);Object.defineProperty(t,"Scheduler",{enumerable:!0,get:function(){return v.Scheduler}});var y=r(4666);Object.defineProperty(t,"Subscription",{enumerable:!0,get:function(){return y.Subscription}});var _=r(7747);Object.defineProperty(t,"Subscriber",{enumerable:!0,get:function(){return _.Subscriber}});var w=r(9828);Object.defineProperty(t,"Notification",{enumerable:!0,get:function(){return w.Notification}}),Object.defineProperty(t,"NotificationKind",{enumerable:!0,get:function(){return w.NotificationKind}});var E=r(5250);Object.defineProperty(t,"pipe",{enumerable:!0,get:function(){return E.pipe}});var O=r(7116);Object.defineProperty(t,"noop",{enumerable:!0,get:function(){return O.noop}});var A=r(8987);Object.defineProperty(t,"identity",{enumerable:!0,get:function(){return A.identity}});var S=r(3659);Object.defineProperty(t,"isObservable",{enumerable:!0,get:function(){return S.isObservable}});var P=r(4798);Object.defineProperty(t,"lastValueFrom",{enumerable:!0,get:function(){return P.lastValueFrom}});var T=r(7327);Object.defineProperty(t,"firstValueFrom",{enumerable:!0,get:function(){return T.firstValueFrom}});var I=r(9216);Object.defineProperty(t,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return I.ArgumentOutOfRangeError}});var R=r(9088);Object.defineProperty(t,"EmptyError",{enumerable:!0,get:function(){return R.EmptyError}});var x=r(5722);Object.defineProperty(t,"NotFoundError",{enumerable:!0,get:function(){return x.NotFoundError}});var M=r(8499);Object.defineProperty(t,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return M.ObjectUnsubscribedError}});var k=r(7298);Object.defineProperty(t,"SequenceError",{enumerable:!0,get:function(){return k.SequenceError}});var L=r(1316);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return L.TimeoutError}});var N=r(4043);Object.defineProperty(t,"UnsubscriptionError",{enumerable:!0,get:function(){return N.UnsubscriptionError}});var C=r(6238);Object.defineProperty(t,"bindCallback",{enumerable:!0,get:function(){return C.bindCallback}});var j=r(2375);Object.defineProperty(t,"bindNodeCallback",{enumerable:!0,get:function(){return j.bindNodeCallback}});var D=r(508);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return D.combineLatest}});var U=r(3364);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return U.concat}});var B=r(5360);Object.defineProperty(t,"connectable",{enumerable:!0,get:function(){return B.connectable}});var F=r(9623);Object.defineProperty(t,"defer",{enumerable:!0,get:function(){return F.defer}});var K=r(6929);Object.defineProperty(t,"empty",{enumerable:!0,get:function(){return K.empty}});var H=r(9220);Object.defineProperty(t,"forkJoin",{enumerable:!0,get:function(){return H.forkJoin}});var G=r(4417);Object.defineProperty(t,"from",{enumerable:!0,get:function(){return G.from}});var $=r(9671);Object.defineProperty(t,"fromEvent",{enumerable:!0,get:function(){return $.fromEvent}});var V=r(7357);Object.defineProperty(t,"fromEventPattern",{enumerable:!0,get:function(){return V.fromEventPattern}});var z=r(3482);Object.defineProperty(t,"generate",{enumerable:!0,get:function(){return z.generate}});var q=r(550);Object.defineProperty(t,"iif",{enumerable:!0,get:function(){return q.iif}});var W=r(3154);Object.defineProperty(t,"interval",{enumerable:!0,get:function(){return W.interval}});var Z=r(2039);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return Z.merge}});var J=r(2980);Object.defineProperty(t,"never",{enumerable:!0,get:function(){return J.never}});var Y=r(1377);Object.defineProperty(t,"of",{enumerable:!0,get:function(){return Y.of}});var X=r(8362);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return X.onErrorResumeNext}});var Q=r(968);Object.defineProperty(t,"pairs",{enumerable:!0,get:function(){return Q.pairs}});var ee=r(6394);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ee.partition}});var te=r(6849);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return te.race}});var re=r(7284);Object.defineProperty(t,"range",{enumerable:!0,get:function(){return re.range}});var ne=r(40);Object.defineProperty(t,"throwError",{enumerable:!0,get:function(){return ne.throwError}});var ie=r(8069);Object.defineProperty(t,"timer",{enumerable:!0,get:function(){return ie.timer}});var oe=r(3348);Object.defineProperty(t,"using",{enumerable:!0,get:function(){return oe.using}});var se=r(4981);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return se.zip}});var ae=r(2862);Object.defineProperty(t,"scheduled",{enumerable:!0,get:function(){return ae.scheduled}});var ce=r(6929);Object.defineProperty(t,"EMPTY",{enumerable:!0,get:function(){return ce.EMPTY}});var ue=r(2980);Object.defineProperty(t,"NEVER",{enumerable:!0,get:function(){return ue.NEVER}}),i(r(2793),t);var le=r(9179);Object.defineProperty(t,"config",{enumerable:!0,get:function(){return le.config}});var fe=r(2605);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return fe.audit}});var de=r(4152);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return de.auditTime}});var he=r(5149);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return he.buffer}});var pe=r(3189);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return pe.bufferCount}});var be=r(9459);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return be.bufferTime}});var me=r(8145);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return me.bufferToggle}});var ge=r(7764);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return ge.bufferWhen}});var ve=r(3056);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return ve.catchError}});var ye=r(498);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return ye.combineAll}});var _e=r(7484);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return _e.combineLatestAll}});var we=r(4755);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return we.combineLatestWith}});var Ee=r(482);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return Ee.concatAll}});var Oe=r(1774);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return Oe.concatMap}});var Ae=r(3977);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return Ae.concatMapTo}});var Se=r(7672);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return Se.concatWith}});var Pe=r(5561);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return Pe.connect}});var Te=r(8259);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return Te.count}});var Ie=r(3473);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return Ie.debounce}});var Re=r(8390);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return Re.debounceTime}});var xe=r(4562);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return xe.defaultIfEmpty}});var Me=r(8151);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return Me.delay}});var ke=r(744);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return ke.delayWhen}});var Le=r(8590);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return Le.dematerialize}});var Ne=r(8406);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return Ne.distinct}});var Ce=r(7300);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return Ce.distinctUntilChanged}});var je=r(4405);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return je.distinctUntilKeyChanged}});var De=r(2787);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return De.elementAt}});var Ue=r(1665);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return Ue.endWith}});var Be=r(1511);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return Be.every}});var Fe=r(5592);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return Fe.exhaust}});var Ke=r(2008);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return Ke.exhaustAll}});var He=r(4019);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return He.exhaustMap}});var Ge=r(9101);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return Ge.expand}});var $e=r(7261);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return $e.filter}});var Ve=r(5381);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return Ve.finalize}});var ze=r(4127);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return ze.find}});var qe=r(9727);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return qe.findIndex}});var We=r(7418);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return We.first}});var Ze=r(7533);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return Ze.groupBy}});var Je=r(9186);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return Je.ignoreElements}});var Ye=r(7757);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return Ye.isEmpty}});var Xe=r(3374);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return Xe.last}});var Qe=r(6269);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return Qe.map}});var et=r(5471);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return et.mapTo}});var tt=r(1160);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return tt.materialize}});var rt=r(1890);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return rt.max}});var nt=r(400);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return nt.mergeAll}});var it=r(9121);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return it.flatMap}});var ot=r(6086);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ot.mergeMap}});var st=r(1244);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return st.mergeMapTo}});var at=r(3699);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return at.mergeScan}});var ct=r(8220);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ct.mergeWith}});var ut=r(770);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ut.min}});var lt=r(8413);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return lt.multicast}});var ft=r(9314);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return ft.observeOn}});var dt=r(1899);Object.defineProperty(t,"onErrorResumeNextWith",{enumerable:!0,get:function(){return dt.onErrorResumeNextWith}});var ht=r(1186);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ht.pairwise}});var pt=r(9532);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return pt.pluck}});var bt=r(5745);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return bt.publish}});var mt=r(8103);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return mt.publishBehavior}});var gt=r(2610);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return gt.publishLast}});var vt=r(5299);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return vt.publishReplay}});var yt=r(3820);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return yt.raceWith}});var _t=r(8083);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return _t.reduce}});var wt=r(2588);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return wt.repeat}});var Et=r(9249);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return Et.repeatWhen}});var Ot=r(4486);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return Ot.retry}});var At=r(9112);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return At.retryWhen}});var St=r(4508);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return St.refCount}});var Pt=r(778);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Pt.sample}});var Tt=r(7701);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Tt.sampleTime}});var It=r(8167);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return It.scan}});var Rt=r(7821);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Rt.sequenceEqual}});var xt=r(2645);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return xt.share}});var Mt=r(7566);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Mt.shareReplay}});var kt=r(4610);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return kt.single}});var Lt=r(5735);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return Lt.skip}});var Nt=r(3252);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return Nt.skipLast}});var Ct=r(1779);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return Ct.skipUntil}});var jt=r(5454);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return jt.skipWhile}});var Dt=r(1923);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Dt.startWith}});var Ut=r(9130);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ut.subscribeOn}});var Bt=r(1695);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return Bt.switchAll}});var Ft=r(6649);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return Ft.switchMap}});var Kt=r(3054);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return Kt.switchMapTo}});var Ht=r(2890);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Ht.switchScan}});var Gt=r(9438);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Gt.take}});var $t=r(4125);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return $t.takeLast}});var Vt=r(9008);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return Vt.takeUntil}});var zt=r(5884);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return zt.takeWhile}});var qt=r(5383);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return qt.tap}});var Wt=r(1016);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Wt.throttle}});var Zt=r(567);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return Zt.throttleTime}});var Jt=r(1332);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return Jt.throwIfEmpty}});var Yt=r(1149);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return Yt.timeInterval}});var Xt=r(1316);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return Xt.timeout}});var Qt=r(4972);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Qt.timeoutWith}});var er=r(1275);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return er.timestamp}});var tr=r(9867);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return tr.toArray}});var rr=r(7649);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return rr.window}});var nr=r(5612);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return nr.windowCount}});var ir=r(9972);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return ir.windowTime}});var or=r(9593);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return or.windowToggle}});var sr=r(6307);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return sr.windowWhen}});var ar=r(5512);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return ar.withLatestFrom}});var cr=r(1221);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return cr.zipAll}});var ur=r(7594);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return ur.zipWith}})},9960:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncSubject=void 0;var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return i(t,e),t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,a=t._isComplete;r?e.error(o):(s||a)&&(n&&e.next(i),e.complete())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.prototype.complete=function(){var t=this,r=t._hasValue,n=t._value;t._isComplete||(this._isComplete=!0,r&&e.prototype.next.call(this,n),e.prototype.complete.call(this))},t}(r(5294).Subject);t.AsyncSubject=o},8114:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.BehaviorSubject=void 0;var o=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(r(5294).Subject);t.BehaviorSubject=o},9828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeNotification=t.Notification=t.NotificationKind=void 0;var n=r(6929),i=r(1377),o=r(40),s=r(2935);!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(t.NotificationKind||(t.NotificationKind={}));var a=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){return c(this,e)},e.prototype.do=function(e,t,r){var n=this,i=n.kind,o=n.value,s=n.error;return"N"===i?null==e?void 0:e(o):"E"===i?null==t?void 0:t(s):null==r?void 0:r()},e.prototype.accept=function(e,t,r){var n;return s.isFunction(null===(n=e)||void 0===n?void 0:n.next)?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){var e=this,t=e.kind,r=e.value,s=e.error,a="N"===t?i.of(r):"E"===t?o.throwError((function(){return s})):"C"===t?n.EMPTY:0;if(!a)throw new TypeError("Unexpected notification kind "+t);return a},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function c(e,t){var r,n,i,o=e,s=o.kind,a=o.value,c=o.error;if("string"!=typeof s)throw new TypeError('Invalid notification, missing "kind"');"N"===s?null===(r=t.next)||void 0===r||r.call(t,a):"E"===s?null===(n=t.error)||void 0===n||n.call(t,c):null===(i=t.complete)||void 0===i||i.call(t)}t.Notification=a,t.observeNotification=c},3005:(e,t)=>{"use strict";function r(e,t,r){return{kind:e,value:t,error:r}}Object.defineProperty(t,"__esModule",{value:!0}),t.createNotification=t.nextNotification=t.errorNotification=t.COMPLETE_NOTIFICATION=void 0,t.COMPLETE_NOTIFICATION=r("C",void 0,void 0),t.errorNotification=function(e){return r("E",void 0,e)},t.nextNotification=function(e){return r("N",e,void 0)},t.createNotification=r},4174:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var n=r(7747),i=r(4666),o=r(4595),s=r(5250),a=r(9179),c=r(2935),u=r(5444),l=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,s=this,a=(o=e)&&o instanceof n.Subscriber||function(e){return e&&c.isFunction(e.next)&&c.isFunction(e.error)&&c.isFunction(e.complete)}(o)&&i.isSubscription(o)?e:new n.SafeSubscriber(e,t,r);return u.errorContext((function(){var e=s,t=e.operator,r=e.source;a.add(t?t.call(a,r):r?s._subscribe(a):s._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=f(t))((function(t,i){var o=new n.SafeSubscriber({next:function(t){try{e(t)}catch(e){i(e),o.unsubscribe()}},error:i,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[o.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Scheduler=void 0;var n=r(9168),i=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=n.dateTimestampProvider.now,e}();t.Scheduler=i},5294:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSubject=t.Subject=void 0;var s=r(4174),a=r(4666),c=r(8499),u=r(1291),l=r(5444),f=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return i(t,e),t.prototype.lift=function(e){var t=new d(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new c.ObjectUnsubscribedError},t.prototype.next=function(e){var t=this;l.errorContext((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),s=i.next();!s.done;s=i.next()){s.value.next(e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;l.errorContext((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;l.errorContext((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?a.EMPTY_SUBSCRIPTION:(this.currentObservers=null,o.push(e),new a.Subscription((function(){t.currentObservers=null,u.arrRemove(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new s.Observable;return e.source=this,e},t.create=function(e,t){return new d(e,t)},t}(s.Observable);t.Subject=f;var d=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:a.EMPTY_SUBSCRIPTION},t}(f);t.AnonymousSubject=d},7747:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_OBSERVER=t.SafeSubscriber=t.Subscriber=void 0;var o=r(2935),s=r(4666),a=r(9179),c=r(1600),u=r(7116),l=r(3005),f=r(1577),d=r(5444),h=function(e){function r(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,s.isSubscription(r)&&r.add(n)):n.destination=t.EMPTY_OBSERVER,n}return i(r,e),r.create=function(e,t,r){return new g(e,t,r)},r.prototype.next=function(e){this.isStopped?y(l.nextNotification(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?y(l.errorNotification(e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?y(l.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(e){this.destination.next(e)},r.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(s.Subscription);t.Subscriber=h;var p=Function.prototype.bind;function b(e,t){return p.call(e,t)}var m=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){v(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){v(e)}else v(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){v(e)}},e}(),g=function(e){function t(t,r,n){var i,s,c=e.call(this)||this;o.isFunction(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:c&&a.config.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return c.unsubscribe()},i={next:t.next&&b(t.next,s),error:t.error&&b(t.error,s),complete:t.complete&&b(t.complete,s)}):i=t;return c.destination=new m(i),c}return i(t,e),t}(h);function v(e){a.config.useDeprecatedSynchronousErrorHandling?d.captureError(e):c.reportUnhandledError(e)}function y(e,t){var r=a.config.onStoppedNotification;r&&f.timeoutProvider.setTimeout((function(){return r(e,t)}))}t.SafeSubscriber=g,t.EMPTY_OBSERVER={closed:!0,next:u.noop,error:function(e){throw e},complete:u.noop}},4666:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.config=void 0,t.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},7327:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.firstValueFrom=void 0;var n=r(9088),i=r(7747);t.firstValueFrom=function(e,t){var r="object"==typeof t;return new Promise((function(o,s){var a=new i.SafeSubscriber({next:function(e){o(e),a.unsubscribe()},error:s,complete:function(){r?o(t.defaultValue):s(new n.EmptyError)}});e.subscribe(a)}))}},4798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lastValueFrom=void 0;var n=r(9088);t.lastValueFrom=function(e,t){var r="object"==typeof t;return new Promise((function(i,o){var s,a=!1;e.subscribe({next:function(e){s=e,a=!0},error:o,complete:function(){a?i(s):r?i(t.defaultValue):o(new n.EmptyError)}})}))}},7165:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableObservable=void 0;var o=r(4174),s=r(4666),a=r(4508),c=r(7326),u=r(6097),l=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,u.hasLift(t)&&(n.lift=t.lift),n}return i(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new s.Subscription;var r=this.getSubject();t.add(this.source.subscribe(c.createOperatorSubscriber(r,void 0,(function(){e._teardown(),r.complete()}),(function(t){e._teardown(),r.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=s.Subscription.EMPTY)}return t},t.prototype.refCount=function(){return a.refCount()(this)},t}(o.Observable);t.ConnectableObservable=l},6238:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindCallback=void 0;var n=r(9706);t.bindCallback=function(e,t,r){return n.bindCallbackInternals(!1,e,t,r)}},9706:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindNodeCallback=void 0;var n=r(9706);t.bindNodeCallback=function(e,t,r){return n.bindCallbackInternals(!0,e,t,r)}},508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestInit=t.combineLatest=void 0;var n=r(4174),i=r(2398),o=r(4417),s=r(8987),a=r(9364),c=r(4544),u=r(4800),l=r(7326),f=r(5267);function d(e,t,r){return void 0===r&&(r=s.identity),function(n){h(t,(function(){for(var i=e.length,s=new Array(i),a=i,c=i,u=function(i){h(t,(function(){var u=o.from(e[i],t),f=!1;u.subscribe(l.createOperatorSubscriber(n,(function(e){s[i]=e,f||(f=!0,c--),c||n.next(r(s.slice()))}),(function(){--a||n.complete()})))}),n)},f=0;f{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concat=void 0;var n=r(482),i=r(4544),o=r(4417);t.concat=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connectable=void 0;var n=r(5294),i=r(4174),o=r(9623),s={connector:function(){return new n.Subject},resetOnDisconnect:!0};t.connectable=function(e,t){void 0===t&&(t=s);var r=null,n=t.connector,a=t.resetOnDisconnect,c=void 0===a||a,u=n(),l=new i.Observable((function(e){return u.subscribe(e)}));return l.connect=function(){return r&&!r.closed||(r=o.defer((function(){return e})).subscribe(u),c&&r.add((function(){return u=n()}))),r},l}},9623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defer=void 0;var n=r(4174),i=r(6958);t.defer=function(e){return new n.Observable((function(t){i.innerFrom(e()).subscribe(t)}))}},2447:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.animationFrames=void 0;var n=r(4174),i=r(2261),o=r(9015);function s(e){return new n.Observable((function(t){var r=e||i.performanceTimestampProvider,n=r.now(),s=0,a=function(){t.closed||(s=o.animationFrameProvider.requestAnimationFrame((function(i){s=0;var o=r.now();t.next({timestamp:e?o:i,elapsed:o-n}),a()})))};return a(),function(){s&&o.animationFrameProvider.cancelAnimationFrame(s)}}))}t.animationFrames=function(e){return e?s(e):a};var a=s()},6929:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.empty=t.EMPTY=void 0;var n=r(4174);t.EMPTY=new n.Observable((function(e){return e.complete()})),t.empty=function(e){return e?function(e){return new n.Observable((function(t){return e.schedule((function(){return t.complete()}))}))}(e):t.EMPTY}},9220:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.forkJoin=void 0;var n=r(4174),i=r(2398),o=r(6958),s=r(4544),a=r(7326),c=r(9364),u=r(4800);t.forkJoin=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.from=void 0;var n=r(2862),i=r(6958);t.from=function(e,t){return t?n.scheduled(e,t):i.innerFrom(e)}},9671:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s};Object.defineProperty(t,"__esModule",{value:!0}),t.fromEvent=void 0;var i=r(6958),o=r(4174),s=r(6086),a=r(5445),c=r(2935),u=r(9364),l=["addListener","removeListener"],f=["addEventListener","removeEventListener"],d=["on","off"];function h(e,t){return function(r){return function(n){return e[r](t,n)}}}t.fromEvent=function e(t,r,p,b){if(c.isFunction(p)&&(b=p,p=void 0),b)return e(t,r,p).pipe(u.mapOneOrManyArgs(b));var m=n(function(e){return c.isFunction(e.addEventListener)&&c.isFunction(e.removeEventListener)}(t)?f.map((function(e){return function(n){return t[e](r,n,p)}})):function(e){return c.isFunction(e.addListener)&&c.isFunction(e.removeListener)}(t)?l.map(h(t,r)):function(e){return c.isFunction(e.on)&&c.isFunction(e.off)}(t)?d.map(h(t,r)):[],2),g=m[0],v=m[1];if(!g&&a.isArrayLike(t))return s.mergeMap((function(t){return e(t,r,p)}))(i.innerFrom(t));if(!g)throw new TypeError("Invalid event target");return new o.Observable((function(e){var t=function(){for(var t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromEventPattern=void 0;var n=r(4174),i=r(2935),o=r(9364);t.fromEventPattern=function e(t,r,s){return s?e(t,r).pipe(o.mapOneOrManyArgs(s)):new n.Observable((function(e){var n=function(){for(var t=[],r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromSubscribable=void 0;var n=r(4174);t.fromSubscribable=function(e){return new n.Observable((function(t){return e.subscribe(t)}))}},3482:function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iif=void 0;var n=r(9623);t.iif=function(e,t,r){return n.defer((function(){return e()?t:r}))}},6958:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.fromReadableStreamLike=t.fromAsyncIterable=t.fromIterable=t.fromPromise=t.fromArrayLike=t.fromInteropObservable=t.innerFrom=void 0;var a=r(5445),c=r(4283),u=r(4174),l=r(3124),f=r(3260),d=r(7756),h=r(8131),p=r(2221),b=r(2935),m=r(1600),g=r(4595);function v(e){return new u.Observable((function(t){var r=e[g.observable]();if(b.isFunction(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}))}function y(e){return new u.Observable((function(t){for(var r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.interval=void 0;var n=r(7152),i=r(8069);t.interval=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=n.asyncScheduler),e<0&&(e=0),i.timer(e,e,t)}},2039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;var n=r(400),i=r(6958),o=r(6929),s=r(4544),a=r(4417);t.merge=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.never=t.NEVER=void 0;var n=r(4174),i=r(7116);t.NEVER=new n.Observable(i.noop),t.never=function(){return t.NEVER}},1377:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.of=void 0;var n=r(4544),i=r(4417);t.of=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onErrorResumeNext=void 0;var n=r(4174),i=r(5034),o=r(7326),s=r(7116),a=r(6958);t.onErrorResumeNext=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairs=void 0;var n=r(4417);t.pairs=function(e,t){return n.from(Object.entries(e),t)}},6394:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(8781),i=r(7261),o=r(6958);t.partition=function(e,t,r){return[i.filter(t,r)(o.innerFrom(e)),i.filter(n.not(t,r))(o.innerFrom(e))]}},6849:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.raceInit=t.race=void 0;var n=r(4174),i=r(6958),o=r(5034),s=r(7326);function a(e){return function(t){for(var r=[],n=function(n){r.push(i.innerFrom(e[n]).subscribe(s.createOperatorSubscriber(t,(function(e){if(r){for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range=void 0;var n=r(4174),i=r(6929);t.range=function(e,t,r){if(null==t&&(t=e,e=0),t<=0)return i.EMPTY;var o=t+e;return new n.Observable(r?function(t){var n=e;return r.schedule((function(){n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=void 0;var n=r(4174),i=r(2935);t.throwError=function(e,t){var r=i.isFunction(e)?e:function(){return e},o=function(e){return e.error(r())};return new n.Observable(t?function(e){return t.schedule(o,0,e)}:o)}},8069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timer=void 0;var n=r(4174),i=r(7152),o=r(9668),s=r(4426);t.timer=function(e,t,r){void 0===e&&(e=0),void 0===r&&(r=i.async);var a=-1;return null!=t&&(o.isScheduler(t)?r=t:a=t),new n.Observable((function(t){var n=s.isValidDate(e)?+e-r.now():e;n<0&&(n=0);var i=0;return r.schedule((function(){t.closed||(t.next(i++),0<=a?this.schedule(void 0,a):t.complete())}),n)}))}},3348:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.using=void 0;var n=r(4174),i=r(6958),o=r(6929);t.using=function(e,t){return new n.Observable((function(r){var n=e(),s=t(n);return(s?i.innerFrom(s):o.EMPTY).subscribe(r),function(){n&&n.unsubscribe()}}))}},4981:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.audit=void 0;var n=r(6097),i=r(6958),o=r(7326);t.audit=function(e){return n.operate((function(t,r){var n=!1,s=null,a=null,c=!1,u=function(){if(null==a||a.unsubscribe(),a=null,n){n=!1;var e=s;s=null,r.next(e)}c&&r.complete()},l=function(){a=null,c&&r.complete()};t.subscribe(o.createOperatorSubscriber(r,(function(t){n=!0,s=t,a||i.innerFrom(e(t)).subscribe(a=o.createOperatorSubscriber(r,u,l))}),(function(){c=!0,(!n||!a||a.closed)&&r.complete()})))}))}},4152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.auditTime=void 0;var n=r(7152),i=r(2605),o=r(8069);t.auditTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.audit((function(){return o.timer(e,t)}))}},5149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buffer=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.buffer=function(e){return n.operate((function(t,r){var n=[];return t.subscribe(o.createOperatorSubscriber(r,(function(e){return n.push(e)}),(function(){r.next(n),r.complete()}))),s.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){var e=n;n=[],r.next(e)}),i.noop)),function(){n=null}}))}},3189:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferCount=void 0;var i=r(6097),o=r(7326),s=r(1291);t.bufferCount=function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,i.operate((function(r,i){var a=[],c=0;r.subscribe(o.createOperatorSubscriber(i,(function(r){var o,u,l,f,d=null;c++%t==0&&a.push([]);try{for(var h=n(a),p=h.next();!p.done;p=h.next()){(g=p.value).push(r),e<=g.length&&(d=null!=d?d:[]).push(g)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(u=h.return)&&u.call(h)}finally{if(o)throw o.error}}if(d)try{for(var b=n(d),m=b.next();!m.done;m=b.next()){var g=m.value;s.arrRemove(a,g),i.next(g)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(f=b.return)&&f.call(b)}finally{if(l)throw l.error}}}),(function(){var e,t;try{for(var r=n(a),o=r.next();!o.done;o=r.next()){var s=o.value;i.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.complete()}),void 0,(function(){a=null})))}))}},9459:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferTime=void 0;var i=r(4666),o=r(6097),s=r(7326),a=r(1291),c=r(7152),u=r(4544),l=r(5267);t.bufferTime=function(e){for(var t,r,f=[],d=1;d=0?l.executeSchedule(r,h,f,p,!0):c=!0,f();var d=s.createOperatorSubscriber(r,(function(e){var t,r,i=o.slice();try{for(var s=n(i),a=s.next();!a.done;a=s.next()){var c=a.value,l=c.buffer;l.push(e),b<=l.length&&u(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}),(function(){for(;null==o?void 0:o.length;)r.next(o.shift().buffer);null==d||d.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return o=null}));t.subscribe(d)}))}},8145:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToggle=void 0;var i=r(4666),o=r(6097),s=r(6958),a=r(7326),c=r(7116),u=r(1291);t.bufferToggle=function(e,t){return o.operate((function(r,o){var l=[];s.innerFrom(e).subscribe(a.createOperatorSubscriber(o,(function(e){var r=[];l.push(r);var n=new i.Subscription;n.add(s.innerFrom(t(e)).subscribe(a.createOperatorSubscriber(o,(function(){u.arrRemove(l,r),o.next(r),n.unsubscribe()}),c.noop)))}),c.noop)),r.subscribe(a.createOperatorSubscriber(o,(function(e){var t,r;try{for(var i=n(l),o=i.next();!o.done;o=i.next()){o.value.push(e)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}),(function(){for(;l.length>0;)o.next(l.shift());o.complete()})))}))}},7764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bufferWhen=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.bufferWhen=function(e){return n.operate((function(t,r){var n=null,a=null,c=function(){null==a||a.unsubscribe();var t=n;n=[],t&&r.next(t),s.innerFrom(e()).subscribe(a=o.createOperatorSubscriber(r,c,i.noop))};c(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=a=null})))}))}},3056:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.catchError=void 0;var n=r(6958),i=r(7326),o=r(6097);t.catchError=function e(t){return o.operate((function(r,o){var s,a=null,c=!1;a=r.subscribe(i.createOperatorSubscriber(o,void 0,void 0,(function(i){s=n.innerFrom(t(i,e(t)(r))),a?(a.unsubscribe(),a=null,s.subscribe(o)):c=!0}))),c&&(a.unsubscribe(),a=null,s.subscribe(o))}))}},498:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineAll=void 0;var n=r(7484);t.combineAll=n.combineLatestAll},6527:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.combineLatestAll=void 0;var n=r(508),i=r(2208);t.combineLatestAll=function(e){return i.joinAllInternals(n.combineLatest,e)}},4755:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatAll=void 0;var n=r(400);t.concatAll=function(){return n.mergeAll(1)}},1774:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatMap=void 0;var n=r(6086),i=r(2935);t.concatMap=function(e,t){return i.isFunction(t)?n.mergeMap(e,t,1):n.mergeMap(e,1)}},3977:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.concatMapTo=void 0;var n=r(1774),i=r(2935);t.concatMapTo=function(e,t){return i.isFunction(t)?n.concatMap((function(){return e}),t):n.concatMap((function(){return e}))}},7672:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;var n=r(5294),i=r(6958),o=r(6097),s=r(6884),a={connector:function(){return new n.Subject}};t.connect=function(e,t){void 0===t&&(t=a);var r=t.connector;return o.operate((function(t,n){var o=r();i.innerFrom(e(s.fromSubscribable(o))).subscribe(n),n.add(t.subscribe(o))}))}},8259:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.count=void 0;var n=r(8083);t.count=function(e){return n.reduce((function(t,r,n){return!e||e(r,n)?t+1:t}),0)}},3473:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0;var n=r(6097),i=r(7116),o=r(7326),s=r(6958);t.debounce=function(e){return n.operate((function(t,r){var n=!1,a=null,c=null,u=function(){if(null==c||c.unsubscribe(),c=null,n){n=!1;var e=a;a=null,r.next(e)}};t.subscribe(o.createOperatorSubscriber(r,(function(t){null==c||c.unsubscribe(),n=!0,a=t,c=o.createOperatorSubscriber(r,u,i.noop),s.innerFrom(e(t)).subscribe(c)}),(function(){u(),r.complete()}),void 0,(function(){a=c=null})))}))}},8390:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounceTime=void 0;var n=r(7152),i=r(6097),o=r(7326);t.debounceTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.operate((function(r,n){var i=null,s=null,a=null,c=function(){if(i){i.unsubscribe(),i=null;var e=s;s=null,n.next(e)}};function u(){var r=a+e,o=t.now();if(o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultIfEmpty=void 0;var n=r(6097),i=r(7326);t.defaultIfEmpty=function(e){return n.operate((function(t,r){var n=!1;t.subscribe(i.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){n||r.next(e),r.complete()})))}))}},8151:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0;var n=r(7152),i=r(744),o=r(8069);t.delay=function(e,t){void 0===t&&(t=n.asyncScheduler);var r=o.timer(e,t);return i.delayWhen((function(){return r}))}},744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delayWhen=void 0;var n=r(3364),i=r(9438),o=r(9186),s=r(5471),a=r(6086),c=r(6958);t.delayWhen=function e(t,r){return r?function(s){return n.concat(r.pipe(i.take(1),o.ignoreElements()),s.pipe(e(t)))}:a.mergeMap((function(e,r){return c.innerFrom(t(e,r)).pipe(i.take(1),s.mapTo(e))}))}},8590:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dematerialize=void 0;var n=r(9828),i=r(6097),o=r(7326);t.dematerialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){return n.observeNotification(e,t)})))}))}},8406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=void 0;var n=r(6097),i=r(7326),o=r(7116),s=r(6958);t.distinct=function(e,t){return n.operate((function(r,n){var a=new Set;r.subscribe(i.createOperatorSubscriber(n,(function(t){var r=e?e(t):t;a.has(r)||(a.add(r),n.next(t))}))),t&&s.innerFrom(t).subscribe(i.createOperatorSubscriber(n,(function(){return a.clear()}),o.noop))}))}},7300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilChanged=void 0;var n=r(8987),i=r(6097),o=r(7326);function s(e,t){return e===t}t.distinctUntilChanged=function(e,t){return void 0===t&&(t=n.identity),e=null!=e?e:s,i.operate((function(r,n){var i,s=!0;r.subscribe(o.createOperatorSubscriber(n,(function(r){var o=t(r);!s&&e(i,o)||(s=!1,i=o,n.next(r))})))}))}},4405:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.distinctUntilKeyChanged=void 0;var n=r(7300);t.distinctUntilKeyChanged=function(e,t){return n.distinctUntilChanged((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}},2787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.elementAt=void 0;var n=r(9216),i=r(7261),o=r(1332),s=r(4562),a=r(9438);t.elementAt=function(e,t){if(e<0)throw new n.ArgumentOutOfRangeError;var r=arguments.length>=2;return function(c){return c.pipe(i.filter((function(t,r){return r===e})),a.take(1),r?s.defaultIfEmpty(t):o.throwIfEmpty((function(){return new n.ArgumentOutOfRangeError})))}}},1665:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.every=void 0;var n=r(6097),i=r(7326);t.every=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(i){e.call(t,i,o++,r)||(n.next(!1),n.complete())}),(function(){n.next(!0),n.complete()})))}))}},5592:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaust=void 0;var n=r(2008);t.exhaust=n.exhaustAll},2008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustAll=void 0;var n=r(4019),i=r(8987);t.exhaustAll=function(){return n.exhaustMap(i.identity)}},4019:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exhaustMap=void 0;var n=r(6269),i=r(6958),o=r(6097),s=r(7326);t.exhaustMap=function e(t,r){return r?function(o){return o.pipe(e((function(e,o){return i.innerFrom(t(e,o)).pipe(n.map((function(t,n){return r(e,t,o,n)})))})))}:o.operate((function(e,r){var n=0,o=null,a=!1;e.subscribe(s.createOperatorSubscriber(r,(function(e){o||(o=s.createOperatorSubscriber(r,void 0,(function(){o=null,a&&r.complete()})),i.innerFrom(t(e,n++)).subscribe(o))}),(function(){a=!0,!o&&r.complete()})))}))}},9101:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expand=void 0;var n=r(6097),i=r(5926);t.expand=function(e,t,r){return void 0===t&&(t=1/0),t=(t||0)<1?1/0:t,n.operate((function(n,o){return i.mergeInternals(n,o,e,t,void 0,!0,r)}))}},7261:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filter=void 0;var n=r(6097),i=r(7326);t.filter=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}},5381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.finalize=void 0;var n=r(6097);t.finalize=function(e){return n.operate((function(t,r){try{t.subscribe(r)}finally{r.add(e)}}))}},4127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createFind=t.find=void 0;var n=r(6097),i=r(7326);function o(e,t,r){var n="index"===r;return function(r,o){var s=0;r.subscribe(i.createOperatorSubscriber(o,(function(i){var a=s++;e.call(t,i,a,r)&&(o.next(n?a:i),o.complete())}),(function(){o.next(n?-1:void 0),o.complete()})))}}t.find=function(e,t){return n.operate(o(e,t,"value"))},t.createFind=o},9727:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findIndex=void 0;var n=r(6097),i=r(4127);t.findIndex=function(e,t){return n.operate(i.createFind(e,t,"index"))}},7418:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.first=void 0;var n=r(9088),i=r(7261),o=r(9438),s=r(4562),a=r(1332),c=r(8987);t.first=function(e,t){var r=arguments.length>=2;return function(u){return u.pipe(e?i.filter((function(t,r){return e(t,r,u)})):c.identity,o.take(1),r?s.defaultIfEmpty(t):a.throwIfEmpty((function(){return new n.EmptyError})))}}},9121:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flatMap=void 0;var n=r(6086);t.flatMap=n.mergeMap},7533:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.groupBy=void 0;var n=r(4174),i=r(6958),o=r(5294),s=r(6097),a=r(7326);t.groupBy=function(e,t,r,c){return s.operate((function(s,u){var l;t&&"function"!=typeof t?(r=t.duration,l=t.element,c=t.connector):l=t;var f=new Map,d=function(e){f.forEach(e),e(u)},h=function(e){return d((function(t){return t.error(e)}))},p=0,b=!1,m=new a.OperatorSubscriber(u,(function(t){try{var s=e(t),d=f.get(s);if(!d){f.set(s,d=c?c():new o.Subject);var g=(y=s,_=d,(w=new n.Observable((function(e){p++;var t=_.subscribe(e);return function(){t.unsubscribe(),0==--p&&b&&m.unsubscribe()}}))).key=y,w);if(u.next(g),r){var v=a.createOperatorSubscriber(d,(function(){d.complete(),null==v||v.unsubscribe()}),void 0,void 0,(function(){return f.delete(s)}));m.add(i.innerFrom(r(g)).subscribe(v))}}d.next(l?l(t):t)}catch(e){h(e)}var y,_,w}),(function(){return d((function(e){return e.complete()}))}),h,(function(){return f.clear()}),(function(){return b=!0,0===p}));s.subscribe(m)}))}},9186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ignoreElements=void 0;var n=r(6097),i=r(7326),o=r(7116);t.ignoreElements=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,o.noop))}))}},7757:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var n=r(6097),i=r(7326);t.isEmpty=function(){return n.operate((function(e,t){e.subscribe(i.createOperatorSubscriber(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}},2208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.joinAllInternals=void 0;var n=r(8987),i=r(9364),o=r(5250),s=r(6086),a=r(9867);t.joinAllInternals=function(e,t){return o.pipe(a.toArray(),s.mergeMap((function(t){return e(t)})),t?i.mapOneOrManyArgs(t):n.identity)}},3374:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.last=void 0;var n=r(9088),i=r(7261),o=r(4125),s=r(1332),a=r(4562),c=r(8987);t.last=function(e,t){var r=arguments.length>=2;return function(u){return u.pipe(e?i.filter((function(t,r){return e(t,r,u)})):c.identity,o.takeLast(1),r?a.defaultIfEmpty(t):s.throwIfEmpty((function(){return new n.EmptyError})))}}},6269:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.map=void 0;var n=r(6097),i=r(7326);t.map=function(e,t){return n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){n.next(e.call(t,r,o++))})))}))}},5471:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mapTo=void 0;var n=r(6269);t.mapTo=function(e){return n.map((function(){return e}))}},1160:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.materialize=void 0;var n=r(9828),i=r(6097),o=r(7326);t.materialize=function(){return i.operate((function(e,t){e.subscribe(o.createOperatorSubscriber(t,(function(e){t.next(n.Notification.createNext(e))}),(function(){t.next(n.Notification.createComplete()),t.complete()}),(function(e){t.next(n.Notification.createError(e)),t.complete()})))}))}},1890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.max=void 0;var n=r(8083),i=r(2935);t.max=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}},3982:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=void 0;var n=r(6086),i=r(8987);t.mergeAll=function(e){return void 0===e&&(e=1/0),n.mergeMap(i.identity,e)}},5926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeInternals=void 0;var n=r(6958),i=r(5267),o=r(7326);t.mergeInternals=function(e,t,r,s,a,c,u,l){var f=[],d=0,h=0,p=!1,b=function(){!p||f.length||d||t.complete()},m=function(e){return d{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMap=void 0;var n=r(6269),i=r(6958),o=r(6097),s=r(5926),a=r(2935);t.mergeMap=function e(t,r,c){return void 0===c&&(c=1/0),a.isFunction(r)?e((function(e,o){return n.map((function(t,n){return r(e,t,o,n)}))(i.innerFrom(t(e,o)))}),c):("number"==typeof r&&(c=r),o.operate((function(e,r){return s.mergeInternals(e,r,t,c)})))}},1244:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMapTo=void 0;var n=r(6086),i=r(2935);t.mergeMapTo=function(e,t,r){return void 0===r&&(r=1/0),i.isFunction(t)?n.mergeMap((function(){return e}),t,r):("number"==typeof t&&(r=t),n.mergeMap((function(){return e}),r))}},3699:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeScan=void 0;var n=r(6097),i=r(5926);t.mergeScan=function(e,t,r){return void 0===r&&(r=1/0),n.operate((function(n,o){var s=t;return i.mergeInternals(n,o,(function(t,r){return e(s,t,r)}),r,(function(e){s=e}),!1,void 0,(function(){return s=null}))}))}},8220:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=void 0;var n=r(8083),i=r(2935);t.min=function(e){return n.reduce(i.isFunction(e)?function(t,r){return e(t,r)<0?t:r}:function(e,t){return e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multicast=void 0;var n=r(7165),i=r(2935),o=r(5561);t.multicast=function(e,t){var r=i.isFunction(e)?e:function(){return e};return i.isFunction(t)?o.connect(t,{connector:r}):function(e){return new n.ConnectableObservable(e,r)}}},9314:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observeOn=void 0;var n=r(5267),i=r(6097),o=r(7326);t.observeOn=function(e,t){return void 0===t&&(t=0),i.operate((function(r,i){r.subscribe(o.createOperatorSubscriber(i,(function(r){return n.executeSchedule(i,e,(function(){return i.next(r)}),t)}),(function(){return n.executeSchedule(i,e,(function(){return i.complete()}),t)}),(function(r){return n.executeSchedule(i,e,(function(){return i.error(r)}),t)})))}))}},1899:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pairwise=void 0;var n=r(6097),i=r(7326);t.pairwise=function(){return n.operate((function(e,t){var r,n=!1;e.subscribe(i.createOperatorSubscriber(t,(function(e){var i=r;r=e,n&&t.next([i,e]),n=!0})))}))}},9857:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.partition=void 0;var n=r(8781),i=r(7261);t.partition=function(e,t){return function(r){return[i.filter(e,t)(r),i.filter(n.not(e,t))(r)]}}},9532:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluck=void 0;var n=r(6269);t.pluck=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publish=void 0;var n=r(5294),i=r(8413),o=r(5561);t.publish=function(e){return e?function(t){return o.connect(e)(t)}:function(e){return i.multicast(new n.Subject)(e)}}},8103:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishBehavior=void 0;var n=r(8114),i=r(7165);t.publishBehavior=function(e){return function(t){var r=new n.BehaviorSubject(e);return new i.ConnectableObservable(t,(function(){return r}))}}},2610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishLast=void 0;var n=r(9960),i=r(7165);t.publishLast=function(){return function(e){var t=new n.AsyncSubject;return new i.ConnectableObservable(e,(function(){return t}))}}},5299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.publishReplay=void 0;var n=r(8806),i=r(8413),o=r(2935);t.publishReplay=function(e,t,r,s){r&&!o.isFunction(r)&&(s=r);var a=o.isFunction(r)?r:void 0;return function(r){return i.multicast(new n.ReplaySubject(e,t,s),a)(r)}}},6699:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reduce=void 0;var n=r(7235),i=r(6097);t.reduce=function(e,t){return i.operate(n.scanInternals(e,t,arguments.length>=2,!1,!0))}},4508:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.refCount=void 0;var n=r(6097),i=r(7326);t.refCount=function(){return n.operate((function(e,t){var r=null;e._refCount++;var n=i.createOperatorSubscriber(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)r=null;else{var n=e._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),t.unsubscribe()}}));e.subscribe(n),n.closed||(r=e.connect())}))}},2588:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeat=void 0;var n=r(6929),i=r(6097),o=r(7326),s=r(6958),a=r(8069);t.repeat=function(e){var t,r,c=1/0;return null!=e&&("object"==typeof e?(t=e.count,c=void 0===t?1/0:t,r=e.delay):c=e),c<=0?function(){return n.EMPTY}:i.operate((function(e,t){var n,i=0,u=function(){if(null==n||n.unsubscribe(),n=null,null!=r){var e="number"==typeof r?a.timer(r):s.innerFrom(r(i)),c=o.createOperatorSubscriber(t,(function(){c.unsubscribe(),l()}));e.subscribe(c)}else l()},l=function(){var r=!1;n=e.subscribe(o.createOperatorSubscriber(t,void 0,(function(){++i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeatWhen=void 0;var n=r(6958),i=r(5294),o=r(6097),s=r(7326);t.repeatWhen=function(e){return o.operate((function(t,r){var o,a,c=!1,u=!1,l=!1,f=function(){return l&&u&&(r.complete(),!0)},d=function(){l=!1,o=t.subscribe(s.createOperatorSubscriber(r,void 0,(function(){l=!0,!f()&&(a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){o?d():c=!0}),(function(){u=!0,f()})))),a).next()}))),c&&(o.unsubscribe(),o=null,c=!1,d())};d()}))}},4486:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retry=void 0;var n=r(6097),i=r(7326),o=r(8987),s=r(8069),a=r(6958);t.retry=function(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,c=void 0===r?1/0:r,u=t.delay,l=t.resetOnSuccess,f=void 0!==l&&l;return c<=0?o.identity:n.operate((function(e,t){var r,n=0,o=function(){var l=!1;r=e.subscribe(i.createOperatorSubscriber(t,(function(e){f&&(n=0),t.next(e)}),void 0,(function(e){if(n++{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retryWhen=void 0;var n=r(6958),i=r(5294),o=r(6097),s=r(7326);t.retryWhen=function(e){return o.operate((function(t,r){var o,a,c=!1,u=function(){o=t.subscribe(s.createOperatorSubscriber(r,void 0,void 0,(function(t){a||(a=new i.Subject,n.innerFrom(e(a)).subscribe(s.createOperatorSubscriber(r,(function(){return o?u():c=!0})))),a&&a.next(t)}))),c&&(o.unsubscribe(),o=null,c=!1,u())};u()}))}},778:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sample=void 0;var n=r(6958),i=r(6097),o=r(7116),s=r(7326);t.sample=function(e){return i.operate((function(t,r){var i=!1,a=null;t.subscribe(s.createOperatorSubscriber(r,(function(e){i=!0,a=e}))),n.innerFrom(e).subscribe(s.createOperatorSubscriber(r,(function(){if(i){i=!1;var e=a;a=null,r.next(e)}}),o.noop))}))}},7701:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sampleTime=void 0;var n=r(7152),i=r(778),o=r(3154);t.sampleTime=function(e,t){return void 0===t&&(t=n.asyncScheduler),i.sample(o.interval(e,t))}},8167:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scan=void 0;var n=r(6097),i=r(7235);t.scan=function(e,t){return n.operate(i.scanInternals(e,t,arguments.length>=2,!0))}},7235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scanInternals=void 0;var n=r(7326);t.scanInternals=function(e,t,r,i,o){return function(s,a){var c=r,u=t,l=0;s.subscribe(n.createOperatorSubscriber(a,(function(t){var r=l++;u=c?e(u,t,r):(c=!0,t),i&&a.next(u)}),o&&function(){c&&a.next(u),a.complete()}))}}},7821:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sequenceEqual=void 0;var n=r(6097),i=r(7326),o=r(6958);t.sequenceEqual=function(e,t){return void 0===t&&(t=function(e,t){return e===t}),n.operate((function(r,n){var s={buffer:[],complete:!1},a={buffer:[],complete:!1},c=function(e){n.next(e),n.complete()},u=function(e,r){var o=i.createOperatorSubscriber(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?c(!1):e.buffer.push(n):!t(n,i.shift())&&c(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&c(0===n.length),null==o||o.unsubscribe()}));return o};r.subscribe(u(s,a)),o.innerFrom(e).subscribe(u(a,s))}))}},2645:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0&&(t=new a.SafeSubscriber({next:function(e){return v.next(e)},error:function(e){p=!0,b(),n=u(m,i,e),v.error(e)},complete:function(){d=!0,b(),n=u(m,f),v.complete()}}),o.innerFrom(e).subscribe(t))}))(e)}}},7566:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shareReplay=void 0;var n=r(8806),i=r(2645);t.shareReplay=function(e,t,r){var o,s,a,c,u=!1;return e&&"object"==typeof e?(o=e.bufferSize,c=void 0===o?1/0:o,s=e.windowTime,t=void 0===s?1/0:s,u=void 0!==(a=e.refCount)&&a,r=e.scheduler):c=null!=e?e:1/0,i.share({connector:function(){return new n.ReplaySubject(c,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}},4610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.single=void 0;var n=r(9088),i=r(7298),o=r(5722),s=r(6097),a=r(7326);t.single=function(e){return s.operate((function(t,r){var s,c=!1,u=!1,l=0;t.subscribe(a.createOperatorSubscriber(r,(function(n){u=!0,e&&!e(n,l++,t)||(c&&r.error(new i.SequenceError("Too many matching values")),c=!0,s=n)}),(function(){c?(r.next(s),r.complete()):r.error(u?new o.NotFoundError("No matching values"):new n.EmptyError)})))}))}},5735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skip=void 0;var n=r(7261);t.skip=function(e){return n.filter((function(t,r){return e<=r}))}},3252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipLast=void 0;var n=r(8987),i=r(6097),o=r(7326);t.skipLast=function(e){return e<=0?n.identity:i.operate((function(t,r){var n=new Array(e),i=0;return t.subscribe(o.createOperatorSubscriber(r,(function(t){var o=i++;if(o{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipUntil=void 0;var n=r(6097),i=r(7326),o=r(6958),s=r(7116);t.skipUntil=function(e){return n.operate((function(t,r){var n=!1,a=i.createOperatorSubscriber(r,(function(){null==a||a.unsubscribe(),n=!0}),s.noop);o.innerFrom(e).subscribe(a),t.subscribe(i.createOperatorSubscriber(r,(function(e){return n&&r.next(e)})))}))}},5454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.skipWhile=void 0;var n=r(6097),i=r(7326);t.skipWhile=function(e){return n.operate((function(t,r){var n=!1,o=0;t.subscribe(i.createOperatorSubscriber(r,(function(t){return(n||(n=!e(t,o++)))&&r.next(t)})))}))}},1923:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startWith=void 0;var n=r(3364),i=r(4544),o=r(6097);t.startWith=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeOn=void 0;var n=r(6097);t.subscribeOn=function(e,t){return void 0===t&&(t=0),n.operate((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}},1695:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchAll=void 0;var n=r(6649),i=r(8987);t.switchAll=function(){return n.switchMap(i.identity)}},6649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchMap=void 0;var n=r(6958),i=r(6097),o=r(7326);t.switchMap=function(e,t){return i.operate((function(r,i){var s=null,a=0,c=!1,u=function(){return c&&!s&&i.complete()};r.subscribe(o.createOperatorSubscriber(i,(function(r){null==s||s.unsubscribe();var c=0,l=a++;n.innerFrom(e(r,l)).subscribe(s=o.createOperatorSubscriber(i,(function(e){return i.next(t?t(r,e,l,c++):e)}),(function(){s=null,u()})))}),(function(){c=!0,u()})))}))}},3054:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchMapTo=void 0;var n=r(6649),i=r(2935);t.switchMapTo=function(e,t){return i.isFunction(t)?n.switchMap((function(){return e}),t):n.switchMap((function(){return e}))}},2890:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.switchScan=void 0;var n=r(6649),i=r(6097);t.switchScan=function(e,t){return i.operate((function(r,i){var o=t;return n.switchMap((function(t,r){return e(o,t,r)}),(function(e,t){return o=t,t}))(r).subscribe(i),function(){o=null}}))}},9438:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.take=void 0;var n=r(6929),i=r(6097),o=r(7326);t.take=function(e){return e<=0?function(){return n.EMPTY}:i.operate((function(t,r){var n=0;t.subscribe(o.createOperatorSubscriber(r,(function(t){++n<=e&&(r.next(t),e<=n&&r.complete())})))}))}},4125:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.takeLast=void 0;var i=r(6929),o=r(6097),s=r(7326);t.takeLast=function(e){return e<=0?function(){return i.EMPTY}:o.operate((function(t,r){var i=[];t.subscribe(s.createOperatorSubscriber(r,(function(t){i.push(t),e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.takeUntil=void 0;var n=r(6097),i=r(7326),o=r(6958),s=r(7116);t.takeUntil=function(e){return n.operate((function(t,r){o.innerFrom(e).subscribe(i.createOperatorSubscriber(r,(function(){return r.complete()}),s.noop)),!r.closed&&t.subscribe(r)}))}},5884:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.takeWhile=void 0;var n=r(6097),i=r(7326);t.takeWhile=function(e,t){return void 0===t&&(t=!1),n.operate((function(r,n){var o=0;r.subscribe(i.createOperatorSubscriber(n,(function(r){var i=e(r,o++);(i||t)&&n.next(r),!i&&n.complete()})))}))}},5383:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tap=void 0;var n=r(2935),i=r(6097),o=r(7326),s=r(8987);t.tap=function(e,t,r){var a=n.isFunction(e)||t||r?{next:e,error:t,complete:r}:e;return a?i.operate((function(e,t){var r;null===(r=a.subscribe)||void 0===r||r.call(a);var n=!0;e.subscribe(o.createOperatorSubscriber(t,(function(e){var r;null===(r=a.next)||void 0===r||r.call(a,e),t.next(e)}),(function(){var e;n=!1,null===(e=a.complete)||void 0===e||e.call(a),t.complete()}),(function(e){var r;n=!1,null===(r=a.error)||void 0===r||r.call(a,e),t.error(e)}),(function(){var e,t;n&&(null===(e=a.unsubscribe)||void 0===e||e.call(a)),null===(t=a.finalize)||void 0===t||t.call(a)})))})):s.identity}},1016:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0;var n=r(6097),i=r(7326),o=r(6958);t.throttle=function(e,t){return n.operate((function(r,n){var s=null!=t?t:{},a=s.leading,c=void 0===a||a,u=s.trailing,l=void 0!==u&&u,f=!1,d=null,h=null,p=!1,b=function(){null==h||h.unsubscribe(),h=null,l&&(v(),p&&n.complete())},m=function(){h=null,p&&n.complete()},g=function(t){return h=o.innerFrom(e(t)).subscribe(i.createOperatorSubscriber(n,b,m))},v=function(){if(f){f=!1;var e=d;d=null,n.next(e),!p&&g(e)}};r.subscribe(i.createOperatorSubscriber(n,(function(e){f=!0,d=e,(!h||h.closed)&&(c?v():g(e))}),(function(){p=!0,(!(l&&f&&h)||h.closed)&&n.complete()})))}))}},567:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttleTime=void 0;var n=r(7152),i=r(1016),o=r(8069);t.throttleTime=function(e,t,r){void 0===t&&(t=n.asyncScheduler);var s=o.timer(e,t);return i.throttle((function(){return s}),r)}},1332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfEmpty=void 0;var n=r(9088),i=r(6097),o=r(7326);function s(){return new n.EmptyError}t.throwIfEmpty=function(e){return void 0===e&&(e=s),i.operate((function(t,r){var n=!1;t.subscribe(o.createOperatorSubscriber(r,(function(e){n=!0,r.next(e)}),(function(){return n?r.complete():r.error(e())})))}))}},1149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeInterval=t.timeInterval=void 0;var n=r(7152),i=r(6097),o=r(7326);t.timeInterval=function(e){return void 0===e&&(e=n.asyncScheduler),i.operate((function(t,r){var n=e.now();t.subscribe(o.createOperatorSubscriber(r,(function(t){var i=e.now(),o=i-n;n=i,r.next(new s(t,o))})))}))};var s=function(e,t){this.value=e,this.interval=t};t.TimeInterval=s},1316:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeout=t.TimeoutError=void 0;var n=r(7152),i=r(4426),o=r(6097),s=r(6958),a=r(3126),c=r(7326),u=r(5267);function l(e){throw new t.TimeoutError(e)}t.TimeoutError=a.createErrorClass((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}})),t.timeout=function(e,t){var r=i.isValidDate(e)?{first:e}:"number"==typeof e?{each:e}:e,a=r.first,f=r.each,d=r.with,h=void 0===d?l:d,p=r.scheduler,b=void 0===p?null!=t?t:n.asyncScheduler:p,m=r.meta,g=void 0===m?null:m;if(null==a&&null==f)throw new TypeError("No timeout provided.");return o.operate((function(e,t){var r,n,i=null,o=0,l=function(e){n=u.executeSchedule(t,b,(function(){try{r.unsubscribe(),s.innerFrom(h({meta:g,lastValue:i,seen:o})).subscribe(t)}catch(e){t.error(e)}}),e)};r=e.subscribe(c.createOperatorSubscriber(t,(function(e){null==n||n.unsubscribe(),o++,t.next(i=e),f>0&&l(f)}),void 0,void 0,(function(){(null==n?void 0:n.closed)||null==n||n.unsubscribe(),i=null}))),!o&&l(null!=a?"number"==typeof a?a:+a-b.now():f)}))}},4972:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutWith=void 0;var n=r(7152),i=r(4426),o=r(1316);t.timeoutWith=function(e,t,r){var s,a,c;if(r=null!=r?r:n.async,i.isValidDate(e)?s=e:"number"==typeof e&&(a=e),!t)throw new TypeError("No observable provided to switch to");if(c=function(){return t},null==s&&null==a)throw new TypeError("No timeout provided.");return o.timeout({first:s,each:a,scheduler:r,with:c})}},1275:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.timestamp=void 0;var n=r(9168),i=r(6269);t.timestamp=function(e){return void 0===e&&(e=n.dateTimestampProvider),i.map((function(t){return{value:t,timestamp:e.now()}}))}},9867:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toArray=void 0;var n=r(8083),i=r(6097),o=function(e,t){return e.push(t),e};t.toArray=function(){return i.operate((function(e,t){n.reduce(o,[])(e).subscribe(t)}))}},7649:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.window=void 0;var n=r(5294),i=r(6097),o=r(7326),s=r(7116),a=r(6958);t.window=function(e){return i.operate((function(t,r){var i=new n.Subject;r.next(i.asObservable());var c=function(e){i.error(e),r.error(e)};return t.subscribe(o.createOperatorSubscriber(r,(function(e){return null==i?void 0:i.next(e)}),(function(){i.complete(),r.complete()}),c)),a.innerFrom(e).subscribe(o.createOperatorSubscriber(r,(function(){i.complete(),r.next(i=new n.Subject)}),s.noop,c)),function(){null==i||i.unsubscribe(),i=null}}))}},5612:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowCount=void 0;var i=r(5294),o=r(6097),s=r(7326);t.windowCount=function(e,t){void 0===t&&(t=0);var r=t>0?t:e;return o.operate((function(t,o){var a=[new i.Subject],c=0;o.next(a[0].asObservable()),t.subscribe(s.createOperatorSubscriber(o,(function(t){var s,u;try{for(var l=n(a),f=l.next();!f.done;f=l.next()){f.value.next(t)}}catch(e){s={error:e}}finally{try{f&&!f.done&&(u=l.return)&&u.call(l)}finally{if(s)throw s.error}}var d=c-e+1;if(d>=0&&d%r==0&&a.shift().complete(),++c%r==0){var h=new i.Subject;a.push(h),o.next(h.asObservable())}}),(function(){for(;a.length>0;)a.shift().complete();o.complete()}),(function(e){for(;a.length>0;)a.shift().error(e);o.error(e)}),(function(){null,a=null})))}))}},9972:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.windowTime=void 0;var n=r(5294),i=r(7152),o=r(4666),s=r(6097),a=r(7326),c=r(1291),u=r(4544),l=r(5267);t.windowTime=function(e){for(var t,r,f=[],d=1;d=0?l.executeSchedule(r,h,f,p,!0):s=!0,f();var d=function(e){return i.slice().forEach(e)},m=function(e){d((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(a.createOperatorSubscriber(r,(function(e){d((function(t){t.window.next(e),b<=++t.seen&&u(t)}))}),(function(){return m((function(e){return e.complete()}))}),(function(e){return m((function(t){return t.error(e)}))}))),function(){i=null}}))}},9593:function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.windowToggle=void 0;var i=r(5294),o=r(4666),s=r(6097),a=r(6958),c=r(7326),u=r(7116),l=r(1291);t.windowToggle=function(e,t){return s.operate((function(r,s){var f=[],d=function(e){for(;0{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.windowWhen=void 0;var n=r(5294),i=r(6097),o=r(7326),s=r(6958);t.windowWhen=function(e){return i.operate((function(t,r){var i,a,c=function(e){i.error(e),r.error(e)},u=function(){var t;null==a||a.unsubscribe(),null==i||i.complete(),i=new n.Subject,r.next(i.asObservable());try{t=s.innerFrom(e())}catch(e){return void c(e)}t.subscribe(a=o.createOperatorSubscriber(r,u,u,c))};u(),t.subscribe(o.createOperatorSubscriber(r,(function(e){return i.next(e)}),(function(){i.complete(),r.complete()}),c,(function(){null==a||a.unsubscribe(),i=null})))}))}},5512:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.zipAll=void 0;var n=r(4981),i=r(2208);t.zipAll=function(e){return i.joinAllInternals(n.zip,e)}},7594:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleArray=void 0;var n=r(4174);t.scheduleArray=function(e,t){return new n.Observable((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}},4271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleAsyncIterable=void 0;var n=r(4174),i=r(5267);t.scheduleAsyncIterable=function(e,t){if(!e)throw new Error("Iterable cannot be null");return new n.Observable((function(r){i.executeSchedule(r,t,(function(){var n=e[Symbol.asyncIterator]();i.executeSchedule(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}},2485:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleIterable=void 0;var n=r(4174),i=r(7630),o=r(2935),s=r(5267);t.scheduleIterable=function(e,t){return new n.Observable((function(r){var n;return s.executeSchedule(r,t,(function(){n=e[i.iterator](),s.executeSchedule(r,t,(function(){var e,t,i;try{t=(e=n.next()).value,i=e.done}catch(e){return void r.error(e)}i?r.complete():r.next(t)}),0,!0)})),function(){return o.isFunction(null==n?void 0:n.return)&&n.return()}}))}},5892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleObservable=void 0;var n=r(6958),i=r(9314),o=r(9130);t.scheduleObservable=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},6976:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.schedulePromise=void 0;var n=r(6958),i=r(9314),o=r(9130);t.schedulePromise=function(e,t){return n.innerFrom(e).pipe(o.subscribeOn(t),i.observeOn(t))}},4260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduleReadableStreamLike=void 0;var n=r(4271),i=r(2221);t.scheduleReadableStreamLike=function(e,t){return n.scheduleAsyncIterable(i.readableStreamLikeToAsyncGenerator(e),t)}},2862:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.scheduled=void 0;var n=r(5892),i=r(6976),o=r(7456),s=r(2485),a=r(4271),c=r(3124),u=r(4283),l=r(5445),f=r(8131),d=r(3260),h=r(7756),p=r(2221),b=r(4260);t.scheduled=function(e,t){if(null!=e){if(c.isInteropObservable(e))return n.scheduleObservable(e,t);if(l.isArrayLike(e))return o.scheduleArray(e,t);if(u.isPromise(e))return i.schedulePromise(e,t);if(d.isAsyncIterable(e))return a.scheduleAsyncIterable(e,t);if(f.isIterable(e))return s.scheduleIterable(e,t);if(p.isReadableStreamLike(e))return b.scheduleReadableStreamLike(e,t)}throw h.createInvalidObservableTypeError(e)}},2502:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var o=function(e){function t(t,r){return e.call(this)||this}return i(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(4666).Subscription);t.Action=o},2142:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationFrameAction=void 0;var o=r(9462),s=r(9015),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=s.animationFrameProvider.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var o=t.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(s.animationFrameProvider.cancelAnimationFrame(r),t._scheduled=void 0)},t}(o.AsyncAction);t.AnimationFrameAction=a},7104:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationFrameScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(r(9812).AsyncScheduler);t.AnimationFrameScheduler=o},4151:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsapAction=void 0;var o=r(9462),s=r(4409),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=s.immediateProvider.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);var o=t.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(s.immediateProvider.clearImmediate(r),t._scheduled===r&&(t._scheduled=void 0))},t}(o.AsyncAction);t.AsapAction=a},4726:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsapScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(r(9812).AsyncScheduler);t.AsapScheduler=o},9462:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAction=void 0;var o=r(2502),s=r(7549),a=r(1291),c=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return i(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),s.intervalProvider.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&s.intervalProvider.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,a.arrRemove(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(o.Action);t.AsyncAction=c},9812:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncScheduler=void 0;var o=r(6949),s=function(e){function t(t,r){void 0===r&&(r=o.Scheduler.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(o.Scheduler);t.AsyncScheduler=s},5336:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.QueueAction=void 0;var o=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.flush(this),0)},t}(r(9462).AsyncAction);t.QueueAction=o},3667:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.QueueScheduler=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(9812).AsyncScheduler);t.QueueScheduler=o},2929:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualAction=t.VirtualTimeScheduler=void 0;var o=r(9462),s=r(4666),a=function(e){function t(t,r){void 0===t&&(t=c),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return i(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(r(9812).AsyncScheduler);t.VirtualTimeScheduler=a;var c=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.index=n,i.active=!0,i.index=t.index=n,i}return i(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return s.Subscription.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var i=e.actions;return i.push(this),i.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(o.AsyncAction);t.VirtualAction=c},8989:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.animationFrame=t.animationFrameScheduler=void 0;var n=r(2142),i=r(7104);t.animationFrameScheduler=new i.AnimationFrameScheduler(n.AnimationFrameAction),t.animationFrame=t.animationFrameScheduler},9015:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.asap=t.asapScheduler=void 0;var n=r(4151),i=r(4726);t.asapScheduler=new i.AsapScheduler(n.AsapAction),t.asap=t.asapScheduler},7152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.async=t.asyncScheduler=void 0;var n=r(9462),i=r(9812);t.asyncScheduler=new i.AsyncScheduler(n.AsyncAction),t.async=t.asyncScheduler},9168:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateTimestampProvider=void 0,t.dateTimestampProvider={now:function(){return(t.dateTimestampProvider.delegate||Date).now()},delegate:void 0}},4409:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.performanceTimestampProvider=void 0,t.performanceTimestampProvider={now:function(){return(t.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}},4093:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.queue=t.queueScheduler=void 0;var n=r(5336),i=r(3667);t.queueScheduler=new i.QueueScheduler(n.QueueAction),t.queue=t.queueScheduler},1577:function(e,t){"use strict";var r=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},n=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";function r(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}Object.defineProperty(t,"__esModule",{value:!0}),t.iterator=t.getSymbolIterator=void 0,t.getSymbolIterator=r,t.iterator=r()},4595:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.observable=void 0,t.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},2793:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9216:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentOutOfRangeError=void 0;var n=r(3126);t.ArgumentOutOfRangeError=n.createErrorClass((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}))},9088:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyError=void 0;var n=r(3126);t.EmptyError=n.createErrorClass((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}))},998:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TestTools=t.Immediate=void 0;var r,n=1,i={};function o(e){return e in i&&(delete i[e],!0)}t.Immediate={setImmediate:function(e){var t=n++;return i[t]=!0,r||(r=Promise.resolve()),r.then((function(){return o(t)&&e()})),t},clearImmediate:function(e){o(e)}},t.TestTools={pending:function(){return Object.keys(i).length}}},5722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotFoundError=void 0;var n=r(3126);t.NotFoundError=n.createErrorClass((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}}))},8499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectUnsubscribedError=void 0;var n=r(3126);t.ObjectUnsubscribedError=n.createErrorClass((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}))},7298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SequenceError=void 0;var n=r(3126);t.SequenceError=n.createErrorClass((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}))},4043:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscriptionError=void 0;var n=r(3126);t.UnsubscriptionError=n.createErrorClass((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}))},4544:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.popNumber=t.popScheduler=t.popResultSelector=void 0;var n=r(2935),i=r(9668);function o(e){return e[e.length-1]}t.popResultSelector=function(e){return n.isFunction(o(e))?e.pop():void 0},t.popScheduler=function(e){return i.isScheduler(o(e))?e.pop():void 0},t.popNumber=function(e,t){return"number"==typeof o(e)?e.pop():t}},2398:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argsArgArrayOrObject=void 0;var r=Array.isArray,n=Object.getPrototypeOf,i=Object.prototype,o=Object.keys;t.argsArgArrayOrObject=function(e){if(1===e.length){var t=e[0];if(r(t))return{args:t,keys:null};if((a=t)&&"object"==typeof a&&n(a)===i){var s=o(t);return{args:s.map((function(e){return t[e]})),keys:s}}}var a;return{args:e,keys:null}}},5034:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.argsOrArgArray=void 0;var r=Array.isArray;t.argsOrArgArray=function(e){return 1===e.length&&r(e[0])?e[0]:e}},1291:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrRemove=void 0,t.arrRemove=function(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}},3126:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorClass=void 0,t.createErrorClass=function(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},4800:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createObject=void 0,t.createObject=function(e,t){return e.reduce((function(e,r,n){return e[r]=t[n],e}),{})}},5444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.captureError=t.errorContext=void 0;var n=r(9179),i=null;t.errorContext=function(e){if(n.config.useDeprecatedSynchronousErrorHandling){var t=!i;if(t&&(i={errorThrown:!1,error:null}),e(),t){var r=i,o=r.errorThrown,s=r.error;if(i=null,o)throw s}}else e()},t.captureError=function(e){n.config.useDeprecatedSynchronousErrorHandling&&i&&(i.errorThrown=!0,i.error=e)}},5267:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeSchedule=void 0,t.executeSchedule=function(e,t,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=t.schedule((function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(o),!i)return o}},8987:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identity=void 0,t.identity=function(e){return e}},5445:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayLike=void 0,t.isArrayLike=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},3260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=void 0;var n=r(2935);t.isAsyncIterable=function(e){return Symbol.asyncIterator&&n.isFunction(null==e?void 0:e[Symbol.asyncIterator])}},4426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isValidDate=void 0,t.isValidDate=function(e){return e instanceof Date&&!isNaN(e)}},2935:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e}},3124:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInteropObservable=void 0;var n=r(4595),i=r(2935);t.isInteropObservable=function(e){return i.isFunction(e[n.observable])}},8131:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=void 0;var n=r(7630),i=r(2935);t.isIterable=function(e){return i.isFunction(null==e?void 0:e[n.iterator])}},3659:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isObservable=void 0;var n=r(4174),i=r(2935);t.isObservable=function(e){return!!e&&(e instanceof n.Observable||i.isFunction(e.lift)&&i.isFunction(e.subscribe))}},4283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=void 0;var n=r(2935);t.isPromise=function(e){return n.isFunction(null==e?void 0:e.then)}},2221:function(e,t,r){"use strict";var n=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof i?Promise.resolve(r.value.v).then(u,l):f(s[0][2],r)}catch(e){f(s[0][3],e)}var r}function u(e){c("next",e)}function l(e){c("throw",e)}function f(e,t){e(t),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(t,"__esModule",{value:!0}),t.isReadableStreamLike=t.readableStreamLikeToAsyncGenerator=void 0;var s=r(2935);t.readableStreamLikeToAsyncGenerator=function(e){return o(this,arguments,(function(){var t,r,o;return n(this,(function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,i(t.read())];case 3:return r=n.sent(),o=r.value,r.done?[4,i(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,i(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))},t.isReadableStreamLike=function(e){return s.isFunction(null==e?void 0:e.getReader)}},9668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isScheduler=void 0;var n=r(2935);t.isScheduler=function(e){return e&&n.isFunction(e.schedule)}},6097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operate=t.hasLift=void 0;var n=r(2935);function i(e){return n.isFunction(null==e?void 0:e.lift)}t.hasLift=i,t.operate=function(e){return function(t){if(i(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}},9364:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noop=void 0,t.noop=function(){}},8781:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.not=void 0,t.not=function(e,t){return function(r,n){return!e.call(t,r,n)}}},5250:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pipeFromArray=t.pipe=void 0;var n=r(8987);function i(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}t.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportUnhandledError=void 0;var n=r(9179),i=r(1577);t.reportUnhandledError=function(e){i.timeoutProvider.setTimeout((function(){var t=n.config.onUnhandledError;if(!t)throw e;t(e)}))}},7756:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createInvalidObservableTypeError=void 0,t.createInvalidObservableTypeError=function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},9002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeAll=t.merge=t.max=t.materialize=t.mapTo=t.map=t.last=t.isEmpty=t.ignoreElements=t.groupBy=t.first=t.findIndex=t.find=t.finalize=t.filter=t.expand=t.exhaustMap=t.exhaustAll=t.exhaust=t.every=t.endWith=t.elementAt=t.distinctUntilKeyChanged=t.distinctUntilChanged=t.distinct=t.dematerialize=t.delayWhen=t.delay=t.defaultIfEmpty=t.debounceTime=t.debounce=t.count=t.connect=t.concatWith=t.concatMapTo=t.concatMap=t.concatAll=t.concat=t.combineLatestWith=t.combineLatest=t.combineLatestAll=t.combineAll=t.catchError=t.bufferWhen=t.bufferToggle=t.bufferTime=t.bufferCount=t.buffer=t.auditTime=t.audit=void 0,t.timeInterval=t.throwIfEmpty=t.throttleTime=t.throttle=t.tap=t.takeWhile=t.takeUntil=t.takeLast=t.take=t.switchScan=t.switchMapTo=t.switchMap=t.switchAll=t.subscribeOn=t.startWith=t.skipWhile=t.skipUntil=t.skipLast=t.skip=t.single=t.shareReplay=t.share=t.sequenceEqual=t.scan=t.sampleTime=t.sample=t.refCount=t.retryWhen=t.retry=t.repeatWhen=t.repeat=t.reduce=t.raceWith=t.race=t.publishReplay=t.publishLast=t.publishBehavior=t.publish=t.pluck=t.partition=t.pairwise=t.onErrorResumeNext=t.observeOn=t.multicast=t.min=t.mergeWith=t.mergeScan=t.mergeMapTo=t.mergeMap=t.flatMap=void 0,t.zipWith=t.zipAll=t.zip=t.withLatestFrom=t.windowWhen=t.windowToggle=t.windowTime=t.windowCount=t.window=t.toArray=t.timestamp=t.timeoutWith=t.timeout=void 0;var n=r(2605);Object.defineProperty(t,"audit",{enumerable:!0,get:function(){return n.audit}});var i=r(4152);Object.defineProperty(t,"auditTime",{enumerable:!0,get:function(){return i.auditTime}});var o=r(5149);Object.defineProperty(t,"buffer",{enumerable:!0,get:function(){return o.buffer}});var s=r(3189);Object.defineProperty(t,"bufferCount",{enumerable:!0,get:function(){return s.bufferCount}});var a=r(9459);Object.defineProperty(t,"bufferTime",{enumerable:!0,get:function(){return a.bufferTime}});var c=r(8145);Object.defineProperty(t,"bufferToggle",{enumerable:!0,get:function(){return c.bufferToggle}});var u=r(7764);Object.defineProperty(t,"bufferWhen",{enumerable:!0,get:function(){return u.bufferWhen}});var l=r(3056);Object.defineProperty(t,"catchError",{enumerable:!0,get:function(){return l.catchError}});var f=r(498);Object.defineProperty(t,"combineAll",{enumerable:!0,get:function(){return f.combineAll}});var d=r(7484);Object.defineProperty(t,"combineLatestAll",{enumerable:!0,get:function(){return d.combineLatestAll}});var h=r(6527);Object.defineProperty(t,"combineLatest",{enumerable:!0,get:function(){return h.combineLatest}});var p=r(4755);Object.defineProperty(t,"combineLatestWith",{enumerable:!0,get:function(){return p.combineLatestWith}});var b=r(3792);Object.defineProperty(t,"concat",{enumerable:!0,get:function(){return b.concat}});var m=r(482);Object.defineProperty(t,"concatAll",{enumerable:!0,get:function(){return m.concatAll}});var g=r(1774);Object.defineProperty(t,"concatMap",{enumerable:!0,get:function(){return g.concatMap}});var v=r(3977);Object.defineProperty(t,"concatMapTo",{enumerable:!0,get:function(){return v.concatMapTo}});var y=r(7672);Object.defineProperty(t,"concatWith",{enumerable:!0,get:function(){return y.concatWith}});var _=r(5561);Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return _.connect}});var w=r(8259);Object.defineProperty(t,"count",{enumerable:!0,get:function(){return w.count}});var E=r(3473);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return E.debounce}});var O=r(8390);Object.defineProperty(t,"debounceTime",{enumerable:!0,get:function(){return O.debounceTime}});var A=r(4562);Object.defineProperty(t,"defaultIfEmpty",{enumerable:!0,get:function(){return A.defaultIfEmpty}});var S=r(8151);Object.defineProperty(t,"delay",{enumerable:!0,get:function(){return S.delay}});var P=r(744);Object.defineProperty(t,"delayWhen",{enumerable:!0,get:function(){return P.delayWhen}});var T=r(8590);Object.defineProperty(t,"dematerialize",{enumerable:!0,get:function(){return T.dematerialize}});var I=r(8406);Object.defineProperty(t,"distinct",{enumerable:!0,get:function(){return I.distinct}});var R=r(7300);Object.defineProperty(t,"distinctUntilChanged",{enumerable:!0,get:function(){return R.distinctUntilChanged}});var x=r(4405);Object.defineProperty(t,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return x.distinctUntilKeyChanged}});var M=r(2787);Object.defineProperty(t,"elementAt",{enumerable:!0,get:function(){return M.elementAt}});var k=r(1665);Object.defineProperty(t,"endWith",{enumerable:!0,get:function(){return k.endWith}});var L=r(1511);Object.defineProperty(t,"every",{enumerable:!0,get:function(){return L.every}});var N=r(5592);Object.defineProperty(t,"exhaust",{enumerable:!0,get:function(){return N.exhaust}});var C=r(2008);Object.defineProperty(t,"exhaustAll",{enumerable:!0,get:function(){return C.exhaustAll}});var j=r(4019);Object.defineProperty(t,"exhaustMap",{enumerable:!0,get:function(){return j.exhaustMap}});var D=r(9101);Object.defineProperty(t,"expand",{enumerable:!0,get:function(){return D.expand}});var U=r(7261);Object.defineProperty(t,"filter",{enumerable:!0,get:function(){return U.filter}});var B=r(5381);Object.defineProperty(t,"finalize",{enumerable:!0,get:function(){return B.finalize}});var F=r(4127);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return F.find}});var K=r(9727);Object.defineProperty(t,"findIndex",{enumerable:!0,get:function(){return K.findIndex}});var H=r(7418);Object.defineProperty(t,"first",{enumerable:!0,get:function(){return H.first}});var G=r(7533);Object.defineProperty(t,"groupBy",{enumerable:!0,get:function(){return G.groupBy}});var $=r(9186);Object.defineProperty(t,"ignoreElements",{enumerable:!0,get:function(){return $.ignoreElements}});var V=r(7757);Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return V.isEmpty}});var z=r(3374);Object.defineProperty(t,"last",{enumerable:!0,get:function(){return z.last}});var q=r(6269);Object.defineProperty(t,"map",{enumerable:!0,get:function(){return q.map}});var W=r(5471);Object.defineProperty(t,"mapTo",{enumerable:!0,get:function(){return W.mapTo}});var Z=r(1160);Object.defineProperty(t,"materialize",{enumerable:!0,get:function(){return Z.materialize}});var J=r(1890);Object.defineProperty(t,"max",{enumerable:!0,get:function(){return J.max}});var Y=r(3982);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return Y.merge}});var X=r(400);Object.defineProperty(t,"mergeAll",{enumerable:!0,get:function(){return X.mergeAll}});var Q=r(9121);Object.defineProperty(t,"flatMap",{enumerable:!0,get:function(){return Q.flatMap}});var ee=r(6086);Object.defineProperty(t,"mergeMap",{enumerable:!0,get:function(){return ee.mergeMap}});var te=r(1244);Object.defineProperty(t,"mergeMapTo",{enumerable:!0,get:function(){return te.mergeMapTo}});var re=r(3699);Object.defineProperty(t,"mergeScan",{enumerable:!0,get:function(){return re.mergeScan}});var ne=r(8220);Object.defineProperty(t,"mergeWith",{enumerable:!0,get:function(){return ne.mergeWith}});var ie=r(770);Object.defineProperty(t,"min",{enumerable:!0,get:function(){return ie.min}});var oe=r(8413);Object.defineProperty(t,"multicast",{enumerable:!0,get:function(){return oe.multicast}});var se=r(9314);Object.defineProperty(t,"observeOn",{enumerable:!0,get:function(){return se.observeOn}});var ae=r(1899);Object.defineProperty(t,"onErrorResumeNext",{enumerable:!0,get:function(){return ae.onErrorResumeNext}});var ce=r(1186);Object.defineProperty(t,"pairwise",{enumerable:!0,get:function(){return ce.pairwise}});var ue=r(9857);Object.defineProperty(t,"partition",{enumerable:!0,get:function(){return ue.partition}});var le=r(9532);Object.defineProperty(t,"pluck",{enumerable:!0,get:function(){return le.pluck}});var fe=r(5745);Object.defineProperty(t,"publish",{enumerable:!0,get:function(){return fe.publish}});var de=r(8103);Object.defineProperty(t,"publishBehavior",{enumerable:!0,get:function(){return de.publishBehavior}});var he=r(2610);Object.defineProperty(t,"publishLast",{enumerable:!0,get:function(){return he.publishLast}});var pe=r(5299);Object.defineProperty(t,"publishReplay",{enumerable:!0,get:function(){return pe.publishReplay}});var be=r(6699);Object.defineProperty(t,"race",{enumerable:!0,get:function(){return be.race}});var me=r(3820);Object.defineProperty(t,"raceWith",{enumerable:!0,get:function(){return me.raceWith}});var ge=r(8083);Object.defineProperty(t,"reduce",{enumerable:!0,get:function(){return ge.reduce}});var ve=r(2588);Object.defineProperty(t,"repeat",{enumerable:!0,get:function(){return ve.repeat}});var ye=r(9249);Object.defineProperty(t,"repeatWhen",{enumerable:!0,get:function(){return ye.repeatWhen}});var _e=r(4486);Object.defineProperty(t,"retry",{enumerable:!0,get:function(){return _e.retry}});var we=r(9112);Object.defineProperty(t,"retryWhen",{enumerable:!0,get:function(){return we.retryWhen}});var Ee=r(4508);Object.defineProperty(t,"refCount",{enumerable:!0,get:function(){return Ee.refCount}});var Oe=r(778);Object.defineProperty(t,"sample",{enumerable:!0,get:function(){return Oe.sample}});var Ae=r(7701);Object.defineProperty(t,"sampleTime",{enumerable:!0,get:function(){return Ae.sampleTime}});var Se=r(8167);Object.defineProperty(t,"scan",{enumerable:!0,get:function(){return Se.scan}});var Pe=r(7821);Object.defineProperty(t,"sequenceEqual",{enumerable:!0,get:function(){return Pe.sequenceEqual}});var Te=r(2645);Object.defineProperty(t,"share",{enumerable:!0,get:function(){return Te.share}});var Ie=r(7566);Object.defineProperty(t,"shareReplay",{enumerable:!0,get:function(){return Ie.shareReplay}});var Re=r(4610);Object.defineProperty(t,"single",{enumerable:!0,get:function(){return Re.single}});var xe=r(5735);Object.defineProperty(t,"skip",{enumerable:!0,get:function(){return xe.skip}});var Me=r(3252);Object.defineProperty(t,"skipLast",{enumerable:!0,get:function(){return Me.skipLast}});var ke=r(1779);Object.defineProperty(t,"skipUntil",{enumerable:!0,get:function(){return ke.skipUntil}});var Le=r(5454);Object.defineProperty(t,"skipWhile",{enumerable:!0,get:function(){return Le.skipWhile}});var Ne=r(1923);Object.defineProperty(t,"startWith",{enumerable:!0,get:function(){return Ne.startWith}});var Ce=r(9130);Object.defineProperty(t,"subscribeOn",{enumerable:!0,get:function(){return Ce.subscribeOn}});var je=r(1695);Object.defineProperty(t,"switchAll",{enumerable:!0,get:function(){return je.switchAll}});var De=r(6649);Object.defineProperty(t,"switchMap",{enumerable:!0,get:function(){return De.switchMap}});var Ue=r(3054);Object.defineProperty(t,"switchMapTo",{enumerable:!0,get:function(){return Ue.switchMapTo}});var Be=r(2890);Object.defineProperty(t,"switchScan",{enumerable:!0,get:function(){return Be.switchScan}});var Fe=r(9438);Object.defineProperty(t,"take",{enumerable:!0,get:function(){return Fe.take}});var Ke=r(4125);Object.defineProperty(t,"takeLast",{enumerable:!0,get:function(){return Ke.takeLast}});var He=r(9008);Object.defineProperty(t,"takeUntil",{enumerable:!0,get:function(){return He.takeUntil}});var Ge=r(5884);Object.defineProperty(t,"takeWhile",{enumerable:!0,get:function(){return Ge.takeWhile}});var $e=r(5383);Object.defineProperty(t,"tap",{enumerable:!0,get:function(){return $e.tap}});var Ve=r(1016);Object.defineProperty(t,"throttle",{enumerable:!0,get:function(){return Ve.throttle}});var ze=r(567);Object.defineProperty(t,"throttleTime",{enumerable:!0,get:function(){return ze.throttleTime}});var qe=r(1332);Object.defineProperty(t,"throwIfEmpty",{enumerable:!0,get:function(){return qe.throwIfEmpty}});var We=r(1149);Object.defineProperty(t,"timeInterval",{enumerable:!0,get:function(){return We.timeInterval}});var Ze=r(1316);Object.defineProperty(t,"timeout",{enumerable:!0,get:function(){return Ze.timeout}});var Je=r(4972);Object.defineProperty(t,"timeoutWith",{enumerable:!0,get:function(){return Je.timeoutWith}});var Ye=r(1275);Object.defineProperty(t,"timestamp",{enumerable:!0,get:function(){return Ye.timestamp}});var Xe=r(9867);Object.defineProperty(t,"toArray",{enumerable:!0,get:function(){return Xe.toArray}});var Qe=r(7649);Object.defineProperty(t,"window",{enumerable:!0,get:function(){return Qe.window}});var et=r(5612);Object.defineProperty(t,"windowCount",{enumerable:!0,get:function(){return et.windowCount}});var tt=r(9972);Object.defineProperty(t,"windowTime",{enumerable:!0,get:function(){return tt.windowTime}});var rt=r(9593);Object.defineProperty(t,"windowToggle",{enumerable:!0,get:function(){return rt.windowToggle}});var nt=r(6307);Object.defineProperty(t,"windowWhen",{enumerable:!0,get:function(){return nt.windowWhen}});var it=r(5512);Object.defineProperty(t,"withLatestFrom",{enumerable:!0,get:function(){return it.withLatestFrom}});var ot=r(586);Object.defineProperty(t,"zip",{enumerable:!0,get:function(){return ot.zip}});var st=r(1221);Object.defineProperty(t,"zipAll",{enumerable:!0,get:function(){return st.zipAll}});var at=r(7594);Object.defineProperty(t,"zipWith",{enumerable:!0,get:function(){return at.zipWith}})},8743:e=>{e.exports=function(e){return ArrayBuffer.isView(e)?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e)}},227:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DeprecationError:()=>S,InvalidAddressError:()=>l,InvalidAmountError:()=>d,InvalidBlockHashError:()=>f,InvalidChainIdError:()=>w,InvalidContractAddressError:()=>_,InvalidDerivationPathError:()=>h,InvalidHexStringError:()=>p,InvalidKeyError:()=>g,InvalidKeyHashError:()=>E,InvalidMessageError:()=>b,InvalidOperationHashError:()=>O,InvalidOperationKindError:()=>A,InvalidPublicKeyError:()=>v,InvalidSignatureError:()=>y,InvalidViewParameterError:()=>m,NetworkError:()=>c,ParameterValidationError:()=>i,PermissionDeniedError:()=>u,ProhibitedActionError:()=>P,PublicKeyNotFoundError:()=>T,RpcError:()=>o,TaquitoError:()=>n,TezosToolkitConfigError:()=>s,UnsupportedActionError:()=>a});class n extends Error{}class i extends n{}class o extends n{}class s extends n{}class a extends n{}class c extends n{}class u extends n{}class l extends i{constructor(e,t){super(),this.address=e,this.errorDetail=t,this.name="InvalidAddressError",this.message=`Invalid address "${e}"`,this.message+=t?` ${t}.`:"."}}class f extends i{constructor(e,t){super(),this.blockHash=e,this.errorDetail=t,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${e}"`,this.message+=t?` ${t}.`:"."}}class d extends i{constructor(e){super(),this.amount=e,this.name="InvalidAmountError",this.message=`Invalid amount "${e}"`}}class h extends i{constructor(e,t){super(),this.derivationPath=e,this.errorDetail=t,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${e}"`,this.message+=t?` ${t}.`:"."}}class p extends i{constructor(e,t){super(),this.hexString=e,this.errorDetail=t,this.name="InvalidHexStringError",this.message=`Invalid hex string "${e}"`,this.message+=t?` ${t}.`:"."}}class b extends i{constructor(e,t){super(),this.msg=e,this.errorDetail=t,this.name="InvalidMessageError",this.message=`Invalid message "${e}"`,this.message+=t?` ${t}.`:"."}}class m extends i{constructor(e,t,r,n){super(),this.viewName=e,this.sigs=t,this.args=r,this.cause=n,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(r)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(t)}.`}}class g extends i{constructor(e){super(),this.errorDetail=e,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=e?` ${e}.`:"."}}class v extends i{constructor(e,t){super(),this.publicKey=e,this.errorDetail=t,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${e}"`,this.message+=t?` ${t}.`:"."}}class y extends i{constructor(e,t){super(),this.signature=e,this.errorDetail=t,this.name="InvalidSignatureError",this.message=`Invalid signature "${e}"`,this.message+=t?` ${t}.`:"."}}class _ extends i{constructor(e,t){super(),this.contractAddress=e,this.errorDetail=t,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${e}"`,this.message+=t?` ${t}.`:"."}}class w extends i{constructor(e,t){super(),this.chainId=e,this.errorDetail=t,this.name="InvalidChainIdError",this.message=`Invalid chain id "${e}"`,this.message+=t?` ${t}.`:"."}}class E extends i{constructor(e,t){super(),this.keyHash=e,this.errorDetail=t,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${e}"`,this.message+=t?` ${t}.`:"."}}class O extends i{constructor(e,t){super(),this.operationHash=e,this.errorDetail=t,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${e}"`,this.message+=t?` ${t}.`:"."}}class A extends i{constructor(e,t){super(),this.operationKind=e,this.errorDetail=t,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${e}"`,this.message+=t?` ${t}.`:"."}}class S extends a{constructor(e){super(),this.message=e,this.name="DeprecationError"}}class P extends a{constructor(e){super(),this.message=e,this.name="ProhibitedActionError"}}class T extends n{constructor(e,t){super(),this.pkh=e,this.cause=t,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${e}" in either wallet or contract API.`}}},5543:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HttpBackend:()=>d,HttpRequestFailed:()=>s,HttpResponseError:()=>a,HttpTimeoutError:()=>c,STATUS_CODE:()=>n,VERSION:()=>u});var n,i=r(227);function o(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s extends i.NetworkError{constructor(e,t,r){super(),this.method=e,this.url=t,this.cause=r,this.name="HttpRequestFailed",this.message=`${e} ${t} ${String(r)}`}}class a extends i.NetworkError{constructor(e,t,r,n,i){super(),this.message=e,this.status=t,this.statusText=r,this.body=n,this.url=i,this.name="HttpResponseError"}}class c extends i.NetworkError{constructor(e,t){super(),this.timeout=e,this.url=t,this.name="HttpTimeoutError",this.message=`HTTP request timeout of ${e}ms exceeded`}}!function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.ALREADY_REPORTED=208]="ALREADY_REPORTED",e[e.IM_USED=226]="IM_USED",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.SWITCH_PROXY=306]="SWITCH_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(n||(n={}));const u={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"};var l;let f=null===globalThis||void 0===globalThis?void 0:globalThis.fetch;"undefined"!=typeof process&&!!(null===(l=null===process||void 0===process?void 0:process.versions)||void 0===l?void 0:l.node)&&(f=r(4986));class d{constructor(e=3e4){this.timeout=e}serialize(e){if(!e)return"";const t=[];for(const r in e)if(e.hasOwnProperty(r)&&void 0!==e[r]){const n="function"==typeof e[r].toJSON?e[r].toJSON():e[r];if(null===n){t.push(encodeURIComponent(r));continue}if(Array.isArray(n)){n.forEach((e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}));continue}t.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}const r=t.join("&");return r?`?${r}`:""}createRequest({url:e,method:t,timeout:r=this.timeout,query:n,headers:i={},json:u=!0},l){return o(this,void 0,void 0,(function*(){const o=e+this.serialize(n);i["Content-Type"]||(i["Content-Type"]="application/json");const d=new AbortController,h=setTimeout((()=>d.abort()),r);try{const e=yield f(o,{method:t,headers:i,body:JSON.stringify(l),signal:d.signal});if(void 0===e)throw new Error("Response is undefined");if(e.status>=400){const t=yield e.text();throw new a(`Http error response: (${e.status}) ${t}`,e.status,e.statusText,t,o)}return u?e.json():e.text()}catch(e){throw e instanceof Error&&"AbortError"===e.name?new c(r,o):e instanceof a?e:new s(String(t),o,e)}finally{clearTimeout(h)}}))}}},4986:(e,t,r)=>{"use strict";var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response},5078:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CODEC:()=>c,LocalForger:()=>je,ProtocolsHash:()=>ke,Uint8ArrayConsumer:()=>T,VERSION:()=>Le,decoders:()=>Ie,encoders:()=>Re,getCodec:()=>Ce,localForger:()=>De,opMapping:()=>u,opMappingReverse:()=>l});var n=r(4632),i=r(227),o=r(2558);const s=e=>e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""),a=(e,t=8)=>e.toString(16).padStart(t,"0");var c;!function(e){e.SECRET="secret",e.RAW="raw",e.TZ1="tz1",e.BRANCH="branch",e.ZARITH="zarith",e.PUBLIC_KEY="public_key",e.PKH="pkh",e.PKH_ARR="pkhArr",e.DELEGATE="delegate",e.SCRIPT="script",e.BALLOT_STATEMENT="ballotStmt",e.PROPOSAL="proposal",e.PROPOSAL_ARR="proposalArr",e.INT32="int32",e.INT16="int16",e.PARAMETERS="parameters",e.ADDRESS="address",e.SMART_CONTRACT_ADDRESS="smart_contract_address",e.SMART_ROLLUP_ADDRESS="smart_rollup_address",e.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",e.VALUE="value",e.PADDED_BYTES="padded_bytes",e.SMART_ROLLUP_MESSAGE="smart_rollup_message",e.MANAGER="manager",e.BLOCK_PAYLOAD_HASH="blockPayloadHash",e.ENTRYPOINT="entrypoint",e.OPERATION="operation",e.OP_ACTIVATE_ACCOUNT="activate_account",e.OP_DELEGATION="delegation",e.OP_TRANSACTION="transaction",e.OP_ORIGINATION="origination",e.OP_BALLOT="ballot",e.OP_FAILING_NOOP="failing_noop",e.OP_ATTESTATION="attestation",e.OP_ENDORSEMENT="endorsement",e.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",e.OP_REVEAL="reveal",e.OP_PROPOSALS="proposals",e.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",e.OP_TRANSFER_TICKET="transfer_ticket",e.BURN_LIMIT="burn_limit",e.OP_INCREASE_PAID_STORAGE="increase_paid_storage",e.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",e.OP_DRAIN_DELEGATE="drain_delegate",e.DEPOSITS_LIMIT="deposits_limit",e.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",e.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",e.PVM_KIND="pvm_kind",e.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",e.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message"}(c||(c={}));const u={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction_deprecated",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET_DEPRECATED",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ",94:"tx_rollup_l2_address",95:"MIN_BLOCK_TIME",96:"sapling_transaction",97:"EMIT",98:"Lambda_rec",99:"LAMBDA_REC","9a":"TICKET","9b":"BYTES","9c":"NAT"},l=(()=>{const e={};return Object.keys(u).forEach((t=>{e[u[t]]=t})),e})(),f={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",21:"attestation",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant",158:"transfer_ticket",112:"set_deposits_limit",113:"increase_paid_storage",114:"update_consensus_key",9:"drain_delegate",200:"smart_rollup_originate",201:"smart_rollup_add_messages",206:"smart_rollup_execute_outbox_message",17:"failing_noop"},d=(()=>{const e={};return Object.keys(f).forEach((t=>{const r="string"==typeof t?parseInt(t,10):t;e[f[r]]=a(r,2)})),e})(),h={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate","05":"deposit"},p=(()=>{const e={};return Object.keys(h).forEach((t=>{e[h[t]]=t})),e})();class b extends i.ParameterValidationError{constructor(e,t){super(),this.operation=e,this.errorDetail=t,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",t&&(this.message+=` ${t}.`)}}class m extends i.ParameterValidationError{constructor(e){super(),this.entrypoint=e,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${e.length}", maximum length is "31".`}}class g extends i.ParameterValidationError{constructor(e){super(),this.ballotValue=e,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${e}" expecting one of the following: "yay", "nay", "pass".`}}class v extends i.ParameterValidationError{constructor(e){super(),this.ballotValue=e,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${e}", cannot be decoded.`}}class y extends i.ParameterValidationError{constructor(e){super(),this.value=e,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${e}", unalbe to encode.`}}class _ extends i.ParameterValidationError{constructor(e){super(),this.message=e,this.name="OperationDecodingError"}}class w extends i.ParameterValidationError{constructor(e){super(),this.message=e,this.name="OperationEncodingError"}}class E extends i.ParameterValidationError{constructor(e){super(),this.op=e,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${e}", can submit an issue on our github for feature request.`}}class O extends i.ParameterValidationError{constructor(e){super(),this.pvm=e,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${e}" expecting either "arith" or "wasm_2_0_0".`}}class A extends i.ParameterValidationError{constructor(e){super(),this.pvm=e,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${e}", cannot be decoded.`}}class S extends i.ParameterValidationError{constructor(e,t){super(),this.address=e,this.errorDetail=t,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${e}"`,t&&(this.message+=` ${t}.`)}}class P extends i.ParameterValidationError{constructor(e,t){super(),this.hash=e,this.errorDetail=t,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${e}"`,t&&(this.message+=` ${t}.`)}}class T{static fromHexString(e){const t=e.toLowerCase();if(/^(([a-f]|\d){2})*$/.test(t)){const e=new Uint8Array((t.match(/([a-z]|\d){2}/g)||[]).map((e=>parseInt(e,16))));return new T(e)}throw new i.InvalidHexStringError(t)}constructor(e,t=0){this.arr=e,this.offset=t}consume(e){const t=this.arr.subarray(this.offset,this.offset+e);return this.offset+=e,t}get(e){return this.arr[this.offset+e]}length(){return this.arr.length-this.offset}slice(e,t){return new T(this.arr.slice(e,t))}}const I=e=>{if(Array.isArray(e)){const t=e.map((e=>I(e))).join(""),r=t.length/2;return`02${a(r)}${t}`}if((e=>"prim"in e)(e))return D(e);if((e=>"bytes"in e&&"string"==typeof e.bytes)(e))return M(e);if((e=>"string"in e&&"string"==typeof e.string)(e))return L(e);if((e=>"int"in e&&"string"==typeof e.int)(e))return C(e);throw new y(JSON.stringify(e))},R=e=>{const t=e.consume(1);switch(t[0]){case 10:return k(e);case 1:return N(e);case 0:return j(e);case 2:{const t=new T(x(e)),r=[];for(;t.length()>0;)r.push(R(t));return r}default:return U(e,t)}},x=(e,t=4)=>{const r=e.consume(t),n=parseInt(Buffer.from(r).toString("hex"),16);return e.consume(n)},M=e=>{if(!/^([A-Fa-f0-9]{2})*$/.test(e.bytes))throw new i.InvalidHexStringError(e.bytes);const t=e.bytes.length/2;return`0a${a(t)}${e.bytes}`},k=e=>{const t=x(e);return{bytes:Buffer.from(t).toString("hex")}},L=e=>{const t=Buffer.from(e.string,"utf8").toString("hex"),r=t.length/2;return`01${a(r)}${t}`},N=e=>{const t=x(e);return{string:Buffer.from(t).toString("utf8")}},C=({int:e})=>{const t=new o.O(e,10),r="-"===t.toString(2)[0]?"1":"0",n=t.toString(2).replace(/-/g,""),i=n.length<=6?6:(n.length-6)%7?n.length+7-(n.length-6)%7:n.length,s=n.padStart(i,"0").match(/\d{6,7}/g).reverse();s[0]=r+s[0];return`00${s.map(((e,t)=>parseInt((t===s.length-1?"0":"1")+e,2).toString(16).padStart(2,"0"))).join("")}`},j=e=>{let t=e.consume(1)[0];const r=[];for(;128&t;)r.push(t),t=e.consume(1)[0];r.push(t);const n=!!(64&r[0]);r[0]=127&r[0];const i=r.map(((e,t)=>e.toString(2).slice(0===t?-6:-7).padStart(0===t?6:7,"0"))).reverse();let s=new o.O(i.join(""),2);return n&&(s=s.times(-1)),{int:s.toFixed()}},D=e=>{const t=+Array.isArray(e.annots),r=Array.isArray(e.args)?e.args.length:0,n=a(Math.min(2*r+t+3,9),2),i=l[e.prim];let o=(e.args||[]).map((e=>I(e))).join("");const s=Array.isArray(e.annots)?K(e.annots):"";return"LAMBDA"!==e.prim&&"LAMBDA_REC"!==e.prim||!r||(o=a(o.length/2)+o+a(0)),("pair"===e.prim||"Pair"===e.prim)&&r>2&&(o=""===s?a(o.length/2)+o+a(0):a(o.length/2)+o),"view"===e.prim&&e.args&&(o=a(o.length/2)+o+a(0)),`${n}${i}${o}${s}`},U=(e,t)=>{const r=(t[0]-3)%2==1;let n=Math.floor((t[0]-3)/2);const i=e.consume(1)[0].toString(16).padStart(2,"0"),o={prim:u[i]};if("LAMBDA"!==u[i]&&"LAMBDA_REC"!==u[i]||e.consume(4),"view"===u[i])return 0!=n?B(e,o):o;let s,a;("pair"===u[i]||"Pair"===u[i])&&n>2&&(s=F(e),n=0,a=H(e));const c=new Array(n).fill(0).map((()=>R(e)));return"LAMBDA"!==u[i]&&"LAMBDA_REC"!==u[i]||e.consume(4),s?o.args=s:c.length&&(o.args=c),a&&""!==a[0]?o.annots=a:r&&(o.annots=H(e)),o},B=(e,t)=>(e.consume(4),t.args=new Array(4).fill(0).map((()=>R(e))),e.consume(4),t),F=e=>{const t=new T(x(e)),r=[];for(;t.length()>0;)r.push(R(t));return r},K=e=>{const t=e.map((e=>Buffer.from(e,"utf8").toString("hex"))).join("20"),r=t.length/2;return`${a(r)}${t}`},H=e=>{const t=e.consume(4),r=parseInt(Buffer.from(t).toString("hex"),16),n=e.consume(r);return Buffer.from(n).toString("hex").split("20").map((e=>Buffer.from(e,"hex").toString("utf8")))},G=e=>t=>(0,n.buf2hex)(Buffer.from((0,n.b58cdecode)(t,n.prefix[e]))),$=e=>t=>{const r=t.consume(n.prefixLength[e]);return(0,n.b58cencode)(r,n.prefix[e])},V=$(n.Prefix.TZ1),z=$(n.Prefix.B),q=e=>{const t=e.consume(1);return 0===t[0]?$(n.Prefix.TZ1)(e):1===t[0]?$(n.Prefix.TZ2)(e):2===t[0]?$(n.Prefix.TZ3)(e):void 0},W=G(n.Prefix.B),Z=G(n.Prefix.TZ1),J=e=>e?"ff":"00",Y=e=>G(n.Prefix.P)(e),X=e=>$(n.Prefix.P)(e),Q=e=>255===e.consume(1)[0],ee=e=>{switch(e.substring(0,3)){case n.Prefix.TZ1:return"00"+G(n.Prefix.TZ1)(e);case n.Prefix.TZ2:return"01"+G(n.Prefix.TZ2)(e);case n.Prefix.TZ3:return"02"+G(n.Prefix.TZ3)(e);case n.Prefix.TZ4:return"03"+G(n.Prefix.TZ4)(e);default:throw new n.InvalidKeyHashError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one for the following "${n.Prefix.TZ1}", "${n.Prefix.TZ2}", "${n.Prefix.TZ3}" or "${n.Prefix.TZ4}".`)}},te=e=>{const t=[];let r=new o.Z(e,10);if(r.isNaN())throw new TypeError(`Invalid zarith number ${e}`);for(;;){if(r.lt(128)){r.lt(16)&&t.push("0"),t.push(r.toString(16));break}{let e=r.mod(128);r=r.minus(e),r=r.dividedBy(128),e=e.plus(128),t.push(e.toString(16))}}return t.join("")},re=e=>{let t=0;for(;t=0;n-=1){const t=127&e.get(n);r=r.multipliedBy(128),r=r.plus(t)}return e.consume(t+1),new o.Z(r).toString()},ne=G(n.Prefix.VH),ie=$(n.Prefix.VH),oe={branch:c.BRANCH,contents:[c.OPERATION]},se={pkh:c.TZ1,secret:c.SECRET},ae={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,public_key:c.PUBLIC_KEY},ce={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,delegate:c.DELEGATE},ue={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,amount:c.ZARITH,destination:c.ADDRESS,parameters:c.PARAMETERS},le={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,balance:c.ZARITH,delegate:c.DELEGATE,script:c.SCRIPT},fe={source:c.PKH,period:c.INT32,proposal:c.PROPOSAL,ballot:c.BALLOT_STATEMENT},de={slot:c.INT16,level:c.INT32,round:c.INT32,block_payload_hash:c.BLOCK_PAYLOAD_HASH},he={slot:c.INT16,level:c.INT32,round:c.INT32,block_payload_hash:c.BLOCK_PAYLOAD_HASH},pe={level:c.INT32,nonce:c.RAW},be={source:c.PKH,period:c.INT32,proposals:c.PROPOSAL_ARR},me={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,value:c.VALUE},ge={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,ticket_contents:c.VALUE,ticket_ty:c.VALUE,ticket_ticketer:c.ADDRESS,ticket_amount:c.ZARITH,destination:c.ADDRESS,entrypoint:c.ENTRYPOINT},ve={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,amount:c.ZARITH,destination:c.SMART_CONTRACT_ADDRESS},ye={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,pk:c.PUBLIC_KEY},_e={consensus_key:c.PKH,delegate:c.PKH,destination:c.PKH},we={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,limit:c.DEPOSITS_LIMIT},Ee={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,pvm_kind:c.PVM_KIND,kernel:c.PADDED_BYTES,parameters_ty:c.VALUE,whitelist:c.PKH_ARR},Oe={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,message:c.SMART_ROLLUP_MESSAGE},Ae={source:c.PKH,fee:c.ZARITH,counter:c.ZARITH,gas_limit:c.ZARITH,storage_limit:c.ZARITH,rollup:c.SMART_ROLLUP_ADDRESS,cemented_commitment:c.SMART_ROLLUP_COMMITMENT_HASH,output_proof:c.PADDED_BYTES},Se={arbitrary:c.PADDED_BYTES},Pe=e=>t=>r=>Object.keys(t).reduce(((n,i)=>{const o=t[i];if(r&&Array.isArray(o)){const t=e[o[0]],s=r[i];if(!Array.isArray(s))throw new w(`Invalid operation value "${JSON.stringify(s)}" of key "${i}, expected value to be Array.`);return n+s.reduce(((e,r)=>e+t(r)),"")}return n+(0,e[o])(r[i])}),""),Te=e=>t=>r=>Object.keys(t).reduce(((n,i)=>{const o=t[i];if(Array.isArray(o)){const t=e[o[0]],s=[],a=r.length();for(;r.length()>0;)if(s.push(t(r)),a===r.length())throw new _("Unable to decode value");return Object.assign(Object.assign({},n),{[i]:s})}{const t=(0,e[o])(r);return void 0!==t?Object.assign(Object.assign({},n),{[i]:t}):Object.assign({},n)}}),{}),Ie={[c.SECRET]:e=>s(e.consume(20)),[c.RAW]:e=>s(e.consume(32)),[c.TZ1]:V,[c.BRANCH]:z,[c.ZARITH]:re,[c.PUBLIC_KEY]:e=>{switch(e.consume(1)[0]){case 0:return $(n.Prefix.EDPK)(e);case 1:return $(n.Prefix.SPPK)(e);case 2:return $(n.Prefix.P2PK)(e);default:throw new n.InvalidPublicKeyError(e.toString(),(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED))}},[c.PKH]:q,[c.PKH_ARR]:e=>{if(!Q(e))return;const t=[];for(e.consume(4);e.length()>0;)t.push(q(e));return t},[c.DELEGATE]:e=>{if(Q(e))return q(e)},[c.INT32]:e=>{const t=e.consume(4);let r=0;for(let e=0;e{const t=x(e),r=x(e);return{code:R(new T(t)),storage:R(new T(r))}},[c.BALLOT_STATEMENT]:e=>{const t=e.consume(1);switch(t[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new v(t[0].toString())}},[c.PROPOSAL]:X,[c.PROPOSAL_ARR]:e=>{const t=[];for(e.consume(4);e.length()>0;)t.push(X(e));return t},[c.PARAMETERS]:e=>{if(0!==e.consume(1)[0]){const t=(e=>{const t=a(e.consume(1)[0],2);if(t in h)return h[t];{const t=x(e,1),r=Buffer.from(t).toString("utf8");if(r.length>31)throw new m(r);return r}})(e),r=x(e);return{entrypoint:t,value:R(new T(r))}}},[c.ADDRESS]:e=>{switch(e.consume(1)[0]){case 0:return q(e);case 1:{const t=$(n.Prefix.KT1)(e);return e.consume(1),t}default:throw new i.InvalidAddressError(e.toString(),": Unable to decode.")}},[c.SMART_ROLLUP_ADDRESS]:e=>{const t=$(n.Prefix.SR1)(e);if(t.substring(0,3)!==n.Prefix.SR1)throw new S(t,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SR1}'.`);return t},[c.SMART_CONTRACT_ADDRESS]:e=>{if(1===e.consume(1)[0]){const t=$(n.Prefix.KT1)(e);return e.consume(1),t}throw new i.InvalidContractAddressError(e.toString(),(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED))},[c.SMART_ROLLUP_COMMITMENT_HASH]:e=>{const t=$(n.Prefix.SRC1)(e);if(t.substring(0,4)!==n.Prefix.SRC1)throw new P(t,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SRC1}'`);return t},[c.VALUE]:e=>{const t=x(e);return R(new T(t))},[c.INT16]:e=>{const t=e.consume(2);let r=0;for(let e=0;e{const t=x(e);return Buffer.from(t).toString("utf8")},[c.BURN_LIMIT]:e=>{const t=e.consume(1);if("00"!==Buffer.from(t).toString("hex"))return re(e)},[c.DEPOSITS_LIMIT]:e=>{const t=e.consume(1);if("00"!==Buffer.from(t).toString("hex"))return re(e)},[c.PVM_KIND]:e=>{const t=e.consume(1);switch(t[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new A(t[0].toString())}},[c.PADDED_BYTES]:e=>{const t=x(e);return Buffer.from(t).toString("hex")},[c.SMART_ROLLUP_MESSAGE]:e=>{const t=x(e);return((e,t=4)=>{const r=[];let n=e;for(;n.length();){const e=n.consume(t),i=parseInt(Buffer.from(e).toString("hex"),16);r.push(n.consume(i)),n=n.slice(i+t)}return r})(new T(t)).map((e=>Buffer.from(e).toString("hex")))}};Ie[c.OPERATION]=(e=>t=>{const r=t.consume(1),n=f[r[0]];if(void 0===n)throw new E(r[0].toString());const i=e[n](t);if("object"!=typeof i)throw new _("Invalid operation, cannot be decoded.");return Object.assign({kind:n},i)})(Ie),Ie[c.OP_ACTIVATE_ACCOUNT]=e=>Te(Ie)(se)(e),Ie[c.OP_FAILING_NOOP]=e=>Te(Ie)(Se)(e),Ie[c.OP_DELEGATION]=e=>Te(Ie)(ce)(e),Ie[c.OP_TRANSACTION]=e=>Te(Ie)(ue)(e),Ie[c.OP_ORIGINATION]=e=>Te(Ie)(le)(e),Ie[c.OP_BALLOT]=e=>Te(Ie)(fe)(e),Ie[c.OP_ATTESTATION]=e=>Te(Ie)(de)(e),Ie[c.OP_ENDORSEMENT]=e=>Te(Ie)(he)(e),Ie[c.OP_SEED_NONCE_REVELATION]=e=>Te(Ie)(pe)(e),Ie[c.OP_PROPOSALS]=e=>Te(Ie)(be)(e),Ie[c.OP_REVEAL]=e=>Te(Ie)(ae)(e),Ie[c.OP_REGISTER_GLOBAL_CONSTANT]=e=>Te(Ie)(me)(e),Ie[c.OP_TRANSFER_TICKET]=e=>Te(Ie)(ge)(e),Ie[c.OP_INCREASE_PAID_STORAGE]=e=>Te(Ie)(ve)(e),Ie[c.OP_UPDATE_CONSENSUS_KEY]=e=>Te(Ie)(ye)(e),Ie[c.OP_DRAIN_DELEGATE]=e=>Te(Ie)(_e)(e),Ie[c.OP_SMART_ROLLUP_ORIGINATE]=e=>Te(Ie)(Ee)(e),Ie[c.OP_SMART_ROLLUP_ADD_MESSAGES]=e=>Te(Ie)(Oe)(e),Ie[c.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=e=>Te(Ie)(Ae)(e),Ie[c.MANAGER]=Te(Ie)(oe),Ie[c.OP_SET_DEPOSITS_LIMIT]=e=>Te(Ie)(we)(e);const Re={[c.SECRET]:e=>e,[c.RAW]:e=>e,[c.TZ1]:Z,[c.BRANCH]:W,[c.ZARITH]:te,[c.PUBLIC_KEY]:e=>{switch(e.substring(0,4)){case n.Prefix.EDPK:return"00"+G(n.Prefix.EDPK)(e);case n.Prefix.SPPK:return"01"+G(n.Prefix.SPPK)(e);case n.Prefix.P2PK:return"02"+G(n.Prefix.P2PK)(e);default:throw new n.InvalidPublicKeyError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following '${n.Prefix.EDPK}', '${n.Prefix.SPPK}', '${n.Prefix.P2PK}' or '${n.Prefix.BLPK}'.`)}},[c.PKH]:ee,[c.PKH_ARR]:e=>{if(!e)return J(!1);if(0===e.length)return J(!0)+a(0);const t=e.reduce(((e,t)=>e+ee(t)),"");return J(!0)+a(t.length/2)+t},[c.DELEGATE]:e=>e?J(!0)+ee(e):J(!1),[c.SCRIPT]:e=>{const t=I(e.code),r=I(e.storage);return`${a(t.length/2,8)}${t}${a(r.length/2,8)}${r}`},[c.BALLOT_STATEMENT]:e=>{switch(e){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new g(e)}},[c.PROPOSAL]:Y,[c.PROPOSAL_ARR]:e=>a(32*e.length)+e.map((e=>Y(e))).join(""),[c.INT32]:e=>{const t=parseInt(String(e),10),r=[];for(let e=0;e<4;e++){const n=8*(4-(e+1));r.push((t&255<>n)}return Buffer.from(r).toString("hex")},[c.PARAMETERS]:e=>{if(!e||"default"===e.entrypoint&&"prim"in e.value&&"Unit"===e.value.prim)return"00";const t=(e=>{if(e in p)return`${p[e]}`;if(e.length>31)throw new m(e);return`ff${I({string:e}).slice(8)}`})(e.entrypoint),r=I(e.value);return`ff${t}${(r.length/2).toString(16).padStart(8,"0")}${r}`},[c.ADDRESS]:e=>{switch(e.substring(0,3)){case n.Prefix.TZ1:case n.Prefix.TZ2:case n.Prefix.TZ3:case n.Prefix.TZ4:return"00"+ee(e);case n.Prefix.KT1:return"01"+G(n.Prefix.KT1)(e)+"00";default:throw new i.InvalidAddressError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following prefix '${n.Prefix.TZ1}', ${n.Prefix.TZ2}', '${n.Prefix.TZ3}', '${n.Prefix.TZ4}' or '${n.Prefix.KT1}'.`)}},[c.SMART_ROLLUP_ADDRESS]:e=>{if(e.substring(0,3)!==n.Prefix.SR1)throw new S(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SR1}'.`);return G(n.Prefix.SR1)(e)},[c.SMART_CONTRACT_ADDRESS]:e=>{if(e.substring(0,3)===n.Prefix.KT1)return"01"+G(n.Prefix.KT1)(e)+"00";throw new i.InvalidContractAddressError(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.KT1}'.`)},[c.SMART_ROLLUP_COMMITMENT_HASH]:e=>{if(e.substring(0,4)===n.Prefix.SRC1)return G(n.Prefix.SRC1)(e);throw new P(e,(0,n.invalidDetail)(n.ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${n.Prefix.SRC1}'`)},[c.VALUE]:e=>{const t=I(e);return`${a(t.length/2)}${t}`},[c.INT16]:e=>{const t=parseInt(String(e),10),r=[];for(let e=0;e<2;e++){const n=8*(2-(e+1));r.push((t&255<>n)}return Buffer.from(r).toString("hex")},[c.BLOCK_PAYLOAD_HASH]:ne,[c.ENTRYPOINT]:e=>`${I({string:e}).slice(2)}`,[c.BURN_LIMIT]:e=>e?`ff${te(e)}`:"00",[c.DEPOSITS_LIMIT]:e=>e?`ff${te(e)}`:"00",[c.PVM_KIND]:e=>{switch(e){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new O(e)}},[c.PADDED_BYTES]:(e,t=8)=>`${a(e.length/2,t)}${e}`,[c.SMART_ROLLUP_MESSAGE]:e=>{const t=e.reduce(((e,t)=>e+`${a(t.length/2)}${t}`),"");return`${a(t.length/2)}${t}`}};Re[c.OPERATION]=(e=>t=>{if(!(t.kind in e)||!(t.kind in d))throw new i.InvalidOperationKindError(t.kind);return d[t.kind]+e[t.kind](t)})(Re),Re[c.OP_ACTIVATE_ACCOUNT]=e=>Pe(Re)(se)(e),Re[c.OP_DELEGATION]=e=>Pe(Re)(ce)(e),Re[c.OP_TRANSACTION]=e=>Pe(Re)(ue)(e),Re[c.OP_ORIGINATION]=e=>Pe(Re)(le)(e),Re[c.OP_BALLOT]=e=>Pe(Re)(fe)(e),Re[c.OP_ATTESTATION]=e=>Pe(Re)(de)(e),Re[c.OP_ENDORSEMENT]=e=>Pe(Re)(he)(e),Re[c.OP_SEED_NONCE_REVELATION]=e=>Pe(Re)(pe)(e),Re[c.OP_PROPOSALS]=e=>Pe(Re)(be)(e),Re[c.OP_REVEAL]=e=>Pe(Re)(ae)(e),Re[c.OP_REGISTER_GLOBAL_CONSTANT]=e=>Pe(Re)(me)(e),Re[c.OP_TRANSFER_TICKET]=e=>Pe(Re)(ge)(e),Re[c.OP_INCREASE_PAID_STORAGE]=e=>Pe(Re)(ve)(e),Re[c.OP_UPDATE_CONSENSUS_KEY]=e=>Pe(Re)(ye)(e),Re[c.OP_DRAIN_DELEGATE]=e=>Pe(Re)(_e)(e),Re[c.OP_SMART_ROLLUP_ORIGINATE]=e=>Pe(Re)(Ee)(e),Re[c.OP_SMART_ROLLUP_ADD_MESSAGES]=e=>Pe(Re)(Oe)(e),Re[c.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=e=>Pe(Re)(Ae)(e),Re[c.MANAGER]=Pe(Re)(oe),Re[c.OP_SET_DEPOSITS_LIMIT]=e=>Pe(Re)(we)(e),Re[c.OP_FAILING_NOOP]=e=>Pe(Re)(Se)(e);const xe={activate_account:se,reveal:ae,delegation:ce,transaction:ue,origination:le,ballot:fe,attestation:de,endorsement:he,seed_nonce_revelation:pe,proposals:be,register_global_constant:me,transfer_ticket:ge,increase_paid_storage:ve,update_consensus_key:ye,drain_delegate:_e,set_deposits_limit:we,smart_rollup_originate:Ee,smart_rollup_add_messages:Oe,smart_rollup_execute_outbox_message:Ae,failing_noop:Se},Me=e=>{const t=e.kind,r=Object.keys(e),n=(i="kind",r.filter((e=>e!==i)));var i;const o=Object.keys(xe[t]);return s=n,o.filter((e=>!s.includes(e)));var s};var ke;!function(e){e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(ke||(ke={}));const Le={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"},Ne=ke.ProxfordY;function Ce(e,t){return{encoder:Re[e],decoder:t=>{const r=T.fromHexString(t);return Ie[e](r)}}}class je{constructor(e=Ne){this.protocolHash=e,this.codec=Ce(c.MANAGER,this.protocolHash)}forge(e){const t=(0,n.validateBlock)(e.branch);if(t!==n.ValidationResult.VALID)throw new i.InvalidBlockHashError(e.branch,(0,n.invalidDetail)(t));for(const t of e.contents){if(r=t.kind,!Object.keys(xe).includes(r))throw new i.InvalidOperationKindError(t.kind);const e=Me(t);if(1===e.length){if("delegation"===t.kind&&"delegate"===e[0])continue;if("origination"===t.kind&&"delegate"===e[0])continue;if("transaction"===t.kind&&"parameters"===e[0])continue;if("set_deposits_limit"===t.kind&&"limit"===e[0])continue;if("smart_rollup_originate"===t.kind&&"whitelist"===e[0])continue;throw new b(t,`missing properties "${e.join(", ")}"`)}if(e.length>1)throw new b(t,`missing properties "${e.join(", ")}"`)}var r;const o=this.codec.encoder(e).toLowerCase();return Promise.resolve(o)}parse(e){return Promise.resolve(this.codec.decoder(e))}}const De=new je},9985:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Contract:()=>nr,DefaultProtocol:()=>b,JSONParseError:()=>j,MacroError:()=>y,MichelineParseError:()=>C,MichelsonError:()=>ue,MichelsonInstructionError:()=>Ct,MichelsonTypeError:()=>fe,MichelsonValidationError:()=>ke,Parser:()=>K,ProtoGreaterOrEqual:()=>g,ProtoInferiorTo:()=>v,Protocol:()=>p,VERSION:()=>cr,assertContractValid:()=>Zt,assertDataListIfAny:()=>ot,assertDataValid:()=>Jt,assertMichelsonBigMapStorableType:()=>qe,assertMichelsonComparableType:()=>He,assertMichelsonContract:()=>Qe,assertMichelsonData:()=>Xe,assertMichelsonInstruction:()=>Ke,assertMichelsonPackableType:()=>Ge,assertMichelsonPassableType:()=>ze,assertMichelsonPushableType:()=>$e,assertMichelsonStorableType:()=>Ve,assertMichelsonType:()=>Je,assertTypeAnnotationsValid:()=>Ft,assertTypesEqual:()=>Xt,assertViewNameValid:()=>Ze,contractEntryPoint:()=>qt,contractEntryPoints:()=>Wt,contractSection:()=>$t,contractViews:()=>Vt,decodeAddressBytes:()=>kt,decodePublicKeyBytes:()=>Nt,decodePublicKeyHashBytes:()=>Lt,dummyContract:()=>ir,emitMicheline:()=>z,formatError:()=>ar,formatStack:()=>or,functionType:()=>Yt,instructionIDs:()=>Re,isContractValid:()=>er,isDataValid:()=>tr,isInstruction:()=>it,isMichelsonCode:()=>rt,isMichelsonData:()=>tt,isMichelsonError:()=>le,isMichelsonScript:()=>et,isMichelsonType:()=>nt,isTypeAnnotationsValid:()=>Qt,isTypeEqual:()=>rr,packData:()=>Pt,packDataBytes:()=>Tt,refContract:()=>h,sourceReference:()=>i,traceDumpFunc:()=>sr,unpackData:()=>xt,unpackDataBytes:()=>Mt});var n=r(227);const i=Symbol("source_reference");class o extends n.TaquitoError{constructor(e,t,r){super(),this.src=e,this.idx=t,this.message=r,this.name="ScanError"}}var s;!function(e){e[e.Comment=0]="Comment",e[e.Number=1]="Number",e[e.String=2]="String",e[e.Bytes=3]="Bytes",e[e.Ident=4]="Ident"}(s||(s={}));const a=new RegExp("\\s"),c=new RegExp("[:@%_A-Za-z]"),u=new RegExp("[@%_\\.A-Za-z0-9]"),l=new RegExp("[0-9]"),f=new RegExp("[0-9a-fA-F]");function*d(e,t=!1){let r=0;for(;r1&&"0x"===e.substring(r,r+2)){for(r+=2;r1&&"/*"===e.substring(r,r+2)){for(r+=2;r1&&"*/"===e.substring(r,r+2));)r++;if(r===e.length)throw new o(e,r,"Unterminated C style comment");r+=2,t&&(yield{t:s.Comment,v:e.slice(i,r),first:i,last:r})}else{if("("!==n&&")"!==n&&"{"!==n&&"}"!==n&&";"!==n)throw new o(e,r,`Invalid character at offset ${r}: \`${n}'`);r++,yield{t:n,v:n,first:i,last:r}}}}const h=Symbol("ref_contract");var p;!function(e){e.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",e.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",e.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",e.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(p||(p={}));const b=p.Psithaca2,m={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:12,PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw:13,PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY:13,PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg:14,PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW:15,PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc:16,PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1:16,PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf:17,ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH:19,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:20};function g(e,t){return m[e]>=m[t]}function v(e,t){return m[e][e+1,t])),i+=a,o+=u;break}case"I":o!==r.length&&(s[1]=r[o++]);break;default:throw new y(e,`${e.prim}: unexpected character: ${u}`)}return{r:n(a,c,[0,s]),n:i,an:o}}function A(e,t,r,n){const i=t[0];switch(i){case"A":return t.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},A(e,t.slice(1),[],n)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...r]}]:n.a;case"D":return t.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},A(e,t.slice(1),[],n)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...r]}]:n.d;default:throw new y(e,`${e.prim}: unexpected character: ${i}`)}}function S(e,t){let r=e.length;for(;r>0&&e[r-1]===t;)r--;return e.slice(0,r)}function P(e){const t=[],r=[];if(void 0!==e)for(const n of e)(0!==n.length&&"%"===n[0]?t:r).push(n);return{fields:t,rest:r}}function T({prim:e,annots:t,args:r}){return Object.assign(Object.assign({prim:e},t&&{annots:t}),r&&{args:r})}const I=/^P[PAI]{3,}R$/,R=/^UNP[PAI]{2,}R$/,x=/^C[AD]{2,}R$/,M=/^SET_C[AD]+R$/,k=/^MAP_C[AD]+R$/,L=/^DI{2,}P$/,N=/^DU+P$/;class C extends n.TaquitoError{constructor(e,t){super(),this.token=e,this.message=t,this.name="MichelineParseError"}}class j extends n.TaquitoError{constructor(e,t){super(),this.node=e,this.message=t,this.name="JSONParseError"}}const D=new C(null,"Unexpected EOF");function U(e){return e.t===s.Ident&&("@"===e.v[0]||"%"===e.v[0]||":"===e.v[0])}const B=new RegExp("^-?[0-9]+$"),F=new RegExp("^([0-9a-fA-F]{2})*$");class K{constructor(e){this.opt=e}expand(e){var t,r,n;if(void 0!==(null===(t=this.opt)||void 0===t?void 0:t.expandGlobalConstant)&&"constant"===e.prim){const t=function(e,t){return void 0!==e.args&&1===e.args.length&&"string"in e.args[0]&&e.args[0].string in t?t[e.args[0].string]:e}(e,this.opt.expandGlobalConstant);return t!==e&&(t[i]=Object.assign(Object.assign({},e[i]||{first:0,last:0}),{globalConstant:e})),t}if(void 0===(null===(r=this.opt)||void 0===r?void 0:r.expandMacros)||(null===(n=this.opt)||void 0===n?void 0:n.expandMacros)){const t=function(e,t){const r=(null==t?void 0:t.protocol)||b;function n(e){return void 0!==e?[{prim:"RENAME",annots:e}]:[]}switch(e.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(_(e,0))return[{prim:"COMPARE"},T({prim:e.prim.slice(3),annots:e.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(_(e,2))return[{prim:e.prim.slice(2)},T({prim:"IF",annots:e.annots,args:e.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(_(e,2))return[{prim:"COMPARE"},{prim:e.prim.slice(5)},T({prim:"IF",annots:e.annots,args:e.args})];break;case"FAIL":if(_(e,0)&&w(e))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(_(e,0)&&w(e))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(_(e,0)&&w(e))return[{prim:e.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(_(e,0)&&w(e))return[[{prim:"COMPARE"},{prim:e.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(_(e,0)&&w(e))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(_(e,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(e.annots)]}];break;case"ASSERT_LEFT":if(_(e,0))return[{prim:"IF_LEFT",args:[n(e.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(_(e,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(e.annots)]}];break;case"IF_SOME":if(_(e,2))return[T({prim:"IF_NONE",annots:e.annots,args:[e.args[1],e.args[0]]})];break;case"IF_RIGHT":if(_(e,2))return[T({prim:"IF_LEFT",annots:e.annots,args:[e.args[1],e.args[0]]})];break;case"CAR":case"CDR":if(void 0===e.args)return e;if(_(e,1)&&E(e,e.args[0])){const t=parseInt(e.args[0].int,10);return T({prim:"GET",args:[{int:"CAR"===e.prim?String(2*t+1):String(2*t)}],annots:e.annots})}}if(I.test(e.prim)&&_(e,0)){const{fields:t,rest:r}=P(e.annots),{r:n}=O(e,e.prim.slice(1),t,((e,t,r)=>[...e||[],...t||[],r]));return n.map((([e,t],i)=>{const o=[...S(t,null).map((e=>null===e?"%":e)),...0===e&&i===n.length-1?r:[]],s=T({prim:"PAIR",annots:0!==o.length?o:void 0});return 0===e?s:{prim:"DIP",args:1===e?[[s]]:[{int:String(e)},[s]]}}))}if(R.test(e.prim)){if(v(r,p.PtEdo2Zk)&&_(e,0)){const{r:t}=O(e,e.prim.slice(3),e.annots||[],((e,t,r)=>[r,...t||[],...e||[]]));return t.map((([e,t])=>{const r=[{prim:"DUP"},T({prim:"CAR",annots:null!==t[0]?[t[0]]:void 0}),{prim:"DIP",args:[[T({prim:"CDR",annots:null!==t[1]?[t[1]]:void 0})]]}];return 0===e?r:{prim:"DIP",args:1===e?[[r]]:[{int:String(e)},[r]]}}))}if("UNPAIR"===e.prim)return e;if(_(e,0)){const{r:t}=O(e,e.prim.slice(3),[],((e,t,r)=>[r,...t||[],...e||[]]));return t.map((([e])=>{const t=T({prim:"UNPAIR"});return 0===e?t:{prim:"DIP",args:1===e?[[t]]:[{int:String(e)},[t]]}}))}}if(x.test(e.prim)&&_(e,0)){const t=[...e.prim.slice(1,e.prim.length-1)];return t.map(((r,n)=>{const i=n===t.length-1?e.annots:void 0;switch(r){case"A":return T({prim:"CAR",annots:i});case"D":return T({prim:"CDR",annots:i});default:throw new y(e,`unexpected character: ${r}`)}}))}if(M.test(e.prim)&&_(e,0)){const{fields:t,rest:r}=P(e.annots);if(t.length>1)throw new y(e,`unexpected annotation on macro ${e.prim}: ${t}`);const n=0!==t.length?{a:[{prim:"DUP"},{prim:"CAR",annots:t},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[t[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:t},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",t[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return A(e,e.prim.slice(5,e.prim.length-1),r,n)}if(k.test(e.prim)&&_(e,1)){const{fields:t}=P(e.annots);if(t.length>1)throw new y(e,`unexpected annotation on macro ${e.prim}: ${t}`);const r={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[T({prim:"CAR",annots:0!==t.length?["@"+t[0].slice(1)]:void 0}),e.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[0!==t.length?t[0]:"%","%@"]}],d:[{prim:"DUP"},T({prim:"CDR",annots:0!==t.length?["@"+t[0].slice(1)]:void 0}),e.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",0!==t.length?t[0]:"%"]}]};return A(e,e.prim.slice(5,e.prim.length-1),[],r)}if(L.test(e.prim)&&_(e,1)){let t=0;for(;"I"===e.prim[1+t];)t++;return T({prim:"DIP",args:[{int:String(t)},e.args[0]]})}if(N.test(e.prim)){let t=0;for(;"U"===e.prim[1+t];)t++;if(v(r,p.PtEdo2Zk)){if(1===t){if(void 0===e.args)return e;_(e,1)&&E(e,e.args[0])&&(t=parseInt(e.args[0].int,10))}else _(e,0);return 1===t?[T({prim:"DUP",annots:e.annots})]:2===t?[{prim:"DIP",args:[[T({prim:"DUP",annots:e.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(t-1)},[T({prim:"DUP",annots:e.annots})]]},{prim:"DIG",args:[{int:String(t)}]}]}if(1===t)return e;if(_(e,0))return T({prim:"DUP",args:[{int:String(t)}],annots:e.annots})}return e}(e,this.opt);return t!==e&&(t[i]=Object.assign(Object.assign({},e[i]||{first:0,last:0}),{macro:e})),t}return e}parseListExpr(e,t){var r;const n={first:t.first,last:t.last},o="("===t.t;let a;if(o){if(a=e.next(),a.done)throw D;n.last=a.value.last}else a={value:t};if(a.value.t!==s.Ident)throw new C(a.value,`not an identifier: ${a.value.v}`);const c={prim:a.value.v,[i]:n};for(;;){const t=e.next();if(t.done){if(o)throw D;break}if(")"===t.value.t){if(!o)throw new C(t.value,"unexpected closing bracket");n.last=t.value.last;break}if(U(t.value))c.annots=c.annots||[],c.annots.push(t.value.v),n.last=t.value.last;else{c.args=c.args||[];const o=this.parseExpr(e,t.value);n.last=(null===(r=o[i])||void 0===r?void 0:r.last)||n.last,c.args.push(o)}}return this.expand(c)}parseArgs(e,t){var r;const n={first:t.first,last:t.last},o={prim:t.v,[i]:n};for(;;){const t=e.next();if(t.done||"}"===t.value.t||";"===t.value.t)return[o,t];if(U(t.value))n.last=t.value.last,o.annots=o.annots||[],o.annots.push(t.value.v);else{const s=this.parseExpr(e,t.value);n.last=(null===(r=s[i])||void 0===r?void 0:r.last)||n.last,o.args=o.args||[],o.args.push(s)}}}parseSequenceExpr(e,t){var r,n;const o={first:t.first,last:t.last},a=[];a[i]=o;const c="{"===t.t;let u="{"===t.t?null:{value:t};for(;;){if(null===u&&(u=e.next(),u.done||(o.last=u.value.last)),u.done){if(c)throw D;return a}if("}"===u.value.t){if(c)return a;throw new C(u.value,"unexpected closing bracket")}if(u.value.t===s.Ident){const[t,n]=this.parseArgs(e,u.value);o.last=(null===(r=t[i])||void 0===r?void 0:r.last)||o.last,a.push(this.expand(t)),u=n}else{const t=this.parseExpr(e,u.value);o.last=(null===(n=t[i])||void 0===n?void 0:n.last)||o.last,a.push(t),u=null}null===u&&(u=e.next(),u.done||(o.last=u.value.last)),u.done||";"!==u.value.t||(u=null)}}parseExpr(e,t){switch(t.t){case s.Ident:return this.expand({prim:t.v,[i]:{first:t.first,last:t.last}});case s.Number:return{int:t.v,[i]:{first:t.first,last:t.last}};case s.String:return{string:JSON.parse(t.v),[i]:{first:t.first,last:t.last}};case s.Bytes:return{bytes:t.v.slice(2),[i]:{first:t.first,last:t.last}};case"{":return this.parseSequenceExpr(e,t);default:return this.parseListExpr(e,t)}}parseSequence(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseSequenceExpr(t,r.value)}parseList(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseListExpr(t,r.value)}parseMichelineExpression(e){if("string"!=typeof e)throw new TypeError(`string type was expected, got ${typeof e} instead`);const t=d(e),r=t.next();return r.done?null:this.parseExpr(t,r.value)}parseScript(e){return this.parseSequence(e)}parseData(e){return this.parseList(e)}parseJSON(e){if("object"!=typeof e)throw new TypeError(`object type was expected, got ${typeof e} instead`);if(Array.isArray(e)){const t=[];for(const r of e){if(null===r||"object"!=typeof r)throw new j(r,`unexpected sequence element: ${r}`);t.push(this.parseJSON(r))}return t}if("prim"in e){const t=e;if("string"==typeof t.prim&&(void 0===t.annots||Array.isArray(t.annots))&&(void 0===t.args||Array.isArray(t.args))){const e={prim:t.prim};if(void 0!==t.annots){for(const e of t.annots)if("string"!=typeof e)throw new j(e,`string expected: ${e}`);e.annots=t.annots}if(void 0!==t.args){e.args=[];for(const r of t.args){if(null===r||"object"!=typeof r)throw new j(r,`unexpected argument: ${r}`);e.args.push(this.parseJSON(r))}}return this.expand(e)}throw new j(e,`malformed prim expression: ${e}`)}if("string"in e){if("string"==typeof e.string)return{string:e.string};throw new j(e,`malformed string literal: ${e}`)}if("int"in e){if("string"==typeof e.int&&B.test(e.int))return{int:e.int};throw new j(e,`malformed int literal: ${e}`)}if("bytes"in e){if("string"==typeof e.bytes&&F.test(e.bytes))return{bytes:e.bytes};throw new j(e,`malformed bytes literal: ${e}`)}throw new j(e,`unexpected object: ${e}`)}}class H{constructor(e,t=0){this.opt=e,this.lev=t}indent(e=0){var t;let r="";if(void 0!==(null===(t=this.opt)||void 0===t?void 0:t.indent))for(let t=this.lev+e;t>0;t--)r+=this.opt.indent;return r}get lf(){var e;return(null===(e=this.opt)||void 0===e?void 0:e.newline)||""}get lfsp(){var e;return(null===(e=this.opt)||void 0===e?void 0:e.newline)||" "}down(e){return new H(this.opt,this.lev+e)}}function G(e){return"prim"in e&&(void 0!==e.annots&&0!==e.annots.length||void 0!==e.args&&0!==e.args.length)}function $(e){if(void 0!==e.args)for(const t of e.args)if(Array.isArray(t)||G(t))return!0;return!1}function V(e,t,r){var n;const o=null===(n=e[i])||void 0===n?void 0:n.macro;if(r&&o)return V(o,t,r);if(Array.isArray(e))return function(e,t,r){let n="{"+t.lf,i=e.length;for(const o of e){if(n+=t.indent(1),"prim"in o){if(n+=o.prim,void 0!==o.annots)for(const e of o.annots)n+=" "+e;if(void 0!==o.args){const e=$(o);for(const i of o.args)n+=e?t.lfsp+t.indent(2)+V(i,t.down(2),r):" "+V(i,t,r)}}else n+=V(o,t.down(1),r);n+=i>1?";"+t.lfsp:t.lf,i--}return n+t.indent()+"}"}(e,t,r);if("string"in e)return JSON.stringify(e.string);if("int"in e)return e.int;if("bytes"in e)return"0x"+e.bytes;{if(!(void 0!==e.annots&&0!==e.annots.length||void 0!==e.args&&0!==e.args.length))return e.prim;let n="("+e.prim;if(void 0!==e.annots)for(const t of e.annots)n+=" "+t;if(void 0!==e.args){const i=$(e);for(const o of e.args)n+=i?t.lfsp+t.indent(1)+V(o,t.down(1),r):" "+V(o,t,r)}return n+")"}}function z(e,t,r=!1){if("object"!=typeof e)throw new TypeError(`object type was expected, got ${typeof e} instead`);return V(e,new H(t),r)}const q=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],W=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class Z extends n.TaquitoError{constructor(e){super(),this.message=e,this.name="Base58DecodingError"}}function J(e){const t=(e.length+9)%64,r=0===t?0:64-t;if(e.length>268435455)throw new n.InvalidMessageError("",`: Invalid length ${e.length} is too big -- SHA-256.`);const i=e.length<<3,o=[...e,128,...new Array(r).fill(0),0,0,0,0,i>>24&255,i>>16&255,i>>8&255,255&i];function s(e,t){return e>>>t|e<<32-t}const a=[...q],c=new Array(64),u=new Array(8);for(let e=0;e>>3,t=s(c[r-2],17)^s(c[r-2],19)^c[r-2]>>>10;c[r]=(0|t)+c[r-7]+e+c[r-16]|0,r++}for(let e=0;e<8;e++)u[e]=a[e];for(let e=0;e<64;e++){const t=s(u[0],2)^s(u[0],13)^s(u[0],22),r=s(u[4],6)^s(u[4],11)^s(u[4],25),n=u[7]+r+(u[4]&u[5]^~u[4]&u[6])+W[e]+c[e]|0,i=t+(u[0]&u[1]^u[0]&u[2]^u[1]&u[2])|0;u[7]=u[6],u[6]=u[5],u[5]=u[4],u[4]=u[3]+n|0,u[3]=u[2],u[2]=u[1],u[1]=u[0],u[0]=n+i|0}for(let e=0;e<8;e++)a[e]=a[e]+u[e]|0}const l=[];for(const e of a)l.push(e>>24&255),l.push(e>>16&255),l.push(e>>8&255),l.push(255&e);return l}const Y=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57],X=[0,1,2,3,4,5,6,7,8,16,17,18,19,20,21,22,23,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73];function Q(e,t){const r=e.charCodeAt(t)-49;if(r>=Y.length||-1===Y[r])throw new Z(`Unexpected character at position ${t}: ${e[t]}`);return Y[r]}function ee(e){const t=function(e){const t=[];let r=0;for(;r0;)t.push(0);return t.reverse()}(e);if(t.length<4)throw new Z(`Data is too short ${t.length}`);const r=t.slice(0,t.length-4),n=t.slice(t.length-4),i=J(J(r));if(n[0]!==i[0]||n[1]!==i[1]||n[2]!==i[2]||n[3]!==i[3])throw new Z("Invalid checksum");return r}function te(e){const t=J(J(e));return function(e){const t=[];let r=0;for(;r0;)t.push(0);return t.reverse(),String.fromCharCode(...t.map((e=>X[e]+49)))}([...e,...t.slice(0,4)])}class re extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidMichelsonError"}}class ne extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidTypeExpressionError"}}class ie extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidDataExpressionError"}}class oe extends n.ParameterValidationError{constructor(e){super(),this.entrypoint=e,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${e}"`}}class se extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="TezosIdEncodeError"}}class ae extends n.TaquitoError{constructor(e){super(),this.message=e,this.name="LongIntegerError"}}class ce extends n.TaquitoError{constructor(e){super(),this.hexByte=e,this.name="HexParseError",this.message=`Unable to parse hex byte "${e}"`}}class ue extends n.TaquitoError{constructor(e,t){super(),this.val=e,this.message=t,this.name="MichelsonError"}}function le(e){return e instanceof ue}class fe extends ue{constructor(e,t,r){super(e,t),this.val=e,this.message=t,this.name="MichelsonTypeError",void 0!==r&&(this.data=r)}}class de{append(e){let t=0;for(;0!==e||t57)throw new ae(`unexpected character in integer constant "${e[t]}"`);this.append(r-48)}}else e<0?(this.neg=!0,this.append(-e)):this.append(e)}cmp(e){if(this.neg!==e.neg)return(e.neg?1:0)-(this.neg?1:0);{let t=0;if(this.buf.length!==e.buf.length)t=this.buf.length=0&&this.buf[r]===e.buf[r];)r--;t=r<0?0:this.buf[r]=0}catch(e){return!1}}const me=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function ge(e,t){if(Array.isArray(e))return{};let r,n,i;if(void 0!==e.annots)for(const o of e.annots)if(0!==o.length){if(!me.test(o)||!(null==t?void 0:t.specialVar)&&("@%"===o||"@%%"===o)||!(null==t?void 0:t.specialFields)&&"%@"===o)throw new ue(e,`${e.prim}: unexpected annotation: ${o}`);switch(o[0]){case"%":((null==t?void 0:t.emptyFields)||o.length>1)&&(r=r||[],r.push(o));break;case":":o.length>1&&(n=n||[],n.push(o));break;case"@":((null==t?void 0:t.emptyVar)||o.length>1)&&(i=i||[],i.push(o))}}return{f:r,t:n,v:i}}const ve={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]],RollupAddress:[20,[1,128,120,31]]};function ye(e,...t){const r=ee(e);for(const e of t){const[t,n]=ve[e];if(r.length===t+n.length){let t=0;for(;t(e>>4&15).toString(16)+(15&e).toString(16))).join("")}const Te=31,Ie={ABS:!0,ADD:!0,ADDRESS:!0,AMOUNT:!0,AND:!0,APPLY:!0,BALANCE:!0,BLAKE2B:!0,CAR:!0,CDR:!0,CHAIN_ID:!0,CHECK_SIGNATURE:!0,COMPARE:!0,CONCAT:!0,CONS:!0,EDIV:!0,EQ:!0,EXEC:!0,FAILWITH:!0,GE:!0,GET_AND_UPDATE:!0,GT:!0,HASH_KEY:!0,IMPLICIT_ACCOUNT:!0,INT:!0,ISNAT:!0,JOIN_TICKETS:!0,KECCAK:!0,LE:!0,LEVEL:!0,LSL:!0,LSR:!0,LT:!0,MEM:!0,MUL:!0,NEG:!0,NEQ:!0,NEVER:!0,NOT:!0,NOW:!0,OR:!0,PACK:!0,PAIRING_CHECK:!0,READ_TICKET:!0,SAPLING_VERIFY_UPDATE:!0,SELF:!0,SELF_ADDRESS:!0,SENDER:!0,SET_DELEGATE:!0,SHA256:!0,SHA3:!0,SHA512:!0,SIZE:!0,SLICE:!0,SOME:!0,SOURCE:!0,SPLIT_TICKET:!0,SUB:!0,SWAP:!0,TICKET:!0,TICKET_DEPRECATED:!0,TOTAL_VOTING_POWER:!0,TRANSFER_TOKENS:!0,UNIT:!0,VOTING_POWER:!0,XOR:!0,RENAME:!0,OPEN_CHEST:!0,SUB_MUTEZ:!0,MIN_BLOCK_TIME:!0,BYTES:!0,NAT:!0},Re=Object.assign({},Ie,{CONTRACT:!0,CREATE_CONTRACT:!0,DIG:!0,DIP:!0,DROP:!0,DUG:!0,DUP:!0,EMIT:!0,EMPTY_BIG_MAP:!0,EMPTY_MAP:!0,EMPTY_SET:!0,GET:!0,IF:!0,IF_CONS:!0,IF_LEFT:!0,IF_NONE:!0,ITER:!0,LAMBDA:!0,LAMBDA_REC:!0,LEFT:!0,LOOP:!0,LOOP_LEFT:!0,MAP:!0,NIL:!0,NONE:!0,PAIR:!0,PUSH:!0,RIGHT:!0,SAPLING_EMPTY_STATE:!0,UNPACK:!0,UNPAIR:!0,UPDATE:!0,CAST:!0,VIEW:!0}),xe={unit:!0,never:!0,bool:!0,int:!0,nat:!0,string:!0,chain_id:!0,bytes:!0,mutez:!0,key_hash:!0,key:!0,signature:!0,timestamp:!0,address:!0,tx_rollup_l2_address:!0},Me=Object.assign({},xe,{or:!0,pair:!0,set:!0,big_map:!0,contract:!0,lambda:!0,list:!0,map:!0,operation:!0,option:!0,bls12_381_g1:!0,bls12_381_g2:!0,bls12_381_fr:!0,sapling_transaction:!0,sapling_transaction_deprecated:!0,sapling_state:!0,ticket:!0,chest_key:!0,chest:!0});class ke extends ue{constructor(e,t){super(e,t),this.val=e,this.message=t,this.name="MichelsonValidationError"}}function Le(e){return"prim"in e}function Ne(e){if(Le(e))return!0;throw new ke(e,"prim expression expected")}function Ce(e){if(Array.isArray(e))return!0;throw new ke(e,"sequence expression expected")}function je(e){if(function(e){return Array.isArray(e)||"prim"in e}(e))return!0;throw new ke(e,"prim or sequence expression expected")}function De(e){if("-"===e.int[0])throw new ke(e,"natural number expected")}function Ue(e){if("int"in e)return!0;throw new ke(e,"int literal expected")}function Be(e){if("string"in e)return!0;throw new ke(e,"string literal expected")}function Fe(e,t){var r;if(0===t&&void 0===e.args||(null===(r=e.args)||void 0===r?void 0:r.length)===t)return!0;throw new ke(e,`${t} arguments expected`)}function Ke(e){var t,r;if(Array.isArray(e)){for(const t of e){if(!Array.isArray(t)&&!Le(t))throw new ke(e,"sequence or prim expected");Ke(t)}return!0}if(Ne(e)){if(Object.prototype.hasOwnProperty.call(Ie,e.prim))return Fe(e,0),!0;switch(e.prim){case"DROP":case"PAIR":case"UNPAIR":case"DUP":case"UPDATE":case"GET":void 0!==e.args&&Fe(e,1)&&Ue(e.args[0])&&De(e.args[0]);break;case"DIG":case"DUG":case"SAPLING_EMPTY_STATE":Fe(e,1)&&Ue(e.args[0])&&De(e.args[0]);break;case"NONE":case"LEFT":case"RIGHT":case"NIL":case"CAST":Fe(e,1)&&Je(e.args[0]);break;case"UNPACK":Fe(e,1)&&Ge(e.args[0]);break;case"CONTRACT":Fe(e,1)&&ze(e.args[0]);break;case"IF_NONE":case"IF_LEFT":case"IF_CONS":case"IF":Fe(e,2)&&(Ce(e.args[0])&&Ke(e.args[0]),Ce(e.args[1])&&Ke(e.args[1]));break;case"MAP":case"ITER":case"LOOP":case"LOOP_LEFT":Fe(e,1)&&Ke(e.args[0]);break;case"CREATE_CONTRACT":Fe(e,1)&&Qe(e.args[0]);break;case"DIP":if(2===(null===(t=e.args)||void 0===t?void 0:t.length))Ue(e.args[0])&&De(e.args[0]),Ce(e.args[1])&&Ke(e.args[1]);else{if(1!==(null===(r=e.args)||void 0===r?void 0:r.length))throw new ke(e,"1 or 2 arguments expected");Ce(e.args[0])&&Ke(e.args[0])}break;case"PUSH":Fe(e,2)&&($e(e.args[0]),Xe(e.args[1]));break;case"EMPTY_SET":Fe(e,1)&&He(e.args[0]);break;case"EMPTY_MAP":Fe(e,2)&&(He(e.args[0]),Je(e.args[1]));break;case"EMPTY_BIG_MAP":Fe(e,2)&&(He(e.args[0]),qe(e.args[1]));break;case"LAMBDA_REC":case"LAMBDA":Fe(e,3)&&(Je(e.args[0]),Je(e.args[1]),Ce(e.args[2])&&Ke(e.args[2]));break;case"VIEW":Fe(e,2)&&(Be(e.args[0])&&Ze(e.args[0]),Je(e.args[1])&&$e(e.args[1]));break;case"EMIT":e.args&&e.args.length>0?Fe(e,1):Fe(e,0);break;default:throw new ke(e,"instruction expected")}}return!0}function He(e){if(je(e))if(Array.isArray(e)||"pair"===e.prim||"or"===e.prim||"option"===e.prim)Ye(e,(e=>He(e)));else if(!Object.prototype.hasOwnProperty.call(xe,e.prim))throw new ke(e,`${e.prim}: type is not comparable`);return!0}function Ge(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim||"ticket"===e.prim)throw new ke(e,`${e.prim}: type can't be used inside PACK/UNPACK instructions`);Ye(e,(e=>Ge(e)))}return!0}function $e(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim||"ticket"===e.prim||"contract"===e.prim)throw new ke(e,`${e.prim}: type can't be pushed`);Ye(e,(e=>$e(e)))}return!0}function Ve(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"operation"===e.prim||"contract"===e.prim)throw new ke(e,`${e.prim}: type can't be used as part of a storage`);Ye(e,(e=>Ve(e)))}return!0}function ze(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"operation"===e.prim)throw new ke(e,`${e.prim}: type can't be used as part of a parameter`);Ye(e,(e=>ze(e)))}return!0}function qe(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim)||"big_map"===e.prim||"operation"===e.prim||"sapling_state"===e.prim)throw new ke(e,`${e.prim}: type can't be used inside a big_map`);Ye(e,(e=>qe(e)))}return!0}const We=new RegExp("^[a-zA-Z0-9_.%@]*$");function Ze(e){if(e.string.length>Te)throw new ke(e,`view name too long: ${e.string}`);if(!We.test(e.string))throw new ke(e,`invalid character(s) in view name: ${e.string}`)}function Je(e){if(je(e)&&Le(e)){if(!Object.prototype.hasOwnProperty.call(Me,e.prim))throw new ke(e,"type expected");Ye(e,(e=>Je(e)))}return!0}function Ye(e,t){if(Array.isArray(e)||"pair"===e.prim){const r=Array.isArray(e)?e:e.args;if(void 0===r||r.length<2)throw new ke(e,"at least 2 arguments expected");return r.forEach((e=>{je(e)&&t(e)})),!0}switch(e.prim){case"option":case"list":Fe(e,1)&&je(e.args[0])&&t(e.args[0]);break;case"contract":Fe(e,1)&&ze(e.args[0]);break;case"or":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(t(e.args[0]),t(e.args[1]));break;case"lambda":Fe(e,2)&&(Je(e.args[0]),Je(e.args[1]));break;case"set":Fe(e,1)&&He(e.args[0]);break;case"map":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(He(e.args[0]),t(e.args[1]));break;case"big_map":Fe(e,2)&&je(e.args[0])&&je(e.args[1])&&(He(e.args[0]),qe(e.args[1]),t(e.args[1]));break;case"ticket":Fe(e,1)&&je(e.args[0])&&He(e.args[0]);break;case"sapling_state":case"sapling_transaction":Fe(e,1)&&Ue(e.args[0]);break;default:Fe(e,0)}return!0}function Xe(e){if("int"in e||"string"in e||"bytes"in e)return!0;if(Array.isArray(e)){let t=0;for(const r of e)Le(r)&&"Elt"===r.prim?(Fe(r,2)&&(Xe(r.args[0]),Xe(r.args[1])),t++):Xe(r);if(0!==t&&t!==e.length)throw new ke(e,"data entries and map elements can't be intermixed");return!0}if(!Le(e))throw new ke(e,"data entry expected");switch(e.prim){case"Unit":case"True":case"False":case"None":Fe(e,0);break;case"Pair":if(void 0===e.args||e.args.length<2)throw new ke(e,"at least 2 arguments expected");for(const t of e.args)Xe(t);break;case"Left":case"Right":case"Some":Fe(e,1)&&Xe(e.args[0]);break;case"Lambda_rec":e.args&&Ke(e.args);break;default:if(!Object.prototype.hasOwnProperty.call(Re,e.prim))throw new ke(e,"data entry or instruction expected");Ke(e)}return!0}function Qe(e){if(Ce(e)){const t={},r={};for(const n of e)if(Ne(n)){if("view"!==n.prim){if(n.prim in t)throw new ke(e,`duplicate contract section: ${n.prim}`);t[n.prim]=!0}switch(n.prim){case"code":Fe(n,1)&&Ce(n.args[0])&&Ke(n.args[0]);break;case"parameter":if(Fe(n,1)&&ze(n.args[0]),n.annots)throw new ke(n,"Annotation must be part of the parameter type");break;case"storage":Fe(n,1)&&Ve(n.args[0]);break;case"view":if(Fe(n,4)){if(Be(n.args[0])){const t=n.args[0];if(t.string in r)throw new ke(e,`duplicate view name: ${t.string}`);r[t.string]=!0,Ze(t)}$e(n.args[1]),$e(n.args[2]),Ce(n.args[3])&&Ke(n.args[3])}break;default:throw new ke(e,`unexpected contract section: ${n.prim}`)}}}return!0}function et(e){try{return Qe(e),!0}catch(e){return!1}}function tt(e){try{return Xe(e),!0}catch(e){return!1}}function rt(e){try{return Ke(e),!0}catch(e){return!1}}function nt(e){try{return Je(e),!0}catch(e){return!1}}function it(e){return Object.prototype.hasOwnProperty.call(Re,e.prim)}function ot(e){if(!Array.isArray(e))return!1;for(const t of e)if("prim"in t){if(it(t))throw new ue(e,`Instruction outside of a lambda: ${JSON.stringify(e)}`);if("Elt"===t.prim)throw new ue(e,`Elt item outside of a map literal: ${JSON.stringify(e)}`)}return!0}"function"==typeof SuppressedError&&SuppressedError;const st=["parameter","storage","code","False","Elt","Left","None","Pair","Right","Some","True","Unit","PACK","UNPACK","BLAKE2B","SHA256","SHA512","ABS","ADD","AMOUNT","AND","BALANCE","CAR","CDR","CHECK_SIGNATURE","COMPARE","CONCAT","CONS","CREATE_ACCOUNT","CREATE_CONTRACT","IMPLICIT_ACCOUNT","DIP","DROP","DUP","EDIV","EMPTY_MAP","EMPTY_SET","EQ","EXEC","FAILWITH","GE","GET","GT","HASH_KEY","IF","IF_CONS","IF_LEFT","IF_NONE","INT","LAMBDA","LE","LEFT","LOOP","LSL","LSR","LT","MAP","MEM","MUL","NEG","NEQ","NIL","NONE","NOT","NOW","OR","PAIR","PUSH","RIGHT","SIZE","SOME","SOURCE","SENDER","SELF","STEPS_TO_QUOTA","SUB","SWAP","TRANSFER_TOKENS","SET_DELEGATE","UNIT","UPDATE","XOR","ITER","LOOP_LEFT","ADDRESS","CONTRACT","ISNAT","CAST","RENAME","bool","contract","int","key","key_hash","lambda","list","map","big_map","nat","option","or","pair","set","signature","string","bytes","mutez","timestamp","unit","operation","address","SLICE","DIG","DUG","EMPTY_BIG_MAP","APPLY","chain_id","CHAIN_ID","LEVEL","SELF_ADDRESS","never","NEVER","UNPAIR","VOTING_POWER","TOTAL_VOTING_POWER","KECCAK","SHA3","PAIRING_CHECK","bls12_381_g1","bls12_381_g2","bls12_381_fr","sapling_state","sapling_transaction_deprecated","SAPLING_EMPTY_STATE","SAPLING_VERIFY_UPDATE","ticket","TICKET_DEPRECATED","READ_TICKET","SPLIT_TICKET","JOIN_TICKETS","GET_AND_UPDATE","chest","chest_key","OPEN_CHEST","VIEW","view","constant","SUB_MUTEZ","tx_rollup_l2_address","MIN_BLOCK_TIME","sapling_transaction","EMIT","Lambda_rec","LAMBDA_REC","TICKET","BYTES","NAT"],at=Object.assign({},...st.map(((e,t)=>({[e]:t}))));var ct;!function(e){e[e.Int=0]="Int",e[e.String=1]="String",e[e.Sequence=2]="Sequence",e[e.Prim0=3]="Prim0",e[e.Prim0Annot=4]="Prim0Annot",e[e.Prim1=5]="Prim1",e[e.Prim1Annot=6]="Prim1Annot",e[e.Prim2=7]="Prim2",e[e.Prim2Annot=8]="Prim2Annot",e[e.Prim=9]="Prim",e[e.Bytes=10]="Bytes"}(ct||(ct={}));class ut{constructor(){this.buffer=[]}get length(){return this.buffer.length}writeBytes(e){this.buffer.push(...e.map((e=>255&e)))}writeUint8(e){const t=0|e;this.buffer.push(255&t)}writeUint16(e){const t=0|e;this.buffer.push(t>>8&255),this.buffer.push(255&t)}writeUint32(e){const t=0|e;this.buffer.push(t>>24&255),this.buffer.push(t>>16&255),this.buffer.push(t>>8&255),this.buffer.push(255&t)}writeInt8(e){this.writeUint8(e)}writeInt16(e){this.writeUint16(e)}writeInt32(e){this.writeUint32(e)}}const lt=new Error("bounds out of range");class ft{constructor(e,t=0,r=e.length){this.buffer=e,this.idx=t,this.cap=r}get length(){return this.cap-this.idx}readBytes(e){if(this.cap-this.idx>>0}readUint16(){if(this.cap-this.idx<2)throw lt;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readUint32(){if(this.cap-this.idx<4)throw lt;return(this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++])>>>0}readInt8(){if(this.cap-this.idx<1)throw lt;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw lt;return(this.buffer[this.idx++]<<8|this.buffer[this.idx++])<<16>>16}readInt32(){if(this.cap-this.idx<4)throw lt;return this.buffer[this.idx++]<<24|this.buffer[this.idx++]<<16|this.buffer[this.idx++]<<8|this.buffer[this.idx++]}}var dt,ht,pt;function bt(e){let t;const r=e.readUint8();switch(r){case ht.ED25519:t="ED25519PublicKeyHash";break;case ht.SECP256K1:t="SECP256K1PublicKeyHash";break;case ht.P256:t="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${r}`)}return{type:t,hash:e.readBytes(20)}}function mt(e){let t;const r=e.readUint8();switch(r){case dt.Implicit:t=bt(e);break;case dt.Originated:t={type:"ContractHash",hash:e.readBytes(20)},e.readBytes(1);break;default:throw new Error(`unknown address tag: ${r}`)}if(0!==e.length){const r=new TextDecoder;t.entryPoint=r.decode(new Uint8Array(e.readBytes(e.length)))}return t}function gt(e,t){let r;switch(e.type){case"ED25519PublicKeyHash":r=ht.ED25519;break;case"SECP256K1PublicKeyHash":r=ht.SECP256K1;break;case"P256PublicKeyHash":r=ht.P256;break;default:throw new Error(`unexpected address type: ${e.type}`)}t.writeUint8(r),t.writeBytes(Array.from(e.hash))}function vt(e){let t,r;const n=e.readUint8();switch(n){case pt.ED25519:r="ED25519PublicKey",t=32;break;case pt.SECP256K1:r="SECP256K1PublicKey",t=33;break;case pt.P256:r="P256PublicKey",t=33;break;default:throw new Error(`unknown public key tag: ${n}`)}return{type:r,publicKey:e.readBytes(t)}}function yt(e,t,r){var n,i;const[o,s]=r(e);if(Array.isArray(o)){const e=new ut;for(const t of o){const r=s.next();if(r.done)throw new Error("REPORT ME: iterator is done");yt(t,e,r.value)}return t.writeUint8(ct.Sequence),t.writeUint32(e.length),void t.writeBytes(e.buffer)}if("string"in o){const e=(new TextEncoder).encode(o.string);return t.writeUint8(ct.String),t.writeUint32(e.length),void t.writeBytes(Array.from(e))}if("int"in o){t.writeUint8(ct.Int);let e=BigInt(o.int);const r=e<0;r&&(e=-e);let n=0;do{const i=0===n?BigInt(6):BigInt(7);let o=e&(BigInt(1)<>=i,e&&(o|=BigInt(128)),0===n&&r&&(o|=BigInt(64)),t.writeUint8(Number(o)),n++}while(e);return}if("bytes"in o){const e=function(e){const t=[];for(let r=0;r=3&&t.writeUint32(0)}function _t(e,t){function*r(){for(;;)yield Rt}const[n,i]=t,o=e.readUint8();switch(o){case ct.Int:{const t=[];let r;do{r=e.readInt8(),t.push(r)}while(0!=(128&r));let n=BigInt(0),o=!1;for(let e=t.length-1;e>=0;e--){const r=0===e?BigInt(6):BigInt(7),i=BigInt(t[e]);n<<=r,n|=i&(BigInt(1)<0;){const e=a.next();if(e.done)throw new Error("REPORT ME: iterator is done");o.push(_t(r,e.value))}a=n(o),s=e}return i(o)}default:{if(o>9)throw new Error(`Unknown tag: ${o}`);const t=e.readUint8();if(t>=st.length)throw new Error(`Unknown primitive tag: ${t}`);const s=st[t],a=o-3>>1;let c={prim:s},u=r(),l=e.copy();for(let t=0;t<2;t++){if(c={prim:s},a<3)for(let e=0;e0;){const e=u.next();if(e.done)throw new Error("REPORT ME: iterator is done");c.args.push(_t(t,e.value))}}u=n(c),l=e}if(1==(o-3&1)||3===a){const t=e.readUint32();if(0!==t){const r=e.readBytes(t),n=new TextDecoder;c.annots=n.decode(new Uint8Array(r)).split(" ")}}return i(c)}}}!function(e){e[e.Implicit=0]="Implicit",e[e.Originated=1]="Originated"}(dt||(dt={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.P256=2]="P256"}(ht||(ht={})),function(e){e[e.ED25519=0]="ED25519",e[e.SECP256K1=1]="SECP256K1",e[e.P256=2]="P256"}(pt||(pt={}));const wt=e=>"prim"in e&&("Left"===e.prim||"Right"===e.prim),Et=e=>"prim"in e&&("Some"===e.prim||"None"===e.prim),Ot=e=>{if(Ee(e))return t=>{if(!Oe(t))throw new fe(e,`pair expected: ${JSON.stringify(t)}`,t);ot(t);const r=we("pair",e);return[we("Pair",t),function*(){for(const e of r.args)yield Ot(e)}()]};switch(e.prim){case"or":return t=>{if(!wt(t))throw new fe(e,`or expected: ${JSON.stringify(t)}`,t);return[t,function*(){yield Ot(e.args["Left"===t.prim?0:1])}()]};case"option":return t=>{if(!Et(t))throw new fe(e,`option expected: ${JSON.stringify(t)}`,t);return[t,function*(){"Some"===t.prim&&(yield Ot(e.args[0]))}()]};case"list":case"set":return t=>{if(!Array.isArray(t))throw new fe(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const r of t)yield Ot(e.args[0])}()]};case"map":return t=>{if(!Array.isArray(t))throw new fe(e,`map expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const r of t)yield t=>{if(!("prim"in t)||"Elt"!==t.prim)throw new fe(e,`map element expected: ${JSON.stringify(t)}`,t);return[t,function*(){for(const t of e.args)yield Ot(t)}()]}}()]};case"chain_id":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`chain id expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ChainID");if(null===n)throw new fe(e,`chain id base58 expected: ${t.string}`,t);r={bytes:Pe(n[1])}}else r=t;return[r,[][Symbol.iterator]()]};case"signature":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`signature expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature");if(null===n)throw new fe(e,`signature base58 expected: ${t.string}`,t);r={bytes:Pe(n[1])}}else r=t;return[r,[][Symbol.iterator]()]};case"key_hash":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`key hash expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash");if(null===n)throw new fe(e,`key hash base58 expected: ${t.string}`,t);const i=new ut;gt({type:n[0],hash:n[1]},i),r={bytes:Pe(i.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"key":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`public key expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=ye(t.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey");if(null===n)throw new fe(e,`public key base58 expected: ${t.string}`,t);const i=new ut;!function(e,t){let r;switch(e.type){case"ED25519PublicKey":r=pt.ED25519;break;case"SECP256K1PublicKey":r=pt.SECP256K1;break;case"P256PublicKey":r=pt.P256;break;default:throw new Error(`unexpected public key type: ${e.type}`)}t.writeUint8(r),t.writeBytes(Array.from(e.publicKey))}({type:n[0],publicKey:n[1]},i),r={bytes:Pe(i.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"address":return t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=t.string.split("%"),i=ye(n[0],"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash");if(null===i)throw new fe(e,`address base58 expected: ${t.string}`,t);const o=new ut;!function(e,t){if("ContractHash"===e.type?(t.writeUint8(dt.Originated),t.writeBytes(Array.from(e.hash)),t.writeUint8(0)):(t.writeUint8(dt.Implicit),gt(e,t)),void 0!==e.entryPoint&&""!==e.entryPoint&&"default"!==e.entryPoint){const r=(new TextEncoder).encode(e.entryPoint);t.writeBytes(Array.from(r))}}({type:i[0],hash:i[1],entryPoint:n.length>1?n[1]:void 0},o),r={bytes:Pe(o.buffer)}}else r=t;return[r,[][Symbol.iterator]()]};case"timestamp":return t=>{if(!("string"in t)&&!("int"in t))throw new fe(e,`timestamp expected: ${JSON.stringify(t)}`,t);let r;if("string"in t){const n=Se(t);if(null===n)throw new fe(e,`can't parse date: ${t.string}`,t);r={int:String(Math.floor(n.getTime()/1e3))}}else r=t;return[r,[][Symbol.iterator]()]};default:return St}},At=e=>"prim"in e&&"PUSH"===e.prim,St=e=>At(e)?(Ke(e),[e,function*(){yield St,yield Ot(e.args[0])}()]):[e,function*(){for(;;)yield St}()];function Pt(e,t){const r=new ut;return r.writeUint8(5),yt(e,r,void 0!==t?Ot(t):St),r.buffer}function Tt(e,t){return{bytes:Pe(Pt(e,t))}}const It=e=>{if(Ee(e))return[t=>{if(!Oe(t))throw new fe(e,`pair expected: ${JSON.stringify(t)}`,t);const r=we("pair",e);return function*(){for(const e of r.args)yield It(e)}()},e=>e];switch(e.prim){case"or":return[t=>{if(!wt(t))throw new fe(e,`or expected: ${JSON.stringify(t)}`,t);return function*(){yield It(e.args["Left"===t.prim?0:1])}()},e=>e];case"option":return[t=>{if(!Et(t))throw new fe(e,`option expected: ${JSON.stringify(t)}`,t);return function*(){"Some"===t.prim&&(yield It(e.args[0]))}()},e=>e];case"list":case"set":return[t=>{if(!Array.isArray(t))throw new fe(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);return function*(){for(;;)yield It(e.args[0])}()},e=>e];case"map":return[t=>{if(!Array.isArray(t))throw new fe(e,`map expected: ${JSON.stringify(t)}`,t);return function*(){for(;;)yield[t=>{if(!("prim"in t)||"Elt"!==t.prim)throw new fe(e,`map element expected: ${JSON.stringify(t)}`,t);return function*(){for(const t of e.args)yield It(t)}()},e=>e]}()},e=>e];case"chain_id":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`chain id expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);return{string:_e("ChainID",r)}}];case"signature":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`signature expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);return{string:_e("GenericSignature",r)}}];case"key_hash":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`key hash expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=bt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"key":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`public key expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=vt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.publicKey)}}];case"address":return[()=>[][Symbol.iterator](),t=>{if(!("bytes"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;const r=he(t.bytes);if(null===r)throw new fe(e,`can't parse bytes: ${t.bytes}`,t);const n=mt(new ft(new Uint8Array(r)));return{string:_e(n.type,n.hash)+(n.entryPoint?"%"+n.entryPoint:"")}}];case"timestamp":return[()=>[][Symbol.iterator](),t=>{if(!("int"in t)&&!("string"in t))throw new fe(e,`address expected: ${JSON.stringify(t)}`,t);if("string"in t)return t;return{string:new Date(1e3*parseInt(t.int,10)).toISOString().slice(0,19)+"Z"}}];default:return Rt}},Rt=[e=>At(e)?(Ke(e),function*(){yield Rt,yield It(e.args[0])}()):function*(){for(;;)yield Rt}(),e=>e];function xt(e,t){const r=new ft(e);if(5!==r.readUint8())throw new Error("incorrect packed data magic number");const n=_t(r,void 0!==t?It(t):Rt);if(Xe(n))return n;throw new Error}function Mt(e,t){const r=he(e.bytes);if(null===r)throw new Error(`can't parse bytes: "${e.bytes}"`);return xt(r,t)}function kt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return mt(new ft(new Uint8Array(t)))}function Lt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return bt(new ft(new Uint8Array(t)))}function Nt(e){const t=he(e.bytes);if(null===t)throw new Error(`can't parse bytes: "${e.bytes}"`);return vt(new ft(new Uint8Array(t)))}class Ct extends ue{constructor(e,t,r){super(e,r),this.val=e,this.stackState=t,this.message=r,this.name="MichelsonInstructionError"}}function jt(e){return Array.isArray(e)?"pair":e.prim}function Dt(e){return"prim"in e?e.args:e}function Ut(e,t,r=!1){if(jt(e)!==jt(t))throw new fe(e,`types mismatch: ${jt(e)} != ${jt(t)}`,void 0);const n=[ge(e),ge(t)];if(n[0].t&&n[1].t&&n[0].t[0]!==n[1].t[0])throw new fe(e,`${jt(e)}: type names mismatch: ${n[0].t[0]} != ${n[1].t[0]}`,void 0);if(r&&n[0].f&&n[1].f&&n[0].f[0]!==n[1].f[0])throw new fe(e,`${jt(e)}: field names mismatch: ${n[0].f[0]} != ${n[1].f}`,void 0);if(Ee(e)){const r=we("pair",e),n=we("pair",t);return Ut(r.args[0],n.args[0],!0),void Ut(r.args[1],n.args[1],!0)}switch(e.prim){case"option":case"list":case"contract":case"set":case"ticket":Ut(e.args[0],t.args[0]);break;case"or":Ut(e.args[0],t.args[0],!0),Ut(e.args[1],t.args[1],!0);break;case"lambda":case"map":case"big_map":Ut(e.args[0],t.args[0]),Ut(e.args[1],t.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(e.args[0].int,10)!==parseInt(t.args[0].int,10))throw new fe(e,`${jt(e)}: type argument mismatch: ${e.args[0].int} != ${t.args[0].int}`,void 0)}}function Bt(e,t){if(e.length!==t.length)throw new fe(e,`stack length mismatch: ${e.length} != ${t.length}`,void 0);for(let r=0;r1)throw new fe(e,`${e.prim}: at most one type annotation allowed: ${e.annots}`,void 0);if(t){if(((null===(n=o.f)||void 0===n?void 0:n.length)||0)>1)throw new fe(e,`${e.prim}: at most one field annotation allowed: ${e.annots}`,void 0)}else if(((null===(i=o.f)||void 0===i?void 0:i.length)||0)>0)throw new fe(e,`${e.prim}: field annotations aren't allowed: ${e.annots}`,void 0)}if(Ee(e)){const t=Dt(e);for(const e of t)Ft(e,!0)}else switch(e.prim){case"option":case"list":case"contract":case"set":Ft(e.args[0]);break;case"or":for(const t of e.args)Ft(t,!0);break;case"lambda":case"map":case"big_map":Ft(e.args[0]),Ft(e.args[1])}}function Kt(e){if(!Array.isArray(e))return!1;for(const t of e)if(!(Array.isArray(t)&&Kt(t)||"prim"in t&&it(t)))return!1;return!0}function Ht(e,t,r){if(Ee(t)){if(Oe(e)){ot(e);const n=we("Pair",e),i=we("pair",t);return Ht(n.args[0],i.args[0],r),void Ht(n.args[1],i.args[1],r)}throw new fe(t,`pair expected: ${JSON.stringify(e)}`,e)}switch(t.prim){case"int":if("int"in e&&pe(e.int))return;throw new fe(t,`integer value expected: ${JSON.stringify(e)}`,e);case"nat":case"mutez":if("int"in e&&be(e.int))return;throw new fe(t,`natural value expected: ${JSON.stringify(e)}`,e);case"string":if("string"in e)return;throw new fe(t,`string value expected: ${JSON.stringify(e)}`,e);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in e&&null!==he(e.bytes))return;throw new fe(t,`bytes value expected: ${JSON.stringify(e)}`,e);case"bool":if("prim"in e&&("True"===e.prim||"False"===e.prim))return;throw new fe(t,`boolean value expected: ${JSON.stringify(e)}`,e);case"key_hash":if("string"in e&&null!==ye(e.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash"))return;if("bytes"in e)try{return void Lt(e)}catch(e){}throw new fe(t,`key hash expected: ${JSON.stringify(e)}`,e);case"timestamp":if(("string"in e||"int"in e)&&null!==Se(e))return;throw new fe(t,`timestamp expected: ${JSON.stringify(e)}`,e);case"address":if("string"in e){let t=e.string;const r=e.string.indexOf("%");if(r>=0&&(t=e.string.slice(0,r)),null!==ye(t,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress"))return}else if("bytes"in e)try{return void kt(e)}catch(e){}throw new fe(t,`address expected: ${JSON.stringify(e)}`,e);case"key":if("string"in e&&null!==ye(e.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey"))return;if("bytes"in e)try{return void Nt(e)}catch(e){}throw new fe(t,`public key expected: ${JSON.stringify(e)}`,e);case"unit":if("prim"in e&&"Unit"===e.prim)return;throw new fe(t,`unit value expected: ${JSON.stringify(e)}`,e);case"signature":if("bytes"in e||"string"in e&&null!==ye(e.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature"))return;throw new fe(t,`signature expected: ${JSON.stringify(e)}`,e);case"chain_id":if("bytes"in e||"string"in e){if(null!==("string"in e?ee(e.string):he(e.bytes)))return}throw new fe(t,`chain id expected: ${JSON.stringify(e)}`,e);case"option":if("prim"in e){if("None"===e.prim)return;if("Some"===e.prim)return void Ht(e.args[0],t.args[0],r)}throw new fe(t,`option expected: ${JSON.stringify(e)}`,e);case"list":case"set":if(ot(e)){for(const n of e)Ht(n,t.args[0],r);return}throw new fe(t,`${t.prim} expected: ${JSON.stringify(e)}`,e);case"or":if("prim"in e){if("Left"===e.prim)return void Ht(e.args[0],t.args[0],r);if("Right"===e.prim)return void Ht(e.args[0],t.args[1],r)}throw new fe(t,`union (or) expected: ${JSON.stringify(e)}`,e);case"lambda":if(Kt(e)){const n=Gt(e,[t.args[0]],r);if("failed"in n)throw new fe(t,`function is failed with error type: ${n.failed}`,e);if(1!==n.length)throw new fe(t,"function must return a value",e);return void Ut(t.args[1],n[0])}throw new fe(t,`function expected: ${JSON.stringify(e)}`,e);case"map":case"big_map":if(Array.isArray(e)){for(const n of e){if(!("prim"in n)||"Elt"!==n.prim)throw new fe(t,`map elements expected: ${JSON.stringify(e)}`,e);Ht(n.args[0],t.args[0],r),Ht(n.args[1],t.args[1],r)}return}throw new fe(t,`${t.prim} expected: ${JSON.stringify(e)}`,e);case"bls12_381_fr":if("int"in e&&pe(e.int)||"bytes"in e&&null!==he(e.bytes))return;throw new fe(t,`BLS12-381 element expected: ${JSON.stringify(e)}`,e);case"sapling_state":if(Array.isArray(e))return;throw new fe(t,`sapling state expected: ${JSON.stringify(e)}`,e);case"ticket":return void Ht(e,{prim:"pair",args:[{prim:"address"},t.args[0],{prim:"nat"}]},r);default:throw new fe(t,`type ${jt(t)} don't have Michelson literal representation`,e)}}function Gt(e,t,r){const n=(null==r?void 0:r.protocol)||b;if(Array.isArray(e))return function(e,t,r){let n=t,i=t,o=0;for(const t of e){const e=Gt(t,i,r);if(n=e,"failed"in e)break;i=e,o++}if("failed"in n&&0==n.level&&(!("prim"in n.failed)||"never"!==n.failed.prim)&&o!==e.length-1)throw new Ct(e,n,"FAIL must appear in a tail position");if(void 0!==(null==r?void 0:r.traceCallback)){const i={op:e,in:t,out:n};r.traceCallback(i)}return"failed"in n?{failed:n.failed,level:n.level+1}:n}(e,t,r);const i=e;function o(e,...r){if(t.length{try{return e(...r)}catch(e){throw e instanceof ue?new Ct(i,t,e.message):e}}}function a(e){return r=>{try{return e(r)}catch(e){throw e instanceof ue?new Ct(i,t,e.message):e}}}const c=s(ge),u=s(Bt),l=s(Ut),f=a(He),d=a(Ge),m=a(Ve),g=a($e),y=a(qe);function _(e,r){const n=c(i,Object.assign(Object.assign({},r),{emptyFields:void 0!==e.f&&e.f>1,emptyVar:void 0!==e.v&&e.v>1})),o=(e,r,n)=>{if(e&&e.length>(r||0))throw new Ct(i,t,`${i.prim}: at most ${r||0} ${n} annotations allowed`)};return o(n.f,e.f,"field"),o(n.t,e.t,"type"),o(n.v,e.v,"variable"),n}function w(e,t){const r=e,n=Array.isArray(r)?{prim:"pair",args:r}:r,i=c(n),o=void 0!==t.v||void 0!==t.t||void 0!==t.f?[...(null===t.v?i.v:t.v)||[],...(null===t.t?i.t:t.t)||[],...(null===t.f?i.f:t.f)||[]]:void 0,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i["@"+(e.v?e.v[0].slice(1)+".":"")+t];function I(e,t){return"failed"in e||"failed"in t?"failed"in e?t:e:(u(e,t),e)}const R=(e=>{var i,s,a,b,R;switch(e.prim){case"DUP":{const r=e.args?parseInt(e.args[0].int,10):1;if(0===r)throw new Ct(e,t,"DUP 0 is forbidden");const n=o(r-1,null)[0];if("ticket"===jt(n))throw new Ct(e,t,"ticket can't be DUPed");return[n,...t]}case"SWAP":{const e=o(0,null,null);return _({}),[e[1],e[0],...t.slice(2)]}case"SOME":return[w({prim:"option",args:[o(0,null)[0]]},_({t:1,v:1})),...t.slice(1)];case"UNIT":return[w({prim:"unit"},_({v:1,t:1})),...t];case"PAIR":{const r=e.args?parseInt(e.args[0].int,10):2;if(r<2)throw new Ct(e,t,`PAIR ${r} is forbidden`);const n=o(0,...new Array(r).fill(null)),i=_({f:r,t:1,v:1},{specialFields:!0}),s=e=>{const t=e.lastIndexOf(".");return e.slice(t>0?t+1:1)},a=n.map(((e,t)=>{var r;const n=c(e);return w(e,{v:null,t:null,f:i.f&&i.f.length>t&&"%"!==i.f[t]?"%@"===i.f[t]?n.v?["%"+s((null===(r=n.v)||void 0===r?void 0:r[0])||"")]:void 0:[i.f[t]]:void 0})}));return[w({prim:"pair",args:a},{t:i.t,v:i.v}),...t.slice(r)]}case"UNPAIR":{const r=e.args?parseInt(e.args[0].int,10):2;if(r<2)throw new Ct(e,t,`UNPAIR ${r} is forbidden`);const n=o(0,["pair"])[0],i=_({f:2,v:2},{specialVar:!0});return[...A(n,r).map(((e,t)=>O(n,e,i,t,0===t?"car":"cdr"))),...t.slice(1)]}case"CAR":case"CDR":{const r=we("pair",o(0,["pair"])[0]);return[O(r,r.args["CAR"===e.prim?0:1],_({f:1,v:1},{specialVar:!0}),0,e.prim.toLocaleLowerCase()),...t.slice(1)]}case"CONS":{const e=o(0,null,["list"]);return l(e[0],e[1].args[0]),[E({prim:"list",args:[e[1].args[0]]}),...t.slice(2)]}case"SIZE":return o(0,["string","list","set","map","bytes"]),[E({prim:"nat"}),...t.slice(1)];case"MEM":{const e=o(0,null,["set","map","big_map"]);return f(e[0]),l(e[0],e[1].args[0]),[E({prim:"bool"}),...t.slice(2)]}case"GET":if(e.args){const r=parseInt(e.args[0].int,10);return[E(S(o(0,["pair"])[0],r)),...t.slice(1)]}{const e=o(0,null,["map","big_map"]);return f(e[0]),l(e[0],e[1].args[0]),[E({prim:"option",args:[e[1].args[1]]}),...t.slice(2)]}case"UPDATE":if(e.args){const r=parseInt(e.args[0].int,10),n=o(0,null,["pair"]);return[E(P(n[1],n[0],r)),...t.slice(2)]}{const e=o(0,null,["bool","option"]);if(f(e[0]),"bool"===e[1].prim){const r=o(2,["set"]);return l(e[0],r[0].args[0]),[E({prim:"set",args:[w(e[0],{t:null})]}),...t.slice(3)]}const r=o(2,["map","big_map"]);return l(e[0],r[0].args[0]),"map"===r[0].prim?[E({prim:"map",args:[w(e[0],{t:null}),w(e[1].args[0],{t:null})]}),...t.slice(3)]:(y(e[1].args[0]),[E({prim:"big_map",args:[w(e[0],{t:null}),w(e[1].args[0],{t:null})]}),...t.slice(3)])}case"GET_AND_UPDATE":{const e=_({v:2}),r=o(0,null,["option"],["map","big_map"]);f(r[0]),l(r[0],r[2].args[0]),l(r[1].args[0],r[2].args[1]);const n=null===(i=e.v)||void 0===i?void 0:i.map((e=>"@"!==e?[e]:void 0));return"map"===r[2].prim?[w({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),w({prim:"map",args:[w(r[0],{t:null}),w(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...t.slice(3)]:(y(r[1].args[0]),[w({prim:"option",args:[r[2].args[1]]},{v:null==n?void 0:n[0]}),w({prim:"big_map",args:[w(r[0],{t:null}),w(r[1].args[0],{t:null})]},{v:null==n?void 0:n[1]}),...t.slice(3)])}case"EXEC":{const e=o(0,null,["lambda"]);return l(e[0],e[1].args[0]),[E(e[1].args[1]),...t.slice(2)]}case"APPLY":{const r=o(0,null,["lambda"]);if(m(r[0]),g(r[0]),!Ee(r[1].args[0]))throw new Ct(e,t,`${e.prim}: function's argument must be a pair: ${jt(r[1].args[0])}`);const n=r[1].args[0];return l(r[0],Dt(n)[0]),[E({prim:"lambda",args:[Dt(n)[1],r[1].args[1]]}),...t.slice(2)]}case"FAILWITH":{const e=o(0,null)[0];return v(n,p.PtEdo2Zk)||d(e),{failed:e,level:0}}case"NEVER":return o(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[E(o(0,null)[0]),...t.slice(1)];case"CONCAT":{const r=o(0,["string","list","bytes"]);if("list"===r[0].prim){if("string"!==jt(r[0].args[0])&&"bytes"!==jt(r[0].args[0]))throw new Ct(e,t,`${e.prim}: can't concatenate list of ${jt(r[0].args[0])}'s`);return[E(r[0].args[0]),...t.slice(1)]}const n=o(1,["string","bytes"]);if(r[0].prim!==n[0].prim)throw new Ct(e,t,`${e.prim}: can't concatenate ${r[0].prim} with ${n[0].prim}`);return[E(n[0]),...t.slice(2)]}case"SLICE":return[E({prim:"option",args:[o(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...t.slice(3)];case"PACK":{const e=o(0,null)[0];return d(e),[E({prim:"bytes"},"@packed"),...t.slice(1)]}case"ADD":{const r=o(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("int"===r[0].prim&&"timestamp"===r[1].prim||"timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...t.slice(2)];if(("int"===r[0].prim||"nat"===r[0].prim||"mutez"===r[0].prim||"bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't add ${r[0].prim} to ${r[1].prim}`)}case"SUB":{const r=v(n,p.PsiThaCa)?o(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):o(0,["nat","int","timestamp"],["nat","int","timestamp"]);if(("nat"===r[0].prim||"int"===r[0].prim)&&("nat"===r[1].prim||"int"===r[1].prim)||"timestamp"===r[0].prim&&"timestamp"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("timestamp"===r[0].prim&&"int"===r[1].prim)return[E({prim:"timestamp"}),...t.slice(2)];if("mutez"===r[0].prim&&"mutez"===r[1].prim)return[E({prim:"mutez"}),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't subtract ${r[0].prim} from ${r[1].prim}`)}case"SUB_MUTEZ":return o(0,["mutez"],["mutez"]),[E({prim:"option",args:[{prim:"mutez"}]}),...t.slice(2)];case"MUL":{const r=o(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if("nat"===r[0].prim&&"int"===r[1].prim||"int"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"int"}),...t.slice(2)];if("nat"===r[0].prim&&"mutez"===r[1].prim||"mutez"===r[0].prim&&"nat"===r[1].prim)return[E({prim:"mutez"}),...t.slice(2)];if(("bls12_381_g1"===r[0].prim||"bls12_381_g2"===r[0].prim||"bls12_381_fr"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[0].prim||"int"===r[0].prim)&&r[0].prim===r[1].prim)return[E(r[0]),...t.slice(2)];if(("nat"===r[0].prim||"int"===r[0].prim)&&"bls12_381_fr"===r[1].prim||("nat"===r[1].prim||"int"===r[1].prim)&&"bls12_381_fr"===r[0].prim)return[E({prim:"bls12_381_fr"}),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't multiply ${r[0].prim} by ${r[1].prim}`)}case"EDIV":{const r=(e,t)=>({prim:"option",args:[{prim:"pair",args:[{prim:e},{prim:t}]}]}),n=o(0,["nat","int","mutez"],["nat","int","mutez"]);if("nat"===n[0].prim&&"nat"===n[1].prim)return[E(r("nat","nat")),...t.slice(2)];if(!("nat"!==n[0].prim&&"int"!==n[0].prim||"nat"!==n[1].prim&&"int"!==n[1].prim))return[E(r("int","nat")),...t.slice(2)];if("mutez"===n[0].prim&&"nat"===n[1].prim)return[E(r("mutez","mutez")),...t.slice(2)];if("mutez"===n[0].prim&&"mutez"===n[1].prim)return[E(r("nat","mutez")),...t.slice(2)];throw new Ct(e,t,`${e.prim}: can't euclideally divide ${n[0].prim} by ${n[1].prim}`)}case"ABS":return o(0,["int"]),[E({prim:"nat"}),...t.slice(1)];case"ISNAT":return o(0,["int"]),[E({prim:"option",args:[{prim:"nat"}]}),...t.slice(1)];case"INT":return o(0,["nat","bls12_381_fr","bytes"]),[E({prim:"int"}),...t.slice(1)];case"BYTES":return o(0,["nat","int"]),[E({prim:"bytes"}),...t.slice(1)];case"NAT":return o(0,["bytes"]),[E({prim:"nat"}),...t.slice(1)];case"NEG":{const e=o(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return"nat"===e.prim||"int"===e.prim?[E({prim:"int"}),...t.slice(1)]:[E(e),...t.slice(1)]}case"LSL":case"LSR":return o(0,["nat","bytes"],["nat","bytes"]),[E({prim:"nat"}),...t.slice(2)];case"OR":case"XOR":{const r=o(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(r[0].prim!==r[1].prim)throw new Ct(e,t,`${e.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...t.slice(2)]}case"AND":{const r=o(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if(("int"!==r[0].prim||"nat"!==r[1].prim)&&r[0].prim!==r[1].prim)throw new Ct(e,t,`${e.prim}: both arguments must be of the same type: ${r[0].prim}, ${r[1].prim}`);return[E(r[1]),...t.slice(2)]}case"NOT":return"bool"===o(0,["nat","bytes","bool","int"])[0].prim?[E({prim:"bool"}),...t.slice(1)]:[E({prim:"int"}),...t.slice(1)];case"COMPARE":{const e=o(0,null,null);return f(e[0]),f(e[1]),[E({prim:"int"}),...t.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return o(0,["int"]),[E({prim:"bool"}),...t.slice(1)];case"SELF":{if(void 0===(null==r?void 0:r.contract))throw new Ct(e,t,`${e.prim}: contract required`);const n=_({f:1,v:1}),i=qt(r.contract,null===(s=n.f)||void 0===s?void 0:s[0]);if(null===i)throw new Ct(e,t,`${e.prim}: contract has no entrypoint ${i}`);return[w({prim:"contract",args:[i]},{v:n.v?n.v:["@self"]}),...t]}case"TRANSFER_TOKENS":{const e=o(0,null,["mutez"],["contract"]);return l(e[0],e[2].args[0]),[E({prim:"operation"}),...t.slice(3)]}case"SET_DELEGATE":{const r=o(0,["option"])[0];if("key_hash"!==jt(r.args[0]))throw new Ct(e,t,`${e.prim}: key hash expected: ${jt(r.args[0])}`);return[E({prim:"operation"}),...t.slice(1)]}case"IMPLICIT_ACCOUNT":return o(0,["key_hash"]),[E({prim:"contract",args:[{prim:"unit"}]}),...t.slice(1)];case"NOW":return[E({prim:"timestamp"},"@now"),...t];case"AMOUNT":return[E({prim:"mutez"},"@amount"),...t];case"BALANCE":return[E({prim:"mutez"},"@balance"),...t];case"CHECK_SIGNATURE":return o(0,["key"],["signature"],["bytes"]),[E({prim:"bool"}),...t.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return o(0,["bytes"]),[E({prim:"bytes"}),...t.slice(1)];case"HASH_KEY":return o(0,["key"]),[E({prim:"key_hash"}),...t.slice(1)];case"SOURCE":return[E({prim:"address"},"@source"),...t];case"SENDER":return[E({prim:"address"},"@sender"),...t];case"ADDRESS":{const e=o(0,["contract"])[0],r=_({v:1});return[w({prim:"address",[h]:e},{v:r.v?r.v:T(c(e),"address")}),...t.slice(1)]}case"SELF_ADDRESS":{const e={prim:"address"};return void 0!==(null==r?void 0:r.contract)&&(e[h]={prim:"contract",args:[$t(r.contract,"parameter").args[0]]}),[E(e,"@address"),...t]}case"CHAIN_ID":return[E({prim:"chain_id"}),...t];case"DROP":{_({});const r=void 0!==e.args?parseInt(e.args[0].int,10):1;return o(r-1,null),t.slice(r)}case"DIG":{_({});const r=parseInt(e.args[0].int,10);return[o(r,null)[0],...t.slice(0,r),...t.slice(r+1)]}case"DUG":{_({});const r=parseInt(e.args[0].int,10);return[...t.slice(1,r+1),o(0,null)[0],...t.slice(r+1)]}case"NONE":return Ft(e.args[0]),[w({prim:"option",args:[e.args[0]]},_({t:1,v:1})),...t];case"LEFT":case"RIGHT":{const r=o(0,null)[0],n=_({f:2,t:1,v:1},{specialFields:!0}),i=c(r),s=[w(r,{t:null,v:null,f:n.f&&n.f.length>0&&"%"!==n.f[0]?"%@"===n.f[0]?i.v?["%"+i.v[0].slice(1)]:void 0:n.f:void 0}),w(e.args[0],{t:null,f:n.f&&n.f.length>1&&"%"!==n.f[1]?n.f:void 0})];return[w({prim:"or",args:"LEFT"===e.prim?s:[s[1],s[0]]},{t:n.t,v:n.v}),...t.slice(1)]}case"NIL":return Ft(e.args[0]),[w({prim:"list",args:[e.args[0]]},_({t:1,v:1})),...t];case"UNPACK":return o(0,["bytes"]),Ft(e.args[0]),[E({prim:"option",args:[e.args[0]]},"@unpacked"),...t.slice(1)];case"CONTRACT":{const r=o(0,["address"])[0];Ft(e.args[0]);const n=_({v:1,f:1}),i=r[h];if(void 0!==i){const r=qt(i,null===(a=n.f)||void 0===a?void 0:a[0]);if(null===r)throw new Ct(e,t,`${e.prim}: contract has no entrypoint ${r}`);l(r,e.args[0])}return[w({prim:"option",args:[{prim:"contract",args:[e.args[0]]}]},{v:n.v?n.v:T(c(r),"contract")}),...t.slice(1)]}case"CAST":{_({});const r=o(0,null)[0];return Ft(e.args[0]),l(e.args[0],r),[e.args[0],...t.slice(1)]}case"IF_NONE":{_({});const n=o(0,["option"])[0],i=t.slice(1);return I(Gt(e.args[0],i,r),Gt(e.args[1],[w(n.args[0],{t:null,v:T(c(n),"some")}),...i],r))}case"IF_LEFT":{_({});const n=o(0,["or"])[0],i=c(n),s=c(n.args[0]),a=c(n.args[1]),u=t.slice(1);return I(Gt(e.args[0],[w(n.args[0],{t:null,v:T(i,s.f?s.f[0].slice(1):"left")}),...u],r),Gt(e.args[1],[w(n.args[1],{t:null,v:T(i,a.f?a.f[0].slice(1):"right")}),...u],r))}case"IF_CONS":{_({});const n=o(0,["list"])[0],i=c(n),s=t.slice(1);return I(Gt(e.args[0],[w(n.args[0],{t:null,v:T(i,"hd")}),w(n,{t:null,v:T(i,"tl")}),...s],r),Gt(e.args[1],s,r))}case"IF":{_({}),o(0,["bool"]);const n=t.slice(1);return I(Gt(e.args[0],n,r),Gt(e.args[1],n,r))}case"MAP":{const n=o(0,["list","map","option"])[0],i=t.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=Gt(e.args[0],[w(s,{t:null,v:T(c(n),"elt")}),...i],r);if("failed"in a){if(!("prim"in a.failed)||"never"!==a.failed.prim)throw new Ct(e,t,`${e.prim}: FAIL is not allowed in MAP`);return{failed:a.failed,level:a.level+1}}if(a.length<1)throw new Ct(e,t,`${e.prim}: function must return a value`);return u(a.slice(1),i),"list"===n.prim?[E({prim:"list",args:[a[0]]}),...i]:"map"===n.prim?[E({prim:"map",args:[n.args[0],a[0]]}),...i]:[E({prim:"option",args:[a[0]]}),...i]}case"ITER":{_({});const n=o(0,["set","list","map"])[0],i=t.slice(1),s="map"===n.prim?{prim:"pair",args:n.args}:n.args[0],a=Gt(e.args[0],[w(s,{t:null,v:T(c(n),"elt")}),...i],r);return"failed"in a?{failed:a.failed,level:a.level+1}:(u(a,i),i)}case"LOOP":{_({}),o(0,["bool"]);const n=t.slice(1),i=Gt(e.args[0],n,r);return"failed"in i?{failed:i.failed,level:i.level+1}:(u(i,[{prim:"bool"},...n]),n)}case"LOOP_LEFT":{_({});const n=o(0,["or"])[0],i=t.slice(1),s=Gt(e.args[0],[w(n.args[0],{t:null,v:T(c(n),"left")}),...i],r);return"failed"in s?{failed:s.failed,level:s.level+1}:(u(s,[n,...i]),[w(n.args[1],{t:null,v:_({v:1}).v}),...i])}case"DIP":{_({});const n=2===e.args.length?parseInt(e.args[0].int,10):1;o(n-1,null);const i=t.slice(0,n),s=t.slice(n),a=2===e.args.length?Gt(e.args[1],s,r):Gt(e.args[0],s,r);return"failed"in a?{failed:a.failed,level:a.level+1}:[...i,...a]}case"CREATE_CONTRACT":{const r=_({v:2}),n=o(0,["option"],["mutez"],null);if("key_hash"!==jt(n[0].args[0]))throw new Ct(e,t,`${e.prim}: key hash expected: ${jt(n[0].args[0])}`);m(n[2])&&(Zt(e.args[0]),Ut($t(e.args[0],"storage").args[0],n[2]));const i=null===(b=r.v)||void 0===b?void 0:b.map((e=>"@"!==e?[e]:void 0));return[w({prim:"operation"},{v:null==i?void 0:i[0]}),w({prim:"address",[h]:{prim:"contract",args:[$t(e.args[0],"parameter").args[0]]}},{v:null==i?void 0:i[1]}),...t.slice(3)]}case"PUSH":return Ft(e.args[0]),Ht(e.args[1],e.args[0],Object.assign(Object.assign({},r),{contract:void 0})),[E(e.args[0]),...t];case"EMPTY_SET":return Ft(e.args[0]),f(e.args[0]),[w({prim:"set",args:e.args},_({t:1,v:1})),...t];case"EMPTY_MAP":return Ft(e.args[0]),f(e.args[0]),Ft(e.args[1]),[w({prim:"map",args:e.args},_({t:1,v:1})),...t];case"EMPTY_BIG_MAP":return Ft(e.args[0]),f(e.args[0]),Ft(e.args[1]),y(e.args[0]),[w({prim:"big_map",args:e.args},_({t:1,v:1})),...t];case"LAMBDA_REC":case"LAMBDA":{Ft(e.args[0]),Ft(e.args[1]);const n=[e.args[0]];"LAMBDA_REC"===e.prim&&n.push({prim:"lambda",args:[e.args[0],e.args[1]]});const i=Gt(e.args[2],n,Object.assign(Object.assign({},r),{contract:void 0}));if("failed"in i)return{failed:i.failed,level:i.level+1};if(1!==i.length)throw new Ct(e,t,`${e.prim}: function must return a value`);return l(e.args[1],i[0]),[E({prim:"lambda",args:[e.args[0],e.args[1]]}),...t]}case"LEVEL":return[E({prim:"nat"},"@level"),...t];case"TOTAL_VOTING_POWER":case"MIN_BLOCK_TIME":return[E({prim:"nat"}),...t];case"VOTING_POWER":return o(0,["key_hash"]),[E({prim:"nat"}),...t.slice(1)];case"TICKET":{const e=o(0,null,["nat"])[0];return f(e),v(n,p.PtLimaPtL)?[w({prim:"ticket",args:[e]},_({t:1,v:1})),...t.slice(2)]:[E({prim:"option",args:[w({prim:"ticket",args:[e]},_({t:1,v:1}))]}),...t.slice(2)]}case"JOIN_TICKETS":{const r=we("pair",o(0,["pair"])[0]);if("ticket"!==jt(r.args[0]))throw new Ct(e,t,`${e.prim}: ticket expected: ${jt(r.args[0])}`);return l(r.args[0],r.args[1]),[E({prim:"option",args:[w(r.args[0],{t:null})]}),...t.slice(1)]}case"SPLIT_TICKET":{const r=o(0,["ticket"],["pair"]),n=we("pair",r[1]);if("nat"!==jt(n.args[0]))throw new Ct(e,t,`${e.prim}: nat expected: ${jt(n.args[0])}`);return l(n.args[0],n.args[1]),[E({prim:"option",args:[{prim:"pair",args:[w(r[0],{t:null}),w(r[0],{t:null})]}]}),...t.slice(2)]}case"READ_TICKET":{const e=_({v:2}),r=o(0,["ticket"])[0],n=null===(R=e.v)||void 0===R?void 0:R.map((e=>"@"!==e?[e]:void 0));return[w({prim:"pair",args:[{prim:"address"},w(r.args[0],{t:null}),{prim:"nat"}]},{v:null==n?void 0:n[0]}),w(r,{v:null==n?void 0:n[1],t:null}),...t.slice(1)]}case"PAIRING_CHECK":{const r=o(0,["list"])[0].args[0];if(!Ee(r))throw new Ct(e,t,`${e.prim}: pair expected: ${jt(r)}`);const n=we("pair",r);if("bls12_381_g1"!==jt(n.args[0]))throw new Ct(e,t,`${e.prim}: bls12_381_g1 expected: ${jt(n.args[0])}`);if("bls12_381_g2"!==jt(n.args[1]))throw new Ct(e,t,`${e.prim}: bls12_381_g2 expected: ${jt(n.args[1])}`);return[E({prim:"bool"}),...t.slice(1)]}case"SAPLING_EMPTY_STATE":return[w({prim:"sapling_state",args:[e.args[0]]},_({v:1,t:1})),...t];case"SAPLING_VERIFY_UPDATE":{const r=o(0,["sapling_transaction"],["sapling_state"]);if(parseInt(r[0].args[0].int,10)!==parseInt(r[1].args[0].int,10))throw new Ct(e,t,`${e.prim}: sapling memo size mismatch: ${r[0].args[0].int} != ${r[1].args[0].int}`);return v(n,p.PtJakarta)?[E({prim:"option",args:[{prim:"pair",args:[{prim:"int"},w(r[1],{t:null})]}]}),...t.slice(2)]:[E({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},w(r[1],{t:null})]}]}]}),...t.slice(2)]}case"OPEN_CHEST":return o(0,["chest_key"],["chest"],["nat"]),[E({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...t.slice(3)];case"VIEW":{const r=o(0,null,["address"]);return g(r[0]),[E({prim:"option",args:[e.args[1]]}),...t.slice(2)]}case"EMIT":{const r=_({f:1,t:1});if(e.args){const n=o(0,null);return l(n[0],e.args[0]),[w({prim:"operation"},r),...t.slice(1)]}return[w({prim:"operation"},r),...t.slice(1)]}default:throw new ue(e,`unexpected instruction: ${e.prim}`)}})(i);if(void 0!==(null==r?void 0:r.traceCallback)){const e={op:i,in:t,out:R};r.traceCallback(e)}return R}function $t(e,t){for(const r of e)if(r.prim===t)return r;throw new ue(e,`missing contract section: ${t}`)}function Vt(e){const t={};for(const r of e)"view"===r.prim&&(t[r.args[0].string]=r);return t}function zt(e){if(Array.isArray(e))for(const t of e)if("prim"in t&&("parameter"===t.prim||"storage"===t.prim||"code"===t.prim))return!0;return!1}function qt(e,t){t=t||"%default";const r=Wt(e).find((e=>e[0]===t));return void 0!==r?r[1]:"%default"===t?zt(e)?$t(e,"parameter").args[0]:e:null}function Wt(e){if(zt(e)){const t=$t(e,"parameter"),r=Wt(t.args[0]),n=ge(t);return n.f?[[n.f[0],t.args[0]],...r]:r}if(t=e,Array.isArray(t)||"or"===t.prim){const t=Dt(e),r=e=>{const r=ge(t[e]);if("or"===jt(t[e])){const n=Wt(t[e]);return r.f?[[r.f[0],t[e]],...n]:n}return r.f?[[r.f[0],t[e]]]:[]};return[...r(0),...r(1)]}var t;return[]}function Zt(e,t){const r=(r,n,i,o)=>{Ft(r,!0),Ft(n);const s=Gt(o,[{prim:"pair",args:[Object.assign(Object.assign({},r),{annots:["@parameter"]}),Object.assign(Object.assign({},n),{annots:["@storage"]})]}],Object.assign(Object.assign({},t),{contract:e}));if("failed"in s)return s;try{Bt(s,[i])}catch(e){throw e instanceof ue?new Ct(o,s,e.message):e}return s},n=$t(e,"parameter").args[0],i=$t(e,"storage").args[0],o=r(n,i,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},i]},$t(e,"code").args[0]);for(const t of Object.values(Vt(e)))r(t.args[1],i,t.args[2],t.args[3]);return o}function Jt(e,t,r){Ft(t),Ht(e,t,r||null)}function Yt(e,t,r){for(const e of t)Ft(e);if(void 0!==(null==r?void 0:r.contract))for(const e of["parameter","storage"]){Ft($t(r.contract,e).args[0])}return Gt(e,t,r||null)}function Xt(e,t,r=!1){if(Array.isArray(e)){for(const t of e)Ft(t);for(const e of t)Ft(e)}else Ft(e),Ft(t);Ut(e,t,r)}function Qt(e,t=!1){try{return Ft(e,t),!0}catch(e){return!1}}function er(e,t){try{return Zt(e,t)}catch(e){return null}}function tr(e,t,r){try{return Jt(e,t,r),!0}catch(e){return!1}}function rr(e,t,r=!1){try{return Xt(e,t,r),!0}catch(e){return!1}}class nr{constructor(e,t){this.contract=e,this.ctx=Object.assign({contract:e},t),this.output=Zt(e,this.ctx)}static parse(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new re("empty Michelson");if(Qe(n))return new nr(n,t)}static parseTypeExpression(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new ne("empty type expression");if(Je(n))return Ft(n),n}static parseDataExpression(e,t){const r=new K(t),n="string"==typeof e?r.parseScript(e):r.parseJSON(e);if(null===n)throw new ie("empty data expression");if(Xe(n))return n;throw void 0}section(e){return $t(this.contract,e)}entryPoints(){return Wt(this.contract)}entryPoint(e){return qt(this.contract,e)}assertDataValid(e,t){Jt(e,t,this.ctx)}isDataValid(e,t){return tr(e,t,this.ctx)}assertParameterValid(e,t){const r=this.entryPoint(e||void 0);if(null===r)throw new oe(null==e?void 0:e.toString());this.assertDataValid(t,r)}isParameterValid(e,t){try{return this.assertParameterValid(e,t),!0}catch(e){return!1}}functionType(e,t){return Yt(e,t,this.ctx)}}const ir=new nr([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);function or(e){return"failed"in e?`[FAILED: ${z(e.failed)}]`:e.map(((e,t)=>{const r=ge(e);return`[${t}${r.v?"/"+r.v[0]:""}]: ${z(e)}`})).join("\n")}function sr(e,t){return r=>{var n;if(Array.isArray(r)&&!e)return;const o=null===(n=r.op[i])||void 0===n?void 0:n.macro,s=`${o?"Macro":"Op"}: ${o?z(o,void 0,!0)+" / ":""}${z(r.op)}\nInput:\n${or(r.in)}\nOutput:\n${or(r.out)}\n`;t(s)}}function ar(e){var t;if(e instanceof Ct){const r=null===(t=e.val[i])||void 0===t?void 0:t.macro;return`${r?"Macro":"Op"}: ${r?z(r,void 0,!0)+" / ":""}${z(e.val)}\nStack:\n${or(e.stackState)}\n`}if(e instanceof fe){return`Type: ${Array.isArray(e.val)?"["+e.val.map(((e,t)=>`[${t}]: ${z(e)}`)).join("; ")+"]":z(e.val)}\n${e.data?`Data: ${z(e.data)}\n`:""}\n`}return`Value: ${z(e.val)}`}const cr={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"}},8899:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AddressValidationError:()=>T,BigMapEncodingError:()=>Fe,BigMapValidationError:()=>m,BytesValidationError:()=>U,ChainIDValidationError:()=>te,ContractValidationError:()=>k,EncodeTicketError:()=>ne,EventSchema:()=>Je,IntValidationError:()=>H,InvalidBigMapDiffError:()=>Be,InvalidBigMapSchemaError:()=>Ue,InvalidMapTypeError:()=>u,InvalidRpcResponseError:()=>De,InvalidScriptError:()=>je,KeyHashValidationError:()=>q,KeyValidationError:()=>V,ListValidationError:()=>N,MapTypecheckError:()=>f,MapValidationError:()=>R,MichelsonMap:()=>d,MissingArgumentError:()=>He,MutezValidationError:()=>j,NatValidationError:()=>A,OrValidationError:()=>v,ParameterEncodingError:()=>Ce,ParameterSchema:()=>We,SaplingStateValue:()=>Qe,Schema:()=>qe,SetValidationError:()=>Q,SignatureValidationError:()=>Z,StorageEncodingError:()=>Ke,Token:()=>p,TokenArgumentValidationError:()=>_,TokenComparisonError:()=>w,UnitValue:()=>Xe,VERSION:()=>Ye,ViewSchema:()=>Ze,deepEqual:()=>ze});var n,i=r(5695),o=r.n(i),s=r(227),a=r(2558),c=r(4632);class u extends s.TaquitoError{constructor(e,t){super(),this.mapType=e,this.reason=t,this.message=`The map type '${JSON.stringify(e)}' is invalid. Reason: ${t}.`,this.name="InvalidMapTypeError"}}const l=Symbol.for("taquito-michelson-map-type-symbol");class f extends s.TaquitoError{constructor(e,t,r,n){super(),this.value=e,this.type=t,this.reason=n,this.name="MapTypecheckError",this.message=`The ${r} provided: ${JSON.stringify(e)} is not compatible with the expected michelson type: ${JSON.stringify(t)}. Reason: ${JSON.stringify(n)}.`,this.name="MapTypecheckError"}}class d{static isMichelsonMap(e){return e&&!0===e[l]}constructor(e){this.valueMap=new Map,this.keyMap=new Map,this[n]=!0,e&&this.setType(e)}setType(e){!function(e){if(!("prim"in e))throw new u(e,"Missing 'prim' field");if(!["map","big_map"].includes(e.prim))throw new u(e,"The prim field should be 'map' or 'big_map'");if(!("args"in e))throw new u(e,"Missing 'args' field");if(!Array.isArray(e.args))throw new u(e,"The 'args' field should be an array");if(2!==e.args.length)throw new u(e,"The 'args' field should have 2 elements")}(e),this.keySchema=new qe(e.args[0]),this.valueSchema=new qe(e.args[1])}removeType(){this.keySchema=void 0,this.valueSchema=void 0}static fromLiteral(e,t){const r=new d(t);return Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}typecheckKey(e){this.keySchema&&this.keySchema.Typecheck(e)}typecheckValue(e){this.valueSchema&&this.valueSchema.Typecheck(e)}assertTypecheckValue(e){try{this.typecheckValue(e)}catch(t){throw new f(e,this.valueSchema,"value",t)}}assertTypecheckKey(e){try{this.typecheckKey(e)}catch(t){throw new f(e,this.keySchema,"key",t)}}serializeDeterministically(e){return o()(e)}*keys(){for(const[e]of this.entries())yield e}*values(){for(const[,e]of this.entries())yield e}*entries(){for(const e of this.valueMap.keys())yield[this.keyMap.get(e),this.valueMap.get(e)]}get(e){this.assertTypecheckKey(e);const t=this.serializeDeterministically(e);return this.valueMap.get(t)}set(e,t){this.assertTypecheckKey(e),this.assertTypecheckValue(t);const r=this.serializeDeterministically(e);this.keyMap.set(r,e),this.valueMap.set(r,t)}delete(e){this.assertTypecheckKey(e),this.keyMap.delete(this.serializeDeterministically(e)),this.valueMap.delete(this.serializeDeterministically(e))}has(e){this.assertTypecheckKey(e);const t=this.serializeDeterministically(e);return this.keyMap.has(t)&&this.valueMap.has(t)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(e){for(const[t,r]of this.entries())e(r,t,this)}}n=l;class h extends s.TaquitoError{constructor(e,t,r){super(),this.value=e,this.token=t,this.name="TokenValidationError";const n=this.token.annot(),i=n?`[${n}] `:"";this.message=`${i}${r}`}}class p{constructor(e,t,r){this.val=e,this.idx=t,this.fac=r,this.createToken=this.fac}typeWithoutAnnotations(){const e=t=>{if("object"==typeof t){if(Array.isArray(t)){return t.map((t=>e(t)))}const r=t;return r.args?{prim:r.prim,args:r.args.map((t=>e(t)))}:{prim:r.prim}}return t};return(t=this.val).args?{prim:t.prim,args:t.args.map((t=>e(t)))}:{prim:t.prim};var t}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.ExtractSchema()]]}}class b extends p{compare(e,t){return e===t?0:ethis.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(t.get(e))]})))}EncodeObject(e,t){const r=this.objLitToMichelsonMap(e);return this.validate(r),t&&t[g.prim]?t[g.prim](r,this.val):Array.from(r.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(r.get(e))]})))}Execute(e,t){if(t&&t[g.prim])return t[g.prim](e,this.val);if(Array.isArray(e)){const t=new d(this.val);return e.forEach((e=>{t.set(this.KeySchema.ToKey(e.args[0]),this.ValueSchema.Execute(e.args[1]))})),t}if("int"in e)return e.int;throw new m(e,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(e)}`)}findAndReturnTokens(e,t){return g.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),this.ValueSchema.findAndReturnTokens(e,t),t}}g.prim="big_map";class v extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="OrValidationError"}}class y extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Encode(e){const t=e[e.length-1],r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof y&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if(String(r.annot())!==String(t)||r instanceof y){if(String(i.annot())!==String(t)||i instanceof y){if(r instanceof y){const t=r.Encode(e);if(t)return{prim:"Left",args:[t]}}if(i instanceof y){const t=i.Encode(e);if(t)return{prim:"Right",args:[t]}}return null}return e.pop(),{prim:"Right",args:[i.Encode(e)]}}return e.pop(),{prim:"Left",args:[r.Encode(e)]}}ExtractSignature(){const e=this.createToken(this.val.args[0],this.idx);let t=1;e instanceof y&&(t=Object.keys(e.ExtractSchema()).length);const r=this.createToken(this.val.args[1],this.idx+t),n=[];if(e instanceof y)n.push(...e.ExtractSignature());else for(const t of e.ExtractSignature())n.push([e.annot(),...t]);if(r instanceof y)n.push(...r.ExtractSignature());else for(const e of r.ExtractSignature())n.push([r.annot(),...e]);return n}EncodeObject(e,t){this.validateJavascriptObject(e);const r=Object.keys(e)[0],n=this.createToken(this.val.args[0],this.idx);let i=1;n instanceof y&&(i=Object.keys(n.ExtractSchema()).length);const o=this.createToken(this.val.args[1],this.idx+i);if(String(n.annot())!==String(r)||n instanceof y){if(String(o.annot())!==String(r)||o instanceof y){if(n instanceof y){const r=n.EncodeObject(e,t);if(r)return{prim:"Left",args:[r]}}if(o instanceof y){const r=o.EncodeObject(e,t);if(r)return{prim:"Right",args:[r]}}return null}return{prim:"Right",args:[o.EncodeObject(e[r],t)]}}return{prim:"Left",args:[n.EncodeObject(e[r],t)]}}validateJavascriptObject(e){if("object"!=typeof e||Array.isArray(e)||null===e||1!==Object.keys(e).length)throw new v(e,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(e)}`)}Execute(e,t){const r=this.createToken(this.val.args[0],this.idx);let n=1;r instanceof y&&(n=Object.keys(r.ExtractSchema()).length);const i=this.createToken(this.val.args[1],this.idx+n);if("Right"===e.prim)return i instanceof y?i.Execute(e.args[0],t):{[i.annot()]:i.Execute(e.args[0],t)};if("Left"===e.prim)return r instanceof y?r.Execute(e.args[0],t):{[r.annot()]:r.Execute(e.args[0],t)};throw new v(e,this,`Was expecting Left or Right prim but got: ${JSON.stringify(e.prim)}`)}traversal(e,t,r){const n=this.createToken(this.val.args[0],this.idx);let i,o=1;n instanceof y?(i=e(n),o=Object.keys(n.ExtractSchema()).length):i={[n.annot()]:e(n)};const s=this.createToken(this.val.args[1],this.idx+o);let a;a=s instanceof y?t(s):{[s.annot()]:t(s)};return r(i,a)}ExtractSchema(){return this.traversal((e=>e.ExtractSchema()),(e=>e.ExtractSchema()),((e,t)=>Object.assign(Object.assign({},e),t)))}generateSchema(){return{__michelsonType:y.prim,schema:this.traversal((e=>e instanceof y?e.generateSchema().schema:e.generateSchema()),(e=>e instanceof y?e.generateSchema().schema:e.generateSchema()),((e,t)=>Object.assign(Object.assign({},e),t)))}}findToken(e){const t=this.createToken(this.val.args[0],this.idx);let r=1;t instanceof y&&(r=Object.keys(t.ExtractSchema()).length);const n=this.createToken(this.val.args[1],this.idx+r);if(String(t.annot())===String(e)&&!(t instanceof y)&&t instanceof b)return t;if(String(n.annot())===String(e)&&!(n instanceof y)&&n instanceof b)return n;if(t instanceof y){const r=t.findToken(e);if(r)return r}if(n instanceof y){const t=n.findToken(e);if(t)return t}return null}compare(e,t){const r=Object.keys(e)[0];if(r!==Object.keys(t)[0]){return JSON.stringify(this.EncodeObject(e))r.findAndReturnTokens(e,t)),(r=>r.findAndReturnTokens(e,t)),((e,t)=>Object.assign(Object.assign({},e),t))),t}}y.prim="or";class _ extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="TokenArgumentValidationError"}}class w extends s.TaquitoError{constructor(e,t){super(),this.val1=e,this.val2=t,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(e)} and ${JSON.stringify(t)} are not comparable`}}function E(e,t=O.prim){if(Array.isArray(e))return E({prim:t,args:e},t);if(void 0===e.args)throw new _(`The value ${JSON.stringify(e)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return e.args.length>2?[e.args[0],{prim:t,args:e.args.slice(1)}]:[e.args[0],e.args[1]]}class O extends b{constructor(e,t,r){super(Array.isArray(e)?{prim:O.prim,args:e}:e.prim?e:{prim:O.prim,args:e},t,r)}args(){return E(this.val)}tokens(){let e=0;return this.args().map((t=>{const r=this.createToken(t,this.idx+e);return r instanceof O?e+=Object.keys(r.ExtractSchema()).length:e++,r}))}Encode(e){return{prim:"Pair",args:this.tokens().map((t=>t.Encode(e)))}}ExtractSignature(){const e=this.args(),t=this.createToken(e[0],this.idx);let r=1;t instanceof y&&(r=Object.keys(t.ExtractSchema()).length);const n=this.createToken(e[1],this.idx+r),i=[];for(const e of t.ExtractSignature())for(const t of n.ExtractSignature())i.push([...e,...t]);return i}ToBigMapKey(e){return{key:this.EncodeObject(e),type:this.typeWithoutAnnotations()}}ToKey(e){return this.Execute(e)}EncodeObject(e,t){const[r,n]=this.tokens();let i,o;return i=r instanceof O&&!r.hasAnnotations()?e:e[r.annot()],o=n instanceof O&&!n.hasAnnotations()?e:e[n.annot()],{prim:"Pair",args:[r.EncodeObject(i,t),n.EncodeObject(o,t)]}}traversal(e,t){const r=this.args(),n=this.createToken(r[0],this.idx);let i,o=1;n instanceof O&&!n.hasAnnotations()?(i=e(n),n instanceof O&&(o=Object.keys(n.ExtractSchema()).length)):i={[n.annot()]:e(n)};const s=this.createToken(r[1],this.idx+o);let a;a=s instanceof O&&!s.hasAnnotations()?t(s):{[s.annot()]:t(s)};return Object.assign(Object.assign({},i),a)}Execute(e,t){const r=E(e,"Pair");return this.traversal((e=>e.Execute(r[0],t)),(e=>e.Execute(r[1],t)))}ExtractSchema(){return this.traversal((e=>e.ExtractSchema()),(e=>e.ExtractSchema()))}generateSchema(){return{__michelsonType:O.prim,schema:this.traversal((e=>e instanceof O&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema()),(e=>e instanceof O&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema()))}}compare(e,t){const[r,n]=this.tokens(),i=(e,t)=>e instanceof O&&!e.hasAnnotations()?t:t[e.annot()];if(r instanceof b&&n instanceof b){const o=r.compare(i(r,e),i(r,t));return 0===o?n.compare(i(n,e),i(n,t)):o}throw new w(e,t)}findAndReturnTokens(e,t){return O.prim===e&&t.push(this),this.tokens().map((r=>r.findAndReturnTokens(e,t))),t}}O.prim="pair";class A extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="NatValidationError"}}class S extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return new a.Z(e[Object.keys(e)[0]])}Encode(e){const t=e.pop();return this.validate(t),{int:new a.Z(t).toFixed()}}validate(e){const t=new a.Z(e);if(t.isNaN())throw new A(e,this,`Value is not a number: ${JSON.stringify(e)}`);if(t.isNegative())throw new A(e,this,`Value cannot be negative: ${JSON.stringify(e)}`)}EncodeObject(e,t){return this.validate(e),t&&t[S.prim]?t[S.prim](e):{int:new a.Z(e).toFixed()}}ExtractSchema(){return S.prim}generateSchema(){return{__michelsonType:S.prim,schema:S.prim}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:S.prim}}}ToKey({int:e}){return new a.Z(e)}compare(e,t){const r=Number(e),n=Number(t);return r===n?0:re.startsWith("tz"),n=r(e),i=r(t);return n&&!i?-1:i&&!n?1:super.compare(e,t)}findAndReturnTokens(e,t){return I.prim===e&&t.push(this),t}}I.prim="address";class R extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="MapValidationError"}}class x extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(e){if(!d.isMichelsonMap(e))throw new R(e,this,`Value ${JSON.stringify(e)} is not a valid MichelsonMap`)}Execute(e,t){const r=new d(this.val);return e.forEach((e=>{r.set(this.KeySchema.ToKey(e.args[0]),this.ValueSchema.Execute(e.args[1],t))})),r}objLitToMichelsonMap(e){return e instanceof d?e:"object"==typeof e?0===Object.keys(e).length?new d:d.fromLiteral(e):e}Encode(e){const t=this.objLitToMichelsonMap(e.pop());return this.validate(t),Array.from(t.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(t.get(e))]})))}EncodeObject(e,t){const r=this.objLitToMichelsonMap(e);return this.validate(r),t&&t[x.prim]?t[x.prim](r):Array.from(r.keys()).sort(((e,t)=>this.KeySchema.compare(e,t))).map((e=>({prim:"Elt",args:[this.KeySchema.EncodeObject(e),this.ValueSchema.EncodeObject(r.get(e))]})))}ExtractSchema(){return{map:{key:this.KeySchema.ExtractSchema(),value:this.ValueSchema.ExtractSchema()}}}generateSchema(){return{__michelsonType:x.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(e,t){return x.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),this.ValueSchema.findAndReturnTokens(e,t),t}}x.prim="map";class M extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return"true"===String(e.prim).toLowerCase()}Encode(e){return{prim:e.pop()?"True":"False"}}EncodeObject(e,t){return t&&t[M.prim]?t[M.prim](e):{prim:e?"True":"False"}}ExtractSchema(){return M.prim}generateSchema(){return{__michelsonType:M.prim,schema:M.prim}}ToBigMapKey(e){return{key:this.EncodeObject(e),type:{prim:M.prim}}}ToKey(e){return this.EncodeObject(e)}compare(e,t){return e&&t||!e&&!t?0:e?1:-1}findAndReturnTokens(e,t){return M.prim===e&&t.push(this),t}}M.prim="bool";class k extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ContractValidationError"}}class L extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if((0,c.validateAddress)(e)!==c.ValidationResult.VALID)throw new k(e,this,`Value ${JSON.stringify(e)} is not a valid contract address.`);return null}Execute(e){if(e.string)return e.string;if(!e.bytes)throw new k(e,this,`Value ${JSON.stringify(e)} is not a valid contract address. must contain bytes or string.`);return(0,c.encodePubKey)(e.bytes)}Encode(e){const t=e.pop();return this.validate(t),{string:t}}EncodeObject(e,t){return this.validate(e),t&&t[L.prim]?t[L.prim](e):{string:e}}ExtractSchema(){return L.prim}generateSchema(){const e=this.createToken(this.val.args[0],0);return{__michelsonType:L.prim,schema:{parameter:this.val.args[0]?e.generateSchema():{}}}}findAndReturnTokens(e,t){return L.prim===e&&t.push(this),t}}L.prim="contract";class N extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ListValidationError"}}class C extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(e){if(!Array.isArray(e))throw new N(e,this,`Value ${JSON.stringify(e)} is not a valid array`)}Encode(e){const t=e.pop();this.validate(t);const r=this.createToken(this.val.args[0],0);return t.reduce(((e,t)=>[...e,r.EncodeObject(t)]),[])}Execute(e,t){const r=this.createToken(this.val.args[0],0);return this.validate(e),e.reduce(((e,n)=>[...e,r.Execute(n,t)]),[])}EncodeObject(e,t){const r=this.createToken(this.val.args[0],0);return this.validate(e),t&&t[C.prim]?t[C.prim](e):e.reduce(((e,t)=>[...e,r.EncodeObject(t)]),[])}ExtractSchema(){return{[C.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:C.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(e,t){return C.prim===e&&t.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(e,t),t}}C.prim="list";class j extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="MutezValidationError"}}class D extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){return new a.Z(e[Object.keys(e)[0]])}ExtractSchema(){return D.prim}generateSchema(){return{__michelsonType:D.prim,schema:D.prim}}validate(e){if(new a.Z(e).isNaN())throw new j(e,this,`Value is not a number: ${e}`)}Encode(e){const t=e.pop();return this.validate(t),{int:String(t).toString()}}EncodeObject(e,t){return this.validate(e),t&&t[D.prim]?t[D.prim](e):{int:String(e).toString()}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:D.prim}}}ToKey({int:e}){return e}compare(e,t){const r=Number(e),n=Number(t);return r===n?0:rthis.KeySchema.compare(e,t))).reduce(((e,t)=>[...e,this.KeySchema.EncodeObject(t)]),[])}Execute(e,t){return e.reduce(((e,r)=>[...e,this.KeySchema.Execute(r,t)]),[])}EncodeObject(e,t){return this.validate(e),t&&t[ee.prim]?t[ee.prim](e):e.sort(((e,t)=>this.KeySchema.compare(e,t))).reduce(((e,t)=>[...e,this.KeySchema.EncodeObject(t)]),[])}ExtractSchema(){return ee.prim}generateSchema(){return{__michelsonType:ee.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(e,t){return ee.prim===e&&t.push(this),this.KeySchema.findAndReturnTokens(e,t),t}}ee.prim="set";class te extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChainIDValidationError"}}class re extends b{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if((0,c.validateChain)(e)!==c.ValidationResult.VALID)throw new te(e,this,`Value ${JSON.stringify(e)} is not a valid ChainID`)}Execute(e){return e[Object.keys(e)[0]]}ExtractSchema(){return re.prim}generateSchema(){return{__michelsonType:re.prim,schema:re.prim}}Encode(e){const t=e.pop();return this.validate(t),{string:t}}EncodeObject(e,t){return this.validate(e),t&&t[re.prim]?t[re.prim](e):{string:e}}ToKey({string:e}){return e}ToBigMapKey(e){return{key:{string:e},type:{prim:re.prim}}}findAndReturnTokens(e,t){return re.prim===e&&t.push(this),t}}re.prim="chain_id";class ne extends s.TaquitoError{constructor(){super(),this.name="TicketEncodeError",this.message="Tickets cannot be sent to the blockchain; they are created on-chain"}}const ie={prim:"contract"},oe={prim:"int"};class se extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new ne}EncodeObject(e,t){if(t&&t[se.prim])return t[se.prim](e,this.val);throw new ne}Execute(e,t){if(t&&t[se.prim])return t[se.prim](e,this.val);const r=this.createToken(ie,this.idx),n=this.valueToken,i=this.createToken(oe,this.idx);return void 0===e.args[2]&&void 0!==e.args[1].args?{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1].args[0],t),amount:i.Execute(e.args[1].args[1],t)}:{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1],t),amount:i.Execute(e.args[2],t)}}ExtractSchema(){return{ticketer:L.prim,value:this.valueToken.ExtractSchema(),amount:G.prim}}generateSchema(){return{__michelsonType:se.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:L.prim,schema:L.prim},amount:{__michelsonType:G.prim,schema:G.prim}}}}findAndReturnTokens(e,t){return se.prim===e&&t.push(this),this.valueToken.findAndReturnTokens(e,t),t}}se.prim="ticket";class ae extends s.TaquitoError{constructor(){super(),this.name="TicketDeprecatedEncodeError",this.message="Ticket_deprecated cannot be sent to the blockchain; they are created on-chain"}}const ce={prim:"contract"},ue={prim:"int"};class le extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new ae}EncodeObject(e,t){if(t&&t[le.prim])return t[le.prim](e,this.val);throw new ae}Execute(e,t){if(t&&t[le.prim])return t[le.prim](e,this.val);const r=this.createToken(ce,this.idx),n=this.valueToken,i=this.createToken(ue,this.idx);return void 0===e.args[2]&&void 0!==e.args[1].args?{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1].args[0],t),amount:i.Execute(e.args[1].args[1],t)}:{ticketer:r.Execute(e.args[0],t),value:n.Execute(e.args[1],t),amount:i.Execute(e.args[2],t)}}ExtractSchema(){return{ticketer:L.prim,value:this.valueToken.ExtractSchema(),amount:G.prim}}generateSchema(){return{__michelsonType:le.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:L.prim,schema:L.prim},amount:{__michelsonType:G.prim,schema:G.prim}}}}findAndReturnTokens(e,t){return le.prim===e&&t.push(this),this.valueToken.findAndReturnTokens(e,t),t}}le.prim="ticket_deprecated";class fe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="NeverTokenError"}}class de extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Encode(e){const t=e.pop();throw new fe(t,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(t)}.`)}EncodeObject(e,t){if(t&&t[de.prim])return t[de.prim](e);throw new fe(e,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(e)}.`)}Execute(e){throw new fe(e,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(e)}.`)}ExtractSchema(){return de.prim}generateSchema(){return{__michelsonType:de.prim,schema:de.prim}}findAndReturnTokens(e,t){return de.prim===e&&t.push(this),t}}de.prim="never";class he extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingStateValidationError"}}class pe extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}isValid(e){return"object"==typeof e&&0===Object.keys(e).length}Execute(e,t){if(t&&t[pe.prim])return t[pe.prim](e,this.val);if("int"in e)return e.int;throw new he(e,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(e)}`)}Encode(e){const t=e.pop();if(this.isValid(t))return[];throw new he(t,this,`Invalid sapling_state. Received: ${JSON.stringify(t)} while expecting: {}`)}EncodeObject(e,t){if(t&&t[pe.prim])return t[pe.prim](e);if(this.isValid(e))return[];throw new he(e,this,`Invalid sapling_state. Received: ${JSON.stringify(e)} while expecting: {}`)}ExtractSchema(){return{[pe.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:pe.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return pe.prim===e&&t.push(this),t}}pe.prim="sapling_state";class be extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingTransactionValidationError"}}class me extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){throw new be(e,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const t=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(t&&t[2].length%2==0)return t[2];throw new be(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}EncodeObject(e,t){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),t&&t[me.prim]?t[me.prim](e):{bytes:String(e).toString()}}ExtractSchema(){return{[me.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:me.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return me.prim===e&&t.push(this),t}}me.prim="sapling_transaction";class ge extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="SaplingTransactionDeprecatedValidationError"}}class ve extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e){throw new ge(e,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const t=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(t&&t[2].length%2==0)return t[2];throw new ge(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.validateBytes(this.convertUint8ArrayToHexString(t)),{bytes:String(t).toString()}}EncodeObject(e,t){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),t&&t[ve.prim]?t[ve.prim](e):{bytes:String(e).toString()}}ExtractSchema(){return{[ve.prim]:{"memo-size":Number(this.val.args[0].int)}}}generateSchema(){return{__michelsonType:ve.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,t){return ve.prim===e&&t.push(this),t}}ve.prim="sapling_transaction_deprecated";class ye extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381frValidationError"}}class _e extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new ye(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return"number"==typeof t?{int:t.toString()}:(t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t})}EncodeObject(e,t){return t&&t[_e.prim]?t[_e.prim](e):"number"==typeof e?{int:e.toString()}:(e=this.convertUint8ArrayToHexString(e),this.validate(e),{bytes:e})}Execute(e){return e.bytes}ExtractSchema(){return _e.prim}generateSchema(){return{__michelsonType:_e.prim,schema:_e.prim}}findAndReturnTokens(e,t){return _e.prim===e&&t.push(this),t}}_e.prim="bls12_381_fr";class we extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381g1ValidationError"}}class Ee extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new we(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ee.prim]?t[Ee.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ee.prim}generateSchema(){return{__michelsonType:Ee.prim,schema:Ee.prim}}findAndReturnTokens(e,t){return Ee.prim===e&&t.push(this),t}}Ee.prim="bls12_381_g1";class Oe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="Bls12381g2ValidationError"}}class Ae extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Oe(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ae.prim]?t[Ae.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ae.prim}generateSchema(){return{__michelsonType:Ae.prim,schema:Ae.prim}}findAndReturnTokens(e,t){return Ae.prim===e&&t.push(this),t}}Ae.prim="bls12_381_g2";class Se extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChestValidationError"}}class Pe extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Se(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Pe.prim]?t[Pe.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Pe.prim}generateSchema(){return{__michelsonType:Pe.prim,schema:Pe.prim}}findAndReturnTokens(e,t){return Pe.prim===e&&t.push(this),t}}Pe.prim="chest";class Te extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="ChestKeyValidationError"}}class Ie extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}validate(e){if(!/^[0-9a-fA-F]*$/.test(e)||e.length%2!=0)throw new Te(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?Buffer.from(e).toString("hex"):e}Encode(e){let t=e.pop();return t=this.convertUint8ArrayToHexString(t),this.validate(t),{bytes:t}}EncodeObject(e,t){return e=this.convertUint8ArrayToHexString(e),this.validate(e),t&&t[Ie.prim]?t[Ie.prim](e):{bytes:e}}Execute(e){return e.bytes}ExtractSchema(){return Ie.prim}generateSchema(){return{__michelsonType:Ie.prim,schema:Ie.prim}}findAndReturnTokens(e,t){return Ie.prim===e&&t.push(this),t}}Ie.prim="chest_key";class Re extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="GlobalConstantEncodingError"}}class xe extends h{constructor(e,t,r){super(e,t,r),this.value=e,this.token=t,this.name="GlobalConstantDecodingError"}}class Me extends p{constructor(e,t,r){super(e,t,r),this.val=e,this.idx=t,this.fac=r}Execute(e,t){if(t&&t[Me.prim])return t[Me.prim](e,this.val);throw new xe(e,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(e){throw new Re(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(e,t){if(t&&t[Me.prim])return t[Me.prim](e);throw new Re(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}ExtractSchema(){return Me.prim}generateSchema(){return{__michelsonType:Me.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(e,t){return Me.prim===e&&t.push(this),t}}Me.prim="constant";const ke=[O,S,P,g,I,x,M,y,L,C,D,B,F,K,G,$,z,W,J,Y,X,ee,re,se,le,de,pe,me,ve,_e,Ee,Ae,Pe,Ie,Me];class Le extends s.TaquitoError{constructor(e,t){super(e),this.message=e,this.data=t,this.name="Invalid token error"}}function Ne(e,t){if(Array.isArray(e))return new O(e,t,Ne);const r=ke.find((t=>t.prim===e.prim));if(!r)throw new Le(`Malformed data: ${JSON.stringify(e)}. Expected a value with a valid prim property`,e);return new r(e,t,Ne)}class Ce extends s.InvalidViewParameterError{constructor(e,t,r,n){super(e,t,r,n),this.viewName=e,this.sigs=t,this.args=r,this.cause=n,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(r)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(t)}`}}class je extends s.TaquitoError{constructor(e,t){super(),this.script=e,this.reason=t,this.name="InvalidScriptError";let r="Invalid on-chain view found in the following script.";t&&(r+=` Reason: ${t}.`),r+=`Script: ${JSON.stringify(e)}`,this.message=r}}class De extends s.TaquitoError{constructor(e,t){super(),this.script=e,this.reason=t,this.name="InvalidRpcResponseError";let r="Invalid RPC response passed as argument(s).";t&&(r+=` Reason: ${t}.`),r+=` Received: ${JSON.stringify(e)}`,this.message=r}}class Ue extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="InvalidBigMapSchemaError"}}class Be extends s.TaquitoError{constructor(e,t){super(e),this.message=e,this.value=t,this.name="InvalidBigMapDiffError"}}class Fe extends s.TaquitoError{constructor(e,t,r,n){super(),this.details=t,this.schema=r,this.value=n,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${e}. Schema is: ${JSON.stringify(r)}. The ${e} is: ${JSON.stringify(n)}. Error details: ${t}`}}class Ke extends s.TaquitoError{constructor(e,t,r,n,i){super(),this.details=t,this.schema=r,this.value=n,this.semantics=i,this.name="StorageEncodingError",this.message=`Unable to encode ${e}. The schema is: ${JSON.stringify(r)}, the value is: ${JSON.stringify(n)}.${i?`And the semantic is: ${JSON.stringify(i)}`:""}. Error details: ${t}`}}class He extends s.TaquitoError{constructor(e){super(e),this.message=e,this.name="MissingArgumentError"}}var Ge;const $e=Symbol.for("taquito-schema-type-symbol");function Ve(e,t=O.prim){var r,n;if(Array.isArray(e))return Ve({prim:t,args:e},t);const i=e;return i.prim===t&&i.args&&i.args.length>2?Object.assign(Object.assign({},i),{args:[null===(r=i.args)||void 0===r?void 0:r[0],{prim:t,args:null===(n=i.args)||void 0===n?void 0:n.slice(1)}]}):i}function ze(e,t){if(void 0===e||void 0===t)return e===t;const r=Ve(e),n=Ve(t);return r.prim===n.prim&&(void 0===r.args&&void 0===n.args||void 0!==r.args&&void 0!==n.args&&r.args.length===n.args.length&&r.args.every(((e,t)=>{var r,i;return ze(e,null!==(i=null===(r=n.args)||void 0===r?void 0:r[t])&&void 0!==i?i:{})})))&&(void 0===r.annots&&void 0===n.annots||void 0!==r.annots&&void 0!==n.annots&&r.annots.length===n.annots.length&&r.annots.every(((e,t)=>{var r;return e===(null===(r=n.annots)||void 0===r?void 0:r[t])})))}class qe{static isSchema(e){return e&&!0===e[$e]}static fromRPCResponse(e){if(!e)throw new De(e,"the RPC response is empty");if(!e.script)throw new De(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new De(e,"The response.script.code should be an array");let t=e.script.code;for(;1===t.length&&Array.isArray(t[0]);)t=t[0];const r=t.find((e=>"prim"in e&&"storage"===e.prim));if(!r||!Array.isArray(r.args))throw new De(e,'The response.script.code has an element of type {prim: "storage"}, but its args is not an array');return new qe(r.args[0])}isExpressionExtended(e){return"prim"in e&&Array.isArray(e.args)}constructor(e){if(this.val=e,this[Ge]=!0,this.root=Ne(e,0),this.root instanceof g)this.bigMap=this.root;else if(this.isExpressionExtended(e)&&"pair"===e.prim){const t=e.args[0];this.isExpressionExtended(t)&&"big_map"===t.prim&&(this.bigMap=new g(t,0,Ne))}}removeTopLevelAnnotation(e){return(this.root instanceof O||this.root instanceof y)&&this.root.hasAnnotations()&&"object"==typeof e&&1===Object.keys(e).length?e[Object.keys(e)[0]]:e}Execute(e,t){const r=this.root.Execute(e,t);return this.removeTopLevelAnnotation(r)}Typecheck(e){this.root instanceof g&&Number.isInteger(Number(e))||this.root instanceof se&&e.ticketer&&e.value&&e.amount||this.root instanceof le&&e.ticketer&&e.value&&e.amount||this.root instanceof x&&this.root.ValueSchema instanceof g||this.root.EncodeObject(e)}ExecuteOnBigMapDiff(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");if(!Array.isArray(e))throw new Be(`Big map diff must be an array, got: ${JSON.stringify(e)}`,e);const r=e.map((({key:e,value:t})=>({args:[e,t]})));return this.bigMap.Execute(r,t)}ExecuteOnBigMapValue(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");return this.bigMap.ValueSchema.Execute(e,t)}EncodeBigMapKey(e){if(!this.bigMap)throw new Ue("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(e)}catch(t){throw new Fe("key",t,this.bigMap.KeySchema,e)}}Encode(e,t){try{return this.root.EncodeObject(e,t)}catch(r){if(r instanceof h)throw r;throw new Ke("storage object",r,this.root,e,t)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(e,t){if(!this.bigMap)throw new Ue("Big map schema is undefined");const r=e.reduce(((e,t)=>Object.assign(Object.assign({},e),this.ExecuteOnBigMapDiff(t.contents[0].metadata.operation_result.big_map_diff))),{});return Object.assign(Object.assign({},this.Execute(t)),{[this.bigMap.annot()]:r})}FindFirstInTopLevelPair(e,t){return this.findValue(this.root.val,e,t)}findValue(e,t,r){if(ze(r,e))return t;if(Array.isArray(e)||"pair"===e.prim){const n=Ve(e),i=Ve(t,"Pair");if(void 0===n.args||void 0===i.args)throw new He("Tokens have no arguments");if(n.args[0])return this.findValue(n.args[0],i.args[0],r)||this.findValue(n.args[1],i.args[1],r)}}findToken(e){return this.root.findAndReturnTokens(e,[])}}Ge=$e;class We{static fromRPCResponse(e){if(!e)throw new De(e,"the RPC response is empty");if(!e.script)throw new De(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new De(e,"The response.script.code should be an array");const t=e.script.code.find((e=>"prim"in e&&"parameter"===e.prim));if(!t)throw new De(e,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray(t.args))throw new De(e,'The response.script.code has an element of type {prim: "parameter"}, but its args is not an array');return new We(t.args[0])}get isMultipleEntryPoint(){return this.root instanceof y||this.root instanceof F&&this.root.subToken()instanceof y}get hasAnnotation(){return!this.isMultipleEntryPoint||"0"!==Object.keys(this.ExtractSchema())[0]}constructor(e){this.root=Ne(e,0)}Execute(e,t){return this.root.Execute(e,t)}Encode(...e){try{return this.root.Encode(e.reverse())}catch(t){if(t instanceof h)throw t;throw new Ce("Unable to encode parameter",this.root,e,t)}}EncodeObject(e,t){try{return this.root.EncodeObject(e,t)}catch(t){if(t instanceof h)throw t;throw new Ce("Unable to encode parameter object",this.root,e,t)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class Ze{static fromRPCResponse(e){const t=[],r=e&&e.script&&Array.isArray(e.script.code)&&e.script.code.filter((e=>"view"===e.prim));return r&&r.forEach((e=>{t.push(new Ze(e.args))})),t}constructor(e){if(!e)throw new je(e,"the args are not defined");if(4!==e.length)throw new je(e,"there should be exactly 4 arguments");if(!("string"in e[0])||!e[0].string)throw new je(e,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=e[0].string,this.viewArgsType=e[1],this.viewReturnType=e[2],this.instructions=e[3],this.rootArgsType=Ne(this.viewArgsType,0),this.rootReturnType=Ne(this.viewReturnType,0)}encodeViewArgs(e){try{return this.rootArgsType.EncodeObject(e)}catch(t){throw new Ce(this.viewName,void 0,e,t)}}decodeViewResult(e,t){return this.rootReturnType.Execute(e,t)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}class Je{constructor(e,t){this.tag=e,this.type=t}static fromMichelineValue(e){var t,r;return new Je(null===(t=e.annots)||void 0===t?void 0:t[0],null===(r=e.args)||void 0===r?void 0:r[0])}static fromRPCResponse(e){const t=[];return e.script.code.forEach((e=>{"prim"in e&&"code"===e.prim&&"args"in e&&e.args&&t.push(...Je.extractEventsRecursively(e.args))})),Je.removeDuplicates(t)}static removeDuplicates(e){const t=[];return e.forEach((e=>{-1===t.findIndex((t=>t.tag===e.tag&&ze(t.type,e.type)))&&t.push(e)})),t}static extractEventsRecursively(e){return Array.isArray(e)?e.flatMap((e=>Je.extractEventsRecursively(e))):"prim"in e?"EMIT"===e.prim?[Je.fromMichelineValue(e)]:"args"in e&&e.args?e.args.flatMap((e=>Je.extractEventsRecursively(e))):[]:[]}}const Ye={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"},Xe=Symbol(),Qe={}},6368:(e,t,r)=>{"use strict";r.r(t),r.d(t,{METADATA_BALANCE_UPDATES_CATEGORY:()=>b,OPERATION_METADATA:()=>p,OpKind:()=>O,PvmKind:()=>m,RpcClient:()=>S,RpcClientCache:()=>h,SmartRollupInputProofKind:()=>v,SmartRollupRefutationOptions:()=>g,SmartRollupRefuteGameEndedPlayerOutcomes:()=>w,SmartRollupRefuteGameEndedReason:()=>E,SmartRollupRefuteGameStatusOptions:()=>_,SmartRollupRefuteRevealProofKind:()=>y,VERSION:()=>A,castToBigNumber:()=>d,defaultChain:()=>u,defaultRPCOptions:()=>l});var n=r(5543),i=r(2558),o=r(4632),s=r(227);function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{const r=e[t];let o;if(void 0!==r){if(Array.isArray(r))return o=d(r),void(n[t]=o);o=new i.Z(r),n[t]=o}})),n}!function(e){e.GET_BAKING_RIGHTS="getBakingRights",e.GET_BALLOTS="getBallots",e.GET_BALLOT_LIST="getBallotList",e.GET_BIG_MAP_KEY="getBigMapKey",e.GET_BIG_MAP_EXPR="getBigMapExpr",e.GET_BLOCK_HASH="getBlockHash",e.GET_BLOCK="getBlock",e.GET_BLOCK_HEADER="getBlockHeader",e.GET_BLOCK_METADATA="getBlockMetadata",e.GET_BALANCE="getBalance",e.GET_CHAIN_ID="getChainId",e.GET_CONSTANTS="getConstants",e.GET_CONTRACT="getContract",e.GET_CURRENT_PERIOD="getCurrentPeriod",e.GET_CURRENT_PROPOSAL="getCurrentProposal",e.GET_CURRENT_QUORUM="getCurrentQuorum",e.GET_DELEGATE="getDelegate",e.GET_DELEGATES="getDelegates",e.GET_VOTING_INFO="getVotingInfo",e.GET_ATTESTATION_RIGHTS="getAttestationRights",e.GET_ENDORSING_RIGHTS="getEndorsingRights",e.GET_ENTRYPOINTS="getEntrypoints",e.GET_LIVE_BLOCKS="getLiveBlocks",e.GET_MANAGER_KEY="getManagerKey",e.GET_NORMALIZED_SCRIPT="getNormalizedScript",e.GET_PROPOSALS="getProposals",e.GET_PROTOCOLS="getProtocols",e.GET_SAPLING_DIFF_BY_CONTRACT="getSaplingDiffByContract",e.GET_SAPLING_DIFF_BY_ID="getSaplingDiffById",e.GET_SCRIPT="getScript",e.GET_STORAGE="getStorage",e.GET_SUCCESSOR_PERIOD="getSuccessorPeriod",e.GET_VOTES_LISTINGS="getVotesListings",e.PACK_DATA="packData",e.GET_STORAGE_USED_SPACE="getStorageUsedSpace",e.GET_STORAGE_PAID_SPACE="getStoragePaidSpace",e.GET_TICKET_BALANCE="getTicketBalance",e.GET_ALL_TICKET_BALANCES="getAllTicketBalances",e.GET_PENDING_OPERATIONS="getPendingOperations"}(f||(f={}));class h{constructor(e,t=1e3){this.rpcClient=e,this.ttl=t,this._cache={}}getAllCachedData(){return this._cache}deleteAllCachedData(){for(const e in this._cache)delete this._cache[e]}formatCacheKey(e,t,r,n){let i="";return r.forEach((e=>{i="object"==typeof e?i+JSON.stringify(e)+"/":i+e+"/"})),n?`${e}/${t}/${i}${JSON.stringify(n)}/`:`${e}/${t}/${i}`}has(e){return e in this._cache}get(e){return this._cache[e].response}put(e,t){const r=setTimeout((()=>this.remove(e)),this.ttl);Object.assign(this._cache,{[e]:{handle:r,response:t}})}remove(e){e in this._cache&&delete this._cache[e]}validateAddress(e){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t))}validateContract(e){const t=(0,o.validateContractAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,o.invalidDetail)(t))}getBlockHash({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_HASH,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockHash({block:e});return this.put(t,r),r}}))}getLiveBlocks({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_LIVE_BLOCKS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getLiveBlocks({block:e});return this.put(t,r),r}}))}getBalance(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALANCE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBalance(e,{block:t});return this.put(r,n),n}}))}getStorage(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorage(e,{block:t});return this.put(r,n),n}}))}getScript(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SCRIPT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getScript(e,{block:t});return this.put(r,n),n}}))}getNormalizedScript(e,t={unparsing_mode:"Readable"},{block:r}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_NORMALIZED_SCRIPT,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getNormalizedScript(e,t,{block:r});return this.put(n,i),i}}))}getContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CONTRACT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getContract(e,{block:t});return this.put(r,n),n}}))}getManagerKey(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_MANAGER_KEY,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getManagerKey(e,{block:t});return this.put(r,n),n}}))}getDelegate(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_DELEGATE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegate(e,{block:t});return this.put(r,n),n}}))}getBigMapKey(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BIG_MAP_KEY,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapKey(e,t,{block:r});return this.put(n,i),i}}))}getBigMapExpr(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BIG_MAP_EXPR,[r,e,t]);if(this.has(n))return this.get(n);{const i=this.rpcClient.getBigMapExpr(e,t,{block:r});return this.put(n,i),i}}))}getDelegates(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_DELEGATES,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getDelegates(e,{block:t});return this.put(r,n),n}}))}getVotingInfo(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_VOTING_INFO,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getVotingInfo(e,{block:t});return this.put(r,n),n}}))}getConstants({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CONSTANTS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getConstants({block:e});return this.put(t,r),r}}))}getBlock({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlock({block:e});return this.put(t,r),r}}))}getBlockHeader({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_HEADER,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockHeader({block:e});return this.put(t,r),r}}))}getBlockMetadata({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BLOCK_METADATA,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBlockMetadata({block:e});return this.put(t,r),r}}))}getBakingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BAKING_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getBakingRights(e,{block:t});return this.put(r,n),n}}))}getAttestationRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ATTESTATION_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getAttestationRights(e,{block:t});return this.put(r,n),n}}))}getEndorsingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ENDORSING_RIGHTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEndorsingRights(e,{block:t});return this.put(r,n),n}}))}getBallotList({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALLOT_LIST,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBallotList({block:e});return this.put(t,r),r}}))}getBallots({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_BALLOTS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getBallots({block:e});return this.put(t,r),r}}))}getCurrentProposal({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_PROPOSAL,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentProposal({block:e});return this.put(t,r),r}}))}getCurrentQuorum({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_QUORUM,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentQuorum({block:e});return this.put(t,r),r}}))}getVotesListings({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_VOTES_LISTINGS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getVotesListings({block:e});return this.put(t,r),r}}))}getProposals({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PROPOSALS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getProposals({block:e});return this.put(t,r),r}}))}forgeOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.forgeOperations(e,{block:t})}))}injectOperation(e){return c(this,void 0,void 0,(function*(){return this.rpcClient.injectOperation(e)}))}preapplyOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.preapplyOperations(e,{block:t})}))}getEntrypoints(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ENTRYPOINTS,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getEntrypoints(e,{block:t});return this.put(r,n),n}}))}runOperation(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.runOperation(e,{block:t})}))}simulateOperation(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.simulateOperation(e,{block:t})}))}runCode(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.rpcClient.runCode(e,{block:t})}))}runScriptView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.rpcClient.runScriptView(Object.assign({unparsing_mode:r},n),{block:i})}))}runView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.rpcClient.runView(Object.assign({unparsing_mode:r},n),{block:i})}))}getChainId(){return c(this,void 0,void 0,(function*(){const e=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CHAIN_ID,[]);if(this.has(e))return this.get(e);{const t=this.rpcClient.getChainId();return this.put(e,t),t}}))}packData(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.PACK_DATA,[t],e);if(this.has(r))return this.get(r);{const n=this.rpcClient.packData(e,{block:t});return this.put(r,n),n}}))}getRpcUrl(){return this.rpcClient.getRpcUrl()}getCurrentPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_CURRENT_PERIOD,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getCurrentPeriod({block:e});return this.put(t,r),r}}))}getSuccessorPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SUCCESSOR_PERIOD,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getSuccessorPeriod({block:e});return this.put(t,r),r}}))}getSaplingDiffById(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SAPLING_DIFF_BY_ID,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffById(e,{block:t});return this.put(r,n),n}}))}getSaplingDiffByContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_SAPLING_DIFF_BY_CONTRACT,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getSaplingDiffByContract(e,{block:t});return this.put(r,n),n}}))}getProtocols({block:e}=l){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PROTOCOLS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getProtocols({block:e});return this.put(t,r),r}}))}getStorageUsedSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE_USED_SPACE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStorageUsedSpace(e,{block:t});return this.put(r,n),n}}))}getStoragePaidSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_STORAGE_PAID_SPACE,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getStoragePaidSpace(e,{block:t});return this.put(r,n),n}}))}getTicketBalance(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){const n=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_TICKET_BALANCE,[r,e],t);if(this.has(n))return this.get(n);{const i=this.rpcClient.getTicketBalance(e,t,{block:r});return this.put(n,i),i}}))}getAllTicketBalances(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_ALL_TICKET_BALANCES,[t,e]);if(this.has(r))return this.get(r);{const n=this.rpcClient.getAllTicketBalances(e,{block:t});return this.put(r,n),n}}))}getPendingOperations(e={}){return c(this,void 0,void 0,(function*(){const t=this.formatCacheKey(this.rpcClient.getRpcUrl(),f.GET_PENDING_OPERATIONS,[e]);if(this.has(t))return this.get(t);{const r=this.rpcClient.getPendingOperations(e);return this.put(t,r),r}}))}}var p,b,m,g,v,y,_,w,E,O;!function(e){e.TOO_LARGE="too large"}(p||(p={})),function(e){e.BAKING_BONUSES="baking bonuses",e.BAKING_REWARDS="baking rewards",e.BLOCK_FEES="block fees",e.BONDS="bonds",e.BOOTSTRAP="bootstrap",e.BURNED="burned",e.COMMITMENT="commitment",e.DELEGATE_DENOMINATOR="delegate_denominator",e.DELEGATOR_NUMERATOR="delegator_numerator",e.DEPOSITS="deposits",e.ENDORSING_REWARDS="endorsing rewards",e.INVOICE="invoice",e.LOST_ENDORSING_REWARDS="lost endorsing rewards",e.MINTED="minted",e.NONCE_REVELATION_REWARDS="nonce revelation rewards",e.PUNISHMENTS="punishments",e.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",e.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",e.STORAGE_FEES="storage fees",e.SUBSIDY="subsidy",e.UNSTAKED_DEPOSITS="unstaked_deposits"}(b||(b={})),function(e){e.WASM2="wasm_2_0_0",e.ARITH="arith",e.RISCV="riscv"}(m||(m={})),function(e){e.START="start",e.MOVE="move"}(g||(g={})),function(e){e.INBOX_PROOF="inbox_proof",e.REVEAL_PROOF="reveal_proof",e.FIRST_INPUT="first_input"}(v||(v={})),function(e){e.RAW_DATA_PROOF="raw_data_proof",e.METADATA_PROOF="metadata_proof",e.DAL_PAGE_PROOF="dal_page_proof"}(y||(y={})),function(e){e.ONGOING="ongoing",e.ENDED="ended"}(_||(_={})),function(e){e.LOSER="loser",e.DRAW="draw"}(w||(w={})),function(e){e.CONFLICT_RESOLVED="conflict_resolved",e.TIMEOUT="timeout"}(E||(E={})),function(e){e.ORIGINATION="origination",e.DELEGATION="delegation",e.REVEAL="reveal",e.TRANSACTION="transaction",e.ACTIVATION="activate_account",e.ATTESTATION="attestation",e.ENDORSEMENT="endorsement",e.PREATTESTATION="preattestation",e.PREENDORSEMENT="preendorsement",e.SET_DEPOSITS_LIMIT="set_deposits_limit",e.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",e.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",e.ATTESTATION_WITH_SLOT="attestation_with_slot",e.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",e.SEED_NONCE_REVELATION="seed_nonce_revelation",e.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",e.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",e.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",e.PROPOSALS="proposals",e.BALLOT="ballot",e.FAILING_NOOP="failing_noop",e.REGISTER_GLOBAL_CONSTANT="register_global_constant",e.TRANSFER_TICKET="transfer_ticket",e.INCREASE_PAID_STORAGE="increase_paid_storage",e.UPDATE_CONSENSUS_KEY="update_consensus_key",e.DRAIN_DELEGATE="drain_delegate",e.VDF_REVELATION="vdf_revelation",e.EVENT="event",e.TICKET_UPDATES="ticket_updates",e.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",e.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",e.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",e.SMART_ROLLUP_PUBLISH="smart_rollup_publish",e.SMART_ROLLUP_CEMENT="smart_rollup_cement",e.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",e.SMART_ROLLUP_REFUTE="smart_rollup_refute",e.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout"}(O||(O={}));const A={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"};class S{constructor(e,t=u,r=new n.HttpBackend){this.url=e,this.chain=t,this.httpBackend=r}createURL(e){let t=this.url;for(;t.endsWith("/");)t=t.slice(0,-1);return`${t}${e}`}validateAddress(e){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t))}validateContract(e){const t=(0,o.validateContractAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,o.invalidDetail)(t))}getBlockHash({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/hash`),method:"GET"})}))}getLiveBlocks({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/live_blocks`),method:"GET"})}))}getBalance(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/balance`),method:"GET"});return new i.Z(r)}))}getStorage(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage`),method:"GET"})}))}getScript(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/script`),method:"GET"})}))}getNormalizedScript(e,t={unparsing_mode:"Readable"},{block:r}=l){return c(this,void 0,void 0,(function*(){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/script/normalized`),method:"POST"},t)}))}getContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}`),method:"GET"});return Object.assign(Object.assign({},r),{balance:new i.Z(r.balance)})}))}getManagerKey(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/manager_key`),method:"GET"})}))}getDelegate(e,{block:t}=l){return c(this,void 0,void 0,(function*(){let r;this.validateAddress(e);try{r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/delegate`),method:"GET"})}catch(e){if(!(e instanceof n.HttpResponseError&&e.status===n.STATUS_CODE.NOT_FOUND))throw e;r=null}return r}))}getBigMapKey(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/big_map_get`),method:"POST"},t)}))}getBigMapExpr(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/big_maps/${e}/${t}`),method:"GET"})}))}getDelegates(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateAddress(e);const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/delegates/${e}`),method:"GET"}),n=d(r,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance","voting_power","total_delegated_stake","staking_denominator"]);return Object.assign(Object.assign(Object.assign({},r),n),{frozen_balance_by_cycle:r.frozen_balance_by_cycle?r.frozen_balance_by_cycle.map((e=>{var{deposit:t,deposits:r,fees:n,rewards:i}=e,o=a(e,["deposit","deposits","fees","rewards"]);const s=d({deposit:t,deposits:r,fees:n,rewards:i},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},o),{deposit:s.deposit,deposits:s.deposits,fees:s.fees,rewards:s.rewards})})):void 0})}))}getVotingInfo(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.validateAddress(e),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/delegates/${e}/voting_info`),method:"GET"})}))}getConstants({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/constants`),method:"GET"}),r=d(t,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_endorsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round","tx_rollup_commitment_bond","vdf_difficulty","sc_rollup_stake_amount","minimal_stake"]);return Object.assign(Object.assign({},t),r)}))}getBlock({block:e,version:t}=l){return c(this,void 0,void 0,(function*(){const r={url:this.createURL(`/chains/${this.chain}/blocks/${e}`),method:"GET"};return void 0!==t&&(r.query={version:t}),yield this.httpBackend.createRequest(r)}))}getBlockHeader({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/header`),method:"GET"})}))}getBlockMetadata({block:e,version:t}=l){return c(this,void 0,void 0,(function*(){const r={url:this.createURL(`/chains/${this.chain}/blocks/${e}/metadata`),method:"GET"};return void 0!==t&&(r.query={version:t}),yield this.httpBackend.createRequest(r)}))}getBakingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/baking_rights`),method:"GET",query:e})}))}getAttestationRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/attestation_rights`),method:"GET",query:e})}))}getEndorsingRights(e={},{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/endorsing_rights`),method:"GET",query:e})}))}getBallotList({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballot_list`),method:"GET"})}))}getBallots({block:e}=l){return c(this,void 0,void 0,(function*(){return d(yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballots`),method:"GET"}),["yay","nay","pass"])}))}getCurrentProposal({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_proposal`),method:"GET"})}))}getCurrentQuorum({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_quorum`),method:"GET"})}))}getVotesListings({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/listings`),method:"GET"});return t.map((e=>(e.voting_power&&(e.voting_power=new i.Z(e.voting_power)),e))),t}))}getProposals({block:e}=l){return c(this,void 0,void 0,(function*(){const t=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/proposals`),method:"GET"});return t.map((e=>e[1]=new i.Z(e[1]))),t}))}forgeOperations(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/forge/operations`),method:"POST"},e)}))}injectOperation(e){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},e)}))}preapplyOperations(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/preapply/operations`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}getEntrypoints(e,{block:t}=l){return c(this,void 0,void 0,(function*(){this.validateContract(e);return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/entrypoints`),method:"GET"})}))}runOperation(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/run_operation`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}simulateOperation(e,{block:t,version:r}=l){return c(this,void 0,void 0,(function*(){const n={url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/simulate_operation`),method:"POST"};return void 0!==r&&(n.query={version:r}),yield this.httpBackend.createRequest(n,e)}))}runCode(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/run_code`),method:"POST"},e)}))}runScriptView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${i}/helpers/scripts/run_script_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}runView(e,t){var{unparsing_mode:r="Readable"}=e,n=a(e,["unparsing_mode"]),i=(void 0===t?l:t).block;return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${i}/helpers/scripts/run_view`),method:"POST"},Object.assign({unparsing_mode:r},n))}))}getChainId(){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})}))}packData(e,{block:t}=l){return c(this,void 0,void 0,(function*(){const r=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/helpers/scripts/pack_data`),method:"POST"},e),{gas:n}=r,o=a(r,["gas"]);let s=n;const c=new i.Z(n||"");return c.isNaN()||(s=c),Object.assign({gas:s},o)}))}getRpcUrl(){return this.url}getCurrentPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_period`),method:"GET"})}))}getSuccessorPeriod({block:e}=l){return c(this,void 0,void 0,(function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/successor_period`),method:"GET"})}))}getSaplingDiffById(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/sapling/${e}/get_diff`),method:"GET"})}))}getSaplingDiffByContract(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/single_sapling_get_diff`),method:"GET"})}))}getProtocols({block:e}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/protocols`),method:"GET"})}))}getStorageUsedSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage/used_space`),method:"GET"})}))}getStoragePaidSpace(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/storage/paid_space`),method:"GET"})}))}getTicketBalance(e,t,{block:r}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/ticket_balance`),method:"POST"},t)}))}getAllTicketBalances(e,{block:t}=l){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${t}/context/contracts/${e}/all_ticket_balances`),method:"GET"})}))}getPendingOperations(e={}){return c(this,void 0,void 0,(function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/pending_operations`),method:"GET",query:e})}))}}},4632:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DeprecationError:()=>f.DeprecationError,InvalidAddressError:()=>f.InvalidAddressError,InvalidBlockHashError:()=>f.InvalidBlockHashError,InvalidChainIdError:()=>f.InvalidChainIdError,InvalidContractAddressError:()=>f.InvalidContractAddressError,InvalidHexStringError:()=>f.InvalidHexStringError,InvalidKeyError:()=>f.InvalidKeyError,InvalidKeyHashError:()=>f.InvalidKeyHashError,InvalidMessageError:()=>f.InvalidMessageError,InvalidOperationHashError:()=>f.InvalidOperationHashError,InvalidOperationKindError:()=>f.InvalidOperationKindError,InvalidProtocolHashError:()=>E,InvalidPublicKeyError:()=>f.InvalidPublicKeyError,InvalidSignatureError:()=>f.InvalidSignatureError,Prefix:()=>n,ProhibitedActionError:()=>f.ProhibitedActionError,VERSION:()=>q,ValidationResult:()=>A,ValueConversionError:()=>O,b58cdecode:()=>te,b58cencode:()=>ee,b58decode:()=>re,b58decodeL2Address:()=>ne,buf2hex:()=>fe,bytes2Char:()=>pe,char2Bytes:()=>he,encodeExpr:()=>X,encodeKey:()=>se,encodeKeyHash:()=>ae,encodeL2Address:()=>oe,encodeOpHash:()=>Q,encodePubKey:()=>ie,format:()=>Y,getPkhfromPk:()=>de,hex2Bytes:()=>be,hex2buf:()=>ce,invalidDetail:()=>V,isValidPrefix:()=>S,mergebuf:()=>ue,mic2arr:()=>le,num2PaddedHex:()=>ge,prefix:()=>g,prefixLength:()=>v,stripHexPrefix:()=>ve,toHexBuf:()=>me,validateAddress:()=>C,validateBlock:()=>G,validateChain:()=>j,validateContractAddress:()=>D,validateKeyHash:()=>U,validateOperation:()=>K,validatePkAndExtractPrefix:()=>_,validateProtocol:()=>H,validatePublicKey:()=>F,validateSignature:()=>B,validateSmartRollupAddress:()=>z,validateSpendingKey:()=>$,verifySignature:()=>y});var n,i=r(8834),o=r(7728),s=r(6851),a=r(1395),c=r.n(a),u=r(4075),l=r.n(u),f=r(227),d=r(2558),h=r(7554),p=r.n(h),b=r(8743),m=r.n(b);!function(e){e.TZ1="tz1",e.TZ2="tz2",e.TZ3="tz3",e.TZ4="tz4",e.KT="KT",e.KT1="KT1",e.EDSK2="edsk2",e.SPSK="spsk",e.P2SK="p2sk",e.EDPK="edpk",e.SPPK="sppk",e.P2PK="p2pk",e.BLPK="BLpk",e.EDESK="edesk",e.SPESK="spesk",e.P2ESK="p2esk",e.EDSK="edsk",e.EDSIG="edsig",e.SPSIG="spsig",e.P2SIG="p2sig",e.SIG="sig",e.NET="Net",e.NCE="nce",e.B="B",e.O="o",e.LO="Lo",e.LLO="LLo",e.P="P",e.CO="Co",e.ID="id",e.EXPR="expr",e.TZ="TZ",e.VH="vh",e.SASK="sask",e.ZET1="zet1",e.SR1="sr1",e.SRC1="src1"}(n||(n={}));const g={[n.TZ1]:new Uint8Array([6,161,159]),[n.TZ2]:new Uint8Array([6,161,161]),[n.TZ3]:new Uint8Array([6,161,164]),[n.TZ4]:new Uint8Array([6,161,166]),[n.KT]:new Uint8Array([2,90,121]),[n.KT1]:new Uint8Array([2,90,121]),[n.EDSK]:new Uint8Array([43,246,78,7]),[n.EDSK2]:new Uint8Array([13,15,58,7]),[n.SPSK]:new Uint8Array([17,162,224,201]),[n.P2SK]:new Uint8Array([16,81,238,189]),[n.EDPK]:new Uint8Array([13,15,37,217]),[n.SPPK]:new Uint8Array([3,254,226,86]),[n.P2PK]:new Uint8Array([3,178,139,127]),[n.BLPK]:new Uint8Array([6,149,135,204]),[n.EDESK]:new Uint8Array([7,90,60,179,41]),[n.SPESK]:new Uint8Array([9,237,241,174,150]),[n.P2ESK]:new Uint8Array([9,48,57,115,171]),[n.EDSIG]:new Uint8Array([9,245,205,134,18]),[n.SPSIG]:new Uint8Array([13,115,101,19,63]),[n.P2SIG]:new Uint8Array([54,240,44,52]),[n.SIG]:new Uint8Array([4,130,43]),[n.NET]:new Uint8Array([87,82,0]),[n.NCE]:new Uint8Array([69,220,169]),[n.B]:new Uint8Array([1,52]),[n.O]:new Uint8Array([5,116]),[n.LO]:new Uint8Array([133,233]),[n.LLO]:new Uint8Array([29,159,109]),[n.P]:new Uint8Array([2,170]),[n.CO]:new Uint8Array([79,179]),[n.ID]:new Uint8Array([153,103]),[n.EXPR]:new Uint8Array([13,44,64,27]),[n.TZ]:new Uint8Array([2,90,121]),[n.VH]:new Uint8Array([1,106,242]),[n.SASK]:new Uint8Array([11,237,20,92]),[n.ZET1]:new Uint8Array([18,71,40,223]),[n.SR1]:new Uint8Array([6,124,117]),[n.SRC1]:new Uint8Array([17,165,134,138])},v={[n.TZ1]:20,[n.TZ2]:20,[n.TZ3]:20,[n.TZ4]:20,[n.KT]:20,[n.KT1]:20,[n.EDPK]:32,[n.SPPK]:33,[n.P2PK]:33,[n.BLPK]:48,[n.EDSIG]:64,[n.SPSIG]:64,[n.P2SIG]:64,[n.SIG]:64,[n.NET]:4,[n.B]:32,[n.P]:32,[n.O]:32,[n.VH]:32,[n.SASK]:169,[n.ZET1]:43,[n.SR1]:20,[n.SRC1]:32};function y(e,t,r,i){const a=_(t),c=function(e){const t=e.startsWith("sig")?e.substring(0,3):e.substring(0,5),r=B(e);if(r!==A.VALID)throw new f.InvalidSignatureError(e,V(r));return t}(r),u=te(t,g[a]),l=te(r,g[c]);let d=ce(function(e){if(""===e)throw new f.InvalidMessageError(e,"can't be empty");return e}(e));void 0!==i&&(d=ue(i,d));const h=(0,s.vp)(d,32);return a===n.EDPK?function(e,t,r){try{return(0,o.T)(r,t,e)}catch(e){return!1}}(l,h,u):a===n.SPPK?function(e,t,r){const n=new(p().ec)("secp256k1").keyFromPublic(r);return w(e,t,n)}(l,h,u):a===n.P2PK&&function(e,t,r){const n=new(p().ec)("p256").keyFromPublic(r);return w(e,t,n)}(l,h,u)}function _(e){if(""===e)throw new f.InvalidPublicKeyError(e,"can't be empty");const t=e.substring(0,4),r=F(e);if(r!==A.VALID)throw new f.InvalidPublicKeyError(e,V(r));return t}function w(e,t,r){const n=fe(m()(e)).match(/([a-f\d]{64})/gi);if(n)try{const[e,i]=n;return r.verify(t,{r:e,s:i})}catch(e){return!1}return!1}class E extends f.ParameterValidationError{constructor(e,t){super(),this.protocolHash=e,this.errorDetails=t,this.name="InvalidProtocolHashError",this.name="InvalidProtocolHashError",this.message=`The protocol hash '${e}' is invalid`,t&&(this.message+=`: ${t}`)}}class O extends f.UnsupportedActionError{constructor(e,t){super(),this.value=e,this.desiredType=t,this.name="ValueConversionError",this.message=`Unable to convert ${e} to a ${t}`}}var A;function S(e){return"string"==typeof e&&e in g}function P(e,t){const r=new RegExp(`^(${t.join("|")})`).exec(e);if(!r||0===r.length)return A.NO_PREFIX_MATCHED;const n=r[0];if(!S(n))return A.NO_PREFIX_MATCHED;e.includes("%")&&(e=e.split("%")[0]);if(!/^(KT1\w{33})$/.test(e)&&"KT1"===n)return A.INVALID_CHECKSUM;let i=l().decodeUnsafe(e);return i?(i=i.slice(g[n].length),i.length!==v[n]?A.INVALID_LENGTH:A.VALID):A.INVALID_CHECKSUM}!function(e){e[e.NO_PREFIX_MATCHED=0]="NO_PREFIX_MATCHED",e[e.INVALID_CHECKSUM=1]="INVALID_CHECKSUM",e[e.INVALID_LENGTH=2]="INVALID_LENGTH",e[e.VALID=3]="VALID"}(A||(A={}));const T=[n.TZ1,n.TZ2,n.TZ3,n.TZ4],I=[n.KT1],R=[n.EDSIG,n.P2SIG,n.SPSIG,n.SIG],x=[n.EDPK,n.SPPK,n.P2PK,n.BLPK],M=[n.O],k=[n.P],L=[n.B],N=[n.SR1];function C(e){return P(e,[...T,...I,...N])}function j(e){return P(e,[n.NET])}function D(e){return P(e,I)}function U(e){return P(e,T)}function B(e){return P(e,R)}function F(e){return P(e,x)}function K(e){return P(e,M)}function H(e){return P(e,k)}function G(e){return P(e,L)}function $(e){return P(e,[n.SASK])}function V(e){switch(e){case A.NO_PREFIX_MATCHED:return"with unsupported prefix";case A.INVALID_CHECKSUM:return"failed checksum";case A.INVALID_LENGTH:return"with incorrect length";default:return""}}function z(e){return P(e,[...N])}const q={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"},W=6,Z=3;function J(e){switch(e){case"tz":return W;case"mtz":return Z;default:return 0}}function Y(e="mutez",t="mutez",r){const n=new d.Z(r);return n.isNaN()?r:n.multipliedBy(Math.pow(10,J(e))).dividedBy(Math.pow(10,J(t)))}function X(e){return ee(c().blake2b(ce(e),void 0,32),g.expr)}function Q(e){return ee(c().blake2b(ce(e),void 0,32),g.o)}function ee(e,t){const r="string"==typeof e?Uint8Array.from(i.lW.from(e,"hex")):e,n=new Uint8Array(t.length+r.length);return n.set(t),n.set(r,t.length),l().encode(i.lW.from(n.buffer))}const te=(e,t)=>l().decode(e).slice(t.length);function re(e){const t=l().decode(e),r={[g.tz1.toString()]:"0000",[g.tz2.toString()]:"0001",[g.tz3.toString()]:"0002"}[new Uint8Array(t.slice(0,3)).toString()];if(r){return r+fe(t.slice(3))}return"01"+fe(t.slice(3,42))+"00"}function ne(e){const t=l().decode(e);return fe(t.slice(3,42))}function ie(e){if("00"===e.substring(0,2)){const t={"0000":g.tz1,"0001":g.tz2,"0002":g.tz3};return ee(e.substring(4),t[e.substring(0,4)])}return ee(e.substring(2,42),g.KT)}function oe(e){return ee(e,g.tz4)}function se(e){if("0"===e[0]){const t={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return ee(e.substring(2),t[e.substring(0,2)])}}function ae(e){if("0"===e[0]){const t={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return ee(e.substring(2),t[e.substring(0,2)])}}const ce=e=>{if(e.length%2!=0)throw new f.InvalidHexStringError(e,": Expecting even number of characters");const t=ve(e);if(!t.match(/^([\da-f]{2})*$/gi))throw new f.InvalidHexStringError(e,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const r=new Uint8Array(t.length/2);let n=0;for(let i=0;i{const r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r},le=function e(t){let r=[];if(Object.prototype.hasOwnProperty.call(t,"prim"))"Pair"===t.prim?(r.push(e(t.args[0])),r=r.concat(e(t.args[1]))):"Elt"===t.prim?r={key:e(t.args[0]),val:e(t.args[1])}:"True"===t.prim?r=!0:"False"===t.prim&&(r=!1);else if(Array.isArray(t)){const n=t.length;for(let i=0;i{const t=[];return e.forEach((e=>{const r=`00${e.toString(16)}`.slice(-2);t.push(r)})),t.join("")},de=e=>{let t,r;const i=_(e),o=te(e,g[i]);switch(i){case n.EDPK:t=g[n.TZ1],r=v[n.TZ1];break;case n.SPPK:t=g[n.TZ2],r=v[n.TZ2];break;case n.P2PK:t=g[n.TZ3],r=v[n.TZ3];break;case n.BLPK:t=g[n.TZ4],r=v[n.TZ4]}return ee((0,s.vp)(o,r),t)};function he(e){return i.lW.from(e,"utf8").toString("hex")}function pe(e){return i.lW.from(ce(e)).toString("utf8")}function be(e){const t=ve(e);if(!t.match(/^(0x)?([\da-f]{2})*$/gi))throw new f.InvalidHexStringError(e,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return i.lW.from(t,"hex")}function me(e,t=8){return i.lW.from(ge(e,t),"hex")}function ge(e,t=8){if(new d.Z(e).isPositive()){const r=Math.ceil(t/4),n=e.toString(16);let i=n.length>=r?n.length:r;return i=i%2==0?i:i+1,function(e,t){const r="0";if(e.length>=t)return e;{const n=t-e.length;return r.repeat(n)+e}}(n,i)}return new d.Z(2).pow(t).minus(new d.Z(e).abs()).toString(16)}function ve(e){return e.startsWith("0x")?e.slice(2):e}},150:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RPCBatchProvider=t.OperationBatch=t.BATCH_KINDS=void 0;const i=r(9480),o=r(3650),s=r(6368),a=r(4632),c=r(227),u=r(6003),l=r(3793);t.BATCH_KINDS=[s.OpKind.ACTIVATION,s.OpKind.ORIGINATION,s.OpKind.TRANSACTION,s.OpKind.DELEGATION];class f extends u.Provider{constructor(e,t){super(e),this.estimator=t,this.operations=[],this.prepare=new l.PrepareProvider(this.context)}withTransfer(e){const t=(0,a.validateAddress)(e.to);if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());if(t!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:s.OpKind.TRANSACTION},e)),this}withTransferTicket(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:s.OpKind.TRANSFER_TICKET},e)),this}withContractCall(e,t={}){return this.withTransfer(e.toTransferParams(t))}withDelegation(e){var t;const r=(0,a.validateAddress)(e.source);if(e.source&&r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.delegate,(0,a.invalidDetail)(n));return this.operations.push(Object.assign({kind:s.OpKind.DELEGATION},e)),this}withActivation({pkh:e,secret:t}){const r=(0,a.validateKeyHash)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidKeyHashError(e,(0,a.invalidDetail)(r));return this.operations.push({kind:s.OpKind.ACTIVATION,pkh:e,secret:t}),this}withOrigination(e){return this.operations.push(Object.assign({kind:s.OpKind.ORIGINATION},e)),this}withRegisterGlobalConstant(e){return this.operations.push(Object.assign({kind:s.OpKind.REGISTER_GLOBAL_CONSTANT},e)),this}withIncreasePaidStorage(e){return this.operations.push(Object.assign({kind:s.OpKind.INCREASE_PAID_STORAGE},e)),this}withSmartRollupAddMessages(e){return this.operations.push(Object.assign({kind:s.OpKind.SMART_ROLLUP_ADD_MESSAGES},e)),this}withSmartRollupOriginate(e){return this.operations.push(Object.assign({kind:s.OpKind.SMART_ROLLUP_ORIGINATE},e)),this}getRPCOp(e){return n(this,void 0,void 0,(function*(){switch(e.kind){case s.OpKind.TRANSACTION:return(0,i.createTransferOperation)(Object.assign({},e));case s.OpKind.ORIGINATION:return(0,i.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign({},e)));case s.OpKind.DELEGATION:return(0,i.createSetDelegateOperation)(Object.assign({},e));case s.OpKind.REGISTER_GLOBAL_CONSTANT:return(0,i.createRegisterGlobalConstantOperation)(Object.assign({},e));case s.OpKind.INCREASE_PAID_STORAGE:return(0,i.createIncreasePaidStorageOperation)(Object.assign({},e));case s.OpKind.TRANSFER_TICKET:return(0,i.createTransferTicketOperation)(Object.assign({},e));case s.OpKind.SMART_ROLLUP_ADD_MESSAGES:return(0,i.createSmartRollupAddMessagesOperation)(Object.assign({},e));case s.OpKind.SMART_ROLLUP_ORIGINATE:return(0,i.createSmartRollupOriginateOperation)(Object.assign({},e));default:throw new c.InvalidOperationKindError(JSON.stringify(e.kind))}}))}with(e){for(const t of e)switch(t.kind){case s.OpKind.TRANSACTION:this.withTransfer(t);break;case s.OpKind.ORIGINATION:this.withOrigination(t);break;case s.OpKind.DELEGATION:this.withDelegation(t);break;case s.OpKind.ACTIVATION:this.withActivation(t);break;case s.OpKind.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant(t);break;case s.OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(t);break;case s.OpKind.TRANSFER_TICKET:this.withTransferTicket(t);break;case s.OpKind.SMART_ROLLUP_ADD_MESSAGES:this.withSmartRollupAddMessages(t);break;case s.OpKind.SMART_ROLLUP_ORIGINATE:this.withSmartRollupOriginate(t);break;default:throw new c.InvalidOperationKindError(JSON.stringify(t.kind))}return this}send(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=e&&e.source||t,n=yield this.estimator.batch(this.operations);n.length!==this.operations.length&&n.shift();const i=yield this.prepare.batch(this.operations,n),s=yield this.forge(i),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(s);return new o.BatchOperation(a,i.opOb.contents,r,u,l,c)}))}}t.OperationBatch=f;t.RPCBatchProvider=class{constructor(e,t){this.context=e,this.estimator=t}batch(e){const t=new f(this.context,this.estimator);return Array.isArray(e)&&t.with(e),t}}},4593:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.getRevealGasLimit=t.ChainIds=t.protocols=t.Protocols=t.COST_PER_BYTE=t.DEFAULT_STORAGE_LIMIT=t.DEFAULT_FEE=t.DEFAULT_GAS_LIMIT=void 0,t.DEFAULT_GAS_LIMIT={DELEGATION:10600,ORIGINATION:10600,TRANSFER:10600,REVEAL_TZ1:1e3,REVEAL_TZ2:1e3,REVEAL_TZ3:2e3,REVEAL_TZ4:2e3},t.DEFAULT_FEE={DELEGATION:1257,ORIGINATION:1e4,TRANSFER:1e4,REVEAL:374},t.DEFAULT_STORAGE_LIMIT={DELEGATION:0,ORIGINATION:257,TRANSFER:257,REVEAL:0},t.COST_PER_BYTE=250,function(e){e.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",e.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",e.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",e.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",e.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",e.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",e.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",e.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",e.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",e.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",e.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",e.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",e.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",e.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",e.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",e.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",e.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",e.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",e.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"}(r||(t.Protocols=r={})),t.protocols={"004":[r.Pt24m4xi],"005":[r.PsBABY5H,r.PsBabyM1],"006":[r.PsCARTHA],"007":[r.PsDELPH1],"008":[r.PtEdo2Zk],"009":[r.PsFLorena],"010":[r.PtGRANADs],"011":[r.PtHangz2],"012":[r.PsiThaCa,r.Psithaca2],"013":[r.PtJakart2],"014":[r.PtKathman],"015":[r.PtLimaPtL],"016":[r.PtMumbai2],"017":[r.PtNairobi],"019":[r.ProxfordY],"020":[r.ProtoALpha]},function(e){e.MAINNET="NetXdQprcVkpaWU",e.CARTHAGENET="NetXjD3HPJJjmcd",e.DELPHINET="NetXm8tYqnMWky1",e.EDONET="NetXSgo1ZT2DRUG",e.FLORENCENET="NetXxkAx4woPLyu",e.GRANADANET="NetXz969SFaFn8k",e.HANGZHOUNET="NetXZSsxBpMQeAT",e.ITHACANET="NetXbhmtAbMukLc",e.ITHACANET2="NetXnHfVqm9iesp",e.JAKARTANET2="NetXLH1uAxK7CCh",e.KATHMANDUNET="NetXazhm4yetmff",e.LIMANET="NetXizpkH94bocH",e.MUMBAINET="NetXQw6nWSnrJ5t",e.MUMBAINET2="NetXgbcrNtXD2yA",e.NAIROBINET="NetXyuzvDo2Ugzb",e.OXFORDNET2="NetXxWsskGahzQB"}(n||(t.ChainIds=n={}));t.getRevealGasLimit=e=>Math.round(11*i(e)/10);const i=e=>{switch(e.substring(0,3)){case"tz1":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ1;case"tz2":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ2;case"tz3":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ3;case"tz4":return t.DEFAULT_GAS_LIMIT.REVEAL_TZ4;default:throw new Error(`Cannot estimate reveal gas limit for ${e}`)}}},4984:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Context=t.defaultConfigConfirmation=void 0;const i=r(6368),o=r(5744),s=r(1067),a=r(8286),c=r(992),u=r(4782),l=r(1151),f=r(150),d=r(635),h=r(5286),p=r(6395),b=r(977),m=r(9494),g=r(259),v=r(5032),y=r(6713),_=r(2021);t.defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class w{constructor(e,r=new s.NoopSigner,n,w=new b.BehaviorSubject(Object.assign({},t.defaultConfigConfirmation)),E,O,A,S,P,T,I,R){this._rpc=e,this._signer=r,this._proto=n,this._config=w,this.providerDecorator=[],this.tz=new c.RpcTzProvider(this),this.estimate=new u.RPCEstimateProvider(this),this.contract=new l.RpcContractProvider(this,this.estimate),this.prepare=new _.PrepareProvider(this),this.batch=new f.RPCBatchProvider(this,this.estimate),this.wallet=new d.Wallet(this),this.withExtensions=()=>{let e=this.clone();return this.providerDecorator.forEach((t=>{e=t(e)})),e},"string"==typeof this._rpc?this._rpcClient=new i.RpcClient(this._rpc):this._rpcClient=this._rpc,this._forger=E||new y.TaquitoLocalForger(this),this._injector=O||new o.RpcInjector(this),this.operationFactory=new a.OperationFactory(this),this._walletProvider=S||new d.LegacyWalletProvider(this),this._parser=P||new h.MichelCodecParser(this),this._packer=A||new p.RpcPacker(this),this._globalConstantsProvider=T||new m.NoopGlobalConstantsProvider,this._readProvider=I||new g.RpcReadAdapter(this._rpcClient),this._stream=R||new v.PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(e){this._config.next(Object.assign({},e))}setPartialConfig(e){this._config.next(Object.assign(Object.assign({},this._config.getValue()),e))}get rpc(){return this._rpcClient}set rpc(e){this._rpcClient=e}get injector(){return this._injector}set injector(e){this._injector=e}get forger(){return this._forger}set forger(e){this._forger=e}get signer(){return this._signer}set signer(e){this._signer=e}get walletProvider(){return this._walletProvider}set walletProvider(e){this._walletProvider=e}set proto(e){this._proto=e}get proto(){return this._proto}get parser(){return this._parser}set parser(e){this._parser=e}get packer(){return this._packer}set packer(e){this._packer=e}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(e){this._globalConstantsProvider=e}get readProvider(){return this._readProvider}set readProvider(e){this._readProvider=e}get stream(){return this._stream}set stream(e){this._stream=e}isAnyProtocolActive(e=[]){return n(this,void 0,void 0,(function*(){if(this._proto)return e.includes(this._proto);{const t=yield this.readProvider.getNextProtocol("head");return e.includes(t)}}))}isAnySignerConfigured(){return!(this.signer instanceof s.NoopSigner)}clone(){return new w(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(e){this.providerDecorator.push(e)}}t.Context=w},5225:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BigMapAbstraction=void 0;const i=r(5543);t.BigMapAbstraction=class{constructor(e,t,r){this.id=e,this.schema=t,this.provider=r}get(e,t){return n(this,void 0,void 0,(function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),e,this.schema,t)}catch(e){if(e instanceof i.HttpResponseError&&e.status===i.STATUS_CODE.NOT_FOUND)return;throw e}}))}getMultipleValues(e,t,r=5){return n(this,void 0,void 0,(function*(){return this.provider.getBigMapKeysByID(this.id.toString(),e,this.schema,t,r)}))}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}},191:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compose=void 0,t.compose=function(e,t){return(r,n)=>t(e(r,n),n)}},2298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethodFactory=void 0;const n=r(3687),i=r(4397),o=r(3849);t.ContractMethodFactory=class{constructor(e,t){this.provider=e,this.contractAddress=t}createContractMethodFlatParams(e,t,r,n=!0,o=!1){return new i.ContractMethod(this.provider,this.contractAddress,e,t,r,n,o)}createContractMethodObjectParam(e,t,r,i=!0,o=!1){return new n.ContractMethodObject(this.provider,this.contractAddress,e,t,r,i,o)}createContractViewObjectParam(e,t,r,n,i){return new o.OnChainView(e,t,this.contractAddress,r,n,i)}}},4397:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethod=void 0;const n=r(635),i=r(1863),o=r(6700);t.ContractMethod=class{constructor(e,t,r,n,i,o=!0,s=!1){this.provider=e,this.address=t,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}validateArgs(e,t,r){const n=t.ExtractSignatures();if(!n.find((t=>t.length===e.length)))throw new o.InvalidParameterError(r,n,e)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(!this.isAnonymous){const e=this.parameterSchema.ExtractSignatures();return 1==e.length?e[0]:e}{const e=this.parameterSchema.ExtractSignatures().find((e=>e[0]===this.name));if(e)return e.shift(),e}}send(e={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}toTransferParams({fee:e,gasLimit:t,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:e,mutez:s,source:n,gasLimit:t,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.Encode(this.name,...this.args):this.parameterSchema.Encode(...this.args)}}}}},4662:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3687:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContractMethodObject=void 0;const n=r(635),i=r(1863);t.ContractMethodObject=class{constructor(e,t,r,n,i="unit",o=!0,s=!1){this.provider=e,this.address=t,this.parameterSchema=r,this.name=n,this.args=i,this.isMultipleEntrypoint=o,this.isAnonymous=s}getSignature(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}send(e={}){return this.provider instanceof n.Wallet?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}toTransferParams({fee:e,gasLimit:t,storageLimit:r,source:n,amount:o=0,mutez:s=!1}={}){return{to:this.address,amount:o,fee:e,mutez:s,source:n,gasLimit:t,storageLimit:r,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:i.DEFAULT_SMART_CONTRACT_METHOD_NAME,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}},3849:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OnChainView=void 0;const i=r(4632),o=r(6700),s=r(227);t.OnChainView=class{constructor(e,t,r,n,i,o="Unit"){this._rpc=e,this._readProvider=t,this._contractAddress=r,this._smartContractViewSchema=n,this._contractStorageType=i,this._args=o}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}executeView(e){return n(this,void 0,void 0,(function*(){this.verifyContextExecution(e);const t=yield this._readProvider.getChainId(),r=this.transformArgsToMichelson(),n={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:r,chain_id:t,source:e.viewCaller};return e.source&&(n.payer=e.source),this.executeViewAndDecodeResult(n)}))}verifyContextExecution(e){if(e.source&&(0,i.validateAddress)(e.source)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${e.source}.`);if(!e.viewCaller||(0,i.validateAddress)(e.viewCaller)!==i.ValidationResult.VALID)throw new o.InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${e.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(e){throw new s.InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,e)}}adaptViewCodeToContext(e,t,r){const n={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:r}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:t}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return e.forEach(((i,o)=>{i.prim in n&&(e[o]=Object(n)[i.prim]),i.args&&0!==i.args.length?this.adaptViewCodeToContext(i.args,t,r):Array.isArray(i)&&this.adaptViewCodeToContext(i,t,r)})),e}executeViewAndDecodeResult(e){return n(this,void 0,void 0,(function*(){let t;try{t=(yield this._rpc.runScriptView(e)).data}catch(e){const t=(0,o.validateAndExtractFailwith)(e);throw t?new o.ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(t)}`,this._smartContractViewSchema.viewName,t,e):e}return this._smartContractViewSchema.decodeViewResult(t)}))}}},1863:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ContractAbstraction=t.ContractView=t.DEFAULT_SMART_CONTRACT_METHOD_NAME=void 0;const i=r(8899),o=r(4632),s=r(2298),a=r(6700),c=r(227);t.DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class u{constructor(e,t,r,n,i,o,s){this.currentContract=e,this.name=t,this.callbackParametersSchema=r,this.parameterSchema=n,this.args=i,this.rpc=o,this.readProvider=s}read(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateChain)(null!=e?e:"");if((0,o.validateContractAddress)(null!=e?e:"")==o.ValidationResult.VALID)throw new c.DeprecationError("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(e&&t!==o.ValidationResult.VALID)throw new c.InvalidChainIdError(e,(0,o.invalidDetail)(t));const r=this.parameterSchema.Encode(...this.args),n=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:r,chain_id:e||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(n.data)}))}}t.ContractView=u;t.ContractAbstraction=class{constructor(e,t,r,n,o,a,c){this.address=e,this.script=t,this.storageProvider=n,this.entrypoints=o,this.rpc=a,this.readProvider=c,this.methods={},this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new s.ContractMethodFactory(r,e),this.schema=i.Schema.fromRPCResponse({script:this.script}),this.parameterSchema=i.ParameterSchema.fromRPCResponse({script:this.script}),this.viewSchema=i.ViewSchema.fromRPCResponse({script:this.script}),0!==this.viewSchema.length&&this._initializeOnChainViews(this,a,this.readProvider,this.viewSchema),this.eventSchema=i.EventSchema.fromRPCResponse({script:this.script}),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(e,r,n,o){const s=this.parameterSchema,c=Object.keys(r);if(s.isMultipleEntryPoint){c.forEach((t=>{const s=new i.ParameterSchema(r[t]);if(this.methods[t]=function(...r){return e.contractMethodFactory.createContractMethodFlatParams(s,t,r)},this.methodsObject[t]=function(r){return e.contractMethodFactory.createContractMethodObjectParam(s,t,r)},(e=>{let t=!1;if("prim"in e&&"pair"===e.prim&&e.args){const r=e.args[e.args.length-1];"prim"in r&&"contract"===r.prim&&(t=!0)}return t})(r[t])){const s=function(...s){const c=r[t].args[0],l=new i.ParameterSchema(c),f=r[t].args[1].args[0],d=new i.ParameterSchema(f);return((e,t,r)=>{const n=t.ExtractSignatures();if(!n.find((t=>t.length===e.length)))throw new a.InvalidParameterError(r,n,e)})(s,l,t),new u(e,t,d,l,s,n,o)};this.views[t]=s}}));Object.keys(s.ExtractSchema()).filter((e=>-1===Object.keys(r).indexOf(e))).forEach((t=>{this.methods[t]=function(...r){return e.contractMethodFactory.createContractMethodFlatParams(s,t,r,!1,!0)},this.methodsObject[t]=function(r){return e.contractMethodFactory.createContractMethodObjectParam(s,t,r,!1,!0)}}))}else{const r=this.parameterSchema;this.methods[t.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...n){return e.contractMethodFactory.createContractMethodFlatParams(r,t.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)},this.methodsObject[t.DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(n){return e.contractMethodFactory.createContractMethodObjectParam(r,t.DEFAULT_SMART_CONTRACT_METHOD_NAME,n,!1)}}}_initializeOnChainViews(e,t,r,n){const i=this.schema.val;n.forEach((n=>{this.contractViews[n.viewName]=function(o){return e.contractMethodFactory.createContractViewObjectParam(t,r,n,i,o)}}))}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(e){return this.storageProvider.getBigMapKey(this.address,e,this.schema)}}},6700:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidBalanceError=t.OriginationParameterError=t.RevealOperationError=t.InvalidViewSimulationContext=t.validateAndExtractFailwith=t.ViewSimulationError=t.InvalidInitParameter=t.InvalidCodeParameter=t.InvalidDelegationSource=t.InvalidParameterError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e,t,r){super(),this.smartContractMethodName=e,this.sigs=t,this.invalidParams=r,this.name="InvalidParameterError",this.message=`${e} Received ${r.length} arguments while expecting one of the following signatures (${JSON.stringify(t)})`}}t.InvalidParameterError=i;class o extends n.ParameterValidationError{constructor(e){super(),this.source=e,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${e}. Please use the smart contract abstraction to set your delegate.`}}t.InvalidDelegationSource=o;class s extends n.ParameterValidationError{constructor(e,t){super(),this.message=e,this.data=t,this.name="InvalidCodeParameter"}}t.InvalidCodeParameter=s;class a extends n.ParameterValidationError{constructor(e,t){super(),this.message=e,this.data=t,this.name="InvalidInitParameter"}}t.InvalidInitParameter=a;class c extends n.RpcError{constructor(e,t,r,n){super(),this.message=e,this.viewName=t,this.failWith=r,this.cause=n,this.name="ViewSimulationError"}}t.ViewSimulationError=c;t.validateAndExtractFailwith=e=>{if(u(e.body)){const t=JSON.parse(e.body);if(Array.isArray(t)&&"with"in t[t.length-1])return t[t.length-1].with}};const u=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};class l extends n.ParameterValidationError{constructor(e){super(),this.info=e,this.name="InvalidViewSimulationContext",this.message=`${e} Please configure the context of the view execution in the executeView method.`}}t.InvalidViewSimulationContext=l;class f extends n.RpcError{constructor(e){super(),this.message=e,this.name="RevealOperationError"}}t.RevealOperationError=f;class d extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name}}t.OriginationParameterError=d;class h extends n.ParameterValidationError{constructor(e){super(),this.message=e,this.name="InvalidBalanceError"}}t.InvalidBalanceError=h},238:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.smartContractAbstractionSemantic=t.compose=void 0,i(r(1863),t),i(r(6700),t),i(r(2619),t),i(r(4007),t),i(r(9480),t),i(r(120),t);var o=r(191);Object.defineProperty(t,"compose",{enumerable:!0,get:function(){return o.compose}}),i(r(4662),t),i(r(4397),t),i(r(3687),t),i(r(5491),t);var s=r(22);Object.defineProperty(t,"smartContractAbstractionSemantic",{enumerable:!0,get:function(){return s.smartContractAbstractionSemantic}})},2619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4007:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MANAGER_LAMBDA=void 0;t.MANAGER_LAMBDA={setDelegate:e=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:e}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],removeDelegate:()=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"NONE",args:[{prim:"key_hash"}]},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit:(e,t)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:e}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${t}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],transferToContract:(e,t)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"address"},{string:e}]},{prim:"CONTRACT",args:[{prim:"unit"}]},{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:`${t}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}]}},9480:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createSmartRollupOriginateOperation=t.createSmartRollupAddMessagesOperation=t.createUpdateConsensusKeyOperation=t.createProposalsOperation=t.createBallotOperation=t.createDrainDelegateOperation=t.createIncreasePaidStorageOperation=t.createTransferTicketOperation=t.createRegisterGlobalConstantOperation=t.createRevealOperation=t.createRegisterDelegateOperation=t.createSetDelegateOperation=t.createTransferOperation=t.createOriginationOperation=t.createActivationOperation=void 0;const i=r(8899),o=r(6368),s=r(4593),a=r(4632),c=r(6700);t.createActivationOperation=({pkh:e,secret:t})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.ACTIVATION,pkh:e,secret:t}}));t.createOriginationOperation=({code:e,init:t,balance:r="0",delegate:u,storage:l,fee:f=s.DEFAULT_FEE.ORIGINATION,gasLimit:d=s.DEFAULT_GAS_LIMIT.ORIGINATION,storageLimit:h=s.DEFAULT_STORAGE_LIMIT.ORIGINATION,mutez:p=!1})=>n(void 0,void 0,void 0,(function*(){if(void 0!==l&&void 0!==t)throw new c.OriginationParameterError("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(e))throw new c.InvalidCodeParameter("Wrong code parameter type, expected an array",e);let n;if(void 0!==l){const t=e.find((e=>"prim"in e&&"storage"===e.prim));if(void 0===(null==t?void 0:t.args))throw new c.InvalidCodeParameter("The storage section is missing from the script",e);n=new i.Schema(t.args[0]).Encode(l)}else{if(void 0===t||"object"!=typeof t)throw new c.InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",t);n=t}const s={code:e,storage:n};if(isNaN(Number(r)))throw new c.InvalidBalanceError(`Invalid Balance "${r}", cannot be converted to a number`);const b={kind:o.OpKind.ORIGINATION,fee:f,gas_limit:d,storage_limit:h,balance:p?r.toString():(0,a.format)("tz","mutez",r).toString(),script:s};return u&&(b.delegate=u),b}));t.createTransferOperation=({to:e,amount:t,parameter:r,fee:i=s.DEFAULT_FEE.TRANSFER,gasLimit:c=s.DEFAULT_GAS_LIMIT.TRANSFER,storageLimit:u=s.DEFAULT_STORAGE_LIMIT.TRANSFER,mutez:l=!1})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSACTION,fee:i,gas_limit:c,storage_limit:u,amount:l?t.toString():(0,a.format)("tz","mutez",t).toString(),destination:e,parameters:r}}));t.createSetDelegateOperation=({delegate:e,source:t,fee:r=s.DEFAULT_FEE.DELEGATION,gasLimit:i=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:a=s.DEFAULT_STORAGE_LIMIT.DELEGATION})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,source:t,fee:r,gas_limit:i,storage_limit:a,delegate:e}}));t.createRegisterDelegateOperation=({fee:e=s.DEFAULT_FEE.DELEGATION,gasLimit:t=s.DEFAULT_GAS_LIMIT.DELEGATION,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.DELEGATION},i)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DELEGATION,fee:e,gas_limit:t,storage_limit:r,delegate:i}}));t.createRevealOperation=({fee:e=s.DEFAULT_FEE.REVEAL,gasLimit:t,storageLimit:r=s.DEFAULT_STORAGE_LIMIT.REVEAL},i,a)=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REVEAL,fee:e,public_key:a,source:i,gas_limit:null!=t?t:(0,s.getRevealGasLimit)(i),storage_limit:r}}));t.createRegisterGlobalConstantOperation=({value:e,source:t,fee:r,gasLimit:i,storageLimit:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.REGISTER_GLOBAL_CONSTANT,value:e,fee:r,gas_limit:i,storage_limit:s,source:t}}));t.createTransferTicketOperation=({ticketContents:e,ticketTy:t,ticketTicketer:r,ticketAmount:i,destination:s,entrypoint:a,source:c,fee:u,gasLimit:l,storageLimit:f})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.TRANSFER_TICKET,fee:u,gas_limit:l,storage_limit:f,source:c,ticket_contents:e,ticket_ty:t,ticket_ticketer:r,ticket_amount:i,destination:s,entrypoint:a}}));t.createIncreasePaidStorageOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,amount:s,destination:a})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.INCREASE_PAID_STORAGE,source:e,fee:t,gas_limit:r,storage_limit:i,amount:s,destination:a}}));t.createDrainDelegateOperation=({consensus_key:e,delegate:t,destination:r})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.DRAIN_DELEGATE,consensus_key:e,delegate:t,destination:r}}));t.createBallotOperation=({source:e,proposal:t,ballot:r})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.BALLOT,source:e,proposal:t,ballot:r}}));t.createProposalsOperation=({source:e,proposals:t})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.PROPOSALS,source:e,proposals:t}}));t.createUpdateConsensusKeyOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,pk:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.UPDATE_CONSENSUS_KEY,source:e,fee:t,gas_limit:r,storage_limit:i,pk:s}}));t.createSmartRollupAddMessagesOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,message:s})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.SMART_ROLLUP_ADD_MESSAGES,source:e,fee:t,gas_limit:r,storage_limit:i,message:s}}));t.createSmartRollupOriginateOperation=({source:e,fee:t,gasLimit:r,storageLimit:i,pvmKind:s,kernel:a,parametersType:c})=>n(void 0,void 0,void 0,(function*(){return{kind:o.OpKind.SMART_ROLLUP_ORIGINATE,source:e,fee:t,gas_limit:r,storage_limit:i,pvm_kind:s,kernel:a,parameters_ty:c}}))},1151:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcContractProvider=void 0;const i=r(5543),o=r(8899),s=r(6368),a=r(4632),c=r(227),u=r(150),l=r(9785),f=r(6646),d=r(5544),h=r(2342),p=r(1846),b=r(1863),m=r(6700),g=r(22),v=r(8983),y=r(106),_=r(3729),w=r(738),E=r(7279),O=r(4384),A=r(2864),S=r(5847),P=r(6003),T=r(3793);class I extends P.Provider{constructor(e,t){super(e),this.estimator=t,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new T.PrepareProvider(this.context)}getStorage(e,t){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=yield this.context.readProvider.getScript(e,"head");let i;return t||(t=n),i=o.Schema.isSchema(t)?t:o.Schema.fromRPCResponse({script:t}),i.Execute(n.storage,(0,g.smartContractAbstractionSemantic)(this))}))}getBigMapKey(e,t,r){return n(this,void 0,void 0,(function*(){const n=(0,a.validateContractAddress)(e);if(n!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(n));let i;r||(r=(yield this.rpc.getContract(e)).script),i=o.Schema.isSchema(r)?r:o.Schema.fromRPCResponse({script:r});const s=i.EncodeBigMapKey(t),u=yield this.rpc.getBigMapKey(e,s);return i.ExecuteOnBigMapValue(u)}))}getBigMapKeyByID(e,t,r,i){return n(this,void 0,void 0,(function*(){const{key:n,type:o}=r.EncodeBigMapKey(t),{packed:s}=yield this.context.packer.packData({data:n,type:o}),c=(0,a.encodeExpr)(s),u=i?yield this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},i):yield this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},"head");return r.ExecuteOnBigMapValue(u,(0,g.smartContractAbstractionSemantic)(this))}))}getBigMapKeysByID(e,t,r,i,s=5){return n(this,void 0,void 0,(function*(){const n=yield this.getBlockForRequest(t,i),a=new o.MichelsonMap;let c=0,u=[];for(;cthis.getBigMapValueOrUndefined(t,e,r,n)));u=[...u,...yield Promise.all(i)],c+=s}for(let e=0;ee.kind===s.OpKind.ORIGINATION)),i=yield this.forge(r),{hash:o,context:a,forgedBytes:c,opResponse:u}=yield this.signAndInject(i);return new f.OriginationOperation(o,n,c,u,a,this)}))}setDelegate(e){var t;return n(this,void 0,void 0,(function*(){const r=(0,a.validateAddress)(e.source);if(e.source&&r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.delegate,(0,a.invalidDetail)(n));if(/kt1/i.test(e.source))throw new m.InvalidDelegationSource(e.source);const i=yield this.signer.publicKeyHash(),o=e.source||i,u=yield this.estimate(e,this.estimator.setDelegate.bind(this.estimator)),f=yield this.prepare.delegation(Object.assign(Object.assign({},e),u)),d=f.opOb.contents.find((e=>e.kind===s.OpKind.DELEGATION)),h=yield this.forge(f),{hash:p,context:b,forgedBytes:g,opResponse:v}=yield this.signAndInject(h);return new l.DelegateOperation(p,d,o,g,v,b)}))}registerDelegate(e){return n(this,void 0,void 0,(function*(){const t=yield this.estimate(e,this.estimator.registerDelegate.bind(this.estimator)),r=yield this.signer.publicKeyHash(),n=yield this.prepare.registerDelegate(Object.assign(Object.assign({},e),t)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.DELEGATION)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:f}=yield this.signAndInject(o);return new l.DelegateOperation(a,i,r,u,f,c)}))}transfer(e){var t;return n(this,void 0,void 0,(function*(){const r=(0,a.validateAddress)(e.to);if(r!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.to,(0,a.invalidDetail)(r));const n=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(n));if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());const i=yield this.signer.publicKeyHash(),o=yield this.estimate(e,this.estimator.transfer.bind(this.estimator)),u=e.source||i,l=yield this.prepare.transaction(Object.assign(Object.assign({},e),o)),f=l.opOb.contents.find((e=>e.kind===s.OpKind.TRANSACTION)),d=yield this.forge(l),{hash:h,context:b,forgedBytes:m,opResponse:g}=yield this.signAndInject(d);return new p.TransactionOperation(h,f,u,m,g,b)}))}transferTicket(e){var t,r;return n(this,void 0,void 0,(function*(){const n=(0,a.validateAddress)(e.destination);if(n!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.destination,(0,a.invalidDetail)(n));const i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=yield this.signer.publicKeyHash(),u=null!==(r=e.source)&&void 0!==r?r:o,l=yield this.estimate(e,this.estimator.transferTicket.bind(this.estimator)),f=yield this.prepare.transferTicket(Object.assign(Object.assign({},e),l)),d=f.opOb.contents.find((e=>e.kind===s.OpKind.TRANSFER_TICKET)),h=yield this.forge(f),{hash:p,context:b,forgedBytes:m,opResponse:g}=yield this.signAndInject(h);return new v.TransferTicketOperation(p,d,u,m,g,b)}))}reveal(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimator.reveal(e);if(r){const i=yield this.estimate(e,(()=>n(this,void 0,void 0,(function*(){return r})))),o=yield this.prepare.reveal(Object.assign(Object.assign({},e),i)),a=o.opOb.contents.find((e=>e.kind===s.OpKind.REVEAL)),c=yield this.forge(o),{hash:u,context:l,forgedBytes:f,opResponse:d}=yield this.signAndInject(c);return new h.RevealOperation(u,a,t,f,d,l)}throw new m.RevealOperationError(`The publicKeyHash '${t}' has already been revealed.`)}))}registerGlobalConstant(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.registerGlobalConstant.bind(this.estimator)),n=yield this.prepare.registerGlobalConstant(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.REGISTER_GLOBAL_CONSTANT)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new d.RegisterGlobalConstantOperation(a,i,t,u,l,c)}))}increasePaidStorage(e){return n(this,void 0,void 0,(function*(){if(e.amount<0)throw new c.InvalidAmountError(e.amount.toString());const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.increasePaidStorage.bind(this.estimator)),n=yield this.prepare.increasePaidStorage(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.INCREASE_PAID_STORAGE)),o=yield this.forge(n),{hash:a,context:u,forgedBytes:l,opResponse:f}=yield this.signAndInject(o);return new y.IncreasePaidStorageOperation(a,i,t,l,f,u)}))}drainDelegate(e){return n(this,void 0,void 0,(function*(){const t=yield this.prepare.drainDelegate(e),r=t.opOb.contents.find((e=>e.kind===s.OpKind.DRAIN_DELEGATE)),n=yield this.forge(t),{hash:i,context:o,forgedBytes:a,opResponse:c}=yield this.signAndInject(n);return new w.DrainDelegateOperation(i,r,a,c,o)}))}ballot(e){var t,r;return n(this,void 0,void 0,(function*(){const n=yield this.signer.publicKeyHash(),i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=null!==(r=e.source)&&void 0!==r?r:n,u=yield this.prepare.ballot(Object.assign(Object.assign({},e),{source:o})),l=u.opOb.contents.find((e=>e.kind===s.OpKind.BALLOT)),f=yield this.forge(u),{hash:d,context:h,forgedBytes:p,opResponse:b}=yield this.signAndInject(f);return new _.BallotOperation(d,l,n,p,b,h)}))}proposals(e){var t,r;return n(this,void 0,void 0,(function*(){const n=yield this.signer.publicKeyHash(),i=(0,a.validateAddress)(null!==(t=e.source)&&void 0!==t?t:"");if(e.source&&i!==a.ValidationResult.VALID)throw new c.InvalidAddressError(e.source,(0,a.invalidDetail)(i));const o=null!==(r=e.source)&&void 0!==r?r:n,u=yield this.prepare.proposals(Object.assign(Object.assign({},e),{source:o})),l=u.opOb.contents.find((e=>e.kind===s.OpKind.PROPOSALS)),f=yield this.forge(u),{hash:d,context:h,forgedBytes:p,opResponse:b}=yield this.signAndInject(f);return new E.ProposalsOperation(d,l,n,p,b,h)}))}updateConsensusKey(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.updateConsensusKey.bind(this.estimator)),n=yield this.prepare.updateConsensusKey(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.UPDATE_CONSENSUS_KEY)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new O.UpdateConsensusKeyOperation(a,i,t,u,l,c)}))}smartRollupAddMessages(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.smartRollupAddMessages.bind(this.estimator)),n=yield this.prepare.smartRollupAddMessages(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.SMART_ROLLUP_ADD_MESSAGES)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new A.SmartRollupAddMessagesOperation(a,i,t,u,l,c)}))}smartRollupOriginate(e){return n(this,void 0,void 0,(function*(){const t=yield this.signer.publicKeyHash(),r=yield this.estimate(e,this.estimator.smartRollupOriginate.bind(this.estimator)),n=yield this.prepare.smartRollupOriginate(Object.assign(Object.assign({},e),r)),i=n.opOb.contents.find((e=>e.kind===s.OpKind.SMART_ROLLUP_ORIGINATE)),o=yield this.forge(n),{hash:a,context:c,forgedBytes:u,opResponse:l}=yield this.signAndInject(o);return new S.SmartRollupOriginateOperation(a,i,t,u,l,c)}))}failingNoop(e){return n(this,void 0,void 0,(function*(){const t={kind:s.OpKind.FAILING_NOOP,arbitrary:e.arbitrary},r=yield this.context.readProvider.getBlockHash(e.basedOnBlock),n=yield this.context.forger.forge({branch:r,contents:[t]}),{prefixSig:i}=yield this.signer.sign(n,new Uint8Array([3]));return{signature:i,bytes:n,signedContent:{branch:r,contents:[{kind:s.OpKind.FAILING_NOOP,arbitrary:e.arbitrary}]}}}))}at(e,t=(e=>e)){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new c.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=this.context.withExtensions().rpc,i=this.context.withExtensions().readProvider,o=yield i.getScript(e,"head"),s=yield i.getEntrypoints(e),u=new b.ContractAbstraction(e,o,this,this,s,n,i);return t(u,this.context)}))}batch(e){const t=new u.OperationBatch(this.context,this.estimator);return Array.isArray(e)&&t.with(e),t}}t.RpcContractProvider=I},5491:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SaplingStateAbstraction=void 0;t.SaplingStateAbstraction=class{constructor(e,t){this.id=e,this.provider=t}getSaplingDiff(e){return r(this,void 0,void 0,(function*(){return this.provider.getSaplingDiffByID(this.id.toString(),e)}))}getId(){return this.id.toString()}}},22:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.smartContractAbstractionSemantic=void 0;const n=r(8899),i=r(5225),o=r(6391),s=r(5491);t.smartContractAbstractionSemantic=e=>({big_map:(t,r)=>{if(t&&"int"in t&&void 0!==t.int){const s=new n.Schema(r);return new i.BigMapAbstraction(new o.default(t.int),s,e)}return{}},sapling_state:t=>t&&"int"in t&&void 0!==t.int?new s.SaplingStateAbstraction(new o.default(t.int),e):{}})},120:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VIEW_LAMBDA=void 0;t.VIEW_LAMBDA={code:[{prim:"parameter",args:[{prim:"lambda",args:[{prim:"unit"},{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},{prim:"unit"}]}]}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"UNIT"},{prim:"EXEC"}]]}],storage:"Unit"}},7642:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RPCResponseError=t.ConfirmationTimeoutError=t.InvalidConfirmationCountError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e){super(),this.invalidConfirmations=e,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${e} expecting at least 1`}}t.InvalidConfirmationCountError=i;class o extends n.NetworkError{constructor(e){super(),this.message=e,this.name="ConfirmationTimeoutError"}}t.ConfirmationTimeoutError=o;class s extends n.RpcError{constructor(e,t){super(),this.message=e,this.cause=t,this.name="RPCResponseError"}}t.RPCResponseError=s},1826:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevealEstimateError=void 0;const n=r(227);class i extends n.TaquitoError{constructor(){super(),this.name="RevealEstimateError",this.message="Public key is unknown, unable to estimate the reveal operation in Wallet API."}}t.RevealEstimateError=i},1243:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4705:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Estimate=void 0;const r=100;class n{constructor(e,t,r,n,i=100){this._milligasLimit=e,this._storageLimit=t,this.opSize=r,this.minimalFeePerStorageByteMutez=n,this.baseFeeMutez=i}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){const e=Math.max(Number(this._storageLimit),0);return e>0?e:0}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3+100)}get operationFeeMutez(){return.1*(Number(this._milligasLimit)/1e3+100)+1*Number(this.opSize)}roundUp(e){return Math.ceil(Number(e))}get minimalFeeMutez(){return this.roundUp(r+this.operationFeeMutez)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+200)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),r)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(e){let t,r=0,i=0,o=0,s=0;return e.forEach((e=>{r+=e.milligasLimit,i+=e.storageLimit,o+=e.opSize,s=Math.max(e.minimalFeePerStorageByteMutez,s),e.baseFeeMutez&&(t=t?t+e.baseFeeMutez:e.baseFeeMutez)})),new n(r,i,o,s,t)}static createArrayEstimateInstancesFromProperties(e){return e.map((e=>new n(e.milligasLimit,e.storageLimit,e.opSize,e.minimalFeePerStorageByteMutez,e.baseFeeMutez)))}}t.Estimate=n},8794:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4705),t),i(r(1243),t),i(r(4782),t),i(r(1826),t)},4782:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{a+="originated_contracts"in e&&void 0!==e.originated_contracts?e.originated_contracts.length*this.ORIGINATION_STORAGE:0,a+="allocated_destination_contract"in e?this.ALLOCATION_STORAGE:0,i+=Number(e.consumed_milligas)||0,a+="paid_storage_size_diff"in e&&Number(e.paid_storage_size_diff)||0,a+="storage_size"in e&&"global_address"in e&&Number(e.storage_size)||0,a+="genesis_commitment_hash"in e?Number(e.size):0})),(0,s.isOpWithFee)(e)?{milligasLimit:i||0,storageLimit:Number(a||0),opSize:t,minimalFeePerStorageByteMutez:r.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:t,minimalFeePerStorageByteMutez:r.toNumber(),baseFeeMutez:0}}calculateEstimates(e,t){return n(this,void 0,void 0,(function*(){const{opbytes:r,opOb:{branch:n,contents:i}}=yield this.forge(e),s={operation:{branch:n,contents:i},chain_id:yield this.context.readProvider.getChainId()},{opResponse:a}=yield this.simulate(s),{cost_per_byte:c}=t,u=[...(0,o.flattenErrors)(a,"backtracked"),...(0,o.flattenErrors)(a)];if(u.length)throw new o.TezosOperationError(u,"Error occurred during estimation",a.contents);let l=1;return Array.isArray(e.opOb.contents)&&e.opOb.contents.length>1&&(l="reveal"===a.contents[0].kind?e.opOb.contents.length-1:e.opOb.contents.length),a.contents.map((e=>this.getEstimationPropertiesFromOperationContent(e,"reveal"===e.kind?this.OP_SIZE_REVEAL/2:r.length/2/l,c)))}))}originate(e){return n(this,void 0,void 0,(function*(){const t=yield this.prepare.originate(e),r=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.calculateEstimates(t,r);return"reveal"===t.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}transfer(e){var t,{fee:r,storageLimit:o,gasLimit:s}=e,u=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.to);if(e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.to,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.source)&&void 0!==t?t:"");if(u.source&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(n));if(u.amount<0)throw new d.InvalidAmountError(u.amount.toString());const i=yield this.prepare.transaction(Object.assign({fee:r,storageLimit:o,gasLimit:s},u)),l=yield this.context.readProvider.getProtocolConstants("head"),f=yield this.calculateEstimates(i,l);return"reveal"===i.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}transferTicket(e){var t,{fee:r,storageLimit:o,gasLimit:s}=e,u=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.destination);if(e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.destination,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.source)&&void 0!==t?t:"");if(u.source&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(n));const i=yield this.context.readProvider.getProtocolConstants("head"),l=yield this.prepare.transferTicket(Object.assign({fee:r,storageLimit:o,gasLimit:s},u)),f=yield this.calculateEstimates(l,i);return"reveal"===l.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}setDelegate(e){var t,{fee:r,gasLimit:o,storageLimit:s}=e,u=i(e,["fee","gasLimit","storageLimit"]);return n(this,void 0,void 0,(function*(){const e=(0,c.validateAddress)(u.source);if(u.source&&e!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.source,(0,c.invalidDetail)(e));const n=(0,c.validateAddress)(null!==(t=u.delegate)&&void 0!==t?t:"");if(u.delegate&&n!==c.ValidationResult.VALID)throw new d.InvalidAddressError(u.delegate,(0,c.invalidDetail)(n));const i=yield this.prepare.delegation(Object.assign({fee:r,storageLimit:s,gasLimit:o},u)),l=yield this.context.readProvider.getProtocolConstants("head"),f=yield this.calculateEstimates(i,l);return"reveal"===i.opOb.contents[0].kind&&f.shift(),a.Estimate.createEstimateInstanceFromProperties(f)}))}batch(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.batch(e),n=yield this.calculateEstimates(r,t);return a.Estimate.createArrayEstimateInstancesFromProperties(n)}))}registerDelegate(e,t){var{fee:r,storageLimit:o,gasLimit:s}=e,c=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=(yield this.getKeys()).publicKeyHash,n=yield this.context.readProvider.getProtocolConstants("head"),i=t||e,u=yield this.prepare.registerDelegate(Object.assign({fee:r,storageLimit:o,gasLimit:s},c),i),l=yield this.calculateEstimates(u,n);return"reveal"===u.opOb.contents[0].kind&&l.shift(),a.Estimate.createEstimateInstanceFromProperties(l)}))}reveal(e){return n(this,void 0,void 0,(function*(){const{publicKeyHash:t,publicKey:r}=yield this.getKeys();if(!r)throw new u.RevealEstimateError;if(yield this.isAccountRevealRequired(t)){const t=yield this.context.readProvider.getProtocolConstants("head"),r=e?yield this.prepare.reveal(e):yield this.prepare.reveal({}),n=yield this.calculateEstimates(r,t);return a.Estimate.createEstimateInstanceFromProperties(n)}}))}registerGlobalConstant(e){var{fee:t,storageLimit:r,gasLimit:o}=e,s=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){const e=yield this.prepare.registerGlobalConstant(Object.assign({fee:t,storageLimit:r,gasLimit:o},s)),n=yield this.context.readProvider.getProtocolConstants("head"),i=yield this.calculateEstimates(e,n);return"reveal"===e.opOb.contents[0].kind&&i.shift(),a.Estimate.createEstimateInstanceFromProperties(i)}))}increasePaidStorage(e){var{fee:t,storageLimit:r,gasLimit:o}=e,s=i(e,["fee","storageLimit","gasLimit"]);return n(this,void 0,void 0,(function*(){if(s.amount<0)throw new d.InvalidAmountError(s.amount.toString());const e=yield this.context.readProvider.getProtocolConstants("head"),n=yield this.prepare.increasePaidStorage(Object.assign({fee:t,storageLimit:r,gasLimit:o},s)),i=yield this.calculateEstimates(n,e);return"reveal"===n.opOb.contents[0].kind&&i.shift(),a.Estimate.createEstimateInstanceFromProperties(i)}))}updateConsensusKey(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.updateConsensusKey(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}smartRollupAddMessages(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.smartRollupAddMessages(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}smartRollupOriginate(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.smartRollupOriginate(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}contractCall(e){return n(this,void 0,void 0,(function*(){const t=yield this.context.readProvider.getProtocolConstants("head"),r=yield this.prepare.contractCall(e),n=yield this.calculateEstimates(r,t);return"reveal"===r.opOb.contents[0].kind&&n.shift(),a.Estimate.createEstimateInstanceFromProperties(n)}))}}t.RPCEstimateProvider=h},7336:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositeForger=void 0;const i=r(3557);t.CompositeForger=class{constructor(e){if(this.forgers=e,0===e.length)throw new i.UnspecifiedForgerError}forge({branch:e,contents:t}){return n(this,void 0,void 0,(function*(){const r=yield Promise.all(this.forgers.map((r=>r.forge({branch:e,contents:t}))));if(0===r.length)throw new i.UnspecifiedForgerError;let n=r.pop();for(;r.length;){const e=r.pop();if(e!==n)throw new i.ForgingMismatchError([n,e]);n=e}return n}))}}},3557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnspecifiedForgerError=t.ForgingMismatchError=void 0;const n=r(227);class i extends n.TaquitoError{constructor(e){super(),this.results=e,this.name="ForgingMismatchError",this.message="Forging mismatch error"}}t.ForgingMismatchError=i;class o extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnspecifiedForgerError",this.message="No forger has been configured. Please configure new CompositeForger([rpcForger, localForger]) with your TezosToolkit instance."}}t.UnspecifiedForgerError=o},794:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RpcForger=void 0;t.RpcForger=class{constructor(e){this.context=e}forge({branch:e,contents:t}){return this.context.rpc.forgeOperations({branch:e,contents:t})}}},6713:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TaquitoLocalForger=void 0;const i=r(5078);t.TaquitoLocalForger=class{constructor(e){this.context=e}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const e=yield this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}))}forge({branch:e,contents:t}){return n(this,void 0,void 0,(function*(){return new i.LocalForger(yield this.getNextProto()).forge({branch:e,contents:t})}))}}},5505:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGlobalConstantsProvider=void 0;const i=r(3739);t.DefaultGlobalConstantsProvider=class{constructor(){this._globalConstantsLibrary={}}loadGlobalConstant(e){for(const t in e)Object.assign(this._globalConstantsLibrary,{[t]:e[t]})}getGlobalConstantByHash(e){return n(this,void 0,void 0,(function*(){const t=this._globalConstantsLibrary[e];if(!t)throw new i.GlobalConstantNotFound(e);return t}))}}},3739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnconfiguredGlobalConstantsProviderError=t.GlobalConstantNotFound=void 0;const n=r(227);class i extends n.TaquitoError{constructor(e){super(),this.hash=e,this.name="GlobalConstantNotFound",this.message=`Please load the value associated with the constant ${e} using the loadGlobalConstant method of the DefaultGlobalConstantsProvider.`}}t.GlobalConstantNotFound=i;class o extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredGlobalConstantsProviderError",this.message="No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."}}t.UnconfiguredGlobalConstantsProviderError=o},3171:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9494:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopGlobalConstantsProvider=void 0;const i=r(3739);t.NoopGlobalConstantsProvider=class{getGlobalConstantByHash(e){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredGlobalConstantsProviderError}))}}},5180:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatErrorMessage=void 0;const n=r(5543);t.formatErrorMessage=function(e,t){const r=JSON.parse(e.body);if(r[0]&&r[0].kind&&r[0].msg){const i=JSON.stringify({kind:r[0].kind,id:r[0].id,msg:r[0].msg.replace(t,"")});return new n.HttpResponseError(`Http error response: (${e.status}) ${i}`,e.status,e.statusText,i,e.url)}return e}},134:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5744:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcInjector=void 0;const i=r(5180),o=r(5543);t.RpcInjector=class{constructor(e){this.context=e}inject(e){return n(this,void 0,void 0,(function*(){let t;try{t=yield this.context.rpc.injectOperation(e)}catch(e){const t=". You may want to use --replace to provide adequate fee and replace it";throw e instanceof o.HttpResponseError&&e.message.includes(t)?(0,i.formatErrorMessage)(e,t):e}return t}))}}},3729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BallotOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"ballot"===e.kind));return e||void 0}get period(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}t.BallotOperation=i},3650:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BatchOperation=void 0;const n=r(6391),i=r(150),o=r(835),s=r(7525),a=r(807);class c extends s.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}getOriginatedContractAddresses(){const e=this.results.filter((e=>"origination"===e.kind));let t=[];for(const r of e)r.metadata.operation_result.originated_contracts&&(t=[...t,...r.metadata.operation_result.originated_contracts]);return t}get status(){return this.results.filter((e=>-1!==i.BATCH_KINDS.indexOf(e.kind))).map((e=>{if((0,a.hasMetadataWithResult)(e)){return e.metadata.operation_result.status}return"unknown"}))[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP}),new n.default(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,o.flattenOperationResult)({contents:this.results}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,o.flattenOperationResult)({contents:this.results}),"paid_storage_size_diff"))}get errors(){return(0,o.flattenErrors)({contents:this.results})}}t.BatchOperation=c},9785:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelegateOperation=void 0;const n=r(6391),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"delegation"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get delegate(){return this.params.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),this.consumedMilliGas?new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.DelegateOperation=o},738:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DrainDelegateOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i){super(e,r,n,i),this.params=t}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"drain_delegate"===e.kind)),t=e&&e.metadata&&e.metadata.balance_updates;return t||void 0}get consensusKey(){return this.params.consensus_key}get delegate(){return this.params.delegate}get destination(){return this.params.destination}}t.DrainDelegateOperation=i},835:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidEstimateValueError=t.OriginationOperationError=t.flattenErrors=t.flattenOperationResult=t.TezosPreapplyFailureError=t.TezosOperationError=void 0;const n=r(227),i=r(807);class o extends n.RpcError{constructor(e,t,r){super(),this.errors=e,this.errorDetails=t,this.operationsWithResults=r,this.name="TezosOperationError",this.lastError=e[e.length-1],this.message=`(${this.kind}) ${this.id}`,"with"in this.lastError&&(this.lastError.with.string?this.message=this.lastError.with.string:this.lastError.with.int?this.message=this.lastError.with.int:this.message=JSON.stringify(this.lastError.with))}get id(){return this.lastError.id}get kind(){return this.lastError.kind}}t.TezosOperationError=o;class s extends Error{constructor(e){super(),this.result=e,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}t.TezosPreapplyFailureError=s;t.flattenOperationResult=e=>{const t=Array.isArray(e)?e:[e],r=[];for(let e=0;er.push(e.result))))}return r};t.flattenErrors=(e,t="failed")=>{const r=Array.isArray(e)?e:[e];let n=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IncreasePaidStorageOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"increase_paid_storage"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}t.IncreasePaidStorageOperation=i},3323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=t.DrainDelegateOperation=t.BallotOperation=t.TransactionOperation=t.OriginationOperation=t.DelegateOperation=t.BatchOperation=t.InvalidEstimateValueError=t.TezosPreapplyFailureError=t.TezosOperationError=t.OpKind=void 0;var n=r(807);Object.defineProperty(t,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});var i=r(835);Object.defineProperty(t,"TezosOperationError",{enumerable:!0,get:function(){return i.TezosOperationError}}),Object.defineProperty(t,"TezosPreapplyFailureError",{enumerable:!0,get:function(){return i.TezosPreapplyFailureError}}),Object.defineProperty(t,"InvalidEstimateValueError",{enumerable:!0,get:function(){return i.InvalidEstimateValueError}});var o=r(3650);Object.defineProperty(t,"BatchOperation",{enumerable:!0,get:function(){return o.BatchOperation}});var s=r(9785);Object.defineProperty(t,"DelegateOperation",{enumerable:!0,get:function(){return s.DelegateOperation}});var a=r(6646);Object.defineProperty(t,"OriginationOperation",{enumerable:!0,get:function(){return a.OriginationOperation}});var c=r(1846);Object.defineProperty(t,"TransactionOperation",{enumerable:!0,get:function(){return c.TransactionOperation}});var u=r(3729);Object.defineProperty(t,"BallotOperation",{enumerable:!0,get:function(){return u.BallotOperation}});var l=r(738);Object.defineProperty(t,"DrainDelegateOperation",{enumerable:!0,get:function(){return l.DrainDelegateOperation}});var f=r(7525);Object.defineProperty(t,"Operation",{enumerable:!0,get:function(){return f.Operation}})},7525:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Operation=void 0;const i=r(977),o=r(9002),s=r(807),a=r(4632),c=r(552),u=r(7642),l=r(227);t.Operation=class{get includedInBlock(){return this._foundAt}constructor(e,t,r,n){if(this.hash=e,this.raw=t,this.results=r,this.context=n,this._pollingConfig$=new i.ReplaySubject(1),this.currentHead$=this._pollingConfig$.pipe((0,o.switchMap)((e=>new i.BehaviorSubject(e).pipe((0,o.timeout)({each:1e3*e.timeout,with:()=>(0,i.throwError)((()=>new u.ConfirmationTimeoutError("Confirmation polling timed out")))})))),(0,o.switchMap)((()=>(0,i.defer)((()=>(0,c.createObservableFromSubscription)(this.context.stream.subscribeBlock("head")))).pipe((0,o.switchMap)((e=>{var t,r;const n=null!==(r=null===(t=this.lastHead)||void 0===t?void 0:t.header.level)&&void 0!==r?r:e.header.level-1;return(0,i.range)(n+1,e.header.level-n-1).pipe((0,o.concatMap)((e=>this.context.readProvider.getBlock(e))),(0,o.endWith)(e))})),(0,o.tap)((e=>this.lastHead=e))))),(0,o.shareReplay)({refCount:!0})),this.confirmed$=this.currentHead$.pipe((0,o.map)((e=>{for(let t=3;t>=0;t--)e.operations[t].forEach((t=>{t.hash===this.hash&&(this._foundAt=e.header.level)}));if(e.header.level-this._foundAt>=0)return this._foundAt})),(0,o.filter)((e=>void 0!==e)),(0,o.first)(),(0,o.shareReplay)()),this._foundAt=Number.POSITIVE_INFINITY,(0,a.validateOperation)(this.hash)!==a.ValidationResult.VALID)throw new l.InvalidOperationHashError(this.hash);this.confirmed$.pipe((0,o.first)(),(0,o.catchError)((()=>(0,i.of)(i.EMPTY)))).subscribe()}get revealOperation(){return Array.isArray(this.results)&&this.results.find((e=>"reveal"===e.kind))}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map((e=>(0,s.hasMetadataWithResult)(e)?e.metadata.operation_result.status:"unknown"))[0]||"unknown"}confirmation(e,t){return n(this,void 0,void 0,(function*(){if(void 0!==e&&e<1)throw new u.InvalidConfirmationCountError(e);const{defaultConfirmationCount:r,confirmationPollingTimeoutSecond:n}=this.context.config;this._pollingConfig$.next({timeout:t||n});const i=void 0!==e?e:r;return new Promise(((e,t)=>{this.confirmed$.pipe((0,o.switchMap)((()=>this.currentHead$)),(0,o.filter)((e=>e.header.level-this._foundAt>=i-1)),(0,o.first)()).subscribe((t=>{e(this._foundAt+(i-1))}),t)}))}))}}},6646:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OriginationOperation=void 0;const i=r(6391),o=r(835),s=r(7525),a=r(807);class c extends s.Operation{constructor(e,t,r,n,i,o){super(e,r,n,i),this.params=t,this.contractProvider=o;const s=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(s)&&(this.contractAddress=s[0])}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"origination"===e.kind)),t=e&&(0,a.hasMetadataWithResult)(e)&&e.metadata.operation_result;return t||void 0}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return i.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:i.BigNumber.ROUND_UP}),this.consumedMilliGas?new i.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get storageDiff(){const e=this.operationResults&&this.operationResults.paid_storage_size_diff;return e||void 0}get storageSize(){const e=this.operationResults&&this.operationResults.storage_size;return e||void 0}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}contract(e,t){return n(this,void 0,void 0,(function*(){if(!this.contractAddress)throw new o.OriginationOperationError("No contract was originated in this operation");return yield this.confirmation(e,t),this.contractProvider.at(this.contractAddress)}))}}t.OriginationOperation=c},7279:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProposalsOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"proposals"===e.kind));return e||void 0}get proposals(){return this.params.proposals}get period(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.period}}t.ProposalsOperation=i},5544:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegisterGlobalConstantOperation=void 0;const n=r(6391),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"register_global_constant"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get registeredExpression(){return this.params.value}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),this.consumedMilliGas?new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}}t.RegisterGlobalConstantOperation=o},2342:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RevealOperation=void 0;const n=r(6391),i=r(835),o=r(7525);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"reveal"===e.kind));return e?[e]:[]}get status(){const e=this.operationResults[0];return e?e.metadata.operation_result.status:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get publicKey(){return this.params.public_key}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}get consumedGas(){return n.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.BigNumber.ROUND_UP}),new n.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"storage_size"))}get errors(){return(0,i.flattenErrors)({contents:this.operationResults})}}t.RevealOperation=s},2864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartRollupAddMessagesOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"smart_rollup_add_messages"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get message(){return this.params.message}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.SmartRollupAddMessagesOperation=i},5847:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SmartRollupOriginateOperation=void 0;const n=r(6368),i=r(7525);class o extends i.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>e.kind===n.OpKind.SMART_ROLLUP_ORIGINATE)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.SmartRollupOriginateOperation=o},1846:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionOperation=void 0;const n=r(6391),i=r(835),o=r(7525);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"transaction"===e.kind));return e?[e]:[]}get status(){const e=this.operationResults[0];return e?e.metadata.operation_result.status:"unknown"}get amount(){return new n.default(this.params.amount)}get destination(){return this.params.destination}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}sumProp(e,t){return e.reduce(((e,r)=>t in r?Number(r[t])+e:e),0)}get consumedGas(){return n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP}),new n.default(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp((0,i.flattenOperationResult)({contents:this.operationResults}),"storage_size"))}get errors(){return(0,i.flattenErrors)({contents:this.operationResults})}}t.TransactionOperation=s},8983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransferTicketOperation=void 0;const n=r(6368),i=r(6391),o=r(3323);class s extends o.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>e.kind===n.OpKind.TRANSFER_TICKET)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return i.BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:i.BigNumber.ROUND_UP}),this.consumedMilliGas?new i.BigNumber(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}}t.TransferTicketOperation=s},807:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasMetadataWithInternalOperationResult=t.hasMetadataWithResult=t.hasMetadata=t.isSourceOp=t.isOpRequireReveal=t.isOpWithFee=t.isKind=t.findWithKind=t.attachKind=t.OpKind=void 0;var n=r(6368);Object.defineProperty(t,"OpKind",{enumerable:!0,get:function(){return n.OpKind}});t.attachKind=(e,t)=>Object.assign(Object.assign({},e),{kind:t});t.findWithKind=(e,r)=>{if(Array.isArray(e)){const n=e.find((e=>e.kind===r));if(n&&(0,t.isKind)(n,r))return n}};t.isKind=(e,t)=>e.kind===t;t.isOpWithFee=e=>-1!==["transaction","delegation","origination","reveal","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(e.kind);t.isOpRequireReveal=e=>-1!==["transaction","delegation","origination","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(e.kind);t.isSourceOp=e=>-1!==["transaction","delegation","origination","reveal","ballot"].indexOf(e.kind);t.hasMetadata=e=>"metadata"in e;t.hasMetadataWithResult=e=>(0,t.hasMetadata)(e)&&"operation_result"in e.metadata;t.hasMetadataWithInternalOperationResult=e=>(0,t.hasMetadata)(e)&&"internal_operation_results"in e.metadata},4384:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateConsensusKeyOperation=void 0;const n=r(7525);class i extends n.Operation{constructor(e,t,r,n,i,o){super(e,n,i,o),this.params=t,this.source=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find((e=>"update_consensus_key"===e.kind)),t=e&&e.metadata&&e.metadata.operation_result;return t||void 0}get status(){var e,t;return null!==(t=null===(e=this.operationResults)||void 0===e?void 0:e.status)&&void 0!==t?t:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get consumedMilliGas(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.consumed_milligas}get errors(){var e;return null===(e=this.operationResults)||void 0===e?void 0:e.errors}}t.UpdateConsensusKeyOperation=i},4762:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9406:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MichelCodecPacker=void 0;const i=r(9985);t.MichelCodecPacker=class{packData(e){return n(this,void 0,void 0,(function*(){const{bytes:t}=(0,i.packDataBytes)(e.data,e.type);return{packed:t}}))}}},6395:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcPacker=void 0;t.RpcPacker=class{constructor(e){this.context=e}packData(e){return r(this,void 0,void 0,(function*(){return this.context.rpc.packData(e)}))}}},9813:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5286:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MichelCodecParser=void 0;const i=r(9985),o=r(6700),s=r(8899);t.MichelCodecParser=class{constructor(e){this.context=e}getNextProto(){return n(this,void 0,void 0,(function*(){if(!this.context.proto){const e=yield this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}))}parseScript(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseScript(e)}))}parseMichelineExpression(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseMichelineExpression(e)}))}parseJSON(e){return n(this,void 0,void 0,(function*(){return new i.Parser({protocol:yield this.getNextProto()}).parseJSON(e)}))}prepareCodeOrigination(e){return n(this,void 0,void 0,(function*(){const t=e;if(t.code=yield this.formatCodeParam(e.code),e.init)t.init=yield this.formatInitParam(e.init);else if(e.storage){const r=t.code.find((e=>"prim"in e&&"storage"===e.prim));if(!(null==r?void 0:r.args))throw new o.InvalidCodeParameter("The storage section is missing from the script",e.code);const n=new s.Schema(r.args[0]),a=yield this.findGlobalConstantsHashAndValue(n);if(0!==Object.keys(a).length){const n=new i.Parser({expandGlobalConstant:a}).parseJSON(r.args[0]),o=new s.Schema(n);t.init=o.Encode(e.storage)}else t.init=n.Encode(e.storage);delete t.storage}return t}))}formatCodeParam(e){return n(this,void 0,void 0,(function*(){let t;if("string"==typeof e){const r=yield this.parseScript(e);if(null===r)throw new o.InvalidCodeParameter("Unable to parse",e);t=r}else{const r=yield this.parseJSON(e),n=["parameter","storage","code"];t=r.sort(((e,t)=>n.indexOf(e.prim)-n.indexOf(t.prim)))}return t}))}formatInitParam(e){return n(this,void 0,void 0,(function*(){let t;if("string"==typeof e){const r=yield this.parseMichelineExpression(e);if(null===r)throw new o.InvalidInitParameter("Invalid init parameter",e);t=r}else t=yield this.parseJSON(e);return t}))}findGlobalConstantsHashAndValue(e){return n(this,void 0,void 0,(function*(){const t=e.findToken("constant"),r={};if(0!==t.length)for(const e of t){const t=e.tokenVal.args;if(t){const e=t[0];if(e.string){const t=e.string,n=yield this.context.globalConstantsProvider.getGlobalConstantByHash(t);Object.assign(r,{[t]:n})}}}return r}))}}},3259:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopParser=void 0;t.NoopParser=class{prepareCodeOrigination(e){return r(this,void 0,void 0,(function*(){return e}))}}},3793:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(8078),t),i(r(2021),t)},8078:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2021:function(e,t,r){"use strict";var n,i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},s=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{var r,n,i;return{fee:null!==(r=e.fee)&&void 0!==r?r:t.fee,gasLimit:null!==(n=e.gasLimit)&&void 0!==n?n:t.gasLimit,storageLimit:null!==(i=e.storageLimit)&&void 0!==i?i:t.storageLimit}};class g extends p.Provider{constructor(e){super(e),this.context=e,n.set(this,void 0),o(this,n,{},"f")}getBlockHash(e){return i(this,void 0,void 0,(function*(){return this.context.readProvider.getBlockHash(null!=e?e:"head~2")}))}getProtocolHash(){return i(this,void 0,void 0,(function*(){return this.context.readProvider.getNextProtocol("head")}))}getHeadCounter(e){var t;return i(this,void 0,void 0,(function*(){return null!==(t=this.context.readProvider.getCounter(e,"head"))&&void 0!==t?t:"0"}))}adjustGasForBatchOperation(e,t,r){return b.default.min(t,e.div(r+1))}getAccountLimits(e,t,r){return i(this,void 0,void 0,(function*(){const n=yield this.context.readProvider.getBalance(e,"head"),{hard_gas_limit_per_operation:i,hard_gas_limit_per_block:o,hard_storage_limit_per_operation:s,cost_per_byte:a}=t;return{fee:0,gasLimit:r?Math.floor(this.adjustGasForBatchOperation(o,i,r).toNumber()):i.toNumber(),storageLimit:Math.floor(b.default.min(n.dividedBy(a),s).toNumber())}}))}getFee(e,t,r){(!s(this,n,"f")[t]||s(this,n,"f")[t]{switch(e.kind){case c.OpKind.ACTIVATION:case c.OpKind.DRAIN_DELEGATE:return Object.assign({},e);case c.OpKind.ORIGINATION:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{balance:void 0!==e.balance?`${e.balance}`:"0"}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.TRANSACTION:{const i=Object.assign(Object.assign(Object.assign(Object.assign({},e),{amount:void 0!==e.amount?`${e.amount}`:"0"}),this.getSource(e,r,n)),this.getFee(e,r,t));if(i.source.toLowerCase().startsWith("kt1"))throw new d.DeprecationError(`KT1 addresses are not supported as source since ${l.Protocols.PsBabyM1}`);return i}case c.OpKind.REVEAL:case c.OpKind.DELEGATION:case c.OpKind.REGISTER_GLOBAL_CONSTANT:case c.OpKind.UPDATE_CONSENSUS_KEY:case c.OpKind.SMART_ROLLUP_ADD_MESSAGES:case c.OpKind.SMART_ROLLUP_ORIGINATE:return Object.assign(Object.assign(Object.assign({},e),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.TRANSFER_TICKET:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{ticket_amount:`${e.ticket_amount}`}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.INCREASE_PAID_STORAGE:return Object.assign(Object.assign(Object.assign(Object.assign({},e),{amount:`${e.amount}`}),this.getSource(e,r,n)),this.getFee(e,r,t));case c.OpKind.BALLOT:case c.OpKind.PROPOSALS:if(void 0===i)throw new f.RPCResponseError("Failed to get the current voting period index");return Object.assign(Object.assign({},e),{period:null==i?void 0:i.voting_period.index});default:throw new d.InvalidOperationKindError(e.kind)}}))}activate({pkh:e,secret:t}){return i(this,void 0,void 0,(function*(){const r=yield(0,h.createActivationOperation)({pkh:e,secret:t}),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:s,contents:this.constructOpContents(i,c,e),protocol:a},counter:c}}))}reveal({fee:e,gasLimit:t,storageLimit:r}){return i(this,void 0,void 0,(function*(){const{pkh:i,publicKey:s}=yield this.getKeys();if(!s)throw new d.PublicKeyNotFoundError(i);const a=yield this.context.readProvider.getProtocolConstants("head"),c=yield this.getAccountLimits(i,a),u=m({fee:e,storageLimit:r,gasLimit:t},c),l=yield(0,h.createRevealOperation)({fee:u.fee,gasLimit:u.gasLimit,storageLimit:u.storageLimit},i,s),f=this.convertIntoArray(l),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(i),10);return{opOb:{branch:p,contents:this.constructOpContents(f,g,i),protocol:b},counter:g}}))}originate(e,t){var{fee:r,storageLimit:s,gasLimit:c}=e,u=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),l=yield(0,h.createOriginationOperation)(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},u),m({fee:r,storageLimit:s,gasLimit:c},a)))),f=yield this.addRevealOperationIfNeeded(l,e),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,e,t),protocol:b},counter:g}}))}transaction(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createTransferOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}delegation(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSetDelegateOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}registerDelegate({fee:e,storageLimit:t,gasLimit:r},s){return i(this,void 0,void 0,(function*(){const{pkh:i}=yield this.getKeys(),a=yield this.context.readProvider.getProtocolConstants("head"),c=yield this.getAccountLimits(i,a),u=m({fee:e,storageLimit:t,gasLimit:r},c),l=yield(0,h.createRegisterDelegateOperation)({fee:u.fee,storageLimit:u.storageLimit,gasLimit:u.gasLimit},i),f=yield this.addRevealOperationIfNeeded(l,i),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(i),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,i,s),protocol:b},counter:g}}))}registerGlobalConstant(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createRegisterGlobalConstantOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}updateConsensusKey(e,t){var{fee:r,storageLimit:s,gasLimit:c}=e,u=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),l=yield(0,h.createUpdateConsensusKeyOperation)(Object.assign(Object.assign({},u),m({fee:r,storageLimit:s,gasLimit:c},a))),f=yield this.addRevealOperationIfNeeded(l,e),d=this.convertIntoArray(f),p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:p,contents:this.constructOpContents(d,g,e,t),protocol:b},counter:g}}))}increasePaidStorage(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createIncreasePaidStorageOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}ballot(e){return i(this,void 0,void 0,(function*(){const{pkh:t}=yield this.getKeys(),r=yield(0,h.createBallotOperation)(Object.assign({},e)),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(t),10);let u;try{u=yield this.rpc.getCurrentPeriod()}catch(e){throw new f.RPCResponseError("Failed to get the current voting period index")}return{opOb:{branch:s,contents:this.constructOpContents(i,c,t,void 0,u),protocol:a},counter:c}}))}proposals(e){return i(this,void 0,void 0,(function*(){const{pkh:t}=yield this.getKeys(),r=yield(0,h.createProposalsOperation)(Object.assign({},e)),i=this.convertIntoArray(r),s=yield this.getBlockHash(),a=yield this.getProtocolHash();o(this,n,{},"f");const c=parseInt(yield this.getHeadCounter(t),10);let u;try{u=yield this.rpc.getCurrentPeriod()}catch(e){throw new f.RPCResponseError("Failed to get the current voting period index")}return{opOb:{branch:s,contents:this.constructOpContents(i,c,t,void 0,u),protocol:a},counter:c}}))}drainDelegate(e,t){return i(this,void 0,void 0,(function*(){const{pkh:r}=yield this.getKeys(),i=yield(0,h.createDrainDelegateOperation)(Object.assign({},e)),s=this.convertIntoArray(i),a=yield this.getBlockHash(),c=yield this.getProtocolHash();o(this,n,{},"f");const u=parseInt(yield this.getHeadCounter(r),10);return{opOb:{branch:a,contents:this.constructOpContents(s,u,r,t),protocol:c},counter:u}}))}transferTicket(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createTransferTicketOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}smartRollupAddMessages(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSmartRollupAddMessagesOperation)(Object.assign(Object.assign({},c),m({fee:t,storageLimit:r,gasLimit:s},a))),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}smartRollupOriginate(e){var{fee:t,storageLimit:r,gasLimit:s}=e,c=a(e,["fee","storageLimit","gasLimit"]);return i(this,void 0,void 0,(function*(){const{pkh:e}=yield this.getKeys(),i=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(e,i),u=yield(0,h.createSmartRollupOriginateOperation)(Object.assign(Object.assign({},m({fee:t,storageLimit:r,gasLimit:s},a)),c)),l=yield this.addRevealOperationIfNeeded(u,e),f=this.convertIntoArray(l),d=yield this.getBlockHash(),p=yield this.getProtocolHash();o(this,n,{},"f");const b=parseInt(yield this.getHeadCounter(e),10);return{opOb:{branch:d,contents:this.constructOpContents(f,b,e,c.source),protocol:p},counter:b}}))}batch(e,t){return i(this,void 0,void 0,(function*(){const{pkh:r,publicKey:i}=yield this.getKeys(),s=yield this.context.readProvider.getProtocolConstants("head"),a=yield this.getAccountLimits(r,s,e.length),c=yield this.isRevealOpNeeded(e,r),f=[];if(t)for(const r of e)if((0,u.isOpWithFee)(r)){const e=t.shift(),n=m(r,{fee:e.suggestedFeeMutez,storageLimit:e.storageLimit,gasLimit:e.gasLimit});f.push(yield this.getRPCOp(Object.assign(Object.assign({},r),n)))}else f.push(Object.assign({},r));else for(const t of e)if((0,u.isOpWithFee)(t)){const e=m(t,a);f.push(yield this.getRPCOp(Object.assign(Object.assign({},t),e)))}else f.push(Object.assign({},t));if(c){if(!i)throw new d.PublicKeyNotFoundError(r);f.unshift(yield(0,h.createRevealOperation)({fee:l.DEFAULT_FEE.REVEAL,storageLimit:l.DEFAULT_STORAGE_LIMIT.REVEAL,gasLimit:(0,l.getRevealGasLimit)(r)},r,i))}const p=yield this.getBlockHash(),b=yield this.getProtocolHash();o(this,n,{},"f");const g=parseInt(yield this.getHeadCounter(r),10);return{opOb:{branch:p,contents:this.constructOpContents(f,g,r),protocol:b},counter:g}}))}contractCall(e){var t,r,s;return i(this,void 0,void 0,(function*(){const i=yield this.getBlockHash(),a=yield this.getProtocolHash(),{pkh:u}=yield this.getKeys();o(this,n,{},"f");const l=parseInt(yield this.getHeadCounter(u),10),f=e.toTransferParams(),d=yield this.context.readProvider.getProtocolConstants("head"),h=yield this.getAccountLimits(u,d),p=m({fee:f.fee,storageLimit:f.storageLimit,gasLimit:f.gasLimit},h),b={kind:c.OpKind.TRANSACTION,fee:null!==(t=f.fee)&&void 0!==t?t:p.fee,gas_limit:null!==(r=f.gasLimit)&&void 0!==r?r:p.gasLimit,storage_limit:null!==(s=f.storageLimit)&&void 0!==s?s:p.storageLimit,amount:String(f.amount),destination:f.to,parameters:f.parameter},g=yield this.addRevealOperationIfNeeded(b,u),v=this.convertIntoArray(g);return{opOb:{branch:i,contents:this.constructOpContents(v,l,u),protocol:a},counter:l}}))}toPreapply(e){return i(this,void 0,void 0,(function*(){const{opOb:{contents:t,branch:r,protocol:n}}=e,i=this.toForge(e),o=yield this.context.forger.forge(i);return[{contents:t,branch:r,protocol:n,signature:(yield this.context.signer.sign(o,new Uint8Array([3]))).prefixSig}]}))}toForge({opOb:{contents:e,branch:t}}){return{branch:t,contents:e}}}t.PrepareProvider=g,n=new WeakMap},6003:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnconfiguredSignerError=void 0;const n=r(227);class i extends n.TezosToolkitConfigError{constructor(){super(),this.name="UnconfiguredSignerError",this.message="No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance."}}t.UnconfiguredSignerError=i},1527:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1067:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoopSigner=void 0;const i=r(7591);t.NoopSigner=class{publicKey(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}publicKeyHash(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}secretKey(){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}sign(e,t){return n(this,void 0,void 0,(function*(){throw new i.UnconfiguredSignerError}))}}},552:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createObservableFromSubscription=void 0;const n=r(977);t.createObservableFromSubscription=function(e){return new n.Observable((t=>(e.on("data",(e=>{t.next(e)})),e.on("error",(e=>{t.error(e)})),e.on("close",(()=>{t.complete()})),()=>{e.close()})))}},3320:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidFilterExpressionError=t.UnsupportedEventError=void 0;const n=r(227);class i extends n.ParameterValidationError{constructor(e){super(),this.type=e,this.name="UnsupportedEventError",this.message=`Unsupported event type "${e}" expecting one of the "data", "error", or "close".`}}t.UnsupportedEventError=i;class o extends n.ParameterValidationError{constructor(e){super(),this.invalidExpression=e,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}t.InvalidFilterExpressionError=o},8176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFilter=t.evaluateExpression=t.evaluateOpFilter=t.eventFilter=void 0;const n=r(3320);t.eventFilter=(e,t,r,n)=>"event"===e.kind&&((!r||e.tag===r)&&((!t||e.source===t)&&(!n||"applied"===e.result.status)));t.evaluateOpFilter=(e,t)=>"opHash"in t?((e,t)=>e.hash===t.opHash)(e,t):"source"in t?((e,t)=>{switch(e.kind){case"attestation":case"endorsement":return"metadata"in e&&e.metadata.delegate===t.source;case"activate_account":return"metadata"in e&&e.pkh===t.source;default:return"source"in e&&e.source===t.source}})(e,t):"kind"in t?((e,t)=>"kind"in e&&e.kind===t.kind)(e,t):"destination"in t&&((e,t)=>{switch(e.kind){case"delegation":return e.delegate===t.destination;case"origination":if("metadata"in e&&"operation_result"in e.metadata&&"originated_contracts"in e.metadata.operation_result&&Array.isArray(e.metadata.operation_result.originated_contracts))return e.metadata.operation_result.originated_contracts.some((e=>e===t.destination));break;case"transaction":return e.destination===t.destination;default:return!1}})(e,t);t.evaluateExpression=(e,r)=>{if(Array.isArray(r.and))return r.and.every((r=>(0,t.evaluateFilter)(e,r)));if(Array.isArray(r.or))return r.or.some((r=>(0,t.evaluateFilter)(e,r)));throw new n.InvalidFilterExpressionError(r)};t.evaluateFilter=(e,r)=>{const n=[];return Array.isArray(r)?n.push(...r):n.push(r),n.every((r=>"and"in r||"or"in r?(0,t.evaluateExpression)(e,r):(0,t.evaluateOpFilter)(e,r)))}},440:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservableSubscription=t.UnsupportedEventError=void 0;const n=r(977),i=r(9002),o=r(3320);var s=r(3320);Object.defineProperty(t,"UnsupportedEventError",{enumerable:!0,get:function(){return s.UnsupportedEventError}});t.ObservableSubscription=class{constructor(e,t=!1,r=(0,i.retry)()){this.shouldRetry=t,this.operatorFunction=r,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new n.Subject,e.pipe((0,i.takeUntil)(this.completed$),(0,i.tap)((e=>{this.call(this.messageListeners,e)}),(e=>{this.call(this.errorListeners,e)}),(()=>{this.call(this.closeListeners)})),this.shouldRetry?r:(0,i.tap)(),(0,i.catchError)((()=>n.NEVER))).subscribe()}call(e,t){for(const r of e)try{r(t)}catch(e){console.error(e)}}remove(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}on(e,t){switch(e){case"data":this.messageListeners.push(t);break;case"error":this.errorListeners.push(t);break;case"close":this.closeListeners.push(t);break;default:throw new o.UnsupportedEventError(e)}}off(e,t){switch(e){case"data":this.remove(this.messageListeners,t);break;case"error":this.remove(this.errorListeners,t);break;case"close":this.remove(this.closeListeners,t);break;default:throw new o.UnsupportedEventError(e)}}close(){this.completed$.next()}}},5032:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PollingSubscribeProvider=t.defaultConfigStreamer=void 0;const i=r(977),o=r(9002),s=r(8176),a=r(4435),c=r(6391);t.defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:(0,o.retry)()};t.PollingSubscribeProvider=class{constructor(e,r={}){this.context=e,this._config$=new i.BehaviorSubject(Object.assign(Object.assign({},t.defaultConfigStreamer),r)),this.timer$=this._config$.pipe((0,o.pluck)("pollingIntervalMilliseconds"),(0,o.switchMap)((e=>e?(0,i.timer)(0,e):(0,i.from)(this.getConfirmationPollingInterval()).pipe((0,o.switchMap)((e=>(0,i.timer)(0,e))))))),this.newBlock$=this.timer$.pipe((0,o.switchMap)((()=>(e=>(0,i.from)(e.rpc.getBlock()).pipe((0,o.first)()))(this.context))),(0,o.distinctUntilKeyChanged)("hash"),(0,o.publish)(),(0,o.refCount)())}get config(){return this._config$.getValue()}getConfirmationPollingInterval(){return n(this,void 0,void 0,(function*(){if(!this.config.pollingIntervalMilliseconds){const e=5e3,t=1e3;try{const r=yield this.context.readProvider.getProtocolConstants("head"),n=(r.minimal_block_delay?r.minimal_block_delay.multipliedBy(1e3):r.time_between_blocks?r.time_between_blocks[0].multipliedBy(1e3):new c.default(e)).dividedBy(3);this.config.pollingIntervalMilliseconds=0===n.toNumber()?t:n.toNumber()}catch(t){return e}}return this.config.pollingIntervalMilliseconds}))}subscribeBlock(e){return new a.ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(e){return new a.ObservableSubscription(this.newBlock$.pipe((0,o.pluck)("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(e){return new a.ObservableSubscription(this.newBlock$.pipe((e=>(0,o.concatMap)((t=>new i.Observable((r=>{for(const n of t.operations)for(const t of n)for(const n of t.contents)(0,s.evaluateFilter)(Object.assign({hash:t.hash},n),e)&&r.next(Object.assign({hash:t.hash},n));r.complete()})))))(e)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(e){return new a.ObservableSubscription(this.newBlock$.pipe((t=e,(0,o.concatMap)((e=>new i.Observable((r=>{for(const n of e.operations)for(const i of n)for(const n of i.contents){const o=n.metadata.internal_operation_results;if(o)for(const n of o)(0,s.eventFilter)(n,null==t?void 0:t.address,null==t?void 0:t.tag,null==t?void 0:t.excludeFailedOperations)&&r.next(Object.assign({opHash:i.hash,blockHash:e.hash,level:e.header.level},n))}r.complete()})))))),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction);var t}}},2353:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.TezosToolkit=t.TaquitoLocalForger=t.RpcReadAdapter=t.ObservableSubscription=t.PollingSubscribeProvider=t.OperationBatch=t.RpcForger=t.CompositeForger=t.UnitValue=t.MichelsonMap=void 0;const o=r(6368),s=r(4984),a=r(4632),c=r(9494),u=r(6395),l=r(259),f=r(1067),d=r(5032),h=r(8023),p=r(635),b=r(6713),m=r(5286),g=r(5744);var v=r(8899);Object.defineProperty(t,"MichelsonMap",{enumerable:!0,get:function(){return v.MichelsonMap}}),Object.defineProperty(t,"UnitValue",{enumerable:!0,get:function(){return v.UnitValue}}),i(r(4593),t),i(r(4984),t),i(r(238),t),i(r(5225),t);var y=r(7336);Object.defineProperty(t,"CompositeForger",{enumerable:!0,get:function(){return y.CompositeForger}});var _=r(794);Object.defineProperty(t,"RpcForger",{enumerable:!0,get:function(){return _.RpcForger}}),i(r(3323),t);var w=r(150);Object.defineProperty(t,"OperationBatch",{enumerable:!0,get:function(){return w.OperationBatch}}),i(r(1527),t),i(r(440),t);var E=r(5032);Object.defineProperty(t,"PollingSubscribeProvider",{enumerable:!0,get:function(){return E.PollingSubscribeProvider}});var O=r(4435);Object.defineProperty(t,"ObservableSubscription",{enumerable:!0,get:function(){return O.ObservableSubscription}}),i(r(4946),t),i(r(635),t),i(r(134),t),i(r(5744),t),i(r(9813),t),i(r(5286),t),i(r(3259),t),i(r(4762),t),i(r(9406),t),i(r(6395),t),i(r(5505),t),i(r(3739),t),i(r(3171),t);var A=r(259);Object.defineProperty(t,"RpcReadAdapter",{enumerable:!0,get:function(){return A.RpcReadAdapter}}),i(r(8794),t);var S=r(6713);Object.defineProperty(t,"TaquitoLocalForger",{enumerable:!0,get:function(){return S.TaquitoLocalForger}}),i(r(3793),t);t.TezosToolkit=class{constructor(e){this._rpc=e,this._options={},this.format=a.format,"string"==typeof this._rpc?this._rpcClient=new o.RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new s.Context(e),this._wallet=new p.Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:e,stream:t,signer:r,protocol:n,config:i,forger:o,wallet:s,packer:a,globalConstantsProvider:c,readProvider:u,parserProvider:l,injectorProvider:f}){this.setRpcProvider(e),this.setStreamProvider(t),this.setSignerProvider(r),this.setForgerProvider(o),this.setWalletProvider(s),this.setPackerProvider(a),this.setGlobalConstantsProvider(c),this.setReadProvider(u),this.setParserProvider(l),this.setInjectorProvider(f),this._context.proto=n,i&&this._context.setPartialConfig(i)}setSignerProvider(e){this._options.signer||void 0!==e?void 0!==e&&(this._context.signer=e,this._options.signer=e):(this._context.signer=new f.NoopSigner,this._options.signer=e)}setRpcProvider(e){"string"==typeof e?this._rpcClient=new o.RpcClient(e):void 0===e||(this._rpcClient=e),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(e){if(void 0!==e)this._options.forger=e,this._context.forger=e;else if(void 0===this._options.forger){const e=this.getFactory(b.TaquitoLocalForger)();this._options.forger=e,this._context.forger=e}}setStreamProvider(e){if("string"==typeof e){const t=new d.PollingSubscribeProvider(new s.Context(new o.RpcClient(e)));this._options.stream=t,this._context.stream=t}else if(void 0!==e)this._options.stream=e,this._context.stream=e;else if(void 0===this._options.stream){const e=this.getFactory(d.PollingSubscribeProvider)();this._options.stream=e,this._context.stream=e}}setWalletProvider(e){if(this._options.wallet||void 0!==e)void 0!==e&&(this._options.wallet=e,this._context.walletProvider=e);else{const e=this.getFactory(p.LegacyWalletProvider)();this._options.wallet=e,this._context.walletProvider=e}}setPackerProvider(e){if(this._options.packer||void 0!==e)void 0!==e&&(this._context.packer=e,this._options.packer=e);else{const e=this.getFactory(u.RpcPacker)();this._context.packer=e,this._options.packer=e}}setGlobalConstantsProvider(e){if(this._options.globalConstantsProvider||void 0!==e)void 0!==e&&(this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e);else{const e=new c.NoopGlobalConstantsProvider;this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e}}setReadProvider(e){const t=e||new l.RpcReadAdapter(this._context.rpc);this._options.readProvider=t,this._context.readProvider=t}setParserProvider(e){if(this._options.parserProvider||void 0!==e)void 0!==e&&(this._context.parser=e,this._options.parserProvider=e);else{const e=new m.MichelCodecParser(this._context);this._context.parser=e,this._options.parserProvider=e}}setInjectorProvider(e){if(this._options.injectorProvider||void 0!==e)void 0!==e&&(this._context.injector=e,this._options.injectorProvider=e);else{const e=new g.RpcInjector(this._context);this._context.injector=e,this._options.injectorProvider=e}}get tz(){return this._context.tz}get contract(){return this._context.contract}get prepare(){return this._context.prepare}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}get globalConstants(){return this._context.globalConstantsProvider}addExtension(e){Array.isArray(e)?e.forEach((e=>e.configureContext(this._context))):e.configureContext(this._context)}getFactory(e){return(...t)=>new e(this._context,...t)}getVersionInfo(){return h.VERSION}}},4946:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},992:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RpcTzProvider=void 0;const i=r(7525),o=r(4632),s=r(227),a=r(6003),c=r(3793);class u extends a.Provider{constructor(e){super(e),this.prepare=new c.PrepareProvider(this.context)}getBalance(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t));return this.context.readProvider.getBalance(e,"head")}))}getDelegate(e){return n(this,void 0,void 0,(function*(){const t=(0,o.validateAddress)(e);if(t!==o.ValidationResult.VALID)throw new s.InvalidAddressError(e,(0,o.invalidDetail)(t));return this.context.readProvider.getDelegate(e,"head")}))}activate(e,t){return n(this,void 0,void 0,(function*(){const r=(0,o.validateKeyHash)(e);if(r!==o.ValidationResult.VALID)throw new o.InvalidKeyHashError(e,(0,o.invalidDetail)(r));const n=yield this.prepare.activate({pkh:e,secret:t}),s=yield this.forge(n),a=`${s.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new i.Operation(yield this.rpc.injectOperation(a),Object.assign(Object.assign({},s),{opbytes:a}),[],this.context.clone())}))}}t.RpcTzProvider=u},8023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,t.VERSION={commitHash:"13a12ab7cf442043526745db2bbf4ef3b089c34a",version:"19.0.2"}},1626:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BatchWalletOperation=void 0;const i=r(6368),o=r(150),s=r(807),a=r(2809),c=r(2323);class u extends a.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t,this.getOriginatedContractAddresses=()=>n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e){const t=e.filter((e=>"origination"===e.kind));let r=[];for(const e of t)e.metadata.operation_result.originated_contracts&&(r=[...r,...e.metadata.operation_result.originated_contracts]);return r}throw new c.ObservableError("Unable to fetch operation results")}))}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.REVEAL));throw new c.ObservableError("Unable to fetch operation results")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.operationResults();if(e)return e.filter((e=>-1!==o.BATCH_KINDS.indexOf(e.kind))).map((e=>{if((0,s.hasMetadataWithResult)(e)){return e.metadata.operation_result.status}return"unknown"}))[0]||"unknown";throw new c.ObservableError("Unable to fetch operation results")}))}}t.BatchWalletOperation=u},4364:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DelegationWalletOperation=void 0;const i=r(6368),o=r(2809),s=r(2323);class a extends o.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.REVEAL));throw new s.ObservableError("Unable to fetch operation result")}))}delegationOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===i.OpKind.DELEGATION));throw new s.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.delegationOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.DelegationWalletOperation=a},2323:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservableError=t.ConfirmationUndefinedError=void 0;const n=r(227);class i extends n.TezosToolkitConfigError{constructor(){super(),this.name="ConfirmationUndefinedError",this.message="Default confirmation count can not be undefined"}}t.ConfirmationUndefinedError=i;class o extends n.NetworkError{constructor(e){super(),this.message=e,this.name="ObservableError"}}t.ObservableError=o},7832:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.IncreasePaidStorageWalletOperation=void 0;const i=r(2809),o=r(6368),s=r(2323);class a extends i.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===o.OpKind.REVEAL));throw new s.ObservableError("Unable to fetch operation result")}))}increasePaidStorageOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return e.find((e=>e.kind===o.OpKind.INCREASE_PAID_STORAGE));throw new s.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.increasePaidStorageOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.IncreasePaidStorageWalletOperation=a},635:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5277),t),i(r(2809),t),i(r(4685),t),i(r(7654),t),i(r(4364),t),i(r(7432),t),i(r(8562),t)},7432:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8562:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyWalletProvider=void 0;const i=r(807);t.LegacyWalletProvider=class{constructor(e){this.context=e}getPKH(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKeyHash()}))}getPK(){return n(this,void 0,void 0,(function*(){return this.context.signer.publicKey()}))}mapTransferParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.TRANSACTION)}))}mapOriginateParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.ORIGINATION)}))}mapDelegateParamsToWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.DELEGATION)}))}mapIncreasePaidStorageWalletParams(e){return n(this,void 0,void 0,(function*(){return(0,i.attachKind)(yield e(),i.OpKind.INCREASE_PAID_STORAGE)}))}sendOperations(e){return n(this,void 0,void 0,(function*(){return(yield this.context.batch.batch(e).send()).hash}))}sign(e,t){return n(this,void 0,void 0,(function*(){const{prefixSig:r}=yield this.context.signer.sign(e,t);return r}))}}},8286:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OperationFactory=t.createNewPollingBasedHeadObservable=t.timeoutAfter=void 0;const i=r(977),o=r(9002),s=r(552),a=r(1626),c=r(4364),u=r(7832),l=r(2809),f=r(7654),d=r(4685),h=r(7642);function p(e){return function(t){return new i.BehaviorSubject(null).pipe((0,o.timeout)({each:e,with:()=>(0,i.throwError)((()=>new h.ConfirmationTimeoutError("Confirmation polling timed out")))}),(0,o.mergeMap)((()=>t)))}}t.timeoutAfter=p;t.createNewPollingBasedHeadObservable=(e,t,r)=>e.pipe(p(1e3*t.config.confirmationPollingTimeoutSecond),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1}));t.OperationFactory=class{constructor(e){this.context=e,this.sharedHeadObs=(0,i.defer)((()=>(0,s.createObservableFromSubscription)(this.context.stream.subscribeBlock("head"))))}createNewHeadObservable(){return n(this,void 0,void 0,(function*(){return(0,t.createNewPollingBasedHeadObservable)(this.sharedHeadObs,this.context)}))}createPastBlockWalker(e,t=1){return(0,i.from)(this.context.readProvider.getBlock(e)).pipe((0,o.switchMap)((e=>1===t?(0,i.of)(e):(0,i.range)(e.header.level,t-1).pipe((0,o.startWith)(e),(0,o.concatMap)((e=>n(this,void 0,void 0,(function*(){return this.context.readProvider.getBlock("number"==typeof e?e:e.header.level)}))))))))}createHeadObservableFromConfig({blockIdentifier:e}){return n(this,void 0,void 0,(function*(){const t=[];return e&&t.push(this.createPastBlockWalker(e)),t.push(yield this.createNewHeadObservable()),(0,i.concat)(...t)}))}createOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new l.WalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createBatchOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new a.BatchWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createTransactionOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new d.TransactionWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createDelegationOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new c.DelegationWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createOriginationOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new f.OriginationWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}createIncreasePaidStorageOperation(e,t={}){return n(this,void 0,void 0,(function*(){return new u.IncreasePaidStorageWalletOperation(e,this.context.clone(),yield this.createHeadObservableFromConfig(t))}))}}},2809:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.WalletOperation=void 0;const i=r(977),o=r(9002),s=r(6298),a=r(4632),c=r(7642),u=r(2323),l=r(227);t.WalletOperation=class{operationResults(){return n(this,void 0,void 0,(function*(){return this._operationResult.pipe((0,o.first)()).toPromise()}))}receipt(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new u.ObservableError("Unable to get operation results");return(0,s.receiptFromOperation)(e)}))}constructor(e,t,r){if(this.opHash=e,this.context=t,this._newHead$=r,this._operationResult=new i.ReplaySubject(1),this._includedInBlock=new i.ReplaySubject(1),this._included=!1,this.newHead$=this._newHead$.pipe((0,o.switchMap)((e=>{var t,r;const n=null!==(r=null===(t=this.lastHead)||void 0===t?void 0:t.header.level)&&void 0!==r?r:e.header.level-1;return(0,i.range)(n+1,e.header.level-n-1).pipe((0,o.concatMap)((e=>this.context.readProvider.getBlock(e))),(0,o.endWith)(e))})),(0,o.tap)((e=>this.lastHead=e)),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),this.confirmed$=this.newHead$.pipe((0,o.map)((e=>{for(const t of e.operations)for(const r of t)if(r.hash===this.opHash)return this._included=!0,this._includedInBlock.next(e),this._operationResult.next(r.contents),e})),(0,o.filter)((e=>void 0!==e)),(0,o.first)(),(0,o.share)({connector:()=>new i.ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1})),(0,a.validateOperation)(this.opHash)!==a.ValidationResult.VALID)throw new l.InvalidOperationHashError(this.opHash);this.confirmed$.pipe((0,o.first)(),(0,o.catchError)((()=>(0,i.of)(void 0)))).subscribe()}getCurrentConfirmation(){return n(this,void 0,void 0,(function*(){return this._included?(0,i.combineLatest)([this._includedInBlock,(0,i.from)(this.context.readProvider.getBlock("head"))]).pipe((0,o.map)((([e,t])=>t.header.level-e.header.level+1)),(0,o.first)()).toPromise():0}))}isInCurrentBranch(e="head"){return n(this,void 0,void 0,(function*(){if(!this._included)return!0;const t=yield this.context.readProvider.getBlockLevel(e),r=yield this._includedInBlock.pipe((0,o.first)()).toPromise();if(!r)throw new u.ObservableError("Inclusion block is undefined");const n=t-r.header.level;if(n<=0)return!0;const i=Math.min(r.header.level+n,r.header.level+60);return new Set(yield this.context.readProvider.getLiveBlocks(i)).has(r.hash)}))}confirmationObservable(e){if(void 0!==e&&e<1)throw new c.InvalidConfirmationCountError(e);const{defaultConfirmationCount:t}=this.context.config,r=void 0!==e?e:t;if(void 0===r)throw new u.ConfirmationUndefinedError;return(0,i.combineLatest)([this._includedInBlock,this.newHead$]).pipe((0,o.distinctUntilChanged)((([,e],[,t])=>e.hash===t.hash)),(0,o.map)((([e,t])=>({block:t,expectedConfirmation:r,currentConfirmation:t.header.level-e.header.level+1,completed:t.header.level-e.header.level>=r-1,isInCurrentBranch:()=>this.isInCurrentBranch(t.hash)}))),(0,o.takeWhile)((({completed:e})=>!e),!0))}confirmation(e){return this.confirmationObservable(e).toPromise()}}},7654:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OriginationWalletOperation=void 0;const i=r(6368),o=r(807),s=r(2809),a=r(2323);class c extends s.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}originationOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return(0,o.findWithKind)(e,i.OpKind.ORIGINATION);throw new a.ObservableError("Unable to fetch operation result")}))}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(e)return(0,o.findWithKind)(e,i.OpKind.REVEAL);throw new a.ObservableError("Unable to fetch operation result")}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.originationOperation();return e?e.metadata.operation_result.status:"unknown"}))}contract(){return n(this,void 0,void 0,(function*(){const e=yield this.originationOperation(),t=((null==e?void 0:e.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at(t)}))}}t.OriginationWalletOperation=c},6298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.receiptFromOperation=void 0;const n=r(6391),i=r(4593),o=r(835);t.receiptFromOperation=(e,{ALLOCATION_BURN:t,ORIGINATION_BURN:r}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{n.default.config({DECIMAL_PLACES:0,ROUNDING_MODE:n.default.ROUND_UP});const s=(0,o.flattenOperationResult)({contents:e});let a=new n.default(0),c=new n.default(0),u=new n.default(0),l=new n.default(0),f=new n.default(0),d=new n.default(0);return s.forEach((e=>{u=u.plus(e.fee||0),l=l.plus(Array.isArray(e.originated_contracts)?e.originated_contracts.length*r:0),f=f.plus("allocated_destination_contract"in e?t:0),a=a.plus(e.consumed_milligas||0),d=d.plus("paid_storage_size_diff"in e&&Number(e.paid_storage_size_diff)||0)})),c=c.plus(f).plus(l).plus(d),{totalFee:u,totalMilliGas:a,totalGas:a.dividedBy(1e3),totalStorage:c,totalAllocationBurn:f,totalOriginationBurn:l,totalPaidStorageDiff:d,totalStorageBurn:new n.default(c.multipliedBy(i.COST_PER_BYTE))}}},4685:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionWalletOperation=void 0;const i=r(2809),o=r(6368),s=r(2323);class a extends i.WalletOperation{constructor(e,t,r){super(e,t,r),this.opHash=e,this.context=t}revealOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new s.ObservableError("operationResult returned undefined");return e.find((e=>e.kind===o.OpKind.REVEAL))}))}transactionOperation(){return n(this,void 0,void 0,(function*(){const e=yield this.operationResults();if(!e)throw new s.ObservableError("operationResult returned undefined");return e.find((e=>e.kind===o.OpKind.TRANSACTION))}))}status(){return n(this,void 0,void 0,(function*(){if(!this._included)return"pending";const e=yield this.transactionOperation();return e?e.metadata.operation_result.status:"unknown"}))}}t.TransactionWalletOperation=a},5277:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Wallet=t.WalletOperationBatch=void 0;const i=r(238),o=r(807),s=r(227),a=r(4632);class c{constructor(e,t){this.walletProvider=e,this.context=t,this.operations=[]}withTransfer(e){const t=(0,a.validateAddress)(e.to);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:o.OpKind.TRANSACTION},e)),this}withContractCall(e,t={}){return this.withTransfer(e.toTransferParams(t))}withDelegation(e){var t;const r=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&r!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.delegate,(0,a.invalidDetail)(r));return this.operations.push(Object.assign({kind:o.OpKind.DELEGATION},e)),this}withOrigination(e){return this.operations.push(Object.assign({kind:o.OpKind.ORIGINATION},e)),this}withIncreasePaidStorage(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.operations.push(Object.assign({kind:o.OpKind.INCREASE_PAID_STORAGE},e)),this}mapOperation(e){return n(this,void 0,void 0,(function*(){switch(e.kind){case o.OpKind.TRANSACTION:return this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));case o.OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},e))}))));case o.OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));case o.OpKind.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams((()=>n(this,void 0,void 0,(function*(){return e}))));default:throw new s.InvalidOperationKindError(JSON.stringify(e.kind))}}))}with(e){for(const t of e)switch(t.kind){case o.OpKind.TRANSACTION:this.withTransfer(t);break;case o.OpKind.ORIGINATION:this.withOrigination(t);break;case o.OpKind.DELEGATION:this.withDelegation(t);break;case o.OpKind.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(t);break;default:throw new s.InvalidOperationKindError(JSON.stringify(t.kind))}return this}send(){return n(this,void 0,void 0,(function*(){const e=[];for(const t of this.operations)e.push(yield this.mapOperation(t));const t=yield this.walletProvider.sendOperations(e);return this.context.operationFactory.createBatchOperation(t)}))}}t.WalletOperationBatch=c;t.Wallet=class{constructor(e){this.context=e,this.walletCommand=e=>({send:e})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:e}={}){return n(this,void 0,void 0,(function*(){return this._pkh&&!e||(this._pkh=yield this.walletProvider.getPKH()),this._pkh}))}pk({forceRefetch:e}={}){return n(this,void 0,void 0,(function*(){return this._pk&&!e||(this._pk=yield this.walletProvider.getPK()),this._pk}))}originate(e){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapOriginateParamsToWalletParams((()=>this.context.parser.prepareCodeOrigination(Object.assign({},e)))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createOriginationOperation(r)}))))}setDelegate(e){var t;const r=(0,a.validateAddress)(null!==(t=e.delegate)&&void 0!==t?t:"");if(e.delegate&&r!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.delegate,(0,a.invalidDetail)(r));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createDelegationOperation(r)}))))}signFailingNoop(e){return n(this,void 0,void 0,(function*(){const t={kind:o.OpKind.FAILING_NOOP,arbitrary:e.arbitrary},r=yield this.context.readProvider.getBlockHash(e.basedOnBlock),n=yield this.context.forger.forge({branch:r,contents:[t]});return{signature:yield this.walletProvider.sign(n,Uint8Array.from([3])),bytes:n,signedContent:{branch:r,contents:[{kind:o.OpKind.FAILING_NOOP,arbitrary:e.arbitrary}]}}}))}registerDelegate(){return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const e=yield this.walletProvider.mapDelegateParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return{delegate:yield this.pkh()}})))),t=yield this.walletProvider.sendOperations([e]);return this.context.operationFactory.createDelegationOperation(t)}))))}transfer(e){const t=(0,a.validateAddress)(e.to);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.to,(0,a.invalidDetail)(t));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapTransferParamsToWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createTransactionOperation(r)}))))}increasePaidStorage(e){const t=(0,a.validateAddress)(e.destination);if(t!==a.ValidationResult.VALID)throw new s.InvalidAddressError(e.destination,(0,a.invalidDetail)(t));return this.walletCommand((()=>n(this,void 0,void 0,(function*(){const t=yield this.walletProvider.mapIncreasePaidStorageWalletParams((()=>n(this,void 0,void 0,(function*(){return e})))),r=yield this.walletProvider.sendOperations([t]);return this.context.operationFactory.createIncreasePaidStorageOperation(r)}))))}batch(e){const t=new c(this.walletProvider,this.context);return Array.isArray(e)&&t.with(e),t}at(e,t=(e=>e)){return n(this,void 0,void 0,(function*(){const r=(0,a.validateContractAddress)(e);if(r!==a.ValidationResult.VALID)throw new s.InvalidContractAddressError(e,(0,a.invalidDetail)(r));const n=this.context.withExtensions().rpc,o=this.context.withExtensions().readProvider,c=yield o.getScript(e,"head"),u=yield o.getEntrypoints(e),l=new i.ContractAbstraction(e,c,this,this.context.contract,u,n,o);return t(l,this.context)}))}getPK(){return n(this,void 0,void 0,(function*(){return yield this.pk()}))}}},5477:()=>{},3196:()=>{},8087:()=>{},2558:(e,t,r)=>{"use strict";r.d(t,{O:()=>w,Z:()=>E});var n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function b(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function g(e,t,r,n){if(er||e!==o(e))throw Error(s+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function v(e){var t=e.c.length-1;return p(e.e/u)==t&&e.c[t]%2!=0}function y(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?b.c=b.e=null:e.e=10;f/=10,c++);return void(c>D?b.c=b.e=null:(b.e=c,b.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return E(b,p,d);b.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(c<0&&(c=f),c+=+p.slice(f+1),p=p.substring(0,f)):c<0&&(c=p.length)}else{if(g(t,2,H.length,"Base"),10==t&&G)return W(b=new $(e),k+b.e+1,L);if(p=String(e),d="number"==typeof e){if(0*e!=0)return E(b,p,d,t);if(b.s=1/e<0?(p=p.slice(1),-1):1,$.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else b.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=H.slice(0,t),c=f=0,h=p.length;fc){c=h;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,f=-1,c=0;continue}return E(b,String(e),d,t)}d=!1,(c=(p=w(p,t,10,b.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(f=0;48===p.charCodeAt(f);f++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(f,++h)){if(h-=f,d&&$.DEBUG&&h>15&&(e>l||e!==o(e)))throw Error(a+b.s*e);if((c=c-f-1)>D)b.c=b.e=null;else if(c=C)?y(c,s):_(c,s,"0");else if(o=(e=W(new $(e),t,r)).e,a=(c=b(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function z(e,t){for(var r,n,i=1,o=new $(e[0]);i=10;i/=10,n++);return(r=n+r*u-1)>D?e.c=e.e=null:r=10;d/=10,s++);if((a=t-s)<0)a+=u,l=t,h=m[p=0],b=o(h/g[s-l-1]%10);else if((p=i((a+1)/u))>=m.length){if(!n)break e;for(;m.length<=p;m.push(0));h=b=0,s=1,l=(a%=u)-u+1}else{for(h=d=m[p],s=1;d>=10;d/=10,s++);b=(l=(a%=u)-u+s)<0?0:o(h/g[s-l-1]%10)}if(n=n||t<0||null!=m[p+1]||(l<0?h:h%g[s-l-1]),n=r<4?(b||n)&&(0==r||r==(e.s<0?3:2)):b>5||5==b&&(4==r||n||6==r&&(a>0?l>0?h/g[s-l]:0:m[p-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(u-t%u)%u],e.e=-t||0):m[0]=e.e=0,e;if(0==a?(m.length=p,d=1,p--):(m.length=p+1,d=g[u-a],m[p]=l>0?o(h/g[s-l]%g[l])*d:0),n)for(;;){if(0==p){for(a=1,l=m[0];l>=10;l/=10,a++);for(l=m[0]+=d,d=1;l>=10;l/=10,d++);a!=d&&(e.e++,m[0]==c&&(m[0]=1));break}if(m[p]+=d,m[p]!=c)break;m[p--]=0,d=1}for(a=m.length;0===m[--a];m.pop());}e.e>D?e.c=e.e=null:e.e=C?y(t,r):_(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(g(r=e[t],0,h,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(g(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(g(r[0],-h,0,t),g(r[1],0,h,t),N=r[0],C=r[1]):(g(r,-h,h,t),N=-(C=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)g(r[0],-h,-1,t),g(r[1],1,h,t),j=r[0],D=r[1];else{if(g(r,-h,h,t),!r)throw Error(s+t+" cannot be zero: "+r);j=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw U=!r,Error(s+"crypto unavailable");U=r}else U=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(g(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(g(r=e[t],0,h,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);G="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,C],RANGE:[j,D],CRYPTO:U,MODULO_MODE:B,POW_PRECISION:F,FORMAT:K,ALPHABET:H}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-h&&i<=h&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t=c||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return z(arguments,-1)},$.minimum=$.min=function(){return z(arguments,1)},$.random=(O=9007199254740992,A=Math.random()*O&2097151?function(){return o(Math.random()*O)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,a,c,l=0,d=[],p=new $(M);if(null==e?e=k:g(e,0,h),a=i(e/u),U)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(a*=2));l>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(d.push(c%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw U=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(a*=7);l=9e15?crypto.randomBytes(7).copy(t,l):(d.push(c%1e14),l+=7);l=a/7}if(!U)for(;l=10;c/=10,l++);lr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,f,d,h,p,m,g=n.indexOf("."),v=k,y=L;for(g>=0&&(f=F,F=0,n=n.replace(".",""),h=(m=new $(i)).pow(n.length-g),F=f,m.c=t(_(b(h.c),h.e,"0"),10,o,e),m.e=m.c.length),l=f=(p=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(g<0?--l:(h.c=p,h.e=l,h.s=s,p=(h=r(h,m,v,y,o)).c,d=h.r,l=h.e),g=p[u=l+v+1],f=o/2,d=d||u<0||null!=p[u+1],d=y<4?(null!=g||d)&&(0==y||y==(h.s<0?3:2)):g>f||g==f&&(4==y||d||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])n=d?_(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(f=p.length;!p[--f];);for(g=0,n="";g<=f;n+=c.charAt(p[g++]));n=_(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%d,l=t/d|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%d)+(n=l*o+(s=e[c]/d|0)*u)%d*d+a)/r|0)+(n/d|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,s,a,l){var f,d,h,b,m,g,v,y,_,w,E,O,A,S,P,T,I,R=n.s==i.s?1:-1,x=n.c,M=i.c;if(!(x&&x[0]&&M&&M[0]))return new $(n.s&&i.s&&(x?!M||x[0]!=M[0]:M)?x&&0==x[0]||!M?0*R:R/0:NaN);for(_=(y=new $(R)).c=[],R=s+(d=n.e-i.e)+1,l||(l=c,d=p(n.e/u)-p(i.e/u),R=R/u|0),h=0;M[h]==(x[h]||0);h++);if(M[h]>(x[h]||0)&&d--,R<0)_.push(1),b=!0;else{for(S=x.length,T=M.length,h=0,R+=2,(m=o(l/(M[0]+1)))>1&&(M=e(M,m,l),x=e(x,m,l),T=M.length,S=x.length),A=T,E=(w=x.slice(0,T)).length;E=l/2&&P++;do{if(m=0,(f=t(M,w,T,E))<0){if(O=w[0],T!=E&&(O=O*l+(w[1]||0)),(m=o(O/P))>1)for(m>=l&&(m=l-1),v=(g=e(M,m,l)).length,E=w.length;1==t(g,w,v,E);)m--,r(g,T=10;R/=10,h++);W(y,s+(y.e=h+d*u-1)+1,a,b)}else y.e=d,y.r=+b;return y}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,T=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(P,"$1").replace(T,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return m(this,new $(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return g(e,0,h),null==t?t=L:g(t,0,8),W(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-p(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new $(e,t),k,L)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new $(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,a,c,l,f,d,h,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+Z(e));if(null!=t&&(t=new $(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Z(p),l?e.s*(2-v(e)):+Z(e))),t?h.mod(t):h;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&v(e)?-0:0,p.e>-1&&(c=1/c),new $(f?1/c:c);F&&(c=i(F/u+2))}for(l?(r=new $(.5),f&&(e.s=1),d=v(e)):d=(a=Math.abs(+Z(e)))%2,h=new $(M);;){if(d){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):n&&(h=h.mod(t))}if(a){if(0===(a=o(a/2)))break;d=a%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)d=v(e);else{if(0===(a=+Z(e)))break;d=a%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):n&&(p=p.mod(t))}return n?h:(f&&(h=M.div(h)),t?h.mod(t):c?W(h,F,L,undefined):h)},x.integerValue=function(e){var t=new $(this);return null==e?e=L:g(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===m(this,new $(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return m(this,new $(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=m(this,new $(e,t)))||0===t},x.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return m(this,new $(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=m(this,new $(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/u,f=e.e/u,d=s.c,h=e.c;if(!l||!f){if(!d||!h)return d?(e.s=-t,e):new $(h?s:NaN);if(!d[0]||!h[0])return h[0]?(e.s=-t,e):new $(d[0]?s:3==L?-0:0)}if(l=p(l),f=p(f),d=d.slice(),a=l-f){for((o=a<0)?(a=-a,i=d):(f=l,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=d.length)<(t=h.length))?a:t,a=t=0;t0)for(;t--;d[r++]=0);for(t=c-1;n>a;){if(d[--n]=0;){for(r=0,m=O[i]%_,g=O[i]/_|0,o=i+(s=l);o>i;)r=((f=m*(f=E[--s]%_)+(a=g*f+(h=E[s]/_|0)*m)%_*_+v[o]+r)/y|0)+(a/_|0)+g*h,v[o--]=f%y;v[o]=r}return r?++n:v.splice(0,1),q(e,v,n)},x.negated=function(){var e=new $(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/u,s=e.e/u,a=n.c,l=e.c;if(!o||!s){if(!a||!l)return new $(i/0);if(!a[0]||!l[0])return l[0]?e:new $(a[0]?n:0*i)}if(o=p(o),s=p(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=l):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=l.length)<0&&(r=l,l=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/c|0,a[t]=c===a[t]?0:a[t]%c;return i&&(a=[i].concat(a),++s),q(e,a,s)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return g(e,1,h),null==t?t=L:g(t,0,8),W(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return g(e,-9007199254740991,l),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=k+4,f=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Z(s)))||c==1/0?(((t=b(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),n=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new $(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(s,o,l,1))),b(o.c).slice(0,c)===(t=b(n.c)).slice(0,c)){if(n.e0&&b>0){for(o=b%c||c,f=p.substr(0,o);o0&&(f+=l+p.slice(o)),h&&(f="-"+f)}n=d?f+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,a,c,l,d,h,p,m,g,v=this,y=v.c;if(null!=e&&(!(l=new $(e)).isInteger()&&(l.c||1!==l.s)||l.lt(M)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Z(l));if(!y)return new $(v);for(t=new $(M),h=n=new $(M),i=d=new $(M),g=b(y),a=t.e=g.length-v.e-1,t.c[0]=f[(c=a%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?a>0?t:h:l,c=D,D=1/0,l=new $(g),d.c[0]=0;p=r(l,t,0,1),1!=(o=n.plus(p.times(i))).comparedTo(e);)n=i,i=o,h=d.plus(p.times(o=h)),d=o,t=l.minus(p.times(o=t)),l=o;return o=r(e.minus(n),i,0,1),d=d.plus(o.times(h)),n=n.plus(o.times(i)),d.s=h.s=v.s,m=r(h,i,a*=2,L).minus(v).abs().comparedTo(r(d,n,a,L).minus(v).abs())<1?[h,i]:[d,n],D=c,m},x.toNumber=function(){return+Z(this)},x.toPrecision=function(e,t){return null!=e&&g(e,1,h),V(this,e,t,2)},x.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=N||i>=C?y(b(r.c),i):_(b(r.c),i,"0"):10===e&&G?t=_(b((r=W(new $(r),k+i+1,L)).c),r.e,"0"):(g(e,2,H.length,"Base"),t=w(_(b(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return Z(this)},x._isBigNumber=!0,x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf,null!=t&&$.set(t),$}();const E=w},763:e=>{"use strict";e.exports={i8:"6.5.4"}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r(2353)})())); -\ No newline at end of file -diff --git a/node_modules/@taquito/taquito/dist/taquito.min.js.LICENSE.txt b/node_modules/@taquito/taquito/dist/taquito.min.js.LICENSE.txt -deleted file mode 100644 -index c019e0e..0000000 ---- a/node_modules/@taquito/taquito/dist/taquito.min.js.LICENSE.txt -+++ /dev/null -@@ -1,12 +0,0 @@ --/*! -- * The buffer module from node.js, for the browser. -- * -- * @author Feross Aboukhadijeh -- * @license MIT -- */ -- --/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -- --/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -- --/*! typedarray-to-buffer. MIT License. Feross Aboukhadijeh */ -diff --git a/node_modules/@taquito/taquito/dist/taquito.umd.js b/node_modules/@taquito/taquito/dist/taquito.umd.js -index 9aa9943..8b725ab 100644 ---- a/node_modules/@taquito/taquito/dist/taquito.umd.js -+++ b/node_modules/@taquito/taquito/dist/taquito.umd.js -@@ -569,6 +569,18 @@ - parameters_ty: parametersType, - }; - }); -+ const createSmartRollupExecuteOutboxMessageOperation = ({ source, fee, gasLimit, storageLimit, rollup, cementedCommitment, outputProof, }) => __awaiter(void 0, void 0, void 0, function* () { -+ return { -+ kind: rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE, -+ source, -+ fee, -+ gas_limit: gasLimit, -+ storage_limit: storageLimit, -+ rollup, -+ cemented_commitment: cementedCommitment, -+ output_proof: outputProof, -+ }; -+ }); - - const attachKind = (op, kind) => { - return Object.assign(Object.assign({}, op), { kind }); -@@ -596,6 +608,7 @@ - 'update_consensus_key', - 'smart_rollup_add_messages', - 'smart_rollup_originate', -+ 'smart_rollup_execute_outbox_message', - ].indexOf(op.kind) !== -1); - }; - const isOpRequireReveal = (op) => { -@@ -609,6 +622,7 @@ - 'update_consensus_key', - 'smart_rollup_add_messages', - 'smart_rollup_originate', -+ 'smart_rollup_execute_outbox_message', - ].indexOf(op.kind) !== -1); - }; - const hasMetadata = (op) => { -@@ -1009,6 +1023,8 @@ - return createSmartRollupAddMessagesOperation(Object.assign({}, param)); - case rpc.OpKind.SMART_ROLLUP_ORIGINATE: - return createSmartRollupOriginateOperation(Object.assign({}, param)); -+ case rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ return createSmartRollupExecuteOutboxMessageOperation(Object.assign({}, param)); - default: - throw new utils.InvalidOperationKindError(param.kind); - } -@@ -2585,6 +2601,7 @@ - case rpc.OpKind.UPDATE_CONSENSUS_KEY: - case rpc.OpKind.SMART_ROLLUP_ADD_MESSAGES: - case rpc.OpKind.SMART_ROLLUP_ORIGINATE: -+ case rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: - return Object.assign(Object.assign(Object.assign({}, op), this.getSource(op, pkh, source)), this.getFee(op, pkh, headCounter)); - case rpc.OpKind.TRANSFER_TICKET: - return Object.assign(Object.assign(Object.assign(Object.assign({}, op), { ticket_amount: `${op.ticket_amount}` }), this.getSource(op, pkh, source)), this.getFee(op, pkh, headCounter)); -@@ -3076,6 +3093,37 @@ - }; - }); - } -+ /** -+ * -+ * @description Method to prepare a smart_rollup_execute_outbox_message operation -+ * @param operation RPCOperation object or RPCOperation array -+ * @param source string or undefined source pkh -+ * @returns a PreparedOperation object -+ */ -+ smartRollupExecuteOutboxMessage(_a) { -+ var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]); -+ return __awaiter(this, void 0, void 0, function* () { -+ const { pkh } = yield this.getKeys(); -+ const protocolConstants = yield this.context.readProvider.getProtocolConstants('head'); -+ const DEFAULT_PARAMS = yield this.getAccountLimits(pkh, protocolConstants); -+ const op = yield createSmartRollupExecuteOutboxMessageOperation(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS))); -+ const operation = yield this.addRevealOperationIfNeeded(op, pkh); -+ const ops = this.convertIntoArray(operation); -+ const hash = yield this.getBlockHash(); -+ const protocol = yield this.getProtocolHash(); -+ __classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f"); -+ const headCounter = parseInt(yield this.getHeadCounter(pkh), 10); -+ const contents = this.constructOpContents(ops, headCounter, pkh, rest.source); -+ return { -+ opOb: { -+ branch: hash, -+ contents, -+ protocol, -+ }, -+ counter: headCounter, -+ }; -+ }); -+ } - /** - * - * @description Method to prepare a batch operation -@@ -3353,6 +3401,16 @@ - this.operations.push(Object.assign({ kind: rpc.OpKind.SMART_ROLLUP_ORIGINATE }, params)); - return this; - } -+ /** -+ * -+ * @description Add a smart rollup execute outbox message to the batch -+ * -+ * @param params Smart Rollup Execute Outbox Message operation parameter -+ */ -+ withSmartRollupExecuteOutboxMessage(params) { -+ this.operations.push(Object.assign({ kind: rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE }, params)); -+ return this; -+ } - getRPCOp(param) { - return __awaiter(this, void 0, void 0, function* () { - switch (param.kind) { -@@ -3372,6 +3430,8 @@ - return createSmartRollupAddMessagesOperation(Object.assign({}, param)); - case rpc.OpKind.SMART_ROLLUP_ORIGINATE: - return createSmartRollupOriginateOperation(Object.assign({}, param)); -+ case rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ return createSmartRollupExecuteOutboxMessageOperation(Object.assign({}, param)); - default: - throw new core.InvalidOperationKindError(JSON.stringify(param.kind)); - } -@@ -3414,6 +3474,9 @@ - case rpc.OpKind.SMART_ROLLUP_ORIGINATE: - this.withSmartRollupOriginate(param); - break; -+ case rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE: -+ this.withSmartRollupExecuteOutboxMessage(param); -+ break; - default: - throw new core.InvalidOperationKindError(JSON.stringify(param.kind)); - } -@@ -4185,6 +4248,25 @@ - return Estimate.createEstimateInstanceFromProperties(estimateProperties); - }); - } -+ /** -+ * -+ * @description Estimate gasLimit, storageLimit and fees for a smart_rollup_execute_outbox_message operation -+ * -+ * @returns An estimation of gasLimit, storageLimit and fees for the operation -+ * -+ * @param Estimate -+ */ -+ smartRollupExecuteOutboxMessage(params) { -+ return __awaiter(this, void 0, void 0, function* () { -+ const protocolConstants = yield this.context.readProvider.getProtocolConstants('head'); -+ const preparedOperation = yield this.prepare.smartRollupExecuteOutboxMessage(params); -+ const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants); -+ if (preparedOperation.opOb.contents[0].kind === 'reveal') { -+ estimateProperties.shift(); -+ } -+ return Estimate.createEstimateInstanceFromProperties(estimateProperties); -+ }); -+ } - /** - * - * @description Estimate gasLimit, storageLimit and fees for contract call -@@ -4813,6 +4895,57 @@ - } - } - -+ /** -+ * -+ * @description SmartRollupExecuteOutboxMessage Operation provides utility to fetch properties for Operation of kind SmartRollupExecuteOutboxMessage -+ * -+ */ -+ class SmartRollupExecuteOutboxMessageOperation extends Operation { -+ constructor(hash, params, source, raw, results, context) { -+ super(hash, raw, results, context); -+ this.params = params; -+ this.source = source; -+ } -+ get operationResults() { -+ const smartRollupExecuteOutboxMessageOp = Array.isArray(this.results) && -+ this.results.find((op) => op.kind === rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); -+ const result = smartRollupExecuteOutboxMessageOp && -+ smartRollupExecuteOutboxMessageOp.metadata && -+ smartRollupExecuteOutboxMessageOp.metadata.operation_result; -+ return result ? result : undefined; -+ } -+ get status() { -+ var _a, _b; -+ return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown'; -+ } -+ get rollup() { -+ return this.params.rollup; -+ } -+ get cementedCommitment() { -+ return this.params.cemented_commitment; -+ } -+ get outputProof() { -+ return this.params.output_proof; -+ } -+ get fee() { -+ return Number(this.params.fee); -+ } -+ get gasLimit() { -+ return Number(this.params.gas_limit); -+ } -+ get storageLimit() { -+ return Number(this.params.storage_limit); -+ } -+ get consumedMilliGas() { -+ var _a; -+ return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas; -+ } -+ get errors() { -+ var _a; -+ return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors; -+ } -+ } -+ - class RpcContractProvider extends Provider { - constructor(context, estimator) { - super(context); -@@ -5291,6 +5424,22 @@ - return new SmartRollupOriginateOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context); - }); - } -+ /** -+ * @description Execute a message from a smart rollup's outbox of a cemented commitment -+ * @param SmartRollupExecuteOutboxMessageParams -+ * @returns An operation handle with results from the RPC node -+ */ -+ smartRollupExecuteOutboxMessage(params) { -+ return __awaiter(this, void 0, void 0, function* () { -+ const publicKeyHash = yield this.signer.publicKeyHash(); -+ const estimate = yield this.estimate(params, this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)); -+ const prepared = yield this.prepare.smartRollupExecuteOutboxMessage(Object.assign(Object.assign({}, params), estimate)); -+ const content = prepared.opOb.contents.find((op) => op.kind === rpc.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE); -+ const opBytes = yield this.forge(prepared); -+ const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes); -+ return new SmartRollupExecuteOutboxMessageOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context); -+ }); -+ } - /** - * - * @description A failing_noop operation that is guaranteed to fail. -@@ -6188,8 +6337,8 @@ - - // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! - const VERSION = { -- "commitHash": "13a12ab7cf442043526745db2bbf4ef3b089c34a", -- "version": "19.0.2" -+ commitHash: '13a12ab7cf442043526745db2bbf4ef3b089c34a', -+ version: '19.0.2', - }; - - /** -@@ -6714,6 +6863,7 @@ - exports.createRevealOperation = createRevealOperation; - exports.createSetDelegateOperation = createSetDelegateOperation; - exports.createSmartRollupAddMessagesOperation = createSmartRollupAddMessagesOperation; -+ exports.createSmartRollupExecuteOutboxMessageOperation = createSmartRollupExecuteOutboxMessageOperation; - exports.createSmartRollupOriginateOperation = createSmartRollupOriginateOperation; - exports.createTransferOperation = createTransferOperation; - exports.createTransferTicketOperation = createTransferTicketOperation; -diff --git a/node_modules/@taquito/taquito/dist/taquito.umd.js.map b/node_modules/@taquito/taquito/dist/taquito.umd.js.map -index a27e2fc..2518fbd 100644 ---- a/node_modules/@taquito/taquito/dist/taquito.umd.js.map -+++ b/node_modules/@taquito/taquito/dist/taquito.umd.js.map -@@ -1 +1 @@ --{"version":3,"file":"taquito.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} -\ No newline at end of file -+{"version":3,"file":"taquito.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} -\ No newline at end of file -diff --git a/node_modules/@taquito/taquito/dist/types/batch/rpc-batch-provider.d.ts b/node_modules/@taquito/taquito/dist/types/batch/rpc-batch-provider.d.ts -index a387123..719ca96 100644 ---- a/node_modules/@taquito/taquito/dist/types/batch/rpc-batch-provider.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/batch/rpc-batch-provider.d.ts -@@ -4,7 +4,7 @@ import { ContractMethod } from '../contract/contract-methods/contract-method-fla - import { SendParams } from '../contract/contract-methods/contract-method-interface'; - import { ContractProvider } from '../contract/interface'; - import { BatchOperation } from '../operations/batch-operation'; --import { ActivationParams, DelegateParams, OriginateParams, TransferParams, ParamsWithKind, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams } from '../operations/types'; -+import { ActivationParams, DelegateParams, OriginateParams, TransferParams, ParamsWithKind, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams } from '../operations/types'; - import { OpKind } from '@taquito/rpc'; - import { ContractMethodObject } from '../contract/contract-methods/contract-method-object-param'; - import { EstimationProvider } from '../estimate/estimate-provider-interface'; -@@ -88,7 +88,14 @@ export declare class OperationBatch extends Provider { - * @param params Smart Rollup Originate operation parameter - */ - withSmartRollupOriginate(params: SmartRollupOriginateParams): this; -- getRPCOp(param: ParamsWithKind): Promise; -+ /** -+ * -+ * @description Add a smart rollup execute outbox message to the batch -+ * -+ * @param params Smart Rollup Execute Outbox Message operation parameter -+ */ -+ withSmartRollupExecuteOutboxMessage(params: SmartRollupExecuteOutboxMessageParams): this; -+ getRPCOp(param: ParamsWithKind): Promise; - /** - * - * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array -diff --git a/node_modules/@taquito/taquito/dist/types/contract/interface.d.ts b/node_modules/@taquito/taquito/dist/types/contract/interface.d.ts -index 04c2c18..41588d4 100644 ---- a/node_modules/@taquito/taquito/dist/types/contract/interface.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/contract/interface.d.ts -@@ -7,7 +7,7 @@ import { OriginationOperation } from '../operations/origination-operation'; - import { RegisterGlobalConstantOperation } from '../operations/register-global-constant-operation'; - import { RevealOperation } from '../operations/reveal-operation'; - import { TransactionOperation } from '../operations/transaction-operation'; --import { DelegateParams, OriginateParams, TransferParams, RegisterDelegateParams, ParamsWithKind, RevealParams, RegisterGlobalConstantParams, IncreasePaidStorageParams, TransferTicketParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, FailingNoopParams } from '../operations/types'; -+import { DelegateParams, OriginateParams, TransferParams, RegisterDelegateParams, ParamsWithKind, RevealParams, RegisterGlobalConstantParams, IncreasePaidStorageParams, TransferTicketParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams } from '../operations/types'; - import { ContractAbstraction, ContractStorageType, DefaultContractType } from './contract'; - import { IncreasePaidStorageOperation } from '../operations/increase-paid-storage-operation'; - import { TransferTicketOperation } from '../operations/transfer-ticket-operation'; -@@ -17,6 +17,7 @@ import { ProposalsOperation } from '../operations/proposals-operation'; - import { UpdateConsensusKeyOperation } from '../operations/update-consensus-key-operation'; - import { SmartRollupAddMessagesOperation } from '../operations/smart-rollup-add-messages-operation'; - import { SmartRollupOriginateOperation } from '../operations/smart-rollup-originate-operation'; -+import { SmartRollupExecuteOutboxMessageOperation } from '../operations/smart-rollup-execute-outbox-message-operation'; - import { FailingNoopOperation } from '../operations/failing-noop-operation'; - export type ContractSchema = Schema | unknown; - export interface StorageProvider { -@@ -212,6 +213,14 @@ export interface ContractProvider extends StorageProvider { - * @param SmartRollupOriginateParams smartRollupOriginate operation parameter - */ - smartRollupOriginate(params: SmartRollupOriginateParams): Promise; -+ /** -+ * @description Execute a message from a smart rollup's outbox of a cemented commitment -+ * -+ * @returns An operation handle with the result from the RPC node -+ * -+ * @param SmartRollupExecuteOutboxMessageParams smartRollupExecuteOutboxMessage operation parameter -+ */ -+ smartRollupExecuteOutboxMessage(params: SmartRollupExecuteOutboxMessageParams): Promise; - /** - * - * @description Send arbitrary data inside a failing_noop operation that's guaranteed to fail. -diff --git a/node_modules/@taquito/taquito/dist/types/contract/prepare.d.ts b/node_modules/@taquito/taquito/dist/types/contract/prepare.d.ts -index e374a97..9127b1a 100644 ---- a/node_modules/@taquito/taquito/dist/types/contract/prepare.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/contract/prepare.d.ts -@@ -1,4 +1,4 @@ --import { OriginateParams, RPCOriginationOperation, TransferParams, RPCTransferOperation, DelegateParams, RPCDelegateOperation, RegisterDelegateParams, RPCRevealOperation, RevealParams, RegisterGlobalConstantParams, RPCRegisterGlobalConstantOperation, TransferTicketParams, RPCTransferTicketOperation, IncreasePaidStorageParams, RPCIncreasePaidStorageOperation, DrainDelegateParams, RPCDrainDelegateOperation, BallotParams, RPCBallotOperation, ProposalsParams, RPCProposalsOperation, UpdateConsensusKeyParams, RPCUpdateConsensusKeyOperation, SmartRollupAddMessagesParams, RPCSmartRollupAddMessagesOperation, RPCSmartRollupOriginateOperation, ActivationParams, RPCActivateOperation, SmartRollupOriginateParams } from '../operations/types'; -+import { OriginateParams, RPCOriginationOperation, TransferParams, RPCTransferOperation, DelegateParams, RPCDelegateOperation, RegisterDelegateParams, RPCRevealOperation, RevealParams, RegisterGlobalConstantParams, RPCRegisterGlobalConstantOperation, TransferTicketParams, RPCTransferTicketOperation, IncreasePaidStorageParams, RPCIncreasePaidStorageOperation, DrainDelegateParams, RPCDrainDelegateOperation, BallotParams, RPCBallotOperation, ProposalsParams, RPCProposalsOperation, UpdateConsensusKeyParams, RPCUpdateConsensusKeyOperation, SmartRollupAddMessagesParams, RPCSmartRollupAddMessagesOperation, SmartRollupOriginateParams, RPCSmartRollupOriginateOperation, SmartRollupExecuteOutboxMessageParams, RPCSmartRollupOutboxMessageOperation, ActivationParams, RPCActivateOperation } from '../operations/types'; - export declare const createActivationOperation: ({ pkh, secret }: ActivationParams) => Promise; - export declare const createOriginationOperation: ({ code, init, balance, delegate, storage, fee, gasLimit, storageLimit, mutez, }: OriginateParams) => Promise; - export declare const createTransferOperation: ({ to, amount, parameter, fee, gasLimit, storageLimit, mutez, }: TransferParams) => Promise; -@@ -14,3 +14,4 @@ export declare const createProposalsOperation: ({ source, proposals }: Proposals - export declare const createUpdateConsensusKeyOperation: ({ source, fee, gasLimit, storageLimit, pk, }: UpdateConsensusKeyParams) => Promise; - export declare const createSmartRollupAddMessagesOperation: ({ source, fee, gasLimit, storageLimit, message, }: SmartRollupAddMessagesParams) => Promise; - export declare const createSmartRollupOriginateOperation: ({ source, fee, gasLimit, storageLimit, pvmKind, kernel, parametersType, }: SmartRollupOriginateParams) => Promise; -+export declare const createSmartRollupExecuteOutboxMessageOperation: ({ source, fee, gasLimit, storageLimit, rollup, cementedCommitment, outputProof, }: SmartRollupExecuteOutboxMessageParams) => Promise; -diff --git a/node_modules/@taquito/taquito/dist/types/contract/rpc-contract-provider.d.ts b/node_modules/@taquito/taquito/dist/types/contract/rpc-contract-provider.d.ts -index 1a5be79..0b1f3fe 100644 ---- a/node_modules/@taquito/taquito/dist/types/contract/rpc-contract-provider.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/contract/rpc-contract-provider.d.ts -@@ -6,7 +6,7 @@ import { OriginationOperation } from '../operations/origination-operation'; - import { RegisterGlobalConstantOperation } from '../operations/register-global-constant-operation'; - import { RevealOperation } from '../operations/reveal-operation'; - import { TransactionOperation } from '../operations/transaction-operation'; --import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, RegisterGlobalConstantParams, RevealParams, TransferParams, TransferTicketParams, IncreasePaidStorageParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, FailingNoopParams } from '../operations/types'; -+import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, RegisterGlobalConstantParams, RevealParams, TransferParams, TransferTicketParams, IncreasePaidStorageParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams } from '../operations/types'; - import { DefaultContractType, ContractStorageType, ContractAbstraction } from './contract'; - import { ContractProvider, ContractSchema, StorageProvider } from './interface'; - import { EstimationProvider } from '../estimate/estimate-provider-interface'; -@@ -18,6 +18,7 @@ import { ProposalsOperation } from '../operations/proposals-operation'; - import { UpdateConsensusKeyOperation } from '../operations/update-consensus-key-operation'; - import { SmartRollupAddMessagesOperation } from '../operations/smart-rollup-add-messages-operation'; - import { SmartRollupOriginateOperation } from '../operations/smart-rollup-originate-operation'; -+import { SmartRollupExecuteOutboxMessageOperation } from '../operations/smart-rollup-execute-outbox-message-operation'; - import { Provider } from '../provider'; - import { FailingNoopOperation } from '../operations/failing-noop-operation'; - export declare class RpcContractProvider extends Provider implements ContractProvider, StorageProvider { -@@ -209,6 +210,12 @@ export declare class RpcContractProvider extends Provider implements ContractPro - * @returns An operation handle with results from the RPC node - */ - smartRollupOriginate(params: SmartRollupOriginateParams): Promise; -+ /** -+ * @description Execute a message from a smart rollup's outbox of a cemented commitment -+ * @param SmartRollupExecuteOutboxMessageParams -+ * @returns An operation handle with results from the RPC node -+ */ -+ smartRollupExecuteOutboxMessage(params: SmartRollupExecuteOutboxMessageParams): Promise; - /** - * - * @description A failing_noop operation that is guaranteed to fail. -diff --git a/node_modules/@taquito/taquito/dist/types/estimate/estimate-provider-interface.d.ts b/node_modules/@taquito/taquito/dist/types/estimate/estimate-provider-interface.d.ts -index c0cba05..cf040cf 100644 ---- a/node_modules/@taquito/taquito/dist/types/estimate/estimate-provider-interface.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/estimate/estimate-provider-interface.d.ts -@@ -1,5 +1,5 @@ - import { OriginateParams, TransferParams, DelegateParams, RegisterDelegateParams, ParamsWithKind } from '../operations'; --import { RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams } from '../operations/types'; -+import { RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams } from '../operations/types'; - import { Estimate } from './estimate'; - import { ContractMethod, ContractMethodObject, ContractProvider } from '../contract'; - export interface EstimationProvider { -@@ -94,6 +94,15 @@ export interface EstimationProvider { - * @param Estimate - */ - smartRollupAddMessages(params: SmartRollupAddMessagesParams): Promise; -+ /** -+ * -+ * @description Estimate gasLimit, storageLimit and fees for an Smart Rollup Execute Outbox Message operation -+ * -+ * @returns An estimation of gasLimit, storageLimit and fees for the operation -+ * -+ * @param Estimate -+ */ -+ smartRollupExecuteOutboxMessage(params: SmartRollupExecuteOutboxMessageParams): Promise; - /** - * - * @description Estimate gasLimit, storageLimit and fees for contract call -diff --git a/node_modules/@taquito/taquito/dist/types/estimate/rpc-estimate-provider.d.ts b/node_modules/@taquito/taquito/dist/types/estimate/rpc-estimate-provider.d.ts -index da7b70c..43080c6 100644 ---- a/node_modules/@taquito/taquito/dist/types/estimate/rpc-estimate-provider.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/estimate/rpc-estimate-provider.d.ts -@@ -1,4 +1,4 @@ --import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, TransferParams, RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams } from '../operations/types'; -+import { DelegateParams, OriginateParams, ParamsWithKind, RegisterDelegateParams, TransferParams, RevealParams, RegisterGlobalConstantParams, TransferTicketParams, IncreasePaidStorageParams, UpdateConsensusKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams } from '../operations/types'; - import { Estimate } from './estimate'; - import { EstimationProvider } from '../estimate/estimate-provider-interface'; - import { ContractMethod, ContractMethodObject, ContractProvider } from '../contract'; -@@ -117,6 +117,15 @@ export declare class RPCEstimateProvider extends Provider implements EstimationP - * @param SmartRollupOriginateParams - */ - smartRollupOriginate(params: SmartRollupOriginateParams): Promise; -+ /** -+ * -+ * @description Estimate gasLimit, storageLimit and fees for a smart_rollup_execute_outbox_message operation -+ * -+ * @returns An estimation of gasLimit, storageLimit and fees for the operation -+ * -+ * @param Estimate -+ */ -+ smartRollupExecuteOutboxMessage(params: SmartRollupExecuteOutboxMessageParams): Promise; - /** - * - * @description Estimate gasLimit, storageLimit and fees for contract call -diff --git a/node_modules/@taquito/taquito/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts b/node_modules/@taquito/taquito/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts -new file mode 100644 -index 0000000..c791bf7 ---- /dev/null -+++ b/node_modules/@taquito/taquito/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts -@@ -0,0 +1,24 @@ -+import { OperationContentsAndResult, OperationContentsSmartRollupExecuteOutboxMessage } from '@taquito/rpc'; -+import { Context } from '../context'; -+import { Operation } from './operations'; -+import { FeeConsumingOperation, ForgedBytes, GasConsumingOperation, StorageConsumingOperation } from './types'; -+/** -+ * -+ * @description SmartRollupExecuteOutboxMessage Operation provides utility to fetch properties for Operation of kind SmartRollupExecuteOutboxMessage -+ * -+ */ -+export declare class SmartRollupExecuteOutboxMessageOperation extends Operation implements GasConsumingOperation, StorageConsumingOperation, FeeConsumingOperation { -+ private readonly params; -+ readonly source: string; -+ constructor(hash: string, params: OperationContentsSmartRollupExecuteOutboxMessage, source: string, raw: ForgedBytes, results: OperationContentsAndResult[], context: Context); -+ get operationResults(): import("@taquito/rpc").OperationResultSmartRollupExecuteOutboxMessage | undefined; -+ get status(): import("@taquito/rpc").OperationResultStatusEnum | "unknown"; -+ get rollup(): string; -+ get cementedCommitment(): string; -+ get outputProof(): string; -+ get fee(): number; -+ get gasLimit(): number; -+ get storageLimit(): number; -+ get consumedMilliGas(): string | undefined; -+ get errors(): import("@taquito/rpc").TezosGenericOperationError[] | undefined; -+} -diff --git a/node_modules/@taquito/taquito/dist/types/operations/types.d.ts b/node_modules/@taquito/taquito/dist/types/operations/types.d.ts -index 6c37e45..ab87807 100644 ---- a/node_modules/@taquito/taquito/dist/types/operations/types.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/operations/types.d.ts -@@ -4,7 +4,7 @@ export { OpKind } from '@taquito/rpc'; - export type withKind = T & { - kind: K; - }; --export type ParamsWithKind = withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind; -+export type ParamsWithKind = withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind | withKind; - export type ParamsWithKindExtended = ParamsWithKind | withKind; - export declare const attachKind: (op: T, kind: K) => withKind; - export declare const findWithKind: (op: T, kind: K) => op is withKind; --export type RPCOpWithFee = RPCTransferOperation | RPCOriginationOperation | RPCDelegateOperation | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation; --export type RPCOpWithSource = RPCTransferOperation | RPCOriginationOperation | RPCDelegateOperation | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation; -+export type RPCOpWithFee = RPCTransferOperation | RPCOriginationOperation | RPCDelegateOperation | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation | RPCSmartRollupOutboxMessageOperation; -+export type RPCOpWithSource = RPCTransferOperation | RPCOriginationOperation | RPCDelegateOperation | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation | RPCSmartRollupOutboxMessageOperation; - export declare const isOpWithFee: (op: T) => op is withKind; -@@ -318,6 +318,13 @@ export interface RPCUpdateConsensusKeyOperation { - storage_limit: number; - pk: string; - } -+export interface SmartRollupAddMessagesParams { -+ source?: string; -+ fee?: number; -+ gasLimit?: number; -+ storageLimit?: number; -+ message: string[]; -+} - export interface RPCSmartRollupAddMessagesOperation { - kind: OpKind.SMART_ROLLUP_ADD_MESSAGES; - source: string; -@@ -326,13 +333,6 @@ export interface RPCSmartRollupAddMessagesOperation { - storage_limit: number; - message: string[]; - } --export interface SmartRollupAddMessagesParams { -- source?: string; -- fee?: number; -- gasLimit?: number; -- storageLimit?: number; -- message: string[]; --} - export interface SmartRollupOriginateParams { - source?: string; - fee?: number; -@@ -352,6 +352,25 @@ export interface RPCSmartRollupOriginateOperation { - kernel: string; - parameters_ty: MichelsonV1Expression; - } -+export interface SmartRollupExecuteOutboxMessageParams { -+ source?: string; -+ fee?: number; -+ gasLimit?: number; -+ storageLimit?: number; -+ rollup: string; -+ cementedCommitment: string; -+ outputProof: string; -+} -+export interface RPCSmartRollupOutboxMessageOperation { -+ kind: OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE; -+ source: string; -+ fee: number; -+ gas_limit: number; -+ storage_limit: number; -+ rollup: string; -+ cemented_commitment: string; -+ output_proof: string; -+} - /** - * @description RPC failing noop operation - */ -@@ -366,7 +385,7 @@ export interface FailingNoopParams { - arbitrary: string; - basedOnBlock: BlockIdentifier; - } --export type RPCOperation = RPCOriginationOperation | RPCTransferOperation | RPCDelegateOperation | RPCRevealOperation | RPCActivateOperation | RPCRegisterGlobalConstantOperation | RPCTransferTicketOperation | RPCIncreasePaidStorageOperation | RPCDrainDelegateOperation | RPCBallotOperation | RPCProposalsOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCFailingNoopOperation | RPCSmartRollupOriginateOperation; -+export type RPCOperation = RPCOriginationOperation | RPCTransferOperation | RPCDelegateOperation | RPCRevealOperation | RPCActivateOperation | RPCRegisterGlobalConstantOperation | RPCTransferTicketOperation | RPCIncreasePaidStorageOperation | RPCDrainDelegateOperation | RPCBallotOperation | RPCProposalsOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation | RPCSmartRollupOutboxMessageOperation | RPCFailingNoopOperation; - export type PrepareOperationParams = { - operation: RPCOperation | RPCOperation[]; - source?: string; -diff --git a/node_modules/@taquito/taquito/dist/types/prepare/prepare-provider.d.ts b/node_modules/@taquito/taquito/dist/types/prepare/prepare-provider.d.ts -index ba47100..f4a91f1 100644 ---- a/node_modules/@taquito/taquito/dist/types/prepare/prepare-provider.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/prepare/prepare-provider.d.ts -@@ -1,5 +1,5 @@ - import { PreapplyParams } from '@taquito/rpc'; --import { DelegateParams, RevealParams, RegisterGlobalConstantParams, TransferParams, OriginateParams, UpdateConsensusKeyParams, TransferTicketParams, IncreasePaidStorageParams, BallotParams, ProposalsParams, DrainDelegateParams, ParamsWithKind, SmartRollupAddMessagesParams, SmartRollupOriginateParams, RegisterDelegateParams, ActivationParams } from '../operations/types'; -+import { DelegateParams, RevealParams, RegisterGlobalConstantParams, TransferParams, OriginateParams, UpdateConsensusKeyParams, TransferTicketParams, IncreasePaidStorageParams, BallotParams, ProposalsParams, DrainDelegateParams, ParamsWithKind, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, RegisterDelegateParams, ActivationParams } from '../operations/types'; - import { PreparationProvider, PreparedOperation } from './interface'; - import { Context } from '../context'; - import { ContractMethod } from '../contract/contract-methods/contract-method-flat-param'; -@@ -143,6 +143,14 @@ export declare class PrepareProvider extends Provider implements PreparationProv - * @returns a PreparedOperation object - */ - smartRollupOriginate({ fee, storageLimit, gasLimit, ...rest }: SmartRollupOriginateParams): Promise; -+ /** -+ * -+ * @description Method to prepare a smart_rollup_execute_outbox_message operation -+ * @param operation RPCOperation object or RPCOperation array -+ * @param source string or undefined source pkh -+ * @returns a PreparedOperation object -+ */ -+ smartRollupExecuteOutboxMessage({ fee, storageLimit, gasLimit, ...rest }: SmartRollupExecuteOutboxMessageParams): Promise; - /** - * - * @description Method to prepare a batch operation -diff --git a/node_modules/@taquito/taquito/dist/types/provider.d.ts b/node_modules/@taquito/taquito/dist/types/provider.d.ts -index 8ef4f65..c79c179 100644 ---- a/node_modules/@taquito/taquito/dist/types/provider.d.ts -+++ b/node_modules/@taquito/taquito/dist/types/provider.d.ts -@@ -26,7 +26,7 @@ export declare abstract class Provider { - gasLimit: number | undefined; - storageLimit: number | undefined; - }>; -- getRPCOp(param: ParamsWithKind): Promise; -+ getRPCOp(param: ParamsWithKind): Promise; - protected runOperation(op: RPCRunOperationParam): Promise<{ - opResponse: import("@taquito/rpc").PreapplyResponse; - op: RPCRunOperationParam; From 5acbe34bb54a678fd35e81dc1f2c908038a039a1 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 4 Mar 2024 22:32:46 +0300 Subject: [PATCH 07/20] Allow the blockchain service to return an undefined signer address instead of throwing an error --- .../bridgeBlockchainService.ts | 2 +- .../errors.ts | 7 +++++ .../taquitoTezosBridgeBlockchainService.ts | 16 ++++++++-- .../web3EtherlinkBridgeBlockchainService.ts | 17 ++++++----- src/tokenBridge/errors.ts | 12 ++++++++ src/tokenBridge/tokenBridge.ts | 30 ++++++++++++++----- 6 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/errors.ts diff --git a/src/bridgeBlockchainService/bridgeBlockchainService.ts b/src/bridgeBlockchainService/bridgeBlockchainService.ts index 7af82d1..965c203 100644 --- a/src/bridgeBlockchainService/bridgeBlockchainService.ts +++ b/src/bridgeBlockchainService/bridgeBlockchainService.ts @@ -1,3 +1,3 @@ export interface BridgeBlockchainService { - getSignerAddress(): Promise; + getSignerAddress(): Promise; } diff --git a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/errors.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/errors.ts new file mode 100644 index 0000000..b3dd985 --- /dev/null +++ b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/errors.ts @@ -0,0 +1,7 @@ +import { TokenBridgeError } from '../../common'; + +export class TezosSignerAccountUnavailableError extends TokenBridgeError { + constructor() { + super('The Tezos signer account is unavailable'); + } +} diff --git a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts index 6961c6a..1288b08 100644 --- a/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts +++ b/src/bridgeBlockchainService/taquitoTezosBridgeBlockchainService/taquitoTezosBridgeBlockchainService.ts @@ -3,8 +3,10 @@ import { Schema } from '@taquito/michelson-encoder'; import type { TezosToolkit, Wallet, ContractProvider, ContractMethod } from '@taquito/taquito'; import type { FA12Contract, FA2Contract, NativeTokenTicketHelper, NonNativeTokenTicketHelper } from './contracts'; +import { TezosSignerAccountUnavailableError } from './errors'; import { fa12helper, fa2helper } from './helpers'; import { tezosTicketerContentMichelsonType } from './tezosTicketerContentMichelsonType'; +import { getErrorLogMessage, loggerProvider } from '../../logging'; import type { FA12TezosToken, FA2TezosToken } from '../../tokens'; import { etherlinkUtils } from '../../utils'; import type { @@ -38,8 +40,15 @@ export abstract class TaquitoTezosBridgeBlockchainService< this.tezosToolkit = options.tezosToolkit; } - getSignerAddress(): Promise { - return this.tezosToolkit.signer.publicKeyHash(); + async getSignerAddress(): Promise { + try { + return await this.tezosToolkit.signer.publicKeyHash(); + } + catch (error) { + loggerProvider.logger.error(getErrorLogMessage(error)); + + return undefined; + } } abstract depositNativeToken( @@ -167,6 +176,9 @@ export abstract class TaquitoTezosBridgeBlockchainService< this.getSignerAddress() ]); + if (!tokenOwnerAddress) + throw new TezosSignerAccountUnavailableError(); + const resultOperation = fa2helper.wrapContractCallsWithApprove({ batch, approvedAddress: ticketHelperContractAddress, diff --git a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts index 32884dd..d482a78 100644 --- a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts +++ b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts @@ -2,6 +2,7 @@ import type { Web3, TransactionReceipt } from 'web3'; import type { NonPayableMethodObject } from 'web3-eth-contract'; import type { WithdrawNonNativeTokenPrecompile } from './precompiles'; +import { getErrorLogMessage, loggerProvider } from '../../logging'; import { tezosUtils } from '../../utils'; import { kernelContractAbi, @@ -43,13 +44,15 @@ export class Web3EtherlinkBridgeBlockchainService implements EtherlinkBridgeBloc ); } - async getSignerAddress(): Promise { - const accounts = await this.web3.eth.getAccounts(); - const address = accounts[0] || this.web3.eth.defaultAccount; - if (!address) - throw new Error('Address is unavailable'); - - return address; + async getSignerAddress(): Promise { + try { + const accounts = await this.web3.eth.getAccounts(); + return accounts[0] || this.web3.eth.defaultAccount; + } + catch (error) { + loggerProvider.logger.error(getErrorLogMessage(error)); + return undefined; + } } withdrawNativeToken(_params: WithdrawNativeTokenParams): Promise { diff --git a/src/tokenBridge/errors.ts b/src/tokenBridge/errors.ts index e7082a8..20eee85 100644 --- a/src/tokenBridge/errors.ts +++ b/src/tokenBridge/errors.ts @@ -38,3 +38,15 @@ export class FailedTokenTransferError extends TokenBridgeError { return `The ${bridgeUtils.getInitialOperationHash(tokenTransfer)} token transfer is failed`; } } + +export class TezosSignerAccountUnavailableError extends TokenBridgeError { + constructor() { + super('The Tezos signer account is unavailable'); + } +} + +export class EtherlinkSignerAccountUnavailableError extends TokenBridgeError { + constructor() { + super('The Etherlink signer account is unavailable'); + } +} diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 792dda0..6f945d1 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -1,4 +1,4 @@ -import { FailedTokenTransferError, InsufficientBalanceError, TokenBridgeDisposed, TokenPairNotFoundError } from './errors'; +import { EtherlinkSignerAccountUnavailableError, FailedTokenTransferError, InsufficientBalanceError, TezosSignerAccountUnavailableError, TokenBridgeDisposed, TokenPairNotFoundError } from './errors'; import type { TokenBridgeComponents } from './tokenBridgeComponents'; import type { TokenBridgeDataApi } from './tokenBridgeDataApi'; import type { TokenBridgeOptions } from './tokenBridgeOptions'; @@ -201,10 +201,10 @@ export class TokenBridge< ): Promise | DepositResult> { this.ensureIsNotDisposed(); - const tezosSourceAddress = await this.getTezosSignerAddress(); + const tezosSourceAddress = await this.getRequiredTezosSignerAddress(); const etherlinkReceiverAddress = typeof etherlinkReceiverAddressOrOptions === 'string' ? etherlinkReceiverAddressOrOptions - : await this.getEtherlinkSignerAddress(); + : await this.getRequiredEtherlinkSignerAddress(); const depositOptions = typeof etherlinkReceiverAddressOrOptions !== 'string' && etherlinkReceiverAddressOrOptions ? etherlinkReceiverAddressOrOptions : options; loggerProvider.lazyLogger.log?.( @@ -288,9 +288,9 @@ export class TokenBridge< ): Promise | StartWithdrawResult> { this.ensureIsNotDisposed(); - const etherlinkSourceAddress = await this.getEtherlinkSignerAddress(); + const etherlinkSourceAddress = await this.getRequiredEtherlinkSignerAddress(); if (!tezosReceiverAddress) { - tezosReceiverAddress = await this.getTezosSignerAddress(); + tezosReceiverAddress = await this.getRequiredEtherlinkSignerAddress(); } const tokenPair = await this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPair(token); @@ -364,13 +364,13 @@ export class TokenBridge< } as FinishWithdrawResult; } - async getTezosSignerAddress(): Promise { + async getTezosSignerAddress(): Promise { this.ensureIsNotDisposed(); return this.bridgeComponents.tezosBridgeBlockchainService.getSignerAddress(); } - async getEtherlinkSignerAddress(): Promise { + async getEtherlinkSignerAddress(): Promise { this.ensureIsNotDisposed(); return this.bridgeComponents.etherlinkBridgeBlockchainService.getSignerAddress(); @@ -601,4 +601,20 @@ export class TokenBridge< TokenBridge.defaultLastCreatedTokenTransfersTimerPeriod ); } + + private async getRequiredTezosSignerAddress(): Promise { + const tezosSignerAddress = await this.getTezosSignerAddress(); + if (tezosSignerAddress) + return tezosSignerAddress; + + throw new TezosSignerAccountUnavailableError(); + } + + private async getRequiredEtherlinkSignerAddress(): Promise { + const tezosSignerAddress = await this.getEtherlinkSignerAddress(); + if (tezosSignerAddress) + return tezosSignerAddress; + + throw new EtherlinkSignerAccountUnavailableError(); + } } From b03749d1ece02cd6592ab54bb2e90a956c59f450 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 4 Mar 2024 23:16:06 +0300 Subject: [PATCH 08/20] Extends the Data API, add data methods for signer addresses --- src/index.ts | 1 + src/tokenBridge/index.ts | 2 ++ src/tokenBridge/tokenBridge.ts | 36 ++++++++++++++++++++++++++- src/tokenBridge/tokenBridgeDataApi.ts | 16 +++++++++++- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4b68abd..d82212b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,7 @@ export { export { TokenBridge, type TokenBridgeOptions, + type SignerTokenBalances } from './tokenBridge'; export { diff --git a/src/tokenBridge/index.ts b/src/tokenBridge/index.ts index a1a6a5e..bd5c8fc 100644 --- a/src/tokenBridge/index.ts +++ b/src/tokenBridge/index.ts @@ -1,2 +1,4 @@ export { TokenBridge } from './tokenBridge'; export type { TokenBridgeOptions } from './tokenBridgeOptions'; + +export type { SignerTokenBalances } from './tokenBridgeDataApi'; diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 6f945d1..ae2ca84 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -1,6 +1,6 @@ import { EtherlinkSignerAccountUnavailableError, FailedTokenTransferError, InsufficientBalanceError, TezosSignerAccountUnavailableError, TokenBridgeDisposed, TokenPairNotFoundError } from './errors'; import type { TokenBridgeComponents } from './tokenBridgeComponents'; -import type { TokenBridgeDataApi } from './tokenBridgeDataApi'; +import type { SignerTokenBalances, TokenBridgeDataApi } from './tokenBridgeDataApi'; import type { TokenBridgeOptions } from './tokenBridgeOptions'; import type { TokenBridgeStreamApi } from './tokenBridgeStreamApi'; import type { EtherlinkBridgeBlockchainService, TezosBridgeBlockchainService } from '../bridgeBlockchainService'; @@ -79,6 +79,8 @@ export class TokenBridge< getTokenTransfer: this.getTokenTransfer.bind(this), getTokenTransfers: this.getTokenTransfers.bind(this), getAccountTokenTransfers: this.getAccountTokenTransfers.bind(this), + getSignerBalances: this.getSignerBalances.bind(this), + getSignerTokenTransfers: this.getSignerTokenTransfers.bind(this), }; this.stream = { subscribeToTokenTransfer: this.subscribeToTokenTransfer.bind(this), @@ -454,6 +456,38 @@ export class TokenBridge< .getAccountTokenTransfers(accountAddressOfAddresses, offset, limit); } + protected async getSignerBalances(): Promise { + const [tezosSignerBalances, etherlinkSignerBalances] = await Promise.all([ + this.getTezosSignerAddress() + .then(signerAddress => signerAddress ? this.getBalances(signerAddress) : undefined), + this.getEtherlinkSignerAddress() + .then(signerAddress => signerAddress ? this.getBalances(signerAddress) : undefined), + ]); + + return { + tezosSignerBalances, + etherlinkSignerBalances + }; + } + + protected async getSignerTokenTransfers(): Promise; + protected async getSignerTokenTransfers(offset: number, limit: number): Promise; + protected async getSignerTokenTransfers(offset?: number, limit?: number): Promise; + protected async getSignerTokenTransfers(offset?: number, limit?: number): Promise { + const [tezosSignerAddress, etherlinkSignerAddress] = await Promise.all([ + this.getTezosSignerAddress(), + this.getEtherlinkSignerAddress() + ]); + + const addresses = tezosSignerAddress && etherlinkSignerAddress + ? [tezosSignerAddress, etherlinkSignerAddress] + : tezosSignerAddress || etherlinkSignerAddress; + + return addresses + ? this.getAccountTokenTransfers(addresses, offset, limit) + : []; + } + // #endregion // #region Stream API diff --git a/src/tokenBridge/tokenBridgeDataApi.ts b/src/tokenBridge/tokenBridgeDataApi.ts index 86283ca..a57162d 100644 --- a/src/tokenBridge/tokenBridgeDataApi.ts +++ b/src/tokenBridge/tokenBridgeDataApi.ts @@ -1,6 +1,20 @@ -import type { TokensBridgeDataProvider, BalancesBridgeDataProvider, TransfersBridgeDataProvider } from '../bridgeDataProviders'; +import type { BridgeTokenTransfer } from '../bridgeCore'; +import type { + TokensBridgeDataProvider, BalancesBridgeDataProvider, TransfersBridgeDataProvider, + AccountTokenBalances +} from '../bridgeDataProviders'; + +export interface SignerTokenBalances { + tezosSignerBalances?: AccountTokenBalances + etherlinkSignerBalances?: AccountTokenBalances; +} export interface TokenBridgeDataApi extends Pick, Pick, Pick { + getSignerBalances(): Promise; + + getSignerTokenTransfers(): Promise; + getSignerTokenTransfers(offset: number, limit: number): Promise; + getSignerTokenTransfers(offset?: number, limit?: number): Promise; } From e69b3012b05432d01c66aa290960196ca7c51729 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Tue, 5 Mar 2024 00:10:32 +0300 Subject: [PATCH 09/20] Fix tests --- integration/tests/balances.test.ts | 4 ++-- integration/tests/deposit.test.ts | 4 ++-- integration/tests/withdrawal.test.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/integration/tests/balances.test.ts b/integration/tests/balances.test.ts index 2847b96..8eed43b 100644 --- a/integration/tests/balances.test.ts +++ b/integration/tests/balances.test.ts @@ -30,8 +30,8 @@ describe('Balances', () => { await tokenBridge.getTezosSignerAddress(), await tokenBridge.getEtherlinkSignerAddress() ]); - testTezosAccountAddress = connectedAddresses[0]; - testEtherlinkAccountAddress = connectedAddresses[1]; + testTezosAccountAddress = connectedAddresses[0]!; + testEtherlinkAccountAddress = connectedAddresses[1]!; }); afterEach(() => { diff --git a/integration/tests/deposit.test.ts b/integration/tests/deposit.test.ts index 6205e15..6f6e0cf 100644 --- a/integration/tests/deposit.test.ts +++ b/integration/tests/deposit.test.ts @@ -39,8 +39,8 @@ describe('Deposit', () => { await tokenBridge.getTezosSignerAddress(), await tokenBridge.getEtherlinkSignerAddress() ]); - testTezosAccountAddress = connectedAddresses[0]; - testEtherlinkAccountAddress = connectedAddresses[1]; + testTezosAccountAddress = connectedAddresses[0]!; + testEtherlinkAccountAddress = connectedAddresses[1]!; }); afterEach(() => { diff --git a/integration/tests/withdrawal.test.ts b/integration/tests/withdrawal.test.ts index 906fc0e..7d5c1a8 100644 --- a/integration/tests/withdrawal.test.ts +++ b/integration/tests/withdrawal.test.ts @@ -38,8 +38,8 @@ describe('Withdrawal', () => { await tokenBridge.getTezosSignerAddress(), await tokenBridge.getEtherlinkSignerAddress() ]); - testTezosAccountAddress = connectedAddresses[0]; - testEtherlinkAccountAddress = connectedAddresses[1]; + testTezosAccountAddress = connectedAddresses[0]!; + testEtherlinkAccountAddress = connectedAddresses[1]!; }); afterEach(() => { From e966c4162df299625d39503028f75516e306f4fc Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Tue, 5 Mar 2024 00:12:18 +0300 Subject: [PATCH 10/20] Update the fetch balances methods, use the fetchOptions instead of method parameters --- .../balancesBridgeDataProvider.ts | 5 +-- .../balancesFetchOptions.ts | 4 +++ .../etherlinkNodeBalancesProvider.ts | 18 +++++----- .../balancesBridgeDataProvider/index.ts | 1 + .../tzKTBalancesProvider.ts | 17 ++++------ .../defaultDataProvider.ts | 16 ++++----- .../dipDupBridgeDataProvider.ts | 34 +++++++++---------- src/bridgeDataProviders/index.ts | 3 +- src/common/fetchOptions.ts | 4 +++ src/common/index.ts | 2 +- src/common/network.ts | 1 - src/tokenBridge/tokenBridge.ts | 12 +++---- 12 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 src/bridgeDataProviders/balancesBridgeDataProvider/balancesFetchOptions.ts create mode 100644 src/common/fetchOptions.ts delete mode 100644 src/common/network.ts diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts index 96cb965..0f5e16b 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/balancesBridgeDataProvider.ts @@ -1,4 +1,5 @@ import type { AccountTokenBalance, AccountTokenBalances } from './accountTokenBalances'; +import type { BalancesFetchOptions } from './balancesFetchOptions'; import type { TezosToken, EtherlinkToken } from '../../tokens'; export interface BalancesBridgeDataProvider { @@ -6,6 +7,6 @@ export interface BalancesBridgeDataProvider { getBalances(accountAddress: string): Promise; getBalances(accountAddress: string, tokens: ReadonlyArray): Promise; - getBalances(accountAddress: string, offset: number, limit: number): Promise; - getBalances(accountAddress: string, tokensOrOffset?: ReadonlyArray | number, limit?: number): Promise; + getBalances(accountAddress: string, fetchOptions: BalancesFetchOptions): Promise; + getBalances(accountAddress: string, tokensOrFetchOptions?: ReadonlyArray | BalancesFetchOptions): Promise; } diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/balancesFetchOptions.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/balancesFetchOptions.ts new file mode 100644 index 0000000..5daed29 --- /dev/null +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/balancesFetchOptions.ts @@ -0,0 +1,4 @@ +import type { FetchOptions } from '../../common'; + +export interface BalancesFetchOptions extends FetchOptions { +} diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts index 6a2a037..516c947 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/etherlinkNodeBalancesProvider/etherlinkNodeBalancesProvider.ts @@ -3,8 +3,10 @@ import { EtherlinkNodeRPCError, EtherlinkNodeTokenBalanceNotSupported } from './ import { RemoteService } from '../../../common'; import { getErrorLogMessage, loggerProvider } from '../../../logging'; import type { NativeEtherlinkToken } from '../../../tokens'; +import { guards } from '../../../utils'; import type { AccountTokenBalance, AccountTokenBalances } from '../accountTokenBalances'; import type { BalancesBridgeDataProvider } from '../balancesBridgeDataProvider'; +import type { BalancesFetchOptions } from '../balancesFetchOptions'; export class EtherlinkNodeBalancesProvider extends RemoteService implements BalancesBridgeDataProvider { async getBalance(accountAddress: string, token: NativeEtherlinkToken): Promise { @@ -19,17 +21,13 @@ export class EtherlinkNodeBalancesProvider extends RemoteService implements Bala async getBalances(accountAddress: string): Promise; async getBalances(accountAddress: string, tokens: readonly NativeEtherlinkToken[]): Promise; - async getBalances(accountAddress: string, offset: number, limit: number): Promise; - async getBalances(accountAddress: string, tokensOrOffset?: readonly NativeEtherlinkToken[] | number, limit?: number): Promise; - async getBalances( - accountAddress: string, - tokensOrOffset?: readonly NativeEtherlinkToken[] | number, - _limit?: number - ): Promise { - const isAllTokens = typeof tokensOrOffset === 'number' || !tokensOrOffset; + async getBalances(accountAddress: string, fetchOptions: BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: readonly NativeEtherlinkToken[] | BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: readonly NativeEtherlinkToken[] | BalancesFetchOptions): Promise { + const isAllTokens = !guards.isReadonlyArray(tokensOrFetchOptions); - if (!isAllTokens && tokensOrOffset.length && tokensOrOffset[0]!.type !== 'native') { - const error = new EtherlinkNodeTokenBalanceNotSupported(tokensOrOffset[0]!); + if (!isAllTokens && tokensOrFetchOptions.length && tokensOrFetchOptions[0]!.type !== 'native') { + const error = new EtherlinkNodeTokenBalanceNotSupported(tokensOrFetchOptions[0]!); loggerProvider.logger.error(error); throw error; } diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/index.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/index.ts index 2d168ce..61776e7 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/index.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/index.ts @@ -1,4 +1,5 @@ export type { AccountTokenBalance, AccountTokenBalances, TokenBalanceInfo } from './accountTokenBalances'; export type { BalancesBridgeDataProvider } from './balancesBridgeDataProvider'; +export type { BalancesFetchOptions } from './balancesFetchOptions'; export { TzKTBalancesProvider } from './tzKTBalancesProvider'; export { EtherlinkNodeBalancesProvider } from './etherlinkNodeBalancesProvider'; diff --git a/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts b/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts index b2db519..4124f8f 100644 --- a/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts +++ b/src/bridgeDataProviders/balancesBridgeDataProvider/tzKTBalancesProvider/tzKTBalancesProvider.ts @@ -7,6 +7,7 @@ import type { TezosToken, NativeTezosToken, NonNativeTezosToken, FA2TezosToken } import { guards, tokenUtils } from '../../../utils'; import type { AccountTokenBalance, AccountTokenBalances, TokenBalanceInfo } from '../accountTokenBalances'; import type { BalancesBridgeDataProvider } from '../balancesBridgeDataProvider'; +import type { BalancesFetchOptions } from '../balancesFetchOptions'; export class TzKTBalancesProvider extends RemoteService implements BalancesBridgeDataProvider { protected static readonly defaultLoadDataLimit = 10000; @@ -31,16 +32,12 @@ export class TzKTBalancesProvider extends RemoteService implements BalancesBridg async getBalances(accountAddress: string): Promise; async getBalances(accountAddress: string, tokens: readonly TezosToken[]): Promise; - async getBalances(accountAddress: string, offset: number, limit: number): Promise; - async getBalances(accountAddress: string, tokensOrOffset?: readonly TezosToken[] | number, limit?: number): Promise; - async getBalances( - accountAddress: string, - tokensOrOffset?: readonly TezosToken[] | number, - limit?: number - ): Promise { - return typeof tokensOrOffset === 'number' || !tokensOrOffset - ? this.getAllTokenBalances(accountAddress, tokensOrOffset, limit) - : this.getTezosTokenBalances(accountAddress, tokensOrOffset); + async getBalances(accountAddress: string, fetchOptions: BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: readonly TezosToken[] | BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: readonly TezosToken[] | BalancesFetchOptions): Promise { + return guards.isReadonlyArray(tokensOrFetchOptions) + ? this.getTezosTokenBalances(accountAddress, tokensOrFetchOptions) + : this.getAllTokenBalances(accountAddress, tokensOrFetchOptions?.offset, tokensOrFetchOptions?.limit); } protected async getAllTokenBalances(accountAddress: string, offset?: number, limit?: number) { diff --git a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts index d53612f..1e513df 100644 --- a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts +++ b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts @@ -7,7 +7,7 @@ import type { import { guards, memoize } from '../../utils'; import { TzKTBalancesProvider, EtherlinkNodeBalancesProvider, - type AccountTokenBalance, type AccountTokenBalances, type BalancesBridgeDataProvider + type AccountTokenBalance, type AccountTokenBalances, type BalancesBridgeDataProvider, type BalancesFetchOptions } from '../balancesBridgeDataProvider'; import { DipDupBridgeDataProvider } from '../dipDupBridgeDataProvider'; import { LocalTokensBridgeDataProvider, type TokensBridgeDataProvider } from '../tokensBridgeDataProvider'; @@ -113,11 +113,11 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance async getBalances(accountAddress: string): Promise; async getBalances(accountAddress: string, tokens: ReadonlyArray): Promise; - async getBalances(accountAddress: string, offset: number, limit: number): Promise; - async getBalances(accountAddress: string, tokensOrOffset?: number | ReadonlyArray | undefined, limit?: number | undefined): Promise; - async getBalances(accountAddress: string, tokensOrOffset?: number | ReadonlyArray | undefined, limit?: number | undefined): Promise { + async getBalances(accountAddress: string, fetchOptions: BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: ReadonlyArray | BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: ReadonlyArray | BalancesFetchOptions): Promise { const isEtherlinkAccount = this.isEtherlinkAccount(accountAddress); - const tokenGroups = typeof tokensOrOffset === 'number' || !tokensOrOffset ? null : this.groupTokens(tokensOrOffset); + const tokenGroups = guards.isReadonlyArray(tokensOrFetchOptions) ? this.groupTokens(tokensOrFetchOptions) : null; const promises: Array> = []; if (isEtherlinkAccount) { @@ -128,9 +128,9 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance promises.push(this.dipDupBridgeDataProvider.getBalances(accountAddress, tokenGroups.nonNativeEtherlinkTokens)); } else { - if (!tokensOrOffset) + if (!(tokensOrFetchOptions as BalancesFetchOptions | undefined)?.offset) promises.push(this.etherlinkNodeBalancesDataProvider.getBalances(accountAddress, nativeTokenArray)); - promises.push(this.dipDupBridgeDataProvider.getBalances(accountAddress, tokensOrOffset as number, limit)); + promises.push(this.dipDupBridgeDataProvider.getBalances(accountAddress, tokensOrFetchOptions as BalancesFetchOptions | undefined)); } } else { @@ -141,7 +141,7 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance promises.push(this.tzKTBalancesDataProvider.getBalances(accountAddress, tokenGroups.nonNativeTezosTokens)); } else { - promises.push(this.tzKTBalancesDataProvider.getBalances(accountAddress, tokensOrOffset as number, limit)); + promises.push(this.tzKTBalancesDataProvider.getBalances(accountAddress, tokensOrFetchOptions as BalancesFetchOptions | undefined)); } } diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts index 9c4c403..6b88e16 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts @@ -14,8 +14,8 @@ import { getTokenLogMessage } from '../../logging'; import type { NonNativeEtherlinkToken } from '../../tokens'; -import { bridgeUtils } from '../../utils'; -import type { BalancesBridgeDataProvider, AccountTokenBalance, AccountTokenBalances } from '../balancesBridgeDataProvider'; +import { bridgeUtils, guards } from '../../utils'; +import type { BalancesBridgeDataProvider, AccountTokenBalance, AccountTokenBalances, BalancesFetchOptions } from '../balancesBridgeDataProvider'; import type { TransfersBridgeDataProvider } from '../transfersBridgeDataProvider'; export class DipDupBridgeDataProvider extends RemoteService implements TransfersBridgeDataProvider, BalancesBridgeDataProvider, Disposable { @@ -199,32 +199,28 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers async getBalances(accountAddress: string): Promise; async getBalances(accountAddress: string, tokens: readonly NonNativeEtherlinkToken[]): Promise; - async getBalances(accountAddress: string, offset: number, limit: number): Promise; - async getBalances(accountAddress: string, tokensOrOffset?: readonly NonNativeEtherlinkToken[] | number, limit?: number): Promise; - async getBalances( - accountAddress: string, - tokensOrOffset?: readonly NonNativeEtherlinkToken[] | number, - limit?: number - ): Promise { + async getBalances(accountAddress: string, fetchOptions: BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: readonly NonNativeEtherlinkToken[] | BalancesFetchOptions): Promise; + async getBalances(accountAddress: string, tokensOrFetchOptions?: readonly NonNativeEtherlinkToken[] | BalancesFetchOptions): Promise { let query: string; - const isAllTokens = typeof tokensOrOffset === 'number' || !tokensOrOffset; + const isAllTokens = !guards.isReadonlyArray(tokensOrFetchOptions); if (isAllTokens) { query = this.dipDupGraphQLQueryBuilder.getAllTokenBalancesQuery( accountAddress, - this.getPreparedOffsetParameter(tokensOrOffset), - this.getPreparedLimitParameter(limit), + this.getPreparedOffsetParameter(tokensOrFetchOptions), + this.getPreparedLimitParameter(tokensOrFetchOptions), ); } else { - const tokenAddresses = tokensOrOffset.map(token => token.address); + const tokenAddresses = tokensOrFetchOptions.map(token => token.address); query = this.dipDupGraphQLQueryBuilder.getTokenBalancesQuery( accountAddress, tokenAddresses ); } - loggerProvider.lazyLogger.log?.(`Getting balances of the ${isAllTokens ? 'all' : getTokenLogMessage(tokensOrOffset)} tokens for the ${accountAddress} address`); + loggerProvider.lazyLogger.log?.(`Getting balances of the ${isAllTokens ? 'all' : getTokenLogMessage(tokensOrFetchOptions)} tokens for the ${accountAddress} address`); const tokenBalancesResponse = await this.fetch>('/v1/graphql', 'json', { method: 'POST', @@ -234,7 +230,7 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers }); this.ensureNoDipDupGraphQLErrors(tokenBalancesResponse); - loggerProvider.lazyLogger.log?.(`The balances of the ${isAllTokens ? 'all' : getTokenLogMessage(tokensOrOffset)} tokens for the ${accountAddress} address has been received`); + loggerProvider.lazyLogger.log?.(`The balances of the ${isAllTokens ? 'all' : getTokenLogMessage(tokensOrFetchOptions)} tokens for the ${accountAddress} address has been received`); loggerProvider.logger.debug('Mapping the tokenBalancesDTO to AccountTokenBalances...'); const accountTokenBalances = mappers.mapTokenBalancesDtoToAccountTokenBalances(tokenBalancesResponse.data, accountAddress); @@ -443,11 +439,15 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers return [previousSubscribedAddressesSize, updatedSubscribedAddressesSize]; } - private getPreparedOffsetParameter(offset: number | undefined | null): number { + private getPreparedOffsetParameter(offsetOrFetchOptions: number | undefined | null | BalancesFetchOptions): number { + const offset = typeof offsetOrFetchOptions === 'number' ? offsetOrFetchOptions : offsetOrFetchOptions?.offset; + return offset && offset > 0 ? offset : 0; } - private getPreparedLimitParameter(limit: number | undefined | null): number { + private getPreparedLimitParameter(limitOrFetchOptions: number | undefined | null | BalancesFetchOptions): number { + const limit = typeof limitOrFetchOptions === 'number' ? limitOrFetchOptions : limitOrFetchOptions?.offset; + return limit && limit > 0 ? limit : DipDupBridgeDataProvider.defaultLoadDataLimit; } diff --git a/src/bridgeDataProviders/index.ts b/src/bridgeDataProviders/index.ts index 28ca251..ed90fbc 100644 --- a/src/bridgeDataProviders/index.ts +++ b/src/bridgeDataProviders/index.ts @@ -10,7 +10,8 @@ export { type TokenBalanceInfo, type AccountTokenBalance, type AccountTokenBalances, - type BalancesBridgeDataProvider + type BalancesBridgeDataProvider, + type BalancesFetchOptions } from './balancesBridgeDataProvider'; export type { diff --git a/src/common/fetchOptions.ts b/src/common/fetchOptions.ts new file mode 100644 index 0000000..72cc1c4 --- /dev/null +++ b/src/common/fetchOptions.ts @@ -0,0 +1,4 @@ +export interface FetchOptions { + offset?: number; + limit?: number; +} diff --git a/src/common/index.ts b/src/common/index.ts index 2eff8a1..c7027ce 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -2,4 +2,4 @@ export { RemoteService, type RemoteServiceResponseFormat } from './remoteService export { EventEmitter, type PublicEventEmitter, type ToEventEmitter, type ToEventEmitters } from './eventEmitter'; export { TimeoutScheduler } from './timeoutScheduler'; export { TokenBridgeError, DisposedError } from './errors'; -export type { Network } from './network'; +export type { FetchOptions } from './fetchOptions'; diff --git a/src/common/network.ts b/src/common/network.ts deleted file mode 100644 index 669d435..0000000 --- a/src/common/network.ts +++ /dev/null @@ -1 +0,0 @@ -export type Network = 'mainnet' | 'testnet'; diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index ae2ca84..1cc4a0a 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -13,7 +13,7 @@ import { type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, type PendingBridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal, type SealedBridgeTokenWithdrawal, type FinishedBridgeTokenWithdrawal } from '../bridgeCore'; -import type { AccountTokenBalance, AccountTokenBalances } from '../bridgeDataProviders'; +import type { AccountTokenBalance, AccountTokenBalances, BalancesFetchOptions } from '../bridgeDataProviders'; import { EventEmitter, ToEventEmitter, type PublicEventEmitter } from '../common'; import { loggerProvider, @@ -407,18 +407,16 @@ export class TokenBridge< protected getBalances(accountAddress: string): Promise; protected getBalances(accountAddress: string, tokens: ReadonlyArray): Promise; - protected getBalances(accountAddress: string, offset: number, limit: number): Promise; + protected getBalances(accountAddress: string, fetchOptions: BalancesFetchOptions): Promise; protected getBalances( accountAddress: string, - tokensOrOffset?: ReadonlyArray | number, - limit?: number + tokensOfFetchOptions?: ReadonlyArray | BalancesFetchOptions ): Promise; protected getBalances( accountAddress: string, - tokensOrOffset?: ReadonlyArray | number, - limit?: number + tokensOfFetchOptions?: ReadonlyArray | BalancesFetchOptions ): Promise { - return this.bridgeComponents.balancesBridgeDataProvider.getBalances(accountAddress, tokensOrOffset, limit); + return this.bridgeComponents.balancesBridgeDataProvider.getBalances(accountAddress, tokensOfFetchOptions); } protected getRegisteredTokenPair(token: TezosToken | EtherlinkToken): Promise { From 68ab443a6d65c1fa41fc462f1545fcea91c6437a Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Tue, 5 Mar 2024 00:28:30 +0300 Subject: [PATCH 11/20] Update the fetch tokens methods, use the fetchOptions instead of method parameters --- .../defaultDataProvider/defaultDataProvider.ts | 10 +++++----- src/bridgeDataProviders/index.ts | 4 +++- .../tokensBridgeDataProvider/index.ts | 4 +++- .../localTokensBridgeDataProvider.ts | 15 +++++++++++---- .../tokensBridgeDataProvider.ts | 5 +++-- .../tokensFetchOptions.ts | 4 ++++ src/tokenBridge/tokenBridge.ts | 13 ++++++++----- 7 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 src/bridgeDataProviders/tokensBridgeDataProvider/tokensFetchOptions.ts diff --git a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts index 1e513df..eea67c4 100644 --- a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts +++ b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts @@ -10,7 +10,7 @@ import { type AccountTokenBalance, type AccountTokenBalances, type BalancesBridgeDataProvider, type BalancesFetchOptions } from '../balancesBridgeDataProvider'; import { DipDupBridgeDataProvider } from '../dipDupBridgeDataProvider'; -import { LocalTokensBridgeDataProvider, type TokensBridgeDataProvider } from '../tokensBridgeDataProvider'; +import { LocalTokensBridgeDataProvider, type TokensBridgeDataProvider, type TokensFetchOptions } from '../tokensBridgeDataProvider'; import type { TransfersBridgeDataProvider } from '../transfersBridgeDataProvider'; interface TokenGroups { @@ -176,10 +176,10 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance } getRegisteredTokenPairs(): Promise; - getRegisteredTokenPairs(offset: number, limit: number): Promise; - getRegisteredTokenPairs(offset?: number, limit?: number): Promise; - getRegisteredTokenPairs(offset?: number, limit?: number): Promise { - return this.bridgeDataProvider.getRegisteredTokenPairs(offset, limit); + getRegisteredTokenPairs(fetchOptions: TokensFetchOptions): Promise; + getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise; + getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise { + return this.bridgeDataProvider.getRegisteredTokenPairs(fetchOptions); } protected groupTokens = memoize((tokens: ReadonlyArray): TokenGroups => { diff --git a/src/bridgeDataProviders/index.ts b/src/bridgeDataProviders/index.ts index ed90fbc..091cbba 100644 --- a/src/bridgeDataProviders/index.ts +++ b/src/bridgeDataProviders/index.ts @@ -1,6 +1,8 @@ export { + LocalTokensBridgeDataProvider, + type TokensBridgeDataProvider, - LocalTokensBridgeDataProvider + type TokensFetchOptions } from './tokensBridgeDataProvider'; export { diff --git a/src/bridgeDataProviders/tokensBridgeDataProvider/index.ts b/src/bridgeDataProviders/tokensBridgeDataProvider/index.ts index 29ecdc2..3686ee1 100644 --- a/src/bridgeDataProviders/tokensBridgeDataProvider/index.ts +++ b/src/bridgeDataProviders/tokensBridgeDataProvider/index.ts @@ -1,2 +1,4 @@ -export type { TokensBridgeDataProvider } from './tokensBridgeDataProvider'; export { LocalTokensBridgeDataProvider } from './localTokensBridgeDataProvider'; + +export type { TokensBridgeDataProvider } from './tokensBridgeDataProvider'; +export type { TokensFetchOptions } from './tokensFetchOptions'; diff --git a/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts b/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts index f1abd1c..147c3aa 100644 --- a/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts +++ b/src/bridgeDataProviders/tokensBridgeDataProvider/localTokensBridgeDataProvider.ts @@ -1,4 +1,5 @@ import type { TokensBridgeDataProvider } from './tokensBridgeDataProvider'; +import type { TokensFetchOptions } from './tokensFetchOptions'; import type { TokenPair } from '../../bridgeCore'; import type { TezosToken, EtherlinkToken } from '../../tokens'; @@ -53,10 +54,16 @@ export class LocalTokensBridgeDataProvider implements TokensBridgeDataProvider { } getRegisteredTokenPairs(): Promise; - getRegisteredTokenPairs(offset: number, limit: number): Promise; - getRegisteredTokenPairs(offset?: number, limit?: number): Promise; - getRegisteredTokenPairs(offset?: number, limit?: number): Promise { - return Promise.resolve(this.tokenPairs.slice(offset, limit && (limit + (offset || 0)))); + getRegisteredTokenPairs(fetchOptions: TokensFetchOptions): Promise; + getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise; + getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise { + if (!fetchOptions) + return Promise.resolve(this.tokenPairs as TokenPair[]); + + const offset = fetchOptions.offset || 0; + const limit = fetchOptions.limit && (fetchOptions.limit + offset); + + return Promise.resolve(this.tokenPairs.slice(offset, limit)); } private createTokenPairsByTokenMap(tokenPairs: readonly TokenPair[]): TokenPairsByTokenMap { diff --git a/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts b/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts index 7c87074..0befccd 100644 --- a/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts +++ b/src/bridgeDataProviders/tokensBridgeDataProvider/tokensBridgeDataProvider.ts @@ -1,3 +1,4 @@ +import type { TokensFetchOptions } from './tokensFetchOptions'; import type { TokenPair } from '../../bridgeCore'; import type { TezosToken, EtherlinkToken } from '../../tokens'; @@ -5,6 +6,6 @@ export interface TokensBridgeDataProvider { getRegisteredTokenPair(token: TezosToken | EtherlinkToken): Promise; getRegisteredTokenPairs(): Promise; - getRegisteredTokenPairs(offset: number, limit: number): Promise; - getRegisteredTokenPairs(offset?: number, limit?: number): Promise; + getRegisteredTokenPairs(fetchOptions: TokensFetchOptions): Promise; + getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise; } diff --git a/src/bridgeDataProviders/tokensBridgeDataProvider/tokensFetchOptions.ts b/src/bridgeDataProviders/tokensBridgeDataProvider/tokensFetchOptions.ts new file mode 100644 index 0000000..28f9aca --- /dev/null +++ b/src/bridgeDataProviders/tokensBridgeDataProvider/tokensFetchOptions.ts @@ -0,0 +1,4 @@ +import type { FetchOptions } from '../../common'; + +export interface TokensFetchOptions extends FetchOptions { +} diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 1cc4a0a..8552568 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -13,7 +13,10 @@ import { type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, type PendingBridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal, type SealedBridgeTokenWithdrawal, type FinishedBridgeTokenWithdrawal } from '../bridgeCore'; -import type { AccountTokenBalance, AccountTokenBalances, BalancesFetchOptions } from '../bridgeDataProviders'; +import type { + AccountTokenBalance, AccountTokenBalances, + BalancesFetchOptions, TokensFetchOptions +} from '../bridgeDataProviders'; import { EventEmitter, ToEventEmitter, type PublicEventEmitter } from '../common'; import { loggerProvider, @@ -424,10 +427,10 @@ export class TokenBridge< } protected getRegisteredTokenPairs(): Promise; - protected getRegisteredTokenPairs(offset: number, limit: number): Promise; - protected getRegisteredTokenPairs(offset?: number, limit?: number): Promise; - protected getRegisteredTokenPairs(offset?: number, limit?: number): Promise { - return this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPairs(offset, limit); + protected getRegisteredTokenPairs(fetchOptions: TokensFetchOptions): Promise; + protected getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise; + protected getRegisteredTokenPairs(fetchOptions?: TokensFetchOptions): Promise { + return this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPairs(fetchOptions); } protected getTokenTransfer(operationHash: string): Promise; From c2c3af6531fb70e6270757ddd02db3ec187d24e9 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Tue, 5 Mar 2024 01:46:18 +0300 Subject: [PATCH 12/20] Update the fetch token transfers methods, use the fetchOptions instead of method parameters --- .../defaultDataProvider.ts | 20 ++++++------ .../dipDupBridgeDataProvider.ts | 32 ++++++++----------- src/bridgeDataProviders/index.ts | 3 +- .../transfersBridgeDataProvider/index.ts | 1 + .../transfersBridgeDataProvider.ts | 15 ++++----- .../transfersFetchOptions.ts | 4 +++ src/tokenBridge/tokenBridge.ts | 28 ++++++++-------- src/tokenBridge/tokenBridgeDataApi.ts | 6 ++-- 8 files changed, 53 insertions(+), 56 deletions(-) create mode 100644 src/bridgeDataProviders/transfersBridgeDataProvider/transfersFetchOptions.ts diff --git a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts index eea67c4..87612fa 100644 --- a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts +++ b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts @@ -11,7 +11,7 @@ import { } from '../balancesBridgeDataProvider'; import { DipDupBridgeDataProvider } from '../dipDupBridgeDataProvider'; import { LocalTokensBridgeDataProvider, type TokensBridgeDataProvider, type TokensFetchOptions } from '../tokensBridgeDataProvider'; -import type { TransfersBridgeDataProvider } from '../transfersBridgeDataProvider'; +import type { TransfersBridgeDataProvider, TransfersFetchOptions } from '../transfersBridgeDataProvider'; interface TokenGroups { nativeTokens: Array; @@ -56,19 +56,19 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance } async getTokenTransfers(): Promise; - async getTokenTransfers(offset: number, limit: number): Promise; - async getTokenTransfers(offset?: number, limit?: number): Promise; - async getTokenTransfers(offset?: number, limit?: number): Promise { - return this.dipDupBridgeDataProvider.getTokenTransfers(offset, limit); + async getTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; + async getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise; + async getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise { + return this.dipDupBridgeDataProvider.getTokenTransfers(fetchOptions); } async getAccountTokenTransfers(accountAddress: string): Promise; async getAccountTokenTransfers(accountAddresses: readonly string[]): Promise; - async getAccountTokenTransfers(accountAddress: string, offset: number, limit: number): Promise; - async getAccountTokenTransfers(accountAddresses: readonly string[], offset: number, limit: number): Promise; - async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], offset?: number, limit?: number): Promise; - async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], offset?: number, limit?: number): Promise { - return this.dipDupBridgeDataProvider.getAccountTokenTransfers(accountAddressOfAddresses, offset, limit); + async getAccountTokenTransfers(accountAddress: string, fetchOptions: TransfersFetchOptions): Promise; + async getAccountTokenTransfers(accountAddresses: readonly string[], fetchOptions: TransfersFetchOptions): Promise; + async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise; + async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise { + return this.dipDupBridgeDataProvider.getAccountTokenTransfers(accountAddressOfAddresses, fetchOptions); } subscribeToTokenTransfer(operationHash: string): void; diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts index 6b88e16..f030d52 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts @@ -16,7 +16,7 @@ import { import type { NonNativeEtherlinkToken } from '../../tokens'; import { bridgeUtils, guards } from '../../utils'; import type { BalancesBridgeDataProvider, AccountTokenBalance, AccountTokenBalances, BalancesFetchOptions } from '../balancesBridgeDataProvider'; -import type { TransfersBridgeDataProvider } from '../transfersBridgeDataProvider'; +import type { TransfersBridgeDataProvider, TransfersFetchOptions } from '../transfersBridgeDataProvider'; export class DipDupBridgeDataProvider extends RemoteService implements TransfersBridgeDataProvider, BalancesBridgeDataProvider, Disposable { protected static readonly defaultLoadDataLimit = 100; @@ -87,23 +87,19 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers } async getTokenTransfers(): Promise; - async getTokenTransfers(offset: number, limit: number): Promise; - async getTokenTransfers(offset?: number, limit?: number): Promise; - async getTokenTransfers(offset?: number, limit?: number): Promise { - return this.getTokenTransfersInternal(undefined, offset, limit); + async getTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; + async getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise; + async getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise { + return this.getTokenTransfersInternal(undefined, fetchOptions); } async getAccountTokenTransfers(accountAddress: string): Promise; async getAccountTokenTransfers(accountAddresses: readonly string[]): Promise; - async getAccountTokenTransfers(accountAddress: string, offset: number, limit: number): Promise; - async getAccountTokenTransfers(accountAddresses: readonly string[], offset: number, limit: number): Promise; - async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], offset?: number, limit?: number): Promise; - async getAccountTokenTransfers( - accountAddressOfAddresses: string | readonly string[], - offset?: number, - limit?: number - ): Promise { - return this.getTokenTransfersInternal(accountAddressOfAddresses, offset, limit); + async getAccountTokenTransfers(accountAddress: string, fetchOptions: TransfersFetchOptions): Promise; + async getAccountTokenTransfers(accountAddresses: readonly string[], fetchOptions: TransfersFetchOptions): Promise; + async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise; + async getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise { + return this.getTokenTransfersInternal(accountAddressOfAddresses, fetchOptions); } subscribeToTokenTransfer(operationHash: string): void; @@ -259,12 +255,10 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers protected async getTokenTransfersInternal( addressOrAddresses: string | readonly string[] | undefined | null, - offset: number | undefined | null, - limit: number | undefined | null + fetchOptions?: TransfersFetchOptions | undefined | null ): Promise { - - offset = this.getPreparedOffsetParameter(offset); - limit = this.getPreparedLimitParameter(limit); + const offset = this.getPreparedOffsetParameter(fetchOptions); + const limit = this.getPreparedLimitParameter(fetchOptions); loggerProvider.lazyLogger.log?.(addressOrAddresses ? `Getting token transfers for ${typeof addressOrAddresses === 'string' diff --git a/src/bridgeDataProviders/index.ts b/src/bridgeDataProviders/index.ts index 091cbba..b9a2f94 100644 --- a/src/bridgeDataProviders/index.ts +++ b/src/bridgeDataProviders/index.ts @@ -17,7 +17,8 @@ export { } from './balancesBridgeDataProvider'; export type { - TransfersBridgeDataProvider + TransfersBridgeDataProvider, + TransfersFetchOptions } from './transfersBridgeDataProvider'; export { diff --git a/src/bridgeDataProviders/transfersBridgeDataProvider/index.ts b/src/bridgeDataProviders/transfersBridgeDataProvider/index.ts index 9b859a5..01abbf9 100644 --- a/src/bridgeDataProviders/transfersBridgeDataProvider/index.ts +++ b/src/bridgeDataProviders/transfersBridgeDataProvider/index.ts @@ -1 +1,2 @@ export type { TransfersBridgeDataProvider } from './transfersBridgeDataProvider'; +export type { TransfersFetchOptions } from './transfersFetchOptions'; diff --git a/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts b/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts index 1ca7eb2..0322b1b 100644 --- a/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts +++ b/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts @@ -1,3 +1,4 @@ +import type { TransfersFetchOptions } from './transfersFetchOptions'; import type { BridgeTokenTransfer, CreatedBridgeTokenDeposit, CreatedBridgeTokenWithdrawal } from '../../bridgeCore'; import type { PublicEventEmitter } from '../../common'; @@ -14,18 +15,14 @@ export interface TransfersBridgeDataProvider { getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; getTokenTransfers(): Promise; - getTokenTransfers(offset: number, limit: number): Promise; - getTokenTransfers(offset?: number, limit?: number): Promise; + getTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; + getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise; getAccountTokenTransfers(accountAddress: string): Promise; getAccountTokenTransfers(accountAddresses: readonly string[]): Promise; - getAccountTokenTransfers(accountAddress: string, offset: number, limit: number): Promise; - getAccountTokenTransfers(accountAddresses: readonly string[], offset: number, limit: number): Promise; - getAccountTokenTransfers( - accountAddressOfAddresses: string | readonly string[], - offset?: number, - limit?: number - ): Promise; + getAccountTokenTransfers(accountAddress: string, fetchOptions: TransfersFetchOptions): Promise; + getAccountTokenTransfers(accountAddresses: readonly string[], fetchOptions: TransfersFetchOptions): Promise; + getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise; subscribeToTokenTransfer(operationHash: string): void; subscribeToTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; diff --git a/src/bridgeDataProviders/transfersBridgeDataProvider/transfersFetchOptions.ts b/src/bridgeDataProviders/transfersBridgeDataProvider/transfersFetchOptions.ts new file mode 100644 index 0000000..a3a3773 --- /dev/null +++ b/src/bridgeDataProviders/transfersBridgeDataProvider/transfersFetchOptions.ts @@ -0,0 +1,4 @@ +import type { FetchOptions } from '../../common'; + +export interface TransfersFetchOptions extends FetchOptions { +} diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 8552568..91e29d0 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -15,7 +15,7 @@ import { } from '../bridgeCore'; import type { AccountTokenBalance, AccountTokenBalances, - BalancesFetchOptions, TokensFetchOptions + BalancesFetchOptions, TokensFetchOptions, TransfersFetchOptions } from '../bridgeDataProviders'; import { EventEmitter, ToEventEmitter, type PublicEventEmitter } from '../common'; import { @@ -441,20 +441,20 @@ export class TokenBridge< } protected getTokenTransfers(): Promise; - protected getTokenTransfers(offset: number, limit: number): Promise; - protected getTokenTransfers(offset?: number, limit?: number): Promise; - protected getTokenTransfers(offset?: number, limit?: number): Promise { - return this.bridgeComponents.transfersBridgeDataProvider.getTokenTransfers(offset, limit); + protected getTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; + protected getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise; + protected getTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise { + return this.bridgeComponents.transfersBridgeDataProvider.getTokenTransfers(fetchOptions); } protected getAccountTokenTransfers(accountAddress: string): Promise; protected getAccountTokenTransfers(accountAddresses: readonly string[]): Promise; - protected getAccountTokenTransfers(accountAddress: string, offset: number, limit: number): Promise; - protected getAccountTokenTransfers(accountAddresses: readonly string[], offset: number, limit: number): Promise; - protected getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], offset?: number, limit?: number): Promise; - protected getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], offset?: number, limit?: number): Promise { + protected getAccountTokenTransfers(accountAddress: string, fetchOptions: TransfersFetchOptions): Promise; + protected getAccountTokenTransfers(accountAddresses: readonly string[], fetchOptions: TransfersFetchOptions): Promise; + protected getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise; + protected getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise { return this.bridgeComponents.transfersBridgeDataProvider - .getAccountTokenTransfers(accountAddressOfAddresses, offset, limit); + .getAccountTokenTransfers(accountAddressOfAddresses, fetchOptions); } protected async getSignerBalances(): Promise { @@ -472,9 +472,9 @@ export class TokenBridge< } protected async getSignerTokenTransfers(): Promise; - protected async getSignerTokenTransfers(offset: number, limit: number): Promise; - protected async getSignerTokenTransfers(offset?: number, limit?: number): Promise; - protected async getSignerTokenTransfers(offset?: number, limit?: number): Promise { + protected async getSignerTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; + protected async getSignerTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise; + protected async getSignerTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise { const [tezosSignerAddress, etherlinkSignerAddress] = await Promise.all([ this.getTezosSignerAddress(), this.getEtherlinkSignerAddress() @@ -485,7 +485,7 @@ export class TokenBridge< : tezosSignerAddress || etherlinkSignerAddress; return addresses - ? this.getAccountTokenTransfers(addresses, offset, limit) + ? this.getAccountTokenTransfers(addresses, fetchOptions) : []; } diff --git a/src/tokenBridge/tokenBridgeDataApi.ts b/src/tokenBridge/tokenBridgeDataApi.ts index a57162d..f32f612 100644 --- a/src/tokenBridge/tokenBridgeDataApi.ts +++ b/src/tokenBridge/tokenBridgeDataApi.ts @@ -1,7 +1,7 @@ import type { BridgeTokenTransfer } from '../bridgeCore'; import type { TokensBridgeDataProvider, BalancesBridgeDataProvider, TransfersBridgeDataProvider, - AccountTokenBalances + AccountTokenBalances, TransfersFetchOptions } from '../bridgeDataProviders'; export interface SignerTokenBalances { @@ -15,6 +15,6 @@ export interface TokenBridgeDataApi extends Pick; getSignerTokenTransfers(): Promise; - getSignerTokenTransfers(offset: number, limit: number): Promise; - getSignerTokenTransfers(offset?: number, limit?: number): Promise; + getSignerTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; + getSignerTokenTransfers(fetchOptions?: TransfersFetchOptions): Promise; } From b9900a1bbc0838a0651a6e208ca040ae903daa0c Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Tue, 5 Mar 2024 04:57:28 +0300 Subject: [PATCH 13/20] Fix a typo --- src/tokenBridge/tokenBridge.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index 91e29d0..e8459a0 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -295,7 +295,7 @@ export class TokenBridge< const etherlinkSourceAddress = await this.getRequiredEtherlinkSignerAddress(); if (!tezosReceiverAddress) { - tezosReceiverAddress = await this.getRequiredEtherlinkSignerAddress(); + tezosReceiverAddress = await this.getRequiredTezosSignerAddress(); } const tokenPair = await this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPair(token); From 48419160c97e5aec3110dea4e892fc020ff74d2b Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Tue, 5 Mar 2024 04:57:58 +0300 Subject: [PATCH 14/20] Add the estimatedOutboxMessageExecutionTimestamp rollup data --- src/bridgeCore/bridgeOperations.ts | 5 ++++- .../queryParts/bridgeWithdrawalFields.ts | 1 + .../dipDupBridgeDataProvider/dtos.ts | 3 ++- .../dipDupBridgeDataProvider/mappers.ts | 3 ++- .../getTokenTransferQueryTestCases.ts | 4 ++-- .../getTokenTransferSubscriptionTestCases.ts | 4 ++-- ...ansfersQueryByAccountAddressesTestCases.ts | 22 +++++++++---------- .../getTokenTransfersQueryTestCases.ts | 4 ++-- ...ubscriptionsByAccountAddressesTestCases.ts | 22 +++++++++---------- ...getTokenTransfersSubscriptionsTestCases.ts | 2 +- 10 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/bridgeCore/bridgeOperations.ts b/src/bridgeCore/bridgeOperations.ts index 0a052ad..bf5305e 100644 --- a/src/bridgeCore/bridgeOperations.ts +++ b/src/bridgeCore/bridgeOperations.ts @@ -21,9 +21,12 @@ export interface EtherlinkTransferTokensOperation { export interface InitialRollupData { readonly outboxMessageLevel: number; readonly outboxMessageIndex: number; + readonly estimatedOutboxMessageExecutionTimestamp?: string; } -export interface CementedRollupData extends InitialRollupData { +export interface CementedRollupData { + readonly outboxMessageLevel: number; + readonly outboxMessageIndex: number; readonly commitment: string; readonly proof: string; } diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts index e881420..f2350c8 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts @@ -28,5 +28,6 @@ l2_transaction { hash } proof + cemented_at } }`; diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts index ccdbb81..c6f7872 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts @@ -61,7 +61,8 @@ interface WithdrawalL2TransactionDto { level: number; index: number; commitment: { hash: string; } | null; - proof: string | null + proof: string | null; + cemented_at: string | null; } } diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts index 4fb2cda..a34e8ba 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts @@ -150,7 +150,8 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg etherlinkOperation, rollupData: { outboxMessageLevel: dto.l2_transaction.outbox_message.level, - outboxMessageIndex: dto.l2_transaction.outbox_message.index + outboxMessageIndex: dto.l2_transaction.outbox_message.index, + estimatedOutboxMessageExecutionTimestamp: dto.l2_transaction.outbox_message.cemented_at || undefined } }; } diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts index 9172257..29cef2b 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts @@ -11,14 +11,14 @@ export const getTokenTransferQueryByTestCases: TestCases = [ 'by Tezos operation hash', { operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', - expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ 'by Etherlink operation hash', { operationHash: '0x407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1', - expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts index 2c53731..4b46bf4 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts @@ -11,14 +11,14 @@ export const getTokenTransferSubscriptionTestCases: TestCases = [ 'by Tezos operation hash', { operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', - expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ 'by Etherlink operation hash', { operationHash: '0x407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1', - expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts index fdffb1b..3e8773e 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts @@ -15,7 +15,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: 'tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -24,7 +24,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -33,7 +33,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: '0x4A1819c83A78C948db50f80fED82721Dd0401c9b', offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -42,7 +42,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -52,7 +52,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -61,7 +61,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -70,7 +70,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo', 'tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -79,7 +79,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448', '0xce912ad4F73dBC149110091044a8f58Fd17B2b53'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -89,7 +89,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', '0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -103,7 +103,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ ], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -119,7 +119,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ ], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts index 6f13181..bd764ef 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts @@ -13,7 +13,7 @@ export const getTokenTransfersQueryTestCases: TestCases = [ { offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -21,7 +21,7 @@ export const getTokenTransfersQueryTestCases: TestCases = [ { offset: 300, limit: 10, - expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 300, limit: 10 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 300, limit: 10 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts index e9175f9..7450bae 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts @@ -13,7 +13,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: 'tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -21,7 +21,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -29,7 +29,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: '0x4A1819c83A78C948db50f80fED82721Dd0401c9b', startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -37,7 +37,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -46,7 +46,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -54,7 +54,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -62,7 +62,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo', 'tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -70,7 +70,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448', '0xce912ad4F73dBC149110091044a8f58Fd17B2b53'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -79,7 +79,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', '0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -92,7 +92,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo' ], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -107,7 +107,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase '0xce912ad4F73dBC149110091044a8f58Fd17B2b53' ], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts index c205eb1..423f2ab 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts @@ -11,7 +11,7 @@ export const getTokenTransfersSubscriptionsTestCases: TestCases = [ 'all', { startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], ]; From 746594859603edaa14e3322b1f550b3e5e846cba Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 18 Mar 2024 04:14:05 +0300 Subject: [PATCH 15/20] Add the Id field to the token transfer; Support the token transfers in the batch operations --- integration/testHelpers.ts | 21 +++- integration/tests/deposit.test.ts | 6 +- integration/tests/withdrawal.test.ts | 4 +- src/bridgeCore/bridgeOperations.ts | 10 ++ .../defaultDataProvider.ts | 42 ++++--- .../dipDupBridgeDataProvider.ts | 111 ++++++++++++----- .../dipDupGraphQLQueryBuilder.ts | 56 +++++++-- .../queryParts/bridgeDepositFields.ts | 3 + .../queryParts/bridgeWithdrawalFields.ts | 3 + .../dipDupBridgeDataProvider/dtos.ts | 8 +- .../dipDupBridgeDataProvider/errors.ts | 6 + .../dipDupBridgeDataProvider/mappers.ts | 15 ++- .../transfersBridgeDataProvider.ts | 25 ++-- src/logging/logMessages.ts | 13 +- src/tokenBridge/errors.ts | 5 +- src/tokenBridge/tokenBridge.ts | 112 +++++++++++------- src/tokenBridge/tokenBridgeDataApi.ts | 2 +- src/tokenBridge/tokenBridgeStreamApi.ts | 2 + src/utils/bridgeUtils.ts | 43 ++++++- .../dipDupGraphQLQueryBuilder.test.ts | 32 ++++- ...etOperationTokenTransfersQueryTestCases.ts | 24 ++++ ...tionTokenTransfersSubscriptionTestCases.ts | 24 ++++ .../getTokenTransferQueryTestCases.ts | 30 +++-- .../getTokenTransferSubscriptionTestCases.ts | 28 ++++- ...ansfersQueryByAccountAddressesTestCases.ts | 22 ++-- .../getTokenTransfersQueryTestCases.ts | 4 +- ...ubscriptionsByAccountAddressesTestCases.ts | 22 ++-- ...getTokenTransfersSubscriptionsTestCases.ts | 2 +- .../testCases/index.ts | 5 +- 29 files changed, 512 insertions(+), 168 deletions(-) create mode 100644 tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersQueryTestCases.ts create mode 100644 tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersSubscriptionTestCases.ts diff --git a/integration/testHelpers.ts b/integration/testHelpers.ts index a5c489e..d55acfa 100644 --- a/integration/testHelpers.ts +++ b/integration/testHelpers.ts @@ -14,7 +14,9 @@ import { type SealedBridgeTokenWithdrawal, type FinishedBridgeTokenWithdrawal } from '../src'; -const tezosOperationRegex = /^o/; +const depositIdRegex = /^o[0-9a-zA-Z]{50}_\d+_\d+$/; +const withdrawalIdRegex = /^0x[0-9a-f]{64}_\d+$/; +const tezosOperationRegex = /^o[0-9a-zA-Z]{50}$/; const etherlinkOperationRegex = /^0x[0-9a-f]{64}$/; interface CreateTestTokenBridgeParams { @@ -138,6 +140,7 @@ export const expectCreatedDeposit = ( } ) => { expect(createdBridgeTokenDeposit).toMatchObject({ + id: expect.stringMatching(depositIdRegex), kind: BridgeTokenTransferKind.Deposit, status: BridgeTokenTransferStatus.Created, source: params.source, @@ -145,6 +148,8 @@ export const expectCreatedDeposit = ( tezosOperation: { blockId: expect.any(Number), hash: expect.stringMatching(tezosOperationRegex), + counter: expect.any(Number), + nonce: expect.any(Number), amount: params.amount, token: params.tezosToken, fee: expect.any(BigInt), @@ -165,6 +170,7 @@ export const expectFinishedDeposit = ( } ) => { expect(finishedBridgeTokenDeposit).toMatchObject({ + id: expect.stringMatching(depositIdRegex), kind: BridgeTokenTransferKind.Deposit, status: BridgeTokenTransferStatus.Finished, source: params.source, @@ -172,6 +178,8 @@ export const expectFinishedDeposit = ( tezosOperation: { blockId: expect.any(Number), hash: expect.stringMatching(tezosOperationRegex), + counter: expect.any(Number), + nonce: expect.any(Number), amount: params.inAmount, token: params.tezosToken, fee: expect.any(BigInt), @@ -180,6 +188,7 @@ export const expectFinishedDeposit = ( etherlinkOperation: { blockId: expect.any(Number), hash: expect.stringMatching(etherlinkOperationRegex), + logIndex: expect.any(Number), amount: params.outAmount, token: params.etherlinkToken, fee: expect.any(BigInt), @@ -221,6 +230,7 @@ export const expectCreatedWithdrawal = ( } ) => { expect(createdBridgeTokenWithdrawal).toMatchObject({ + id: expect.stringMatching(withdrawalIdRegex), kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Created, source: params.source, @@ -228,6 +238,7 @@ export const expectCreatedWithdrawal = ( etherlinkOperation: { blockId: expect.any(Number), hash: expect.stringMatching(etherlinkOperationRegex), + logIndex: expect.any(Number), amount: params.amount, token: params.etherlinkToken, fee: expect.any(BigInt), @@ -250,6 +261,7 @@ export const expectSealedWithdrawal = ( } ) => { expect(sealedBridgeTokenWithdrawal).toMatchObject({ + id: expect.stringMatching(withdrawalIdRegex), kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Sealed, source: params.source, @@ -257,6 +269,7 @@ export const expectSealedWithdrawal = ( etherlinkOperation: { blockId: expect.any(Number), hash: expect.stringMatching(etherlinkOperationRegex), + logIndex: expect.any(Number), amount: params.amount, token: params.etherlinkToken, fee: expect.any(BigInt), @@ -266,7 +279,7 @@ export const expectSealedWithdrawal = ( outboxMessageIndex: expect.any(Number), outboxMessageLevel: expect.any(Number), commitment: expect.any(String), - proof: expect.any(String) + proof: expect.any(String), } }); }; @@ -283,6 +296,7 @@ export const expectFinishedWithdrawal = ( } ) => { expect(finishedBridgeTokenWithdrawal).toMatchObject({ + id: expect.stringMatching(withdrawalIdRegex), kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Finished, source: params.source, @@ -290,6 +304,7 @@ export const expectFinishedWithdrawal = ( etherlinkOperation: { blockId: expect.any(Number), hash: expect.stringMatching(etherlinkOperationRegex), + logIndex: expect.any(Number), amount: params.inAmount, token: params.etherlinkToken, fee: expect.any(BigInt), @@ -298,6 +313,8 @@ export const expectFinishedWithdrawal = ( tezosOperation: { blockId: expect.any(Number), hash: expect.stringMatching(tezosOperationRegex), + counter: expect.any(Number), + nonce: null, amount: params.outAmount, token: params.tezosToken, fee: expect.any(BigInt), diff --git a/integration/tests/deposit.test.ts b/integration/tests/deposit.test.ts index 6f6e0cf..4c34008 100644 --- a/integration/tests/deposit.test.ts +++ b/integration/tests/deposit.test.ts @@ -170,7 +170,7 @@ describe('Deposit', () => { }); tokenBridge.deposit(amount, tezosToken) - .then(result => tokenBridge.stream.subscribeToTokenTransfer(result.tokenTransfer)); + .then(result => tokenBridge.stream.subscribeToOperationTokenTransfers(result.tokenTransfer)); }); test('Deposit FA1.2 token, check the transfer status using events (subscribeToAccountTransfers)', done => { @@ -180,7 +180,7 @@ describe('Deposit', () => { let tokenTransferOperationHash: string | undefined; tokenBridge.addEventListener('tokenTransferCreated', tokenTransfer => { - if (bridgeUtils.getInitialOperationHash(tokenTransfer) !== tokenTransferOperationHash) + if (bridgeUtils.getInitialOperation(tokenTransfer).hash !== tokenTransferOperationHash) return; expectPendingDeposit(tokenTransfer, { @@ -193,7 +193,7 @@ describe('Deposit', () => { }); tokenBridge.addEventListener('tokenTransferUpdated', tokenTransfer => { - if (bridgeUtils.getInitialOperationHash(tokenTransfer) !== tokenTransferOperationHash) + if (bridgeUtils.getInitialOperation(tokenTransfer).hash !== tokenTransferOperationHash) return; if (tokenTransfer.status === BridgeTokenTransferStatus.Created) { diff --git a/integration/tests/withdrawal.test.ts b/integration/tests/withdrawal.test.ts index 7d5c1a8..a8c0f85 100644 --- a/integration/tests/withdrawal.test.ts +++ b/integration/tests/withdrawal.test.ts @@ -70,7 +70,7 @@ describe('Withdrawal', () => { }); const sealedBridgeTokenWithdrawal = await tokenBridge.waitForStatus( - startWithdrawResult.tokenTransfer, + createdBridgeTokenWithdrawal, BridgeTokenTransferStatus.Sealed ); expectSealedWithdrawal(sealedBridgeTokenWithdrawal, { @@ -119,7 +119,7 @@ describe('Withdrawal', () => { }); const sealedBridgeTokenWithdrawal = await tokenBridge.waitForStatus( - startWithdrawResult.tokenTransfer, + createdBridgeTokenWithdrawal, BridgeTokenTransferStatus.Sealed ); expectSealedWithdrawal(sealedBridgeTokenWithdrawal, { diff --git a/src/bridgeCore/bridgeOperations.ts b/src/bridgeCore/bridgeOperations.ts index bf5305e..d47442f 100644 --- a/src/bridgeCore/bridgeOperations.ts +++ b/src/bridgeCore/bridgeOperations.ts @@ -3,6 +3,8 @@ import type { TezosToken, EtherlinkToken } from '../tokens'; export interface TezosTransferTokensOperation { readonly blockId: number; readonly hash: string; + readonly counter: number; + readonly nonce: number | null; readonly amount: bigint; readonly token: TezosToken; readonly fee: bigint; @@ -12,6 +14,7 @@ export interface TezosTransferTokensOperation { export interface EtherlinkTransferTokensOperation { readonly blockId: number; readonly hash: string; + readonly logIndex: number; readonly amount: bigint; readonly token: EtherlinkToken; readonly fee: bigint; @@ -69,12 +72,14 @@ export interface PendingBridgeTokenDeposit extends BridgeTokenTransferBase { } export interface CreatedBridgeTokenDeposit extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Deposit; readonly status: BridgeTokenTransferStatus.Created; readonly tezosOperation: TezosTransferTokensOperation; } export interface FinishedBridgeTokenDeposit extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Deposit; readonly status: BridgeTokenTransferStatus.Finished; readonly tezosOperation: TezosTransferTokensOperation; @@ -82,6 +87,7 @@ export interface FinishedBridgeTokenDeposit extends BridgeTokenTransferBase { } export interface FailedBridgeTokenDeposit extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Deposit; readonly status: BridgeTokenTransferStatus.Failed; readonly tezosOperation: TezosTransferTokensOperation; @@ -106,6 +112,7 @@ export interface PendingBridgeTokenWithdrawal extends BridgeTokenTransferBase { } export interface CreatedBridgeTokenWithdrawal extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Withdrawal; readonly status: BridgeTokenTransferStatus.Created; readonly etherlinkOperation: EtherlinkTransferTokensOperation; @@ -113,6 +120,7 @@ export interface CreatedBridgeTokenWithdrawal extends BridgeTokenTransferBase { } export interface SealedBridgeTokenWithdrawal extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Withdrawal; readonly status: BridgeTokenTransferStatus.Sealed; readonly etherlinkOperation: EtherlinkTransferTokensOperation; @@ -120,6 +128,7 @@ export interface SealedBridgeTokenWithdrawal extends BridgeTokenTransferBase { } export interface FinishedBridgeTokenWithdrawal extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Withdrawal; readonly status: BridgeTokenTransferStatus.Finished; readonly etherlinkOperation: EtherlinkTransferTokensOperation; @@ -128,6 +137,7 @@ export interface FinishedBridgeTokenWithdrawal extends BridgeTokenTransferBase { } export interface FailedBridgeTokenWithdrawal extends BridgeTokenTransferBase { + readonly id: string; readonly kind: BridgeTokenTransferKind.Withdrawal; readonly status: BridgeTokenTransferStatus.Failed; readonly etherlinkOperation: EtherlinkTransferTokensOperation; diff --git a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts index 87612fa..cd5de93 100644 --- a/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts +++ b/src/bridgeDataProviders/defaultDataProvider/defaultDataProvider.ts @@ -48,11 +48,8 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance return this.dipDupBridgeDataProvider.events; } - async getTokenTransfer(operationHash: string): Promise; - async getTokenTransfer(tokenTransfer: BridgeTokenTransfer): Promise; - async getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; - async getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise { - return this.dipDupBridgeDataProvider.getTokenTransfer(operationHashOrTokenTransfer); + async getTokenTransfer(tokenTransferId: string): Promise { + return this.dipDupBridgeDataProvider.getTokenTransfer(tokenTransferId); } async getTokenTransfers(): Promise; @@ -71,18 +68,19 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance return this.dipDupBridgeDataProvider.getAccountTokenTransfers(accountAddressOfAddresses, fetchOptions); } - subscribeToTokenTransfer(operationHash: string): void; - subscribeToTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; - subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { - return this.dipDupBridgeDataProvider.subscribeToTokenTransfer(operationHashOrTokenTransfer); + async getOperationTokenTransfers(operationHash: string): Promise; + async getOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): Promise; + async getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; + async getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise { + return this.dipDupBridgeDataProvider.getOperationTokenTransfers(operationHashOrTokenTransfer); } - unsubscribeFromTokenTransfer(operationHash: string): void; - unsubscribeFromTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; - unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { - return this.dipDupBridgeDataProvider.unsubscribeFromTokenTransfer(operationHashOrTokenTransfer); + subscribeToTokenTransfer(tokenTransferId: string): void { + return this.dipDupBridgeDataProvider.subscribeToTokenTransfer(tokenTransferId); + } + + unsubscribeFromTokenTransfer(tokenTransferId: string): void { + return this.dipDupBridgeDataProvider.unsubscribeFromTokenTransfer(tokenTransferId); } subscribeToTokenTransfers(): void { @@ -107,6 +105,20 @@ export class DefaultDataProvider implements TransfersBridgeDataProvider, Balance return this.dipDupBridgeDataProvider.unsubscribeFromAccountTokenTransfers(accountAddressOrAddresses); } + subscribeToOperationTokenTransfers(operationHash: string): void; + subscribeToOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): void; + subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { + return this.dipDupBridgeDataProvider.subscribeToOperationTokenTransfers(operationHashOrTokenTransfer); + } + + unsubscribeFromOperationTokenTransfers(operationHash: string): void; + unsubscribeFromOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): void; + unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { + return this.dipDupBridgeDataProvider.unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer); + } + unsubscribeFromAllSubscriptions(): void { return this.dipDupBridgeDataProvider.unsubscribeFromAllSubscriptions(); } diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts index f030d52..3aadfc1 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupBridgeDataProvider.ts @@ -1,7 +1,7 @@ import type { DipDupBridgeDataProviderOptions } from './dipDupBridgeDataProviderOptions'; import { DipDupGraphQLQueryBuilder } from './dipDupGraphQLQueryBuilder'; import type { GraphQLResponse, BridgeOperationsDto, TokenBalancesDto } from './dtos'; -import { DipDupAutoUpdateIsDisabledError, DipDupGraphQLError, DipDupTokenBalanceNotSupported } from './errors'; +import { DipDupAutoUpdateIsDisabledError, DipDupGraphQLError, DipDupTokenBalanceNotSupported, DipDupTokenTransferIdInvalid } from './errors'; import * as mappers from './mappers'; import { DipDupWebSocketClient, type DipDupWebSocketResponseDto } from './webSocket'; import { loggerProvider } from '../..'; @@ -11,7 +11,8 @@ import { getErrorLogMessage, getBridgeTokenTransferLogMessage, getDetailedBridgeTokenTransferLogMessage, - getTokenLogMessage + getTokenLogMessage, + getBridgeTokenTransferIdLogMessage } from '../../logging'; import type { NonNativeEtherlinkToken } from '../../tokens'; import { bridgeUtils, guards } from '../../utils'; @@ -56,27 +57,22 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers throw error; } - async getTokenTransfer(operationHash: string): Promise; - async getTokenTransfer(tokenTransfer: BridgeTokenTransfer): Promise; - async getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; - async getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise { - const operationHash = typeof operationHashOrTokenTransfer === 'string' - ? operationHashOrTokenTransfer - : (operationHashOrTokenTransfer.kind === BridgeTokenTransferKind.Deposit) - ? operationHashOrTokenTransfer.tezosOperation.hash - : operationHashOrTokenTransfer.etherlinkOperation.hash; + async getTokenTransfer(tokenTransferId: string): Promise { + loggerProvider.logger.log('Getting token transfer by the token transfer Id:', tokenTransferId); - loggerProvider.logger.log('Getting token transfer by the operation hash:', operationHash); + const operationData = bridgeUtils.convertTokenTransferIdToOperationData(tokenTransferId); + if (!operationData) + throw new DipDupTokenTransferIdInvalid(tokenTransferId); const bridgeOperationsResponse = await this.fetch>('/v1/graphql', 'json', { method: 'POST', body: JSON.stringify({ - query: this.dipDupGraphQLQueryBuilder.getTokenTransferQuery(operationHash) + query: this.dipDupGraphQLQueryBuilder.getTokenTransferQuery(operationData[0], operationData[1], operationData[2]) }) }); this.ensureNoDipDupGraphQLErrors(bridgeOperationsResponse); - loggerProvider.logger.log('Token transfer has been received by the operation hash:', operationHash); + loggerProvider.logger.log('Token transfer has been received by the token transfer Id:', tokenTransferId); const tokenTransfer = mappers.mapBridgeOperationsDtoToBridgeTokenTransfer(bridgeOperationsResponse.data)[0]; @@ -102,32 +98,54 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers return this.getTokenTransfersInternal(accountAddressOfAddresses, fetchOptions); } - subscribeToTokenTransfer(operationHash: string): void; - subscribeToTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; - subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { - this.startDipDupWebSocketClientIfNeeded(); + async getOperationTokenTransfers(operationHash: string): Promise; + async getOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): Promise; + async getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; + async getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise { const operationHash = typeof operationHashOrTokenTransfer === 'string' ? operationHashOrTokenTransfer - : bridgeUtils.getInitialOperationHash(operationHashOrTokenTransfer); + : (operationHashOrTokenTransfer.kind === BridgeTokenTransferKind.Deposit) + ? operationHashOrTokenTransfer.tezosOperation.hash + : operationHashOrTokenTransfer.etherlinkOperation.hash; - loggerProvider.logger.log('Subscribe to the token transfer by the initial operation:', operationHash); + loggerProvider.logger.log('Getting token transfer by the operation hash:', operationHash); - const subscription = this.dipDupGraphQLQueryBuilder.getTokenTransferSubscription(operationHash); + const bridgeOperationsResponse = await this.fetch>('/v1/graphql', 'json', { + method: 'POST', + body: JSON.stringify({ + query: this.dipDupGraphQLQueryBuilder.getOperationTokenTransfersQuery(operationHash) + }) + }); + this.ensureNoDipDupGraphQLErrors(bridgeOperationsResponse); + + loggerProvider.logger.log(`Token transfer (${bridgeOperationsResponse.data.bridge_operation.length}) has been received by the operation hash:`, operationHash); + + const tokenTransfers = mappers.mapBridgeOperationsDtoToBridgeTokenTransfer(bridgeOperationsResponse.data); + + return tokenTransfers; + } + + subscribeToTokenTransfer(tokenTransferId: string): void { + this.startDipDupWebSocketClientIfNeeded(); + + loggerProvider.logger.log('Subscribe to the token transfer by the token transfer Id:', tokenTransferId); + + const operationData = bridgeUtils.convertTokenTransferIdToOperationData(tokenTransferId); + if (!operationData) + throw new DipDupTokenTransferIdInvalid(tokenTransferId); + + const subscription = this.dipDupGraphQLQueryBuilder.getTokenTransferSubscription(operationData[0], operationData[1], operationData[2]); this.dipDupWebSocketClient.subscribe(subscription); } - unsubscribeFromTokenTransfer(operationHash: string): void; - unsubscribeFromTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; - unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { - const operationHash = typeof operationHashOrTokenTransfer === 'string' - ? operationHashOrTokenTransfer - : bridgeUtils.getInitialOperationHash(operationHashOrTokenTransfer); + unsubscribeFromTokenTransfer(tokenTransferId: string): void { + loggerProvider.logger.log('Unsubscribe from the token transfer by the token transfer Id:', tokenTransferId); - loggerProvider.logger.log('Unsubscribe from the token transfer by the initial operation:', operationHash); + const operationData = bridgeUtils.convertTokenTransferIdToOperationData(tokenTransferId); + if (!operationData) + throw new DipDupTokenTransferIdInvalid(tokenTransferId); - const subscription = this.dipDupGraphQLQueryBuilder.getTokenTransferSubscription(operationHash); + const subscription = this.dipDupGraphQLQueryBuilder.getTokenTransferSubscription(operationData[0], operationData[1], operationData[2]); this.dipDupWebSocketClient.unsubscribe(subscription); } @@ -155,6 +173,35 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers this.unsubscribeFromTokenTransfersInternal(accountAddressOrAddresses); } + subscribeToOperationTokenTransfers(operationHash: string): void; + subscribeToOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): void; + subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { + this.startDipDupWebSocketClientIfNeeded(); + const operationHash = typeof operationHashOrTokenTransfer === 'string' + ? operationHashOrTokenTransfer + : bridgeUtils.getInitialOperation(operationHashOrTokenTransfer).hash; + + loggerProvider.logger.log('Subscribe to the token transfers by the initial operation:', operationHash); + + const subscription = this.dipDupGraphQLQueryBuilder.getOperationTokenTransfersSubscription(operationHash); + this.dipDupWebSocketClient.subscribe(subscription); + } + + unsubscribeFromOperationTokenTransfers(operationHash: string): void; + unsubscribeFromOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): void; + unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { + const operationHash = typeof operationHashOrTokenTransfer === 'string' + ? operationHashOrTokenTransfer + : bridgeUtils.getInitialOperation(operationHashOrTokenTransfer).hash; + + loggerProvider.logger.log('Unsubscribe from the token transfers by the initial operation:', operationHash); + + const subscription = this.dipDupGraphQLQueryBuilder.getOperationTokenTransfersSubscription(operationHash); + this.dipDupWebSocketClient.unsubscribe(subscription); + } + unsubscribeFromAllSubscriptions(): void { this.dipDupWebSocketClient.unsubscribeFromAllSubscriptions(); this.subscribedAddresses.clear(); @@ -375,7 +422,7 @@ export class DipDupBridgeDataProvider extends RemoteService implements Transfers if (!tokenTransfer) continue; - loggerProvider.lazyLogger.log?.(`The ${bridgeUtils.getInitialOperationHash(tokenTransfer)} token transfer has been ${isCreated ? 'created' : 'updated'}.`); + loggerProvider.lazyLogger.log?.(`The ${getBridgeTokenTransferIdLogMessage(tokenTransfer)} token transfer has been ${isCreated ? 'created' : 'updated'}.`); loggerProvider.lazyLogger.log?.(getBridgeTokenTransferLogMessage(tokenTransfer)); loggerProvider.lazyLogger.debug?.(getDetailedBridgeTokenTransferLogMessage(tokenTransfer)); diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.ts index 2d1c844..220cffa 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.ts @@ -24,12 +24,26 @@ export class DipDupGraphQLQueryBuilder { ) { } - getTokenTransferQuery(operationHash: string): GraphQLQuery { - return this.getTokenTransferQueryOrSubscription(operationHash, true); + getTokenTransferQuery(etherlinkOperationHash: string, logIndex: number): GraphQLQuery; + getTokenTransferQuery(tezosOperationHash: string, counter: number, nonce: number | null): GraphQLQuery; + getTokenTransferQuery(operationHash: string, counterOrLogIndex?: number, nonce?: number | null): GraphQLQuery; + getTokenTransferQuery(operationHash: string, counterOrLogIndex?: number, nonce?: number | null): GraphQLQuery { + return this.getOperationTokenTransfersQueryOrSubscription(true, operationHash, counterOrLogIndex, nonce); } - getTokenTransferSubscription(operationHash: string): GraphQLQuery { - return this.getTokenTransferQueryOrSubscription(operationHash, false); + getTokenTransferSubscription(etherlinkOperationHash: string, logIndex: number): GraphQLQuery; + getTokenTransferSubscription(tezosOperationHash: string, counter: number, nonce: number | null): GraphQLQuery; + getTokenTransferSubscription(operationHash: string, counterOrLogIndex?: number, nonce?: number | null): GraphQLQuery; + getTokenTransferSubscription(operationHash: string, counterOrLogIndex?: number, nonce?: number | null): GraphQLQuery { + return this.getOperationTokenTransfersQueryOrSubscription(false, operationHash, counterOrLogIndex, nonce); + } + + getOperationTokenTransfersQuery(operationHash: string): GraphQLQuery { + return this.getOperationTokenTransfersQueryOrSubscription(true, operationHash); + } + + getOperationTokenTransfersSubscription(operationHash: string): GraphQLQuery { + return this.getOperationTokenTransfersQueryOrSubscription(false, operationHash); } getTokenTransfersQuery( @@ -96,24 +110,48 @@ export class DipDupGraphQLQueryBuilder { }`; } - protected getTokenTransferQueryOrSubscription(operationHash: string, isQuery: boolean): GraphQLQuery { + protected getOperationTokenTransfersQueryOrSubscription(isQuery: boolean, operationHash: string): GraphQLQuery; + protected getOperationTokenTransfersQueryOrSubscription(isQuery: boolean, etherlinkOperationHash: string, logIndex: number): GraphQLQuery; + protected getOperationTokenTransfersQueryOrSubscription(isQuery: boolean, tezosOperationHash: string, counter: number, nonce: number | null): GraphQLQuery; + protected getOperationTokenTransfersQueryOrSubscription(isQuery: boolean, operationHash: string, counterOrLogIndex?: number, nonce?: number | null): GraphQLQuery; + protected getOperationTokenTransfersQueryOrSubscription(isQuery: boolean, operationHash: string, counterOrLogIndex?: number, nonce?: number | null): GraphQLQuery { const queryType = isQuery ? 'query' : 'subscription'; let whereArgument: string; if (this.isEtherlinkTransaction(operationHash)) { operationHash = this.prepareEtherlinkHexValue(operationHash, false); + const logIndexCondition = typeof counterOrLogIndex === 'number' + ? `log_index: { _eq: ${counterOrLogIndex} }` + : ''; + const l2TransactionCondition = `l2_transaction: { + transaction_hash: { _eq: "${operationHash}" } + ${logIndexCondition} + }`; + whereArgument = `where: { _or : [ - { withdrawal: { l2_transaction: { transaction_hash: { _eq: "${operationHash}" } } } } - { deposit: { l2_transaction: { transaction_hash: { _eq: "${operationHash}" } } } } + { withdrawal: { ${l2TransactionCondition} } } + { deposit: { ${l2TransactionCondition} } } ] }`; } else { + const counterCondition = typeof counterOrLogIndex === 'number' + ? `counter: { _eq: ${counterOrLogIndex} }` + : ''; + const nonceCondition = typeof nonce === 'number' + ? `nonce: { _eq: ${nonce} }` + : ''; + const l1TransactionCondition = `l1_transaction: { + operation_hash: { _eq: "${operationHash}" } + ${counterCondition} + ${nonceCondition} + }`; + whereArgument = `where: { _or : [ - { deposit: { l1_transaction: { operation_hash: { _eq: "${operationHash}" } } } } - { withdrawal: { l1_transaction: { operation_hash: { _eq: "${operationHash}" } } } } + { deposit: { ${l1TransactionCondition} } } + { withdrawal: { ${l1TransactionCondition} } } ] }`; } diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeDepositFields.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeDepositFields.ts index 3507b51..7339e37 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeDepositFields.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeDepositFields.ts @@ -2,6 +2,8 @@ export const bridgeDepositFields = ` l1_transaction { level operation_hash + counter + nonce amount ticket { token { @@ -22,6 +24,7 @@ l1_transaction { l2_transaction { level transaction_hash + log_index amount l2_token { id diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts index f2350c8..3948388 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dipDupGraphQLQueryBuilder/queryParts/bridgeWithdrawalFields.ts @@ -2,11 +2,14 @@ export const bridgeWithdrawalFields = ` l1_transaction { level operation_hash + counter + nonce timestamp } l2_transaction { level transaction_hash + log_index amount l2_token { id diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts index c6f7872..28230ac 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/dtos.ts @@ -17,6 +17,8 @@ interface TezosTicketDto { interface DepositL1TransactionDto { level: number; operation_hash: string; + counter: number; + nonce: number | null; amount: string; ticket: TezosTicketDto; l1_account: string; @@ -28,6 +30,7 @@ interface DepositL1TransactionDto { interface DepositL2TransactionDto { level: number; transaction_hash: string; + log_index: number; amount: string; l2_token: { id: string; @@ -42,13 +45,16 @@ export interface BridgeDepositDto { interface WithdrawalL1TransactionDto { level: number; - operation_hash: string + operation_hash: string; + counter: number; + nonce: number | null; timestamp: string; } interface WithdrawalL2TransactionDto { level: number; transaction_hash: string; + log_index: number; amount: string; l2_token: { id: string; diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts index 61016f2..9a05872 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/errors.ts @@ -24,3 +24,9 @@ export class DipDupTokenBalanceNotSupported extends TokenBridgeError { super(`DipDup won't be able to receive a balance of the ${tokenUtils.toDisplayString(token)}) token. Only ERC-20 tokens.`); } } + +export class DipDupTokenTransferIdInvalid extends TokenBridgeError { + constructor(tokenTransferId: string) { + super(`The token transfer Id is invalid: ${tokenTransferId}`); + } +} diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts index a34e8ba..9e4b5f1 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts @@ -11,7 +11,7 @@ import { } from '../../bridgeCore'; import { getErrorLogMessage, loggerProvider } from '../../logging'; import type { TezosToken, EtherlinkToken } from '../../tokens'; -import { etherlinkUtils } from '../../utils'; +import { bridgeUtils, etherlinkUtils } from '../../utils'; import type { AccountTokenBalance, AccountTokenBalances } from '../balancesBridgeDataProvider'; const mapTezosTokenDtoToTezosToken = (tezosTokenDto: TezosTokenDto | undefined | null): TezosToken => { @@ -51,15 +51,19 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos const tezosOperation: CreatedBridgeTokenDeposit['tezosOperation'] = { blockId: dto.l1_transaction.level, hash: dto.l1_transaction.operation_hash, + counter: dto.l1_transaction.counter, + nonce: dto.l1_transaction.nonce, amount: BigInt(dto.l1_transaction.amount), token: mapTezosTokenDtoToTezosToken(dto.l1_transaction.ticket.token), // TODO: receive the fee fee: 0n, timestamp: dto.l1_transaction.timestamp }; + const id = bridgeUtils.convertOperationDataToTokenTransferId(tezosOperation.hash, tezosOperation.counter, tezosOperation.nonce); return dto.l2_transaction ? { + id, kind: BridgeTokenTransferKind.Deposit, status: BridgeTokenTransferStatus.Finished, source, @@ -68,6 +72,7 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos etherlinkOperation: { blockId: dto.l2_transaction.level, hash: etherlinkUtils.prepareHexPrefix(dto.l2_transaction.transaction_hash, true), + logIndex: dto.l2_transaction.log_index, amount: BigInt(dto.l2_transaction.amount), token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), // TODO: receive the fee @@ -76,6 +81,7 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos } } : { + id, kind: BridgeTokenTransferKind.Deposit, status: BridgeTokenTransferStatus.Created, source, @@ -98,15 +104,18 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg const etherlinkOperation: CreatedBridgeTokenWithdrawal['etherlinkOperation'] = { blockId: dto.l2_transaction.level, hash: etherlinkUtils.prepareHexPrefix(dto.l2_transaction.transaction_hash, true), + logIndex: dto.l2_transaction.log_index, amount, token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), // TODO: receive the fee fee: 0n, timestamp: dto.l2_transaction.timestamp }; + const id = bridgeUtils.convertOperationDataToTokenTransferId(etherlinkOperation.hash, etherlinkOperation.logIndex); return dto.l1_transaction ? { + id, kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Finished, source, @@ -114,6 +123,8 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg tezosOperation: { blockId: dto.l1_transaction.level, hash: dto.l1_transaction.operation_hash, + counter: dto.l1_transaction.counter, + nonce: dto.l1_transaction.nonce, amount, token: mapTezosTokenDtoToTezosToken(dto.l2_transaction.l2_token?.ticket?.token), // TODO: receive the fee @@ -130,6 +141,7 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg } : dto.l2_transaction.outbox_message.commitment && dto.l2_transaction.outbox_message.proof ? { + id, kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Sealed, source, @@ -143,6 +155,7 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg } } : { + id, kind: BridgeTokenTransferKind.Withdrawal, status: BridgeTokenTransferStatus.Created, source, diff --git a/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts b/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts index 0322b1b..3ad016f 100644 --- a/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts +++ b/src/bridgeDataProviders/transfersBridgeDataProvider/transfersBridgeDataProvider.ts @@ -10,9 +10,7 @@ interface TransfersBridgeDataProviderEvents { export interface TransfersBridgeDataProvider { readonly events: TransfersBridgeDataProviderEvents; - getTokenTransfer(operationHash: string): Promise; - getTokenTransfer(tokenTransfer: BridgeTokenTransfer): Promise; - getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; + getTokenTransfer(tokenTransferId: string): Promise; getTokenTransfers(): Promise; getTokenTransfers(fetchOptions: TransfersFetchOptions): Promise; @@ -24,12 +22,13 @@ export interface TransfersBridgeDataProvider { getAccountTokenTransfers(accountAddresses: readonly string[], fetchOptions: TransfersFetchOptions): Promise; getAccountTokenTransfers(accountAddressOfAddresses: string | readonly string[], fetchOptions?: TransfersFetchOptions): Promise; - subscribeToTokenTransfer(operationHash: string): void; - subscribeToTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; - subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - unsubscribeFromTokenTransfer(operationHash: string): void; - unsubscribeFromTokenTransfer(tokenTransfer: BridgeTokenTransfer): void; - unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + getOperationTokenTransfers(operationHash: string): Promise; + getOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): Promise; + getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; + + subscribeToTokenTransfer(tokenTransferId: string): void; + + unsubscribeFromTokenTransfer(tokenTransferId: string): void; subscribeToTokenTransfers(): void; @@ -43,5 +42,13 @@ export interface TransfersBridgeDataProvider { unsubscribeFromAccountTokenTransfers(accountAddresses: readonly string[]): void; unsubscribeFromAccountTokenTransfers(accountAddressOrAddresses: string | readonly string[]): void; + subscribeToOperationTokenTransfers(operationHash: string): void; + subscribeToOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): void; + subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + + unsubscribeFromOperationTokenTransfers(operationHash: string): void; + unsubscribeFromOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): void; + unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + unsubscribeFromAllSubscriptions(): void; } diff --git a/src/logging/logMessages.ts b/src/logging/logMessages.ts index 133a3de..813e7c8 100644 --- a/src/logging/logMessages.ts +++ b/src/logging/logMessages.ts @@ -18,6 +18,16 @@ export const getErrorLogMessage = (error: any): string => { export const getTokenLogMessage = tokenUtils.toDisplayString; +export const getBridgeTokenTransferIdLogMessage = (bridgeTokenTransfer: BridgeTokenTransfer | null | undefined): string => { + return bridgeTokenTransfer + ? bridgeTokenTransfer.status !== BridgeTokenTransferStatus.Pending + ? bridgeTokenTransfer.id + : `none (${bridgeUtils.getInitialOperation(bridgeTokenTransfer).hash})` + : bridgeTokenTransfer === null + ? 'null' + : 'undefined'; +}; + const getNullOrUndefinedBridgeTokenTransferLogMessage = (bridgeTokenTransfer: null | undefined): string => { return `Bridge Token transfer is ${bridgeTokenTransfer === null ? 'null' : 'undefined'}`; }; @@ -25,6 +35,7 @@ const getNullOrUndefinedBridgeTokenTransferLogMessage = (bridgeTokenTransfer: nu export const getBridgeTokenTransferLogMessage = (bridgeTokenTransfer: BridgeTokenTransfer | null | undefined): string => { return bridgeTokenTransfer ? `Bridge Token Transfer: + Id: ${bridgeTokenTransfer && bridgeTokenTransfer.status !== BridgeTokenTransferStatus.Pending ? bridgeTokenTransfer.id : 'none'} Kind: ${BridgeTokenTransferKind[bridgeTokenTransfer.kind]} Status: ${BridgeTokenTransferStatus[bridgeTokenTransfer.status]} Source: ${bridgeTokenTransfer.source} @@ -38,7 +49,7 @@ export const getBridgeTokenTransferLogMessage = (bridgeTokenTransfer: BridgeToke export const getDetailedBridgeTokenTransferLogMessage = (bridgeTokenTransfer: BridgeTokenTransfer | null | undefined): string => { return bridgeTokenTransfer - ? `Bridge Token Transfer [${bridgeUtils.getInitialOperationHash(bridgeTokenTransfer)}]: + ? `Bridge Token Transfer [${getBridgeTokenTransferIdLogMessage(bridgeTokenTransfer)}]: ${bridgeUtils.stringifyBridgeTokenTransfer(bridgeTokenTransfer, 2)} diff --git a/src/tokenBridge/errors.ts b/src/tokenBridge/errors.ts index 20eee85..3fe3e08 100644 --- a/src/tokenBridge/errors.ts +++ b/src/tokenBridge/errors.ts @@ -1,7 +1,8 @@ import type { BridgeTokenTransfer } from '../bridgeCore'; import { DisposedError, TokenBridgeError } from '../common'; +import { getBridgeTokenTransferIdLogMessage } from '../logging'; import type { TezosToken, EtherlinkToken } from '../tokens'; -import { bridgeUtils, tokenUtils } from '../utils'; +import { tokenUtils } from '../utils'; export class TokenBridgeDisposed extends DisposedError { constructor() { @@ -35,7 +36,7 @@ export class FailedTokenTransferError extends TokenBridgeError { } private static getMessage(tokenTransfer: BridgeTokenTransfer): string { - return `The ${bridgeUtils.getInitialOperationHash(tokenTransfer)} token transfer is failed`; + return `The ${getBridgeTokenTransferIdLogMessage(tokenTransfer)} token transfer is failed`; } } diff --git a/src/tokenBridge/tokenBridge.ts b/src/tokenBridge/tokenBridge.ts index e8459a0..3e68b70 100644 --- a/src/tokenBridge/tokenBridge.ts +++ b/src/tokenBridge/tokenBridge.ts @@ -28,12 +28,8 @@ import type { } from '../tokens'; import { bridgeUtils, guards } from '../utils'; -type TokenTransferCreatedEventArgument = readonly [ - tokenTransfer: PendingBridgeTokenDeposit | PendingBridgeTokenWithdrawal | CreatedBridgeTokenDeposit | CreatedBridgeTokenWithdrawal -]; - interface TokenBridgeComponentsEvents { - readonly tokenTransferCreated: PublicEventEmitter; + readonly tokenTransferCreated: PublicEventEmitter; readonly tokenTransferUpdated: PublicEventEmitter; } @@ -53,7 +49,7 @@ export class TokenBridge< tokenTransferUpdated: new EventEmitter() }; - protected readonly tokenTransferOperationWatchers = new Map< + protected readonly tokenTransferStatusWatchers = new Map< string, Map, @@ -82,6 +78,7 @@ export class TokenBridge< getTokenTransfer: this.getTokenTransfer.bind(this), getTokenTransfers: this.getTokenTransfers.bind(this), getAccountTokenTransfers: this.getAccountTokenTransfers.bind(this), + getOperationTokenTransfers: this.getOperationTokenTransfers.bind(this), getSignerBalances: this.getSignerBalances.bind(this), getSignerTokenTransfers: this.getSignerTokenTransfers.bind(this), }; @@ -89,9 +86,11 @@ export class TokenBridge< subscribeToTokenTransfer: this.subscribeToTokenTransfer.bind(this), subscribeToTokenTransfers: this.subscribeToTokenTransfers.bind(this), subscribeToAccountTokenTransfers: this.subscribeToAccountTokenTransfers.bind(this), + subscribeToOperationTokenTransfers: this.subscribeToOperationTokenTransfers.bind(this), unsubscribeFromTokenTransfer: this.unsubscribeFromTokenTransfer.bind(this), unsubscribeFromTokenTransfers: this.unsubscribeFromTokenTransfers.bind(this), unsubscribeFromAccountTokenTransfers: this.unsubscribeFromAccountTokenTransfers.bind(this), + unsubscribeFromOperationTokenTransfers: this.unsubscribeFromOperationTokenTransfers.bind(this), unsubscribeFromAllSubscriptions: this.unsubscribeFromAllSubscriptions.bind(this) }; @@ -137,15 +136,20 @@ export class TokenBridge< if (transfer.status >= status) return transfer; - const operationHash = bridgeUtils.getInitialOperationHash(transfer); - const updatedTransfer = await this.bridgeComponents.transfersBridgeDataProvider.getTokenTransfer(operationHash); + const isPending = transfer.status === BridgeTokenTransferStatus.Pending; + const updatedTransfers = await (isPending + ? this.bridgeComponents.transfersBridgeDataProvider.getOperationTokenTransfers(transfer) + : this.bridgeComponents.transfersBridgeDataProvider.getTokenTransfer(transfer.id)); + const updatedTransfer = guards.isArray(updatedTransfers) ? updatedTransfers[0] : updatedTransfers; + if (updatedTransfer?.status === status) return updatedTransfer; - let statusWatchers = this.tokenTransferOperationWatchers.get(operationHash); + const statusWatcherKey = isPending ? bridgeUtils.getInitialOperation(transfer).hash : transfer.id; + let statusWatchers = this.tokenTransferStatusWatchers.get(statusWatcherKey); if (!statusWatchers) { statusWatchers = new Map(); - this.tokenTransferOperationWatchers.set(operationHash, statusWatchers); + this.tokenTransferStatusWatchers.set(statusWatcherKey, statusWatchers); } const watcher = statusWatchers.get(status); @@ -153,23 +157,24 @@ export class TokenBridge< return watcher.promise; const watcherPromise = new Promise((resolve, reject) => { - const statusWatchers = this.tokenTransferOperationWatchers.get(operationHash); + const statusWatchers = this.tokenTransferStatusWatchers.get(statusWatcherKey); if (!statusWatchers) { - reject(`Status watchers map not found for the ${operationHash} operation`); + reject(`Status watchers map not found for the ${statusWatcherKey} token transfer`); return; } setTimeout(() => { try { - this.bridgeComponents.transfersBridgeDataProvider.subscribeToTokenTransfer(operationHash); + this.bridgeComponents.transfersBridgeDataProvider[isPending ? 'subscribeToOperationTokenTransfers' : 'subscribeToTokenTransfer'](statusWatcherKey); + statusWatchers.set(status, { promise: watcherPromise, resolve: (updatedTransfer: BridgeTokenTransfer) => { - this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromTokenTransfer(operationHash); + this.bridgeComponents.transfersBridgeDataProvider[isPending ? 'unsubscribeFromOperationTokenTransfers' : 'unsubscribeFromTokenTransfer'](statusWatcherKey); resolve(updatedTransfer); }, reject: (error: unknown) => { - this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromTokenTransfer(operationHash); + this.bridgeComponents.transfersBridgeDataProvider[isPending ? 'unsubscribeFromOperationTokenTransfers' : 'unsubscribeFromTokenTransfer'](statusWatcherKey); reject(error); } }); @@ -433,11 +438,8 @@ export class TokenBridge< return this.bridgeComponents.tokensBridgeDataProvider.getRegisteredTokenPairs(fetchOptions); } - protected getTokenTransfer(operationHash: string): Promise; - protected getTokenTransfer(tokenTransfer: BridgeTokenTransfer): Promise; - protected getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; - protected getTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise { - return this.bridgeComponents.transfersBridgeDataProvider.getTokenTransfer(operationHashOrTokenTransfer); + protected getTokenTransfer(tokenTransferId: string): Promise { + return this.bridgeComponents.transfersBridgeDataProvider.getTokenTransfer(tokenTransferId); } protected getTokenTransfers(): Promise; @@ -457,6 +459,13 @@ export class TokenBridge< .getAccountTokenTransfers(accountAddressOfAddresses, fetchOptions); } + protected getOperationTokenTransfers(operationHash: string): Promise; + protected getOperationTokenTransfers(tokenTransfer: BridgeTokenTransfer): Promise; + protected getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise; + protected getOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): Promise { + return this.bridgeComponents.transfersBridgeDataProvider.getOperationTokenTransfers(operationHashOrTokenTransfer); + } + protected async getSignerBalances(): Promise { const [tezosSignerBalances, etherlinkSignerBalances] = await Promise.all([ this.getTezosSignerAddress() @@ -493,19 +502,12 @@ export class TokenBridge< // #region Stream API - protected subscribeToTokenTransfer(transfer: BridgeTokenTransfer): void; - protected subscribeToTokenTransfer(operationHash: BridgeTokenTransfer): void; - protected subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - protected subscribeToTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { - this.bridgeComponents.transfersBridgeDataProvider.subscribeToTokenTransfer(operationHashOrTokenTransfer); + protected subscribeToTokenTransfer(tokenTransferId: string): void { + this.bridgeComponents.transfersBridgeDataProvider.subscribeToTokenTransfer(tokenTransferId); } - protected unsubscribeFromTokenTransfer(transfer: BridgeTokenTransfer): void; - protected unsubscribeFromTokenTransfer(operationHash: BridgeTokenTransfer): void; - protected unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - protected unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; - protected unsubscribeFromTokenTransfer(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { - this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromTokenTransfer(operationHashOrTokenTransfer); + protected unsubscribeFromTokenTransfer(tokenTransferId: string): void { + this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromTokenTransfer(tokenTransferId); } protected subscribeToTokenTransfers(): void { @@ -530,22 +532,37 @@ export class TokenBridge< this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromAccountTokenTransfers(accountAddressOrAddresses); } + protected subscribeToOperationTokenTransfers(transfer: BridgeTokenTransfer): void; + protected subscribeToOperationTokenTransfers(operationHash: BridgeTokenTransfer): void; + protected subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + protected subscribeToOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { + this.bridgeComponents.transfersBridgeDataProvider.subscribeToOperationTokenTransfers(operationHashOrTokenTransfer); + } + + protected unsubscribeFromOperationTokenTransfers(transfer: BridgeTokenTransfer): void; + protected unsubscribeFromOperationTokenTransfers(operationHash: BridgeTokenTransfer): void; + protected unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + protected unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void; + protected unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer: string | BridgeTokenTransfer): void { + this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromOperationTokenTransfers(operationHashOrTokenTransfer); + } + protected unsubscribeFromAllSubscriptions(): void { this.bridgeComponents.transfersBridgeDataProvider.unsubscribeFromAllSubscriptions(); } // #endregion - protected emitLocalTokenTransferCreatedEvent(tokenTransfer: TokenTransferCreatedEventArgument[0]) { + protected emitLocalTokenTransferCreatedEvent(tokenTransfer: BridgeTokenTransfer) { setTimeout(() => { this.emitTokenTransferCreatedOrUpdatedEvent(tokenTransfer); }, 0); } - protected emitTokenTransferCreatedOrUpdatedEvent(tokenTransfer: TokenTransferCreatedEventArgument[0]) { + protected emitTokenTransferCreatedOrUpdatedEvent(tokenTransfer: BridgeTokenTransfer) { this.ensureLastCreatedTokenTransfersTimerIsStarted(); - const initialOperationHash = bridgeUtils.getInitialOperationHash(tokenTransfer); + const initialOperationHash = bridgeUtils.getInitialOperation(tokenTransfer).hash; let eventName: 'tokenTransferCreated' | 'tokenTransferUpdated'; if (this.lastCreatedTokenTransfers.has(initialOperationHash)) { eventName = 'tokenTransferUpdated'; @@ -561,10 +578,21 @@ export class TokenBridge< } protected resolveStatusWatcherIfNeeded(tokenTransfer: BridgeTokenTransfer) { - const initialOperationHash = bridgeUtils.getInitialOperationHash(tokenTransfer); - const statusWatchers = this.tokenTransferOperationWatchers.get(initialOperationHash); - if (!statusWatchers) - return; + let statusWatcherKey: string; + let statusWatchers: ReturnType; + + if (tokenTransfer.status !== BridgeTokenTransferStatus.Pending) { + statusWatcherKey = tokenTransfer.id; + statusWatchers = this.tokenTransferStatusWatchers.get(tokenTransfer.id); + } + + if (!statusWatchers) { + statusWatcherKey = bridgeUtils.getInitialOperation(tokenTransfer).hash; + statusWatchers = this.tokenTransferStatusWatchers.get(statusWatcherKey); + + if (!statusWatchers) + return; + } for (const [status, watcher] of statusWatchers) { if (tokenTransfer.status >= status) { @@ -577,11 +605,11 @@ export class TokenBridge< } if (!statusWatchers.size) - this.tokenTransferOperationWatchers.delete(initialOperationHash); + this.tokenTransferStatusWatchers.delete(statusWatcherKey!); } protected rejectAndClearAllStatusWatchers(error: unknown) { - for (const statusWatchers of this.tokenTransferOperationWatchers.values()) { + for (const statusWatchers of this.tokenTransferStatusWatchers.values()) { for (const statusWatcher of statusWatchers.values()) { statusWatcher.reject(error); } @@ -589,7 +617,7 @@ export class TokenBridge< statusWatchers.clear(); } - this.tokenTransferOperationWatchers.clear(); + this.tokenTransferStatusWatchers.clear(); } protected attachEvents() { @@ -602,7 +630,7 @@ export class TokenBridge< this.bridgeComponents.transfersBridgeDataProvider.events.tokenTransferCreated.removeListener(this.handleTransfersBridgeDataProviderTokenTransferCreated); } - protected handleTransfersBridgeDataProviderTokenTransferCreated = (createdTokenTransfer: TokenTransferCreatedEventArgument[0]) => { + protected handleTransfersBridgeDataProviderTokenTransferCreated = (createdTokenTransfer: BridgeTokenTransfer) => { this.resolveStatusWatcherIfNeeded(createdTokenTransfer); this.emitTokenTransferCreatedOrUpdatedEvent(createdTokenTransfer); }; diff --git a/src/tokenBridge/tokenBridgeDataApi.ts b/src/tokenBridge/tokenBridgeDataApi.ts index f32f612..5299348 100644 --- a/src/tokenBridge/tokenBridgeDataApi.ts +++ b/src/tokenBridge/tokenBridgeDataApi.ts @@ -11,7 +11,7 @@ export interface SignerTokenBalances { export interface TokenBridgeDataApi extends Pick, Pick, - Pick { + Pick { getSignerBalances(): Promise; getSignerTokenTransfers(): Promise; diff --git a/src/tokenBridge/tokenBridgeStreamApi.ts b/src/tokenBridge/tokenBridgeStreamApi.ts index d68ca3e..7ef7c44 100644 --- a/src/tokenBridge/tokenBridgeStreamApi.ts +++ b/src/tokenBridge/tokenBridgeStreamApi.ts @@ -5,9 +5,11 @@ export interface TokenBridgeStreamApi extends Pick< | 'subscribeToTokenTransfer' | 'subscribeToTokenTransfers' | 'subscribeToAccountTokenTransfers' + | 'subscribeToOperationTokenTransfers' | 'unsubscribeFromTokenTransfer' | 'unsubscribeFromTokenTransfers' | 'unsubscribeFromAccountTokenTransfers' + | 'unsubscribeFromOperationTokenTransfers' | 'unsubscribeFromAllSubscriptions' > { } diff --git a/src/utils/bridgeUtils.ts b/src/utils/bridgeUtils.ts index ca2f02d..5963ad5 100644 --- a/src/utils/bridgeUtils.ts +++ b/src/utils/bridgeUtils.ts @@ -1,15 +1,50 @@ import { BridgeTokenTransferKind, type BridgeTokenTransfer, type FinishedBridgeTokenDeposit } from '../bridgeCore'; +const tokenTransferIdSeparator = '_'; +const isEtherlinkTransaction = (operationHash: string) => operationHash.startsWith('0x'); + export const getInitialOperation = (tokenTransfer: BridgeTokenTransfer) => { return tokenTransfer.kind === BridgeTokenTransferKind.Deposit ? tokenTransfer.tezosOperation : tokenTransfer.etherlinkOperation; }; -export const getInitialOperationHash = (tokenTransfer: BridgeTokenTransfer): string => { - return tokenTransfer.kind === BridgeTokenTransferKind.Deposit - ? tokenTransfer.tezosOperation.hash - : tokenTransfer.etherlinkOperation.hash; +export function convertOperationDataToTokenTransferId(etherlinkOperationHash: string, logIndex: number): string; +export function convertOperationDataToTokenTransferId(tezosOperationHash: string, counter: number, nonce: number | null): string; +export function convertOperationDataToTokenTransferId(operationHash: string, logIndexOrCounter: number, nonce?: number | null): string; +export function convertOperationDataToTokenTransferId(operationHash: string, logIndexOrCounter: number, nonce?: number | null): string { + return !isEtherlinkTransaction(operationHash) && typeof nonce === 'number' + ? `${operationHash}${tokenTransferIdSeparator}${logIndexOrCounter.toString(10)}${tokenTransferIdSeparator}${nonce.toString(10)}` + : `${operationHash}${tokenTransferIdSeparator}${logIndexOrCounter.toString(10)}`; +} + +export const convertTokenTransferIdToOperationData = ( + tokenTransferId: string +): null + | readonly [tezosOperationHash: string, counter: number, nonce: number | null] + | readonly [etherlinkOperationHash: string, logIndex: number] => { + if (!tokenTransferId) + return null; + + try { + const operationData = tokenTransferId.split(tokenTransferIdSeparator); + if (!operationData[0] || !operationData[1]) + return null; + + const counterOrLogIndex = Number.parseInt(operationData[1]); + if (isEtherlinkTransaction(tokenTransferId)) + return [operationData[0], counterOrLogIndex]; + + + return operationData[2] + ? [operationData[0], counterOrLogIndex, Number.parseInt(operationData[2])] + : [operationData[0], counterOrLogIndex, null]; + } + catch { + // + } + + return null; }; export const isBridgeTokenTransferOwner = (tokenTransfer: BridgeTokenTransfer, address: string): boolean => { diff --git a/tests/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.test.ts b/tests/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.test.ts index f20f249..61e0d66 100644 --- a/tests/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.test.ts +++ b/tests/dipDupGraphQLQueryBuilder/dipDupGraphQLQueryBuilder.test.ts @@ -1,8 +1,10 @@ import { - getTokenTransferQueryByTestCases, + getTokenTransferQueryTestCases, + getOperationTokenTransfersQueryTestCases, getTokenTransfersQueryTestCases, getTokenTransfersQueryByAccountAddressesTestCases, getTokenTransferSubscriptionTestCases, + getOperationTokenTransfersSubscriptionTestCases, getTokenTransfersSubscriptionsByAccountAddressesTestCases, getTokenTransfersSubscriptionsTestCases } from './testCases'; @@ -16,8 +18,18 @@ describe('DipDup GraphQL Query Builder', () => { queryBuilder = new DipDupGraphQLQueryBuilder(); }); - test.each(getTokenTransferQueryByTestCases)( + test.each(getTokenTransferQueryTestCases)( 'Build the getTokenTransfer query %s', + (_, testData) => { + const query = queryBuilder.getTokenTransferQuery(testData.operationHash, testData.counter || testData.logIndex, testData.nonce); + const preparedQuery = prepareQueryFormatting(query); + + expect(preparedQuery).toBe(testData.expectedQuery); + } + ); + + test.each(getOperationTokenTransfersQueryTestCases)( + 'Build the getOperationTokenTransfers query %s', (_, testData) => { const query = queryBuilder.getTokenTransferQuery(testData.operationHash); const preparedQuery = prepareQueryFormatting(query); @@ -47,7 +59,17 @@ describe('DipDup GraphQL Query Builder', () => { ); test.each(getTokenTransferSubscriptionTestCases)( - 'Build the getTokenTransferSubscription query %s', + 'Build the getOperationTokenTransferSubscription query %s', + (_, testData) => { + const subscription = queryBuilder.getTokenTransferSubscription(testData.operationHash, testData.counter || testData.logIndex, testData.nonce); + const preparedSubscription = prepareQueryFormatting(subscription); + + expect(preparedSubscription).toBe(testData.expectedQuery); + } + ); + + test.each(getOperationTokenTransfersSubscriptionTestCases)( + 'Build the getOperationTokenTransfersSubscription query %s', (_, testData) => { const subscription = queryBuilder.getTokenTransferSubscription(testData.operationHash); const preparedSubscription = prepareQueryFormatting(subscription); @@ -57,7 +79,7 @@ describe('DipDup GraphQL Query Builder', () => { ); test.each(getTokenTransfersSubscriptionsByAccountAddressesTestCases)( - 'Build the getTokenTransferSubscriptions query %s', + 'Build the getTokenTransfersSubscription query %s', (_, testData) => { const subscription = queryBuilder.getTokenTransfersStreamSubscription(testData.address, testData.startUpdatedAt); const preparedSubscription = prepareQueryFormatting(subscription); @@ -67,7 +89,7 @@ describe('DipDup GraphQL Query Builder', () => { ); test.each(getTokenTransfersSubscriptionsTestCases)( - 'Build the getTokenTransferSubscriptions query %s', + 'Build the getTokenTransfersSubscription query %s', (_, testData) => { const subscription = queryBuilder.getTokenTransfersStreamSubscription(null, testData.startUpdatedAt); const preparedSubscription = prepareQueryFormatting(subscription); diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersQueryTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersQueryTestCases.ts new file mode 100644 index 0000000..95507c9 --- /dev/null +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersQueryTestCases.ts @@ -0,0 +1,24 @@ +/* eslint-disable max-len */ +import { PositiveTestCaseBase } from './testCase'; + +type TestCase = PositiveTestCaseBase<{ + operationHash: string +}>; +type TestCases = readonly TestCase[]; + +export const getOperationTokenTransfersQueryTestCases: TestCases = [ + [ + 'by Tezos operation hash', + { + operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + } + ], + [ + 'by Etherlink operation hash', + { + operationHash: '0x407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1', + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + } + ] +]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersSubscriptionTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersSubscriptionTestCases.ts new file mode 100644 index 0000000..eead406 --- /dev/null +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getOperationTokenTransfersSubscriptionTestCases.ts @@ -0,0 +1,24 @@ +/* eslint-disable max-len */ +import { PositiveTestCaseBase } from './testCase'; + +type TestCase = PositiveTestCaseBase<{ + operationHash: string, +}>; +type TestCases = readonly TestCase[]; + +export const getOperationTokenTransfersSubscriptionTestCases: TestCases = [ + [ + 'by Tezos operation hash', + { + operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + } + ], + [ + 'by Etherlink operation hash', + { + operationHash: '0x407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1', + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + } + ] +]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts index 29cef2b..2b0294b 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferQueryTestCases.ts @@ -2,23 +2,39 @@ import { PositiveTestCaseBase } from './testCase'; type TestCase = PositiveTestCaseBase<{ - operationHash: string -}>; + operationHash: string; + counter?: number; + nonce?: number; + logIndex?: number; +} & ( + | { counter: number; nonce?: number; logIndex?: undefined; } + | { counter?: undefined; nonce?: undefined; logIndex: number; })>; type TestCases = readonly TestCase[]; -export const getTokenTransferQueryByTestCases: TestCases = [ +export const getTokenTransferQueryTestCases: TestCases = [ [ - 'by Tezos operation hash', + 'by Tezos operation (without nonce)', { operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', - expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + counter: 57383, + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 57383 } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 57383 } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ - 'by Etherlink operation hash', + 'by Tezos operation (with nonce)', + { + operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', + counter: 73027, + nonce: 15, + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 73027 } nonce: { _eq: 15 } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 73027 } nonce: { _eq: 15 } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + } + ], + [ + 'by Etherlink operation', { operationHash: '0x407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1', - expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + logIndex: 10, + expectedQuery: 'query TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } log_index: { _eq: 10 } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } log_index: { _eq: 10 } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts index 4b46bf4..ffb9610 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransferSubscriptionTestCases.ts @@ -2,23 +2,39 @@ import { PositiveTestCaseBase } from './testCase'; type TestCase = PositiveTestCaseBase<{ - operationHash: string, -}>; + operationHash: string; + counter?: number; + nonce?: number; + logIndex?: number; +} & ( + | { counter: number; nonce?: number; logIndex?: undefined; } + | { counter?: undefined; nonce?: undefined; logIndex: number; })>; type TestCases = readonly TestCase[]; export const getTokenTransferSubscriptionTestCases: TestCases = [ [ - 'by Tezos operation hash', + 'by Tezos operation (without nonce)', { operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', - expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + counter: 57383, + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 57383 } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 57383 } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ - 'by Etherlink operation hash', + 'by Tezos operation (with nonce)', + { + operationHash: 'oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z', + counter: 73027, + nonce: 15, + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { deposit: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 73027 } nonce: { _eq: 15 } } } } { withdrawal: { l1_transaction: { operation_hash: { _eq: "oocHgjpnSz9A8LRPekG4Fxspc2FW7wiBj7i3nMLpTaj4KQrSH2z" } counter: { _eq: 73027 } nonce: { _eq: 15 } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + } + ], + [ + 'by Etherlink operation', { operationHash: '0x407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1', - expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + logIndex: 10, + expectedQuery: 'subscription TokenTransfer { bridge_operation(where: { _or : [ { withdrawal: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } log_index: { _eq: 10 } } } } { deposit: { l2_transaction: { transaction_hash: { _eq: "407671cc863e14b40c404ee9bd8f7281516f44d9b4785f006dc43b4f4ef8d2f1" } log_index: { _eq: 10 } } } } ] }) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts index 3e8773e..267e826 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryByAccountAddressesTestCases.ts @@ -15,7 +15,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: 'tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -24,7 +24,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -33,7 +33,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: '0x4A1819c83A78C948db50f80fED82721Dd0401c9b', offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -42,7 +42,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -52,7 +52,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -61,7 +61,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -70,7 +70,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo', 'tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -79,7 +79,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448', '0xce912ad4F73dBC149110091044a8f58Fd17B2b53'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -89,7 +89,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', '0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -103,7 +103,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ ], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -119,7 +119,7 @@ export const getTokenTransfersQueryByAccountAddressesTestCases: TestCases = [ ], offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts index bd764ef..2e0bb0a 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersQueryTestCases.ts @@ -13,7 +13,7 @@ export const getTokenTransfersQueryTestCases: TestCases = [ { offset: 0, limit: 100, - expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 0, limit: 100 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -21,7 +21,7 @@ export const getTokenTransfersQueryTestCases: TestCases = [ { offset: 300, limit: 10, - expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 300, limit: 10 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'query TokenTransfers { bridge_operation( order_by: { created_at: desc }, offset: 300, limit: 10 ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts index 7450bae..0d63f05 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsByAccountAddressesTestCases.ts @@ -13,7 +13,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: 'tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -21,7 +21,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } { withdrawal: { l2_transaction: { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -29,7 +29,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: '0x4A1819c83A78C948db50f80fED82721Dd0401c9b', startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -37,7 +37,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } { withdrawal: { l2_transaction: { l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -46,7 +46,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -54,7 +54,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -62,7 +62,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo', 'tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } { withdrawal: { l2_transaction: { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -70,7 +70,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['0x4A1819c83A78C948db50f80fED82721Dd0401c9b', '0xBefD2C6fFC36249ebEbd21d6DF6376ecF3BAc448', '0xce912ad4F73dBC149110091044a8f58Fd17B2b53'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } { withdrawal: { l2_transaction: { l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], @@ -79,7 +79,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase { address: ['tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF', '0x4A1819c83A78C948db50f80fED82721Dd0401c9b'], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _eq: "tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF" } }{ l2_account: { _eq: "4a1819c83a78c948db50f80fed82721dd0401c9b" } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -92,7 +92,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase 'tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo' ], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], [ @@ -107,7 +107,7 @@ export const getTokenTransfersSubscriptionsByAccountAddressesTestCases: TestCase '0xce912ad4F73dBC149110091044a8f58Fd17B2b53' ], startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( where: { _or: [ { deposit: { l1_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } { withdrawal: { l2_transaction: { _or: [ { l1_account: { _in: ["tz1M6VFkpALGXYoP5CvobR3z1pYu7KvirpMF","tz1YG6P2GTQKFpd9jeuESam2vg6aA9HHRkKo","tz1N96ka7u5cKVbrLdK6wa6KyLoAgdfDzKns"] } }{ l2_account: { _in: ["4a1819c83a78c948db50f80fed82721dd0401c9b","befd2c6ffc36249ebebd21d6df6376ecf3bac448","ce912ad4f73dbc149110091044a8f58fd17b2b53"] } } ] } } } ] }, batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ] ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts index 423f2ab..973c2c2 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/getTokenTransfersSubscriptionsTestCases.ts @@ -11,7 +11,7 @@ export const getTokenTransfersSubscriptionsTestCases: TestCases = [ 'all', { startUpdatedAt: new Date('2024-03-17T12:13:10.104Z'), - expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash timestamp } l2_transaction { level transaction_hash amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' + expectedQuery: 'subscription TokenTransfers { bridge_operation_stream( batch_size: 10, cursor: {initial_value: {updated_at: "2024-03-17T12:13:10.104Z"}, ordering: ASC} ) { type is_completed is_successful created_at updated_at deposit { l1_transaction { level operation_hash counter nonce amount ticket { token { type contract_address token_id } } l1_account l2_account timestamp inbox_message { type level index } } l2_transaction { level transaction_hash log_index amount l2_token { id } timestamp } } withdrawal { l1_transaction { level operation_hash counter nonce timestamp } l2_transaction { level transaction_hash log_index amount l2_token { id ticket { token { type contract_address token_id } } } l1_account l2_account timestamp outbox_message { level index commitment { hash } proof cemented_at } } } } }' } ], ]; diff --git a/tests/dipDupGraphQLQueryBuilder/testCases/index.ts b/tests/dipDupGraphQLQueryBuilder/testCases/index.ts index 34ac871..245ccb7 100644 --- a/tests/dipDupGraphQLQueryBuilder/testCases/index.ts +++ b/tests/dipDupGraphQLQueryBuilder/testCases/index.ts @@ -1,6 +1,9 @@ -export { getTokenTransferQueryByTestCases } from './getTokenTransferQueryTestCases'; +export { getTokenTransferQueryTestCases } from './getTokenTransferQueryTestCases'; +export { getOperationTokenTransfersQueryTestCases } from './getOperationTokenTransfersQueryTestCases'; export { getTokenTransfersQueryByAccountAddressesTestCases } from './getTokenTransfersQueryByAccountAddressesTestCases'; export { getTokenTransfersQueryTestCases } from './getTokenTransfersQueryTestCases'; + export { getTokenTransferSubscriptionTestCases } from './getTokenTransferSubscriptionTestCases'; +export { getOperationTokenTransfersSubscriptionTestCases } from './getOperationTokenTransfersSubscriptionTestCases'; export { getTokenTransfersSubscriptionsByAccountAddressesTestCases } from './getTokenTransfersSubscriptionsByAccountAddressesTestCases'; export { getTokenTransfersSubscriptionsTestCases } from './getTokenTransfersSubscriptionsTestCases'; From 62fe4092243450961281c04a000e43eccdda5a92 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 18 Mar 2024 04:16:07 +0300 Subject: [PATCH 16/20] Fix stopping the WebSocket before starting it --- .../webSocket/dipDupWebSocketClient.ts | 3 ++- .../webSocket/webSocketClient/index.node.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/dipDupWebSocketClient.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/dipDupWebSocketClient.ts index b9b539c..32e0b51 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/dipDupWebSocketClient.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/dipDupWebSocketClient.ts @@ -58,7 +58,7 @@ export class DipDupWebSocketClient { } stop() { - if (!this.isStarted) + if (!(this.isStarted || this._isStarting)) return; this.socket.events.messageReceived.removeListener(this.onSocketMessageReceived); @@ -67,6 +67,7 @@ export class DipDupWebSocketClient { this.reconnectScheduler[Symbol.dispose](); this._isStarted = false; + this._isStarting = false; } subscribe(query: string): boolean { diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/webSocketClient/index.node.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/webSocketClient/index.node.ts index 9dc986b..c580d48 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/webSocketClient/index.node.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/webSocket/webSocketClient/index.node.ts @@ -70,7 +70,7 @@ export class WebSocketClient implements WebSocketClientInterface { - throw new Error(`Websocket received error: ${JSON.stringify(event)}`); + throw new Error(`Websocket received error: ${event.message}`); }; protected onClosed = (event: WebSocketCloseEvent) => { From 2296caf096cd364c8e74045310aacdf63b413041 Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 18 Mar 2024 04:20:16 +0300 Subject: [PATCH 17/20] Remove the fee field from the transfer operations --- integration/testHelpers.ts | 7 ------- src/bridgeCore/bridgeOperations.ts | 2 -- .../dipDupBridgeDataProvider/mappers.ts | 8 -------- src/utils/bridgeUtils.ts | 2 +- src/utils/tezosUtils.ts | 11 ++--------- 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/integration/testHelpers.ts b/integration/testHelpers.ts index d55acfa..a478dac 100644 --- a/integration/testHelpers.ts +++ b/integration/testHelpers.ts @@ -152,7 +152,6 @@ export const expectCreatedDeposit = ( nonce: expect.any(Number), amount: params.amount, token: params.tezosToken, - fee: expect.any(BigInt), timestamp: expect.any(String), } }); @@ -182,7 +181,6 @@ export const expectFinishedDeposit = ( nonce: expect.any(Number), amount: params.inAmount, token: params.tezosToken, - fee: expect.any(BigInt), timestamp: expect.any(String), }, etherlinkOperation: { @@ -191,7 +189,6 @@ export const expectFinishedDeposit = ( logIndex: expect.any(Number), amount: params.outAmount, token: params.etherlinkToken, - fee: expect.any(BigInt), timestamp: expect.any(String), } }); @@ -241,7 +238,6 @@ export const expectCreatedWithdrawal = ( logIndex: expect.any(Number), amount: params.amount, token: params.etherlinkToken, - fee: expect.any(BigInt), timestamp: expect.any(String), }, rollupData: { @@ -272,7 +268,6 @@ export const expectSealedWithdrawal = ( logIndex: expect.any(Number), amount: params.amount, token: params.etherlinkToken, - fee: expect.any(BigInt), timestamp: expect.any(String), }, rollupData: { @@ -307,7 +302,6 @@ export const expectFinishedWithdrawal = ( logIndex: expect.any(Number), amount: params.inAmount, token: params.etherlinkToken, - fee: expect.any(BigInt), timestamp: expect.any(String), }, tezosOperation: { @@ -317,7 +311,6 @@ export const expectFinishedWithdrawal = ( nonce: null, amount: params.outAmount, token: params.tezosToken, - fee: expect.any(BigInt), timestamp: expect.any(String), }, rollupData: { diff --git a/src/bridgeCore/bridgeOperations.ts b/src/bridgeCore/bridgeOperations.ts index d47442f..05697fe 100644 --- a/src/bridgeCore/bridgeOperations.ts +++ b/src/bridgeCore/bridgeOperations.ts @@ -7,7 +7,6 @@ export interface TezosTransferTokensOperation { readonly nonce: number | null; readonly amount: bigint; readonly token: TezosToken; - readonly fee: bigint; readonly timestamp: string; } @@ -17,7 +16,6 @@ export interface EtherlinkTransferTokensOperation { readonly logIndex: number; readonly amount: bigint; readonly token: EtherlinkToken; - readonly fee: bigint; readonly timestamp: string; } diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts index 9e4b5f1..4a67f8b 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts @@ -55,8 +55,6 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos nonce: dto.l1_transaction.nonce, amount: BigInt(dto.l1_transaction.amount), token: mapTezosTokenDtoToTezosToken(dto.l1_transaction.ticket.token), - // TODO: receive the fee - fee: 0n, timestamp: dto.l1_transaction.timestamp }; const id = bridgeUtils.convertOperationDataToTokenTransferId(tezosOperation.hash, tezosOperation.counter, tezosOperation.nonce); @@ -75,8 +73,6 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos logIndex: dto.l2_transaction.log_index, amount: BigInt(dto.l2_transaction.amount), token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), - // TODO: receive the fee - fee: 0n, timestamp: dto.l2_transaction.timestamp } } @@ -107,8 +103,6 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg logIndex: dto.l2_transaction.log_index, amount, token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), - // TODO: receive the fee - fee: 0n, timestamp: dto.l2_transaction.timestamp }; const id = bridgeUtils.convertOperationDataToTokenTransferId(etherlinkOperation.hash, etherlinkOperation.logIndex); @@ -127,8 +121,6 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg nonce: dto.l1_transaction.nonce, amount, token: mapTezosTokenDtoToTezosToken(dto.l2_transaction.l2_token?.ticket?.token), - // TODO: receive the fee - fee: 0n, timestamp: dto.l1_transaction.timestamp }, etherlinkOperation, diff --git a/src/utils/bridgeUtils.ts b/src/utils/bridgeUtils.ts index 5963ad5..51488af 100644 --- a/src/utils/bridgeUtils.ts +++ b/src/utils/bridgeUtils.ts @@ -52,7 +52,7 @@ export const isBridgeTokenTransferOwner = (tokenTransfer: BridgeTokenTransfer, a }; const operationFieldNames: ReadonlyArray = ['tezosOperation', 'etherlinkOperation']; -const bigIntFieldNames: ReadonlyArray = ['amount', 'fee']; +const bigIntFieldNames: ReadonlyArray = ['amount']; const jsonStringifyReplacer = (_key: string, value: unknown) => typeof value === 'bigint' ? value.toString(10) : value; diff --git a/src/utils/tezosUtils.ts b/src/utils/tezosUtils.ts index 08661a9..ad65592 100644 --- a/src/utils/tezosUtils.ts +++ b/src/utils/tezosUtils.ts @@ -1,7 +1,4 @@ -import type { BatchOperation, TransactionOperation } from '@taquito/taquito'; -import { encodePubKey, b58decode } from '@taquito/utils'; - -import { memoize } from './memoize'; +import { b58decode, encodeAddress } from '@taquito/utils'; export const convertAddressToBytes = (address: string, addPrefix = false): string => { const bytes = b58decode(address); @@ -13,9 +10,5 @@ export const convertBytesToAddress = (bytes: string): string => { if (bytes.startsWith('0x')) bytes = bytes.substring(2); - return encodePubKey(bytes); + return encodeAddress(bytes); }; - -export const getOperationTotalCost = memoize((operation: TransactionOperation | BatchOperation) => { - return operation.fee + Number.parseInt(operation.storageDiff) * 250; -}); From d529c29f5cf8f9000e611352ca8e2d2914edd06b Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 18 Mar 2024 04:43:15 +0300 Subject: [PATCH 18/20] Support the failed token transfers --- src/bridgeCore/index.ts | 3 + .../dipDupBridgeDataProvider/mappers.ts | 152 ++++++++++-------- src/index.ts | 3 + 3 files changed, 94 insertions(+), 64 deletions(-) diff --git a/src/bridgeCore/index.ts b/src/bridgeCore/index.ts index 1eaab2c..a26e166 100644 --- a/src/bridgeCore/index.ts +++ b/src/bridgeCore/index.ts @@ -4,6 +4,9 @@ export { BridgeTokenTransferKind, BridgeTokenTransferStatus, + type TezosTransferTokensOperation, + type EtherlinkTransferTokensOperation, + type BridgeTokenTransfer, type BridgeTokenDeposit, diff --git a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts index 4a67f8b..f0f57d3 100644 --- a/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts +++ b/src/bridgeDataProviders/dipDupBridgeDataProvider/mappers.ts @@ -5,9 +5,8 @@ import type { } from './dtos'; import { BridgeTokenTransferKind, BridgeTokenTransferStatus, - type BridgeTokenTransfer, - type BridgeTokenDeposit, type CreatedBridgeTokenDeposit, - type BridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal + type TezosTransferTokensOperation, type EtherlinkTransferTokensOperation, + type BridgeTokenTransfer, type BridgeTokenDeposit, type BridgeTokenWithdrawal } from '../../bridgeCore'; import { getErrorLogMessage, loggerProvider } from '../../logging'; import type { TezosToken, EtherlinkToken } from '../../tokens'; @@ -43,12 +42,12 @@ const mapEtherlinkTokenDtoToEtherlinkToken = (etherlinkTokenId: string | undefin }; }; -export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepositDto): BridgeTokenDeposit | null => { +export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepositDto, isFailed: boolean): BridgeTokenDeposit | null => { try { const source = dto.l1_transaction.l1_account; const receiver = etherlinkUtils.toChecksumAddress(dto.l1_transaction.l2_account); - const tezosOperation: CreatedBridgeTokenDeposit['tezosOperation'] = { + const tezosOperation: TezosTransferTokensOperation = { blockId: dto.l1_transaction.level, hash: dto.l1_transaction.operation_hash, counter: dto.l1_transaction.counter, @@ -57,33 +56,46 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos token: mapTezosTokenDtoToTezosToken(dto.l1_transaction.ticket.token), timestamp: dto.l1_transaction.timestamp }; + const etherlinkOperation: EtherlinkTransferTokensOperation | undefined = dto.l2_transaction + ? { + blockId: dto.l2_transaction.level, + hash: etherlinkUtils.prepareHexPrefix(dto.l2_transaction.transaction_hash, true), + logIndex: dto.l2_transaction.log_index, + amount: BigInt(dto.l2_transaction.amount), + token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), + timestamp: dto.l2_transaction.timestamp + } + : undefined; const id = bridgeUtils.convertOperationDataToTokenTransferId(tezosOperation.hash, tezosOperation.counter, tezosOperation.nonce); - return dto.l2_transaction + return isFailed ? { id, kind: BridgeTokenTransferKind.Deposit, - status: BridgeTokenTransferStatus.Finished, + status: BridgeTokenTransferStatus.Failed, source, receiver, tezosOperation, - etherlinkOperation: { - blockId: dto.l2_transaction.level, - hash: etherlinkUtils.prepareHexPrefix(dto.l2_transaction.transaction_hash, true), - logIndex: dto.l2_transaction.log_index, - amount: BigInt(dto.l2_transaction.amount), - token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), - timestamp: dto.l2_transaction.timestamp - } + etherlinkOperation } - : { - id, - kind: BridgeTokenTransferKind.Deposit, - status: BridgeTokenTransferStatus.Created, - source, - receiver, - tezosOperation - }; + : etherlinkOperation + ? { + id, + kind: BridgeTokenTransferKind.Deposit, + status: BridgeTokenTransferStatus.Finished, + source, + receiver, + tezosOperation, + etherlinkOperation + } + : { + id, + kind: BridgeTokenTransferKind.Deposit, + status: BridgeTokenTransferStatus.Created, + source, + receiver, + tezosOperation + }; } catch (error) { loggerProvider.logger.error('Deposit DTO mapping error.', getErrorLogMessage(error)); @@ -91,13 +103,13 @@ export const mapBridgeDepositDtoToDepositBridgeTokenTransfer = (dto: BridgeDepos } }; -export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: BridgeWithdrawalDto): BridgeTokenWithdrawal | null => { +export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: BridgeWithdrawalDto, isFailed: boolean): BridgeTokenWithdrawal | null => { try { const source = etherlinkUtils.toChecksumAddress(dto.l2_transaction.l2_account); const receiver = dto.l2_transaction.l1_account; const amount = BigInt(dto.l2_transaction.amount); - const etherlinkOperation: CreatedBridgeTokenWithdrawal['etherlinkOperation'] = { + const etherlinkOperation: EtherlinkTransferTokensOperation = { blockId: dto.l2_transaction.level, hash: etherlinkUtils.prepareHexPrefix(dto.l2_transaction.transaction_hash, true), logIndex: dto.l2_transaction.log_index, @@ -105,60 +117,70 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg token: mapEtherlinkTokenDtoToEtherlinkToken(dto.l2_transaction.l2_token?.id), timestamp: dto.l2_transaction.timestamp }; + const tezosOperation: TezosTransferTokensOperation | undefined = dto.l1_transaction + ? { + blockId: dto.l1_transaction.level, + hash: dto.l1_transaction.operation_hash, + counter: dto.l1_transaction.counter, + nonce: dto.l1_transaction.nonce, + amount, + token: mapTezosTokenDtoToTezosToken(dto.l2_transaction.l2_token?.ticket?.token), + timestamp: dto.l1_transaction.timestamp + } + : undefined; + const rollupData = { + outboxMessageLevel: dto.l2_transaction.outbox_message.level, + outboxMessageIndex: dto.l2_transaction.outbox_message.index, + commitment: dto.l2_transaction.outbox_message.commitment?.hash || '', + proof: dto.l2_transaction.outbox_message.proof || '' + }; const id = bridgeUtils.convertOperationDataToTokenTransferId(etherlinkOperation.hash, etherlinkOperation.logIndex); - return dto.l1_transaction + return isFailed ? { id, kind: BridgeTokenTransferKind.Withdrawal, - status: BridgeTokenTransferStatus.Finished, + status: BridgeTokenTransferStatus.Failed, source, receiver, - tezosOperation: { - blockId: dto.l1_transaction.level, - hash: dto.l1_transaction.operation_hash, - counter: dto.l1_transaction.counter, - nonce: dto.l1_transaction.nonce, - amount, - token: mapTezosTokenDtoToTezosToken(dto.l2_transaction.l2_token?.ticket?.token), - timestamp: dto.l1_transaction.timestamp - }, + tezosOperation, etherlinkOperation, - rollupData: { - outboxMessageLevel: dto.l2_transaction.outbox_message.level, - outboxMessageIndex: dto.l2_transaction.outbox_message.index, - commitment: dto.l2_transaction.outbox_message.commitment?.hash || '', - proof: dto.l2_transaction.outbox_message.proof || '' - } + rollupData } - : dto.l2_transaction.outbox_message.commitment && dto.l2_transaction.outbox_message.proof + : tezosOperation ? { id, kind: BridgeTokenTransferKind.Withdrawal, - status: BridgeTokenTransferStatus.Sealed, + status: BridgeTokenTransferStatus.Finished, source, receiver, + tezosOperation, etherlinkOperation, - rollupData: { - outboxMessageLevel: dto.l2_transaction.outbox_message.level, - outboxMessageIndex: dto.l2_transaction.outbox_message.index, - commitment: dto.l2_transaction.outbox_message.commitment.hash, - proof: dto.l2_transaction.outbox_message.proof - } + rollupData } - : { - id, - kind: BridgeTokenTransferKind.Withdrawal, - status: BridgeTokenTransferStatus.Created, - source, - receiver, - etherlinkOperation, - rollupData: { - outboxMessageLevel: dto.l2_transaction.outbox_message.level, - outboxMessageIndex: dto.l2_transaction.outbox_message.index, - estimatedOutboxMessageExecutionTimestamp: dto.l2_transaction.outbox_message.cemented_at || undefined + : rollupData.commitment && rollupData.proof + ? { + id, + kind: BridgeTokenTransferKind.Withdrawal, + status: BridgeTokenTransferStatus.Sealed, + source, + receiver, + etherlinkOperation, + rollupData } - }; + : { + id, + kind: BridgeTokenTransferKind.Withdrawal, + status: BridgeTokenTransferStatus.Created, + source, + receiver, + etherlinkOperation, + rollupData: { + outboxMessageLevel: dto.l2_transaction.outbox_message.level, + outboxMessageIndex: dto.l2_transaction.outbox_message.index, + estimatedOutboxMessageExecutionTimestamp: dto.l2_transaction.outbox_message.cemented_at || undefined + } + }; } catch (error) { loggerProvider.logger.error('Withdrawal DTO mapping error.', getErrorLogMessage(error)); @@ -167,9 +189,11 @@ export const mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer = (dto: Bridg }; export const mapBridgeOperationDtoToBridgeTokenTransfer = (dto: BridgeOperationDto): BridgeTokenTransfer | null => { + const isFailed = dto.is_completed && !dto.is_successful; + return dto.type === 'deposit' - ? mapBridgeDepositDtoToDepositBridgeTokenTransfer(dto.deposit!) - : mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer(dto.withdrawal!); + ? mapBridgeDepositDtoToDepositBridgeTokenTransfer(dto.deposit!, isFailed) + : mapBridgeWithdrawalDtoToWithdrawalBridgeTokenTransfer(dto.withdrawal!, isFailed); }; export const mapBridgeOperationsDtoToBridgeTokenTransfer = (dto: BridgeOperationsDto | BridgeOperationsStreamDto): BridgeTokenTransfer[] => { diff --git a/src/index.ts b/src/index.ts index d82212b..f662e0e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,6 +36,9 @@ export { type TokenPair, + type TezosTransferTokensOperation, + type EtherlinkTransferTokensOperation, + type BridgeTokenTransfer, type BridgeTokenDeposit, type PendingBridgeTokenDeposit, From cf634b29d95c845300c33e9e23127742b2e1495e Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 18 Mar 2024 05:07:05 +0300 Subject: [PATCH 19/20] Remove the defaultTokenBridge --- integration/testHelpers.ts | 50 ++++--- .../defaultAddresses.ts | 5 + .../etherlinkBridgeBlockchainService/index.ts | 1 + .../web3EtherlinkBridgeBlockchainService.ts | 11 +- src/defaultTokenBridge.ts | 131 ------------------ src/index.ts | 8 -- 6 files changed, 41 insertions(+), 165 deletions(-) create mode 100644 src/bridgeBlockchainService/etherlinkBridgeBlockchainService/defaultAddresses.ts delete mode 100644 src/defaultTokenBridge.ts diff --git a/integration/testHelpers.ts b/integration/testHelpers.ts index a478dac..b5bfa65 100644 --- a/integration/testHelpers.ts +++ b/integration/testHelpers.ts @@ -4,14 +4,18 @@ import Web3 from 'web3'; import { TestConfig } from './testConfig'; import { - createDefaultTokenBridge, + loggerProvider, + TokenBridge, + TaquitoContractTezosBridgeBlockchainService, + Web3EtherlinkBridgeBlockchainService, + DefaultDataProvider, BridgeTokenTransferKind, BridgeTokenTransferStatus, LogLevel, - type DefaultTokenBridgeOptions, type TezosToken, type EtherlinkToken, type BridgeTokenTransfer, type PendingBridgeTokenDeposit, type CreatedBridgeTokenDeposit, type FinishedBridgeTokenDeposit, type PendingBridgeTokenWithdrawal, type CreatedBridgeTokenWithdrawal, - type SealedBridgeTokenWithdrawal, type FinishedBridgeTokenWithdrawal + type SealedBridgeTokenWithdrawal, type FinishedBridgeTokenWithdrawal, + type DefaultDataProviderOptions, } from '../src'; const depositIdRegex = /^o[0-9a-zA-Z]{50}_\d+_\d+$/; @@ -23,27 +27,16 @@ interface CreateTestTokenBridgeParams { testConfig: TestConfig, tezosToolkit?: TezosToolkit, etherlinkToolkit?: Web3, - overrideOptions?: Partial> + overriddenDefaultDataProviderOptions?: Partial } -export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolkit, overrideOptions }: CreateTestTokenBridgeParams) => { +export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolkit, overriddenDefaultDataProviderOptions }: CreateTestTokenBridgeParams) => { tezosToolkit = tezosToolkit || createTezosToolkitWithSigner(testConfig.tezosRpcUrl, testConfig.tezosAccountPrivateKey); etherlinkToolkit = etherlinkToolkit || createEtherlinkToolkitWithSigner(testConfig.etherlinkRpcUrl, testConfig.etherlinkAccountPrivateKey); - return createDefaultTokenBridge({ - logging: { - logLevel: LogLevel.Debug - }, - tezos: { - name: 'taquito', - apiType: 'contract', - tezosToolkit, - smartRollupAddress: testConfig.tezosRollupAddress - }, - etherlink: { - name: 'web3', - web3: etherlinkToolkit - }, + loggerProvider.setLogLevel(LogLevel.Debug); + + const defaultDataProvider = new DefaultDataProvider({ dipDup: { baseUrl: testConfig.dipDupBaseUrl, webSocketApiBaseUrl: testConfig.dipDupBaseUrl.replace('https', 'wss'), @@ -81,8 +74,23 @@ export const createTestTokenBridge = ({ testConfig, tezosToolkit, etherlinkToolk } }, ], - ...overrideOptions - } as const); + ...overriddenDefaultDataProviderOptions + }); + + return new TokenBridge({ + tezosBridgeBlockchainService: new TaquitoContractTezosBridgeBlockchainService({ + tezosToolkit, + smartRollupAddress: testConfig.tezosRollupAddress + }), + etherlinkBridgeBlockchainService: new Web3EtherlinkBridgeBlockchainService({ + web3: etherlinkToolkit + }), + bridgeDataProviders: { + transfers: defaultDataProvider, + balances: defaultDataProvider, + tokens: defaultDataProvider, + } + }); }; export const createTezosToolkitWithSigner = (rpcUrl: string, privateKey: string): TezosToolkit => { diff --git a/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/defaultAddresses.ts b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/defaultAddresses.ts new file mode 100644 index 0000000..014c0da --- /dev/null +++ b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/defaultAddresses.ts @@ -0,0 +1,5 @@ +export const defaultAddresses = { + etherlinkKernelAddress: '0x0000000000000000000000000000000000000000', + withdrawNativeTokenPrecompileAddress: '0x0000000000000000000000000000000000000020', + withdrawNonNativeTokenPrecompileAddress: '0x0000000000000000000000000000000000000040' +} as const; diff --git a/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts index a79d439..4e27af3 100644 --- a/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts +++ b/src/bridgeBlockchainService/etherlinkBridgeBlockchainService/index.ts @@ -1,2 +1,3 @@ export * from './abi'; +export * from './defaultAddresses'; export type * from './etherlinkBridgeBlockchainService'; diff --git a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts index d482a78..6d9af93 100644 --- a/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts +++ b/src/bridgeBlockchainService/web3EtherlinkBridgeBlockchainService/web3EtherlinkBridgeBlockchainService.ts @@ -6,6 +6,7 @@ import { getErrorLogMessage, loggerProvider } from '../../logging'; import { tezosUtils } from '../../utils'; import { kernelContractAbi, + defaultAddresses, type EtherlinkBridgeBlockchainService, type WithdrawNativeTokenParams, type WithdrawNativeTokenResult, @@ -17,9 +18,9 @@ import { export interface Web3EtherlinkBridgeBlockchainServiceOptions { web3: Web3; - kernelAddress: string; - withdrawNativeTokenPrecompileAddress: string; - withdrawNonNativeTokenPrecompileAddress: string; + kernelAddress?: string; + withdrawNativeTokenPrecompileAddress?: string; + withdrawNonNativeTokenPrecompileAddress?: string; } export class Web3EtherlinkBridgeBlockchainService implements EtherlinkBridgeBlockchainService< @@ -35,8 +36,8 @@ export class Web3EtherlinkBridgeBlockchainService implements EtherlinkBridgeBloc constructor(options: Web3EtherlinkBridgeBlockchainServiceOptions) { this.web3 = options.web3; - this.withdrawNativeTokenPrecompiledAddress = options.withdrawNativeTokenPrecompileAddress; - this.withdrawNonNativeTokenPrecompiledAddress = options.withdrawNonNativeTokenPrecompileAddress; + this.withdrawNativeTokenPrecompiledAddress = options.withdrawNativeTokenPrecompileAddress || defaultAddresses.withdrawNativeTokenPrecompileAddress; + this.withdrawNonNativeTokenPrecompiledAddress = options.withdrawNonNativeTokenPrecompileAddress || defaultAddresses.withdrawNonNativeTokenPrecompileAddress; this.withdrawNonNativeTokenPrecompile = new this.web3.eth.Contract( kernelContractAbi, diff --git a/src/defaultTokenBridge.ts b/src/defaultTokenBridge.ts deleted file mode 100644 index de9f7fe..0000000 --- a/src/defaultTokenBridge.ts +++ /dev/null @@ -1,131 +0,0 @@ -import type { TezosToolkit } from '@taquito/taquito'; -import type Web3 from 'web3'; - -import { - TaquitoContractTezosBridgeBlockchainService, - TaquitoWalletTezosBridgeBlockchainService, - Web3EtherlinkBridgeBlockchainService, -} from './bridgeBlockchainService'; -import type { TokenPair } from './bridgeCore'; -import { DefaultDataProvider, type DefaultDataProviderOptions, type TokensBridgeDataProvider } from './bridgeDataProviders'; -import { LogLevel, loggerProvider, type Logger } from './logging'; -import { TokenBridge } from './tokenBridge'; - -interface TaquitoTezosBridgeBlockchainServiceOptionsBase { - name: 'taquito'; - tezosToolkit: TezosToolkit; - smartRollupAddress: string; -} - -interface TaquitoContractTezosBridgeBlockchainServiceOptions extends TaquitoTezosBridgeBlockchainServiceOptionsBase { - apiType: 'contract'; -} - -interface TaquitoWalletTezosBridgeBlockchainServiceOptions extends TaquitoTezosBridgeBlockchainServiceOptionsBase { - apiType: 'wallet'; -} - -type TezosBridgeBlockchainServiceOptions = - | TaquitoContractTezosBridgeBlockchainServiceOptions - | TaquitoWalletTezosBridgeBlockchainServiceOptions; - -interface EtherlinkWeb3BridgeBlockchainServiceOptions { - name: 'web3'; - web3: Web3; -} - -type EtherlinkBridgeBlockchainServiceOptions = EtherlinkWeb3BridgeBlockchainServiceOptions; - -interface LoggingOptions { - logger?: Logger - logLevel?: LogLevel -} - -export type DefaultTokenBridgeOptions< - TTezosBridgeBlockchainServiceOptions extends TezosBridgeBlockchainServiceOptions = TezosBridgeBlockchainServiceOptions, - TEtherlinkBridgeBlockchainServiceOptions extends EtherlinkBridgeBlockchainServiceOptions = EtherlinkBridgeBlockchainServiceOptions -> = { - tezos: TTezosBridgeBlockchainServiceOptions; - etherlink: TEtherlinkBridgeBlockchainServiceOptions; - tokenPairs: TokensBridgeDataProvider | ReadonlyArray>; - logging?: LoggingOptions; -} & DefaultDataProviderOptions; - -export const defaultEtherlinkKernelAddress = '0x0000000000000000000000000000000000000000'; -export const defaultWithdrawNativeTokenPrecompileAddress = '0x0000000000000000000000000000000000000020'; -export const defaultWithdrawNonNativeTokenPrecompileAddress = '0x0000000000000000000000000000000000000040'; - -const createTezosBridgeBlockchainService = (options: DefaultTokenBridgeOptions['tezos']) => { - switch (options.name) { - case 'taquito': - switch (options.apiType) { - case 'contract': - return new TaquitoContractTezosBridgeBlockchainService({ - tezosToolkit: options.tezosToolkit, - smartRollupAddress: options.smartRollupAddress, - }); - case 'wallet': - return new TaquitoWalletTezosBridgeBlockchainService({ - tezosToolkit: options.tezosToolkit, - smartRollupAddress: options.smartRollupAddress, - }); - default: - throw new Error(`Unknown Taquito API type: ${(options as any).apiType}`); - } - default: - throw new Error(`Unknown service name: ${options.name}`); - } -}; - -const createEtherlinkBridgeBlockchainService = (options: DefaultTokenBridgeOptions['etherlink']) => { - switch (options.name) { - case 'web3': - return new Web3EtherlinkBridgeBlockchainService({ - web3: options.web3, - kernelAddress: defaultEtherlinkKernelAddress, - withdrawNativeTokenPrecompileAddress: defaultWithdrawNativeTokenPrecompileAddress, - withdrawNonNativeTokenPrecompileAddress: defaultWithdrawNonNativeTokenPrecompileAddress - }); - default: - throw new Error(`Unknown service name: ${options.name}`); - } -}; - -type MapTezosOptionsToService = Options extends TaquitoContractTezosBridgeBlockchainServiceOptions - ? TaquitoContractTezosBridgeBlockchainService - : Options extends TaquitoWalletTezosBridgeBlockchainServiceOptions - ? TaquitoWalletTezosBridgeBlockchainService - : never; - -type MapEtherlinkOptionsToService = Options extends EtherlinkWeb3BridgeBlockchainServiceOptions - ? Web3EtherlinkBridgeBlockchainService - : never; - -export const createDefaultTokenBridge = < - TOptions extends TezosBridgeBlockchainServiceOptions, - EOptions extends EtherlinkBridgeBlockchainServiceOptions ->(options: DefaultTokenBridgeOptions): TokenBridge, MapEtherlinkOptionsToService> => { - if (options.logging) { - options.logging.logger && loggerProvider.setLogger(options.logging.logger); - options.logging.logLevel && loggerProvider.setLogLevel(options.logging.logLevel); - } - loggerProvider.logger.debug('Creating the default token bridge...'); - - const tezosBridgeBlockchainService = createTezosBridgeBlockchainService(options.tezos); - const etherlinkBridgeBlockchainService = createEtherlinkBridgeBlockchainService(options.etherlink); - - const defaultDataProvider = new DefaultDataProvider(options); - const tokenBridge = new TokenBridge({ - tezosBridgeBlockchainService, - etherlinkBridgeBlockchainService, - bridgeDataProviders: { - tokens: defaultDataProvider, - balances: defaultDataProvider, - transfers: defaultDataProvider - } - }); - - loggerProvider.logger.debug('The default token bridge has been created'); - - return tokenBridge as TokenBridge, MapEtherlinkOptionsToService>; -}; diff --git a/src/index.ts b/src/index.ts index f662e0e..e0e888e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,14 +8,6 @@ export { type RemoteServiceResponseFormat, } from './common'; -export { - createDefaultTokenBridge, - defaultEtherlinkKernelAddress, - defaultWithdrawNativeTokenPrecompileAddress, - defaultWithdrawNonNativeTokenPrecompileAddress, - type DefaultTokenBridgeOptions -} from './defaultTokenBridge'; - export { TokenBridge, type TokenBridgeOptions, From befff71b54464d3a047ff8c86b80b3d2f275e25e Mon Sep 17 00:00:00 2001 From: Andrew Skubarenko Date: Mon, 18 Mar 2024 06:21:55 +0300 Subject: [PATCH 20/20] Update the taquito packages --- package-lock.json | 108 +++++++++++++++++++++++----------------------- package.json | 6 +-- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index b675af7..921b7d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,13 +9,13 @@ "version": "0.1.1", "license": "MIT", "dependencies": { - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0", "web3-utils": "^4.2.0", "web3-validator": "^2.0.4" }, "devDependencies": { - "@taquito/signer": "^19.1.0-beta-RC.0", - "@taquito/taquito": "^19.1.0-beta-RC.0", + "@taquito/signer": "^19.1.0", + "@taquito/taquito": "^19.1.0", "@types/jest": "^29.5.11", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", @@ -1950,9 +1950,9 @@ } }, "node_modules/@taquito/core": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/core/-/core-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-HkZsqMskL7DWpYOPaSQnHLn0Q21DK3KiT/lEeNhBcGKtvLaJjVjduZ9A6TQR+GfAO+x+CkHILjuGaH/mht69cA==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/core/-/core-19.1.0.tgz", + "integrity": "sha512-gW7rQCXnznCsTaVNF04ilS6jgzxfJWRiDm7BDC0U5FrEHxIfiRXj6dDbVtOLvcai2xBmfCghFL79lCsToVYztQ==", "dependencies": { "json-stringify-safe": "^5.0.1" }, @@ -1961,12 +1961,12 @@ } }, "node_modules/@taquito/http-utils": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-/NYSY4fVfPPnwA6pVN3TMQaoop3xU0q5CXZ7u5vmDUV2GOTtP6noUeJuvNX5pabwjJZxLwdYLWXCvXZq9qI5AQ==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/http-utils/-/http-utils-19.1.0.tgz", + "integrity": "sha512-MDvK5rHFtgpK/c4G8ttrYj5fy4lDz/MpwryrUjfcAZG/EfWdFcw6JIaFrrIrCRUp2d09+182sogaT3xzYGq6kA==", "dev": true, "dependencies": { - "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", "node-fetch": "^2.7.0" }, "engines": { @@ -1974,13 +1974,13 @@ } }, "node_modules/@taquito/local-forging": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-e/Lc3PqdX7POKIxDA5JiCKdLlvr8htIAzyqYhrEZMeqdGHVR2ZFjTnGxcGZiTncpN9NfhY46U/z9NT2bmqp4aw==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/local-forging/-/local-forging-19.1.0.tgz", + "integrity": "sha512-ZjucQX3Gv+MzYJmTY617ok93nPXLK/5P/Gtxolys4sETT5KaQAbxWCkaZIlJEYVXso/jF2JRUfiXzzoMLR9Q1w==", "dev": true, "dependencies": { - "@taquito/core": "^19.1.0-beta-RC.0", - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", + "@taquito/utils": "^19.1.0", "bignumber.js": "^9.1.2" }, "engines": { @@ -1988,26 +1988,26 @@ } }, "node_modules/@taquito/michel-codec": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-z6DhwsQmyaijopQs9brw/V1mLu2j74uL8q38jY8OVS8bRKIUSvsunDBd8dJGbLARcHG2JncOGLrFZ5E631VuSw==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/michel-codec/-/michel-codec-19.1.0.tgz", + "integrity": "sha512-iIvNBPowx/x/rtaxCuVj1QL2jR3iaHaZHGfiN+gUa5jo+eL3YUJZSIDCiTQM3HKHVBNP+0x+OeBeuCmMcSMVog==", "dev": true, "dependencies": { - "@taquito/core": "^19.1.0-beta-RC.0" + "@taquito/core": "^19.1.0" }, "engines": { "node": ">=18" } }, "node_modules/@taquito/michelson-encoder": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-XAwUhcTzahPVk8rcipLaG/RNjTXS/KNM5eHhi7RSH+37e5fgaCiRa7+cASFlWG605/zmwg7Ro2VZVZTZTt7vbg==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/michelson-encoder/-/michelson-encoder-19.1.0.tgz", + "integrity": "sha512-1MG2eG6R4/UwMAzEgz8k79yWh1vfzlFfmbAQpoigC6pfDAsoc5/zaqKcdxpqrpd422TA+8LTewYFXkGBFLf/cA==", "dev": true, "dependencies": { - "@taquito/core": "^19.1.0-beta-RC.0", - "@taquito/rpc": "^19.1.0-beta-RC.0", - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", + "@taquito/rpc": "^19.1.0", + "@taquito/utils": "^19.1.0", "bignumber.js": "^9.1.2", "fast-json-stable-stringify": "^2.1.0" }, @@ -2016,14 +2016,14 @@ } }, "node_modules/@taquito/rpc": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-EcphrNCM3Wbyuv+CdETyrv+M9B+DHTOXluI+E99jH0H2Bo8fxKJBU/hSJS2Kk/Y59UMGu/4Rs8yAnBNYRzSCyA==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/rpc/-/rpc-19.1.0.tgz", + "integrity": "sha512-dpPEmrSrY4EmnODcU9QdN4JydeEQF/k8C/2f+0Vu4OHPewaYDX48toby+OtJ9rp5ZVPv8+/XJEwOyX37m4nBng==", "dev": true, "dependencies": { - "@taquito/core": "^19.1.0-beta-RC.0", - "@taquito/http-utils": "^19.1.0-beta-RC.0", - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", + "@taquito/http-utils": "^19.1.0", + "@taquito/utils": "^19.1.0", "bignumber.js": "^9.1.2" }, "engines": { @@ -2031,9 +2031,9 @@ } }, "node_modules/@taquito/signer": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-wy2SoAEQ6V/WpMN8622cztzFNRt9EuB25TzVY0UyI66or5cBFzWAVig1tYw0sOFpSzgODP2JgMNaX9qVKn19AQ==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/signer/-/signer-19.1.0.tgz", + "integrity": "sha512-JKaf+qh2NlJQG6184zvYYzWYnWIh1ffG1BV6PfS72aXM3963tOJ6YyRr5aPRrjrvIKHI+WPXIuXE4uZMZKTnIw==", "dev": true, "dependencies": { "@stablelib/blake2b": "^1.0.1", @@ -2042,9 +2042,9 @@ "@stablelib/nacl": "^1.0.4", "@stablelib/pbkdf2": "^1.0.1", "@stablelib/sha512": "^1.0.1", - "@taquito/core": "^19.1.0-beta-RC.0", - "@taquito/taquito": "^19.1.0-beta-RC.0", - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", + "@taquito/taquito": "^19.1.0", + "@taquito/utils": "^19.1.0", "@types/bn.js": "^5.1.2", "bip39": "3.1.0", "elliptic": "^6.5.4", @@ -2056,19 +2056,19 @@ } }, "node_modules/@taquito/taquito": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-3L3jpfLbMjXBjyJJ995SaED9d8LI2WsH7SSGEj0s2ir+bOUR93cQfCD+I7CE6RQl4x5ejjPxFre0lVqeTxQ/ZA==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/taquito/-/taquito-19.1.0.tgz", + "integrity": "sha512-Rh3JXISzsx9E8gd4i4c2kFEspyNpIs6CgobkjuDLKHql4yUGRZg9q5pKWMSkdgrbdLwb8vtIvFZnPDsBJtCt/w==", "dev": true, "hasInstallScript": true, "dependencies": { - "@taquito/core": "^19.1.0-beta-RC.0", - "@taquito/http-utils": "^19.1.0-beta-RC.0", - "@taquito/local-forging": "^19.1.0-beta-RC.0", - "@taquito/michel-codec": "^19.1.0-beta-RC.0", - "@taquito/michelson-encoder": "^19.1.0-beta-RC.0", - "@taquito/rpc": "^19.1.0-beta-RC.0", - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", + "@taquito/http-utils": "^19.1.0", + "@taquito/local-forging": "^19.1.0", + "@taquito/michel-codec": "^19.1.0", + "@taquito/michelson-encoder": "^19.1.0", + "@taquito/rpc": "^19.1.0", + "@taquito/utils": "^19.1.0", "bignumber.js": "^9.1.2", "rxjs": "^7.8.1" }, @@ -2077,13 +2077,13 @@ } }, "node_modules/@taquito/utils": { - "version": "19.1.0-beta-RC.0", - "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-19.1.0-beta-RC.0.tgz", - "integrity": "sha512-7YmWeNVJ6Sh+Yy/Oyv/ch6ScAw8CuEoecnuJNusbkKn4eJI3xP4TEW5tqhnFrFT829Z2Wizi4kHoykz8W4I07A==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@taquito/utils/-/utils-19.1.0.tgz", + "integrity": "sha512-vgEUWBb1n1PY8XpFqLJ2Axdlo/lNoIqNTeAyVHN7yxxqyVghSoMeWVsfbCJ661GJ32R1NNo4XAJrzwMR+B7soA==", "dependencies": { "@stablelib/blake2b": "^1.0.1", "@stablelib/ed25519": "^1.0.3", - "@taquito/core": "^19.1.0-beta-RC.0", + "@taquito/core": "^19.1.0", "@types/bs58check": "^2.1.0", "bignumber.js": "^9.1.2", "blakejs": "^1.2.1", @@ -3384,9 +3384,9 @@ "dev": true }, "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.5.tgz", + "integrity": "sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==", "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", diff --git a/package.json b/package.json index 18c48a8..f98577b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "default": "./dist/node/index.js" }, "dependencies": { - "@taquito/utils": "^19.1.0-beta-RC.0", + "@taquito/utils": "^19.1.0", "web3-utils": "^4.2.0", "web3-validator": "^2.0.4" }, @@ -51,8 +51,8 @@ } }, "devDependencies": { - "@taquito/signer": "^19.1.0-beta-RC.0", - "@taquito/taquito": "^19.1.0-beta-RC.0", + "@taquito/signer": "^19.1.0", + "@taquito/taquito": "^19.1.0", "@types/jest": "^29.5.11", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1",