@snaha/swarm-id 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +431 -0
- package/dist/chunk/bmt.d.ts +17 -0
- package/dist/chunk/bmt.d.ts.map +1 -0
- package/dist/chunk/cac.d.ts +18 -0
- package/dist/chunk/cac.d.ts.map +1 -0
- package/dist/chunk/constants.d.ts +10 -0
- package/dist/chunk/constants.d.ts.map +1 -0
- package/dist/chunk/encrypted-cac.d.ts +48 -0
- package/dist/chunk/encrypted-cac.d.ts.map +1 -0
- package/dist/chunk/encryption.d.ts +86 -0
- package/dist/chunk/encryption.d.ts.map +1 -0
- package/dist/chunk/index.d.ts +6 -0
- package/dist/chunk/index.d.ts.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/proxy/act/act.d.ts +78 -0
- package/dist/proxy/act/act.d.ts.map +1 -0
- package/dist/proxy/act/crypto.d.ts +44 -0
- package/dist/proxy/act/crypto.d.ts.map +1 -0
- package/dist/proxy/act/grantee-list.d.ts +82 -0
- package/dist/proxy/act/grantee-list.d.ts.map +1 -0
- package/dist/proxy/act/history.d.ts +183 -0
- package/dist/proxy/act/history.d.ts.map +1 -0
- package/dist/proxy/act/index.d.ts +104 -0
- package/dist/proxy/act/index.d.ts.map +1 -0
- package/dist/proxy/chunking-encrypted.d.ts +14 -0
- package/dist/proxy/chunking-encrypted.d.ts.map +1 -0
- package/dist/proxy/chunking.d.ts +15 -0
- package/dist/proxy/chunking.d.ts.map +1 -0
- package/dist/proxy/download-data.d.ts +16 -0
- package/dist/proxy/download-data.d.ts.map +1 -0
- package/dist/proxy/feed-manifest.d.ts +62 -0
- package/dist/proxy/feed-manifest.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/async-finder.d.ts +77 -0
- package/dist/proxy/feeds/epochs/async-finder.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/epoch.d.ts +88 -0
- package/dist/proxy/feeds/epochs/epoch.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/finder.d.ts +67 -0
- package/dist/proxy/feeds/epochs/finder.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/index.d.ts +35 -0
- package/dist/proxy/feeds/epochs/index.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/test-utils.d.ts +93 -0
- package/dist/proxy/feeds/epochs/test-utils.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/types.d.ts +109 -0
- package/dist/proxy/feeds/epochs/types.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/updater.d.ts +68 -0
- package/dist/proxy/feeds/epochs/updater.d.ts.map +1 -0
- package/dist/proxy/feeds/epochs/utils.d.ts +22 -0
- package/dist/proxy/feeds/epochs/utils.d.ts.map +1 -0
- package/dist/proxy/feeds/index.d.ts +5 -0
- package/dist/proxy/feeds/index.d.ts.map +1 -0
- package/dist/proxy/feeds/sequence/async-finder.d.ts +14 -0
- package/dist/proxy/feeds/sequence/async-finder.d.ts.map +1 -0
- package/dist/proxy/feeds/sequence/finder.d.ts +17 -0
- package/dist/proxy/feeds/sequence/finder.d.ts.map +1 -0
- package/dist/proxy/feeds/sequence/index.d.ts +23 -0
- package/dist/proxy/feeds/sequence/index.d.ts.map +1 -0
- package/dist/proxy/feeds/sequence/types.d.ts +80 -0
- package/dist/proxy/feeds/sequence/types.d.ts.map +1 -0
- package/dist/proxy/feeds/sequence/updater.d.ts +26 -0
- package/dist/proxy/feeds/sequence/updater.d.ts.map +1 -0
- package/dist/proxy/index.d.ts +6 -0
- package/dist/proxy/index.d.ts.map +1 -0
- package/dist/proxy/manifest-builder.d.ts +183 -0
- package/dist/proxy/manifest-builder.d.ts.map +1 -0
- package/dist/proxy/mantaray-encrypted.d.ts +27 -0
- package/dist/proxy/mantaray-encrypted.d.ts.map +1 -0
- package/dist/proxy/mantaray.d.ts +26 -0
- package/dist/proxy/mantaray.d.ts.map +1 -0
- package/dist/proxy/types.d.ts +29 -0
- package/dist/proxy/types.d.ts.map +1 -0
- package/dist/proxy/upload-data.d.ts +17 -0
- package/dist/proxy/upload-data.d.ts.map +1 -0
- package/dist/proxy/upload-encrypted-data.d.ts +103 -0
- package/dist/proxy/upload-encrypted-data.d.ts.map +1 -0
- package/dist/schemas.d.ts +240 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/storage/debounced-uploader.d.ts +62 -0
- package/dist/storage/debounced-uploader.d.ts.map +1 -0
- package/dist/storage/utilization-store.d.ts +108 -0
- package/dist/storage/utilization-store.d.ts.map +1 -0
- package/dist/swarm-id-auth.d.ts +74 -0
- package/dist/swarm-id-auth.d.ts.map +1 -0
- package/dist/swarm-id-auth.js +2 -0
- package/dist/swarm-id-auth.js.map +1 -0
- package/dist/swarm-id-client.d.ts +878 -0
- package/dist/swarm-id-client.d.ts.map +1 -0
- package/dist/swarm-id-client.js +2 -0
- package/dist/swarm-id-client.js.map +1 -0
- package/dist/swarm-id-proxy.d.ts +236 -0
- package/dist/swarm-id-proxy.d.ts.map +1 -0
- package/dist/swarm-id-proxy.js +2 -0
- package/dist/swarm-id-proxy.js.map +1 -0
- package/dist/swarm-id.esm.js +2 -0
- package/dist/swarm-id.esm.js.map +1 -0
- package/dist/swarm-id.umd.js +2 -0
- package/dist/swarm-id.umd.js.map +1 -0
- package/dist/sync/index.d.ts +9 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/key-derivation.d.ts +25 -0
- package/dist/sync/key-derivation.d.ts.map +1 -0
- package/dist/sync/restore-account.d.ts +28 -0
- package/dist/sync/restore-account.d.ts.map +1 -0
- package/dist/sync/serialization.d.ts +16 -0
- package/dist/sync/serialization.d.ts.map +1 -0
- package/dist/sync/store-interfaces.d.ts +53 -0
- package/dist/sync/store-interfaces.d.ts.map +1 -0
- package/dist/sync/sync-account.d.ts +44 -0
- package/dist/sync/sync-account.d.ts.map +1 -0
- package/dist/sync/types.d.ts +13 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/test-fixtures.d.ts +17 -0
- package/dist/test-fixtures.d.ts.map +1 -0
- package/dist/types-BD_VkNn0.js +2 -0
- package/dist/types-BD_VkNn0.js.map +1 -0
- package/dist/types-lJCaT-50.js +2 -0
- package/dist/types-lJCaT-50.js.map +1 -0
- package/dist/types.d.ts +2157 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/account-payload.d.ts +94 -0
- package/dist/utils/account-payload.d.ts.map +1 -0
- package/dist/utils/account-state-snapshot.d.ts +38 -0
- package/dist/utils/account-state-snapshot.d.ts.map +1 -0
- package/dist/utils/backup-encryption.d.ts +127 -0
- package/dist/utils/backup-encryption.d.ts.map +1 -0
- package/dist/utils/batch-utilization.d.ts +432 -0
- package/dist/utils/batch-utilization.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +11 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/hex.d.ts +17 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/key-derivation.d.ts +92 -0
- package/dist/utils/key-derivation.d.ts.map +1 -0
- package/dist/utils/storage-managers.d.ts +65 -0
- package/dist/utils/storage-managers.d.ts.map +1 -0
- package/dist/utils/swarm-id-export.d.ts +24 -0
- package/dist/utils/swarm-id-export.d.ts.map +1 -0
- package/dist/utils/ttl.d.ts +49 -0
- package/dist/utils/ttl.d.ts.map +1 -0
- package/dist/utils/url.d.ts +41 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/versioned-storage.d.ts +131 -0
- package/dist/utils/versioned-storage.d.ts.map +1 -0
- package/package.json +78 -0
- package/src/chunk/bmt.test.ts +217 -0
- package/src/chunk/bmt.ts +57 -0
- package/src/chunk/cac.test.ts +214 -0
- package/src/chunk/cac.ts +65 -0
- package/src/chunk/constants.ts +18 -0
- package/src/chunk/encrypted-cac.test.ts +385 -0
- package/src/chunk/encrypted-cac.ts +131 -0
- package/src/chunk/encryption.test.ts +352 -0
- package/src/chunk/encryption.ts +300 -0
- package/src/chunk/index.ts +47 -0
- package/src/index.ts +430 -0
- package/src/proxy/act/act.test.ts +278 -0
- package/src/proxy/act/act.ts +158 -0
- package/src/proxy/act/bee-compat.test.ts +948 -0
- package/src/proxy/act/crypto.test.ts +436 -0
- package/src/proxy/act/crypto.ts +376 -0
- package/src/proxy/act/grantee-list.test.ts +393 -0
- package/src/proxy/act/grantee-list.ts +239 -0
- package/src/proxy/act/history.test.ts +360 -0
- package/src/proxy/act/history.ts +413 -0
- package/src/proxy/act/index.test.ts +748 -0
- package/src/proxy/act/index.ts +853 -0
- package/src/proxy/chunking-encrypted.ts +95 -0
- package/src/proxy/chunking.ts +65 -0
- package/src/proxy/download-data.ts +448 -0
- package/src/proxy/feed-manifest.ts +174 -0
- package/src/proxy/feeds/epochs/async-finder.ts +372 -0
- package/src/proxy/feeds/epochs/epoch.test.ts +249 -0
- package/src/proxy/feeds/epochs/epoch.ts +181 -0
- package/src/proxy/feeds/epochs/finder.ts +282 -0
- package/src/proxy/feeds/epochs/index.ts +73 -0
- package/src/proxy/feeds/epochs/integration.test.ts +1336 -0
- package/src/proxy/feeds/epochs/test-utils.ts +274 -0
- package/src/proxy/feeds/epochs/types.ts +128 -0
- package/src/proxy/feeds/epochs/updater.ts +192 -0
- package/src/proxy/feeds/epochs/utils.ts +62 -0
- package/src/proxy/feeds/index.ts +5 -0
- package/src/proxy/feeds/sequence/async-finder.ts +31 -0
- package/src/proxy/feeds/sequence/finder.ts +73 -0
- package/src/proxy/feeds/sequence/index.ts +54 -0
- package/src/proxy/feeds/sequence/integration.test.ts +966 -0
- package/src/proxy/feeds/sequence/types.ts +103 -0
- package/src/proxy/feeds/sequence/updater.ts +71 -0
- package/src/proxy/index.ts +5 -0
- package/src/proxy/manifest-builder.test.ts +427 -0
- package/src/proxy/manifest-builder.ts +679 -0
- package/src/proxy/mantaray-encrypted.ts +78 -0
- package/src/proxy/mantaray.ts +104 -0
- package/src/proxy/types.ts +32 -0
- package/src/proxy/upload-data.ts +189 -0
- package/src/proxy/upload-encrypted-data.ts +658 -0
- package/src/schemas.ts +299 -0
- package/src/storage/debounced-uploader.ts +192 -0
- package/src/storage/utilization-store.ts +397 -0
- package/src/swarm-id-client.test.ts +99 -0
- package/src/swarm-id-client.ts +3095 -0
- package/src/swarm-id-proxy.ts +3891 -0
- package/src/sync/index.ts +28 -0
- package/src/sync/restore-account.ts +90 -0
- package/src/sync/serialization.ts +39 -0
- package/src/sync/store-interfaces.ts +62 -0
- package/src/sync/sync-account.test.ts +302 -0
- package/src/sync/sync-account.ts +396 -0
- package/src/sync/types.ts +11 -0
- package/src/test-fixtures.ts +109 -0
- package/src/types.ts +1651 -0
- package/src/utils/account-state-snapshot.test.ts +595 -0
- package/src/utils/account-state-snapshot.ts +94 -0
- package/src/utils/backup-encryption.test.ts +442 -0
- package/src/utils/backup-encryption.ts +352 -0
- package/src/utils/batch-utilization.ts +1309 -0
- package/src/utils/constants.ts +20 -0
- package/src/utils/hex.ts +27 -0
- package/src/utils/key-derivation.ts +197 -0
- package/src/utils/storage-managers.ts +365 -0
- package/src/utils/ttl.ts +129 -0
- package/src/utils/url.test.ts +136 -0
- package/src/utils/url.ts +71 -0
- package/src/utils/versioned-storage.ts +323 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { deriveAccountBackupKey, deriveAccountSwarmEncryptionKey, backupKeyToPrivateKey, } from "../utils/key-derivation";
|
|
2
|
+
export { serializeAccountState, deserializeAccountState } from "./serialization";
|
|
3
|
+
export { createSyncAccount, ACCOUNT_SYNC_TOPIC_PREFIX } from "./sync-account";
|
|
4
|
+
export type { SyncAccountOptions, SyncAccountFunction } from "./sync-account";
|
|
5
|
+
export { restoreAccountFromSwarm } from "./restore-account";
|
|
6
|
+
export type { RestoreAccountResult } from "./restore-account";
|
|
7
|
+
export type { AccountsStoreInterface, IdentitiesStoreInterface, ConnectedAppsStoreInterface, PostageStampsStoreInterface, StamperOptions, FlushableStamper, } from "./store-interfaces";
|
|
8
|
+
export type { SyncResult } from "./types";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,sBAAsB,EACtB,+BAA+B,EAC/B,qBAAqB,GACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAGhF,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAG7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAG7D,YAAY,EACV,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,cAAc,EACd,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PrivateKey } from "@ethersphere/bee-js";
|
|
2
|
+
/**
|
|
3
|
+
* Derive account backup key from account master key
|
|
4
|
+
*
|
|
5
|
+
* Used for signing account feed updates
|
|
6
|
+
*
|
|
7
|
+
* @param accountMasterKey - Account master key (hex string)
|
|
8
|
+
* @param accountId - Account ID (EthAddress hex string)
|
|
9
|
+
* @returns 32-byte account backup key (as hex string)
|
|
10
|
+
*/
|
|
11
|
+
export declare function deriveAccountBackupKey(accountMasterKey: string, accountId: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Derive account Swarm encryption key from account master key
|
|
14
|
+
*
|
|
15
|
+
* Used for encrypting account snapshot data before upload to Swarm
|
|
16
|
+
*
|
|
17
|
+
* @param accountMasterKey - Account master key (hex string)
|
|
18
|
+
* @returns 32-byte encryption key (as hex string)
|
|
19
|
+
*/
|
|
20
|
+
export declare function deriveAccountSwarmEncryptionKey(accountMasterKey: string): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Convert backup key to PrivateKey for feed signing
|
|
23
|
+
*/
|
|
24
|
+
export declare function backupKeyToPrivateKey(backupKeyHex: string): PrivateKey;
|
|
25
|
+
//# sourceMappingURL=key-derivation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-derivation.d.ts","sourceRoot":"","sources":["../../src/sync/key-derivation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;GAOG;AACH,wBAAsB,+BAA+B,CACnD,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAEtE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restore Account from Swarm
|
|
3
|
+
*
|
|
4
|
+
* When a passkey auth succeeds but no local account exists (e.g. new device),
|
|
5
|
+
* this utility derives the keys needed to find and decrypt the account
|
|
6
|
+
* snapshot stored in Swarm and returns the restored state.
|
|
7
|
+
*/
|
|
8
|
+
import { Bee, EthAddress, type Bytes } from "@ethersphere/bee-js";
|
|
9
|
+
import type { AccountStateSnapshot } from "../utils/account-state-snapshot";
|
|
10
|
+
/**
|
|
11
|
+
* Result of a successful account restore from Swarm
|
|
12
|
+
*/
|
|
13
|
+
export interface RestoreAccountResult {
|
|
14
|
+
snapshot: AccountStateSnapshot;
|
|
15
|
+
swarmEncryptionKey: string;
|
|
16
|
+
credentialId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Restore account state from Swarm using passkey authentication result
|
|
20
|
+
*
|
|
21
|
+
* @param bee - Bee client instance
|
|
22
|
+
* @param masterKey - Master key from passkey authentication
|
|
23
|
+
* @param ethereumAddress - Account ID (EthAddress) from passkey authentication
|
|
24
|
+
* @param credentialId - Credential ID from passkey authentication
|
|
25
|
+
* @returns Restored account state, or undefined if no backup found in Swarm
|
|
26
|
+
*/
|
|
27
|
+
export declare function restoreAccountFromSwarm(bee: Bee, masterKey: Bytes, ethereumAddress: EthAddress, credentialId: string): Promise<RestoreAccountResult | undefined>;
|
|
28
|
+
//# sourceMappingURL=restore-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-account.d.ts","sourceRoot":"","sources":["../../src/sync/restore-account.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,GAAG,EAEH,UAAU,EAGV,KAAK,KAAK,EACX,MAAM,qBAAqB,CAAA;AAS5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAE3E;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,KAAK,EAChB,eAAe,EAAE,UAAU,EAC3B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAwC3C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AccountStateSnapshot } from "../utils/account-state-snapshot";
|
|
2
|
+
/**
|
|
3
|
+
* Serialize account state to JSON bytes
|
|
4
|
+
*
|
|
5
|
+
* @param state - Account payload to serialize
|
|
6
|
+
* @returns JSON encoded as Uint8Array
|
|
7
|
+
*/
|
|
8
|
+
export declare function serializeAccountState(state: AccountStateSnapshot): Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* Deserialize JSON bytes to account payload
|
|
11
|
+
*
|
|
12
|
+
* @param data - JSON bytes to deserialize
|
|
13
|
+
* @returns Account payload
|
|
14
|
+
*/
|
|
15
|
+
export declare function deserializeAccountState(data: Uint8Array): AccountStateSnapshot;
|
|
16
|
+
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/sync/serialization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAE3E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,UAAU,CAI7E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,UAAU,GACf,oBAAoB,CAYtB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store Interfaces for Sync Coordinator
|
|
3
|
+
*
|
|
4
|
+
* These interfaces define the minimal contract that stores must implement
|
|
5
|
+
* to be used with the sync coordinator. This allows the coordinator to be
|
|
6
|
+
* used with different store implementations (Svelte stores, plain objects, etc.)
|
|
7
|
+
*/
|
|
8
|
+
import type { EthAddress, BatchId, Stamper } from "@ethersphere/bee-js";
|
|
9
|
+
import type { Account, Identity, ConnectedApp, PostageStamp } from "../schemas";
|
|
10
|
+
/**
|
|
11
|
+
* Options for creating a stamper with utilization tracking
|
|
12
|
+
*/
|
|
13
|
+
export interface StamperOptions {
|
|
14
|
+
owner: EthAddress;
|
|
15
|
+
encryptionKey: Uint8Array;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extended stamper interface with optional flush capability
|
|
19
|
+
*
|
|
20
|
+
* Some stampers (like UtilizationAwareStamper) support flushing
|
|
21
|
+
* dirty bucket state to cache.
|
|
22
|
+
*/
|
|
23
|
+
export interface FlushableStamper extends Stamper {
|
|
24
|
+
flush?(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Interface for accessing account data
|
|
28
|
+
*/
|
|
29
|
+
export interface AccountsStoreInterface {
|
|
30
|
+
getAccount(id: EthAddress): Account | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interface for accessing identity data
|
|
34
|
+
*/
|
|
35
|
+
export interface IdentitiesStoreInterface {
|
|
36
|
+
getIdentitiesByAccount(accountId: EthAddress): Identity[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Interface for accessing connected app data
|
|
40
|
+
*/
|
|
41
|
+
export interface ConnectedAppsStoreInterface {
|
|
42
|
+
getAppsByIdentityId(identityId: string): ConnectedApp[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Interface for accessing and managing postage stamp data
|
|
46
|
+
*/
|
|
47
|
+
export interface PostageStampsStoreInterface {
|
|
48
|
+
getStamp(batchID: BatchId): PostageStamp | undefined;
|
|
49
|
+
getStampsByAccount(accountId: string): PostageStamp[];
|
|
50
|
+
getStamper(batchID: BatchId, options?: StamperOptions): Promise<FlushableStamper | undefined>;
|
|
51
|
+
updateStampUtilization(batchID: BatchId, utilization: number): void;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=store-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-interfaces.d.ts","sourceRoot":"","sources":["../../src/sync/store-interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE/E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,UAAU,CAAA;IACjB,aAAa,EAAE,UAAU,CAAA;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS,CAAA;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,sBAAsB,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,EAAE,CAAA;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,EAAE,CAAA;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAAA;IACpD,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE,CAAA;IACrD,UAAU,CACR,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAA;IACxC,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CACpE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Account
|
|
3
|
+
*
|
|
4
|
+
* Factory function that creates a sync function for syncing account state
|
|
5
|
+
* to Swarm. This integrates store access, key derivation, and utilization
|
|
6
|
+
* tracking.
|
|
7
|
+
*/
|
|
8
|
+
import { Bee } from "@ethersphere/bee-js";
|
|
9
|
+
import type { UtilizationStoreDB } from "../storage/utilization-store";
|
|
10
|
+
import type { DebouncedUtilizationUploader } from "../storage/debounced-uploader";
|
|
11
|
+
import type { AccountsStoreInterface, IdentitiesStoreInterface, ConnectedAppsStoreInterface, PostageStampsStoreInterface } from "./store-interfaces";
|
|
12
|
+
import type { SyncResult } from "./types";
|
|
13
|
+
export declare const ACCOUNT_SYNC_TOPIC_PREFIX = "swarm-id-backup-v1:account";
|
|
14
|
+
/**
|
|
15
|
+
* Options for creating a sync account function
|
|
16
|
+
*/
|
|
17
|
+
export interface SyncAccountOptions {
|
|
18
|
+
/** Bee client for Swarm operations */
|
|
19
|
+
bee: Bee;
|
|
20
|
+
/** Store providing account data */
|
|
21
|
+
accountsStore: AccountsStoreInterface;
|
|
22
|
+
/** Store providing identity data */
|
|
23
|
+
identitiesStore: IdentitiesStoreInterface;
|
|
24
|
+
/** Store providing connected app data */
|
|
25
|
+
connectedAppsStore: ConnectedAppsStoreInterface;
|
|
26
|
+
/** Store providing postage stamp data */
|
|
27
|
+
postageStampsStore: PostageStampsStoreInterface;
|
|
28
|
+
/** Utilization store for browser-based utilization tracking */
|
|
29
|
+
utilizationStore: UtilizationStoreDB;
|
|
30
|
+
/** Debounced uploader for batch utilization state */
|
|
31
|
+
utilizationUploader: DebouncedUtilizationUploader;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sync account function type
|
|
35
|
+
*/
|
|
36
|
+
export type SyncAccountFunction = (accountId: string) => Promise<SyncResult | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a sync account function with dependency-injected stores
|
|
39
|
+
*
|
|
40
|
+
* @param options - Configuration options including stores and optional utilization tracking
|
|
41
|
+
* @returns Function that syncs an account to Swarm
|
|
42
|
+
*/
|
|
43
|
+
export declare function createSyncAccount(options: SyncAccountOptions): SyncAccountFunction;
|
|
44
|
+
//# sourceMappingURL=sync-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-account.d.ts","sourceRoot":"","sources":["../../src/sync/sync-account.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,GAAG,EAOJ,MAAM,qBAAqB,CAAA;AAO5B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AACjF,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,oBAAoB,CAAA;AAI3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAQzC,eAAO,MAAM,yBAAyB,+BAA+B,CAAA;AAErE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,GAAG,EAAE,GAAG,CAAA;IAER,mCAAmC;IACnC,aAAa,EAAE,sBAAsB,CAAA;IAErC,oCAAoC;IACpC,eAAe,EAAE,wBAAwB,CAAA;IAEzC,yCAAyC;IACzC,kBAAkB,EAAE,2BAA2B,CAAA;IAE/C,yCAAyC;IACzC,kBAAkB,EAAE,2BAA2B,CAAA;IAE/C,+DAA+D;IAC/D,gBAAgB,EAAE,kBAAkB,CAAA;IAEpC,qDAAqD;IACrD,mBAAmB,EAAE,4BAA4B,CAAA;CAClD;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;AAwBpC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,mBAAmB,CAgSrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sync/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,MAAM,EAAE,SAAS,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,UAAU,EAAE,CAAA;CAC7B,GACD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PasskeyAccount, EthereumAccount, AgentAccount, Identity, ConnectedApp, PostageStamp } from "./schemas";
|
|
2
|
+
export declare const TEST_ETH_ADDRESS_HEX: string;
|
|
3
|
+
export declare const TEST_ETH_ADDRESS_2_HEX: string;
|
|
4
|
+
export declare const TEST_IDENTITY_ADDRESS_HEX: string;
|
|
5
|
+
export declare const TEST_IDENTITY_ADDRESS_2_HEX: string;
|
|
6
|
+
export declare const TEST_BATCH_ID_HEX: string;
|
|
7
|
+
export declare const TEST_BATCH_ID_2_HEX: string;
|
|
8
|
+
export declare const TEST_PRIVATE_KEY_HEX: string;
|
|
9
|
+
export declare const TEST_ENCRYPTION_KEY_HEX: string;
|
|
10
|
+
export declare const DIFFERENT_ENCRYPTION_KEY_HEX: string;
|
|
11
|
+
export declare function createPasskeyAccount(overrides?: Partial<PasskeyAccount>): PasskeyAccount;
|
|
12
|
+
export declare function createEthereumAccount(overrides?: Partial<EthereumAccount>): EthereumAccount;
|
|
13
|
+
export declare function createAgentAccount(overrides?: Partial<AgentAccount>): AgentAccount;
|
|
14
|
+
export declare function createIdentity(overrides?: Partial<Identity>): Identity;
|
|
15
|
+
export declare function createConnectedApp(overrides?: Partial<ConnectedApp>): ConnectedApp;
|
|
16
|
+
export declare function createPostageStamp(overrides?: Partial<PostageStamp>): PostageStamp;
|
|
17
|
+
//# sourceMappingURL=test-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../src/test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACb,MAAM,WAAW,CAAA;AAElB,eAAO,MAAM,oBAAoB,QAAiB,CAAA;AAClD,eAAO,MAAM,sBAAsB,QAAiB,CAAA;AACpD,eAAO,MAAM,yBAAyB,QAAiB,CAAA;AACvD,eAAO,MAAM,2BAA2B,QAAiB,CAAA;AACzD,eAAO,MAAM,iBAAiB,QAAiB,CAAA;AAC/C,eAAO,MAAM,mBAAmB,QAAiB,CAAA;AACjD,eAAO,MAAM,oBAAoB,QAAiB,CAAA;AAClD,eAAO,MAAM,uBAAuB,QAAiB,CAAA;AACrD,eAAO,MAAM,4BAA4B,QAAiB,CAAA;AAE1D,wBAAgB,oBAAoB,CAClC,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAClC,cAAc,CAUhB;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GACnC,eAAe,CAajB;AAED,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,YAAY,CASd;AAED,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAQtE;AAED,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,YAAY,CASd;AAED,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,YAAY,CAgBd"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t,n){function o(n,o){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=o}const i=n?.Parent??Object;class r extends i{}function s(e){var t;const i=n?.Parent?new r:this;o(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const e of i._zod.deferred)e();return i}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class t extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class n extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const o={};function i(e){return o}function r(e,t){return"bigint"==typeof t?t.toString():t}function s(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function a(e){return null==e}function u(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const c=Symbol("evaluating");function d(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==c)return void 0===o&&(o=c,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function p(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function l(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function f(e){return JSON.stringify(e)}const h="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const v=s(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function _(e){if(!1===m(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==m(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function g(e){return _(e)?{...e}:Array.isArray(e)?[...e]:e}const y=new Set(["string","number","symbol"]);function z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function b(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const k={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function $(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Z(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return"string"==typeof e?e:e?.message}function x(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const i=I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??"Invalid input";o.message=i}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function E(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function A(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const P=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,r,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},T=e("$ZodError",P),O=e("$ZodError",P,{Parent:Error});const N=e=>(n,o,r,s)=>{const a=r?Object.assign(r,{async:!1}):{async:!1},u=n._zod.run({value:o,issues:[]},a);if(u instanceof Promise)throw new t;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map(e=>x(e,a,i())));throw h(t,s?.callee),t}return u.value},j=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(r?.Err??e)(a.issues.map(e=>x(e,s,i())));throw h(t,r?.callee),t}return a.value},S=e=>(n,o,r)=>{const s=r?{...r,async:!1}:{async:!1},a=n._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new t;return a.issues.length?{success:!1,error:new(e??T)(a.issues.map(e=>x(e,s,i())))}:{success:!0,data:a.value}},F=S(O),U=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>x(e,r,i())))}:{success:!0,data:s.value}},C=U(O),D=e=>(t,n,o)=>{const i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return N(e)(t,n,i)},R=e=>(t,n,o)=>N(e)(t,n,o),M=e=>async(t,n,o)=>{const i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return j(e)(t,n,i)},V=e=>async(t,n,o)=>j(e)(t,n,o),L=e=>(t,n,o)=>{const i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return S(e)(t,n,i)},q=e=>(t,n,o)=>S(e)(t,n,o),W=e=>async(t,n,o)=>{const i=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return U(e)(t,n,i)},B=e=>async(t,n,o)=>U(e)(t,n,o),G=/^[cC][^\s-]{8,}$/,J=/^[0-9a-z]+$/,K=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Y=/^[0-9a-vA-V]{20}$/,X=/^[A-Za-z0-9]{27}$/,H=/^[a-zA-Z0-9_-]{21}$/,Q=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,te=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ne=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const oe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ie=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,re=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,se=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ae=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ue=/^[A-Za-z0-9_-]*$/,ce=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,de=/^\+(?:[0-9]){6,14}[0-9]$/,pe="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",le=new RegExp(`^${pe}$`);function fe(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const he=/^-?\d+$/,me=/^-?\d+(?:\.\d+)?/,ve=/^(?:true|false)$/i,_e=/^[^A-Z]*$/,ge=/^[^a-z]*$/,ye=e("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ze={number:"number",bigint:"bigint",object:"date"},we=e("$ZodCheckLessThan",(e,t)=>{ye.init(e,t);const n=ze[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),be=e("$ZodCheckGreaterThan",(e,t)=>{ye.init(e,t);const n=ze[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ke=e("$ZodCheckMultipleOf",(e,t)=>{ye.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let i=(o.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}const r=n>i?n:i;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),$e=e("$ZodCheckNumberFormat",(e,t)=>{ye.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[i,r]=k[t.format];e._zod.onattach.push(e=>{const o=e._zod.bag;o.format=t.format,o.minimum=i,o.maximum=r,n&&(o.pattern=he)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}))}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>r&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}}),Ze=e("$ZodCheckMaxLength",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!a(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=E(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ie=e("$ZodCheckMinLength",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!a(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=E(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xe=e("$ZodCheckLengthEquals",(e,t)=>{var n;ye.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!a(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const r=E(o),s=i>t.length;n.issues.push({origin:r,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ee=e("$ZodCheckStringFormat",(e,t)=>{var n,o;ye.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Ae=e("$ZodCheckRegex",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pe=e("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=_e),Ee.init(e,t)}),Te=e("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ge),Ee.init(e,t)}),Oe=e("$ZodCheckIncludes",(e,t)=>{ye.init(e,t);const n=z(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ne=e("$ZodCheckStartsWith",(e,t)=>{ye.init(e,t);const n=new RegExp(`^${z(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),je=e("$ZodCheckEndsWith",(e,t)=>{ye.init(e,t);const n=new RegExp(`.*${z(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Se=e("$ZodCheckOverwrite",(e,t)=>{ye.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Fe{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),o=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Ue={major:4,minor:1,patch:12},Ce=e("$ZodType",(e,n)=>{var o;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Ue;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const n=(e,n,o)=>{let i,r=$(e);for(const s of n){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(r)continue;const n=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===o?.async)throw new t;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a;e.issues.length!==n&&(r||(r=$(e,n)))});else{if(e.issues.length===n)continue;r||(r=$(e,n))}}return i?i.then(()=>e):e},o=(o,r,s)=>{if($(o))return o.aborted=!0,o;const a=n(r,i,s);if(a instanceof Promise){if(!1===s.async)throw new t;return a.then(t=>e._zod.parse(t,s))}return e._zod.parse(a,s)};e._zod.run=(r,s)=>{if(s.skipChecks)return e._zod.parse(r,s);if("backward"===s.direction){const t=e._zod.parse({value:r.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>o(e,r,s)):o(t,r,s)}const a=e._zod.parse(r,s);if(a instanceof Promise){if(!1===s.async)throw new t;return a.then(e=>n(e,i,s))}return n(a,i,s)}}e["~standard"]={validate:t=>{try{const n=F(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return C(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),De=e("$ZodString",(e,t)=>{var n;Ce.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Re=e("$ZodStringFormat",(e,t)=>{Ee.init(e,t),De.init(e,t)}),Me=e("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ee),Re.init(e,t)}),Ve=e("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=te(e))}else t.pattern??(t.pattern=te());Re.init(e,t)}),Le=e("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ne),Re.init(e,t)}),qe=e("$ZodURL",(e,t)=>{Re.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),i=new URL(o);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ce.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=i.href:n.value=o)}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),We=e("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Re.init(e,t)}),Be=e("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=H),Re.init(e,t)}),Ge=e("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=G),Re.init(e,t)}),Je=e("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=J),Re.init(e,t)}),Ke=e("$ZodULID",(e,t)=>{t.pattern??(t.pattern=K),Re.init(e,t)}),Ye=e("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Y),Re.init(e,t)}),Xe=e("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=X),Re.init(e,t)}),He=e("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=fe({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${pe}T(?:${o})$`)}(t)),Re.init(e,t)}),Qe=e("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=le),Re.init(e,t)}),et=e("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${fe(t)}$`)),Re.init(e,t)}),tt=e("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Q),Re.init(e,t)}),nt=e("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=oe),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),ot=e("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ie),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),it=e("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=re),Re.init(e,t)}),rt=e("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=se),Re.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(2!==o.length)throw new Error;const[e,t]=o;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function st(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const at=e("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ae),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{st(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const ut=e("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ue),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{(function(e){if(!ue.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return st(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ct=e("$ZodE164",(e,t)=>{t.pattern??(t.pattern=de),Re.init(e,t)});const dt=e("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n;if(!o)return!1;const i=JSON.parse(atob(o));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),pt=e("$ZodNumber",(e,t)=>{Ce.init(e,t),e._zod.pattern=e._zod.bag.pattern??me,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const r="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...r?{received:r}:{}}),n}}),lt=e("$ZodNumber",(e,t)=>{$e.init(e,t),pt.init(e,t)}),ft=e("$ZodBoolean",(e,t)=>{Ce.init(e,t),e._zod.pattern=ve,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),ht=e("$ZodUnknown",(e,t)=>{Ce.init(e,t),e._zod.parse=e=>e}),mt=e("$ZodNever",(e,t)=>{Ce.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function vt(e,t,n){e.issues.length&&t.issues.push(...Z(n,e.issues)),t.value[n]=e.value}const _t=e("$ZodArray",(e,t)=>{Ce.init(e,t),e._zod.parse=(n,o)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const r=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},o);a instanceof Promise?r.push(a.then(t=>vt(t,n,e))):vt(a,n,e)}return r.length?Promise.all(r).then(()=>n):n}});function gt(e,t,n,o){e.issues.length&&t.issues.push(...Z(n,e.issues)),void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function yt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=e.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function zt(e,t,n,o,i,r){const s=[],a=i.keySet,u=i.catchall._zod,c=u.def.type;for(const i of Object.keys(t)){if(a.has(i))continue;if("never"===c){s.push(i);continue}const r=u.run({value:t[i],issues:[]},o);r instanceof Promise?e.push(r.then(e=>gt(e,n,i,t))):gt(r,n,i,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:r}),e.length?Promise.all(e).then(()=>n):n}const wt=e("$ZodObject",(e,t)=>{Ce.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const o=s(()=>yt(t));d(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n});const i=m,r=t.catchall;let a;e._zod.parse=(t,n)=>{a??(a=o.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const u=[],c=a.shape;for(const e of a.keys){const o=c[e]._zod.run({value:s[e],issues:[]},n);o instanceof Promise?u.push(o.then(n=>gt(n,t,e,s))):gt(o,t,e,s)}return r?zt(u,s,t,n,o.value,e):u.length?Promise.all(u).then(()=>t):t}}),bt=e("$ZodObjectJIT",(e,t)=>{wt.init(e,t);const n=e._zod.parse,i=s(()=>yt(t));let r;const a=m,u=!o.jitless,c=u&&v.value,d=t.catchall;let p;e._zod.parse=(o,s)=>{p??(p=i.value);const l=o.value;return a(l)?u&&c&&!1===s?.async&&!0!==s.jitless?(r||(r=(e=>{const t=new Fe(["shape","payload","ctx"]),n=i.value,o=e=>{const t=f(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let s=0;for(const e of n.keys)r[e]="key_"+s++;t.write("const newResult = {};");for(const e of n.keys){const n=r[e],i=f(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),o=r(o,s),d?zt([],l,o,s,p,e):o):n(o,s):(o.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),o)}});function kt(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter(e=>!$(e));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>x(e,o,i())))}),t)}const $t=e("$ZodUnion",(e,t)=>{Ce.init(e,t),d(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),d(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),d(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>u(e.source)).join("|")})$`)}});const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(i,r)=>{if(n)return o(i,r);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:i.value,issues:[]},r);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>kt(t,i,e,r)):kt(a,i,e,r)}}),Zt=e("$ZodDiscriminatedUnion",(e,t)=>{$t.init(e,t);const n=e._zod.parse;d(e._zod,"propValues",()=>{const e={};for(const n of t.options){const o=n._zod.propValues;if(!o||0===Object.keys(o).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(o)){e[t]||(e[t]=new Set);for(const o of n)e[t].add(o)}}return e});const o=s(()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n});e._zod.parse=(i,r)=>{const s=i.value;if(!m(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=o.value.get(s?.[t.discriminator]);return a?a._zod.run(i,r):t.unionFallback?n(i,r):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),i)}}),It=e("$ZodIntersection",(e,t)=>{Ce.init(e,t),e._zod.parse=(e,n)=>{const o=e.value,i=t.left._zod.run({value:o,issues:[]},n),r=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||r instanceof Promise?Promise.all([i,r]).then(([t,n])=>Et(e,t,n)):Et(e,i,r)}});function xt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(_(e)&&_(t)){const n=Object.keys(t),o=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const n of o){const o=xt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};i[n]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const i=xt(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Et(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),$(e))return e;const o=xt(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const At=e("$ZodEnum",(e,t)=>{Ce.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(e=>y.has(typeof e)).map(e=>"string"==typeof e?z(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const r=t.value;return o.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}}),Pt=e("$ZodLiteral",(e,t)=>{if(Ce.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?z(e):e?z(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Tt=e("$ZodTransform",(e,o)=>{Ce.init(e,o),e._zod.parse=(i,r)=>{if("backward"===r.direction)throw new n(e.constructor.name);const s=o.transform(i.value,i);if(r.async){return(s instanceof Promise?s:Promise.resolve(s)).then(e=>(i.value=e,i))}if(s instanceof Promise)throw new t;return i.value=s,i}});function Ot(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Nt=e("$ZodOptional",(e,t)=>{Ce.init(e,t),e._zod.optin="optional",e._zod.optout="optional",d(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${u(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(t=>Ot(t,e.value)):Ot(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),jt=e("$ZodNullable",(e,t)=>{Ce.init(e,t),d(e._zod,"optin",()=>t.innerType._zod.optin),d(e._zod,"optout",()=>t.innerType._zod.optout),d(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${u(e.source)}|null)$`):void 0}),d(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),St=e("$ZodDefault",(e,t)=>{Ce.init(e,t),e._zod.optin="optional",d(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(e=>Ft(e,t)):Ft(o,t)}});function Ft(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Ut=e("$ZodPrefault",(e,t)=>{Ce.init(e,t),e._zod.optin="optional",d(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ct=e("$ZodNonOptional",(e,t)=>{Ce.init(e,t),d(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,o)=>{const i=t.innerType._zod.run(n,o);return i instanceof Promise?i.then(t=>Dt(t,e)):Dt(i,e)}});function Dt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rt=e("$ZodCatch",(e,t)=>{Ce.init(e,t),d(e._zod,"optin",()=>t.innerType._zod.optin),d(e._zod,"optout",()=>t.innerType._zod.optout),d(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>x(e,n,i()))},input:e.value}),e.issues=[]),e)):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>x(e,n,i()))},input:e.value}),e.issues=[]),e)}}),Mt=e("$ZodPipe",(e,t)=>{Ce.init(e,t),d(e._zod,"values",()=>t.in._zod.values),d(e._zod,"optin",()=>t.in._zod.optin),d(e._zod,"optout",()=>t.out._zod.optout),d(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const o=t.out._zod.run(e,n);return o instanceof Promise?o.then(e=>Vt(e,t.in,n)):Vt(o,t.in,n)}const o=t.in._zod.run(e,n);return o instanceof Promise?o.then(e=>Vt(e,t.out,n)):Vt(o,t.out,n)}});function Vt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Lt=e("$ZodReadonly",(e,t)=>{Ce.init(e,t),d(e._zod,"propValues",()=>t.innerType._zod.propValues),d(e._zod,"values",()=>t.innerType._zod.values),d(e._zod,"optin",()=>t.innerType._zod.optin),d(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(qt):qt(o)}});function qt(e){return e.value=Object.freeze(e.value),e}const Wt=e("$ZodCustom",(e,t)=>{ye.init(e,t),Ce.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,i=t.fn(o);if(i instanceof Promise)return i.then(t=>Bt(t,n,o,e));Bt(i,n,o,e)}});function Bt(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push(A(e))}}class Gt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Jt(){return new Gt}const Kt=Jt();function Yt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(t)})}function Xt(e,t){return new we({check:"less_than",...b(t),value:e,inclusive:!1})}function Ht(e,t){return new we({check:"less_than",...b(t),value:e,inclusive:!0})}function Qt(e,t){return new be({check:"greater_than",...b(t),value:e,inclusive:!1})}function en(e,t){return new be({check:"greater_than",...b(t),value:e,inclusive:!0})}function tn(e,t){return new ke({check:"multiple_of",...b(t),value:e})}function nn(e,t){return new Ze({check:"max_length",...b(t),maximum:e})}function on(e,t){return new Ie({check:"min_length",...b(t),minimum:e})}function rn(e,t){return new xe({check:"length_equals",...b(t),length:e})}function sn(e){return new Se({check:"overwrite",tx:e})}function an(e){const t=function(e,t){const n=new ye({check:"custom",...b(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(A(e,n.value,t._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(A(o))}},e(n.value,n)));return t}const un=e("ZodISODateTime",(e,t)=>{He.init(e,t),Nn.init(e,t)});function cn(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}(un,e)}const dn=e("ZodISODate",(e,t)=>{Qe.init(e,t),Nn.init(e,t)});function pn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}(dn,e)}const ln=e("ZodISOTime",(e,t)=>{et.init(e,t),Nn.init(e,t)});function fn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}(ln,e)}const hn=e("ZodISODuration",(e,t)=>{tt.init(e,t),Nn.init(e,t)});function mn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}(hn,e)}const vn=e("ZodError",(e,t)=>{T.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},o=e=>{for(const i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>o({issues:e}));else if("invalid_key"===i.code)o({issues:i.issues});else if("invalid_element"===i.code)o({issues:i.issues});else if(0===i.path.length)n._errors.push(t(i));else{let e=n,o=0;for(;o<i.path.length;){const n=i.path[o];o===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],o++}}};return o(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},o=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):o.push(t(i));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,r,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,r,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),_n=N(vn),gn=j(vn),yn=S(vn),zn=U(vn),wn=D(vn),bn=R(vn),kn=M(vn),$n=V(vn),Zn=L(vn),In=q(vn),xn=W(vn),En=B(vn),An=e("ZodType",(e,t)=>(Ce.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(l(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,n)=>w(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>_n(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>yn(e,t,n),e.parseAsync=async(t,n)=>gn(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>zn(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>wn(e,t,n),e.decode=(t,n)=>bn(e,t,n),e.encodeAsync=async(t,n)=>kn(e,t,n),e.decodeAsync=async(t,n)=>$n(e,t,n),e.safeEncode=(t,n)=>Zn(e,t,n),e.safeDecode=(t,n)=>In(e,t,n),e.safeEncodeAsync=async(t,n)=>xn(e,t,n),e.safeDecodeAsync=async(t,n)=>En(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...b(n)})}(jo,e,t)}(t,n)),e.superRefine=t=>e.check(an(t)),e.overwrite=t=>e.check(sn(t)),e.optional=()=>$o(e),e.nullable=()=>Io(e),e.nullish=()=>$o(Io(e)),e.nonoptional=t=>function(e,t){return new Ao({type:"nonoptional",innerType:e,...b(t)})}(e,t),e.array=()=>{return function(e,t,n){return new e({type:"array",element:t,...b(n)})}(co,e,t);var t},e.or=t=>ho([e,t]),e.and=t=>new _o({type:"intersection",left:e,right:t}),e.transform=t=>Oo(e,new bo({type:"transform",transform:t})),e.default=t=>{return n=t,new xo({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():g(n)}});var n},e.prefault=t=>{return n=t,new Eo({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():g(n)}});var n},e.catch=t=>{return new Po({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Oo(e,t),e.readonly=()=>new No({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Kt.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Kt.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Kt.get(e);const n=e.clone();return Kt.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Pn=e("_ZodString",(e,t)=>{De.init(e,t),An.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Ae({check:"string_format",format:"regex",...b(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Oe({check:"string_format",format:"includes",...b(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ne({check:"string_format",format:"starts_with",...b(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new je({check:"string_format",format:"ends_with",...b(t),suffix:e})}(...t)),e.min=(...t)=>e.check(on(...t)),e.max=(...t)=>e.check(nn(...t)),e.length=(...t)=>e.check(rn(...t)),e.nonempty=(...t)=>e.check(on(1,...t)),e.lowercase=t=>e.check(function(e){return new Pe({check:"string_format",format:"lowercase",...b(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Te({check:"string_format",format:"uppercase",...b(e)})}(t)),e.trim=()=>e.check(sn(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return sn(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(sn(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(sn(e=>e.toUpperCase()))}),Tn=e("ZodString",(e,t)=>{De.init(e,t),Pn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}(jn,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}(Un,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(t)})}(Hn,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(t)})}(Cn,t)),e.guid=t=>e.check(Yt(Sn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}(Fn,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(t)})}(Fn,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(t)})}(Fn,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(t)})}(Fn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(t)})}(Dn,t)),e.guid=t=>e.check(Yt(Sn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(t)})}(Rn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(t)})}(Mn,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(t)})}(Vn,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(t)})}(Kn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(t)})}(Yn,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(t)})}(Ln,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(t)})}(qn,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}(Wn,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}(Bn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(t)})}(Gn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(t)})}(Jn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(t)})}(Xn,t)),e.datetime=t=>e.check(cn(t)),e.date=t=>e.check(pn(t)),e.time=t=>e.check(fn(t)),e.duration=t=>e.check(mn(t))});function On(e){return function(e,t){return new e({type:"string",...b(t)})}(Tn,e)}const Nn=e("ZodStringFormat",(e,t)=>{Re.init(e,t),Pn.init(e,t)}),jn=e("ZodEmail",(e,t)=>{Le.init(e,t),Nn.init(e,t)}),Sn=e("ZodGUID",(e,t)=>{Me.init(e,t),Nn.init(e,t)}),Fn=e("ZodUUID",(e,t)=>{Ve.init(e,t),Nn.init(e,t)}),Un=e("ZodURL",(e,t)=>{qe.init(e,t),Nn.init(e,t)}),Cn=e("ZodEmoji",(e,t)=>{We.init(e,t),Nn.init(e,t)}),Dn=e("ZodNanoID",(e,t)=>{Be.init(e,t),Nn.init(e,t)}),Rn=e("ZodCUID",(e,t)=>{Ge.init(e,t),Nn.init(e,t)}),Mn=e("ZodCUID2",(e,t)=>{Je.init(e,t),Nn.init(e,t)}),Vn=e("ZodULID",(e,t)=>{Ke.init(e,t),Nn.init(e,t)}),Ln=e("ZodXID",(e,t)=>{Ye.init(e,t),Nn.init(e,t)}),qn=e("ZodKSUID",(e,t)=>{Xe.init(e,t),Nn.init(e,t)}),Wn=e("ZodIPv4",(e,t)=>{nt.init(e,t),Nn.init(e,t)}),Bn=e("ZodIPv6",(e,t)=>{ot.init(e,t),Nn.init(e,t)}),Gn=e("ZodCIDRv4",(e,t)=>{it.init(e,t),Nn.init(e,t)}),Jn=e("ZodCIDRv6",(e,t)=>{rt.init(e,t),Nn.init(e,t)}),Kn=e("ZodBase64",(e,t)=>{at.init(e,t),Nn.init(e,t)}),Yn=e("ZodBase64URL",(e,t)=>{ut.init(e,t),Nn.init(e,t)}),Xn=e("ZodE164",(e,t)=>{ct.init(e,t),Nn.init(e,t)}),Hn=e("ZodJWT",(e,t)=>{dt.init(e,t),Nn.init(e,t)}),Qn=e("ZodNumber",(e,t)=>{pt.init(e,t),An.init(e,t),e.gt=(t,n)=>e.check(Qt(t,n)),e.gte=(t,n)=>e.check(en(t,n)),e.min=(t,n)=>e.check(en(t,n)),e.lt=(t,n)=>e.check(Xt(t,n)),e.lte=(t,n)=>e.check(Ht(t,n)),e.max=(t,n)=>e.check(Ht(t,n)),e.int=t=>e.check(no(t)),e.safe=t=>e.check(no(t)),e.positive=t=>e.check(Qt(0,t)),e.nonnegative=t=>e.check(en(0,t)),e.negative=t=>e.check(Xt(0,t)),e.nonpositive=t=>e.check(Ht(0,t)),e.multipleOf=(t,n)=>e.check(tn(t,n)),e.step=(t,n)=>e.check(tn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function eo(e){return function(e,t){return new e({type:"number",checks:[],...b(t)})}(Qn,e)}const to=e("ZodNumberFormat",(e,t)=>{lt.init(e,t),Qn.init(e,t)});function no(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(t)})}(to,e)}const oo=e("ZodBoolean",(e,t)=>{ft.init(e,t),An.init(e,t)});function io(e){return function(e,t){return new e({type:"boolean",...b(t)})}(oo,e)}const ro=e("ZodUnknown",(e,t)=>{ht.init(e,t),An.init(e,t)});function so(){return new ro({type:"unknown"})}const ao=e("ZodNever",(e,t)=>{mt.init(e,t),An.init(e,t)});function uo(e){return function(e,t){return new e({type:"never",...b(t)})}(ao,e)}const co=e("ZodArray",(e,t)=>{_t.init(e,t),An.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(on(t,n)),e.nonempty=t=>e.check(on(1,t)),e.max=(t,n)=>e.check(nn(t,n)),e.length=(t,n)=>e.check(rn(t,n)),e.unwrap=()=>e.element});const po=e("ZodObject",(e,t)=>{bt.init(e,t),An.init(e,t),d(e,"shape",()=>t.shape),e.keyof=()=>yo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:so()}),e.loose=()=>e.clone({...e._zod.def,catchall:so()}),e.strict=()=>e.clone({...e._zod.def,catchall:uo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!_(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=l(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return p(this,"shape",n),n},checks:[]});return w(e,o)}(e,t),e.safeExtend=t=>function(e,t){if(!_(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return p(this,"shape",n),n},checks:e._zod.def.checks};return w(e,n)}(e,t),e.merge=t=>function(e,t){const n=l(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return p(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return w(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return w(e,l(e._zod.def,{get shape(){const e={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=n.shape[o])}return p(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,o=l(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return p(this,"shape",o),o},checks:[]});return w(e,o)}(e,t),e.partial=(...t)=>function(e,t,n){const o=l(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)i[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return p(this,"shape",i),i},checks:[]});return w(t,o)}(ko,e,t[0]),e.required=(...t)=>function(e,t,n){const o=l(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)i[t]=new e({type:"nonoptional",innerType:o[t]});return p(this,"shape",i),i},checks:[]});return w(t,o)}(Ao,e,t[0])});function lo(e,t){const n={type:"object",shape:e??{},...b(t)};return new po(n)}const fo=e("ZodUnion",(e,t)=>{$t.init(e,t),An.init(e,t),e.options=t.options});function ho(e,t){return new fo({type:"union",options:e,...b(t)})}const mo=e("ZodDiscriminatedUnion",(e,t)=>{fo.init(e,t),Zt.init(e,t)});function vo(e,t,n){return new mo({type:"union",options:t,discriminator:e,...b(n)})}const _o=e("ZodIntersection",(e,t)=>{It.init(e,t),An.init(e,t)});const go=e("ZodEnum",(e,t)=>{At.init(e,t),An.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new go({...t,checks:[],...b(o),entries:i})},e.exclude=(e,o)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new go({...t,checks:[],...b(o),entries:i})}});function yo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new go({type:"enum",entries:n,...b(t)})}const zo=e("ZodLiteral",(e,t)=>{Pt.init(e,t),An.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function wo(e,t){return new zo({type:"literal",values:Array.isArray(e)?e:[e],...b(t)})}const bo=e("ZodTransform",(e,t)=>{Tt.init(e,t),An.init(e,t),e._zod.parse=(o,i)=>{if("backward"===i.direction)throw new n(e.constructor.name);o.addIssue=n=>{if("string"==typeof n)o.issues.push(A(n,o.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=o.value),t.inst??(t.inst=e),o.issues.push(A(t))}};const r=t.transform(o.value,o);return r instanceof Promise?r.then(e=>(o.value=e,o)):(o.value=r,o)}});const ko=e("ZodOptional",(e,t)=>{Nt.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new ko({type:"optional",innerType:e})}const Zo=e("ZodNullable",(e,t)=>{jt.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Io(e){return new Zo({type:"nullable",innerType:e})}const xo=e("ZodDefault",(e,t)=>{St.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Eo=e("ZodPrefault",(e,t)=>{Ut.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Ao=e("ZodNonOptional",(e,t)=>{Ct.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Po=e("ZodCatch",(e,t)=>{Rt.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const To=e("ZodPipe",(e,t)=>{Mt.init(e,t),An.init(e,t),e.in=t.in,e.out=t.out});function Oo(e,t){return new To({type:"pipe",in:e,out:t})}const No=e("ZodReadonly",(e,t)=>{Lt.init(e,t),An.init(e,t),e.unwrap=()=>e._zod.def.innerType});const jo=e("ZodCustom",(e,t)=>{Wt.init(e,t),An.init(e,t)});function So(e,t={error:`Input not instance of ${e.name}`}){const n=new jo({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...b(t)});return n._zod.bag.Class=e,n}const Fo=On().refine(e=>64===e.length||128===e.length,{message:"Reference must be 64 chars (32 bytes) or 128 chars (64 bytes for encrypted)"}),Uo=On().length(64);On().length(40);const Co=lo({pin:io().optional(),encrypt:io().optional(),tag:eo().optional(),deferred:io().optional(),redundancyLevel:eo().min(0).max(4).optional()}).optional(),Do=lo({redundancyStrategy:ho([wo(0),wo(1),wo(2),wo(3)]).optional(),fallback:io().optional(),timeoutMs:eo().optional(),actPublisher:ho([So(Uint8Array),On()]),actHistoryAddress:ho([So(Uint8Array),On()]),actTimestamp:ho([eo(),On()])}).optional();lo({reference:Fo,tagUid:eo().optional()}),lo({name:On(),data:So(Uint8Array)}),lo({batchID:Uo,utilization:eo(),usable:io(),label:On(),depth:eo(),amount:On(),bucketDepth:eo(),blockNumber:eo(),immutableFlag:io(),exists:io(),batchTTL:eo().optional()}),lo({authenticated:io(),origin:On().optional()});const Ro=lo({backgroundColor:On().optional(),color:On().optional(),border:On().optional(),borderRadius:On().optional(),padding:On().optional(),fontSize:On().optional(),fontFamily:On().optional(),fontWeight:On().optional(),cursor:On().optional(),width:On().optional(),height:On().optional()}).optional(),Mo=vo("type",[lo({type:wo("parentIdentify"),beeApiUrl:On().url().optional(),popupMode:yo(["popup","window"]).optional()}),lo({type:wo("checkAuth")}),lo({type:wo("requestAuth"),styles:Ro}),lo({type:wo("uploadData"),requestId:On(),data:So(Uint8Array),options:Co,enableProgress:io().optional()}),lo({type:wo("downloadData"),requestId:On(),reference:Fo,options:Do}),lo({type:wo("uploadFile"),requestId:On(),data:So(Uint8Array),name:On().optional(),options:Co}),lo({type:wo("downloadFile"),requestId:On(),reference:Fo,path:On().optional(),options:Do}),lo({type:wo("uploadChunk"),requestId:On(),data:So(Uint8Array),options:Co}),lo({type:wo("downloadChunk"),requestId:On(),reference:Fo,options:Do})]),Vo=vo("type",[lo({type:wo("proxyReady"),authenticated:io(),parentOrigin:On()}),lo({type:wo("authStatusResponse"),authenticated:io(),origin:On().optional()}),lo({type:wo("authSuccess"),origin:On()}),lo({type:wo("uploadDataResponse"),requestId:On(),reference:Fo,tagUid:eo().optional()}),lo({type:wo("downloadDataResponse"),requestId:On(),data:So(Uint8Array)}),lo({type:wo("uploadFileResponse"),requestId:On(),reference:Fo,tagUid:eo().optional()}),lo({type:wo("downloadFileResponse"),requestId:On(),name:On(),data:So(Uint8Array)}),lo({type:wo("uploadChunkResponse"),requestId:On(),reference:Fo}),lo({type:wo("downloadChunkResponse"),requestId:On(),data:So(Uint8Array)}),lo({type:wo("uploadProgress"),requestId:On(),total:eo(),processed:eo()}),lo({type:wo("error"),requestId:On(),error:On()})]),Lo=lo({secret:On(),postageBatchId:Uo.optional(),signerKey:On().length(64).optional()}).refine(e=>!!e.postageBatchId,{message:"postageBatchId is required. signerKey is optional for client-side signing."}),qo=vo("type",[lo({type:wo("setSecret"),appOrigin:On(),data:Lo})]);export{Vo as I,Mo as P,qo as a};
|
|
2
|
+
//# sourceMappingURL=types-BD_VkNn0.js.map
|