@dfinity/nns 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/candid/genesis_token.certified.idl.js +37 -0
- package/dist/candid/genesis_token.did +30 -0
- package/dist/candid/genesis_token.idl.d.ts +10 -0
- package/dist/candid/genesis_token.idl.js +37 -0
- package/dist/candid/governance.certified.idl.js +14 -0
- package/dist/candid/governance.did +18 -4
- package/dist/candid/governance.idl.js +23 -5
- package/dist/candid/governanceTypes.d.ts +19 -13
- package/dist/candid/payloads.did +127 -21
- package/dist/candid/payloads.idl.d.ts +28 -1
- package/dist/candid/payloads.idl.js +97 -3
- package/dist/cjs/index.cjs.js +36 -33
- package/dist/cjs/index.cjs.js.map +3 -3
- package/dist/esm/account_identifier.js +1 -1
- package/dist/esm/{chunk-L4BUBLWY.js → chunk-E6UFXMWU.js} +20 -20
- package/dist/esm/{chunk-L4BUBLWY.js.map → chunk-E6UFXMWU.js.map} +2 -2
- package/dist/esm/{chunk-PKY54KPG.js → chunk-FL7E4DL3.js} +3 -3
- package/dist/esm/{chunk-PKY54KPG.js.map → chunk-FL7E4DL3.js.map} +1 -1
- package/dist/esm/chunk-HPCMNLTU.js +2 -0
- package/dist/esm/{chunk-7RUPLQYT.js.map → chunk-HPCMNLTU.js.map} +3 -3
- package/dist/esm/chunk-KUIJF2IJ.js +4 -0
- package/dist/esm/chunk-KUIJF2IJ.js.map +7 -0
- package/dist/esm/chunk-KXYKDST6.js +17 -0
- package/dist/esm/{chunk-BRAPLAM7.js.map → chunk-KXYKDST6.js.map} +3 -3
- package/dist/esm/chunk-MTPVFXPH.js +2 -0
- package/dist/esm/{chunk-EWMNJTAM.js.map → chunk-MTPVFXPH.js.map} +1 -1
- package/dist/esm/chunk-NOBP3Q32.js +7 -0
- package/dist/esm/chunk-NOBP3Q32.js.map +7 -0
- package/dist/esm/chunk-ONAVPXOT.js +2 -0
- package/dist/esm/chunk-ONAVPXOT.js.map +7 -0
- package/dist/esm/chunk-QNJXXPDD.js +2 -0
- package/dist/esm/chunk-QNJXXPDD.js.map +7 -0
- package/dist/esm/{chunk-CY2PTZ5N.js → chunk-XMQ7XZ3Q.js} +2 -2
- package/dist/esm/{chunk-CY2PTZ5N.js.map → chunk-XMQ7XZ3Q.js.map} +1 -1
- package/dist/esm/genesis_token.js +2 -0
- package/dist/esm/genesis_token.js.map +7 -0
- package/dist/esm/governance.js +1 -1
- package/dist/esm/icp.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/ledger.js +1 -1
- package/dist/proto/governance.proto +287 -0
- package/dist/proto/governance_pb.d.ts +1055 -0
- package/dist/proto/governance_pb.js +7806 -0
- package/dist/types/canisters/governance/request.converters.d.ts +15 -0
- package/dist/types/canisters/governance/request.proto.converters.d.ts +15 -0
- package/dist/types/canisters/governance/response.converters.d.ts +2 -0
- package/dist/types/canisters/governance/response.proto.converters.d.ts +1 -0
- package/dist/types/canisters/governance/services.d.ts +7 -1
- package/dist/types/constants/canister_ids.d.ts +1 -0
- package/dist/types/errors/governance.errors.d.ts +7 -1
- package/dist/types/genesis_token.d.ts +17 -0
- package/dist/types/governance.d.ts +49 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types/governance.d.ts +1 -0
- package/dist/types/types/governance_converters.d.ts +10 -5
- package/dist/types/utils/account_identifier.utils.d.ts +5 -0
- package/dist/types/utils/accounts.utils.d.ts +6 -0
- package/dist/types/utils/converter.utils.d.ts +0 -5
- package/dist/types/utils/number.utils.d.ts +1 -0
- package/package.json +17 -17
- package/dist/esm/chunk-7RUPLQYT.js +0 -4
- package/dist/esm/chunk-BRAPLAM7.js +0 -18
- package/dist/esm/chunk-DEPEAMHA.js +0 -3
- package/dist/esm/chunk-DEPEAMHA.js.map +0 -7
- package/dist/esm/chunk-EWMNJTAM.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as S,b as T}from"./chunk-KUIJF2IJ.js";import{e as B}from"./chunk-QNJXXPDD.js";import{g as P,i as A}from"./chunk-E6UFXMWU.js";import{a as x,d as u}from"./chunk-MTPVFXPH.js";import{c as C}from"./chunk-FL7E4DL3.js";import{c as w}from"./chunk-ONAVPXOT.js";var n=w(C());var l=w(C());var E=r=>{let e=B(r,32),t=new l.Subaccount;return t.setSubAccount(new Uint8Array(e)),t},_=r=>{let e=new l.ICPTs;return e.setE8s(r.toString(10)),e};var c=class extends Error{},p=class extends c{},f=class extends c{constructor(t){super();this.balance=t}},g=class extends c{constructor(t){super();this.allowed_window_secs=t}},b=class extends c{},h=class extends c{constructor(t){super();this.duplicateOf=t}},N=r=>{let{message:e}=r;if(e.includes("Reject code: 5")){if(e.match(/Sending from (.*) is not allowed/))return new p;{let t=e.match(/transaction.*duplicate.* in block (\d+)/);if(t&&t.length>1)return new h(BigInt(t[1]))}{let t=e.match(/debit account.*, current balance: (\d*(\.\d*)?)/);if(t&&t.length>1){let o=u.fromString(t[1]);if(o instanceof u)return new f(o)}}if(e.includes("is in future"))return new b;{let t=e.match(/older than (\d+)/);if(t&&t.length>1)return new g(Number.parseInt(t[1]))}}throw r};var d=class{constructor(e,t,o,s){this.agent=e;this.canisterId=t;this.updateFetcher=o;this.queryFetcher=s}static create(e={}){return new d(e.agent??A(),e.canisterId??P,e.updateCallOverride??S,e.queryCallOverride??T)}accountBalance=async({accountIdentifier:e,certified:t=!0})=>{let o=t?this.updateFetcher:this.queryFetcher,s=new n.AccountBalanceRequest;s.setAccount(e.toProto());let m=await o({agent:this.agent,canisterId:this.canisterId,methodName:"account_balance_pb",arg:s.serializeBinary()});return u.fromE8s(BigInt(n.ICPTs.deserializeBinary(new Uint8Array(m)).getE8s()))};transfer=async({to:e,amount:t,memo:o,fee:s,fromSubAccountId:m})=>{let a=new n.SendRequest;a.setTo(e.toProto());let I=new n.Payment;I.setReceiverGets(t.toProto()),a.setPayment(I),a.setMaxFee(_(s??x));let y=new n.Memo;y.setMemo((o??BigInt(0)).toString()),a.setMemo(y),m!==void 0&&a.setFromSubaccount(E(m));try{let i=await this.updateFetcher({agent:this.agent,canisterId:this.canisterId,methodName:"send_pb",arg:a.serializeBinary()});return BigInt(n.BlockHeight.deserializeBinary(i).getHeight())}catch(i){throw i instanceof Error?N(i):i}}};export{c as a,p as b,f as c,g as d,b as e,h as f,N as g,d as h};
|
|
2
|
+
//# sourceMappingURL=chunk-HPCMNLTU.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/ledger.ts", "../../src/canisters/ledger/ledger.request.converts.ts", "../../src/errors/ledger.errors.ts"
|
|
4
|
-
"sourcesContent": ["import { Agent } from \"@dfinity/agent\";\nimport { Principal } from \"@dfinity/principal\";\nimport {\n AccountBalanceRequest,\n BlockHeight as PbBlockHeight,\n ICPTs,\n Memo,\n Payment,\n SendRequest,\n} from \"../proto/ledger_pb\";\nimport { AccountIdentifier } from \"./account_identifier\";\nimport {\n subAccountIdToSubaccount,\n toICPTs,\n} from \"./canisters/ledger/ledger.request.converts\";\nimport { MAINNET_LEDGER_CANISTER_ID } from \"./constants/canister_ids\";\nimport { TRANSACTION_FEE } from \"./constants/constants\";\nimport { mapTransferError } from \"./errors/ledger.errors\";\nimport { ICP } from \"./icp\";\nimport { BlockHeight, E8s } from \"./types/common\";\nimport { LedgerCanisterCall, LedgerCanisterOptions } from \"./types/ledger\";\nimport { defaultAgent } from \"./utils/agent.utils\";\nimport { queryCall, updateCall } from \"./utils/proto.utils\";\n\nexport class LedgerCanister {\n private constructor(\n private readonly agent: Agent,\n private readonly canisterId: Principal,\n private readonly updateFetcher: LedgerCanisterCall,\n private readonly queryFetcher: LedgerCanisterCall\n ) {}\n\n public static create(options: LedgerCanisterOptions = {}) {\n return new LedgerCanister(\n options.agent ?? defaultAgent(),\n options.canisterId ?? MAINNET_LEDGER_CANISTER_ID,\n options.updateCallOverride ?? updateCall,\n options.queryCallOverride ?? queryCall\n );\n }\n\n /**\n * Returns the balance of the specified account identifier.\n *\n * If `certified` is true, the request is fetched as an update call, otherwise\n * it is fetched using a query call.\n *\n * @throws {@link Error}\n */\n public accountBalance = async ({\n accountIdentifier,\n certified = true,\n }: {\n accountIdentifier: AccountIdentifier;\n certified?: boolean;\n }): Promise<ICP> => {\n const callMethod = certified ? this.updateFetcher : this.queryFetcher;\n\n const request = new AccountBalanceRequest();\n request.setAccount(accountIdentifier.toProto());\n\n const responseBytes = await callMethod({\n agent: this.agent,\n canisterId: this.canisterId,\n methodName: \"account_balance_pb\",\n arg: request.serializeBinary(),\n });\n\n return ICP.fromE8s(\n BigInt(ICPTs.deserializeBinary(new Uint8Array(responseBytes)).getE8s())\n );\n };\n\n /**\n * Transfer ICP from the caller to the destination `accountIdentifier`.\n * Returns the index of the block containing the tx if it was successful.\n *\n * @throws {@link TransferError}\n */\n public transfer = async ({\n to,\n amount,\n memo,\n fee,\n fromSubAccountId,\n }: {\n to: AccountIdentifier;\n amount: ICP;\n memo?: bigint;\n fee?: E8s;\n fromSubAccountId?: number;\n }): Promise<BlockHeight> => {\n const request = new SendRequest();\n request.setTo(to.toProto());\n\n const payment = new Payment();\n payment.setReceiverGets(amount.toProto());\n request.setPayment(payment);\n\n request.setMaxFee(toICPTs(fee ?? TRANSACTION_FEE));\n\n // Always explicitly set the memo for compatibility with ledger wallet - hardware wallet\n const requestMemo: Memo = new Memo();\n requestMemo.setMemo((memo ?? BigInt(0)).toString());\n request.setMemo(requestMemo);\n\n if (fromSubAccountId !== undefined) {\n request.setFromSubaccount(subAccountIdToSubaccount(fromSubAccountId));\n }\n\n try {\n const responseBytes = await this.updateFetcher({\n agent: this.agent,\n canisterId: this.canisterId,\n methodName: \"send_pb\",\n arg: request.serializeBinary(),\n });\n\n // Successful tx. Return the block height.\n return BigInt(PbBlockHeight.deserializeBinary(responseBytes).getHeight());\n } catch (err) {\n if (err instanceof Error) {\n throw mapTransferError(err);\n }\n\n throw err;\n }\n };\n}\n", "import { ICPTs, Subaccount } from \"../../../proto/ledger_pb\";\nimport { SUB_ACCOUNT_BYTE_LENGTH } from \"../../constants/constants\";\nimport { numberToArrayBuffer } from \"../../utils/converter.utils\";\n\nexport const subAccountIdToSubaccount = (subAccountId: number): Subaccount => {\n const bytes = numberToArrayBuffer(subAccountId, SUB_ACCOUNT_BYTE_LENGTH);\n const subaccount: Subaccount = new Subaccount();\n subaccount.setSubAccount(new Uint8Array(bytes));\n return subaccount;\n};\n\nexport const toICPTs = (amount: bigint): ICPTs => {\n const result = new ICPTs();\n result.setE8s(amount.toString(10));\n return result;\n};\n", "import { ICP } from \"../icp\";\nimport { BlockHeight } from \"../types/common\";\n\nexport abstract class TransferError extends Error {}\n\nexport class InvalidSenderError extends TransferError {}\n\nexport class InsufficientFundsError extends TransferError {\n constructor(public readonly balance: ICP) {\n super();\n }\n}\n\nexport class TxTooOldError extends TransferError {\n constructor(public readonly allowed_window_secs: number) {\n super();\n }\n}\n\nexport class TxCreatedInFutureError extends TransferError {}\n\nexport class TxDuplicateError extends TransferError {\n constructor(public readonly duplicateOf: BlockHeight) {\n super();\n }\n}\n\nexport const mapTransferError = (responseBytes: Error): TransferError => {\n const { message } = responseBytes;\n\n if (message.includes(\"Reject code: 5\")) {\n // Match against the different error types.\n // This string matching is fragile. It's a stop-gap solution until\n // we migrate to the candid interface.\n\n if (message.match(/Sending from (.*) is not allowed/)) {\n return new InvalidSenderError();\n }\n\n {\n const m = message.match(/transaction.*duplicate.* in block (\\d+)/);\n if (m && m.length > 1) {\n return new TxDuplicateError(BigInt(m[1]));\n }\n }\n\n {\n const m = message.match(\n /debit account.*, current balance: (\\d*(\\.\\d*)?)/\n );\n if (m && m.length > 1) {\n const balance = ICP.fromString(m[1]);\n if (balance instanceof ICP) {\n return new InsufficientFundsError(balance);\n }\n }\n }\n\n if (message.includes(\"is in future\")) {\n return new TxCreatedInFutureError();\n }\n\n {\n const m = message.match(/older than (\\d+)/);\n if (m && m.length > 1) {\n return new TxTooOldError(Number.parseInt(m[1]));\n }\n }\n }\n\n // Unknown error. Throw as-is.\n throw responseBytes;\n};\n"
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": ["../../src/ledger.ts", "../../src/canisters/ledger/ledger.request.converts.ts", "../../src/errors/ledger.errors.ts"],
|
|
4
|
+
"sourcesContent": ["import { Agent } from \"@dfinity/agent\";\nimport { Principal } from \"@dfinity/principal\";\nimport {\n AccountBalanceRequest,\n BlockHeight as PbBlockHeight,\n ICPTs,\n Memo,\n Payment,\n SendRequest,\n} from \"../proto/ledger_pb\";\nimport { AccountIdentifier } from \"./account_identifier\";\nimport {\n subAccountIdToSubaccount,\n toICPTs,\n} from \"./canisters/ledger/ledger.request.converts\";\nimport { MAINNET_LEDGER_CANISTER_ID } from \"./constants/canister_ids\";\nimport { TRANSACTION_FEE } from \"./constants/constants\";\nimport { mapTransferError } from \"./errors/ledger.errors\";\nimport { ICP } from \"./icp\";\nimport { BlockHeight, E8s } from \"./types/common\";\nimport { LedgerCanisterCall, LedgerCanisterOptions } from \"./types/ledger\";\nimport { defaultAgent } from \"./utils/agent.utils\";\nimport { queryCall, updateCall } from \"./utils/proto.utils\";\n\nexport class LedgerCanister {\n private constructor(\n private readonly agent: Agent,\n private readonly canisterId: Principal,\n private readonly updateFetcher: LedgerCanisterCall,\n private readonly queryFetcher: LedgerCanisterCall\n ) {}\n\n public static create(options: LedgerCanisterOptions = {}) {\n return new LedgerCanister(\n options.agent ?? defaultAgent(),\n options.canisterId ?? MAINNET_LEDGER_CANISTER_ID,\n options.updateCallOverride ?? updateCall,\n options.queryCallOverride ?? queryCall\n );\n }\n\n /**\n * Returns the balance of the specified account identifier.\n *\n * If `certified` is true, the request is fetched as an update call, otherwise\n * it is fetched using a query call.\n *\n * @throws {@link Error}\n */\n public accountBalance = async ({\n accountIdentifier,\n certified = true,\n }: {\n accountIdentifier: AccountIdentifier;\n certified?: boolean;\n }): Promise<ICP> => {\n const callMethod = certified ? this.updateFetcher : this.queryFetcher;\n\n const request = new AccountBalanceRequest();\n request.setAccount(accountIdentifier.toProto());\n\n const responseBytes = await callMethod({\n agent: this.agent,\n canisterId: this.canisterId,\n methodName: \"account_balance_pb\",\n arg: request.serializeBinary(),\n });\n\n return ICP.fromE8s(\n BigInt(ICPTs.deserializeBinary(new Uint8Array(responseBytes)).getE8s())\n );\n };\n\n /**\n * Transfer ICP from the caller to the destination `accountIdentifier`.\n * Returns the index of the block containing the tx if it was successful.\n *\n * @throws {@link TransferError}\n */\n public transfer = async ({\n to,\n amount,\n memo,\n fee,\n fromSubAccountId,\n }: {\n to: AccountIdentifier;\n amount: ICP;\n memo?: bigint;\n fee?: E8s;\n fromSubAccountId?: number;\n }): Promise<BlockHeight> => {\n const request = new SendRequest();\n request.setTo(to.toProto());\n\n const payment = new Payment();\n payment.setReceiverGets(amount.toProto());\n request.setPayment(payment);\n\n request.setMaxFee(toICPTs(fee ?? TRANSACTION_FEE));\n\n // Always explicitly set the memo for compatibility with ledger wallet - hardware wallet\n const requestMemo: Memo = new Memo();\n requestMemo.setMemo((memo ?? BigInt(0)).toString());\n request.setMemo(requestMemo);\n\n if (fromSubAccountId !== undefined) {\n request.setFromSubaccount(subAccountIdToSubaccount(fromSubAccountId));\n }\n\n try {\n const responseBytes = await this.updateFetcher({\n agent: this.agent,\n canisterId: this.canisterId,\n methodName: \"send_pb\",\n arg: request.serializeBinary(),\n });\n\n // Successful tx. Return the block height.\n return BigInt(PbBlockHeight.deserializeBinary(responseBytes).getHeight());\n } catch (err) {\n if (err instanceof Error) {\n throw mapTransferError(err);\n }\n\n throw err;\n }\n };\n}\n", "import { ICPTs, Subaccount } from \"../../../proto/ledger_pb\";\nimport { SUB_ACCOUNT_BYTE_LENGTH } from \"../../constants/constants\";\nimport { numberToArrayBuffer } from \"../../utils/converter.utils\";\n\nexport const subAccountIdToSubaccount = (subAccountId: number): Subaccount => {\n const bytes = numberToArrayBuffer(subAccountId, SUB_ACCOUNT_BYTE_LENGTH);\n const subaccount: Subaccount = new Subaccount();\n subaccount.setSubAccount(new Uint8Array(bytes));\n return subaccount;\n};\n\nexport const toICPTs = (amount: bigint): ICPTs => {\n const result = new ICPTs();\n result.setE8s(amount.toString(10));\n return result;\n};\n", "import { ICP } from \"../icp\";\nimport { BlockHeight } from \"../types/common\";\n\nexport abstract class TransferError extends Error {}\n\nexport class InvalidSenderError extends TransferError {}\n\nexport class InsufficientFundsError extends TransferError {\n constructor(public readonly balance: ICP) {\n super();\n }\n}\n\nexport class TxTooOldError extends TransferError {\n constructor(public readonly allowed_window_secs: number) {\n super();\n }\n}\n\nexport class TxCreatedInFutureError extends TransferError {}\n\nexport class TxDuplicateError extends TransferError {\n constructor(public readonly duplicateOf: BlockHeight) {\n super();\n }\n}\n\nexport const mapTransferError = (responseBytes: Error): TransferError => {\n const { message } = responseBytes;\n\n if (message.includes(\"Reject code: 5\")) {\n // Match against the different error types.\n // This string matching is fragile. It's a stop-gap solution until\n // we migrate to the candid interface.\n\n if (message.match(/Sending from (.*) is not allowed/)) {\n return new InvalidSenderError();\n }\n\n {\n const m = message.match(/transaction.*duplicate.* in block (\\d+)/);\n if (m && m.length > 1) {\n return new TxDuplicateError(BigInt(m[1]));\n }\n }\n\n {\n const m = message.match(\n /debit account.*, current balance: (\\d*(\\.\\d*)?)/\n );\n if (m && m.length > 1) {\n const balance = ICP.fromString(m[1]);\n if (balance instanceof ICP) {\n return new InsufficientFundsError(balance);\n }\n }\n }\n\n if (message.includes(\"is in future\")) {\n return new TxCreatedInFutureError();\n }\n\n {\n const m = message.match(/older than (\\d+)/);\n if (m && m.length > 1) {\n return new TxTooOldError(Number.parseInt(m[1]));\n }\n }\n }\n\n // Unknown error. Throw as-is.\n throw responseBytes;\n};\n"],
|
|
5
|
+
"mappings": "qQAEA,MAOO,OCTP,MAAkC,OAI3B,GAAM,GAA2B,AAAC,GAAqC,CAC5E,GAAM,GAAQ,EAAoB,EAAc,EAAuB,EACjE,EAAyB,GAAI,cACnC,SAAW,cAAc,GAAI,YAAW,CAAK,CAAC,EACvC,CACT,EAEa,EAAU,AAAC,GAA0B,CAChD,GAAM,GAAS,GAAI,SACnB,SAAO,OAAO,EAAO,SAAS,EAAE,CAAC,EAC1B,CACT,ECZO,mBAAqC,MAAM,CAAC,EAE5C,eAAiC,EAAc,CAAC,EAEhD,eAAqC,EAAc,CACxD,YAA4B,EAAc,CACxC,MAAM,EADoB,cAE5B,CACF,EAEO,eAA4B,EAAc,CAC/C,YAA4B,EAA6B,CACvD,MAAM,EADoB,0BAE5B,CACF,EAEO,eAAqC,EAAc,CAAC,EAEpD,eAA+B,EAAc,CAClD,YAA4B,EAA0B,CACpD,MAAM,EADoB,kBAE5B,CACF,EAEa,EAAmB,AAAC,GAAwC,CACvE,GAAM,CAAE,WAAY,EAEpB,GAAI,EAAQ,SAAS,gBAAgB,EAAG,CAKtC,GAAI,EAAQ,MAAM,kCAAkC,EAClD,MAAO,IAAI,GAGb,CACE,GAAM,GAAI,EAAQ,MAAM,yCAAyC,EACjE,GAAI,GAAK,EAAE,OAAS,EAClB,MAAO,IAAI,GAAiB,OAAO,EAAE,EAAE,CAAC,CAE5C,CAEA,CACE,GAAM,GAAI,EAAQ,MAChB,iDACF,EACA,GAAI,GAAK,EAAE,OAAS,EAAG,CACrB,GAAM,GAAU,EAAI,WAAW,EAAE,EAAE,EACnC,GAAI,YAAmB,GACrB,MAAO,IAAI,GAAuB,CAAO,CAE7C,CACF,CAEA,GAAI,EAAQ,SAAS,cAAc,EACjC,MAAO,IAAI,GAGb,CACE,GAAM,GAAI,EAAQ,MAAM,kBAAkB,EAC1C,GAAI,GAAK,EAAE,OAAS,EAClB,MAAO,IAAI,GAAc,OAAO,SAAS,EAAE,EAAE,CAAC,CAElD,CACF,CAGA,KAAM,EACR,EFhDO,WAAqB,CAClB,YACW,EACA,EACA,EACA,EACjB,CAJiB,aACA,kBACA,qBACA,mBAChB,OAEW,QAAO,EAAiC,CAAC,EAAG,CACxD,MAAO,IAAI,GACT,EAAQ,OAAS,EAAa,EAC9B,EAAQ,YAAc,EACtB,EAAQ,oBAAsB,EAC9B,EAAQ,mBAAqB,CAC/B,CACF,CAUO,eAAiB,MAAO,CAC7B,oBACA,YAAY,MAIM,CAClB,GAAM,GAAa,EAAY,KAAK,cAAgB,KAAK,aAEnD,EAAU,GAAI,yBACpB,EAAQ,WAAW,EAAkB,QAAQ,CAAC,EAE9C,GAAM,GAAgB,KAAM,GAAW,CACrC,MAAO,KAAK,MACZ,WAAY,KAAK,WACjB,WAAY,qBACZ,IAAK,EAAQ,gBAAgB,CAC/B,CAAC,EAED,MAAO,GAAI,QACT,OAAO,QAAM,kBAAkB,GAAI,YAAW,CAAa,CAAC,EAAE,OAAO,CAAC,CACxE,CACF,EAQO,SAAW,MAAO,CACvB,KACA,SACA,OACA,MACA,sBAO0B,CAC1B,GAAM,GAAU,GAAI,eACpB,EAAQ,MAAM,EAAG,QAAQ,CAAC,EAE1B,GAAM,GAAU,GAAI,WACpB,EAAQ,gBAAgB,EAAO,QAAQ,CAAC,EACxC,EAAQ,WAAW,CAAO,EAE1B,EAAQ,UAAU,EAAQ,GAAO,CAAe,CAAC,EAGjD,GAAM,GAAoB,GAAI,QAC9B,EAAY,QAAS,IAAQ,OAAO,CAAC,GAAG,SAAS,CAAC,EAClD,EAAQ,QAAQ,CAAW,EAEvB,IAAqB,QACvB,EAAQ,kBAAkB,EAAyB,CAAgB,CAAC,EAGtE,GAAI,CACF,GAAM,GAAgB,KAAM,MAAK,cAAc,CAC7C,MAAO,KAAK,MACZ,WAAY,KAAK,WACjB,WAAY,UACZ,IAAK,EAAQ,gBAAgB,CAC/B,CAAC,EAGD,MAAO,QAAO,cAAc,kBAAkB,CAAa,EAAE,UAAU,CAAC,CAC1E,OAAS,EAAP,CACA,KAAI,aAAe,OACX,EAAiB,CAAG,EAGtB,CACR,CACF,CACF",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{c as n}from"./chunk-E6UFXMWU.js";var u=async({agent:s,canisterId:t,methodName:r,arg:a})=>{let e=await s.call(t,{methodName:r,arg:a,effectiveCanisterId:t});if(!e.response.ok)throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${t}`,` Request ID: ${e.requestId}`,` HTTP status code: ${e.response.status}`,` HTTP status text: ${e.response.statusText}`].join(`
|
|
2
|
+
`));let o=await n.pollForResponse(s,t,e.requestId,n.defaultStrategy());return new Uint8Array(o)},p=async({agent:s,canisterId:t,methodName:r,arg:a})=>{let e=await s.query(t,{methodName:r,arg:a});if(e.status=="rejected")throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${t}`,` HTTP status code: ${e.reject_code}`,` HTTP status text: ${e.reject_message}`].join(`
|
|
3
|
+
`));return new Uint8Array(e.reply.arg)};export{u as a,p as b};
|
|
4
|
+
//# sourceMappingURL=chunk-KUIJF2IJ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/proto.utils.ts"],
|
|
4
|
+
"sourcesContent": ["import { Agent, polling } from \"@dfinity/agent\";\nimport { Principal } from \"@dfinity/principal\";\n\n/**\n * Submits an update call to the IC.\n * @returns The (binary) response if the request succeeded, an error otherwise.\n */\nexport const updateCall = async ({\n agent,\n canisterId,\n methodName,\n arg,\n}: {\n agent: Agent;\n canisterId: Principal;\n methodName: string;\n arg: ArrayBuffer;\n}): Promise<Uint8Array> => {\n const submitResponse = await agent.call(canisterId, {\n methodName,\n arg,\n effectiveCanisterId: canisterId,\n });\n\n if (!submitResponse.response.ok) {\n throw new Error(\n [\n \"Call failed:\",\n ` Method: ${methodName}`,\n ` Canister ID: ${canisterId}`,\n ` Request ID: ${submitResponse.requestId}`,\n ` HTTP status code: ${submitResponse.response.status}`,\n ` HTTP status text: ${submitResponse.response.statusText}`,\n ].join(\"\\n\")\n );\n }\n\n const blob = await polling.pollForResponse(\n agent,\n canisterId,\n submitResponse.requestId,\n polling.defaultStrategy()\n );\n\n return new Uint8Array(blob);\n};\n\n/**\n * Submits a query call to the IC.\n * @returns The (binary) response if the request succeeded, an error otherwise.\n */\nexport const queryCall = async ({\n agent,\n canisterId,\n methodName,\n arg,\n}: {\n agent: Agent;\n canisterId: Principal;\n methodName: string;\n arg: ArrayBuffer;\n}): Promise<Uint8Array> => {\n const queryResponse = await agent.query(canisterId, {\n methodName,\n arg,\n });\n\n if (queryResponse.status == \"rejected\") {\n throw new Error(\n [\n \"Call failed:\",\n ` Method: ${methodName}`,\n ` Canister ID: ${canisterId}`,\n ` HTTP status code: ${queryResponse.reject_code}`,\n ` HTTP status text: ${queryResponse.reject_message}`,\n ].join(\"\\n\")\n );\n }\n\n return new Uint8Array(queryResponse.reply.arg);\n};\n"],
|
|
5
|
+
"mappings": "wCAOO,GAAM,GAAa,MAAO,CAC/B,QACA,aACA,aACA,SAMyB,CACzB,GAAM,GAAiB,KAAM,GAAM,KAAK,EAAY,CAClD,aACA,MACA,oBAAqB,CACvB,CAAC,EAED,GAAI,CAAC,EAAe,SAAS,GAC3B,KAAM,IAAI,OACR,CACE,eACA,aAAa,IACb,kBAAkB,IAClB,iBAAiB,EAAe,YAChC,uBAAuB,EAAe,SAAS,SAC/C,uBAAuB,EAAe,SAAS,YACjD,EAAE,KAAK;AAAA,CAAI,CACb,EAGF,GAAM,GAAO,KAAM,GAAQ,gBACzB,EACA,EACA,EAAe,UACf,EAAQ,gBAAgB,CAC1B,EAEA,MAAO,IAAI,YAAW,CAAI,CAC5B,EAMa,EAAY,MAAO,CAC9B,QACA,aACA,aACA,SAMyB,CACzB,GAAM,GAAgB,KAAM,GAAM,MAAM,EAAY,CAClD,aACA,KACF,CAAC,EAED,GAAI,EAAc,QAAU,WAC1B,KAAM,IAAI,OACR,CACE,eACA,aAAa,IACb,kBAAkB,IAClB,uBAAuB,EAAc,cACrC,uBAAuB,EAAc,gBACvC,EAAE,KAAK;AAAA,CAAI,CACb,EAGF,MAAO,IAAI,YAAW,EAAc,MAAM,GAAG,CAC/C",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{a as X}from"./chunk-ONAVPXOT.js";var Et=X((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=window:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(i){return Object.prototype.toString.call(i)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(i){return typeof i=="object"&&i.buffer&&i.buffer.constructor===ArrayBuffer});var createOutputMethod=function(i,t){return function(r){return new Sha256(t,!0).update(r)[i]()}},createMethod=function(i){var t=createOutputMethod("hex",i);NODE_JS&&(t=nodeWrap(t,i)),t.create=function(){return new Sha256(i)},t.update=function(n){return t.create().update(n)};for(var r=0;r<OUTPUT_TYPES.length;++r){var e=OUTPUT_TYPES[r];t[e]=createOutputMethod(e,i)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(i){if(typeof i=="string")return crypto.createHash(algorithm).update(i,"utf8").digest("hex");if(i==null)throw new Error(ERROR);return i.constructor===ArrayBuffer&&(i=new Uint8Array(i)),Array.isArray(i)||ArrayBuffer.isView(i)||i.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(i)).digest("hex"):method(i)};return nodeMethod},createHmacOutputMethod=function(i,t){return function(r,e){return new HmacSha256(r,t,!0).update(e)[i]()}},createHmacMethod=function(i){var t=createHmacOutputMethod("hex",i);t.create=function(n){return new HmacSha256(n,i)},t.update=function(n,o){return t.create(n).update(o)};for(var r=0;r<OUTPUT_TYPES.length;++r){var e=OUTPUT_TYPES[r];t[e]=createHmacOutputMethod(e,i)}return t};function Sha256(i,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=i}Sha256.prototype.update=function(i){if(!this.finalized){var t,r=typeof i;if(r!=="string"){if(r==="object"){if(i===null)throw new Error(ERROR);if(ARRAY_BUFFER&&i.constructor===ArrayBuffer)i=new Uint8Array(i);else if(!Array.isArray(i)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(i)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var e,n=0,o,h=i.length,f=this.blocks;n<h;){if(this.hashed&&(this.hashed=!1,f[0]=this.block,f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0),t)for(o=this.start;n<h&&o<64;++n)f[o>>2]|=i[n]<<SHIFT[o++&3];else for(o=this.start;n<h&&o<64;++n)e=i.charCodeAt(n),e<128?f[o>>2]|=e<<SHIFT[o++&3]:e<2048?(f[o>>2]|=(192|e>>6)<<SHIFT[o++&3],f[o>>2]|=(128|e&63)<<SHIFT[o++&3]):e<55296||e>=57344?(f[o>>2]|=(224|e>>12)<<SHIFT[o++&3],f[o>>2]|=(128|e>>6&63)<<SHIFT[o++&3],f[o>>2]|=(128|e&63)<<SHIFT[o++&3]):(e=65536+((e&1023)<<10|i.charCodeAt(++n)&1023),f[o>>2]|=(240|e>>18)<<SHIFT[o++&3],f[o>>2]|=(128|e>>12&63)<<SHIFT[o++&3],f[o>>2]|=(128|e>>6&63)<<SHIFT[o++&3],f[o>>2]|=(128|e&63)<<SHIFT[o++&3]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=f[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var i=this.blocks,t=this.lastByteIndex;i[16]=this.block,i[t>>2]|=EXTRA[t&3],this.block=i[16],t>=56&&(this.hashed||this.hash(),i[0]=this.block,i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0),i[14]=this.hBytes<<3|this.bytes>>>29,i[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var i=this.h0,t=this.h1,r=this.h2,e=this.h3,n=this.h4,o=this.h5,h=this.h6,f=this.h7,c=this.blocks,s,p,a,y,x,F,d,C,k,D,T;for(s=16;s<64;++s)x=c[s-15],p=(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3,x=c[s-2],a=(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10,c[s]=c[s-16]+p+c[s-7]+a<<0;for(T=t&r,s=0;s<64;s+=4)this.first?(this.is224?(C=300032,x=c[0]-1413257819,f=x-150054599<<0,e=x+24177077<<0):(C=704751109,x=c[0]-210244248,f=x-1521486534<<0,e=x+143694565<<0),this.first=!1):(p=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),a=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),C=i&t,y=C^i&r^T,d=n&o^~n&h,x=f+a+d+K[s]+c[s],F=p+y,f=e+x<<0,e=x+F<<0),p=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),a=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7),k=e&i,y=k^e&t^C,d=f&n^~f&o,x=h+a+d+K[s+1]+c[s+1],F=p+y,h=r+x<<0,r=x+F<<0,p=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),a=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),D=r&e,y=D^r&i^k,d=h&f^~h&n,x=o+a+d+K[s+2]+c[s+2],F=p+y,o=t+x<<0,t=x+F<<0,p=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),a=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),T=t&r,y=T^t&e^D,d=o&h^~o&f,x=n+a+d+K[s+3]+c[s+3],F=p+y,n=i+x<<0,i=x+F<<0;this.h0=this.h0+i<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+e<<0,this.h4=this.h4+n<<0,this.h5=this.h5+o<<0,this.h6=this.h6+h<<0,this.h7=this.h7+f<<0},Sha256.prototype.hex=function(){this.finalize();var i=this.h0,t=this.h1,r=this.h2,e=this.h3,n=this.h4,o=this.h5,h=this.h6,f=this.h7,c=HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]+HEX_CHARS[h>>28&15]+HEX_CHARS[h>>24&15]+HEX_CHARS[h>>20&15]+HEX_CHARS[h>>16&15]+HEX_CHARS[h>>12&15]+HEX_CHARS[h>>8&15]+HEX_CHARS[h>>4&15]+HEX_CHARS[h&15];return this.is224||(c+=HEX_CHARS[f>>28&15]+HEX_CHARS[f>>24&15]+HEX_CHARS[f>>20&15]+HEX_CHARS[f>>16&15]+HEX_CHARS[f>>12&15]+HEX_CHARS[f>>8&15]+HEX_CHARS[f>>4&15]+HEX_CHARS[f&15]),c},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var i=this.h0,t=this.h1,r=this.h2,e=this.h3,n=this.h4,o=this.h5,h=this.h6,f=this.h7,c=[i>>24&255,i>>16&255,i>>8&255,i&255,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24&255,r>>16&255,r>>8&255,r&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,o>>24&255,o>>16&255,o>>8&255,o&255,h>>24&255,h>>16&255,h>>8&255,h&255];return this.is224||c.push(f>>24&255,f>>16&255,f>>8&255,f&255),c},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var i=new ArrayBuffer(this.is224?28:32),t=new DataView(i);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),i};function HmacSha256(i,t,r){var e,n=typeof i;if(n==="string"){var o=[],h=i.length,f=0,c;for(e=0;e<h;++e)c=i.charCodeAt(e),c<128?o[f++]=c:c<2048?(o[f++]=192|c>>6,o[f++]=128|c&63):c<55296||c>=57344?(o[f++]=224|c>>12,o[f++]=128|c>>6&63,o[f++]=128|c&63):(c=65536+((c&1023)<<10|i.charCodeAt(++e)&1023),o[f++]=240|c>>18,o[f++]=128|c>>12&63,o[f++]=128|c>>6&63,o[f++]=128|c&63);i=o}else if(n==="object"){if(i===null)throw new Error(ERROR);if(ARRAY_BUFFER&&i.constructor===ArrayBuffer)i=new Uint8Array(i);else if(!Array.isArray(i)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(i)))throw new Error(ERROR)}else throw new Error(ERROR);i.length>64&&(i=new Sha256(t,!0).update(i).array());var s=[],p=[];for(e=0;e<64;++e){var a=i[e]||0;s[e]=92^a,p[e]=54^a}Sha256.call(this,t,r),this.update(p),this.oKeyPad=s,this.inner=!0,this.sharedMemory=r}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var i=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(i),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var Q=X(O=>{"use strict";O.byteLength=wt;O.toByteArray=Bt;O.fromByteArray=St;var B=[],w=[],Ft=typeof Uint8Array<"u"?Uint8Array:Array,P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(H=0,G=P.length;H<G;++H)B[H]=P[H],w[P.charCodeAt(H)]=H;var H,G;w["-".charCodeAt(0)]=62;w["_".charCodeAt(0)]=63;function Z(i){var t=i.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=i.indexOf("=");r===-1&&(r=t);var e=r===t?0:4-r%4;return[r,e]}function wt(i){var t=Z(i),r=t[0],e=t[1];return(r+e)*3/4-e}function dt(i,t,r){return(t+r)*3/4-r}function Bt(i){var t,r=Z(i),e=r[0],n=r[1],o=new Ft(dt(i,e,n)),h=0,f=n>0?e-4:e,c;for(c=0;c<f;c+=4)t=w[i.charCodeAt(c)]<<18|w[i.charCodeAt(c+1)]<<12|w[i.charCodeAt(c+2)]<<6|w[i.charCodeAt(c+3)],o[h++]=t>>16&255,o[h++]=t>>8&255,o[h++]=t&255;return n===2&&(t=w[i.charCodeAt(c)]<<2|w[i.charCodeAt(c+1)]>>4,o[h++]=t&255),n===1&&(t=w[i.charCodeAt(c)]<<10|w[i.charCodeAt(c+1)]<<4|w[i.charCodeAt(c+2)]>>2,o[h++]=t>>8&255,o[h++]=t&255),o}function At(i){return B[i>>18&63]+B[i>>12&63]+B[i>>6&63]+B[i&63]}function Rt(i,t,r){for(var e,n=[],o=t;o<r;o+=3)e=(i[o]<<16&16711680)+(i[o+1]<<8&65280)+(i[o+2]&255),n.push(At(e));return n.join("")}function St(i){for(var t,r=i.length,e=r%3,n=[],o=16383,h=0,f=r-e;h<f;h+=o)n.push(Rt(i,h,h+o>f?f:h+o));return e===1?(t=i[r-1],n.push(B[t>>2]+B[t<<4&63]+"==")):e===2&&(t=(i[r-2]<<8)+i[r-1],n.push(B[t>>10]+B[t>>4&63]+B[t<<2&63]+"=")),n.join("")}});var v=X(L=>{L.read=function(i,t,r,e,n){var o,h,f=n*8-e-1,c=(1<<f)-1,s=c>>1,p=-7,a=r?n-1:0,y=r?-1:1,x=i[t+a];for(a+=y,o=x&(1<<-p)-1,x>>=-p,p+=f;p>0;o=o*256+i[t+a],a+=y,p-=8);for(h=o&(1<<-p)-1,o>>=-p,p+=e;p>0;h=h*256+i[t+a],a+=y,p-=8);if(o===0)o=1-s;else{if(o===c)return h?NaN:(x?-1:1)*(1/0);h=h+Math.pow(2,e),o=o-s}return(x?-1:1)*h*Math.pow(2,o-e)};L.write=function(i,t,r,e,n,o){var h,f,c,s=o*8-n-1,p=(1<<s)-1,a=p>>1,y=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=e?0:o-1,F=e?1:-1,d=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,h=p):(h=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-h))<1&&(h--,c*=2),h+a>=1?t+=y/c:t+=y*Math.pow(2,1-a),t*c>=2&&(h++,c/=2),h+a>=p?(f=0,h=p):h+a>=1?(f=(t*c-1)*Math.pow(2,n),h=h+a):(f=t*Math.pow(2,a-1)*Math.pow(2,n),h=0));n>=8;i[r+x]=f&255,x+=F,f/=256,n-=8);for(h=h<<n|f,s+=n;s>0;i[r+x]=h&255,x+=F,h/=256,s-=8);i[r+x-F]|=d*128}});var qt=X(U=>{"use strict";var $=Q(),g=v(),tt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;U.Buffer=u;U.SlowBuffer=Ut;U.INSPECT_MAX_BYTES=50;var M=2147483647;U.kMaxLength=M;u.TYPED_ARRAY_SUPPORT=Ht();!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ht(){try{let i=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(i,t),i.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(!!u.isBuffer(this))return this.byteOffset}});function R(i){if(i>M)throw new RangeError('The value "'+i+'" is invalid for option "size"');let t=new Uint8Array(i);return Object.setPrototypeOf(t,u.prototype),t}function u(i,t,r){if(typeof i=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return j(i)}return nt(i,t,r)}u.poolSize=8192;function nt(i,t,r){if(typeof i=="string")return _t(i,t);if(ArrayBuffer.isView(i))return gt(i);if(i==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);if(A(i,ArrayBuffer)||i&&A(i.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(A(i,SharedArrayBuffer)||i&&A(i.buffer,SharedArrayBuffer)))return Y(i,t,r);if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let e=i.valueOf&&i.valueOf();if(e!=null&&e!==i)return u.from(e,t,r);let n=mt(i);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof i[Symbol.toPrimitive]=="function")return u.from(i[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 i)}u.from=function(i,t,r){return nt(i,t,r)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function ot(i){if(typeof i!="number")throw new TypeError('"size" argument must be of type number');if(i<0)throw new RangeError('The value "'+i+'" is invalid for option "size"')}function It(i,t,r){return ot(i),i<=0?R(i):t!==void 0?typeof r=="string"?R(i).fill(t,r):R(i).fill(t):R(i)}u.alloc=function(i,t,r){return It(i,t,r)};function j(i){return ot(i),R(i<0?0:z(i)|0)}u.allocUnsafe=function(i){return j(i)};u.allocUnsafeSlow=function(i){return j(i)};function _t(i,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=ht(i,t)|0,e=R(r),n=e.write(i,t);return n!==r&&(e=e.slice(0,n)),e}function W(i){let t=i.length<0?0:z(i.length)|0,r=R(t);for(let e=0;e<t;e+=1)r[e]=i[e]&255;return r}function gt(i){if(A(i,Uint8Array)){let t=new Uint8Array(i);return Y(t.buffer,t.byteOffset,t.byteLength)}return W(i)}function Y(i,t,r){if(t<0||i.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let e;return t===void 0&&r===void 0?e=new Uint8Array(i):r===void 0?e=new Uint8Array(i,t):e=new Uint8Array(i,t,r),Object.setPrototypeOf(e,u.prototype),e}function mt(i){if(u.isBuffer(i)){let t=z(i.length)|0,r=R(t);return r.length===0||i.copy(r,0,0,t),r}if(i.length!==void 0)return typeof i.length!="number"||q(i.length)?R(0):W(i);if(i.type==="Buffer"&&Array.isArray(i.data))return W(i.data)}function z(i){if(i>=M)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+M.toString(16)+" bytes");return i|0}function Ut(i){return+i!=i&&(i=0),u.alloc(+i)}u.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==u.prototype};u.compare=function(t,r){if(A(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),A(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(t)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let e=t.length,n=r.length;for(let o=0,h=Math.min(e,n);o<h;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0};u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return u.alloc(0);let e;if(r===void 0)for(r=0,e=0;e<t.length;++e)r+=t[e].length;let n=u.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){let h=t[e];if(A(h,Uint8Array))o+h.length>n.length?(u.isBuffer(h)||(h=u.from(h)),h.copy(n,o)):Uint8Array.prototype.set.call(n,h,o);else if(u.isBuffer(h))h.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=h.length}return n};function ht(i,t){if(u.isBuffer(i))return i.length;if(ArrayBuffer.isView(i)||A(i,ArrayBuffer))return i.byteLength;if(typeof i!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof i);let r=i.length,e=arguments.length>2&&arguments[2]===!0;if(!e&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return J(i).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return yt(i).length;default:if(n)return e?-1:J(i).length;t=(""+t).toLowerCase(),n=!0}}u.byteLength=ht;function Ct(i,t,r){let e=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(i||(i="utf8");;)switch(i){case"hex":return Lt(this,t,r);case"utf8":case"utf-8":return ft(this,t,r);case"ascii":return Dt(this,t,r);case"latin1":case"binary":return Pt(this,t,r);case"base64":return Nt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,t,r);default:if(e)throw new TypeError("Unknown encoding: "+i);i=(i+"").toLowerCase(),e=!0}}u.prototype._isBuffer=!0;function I(i,t,r){let e=i[t];i[t]=i[r],i[r]=e}u.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)I(this,r,r+1);return this};u.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)I(this,r,r+3),I(this,r+1,r+2);return this};u.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)I(this,r,r+7),I(this,r+1,r+6),I(this,r+2,r+5),I(this,r+3,r+4);return this};u.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?ft(this,0,t):Ct.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:u.compare(this,t)===0};u.prototype.inspect=function(){let t="",r=U.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};tt&&(u.prototype[tt]=u.prototype.inspect);u.prototype.compare=function(t,r,e,n,o){if(A(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),e===void 0&&(e=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(r>>>=0,e>>>=0,n>>>=0,o>>>=0,this===t)return 0;let h=o-n,f=e-r,c=Math.min(h,f),s=this.slice(n,o),p=t.slice(r,e);for(let a=0;a<c;++a)if(s[a]!==p[a]){h=s[a],f=p[a];break}return h<f?-1:f<h?1:0};function ut(i,t,r,e,n){if(i.length===0)return-1;if(typeof r=="string"?(e=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,q(r)&&(r=n?0:i.length-1),r<0&&(r=i.length+r),r>=i.length){if(n)return-1;r=i.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=u.from(t,e)),u.isBuffer(t))return t.length===0?-1:rt(i,t,r,e,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(i,t,r):Uint8Array.prototype.lastIndexOf.call(i,t,r):rt(i,[t],r,e,n);throw new TypeError("val must be string, number or Buffer")}function rt(i,t,r,e,n){let o=1,h=i.length,f=t.length;if(e!==void 0&&(e=String(e).toLowerCase(),e==="ucs2"||e==="ucs-2"||e==="utf16le"||e==="utf-16le")){if(i.length<2||t.length<2)return-1;o=2,h/=2,f/=2,r/=2}function c(p,a){return o===1?p[a]:p.readUInt16BE(a*o)}let s;if(n){let p=-1;for(s=r;s<h;s++)if(c(i,s)===c(t,p===-1?0:s-p)){if(p===-1&&(p=s),s-p+1===f)return p*o}else p!==-1&&(s-=s-p),p=-1}else for(r+f>h&&(r=h-f),s=r;s>=0;s--){let p=!0;for(let a=0;a<f;a++)if(c(i,s+a)!==c(t,a)){p=!1;break}if(p)return s}return-1}u.prototype.includes=function(t,r,e){return this.indexOf(t,r,e)!==-1};u.prototype.indexOf=function(t,r,e){return ut(this,t,r,e,!0)};u.prototype.lastIndexOf=function(t,r,e){return ut(this,t,r,e,!1)};function bt(i,t,r,e){r=Number(r)||0;let n=i.length-r;e?(e=Number(e),e>n&&(e=n)):e=n;let o=t.length;e>o/2&&(e=o/2);let h;for(h=0;h<e;++h){let f=parseInt(t.substr(h*2,2),16);if(q(f))return h;i[r+h]=f}return h}function Tt(i,t,r,e){return N(J(t,i.length-r),i,r,e)}function Xt(i,t,r,e){return N(jt(t),i,r,e)}function Ot(i,t,r,e){return N(yt(t),i,r,e)}function Mt(i,t,r,e){return N(zt(t,i.length-r),i,r,e)}u.prototype.write=function(t,r,e,n){if(r===void 0)n="utf8",e=this.length,r=0;else if(e===void 0&&typeof r=="string")n=r,e=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(e)?(e=e>>>0,n===void 0&&(n="utf8")):(n=e,e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((e===void 0||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let h=!1;for(;;)switch(n){case"hex":return bt(this,t,r,e);case"utf8":case"utf-8":return Tt(this,t,r,e);case"ascii":case"latin1":case"binary":return Xt(this,t,r,e);case"base64":return Ot(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,t,r,e);default:if(h)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),h=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Nt(i,t,r){return t===0&&r===i.length?$.fromByteArray(i):$.fromByteArray(i.slice(t,r))}function ft(i,t,r){r=Math.min(i.length,r);let e=[],n=t;for(;n<r;){let o=i[n],h=null,f=o>239?4:o>223?3:o>191?2:1;if(n+f<=r){let c,s,p,a;switch(f){case 1:o<128&&(h=o);break;case 2:c=i[n+1],(c&192)===128&&(a=(o&31)<<6|c&63,a>127&&(h=a));break;case 3:c=i[n+1],s=i[n+2],(c&192)===128&&(s&192)===128&&(a=(o&15)<<12|(c&63)<<6|s&63,a>2047&&(a<55296||a>57343)&&(h=a));break;case 4:c=i[n+1],s=i[n+2],p=i[n+3],(c&192)===128&&(s&192)===128&&(p&192)===128&&(a=(o&15)<<18|(c&63)<<12|(s&63)<<6|p&63,a>65535&&a<1114112&&(h=a))}}h===null?(h=65533,f=1):h>65535&&(h-=65536,e.push(h>>>10&1023|55296),h=56320|h&1023),e.push(h),n+=f}return kt(e)}var it=4096;function kt(i){let t=i.length;if(t<=it)return String.fromCharCode.apply(String,i);let r="",e=0;for(;e<t;)r+=String.fromCharCode.apply(String,i.slice(e,e+=it));return r}function Dt(i,t,r){let e="";r=Math.min(i.length,r);for(let n=t;n<r;++n)e+=String.fromCharCode(i[n]&127);return e}function Pt(i,t,r){let e="";r=Math.min(i.length,r);for(let n=t;n<r;++n)e+=String.fromCharCode(i[n]);return e}function Lt(i,t,r){let e=i.length;(!t||t<0)&&(t=0),(!r||r<0||r>e)&&(r=e);let n="";for(let o=t;o<r;++o)n+=Kt[i[o]];return n}function $t(i,t,r){let e=i.slice(t,r),n="";for(let o=0;o<e.length-1;o+=2)n+=String.fromCharCode(e[o]+e[o+1]*256);return n}u.prototype.slice=function(t,r){let e=this.length;t=~~t,r=r===void 0?e:~~r,t<0?(t+=e,t<0&&(t=0)):t>e&&(t=e),r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),r<t&&(r=t);let n=this.subarray(t,r);return Object.setPrototypeOf(n,u.prototype),n};function l(i,t,r){if(i%1!==0||i<0)throw new RangeError("offset is not uint");if(i+t>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(t,r,e){t=t>>>0,r=r>>>0,e||l(t,r,this.length);let n=this[t],o=1,h=0;for(;++h<r&&(o*=256);)n+=this[t+h]*o;return n};u.prototype.readUintBE=u.prototype.readUIntBE=function(t,r,e){t=t>>>0,r=r>>>0,e||l(t,r,this.length);let n=this[t+--r],o=1;for(;r>0&&(o*=256);)n+=this[t+--r]*o;return n};u.prototype.readUint8=u.prototype.readUInt8=function(t,r){return t=t>>>0,r||l(t,1,this.length),this[t]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||l(t,2,this.length),this[t]|this[t+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||l(t,2,this.length),this[t]<<8|this[t+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||l(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};u.prototype.readBigUInt64LE=S(function(t){t=t>>>0,m(t,"offset");let r=this[t],e=this[t+7];(r===void 0||e===void 0)&&b(t,this.length-8);let n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+e*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});u.prototype.readBigUInt64BE=S(function(t){t=t>>>0,m(t,"offset");let r=this[t],e=this[t+7];(r===void 0||e===void 0)&&b(t,this.length-8);let n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+e;return(BigInt(n)<<BigInt(32))+BigInt(o)});u.prototype.readIntLE=function(t,r,e){t=t>>>0,r=r>>>0,e||l(t,r,this.length);let n=this[t],o=1,h=0;for(;++h<r&&(o*=256);)n+=this[t+h]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};u.prototype.readIntBE=function(t,r,e){t=t>>>0,r=r>>>0,e||l(t,r,this.length);let n=r,o=1,h=this[t+--n];for(;n>0&&(o*=256);)h+=this[t+--n]*o;return o*=128,h>=o&&(h-=Math.pow(2,8*r)),h};u.prototype.readInt8=function(t,r){return t=t>>>0,r||l(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};u.prototype.readInt16LE=function(t,r){t=t>>>0,r||l(t,2,this.length);let e=this[t]|this[t+1]<<8;return e&32768?e|4294901760:e};u.prototype.readInt16BE=function(t,r){t=t>>>0,r||l(t,2,this.length);let e=this[t+1]|this[t]<<8;return e&32768?e|4294901760:e};u.prototype.readInt32LE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};u.prototype.readInt32BE=function(t,r){return t=t>>>0,r||l(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};u.prototype.readBigInt64LE=S(function(t){t=t>>>0,m(t,"offset");let r=this[t],e=this[t+7];(r===void 0||e===void 0)&&b(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(e<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});u.prototype.readBigInt64BE=S(function(t){t=t>>>0,m(t,"offset");let r=this[t],e=this[t+7];(r===void 0||e===void 0)&&b(t,this.length-8);let n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+e)});u.prototype.readFloatLE=function(t,r){return t=t>>>0,r||l(t,4,this.length),g.read(this,t,!0,23,4)};u.prototype.readFloatBE=function(t,r){return t=t>>>0,r||l(t,4,this.length),g.read(this,t,!1,23,4)};u.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||l(t,8,this.length),g.read(this,t,!0,52,8)};u.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||l(t,8,this.length),g.read(this,t,!1,52,8)};function E(i,t,r,e,n,o){if(!u.isBuffer(i))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+e>i.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r=r>>>0,e=e>>>0,!n){let f=Math.pow(2,8*e)-1;E(this,t,r,e,f,0)}let o=1,h=0;for(this[r]=t&255;++h<e&&(o*=256);)this[r+h]=t/o&255;return r+e};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,r,e,n){if(t=+t,r=r>>>0,e=e>>>0,!n){let f=Math.pow(2,8*e)-1;E(this,t,r,e,f,0)}let o=e-1,h=1;for(this[r+o]=t&255;--o>=0&&(h*=256);)this[r+o]=t/h&255;return r+e};u.prototype.writeUint8=u.prototype.writeUInt8=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,1,255,0),this[r]=t&255,r+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function ct(i,t,r,e,n){lt(t,e,n,i,r,7);let o=Number(t&BigInt(4294967295));i[r++]=o,o=o>>8,i[r++]=o,o=o>>8,i[r++]=o,o=o>>8,i[r++]=o;let h=Number(t>>BigInt(32)&BigInt(4294967295));return i[r++]=h,h=h>>8,i[r++]=h,h=h>>8,i[r++]=h,h=h>>8,i[r++]=h,r}function st(i,t,r,e,n){lt(t,e,n,i,r,7);let o=Number(t&BigInt(4294967295));i[r+7]=o,o=o>>8,i[r+6]=o,o=o>>8,i[r+5]=o,o=o>>8,i[r+4]=o;let h=Number(t>>BigInt(32)&BigInt(4294967295));return i[r+3]=h,h=h>>8,i[r+2]=h,h=h>>8,i[r+1]=h,h=h>>8,i[r]=h,r+8}u.prototype.writeBigUInt64LE=S(function(t,r=0){return ct(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});u.prototype.writeBigUInt64BE=S(function(t,r=0){return st(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});u.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r=r>>>0,!n){let c=Math.pow(2,8*e-1);E(this,t,r,e,c-1,-c)}let o=0,h=1,f=0;for(this[r]=t&255;++o<e&&(h*=256);)t<0&&f===0&&this[r+o-1]!==0&&(f=1),this[r+o]=(t/h>>0)-f&255;return r+e};u.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r=r>>>0,!n){let c=Math.pow(2,8*e-1);E(this,t,r,e,c-1,-c)}let o=e-1,h=1,f=0;for(this[r+o]=t&255;--o>=0&&(h*=256);)t<0&&f===0&&this[r+o+1]!==0&&(f=1),this[r+o]=(t/h>>0)-f&255;return r+e};u.prototype.writeInt8=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};u.prototype.writeInt16LE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};u.prototype.writeInt16BE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};u.prototype.writeInt32LE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};u.prototype.writeInt32BE=function(t,r,e){return t=+t,r=r>>>0,e||E(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};u.prototype.writeBigInt64LE=S(function(t,r=0){return ct(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});u.prototype.writeBigInt64BE=S(function(t,r=0){return st(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function at(i,t,r,e,n,o){if(r+e>i.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function pt(i,t,r,e,n){return t=+t,r=r>>>0,n||at(i,t,r,4,34028234663852886e22,-34028234663852886e22),g.write(i,t,r,e,23,4),r+4}u.prototype.writeFloatLE=function(t,r,e){return pt(this,t,r,!0,e)};u.prototype.writeFloatBE=function(t,r,e){return pt(this,t,r,!1,e)};function xt(i,t,r,e,n){return t=+t,r=r>>>0,n||at(i,t,r,8,17976931348623157e292,-17976931348623157e292),g.write(i,t,r,e,52,8),r+8}u.prototype.writeDoubleLE=function(t,r,e){return xt(this,t,r,!0,e)};u.prototype.writeDoubleBE=function(t,r,e){return xt(this,t,r,!1,e)};u.prototype.copy=function(t,r,e,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=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),t.length-r<n-e&&(n=t.length-r+e);let o=n-e;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,e,n):Uint8Array.prototype.set.call(t,this.subarray(e,n),r),o};u.prototype.fill=function(t,r,e,n){if(typeof t=="string"){if(typeof r=="string"?(n=r,r=0,e=this.length):typeof e=="string"&&(n=e,e=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let h=t.charCodeAt(0);(n==="utf8"&&h<128||n==="latin1")&&(t=h)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;r=r>>>0,e=e===void 0?this.length:e>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<e;++o)this[o]=t;else{let h=u.isBuffer(t)?t:u.from(t,n),f=h.length;if(f===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<e-r;++o)this[o+r]=h[o%f]}return this};var _={};function V(i,t,r){_[i]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${i}]`,this.stack,delete this.name}get code(){return i}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${i}]: ${this.message}`}}}V("ERR_BUFFER_OUT_OF_BOUNDS",function(i){return i?`${i} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);V("ERR_INVALID_ARG_TYPE",function(i,t){return`The "${i}" argument must be of type number. Received type ${typeof t}`},TypeError);V("ERR_OUT_OF_RANGE",function(i,t,r){let e=`The value of "${i}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=et(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=et(n)),n+="n"),e+=` It must be ${t}. Received ${n}`,e},RangeError);function et(i){let t="",r=i.length,e=i[0]==="-"?1:0;for(;r>=e+4;r-=3)t=`_${i.slice(r-3,r)}${t}`;return`${i.slice(0,r)}${t}`}function Wt(i,t,r){m(t,"offset"),(i[t]===void 0||i[t+r]===void 0)&&b(t,i.length-(r+1))}function lt(i,t,r,e,n,o){if(i>r||i<t){let h=typeof t=="bigint"?"n":"",f;throw o>3?t===0||t===BigInt(0)?f=`>= 0${h} and < 2${h} ** ${(o+1)*8}${h}`:f=`>= -(2${h} ** ${(o+1)*8-1}${h}) and < 2 ** ${(o+1)*8-1}${h}`:f=`>= ${t}${h} and <= ${r}${h}`,new _.ERR_OUT_OF_RANGE("value",f,i)}Wt(e,n,o)}function m(i,t){if(typeof i!="number")throw new _.ERR_INVALID_ARG_TYPE(t,"number",i)}function b(i,t,r){throw Math.floor(i)!==i?(m(i,r),new _.ERR_OUT_OF_RANGE(r||"offset","an integer",i)):t<0?new _.ERR_BUFFER_OUT_OF_BOUNDS:new _.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,i)}var Yt=/[^+/0-9A-Za-z-_]/g;function Jt(i){if(i=i.split("=")[0],i=i.trim().replace(Yt,""),i.length<2)return"";for(;i.length%4!==0;)i=i+"=";return i}function J(i,t){t=t||1/0;let r,e=i.length,n=null,o=[];for(let h=0;h<e;++h){if(r=i.charCodeAt(h),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(h+1===e){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function jt(i){let t=[];for(let r=0;r<i.length;++r)t.push(i.charCodeAt(r)&255);return t}function zt(i,t){let r,e,n,o=[];for(let h=0;h<i.length&&!((t-=2)<0);++h)r=i.charCodeAt(h),e=r>>8,n=r%256,o.push(n),o.push(e);return o}function yt(i){return $.toByteArray(Jt(i))}function N(i,t,r,e){let n;for(n=0;n<e&&!(n+r>=t.length||n>=i.length);++n)t[n+r]=i[n];return n}function A(i,t){return i instanceof t||i!=null&&i.constructor!=null&&i.constructor.name!=null&&i.constructor.name===t.name}function q(i){return i!==i}var Kt=function(){let i="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let e=r*16;for(let n=0;n<16;++n)t[e+n]=i[r]+i[n]}return t}();function S(i){return typeof BigInt>"u"?Vt:i}function Vt(){throw new Error("BigInt not supported")}});export{Et as a,Q as b,v as c,qt as d};
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9
|
+
/**
|
|
10
|
+
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
11
|
+
*
|
|
12
|
+
* @version 0.9.0
|
|
13
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
14
|
+
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/
|
|
17
|
+
//# sourceMappingURL=chunk-KXYKDST6.js.map
|