@tinycloudlabs/web-sdk 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +320 -0
- package/dist/625.index.js +1 -0
- package/dist/authorization/WebSpaceCreationHandler.d.ts +40 -0
- package/dist/authorization/WebSpaceCreationHandler.d.ts.map +1 -0
- package/dist/authorization/WebUserAuthorization.d.ts +295 -0
- package/dist/authorization/WebUserAuthorization.d.ts.map +1 -0
- package/dist/authorization/index.d.ts +12 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/delegation.d.ts +85 -0
- package/dist/delegation.d.ts.map +1 -0
- package/dist/index.d.ts +12 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/modules/Storage/index.d.ts +1 -2
- package/dist/modules/Storage/index.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/KVServiceAdapter.d.ts +24 -0
- package/dist/modules/Storage/tinycloud/KVServiceAdapter.d.ts.map +1 -0
- package/dist/modules/Storage/tinycloud/index.d.ts +1 -4
- package/dist/modules/Storage/tinycloud/index.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/module.d.ts +1 -1
- package/dist/modules/Storage/tinycloud/types.d.ts +7 -9
- package/dist/modules/Storage/tinycloud/types.d.ts.map +1 -1
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +159 -0
- package/dist/modules/Storage/tinycloud/types.schema.d.ts.map +1 -0
- package/dist/modules/UserAuthorization.d.ts +191 -58
- package/dist/modules/UserAuthorization.d.ts.map +1 -1
- package/dist/modules/WasmInitializer.d.ts +26 -0
- package/dist/modules/WasmInitializer.d.ts.map +1 -0
- package/dist/modules/index.d.ts +5 -2
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/keys/WasmKeyProvider.d.ts +126 -0
- package/dist/modules/keys/WasmKeyProvider.d.ts.map +1 -0
- package/dist/modules/keys/index.d.ts +7 -0
- package/dist/modules/keys/index.d.ts.map +1 -0
- package/dist/modules/registry/Registry.d.ts +59 -0
- package/dist/modules/registry/Registry.d.ts.map +1 -0
- package/dist/modules/tcw.d.ts +649 -53
- package/dist/modules/tcw.d.ts.map +1 -1
- package/dist/notifications/ModalManager.d.ts +6 -3
- package/dist/notifications/ModalManager.d.ts.map +1 -1
- package/dist/notifications/NodeSelectionModal.d.ts +29 -0
- package/dist/notifications/NodeSelectionModal.d.ts.map +1 -0
- package/dist/notifications/{OrbitCreationModal.d.ts → SpaceCreationModal.d.ts} +8 -8
- package/dist/notifications/{OrbitCreationModal.d.ts.map → SpaceCreationModal.d.ts.map} +1 -1
- package/dist/notifications/index.d.ts +3 -2
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/types.schema.d.ts +224 -0
- package/dist/notifications/types.schema.d.ts.map +1 -0
- package/dist/utils/debug.d.ts +9 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/multiaddr.d.ts +36 -0
- package/dist/utils/multiaddr.d.ts.map +1 -0
- package/package.json +14 -6
- package/dist/index.js.LICENSE.txt +0 -21
- package/dist/modules/Storage/TinyCloudStorage.d.ts +0 -182
- package/dist/modules/Storage/TinyCloudStorage.d.ts.map +0 -1
- package/dist/modules/Storage/interfaces.d.ts +0 -119
- package/dist/modules/Storage/interfaces.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/authenticator.d.ts +0 -12
- package/dist/modules/Storage/tinycloud/authenticator.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/capabilities.d.ts +0 -25
- package/dist/modules/Storage/tinycloud/capabilities.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/kv.d.ts +0 -18
- package/dist/modules/Storage/tinycloud/kv.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/orbit.d.ts +0 -167
- package/dist/modules/Storage/tinycloud/orbit.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts +0 -43
- package/dist/modules/Storage/tinycloud/tinycloud.d.ts.map +0 -1
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts +0 -19
- package/dist/modules/Storage/tinycloud/walletProvider.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAuthorization.d.ts","sourceRoot":"","sources":["../../src/modules/UserAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAe,UAAU,
|
|
1
|
+
{"version":3,"file":"UserAuthorization.d.ts","sourceRoot":"","sources":["../../src/modules/UserAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAe,UAAU,EAAa,MAAM,6BAA6B,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAiB,WAAW,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,OAAO,EAAc,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,SAAS,EACV,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAE5C,kBAAkB,EAKnB,MAAM,yBAAyB,CAAC;AAWjC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9C;;GAEG;AACH,OAAO,QAAQ,gCAAgC,CAAC;IAC9C,UAAU,YAAY;QACpB,gFAAgF;QAChF,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,2EAA2E;QAC3E,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,yDAAyD;QACzD,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;CACF;AAED;;GAEG;AACH,UAAU,cAAc;IACtB,+DAA+D;IAC/D,cAAc,EAAE,UAAU,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACpD,6EAA6E;IAC7E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GG;YACW,qBAAqB;IAYnC;;;;OAIG;YACW,iBAAiB;CAgDhC;AAED,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized WASM initialization for the TinyCloud SDK.
|
|
3
|
+
* Ensures WASM modules are loaded before any extension operations.
|
|
4
|
+
*/
|
|
5
|
+
export declare class WasmInitializer {
|
|
6
|
+
private static isInitialized;
|
|
7
|
+
private static tinycloudModule;
|
|
8
|
+
private static sessionManager;
|
|
9
|
+
/**
|
|
10
|
+
* Ensures WASM modules are initialized. Safe to call multiple times.
|
|
11
|
+
* @returns Promise resolving to initialized WASM modules
|
|
12
|
+
*/
|
|
13
|
+
static ensureInitialized(): Promise<{
|
|
14
|
+
tinycloudModule: any;
|
|
15
|
+
sessionManager: any;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the initialized WASM modules if available.
|
|
19
|
+
* @returns The WASM modules or null if not initialized
|
|
20
|
+
*/
|
|
21
|
+
static getModules(): {
|
|
22
|
+
tinycloudModule: any;
|
|
23
|
+
sessionManager: any;
|
|
24
|
+
} | null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=WasmInitializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WasmInitializer.d.ts","sourceRoot":"","sources":["../../src/modules/WasmInitializer.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAS;IACrC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAM;IACpC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAM;IAEnC;;;OAGG;WACU,iBAAiB,IAAI,OAAO,CAAC;QACxC,eAAe,EAAE,GAAG,CAAC;QACrB,cAAc,EAAE,GAAG,CAAC;KACrB,CAAC;IAeF;;;OAGG;IACH,MAAM,CAAC,UAAU,IAAI;QAAE,eAAe,EAAE,GAAG,CAAC;QAAC,cAAc,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI;CAS1E"}
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./UserAuthorization";
|
|
2
|
+
export * from "./Storage";
|
|
3
|
+
export * from "./tcw";
|
|
4
|
+
export { TinyCloudWeb } from "./tcw";
|
|
5
|
+
export { WebUserAuthorization, WebUserAuthorizationConfig, WebSignStrategy, WalletPopupStrategy, defaultWebSignStrategy, ModalSpaceCreationHandler, defaultWebSpaceCreationHandler, } from "../authorization";
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WasmKeyProvider - KeyProvider implementation using WASM session manager.
|
|
3
|
+
*
|
|
4
|
+
* This provider wraps the SessionManager from web-sdk-wasm to provide
|
|
5
|
+
* cryptographic key operations required by the SharingService.
|
|
6
|
+
*
|
|
7
|
+
* Supports multiple named session keys that can coexist within a single
|
|
8
|
+
* session manager instance.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import type { KeyProvider, JWK } from "@tinycloudlabs/sdk-core";
|
|
13
|
+
import { tcwSession } from "@tinycloudlabs/web-sdk-wasm";
|
|
14
|
+
/** Type alias for SessionManager from the tcwSession namespace */
|
|
15
|
+
type TCWSessionManager = tcwSession.TCWSessionManager;
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for WasmKeyProvider.
|
|
18
|
+
*/
|
|
19
|
+
export interface WasmKeyProviderConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Optional WASM session manager instance.
|
|
22
|
+
* If not provided, a new manager will be created.
|
|
23
|
+
*/
|
|
24
|
+
sessionManager?: TCWSessionManager;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* KeyProvider implementation for web-sdk using WASM session manager.
|
|
28
|
+
*
|
|
29
|
+
* This allows the SharingService to create new session keys for sharing links
|
|
30
|
+
* using the same cryptographic operations as the main session management.
|
|
31
|
+
*
|
|
32
|
+
* Multiple named keys can coexist and are identified by their key ID for
|
|
33
|
+
* delegation targeting.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Create with a shared session manager
|
|
38
|
+
* const sessionManager = new tcwSession.TCWSessionManager();
|
|
39
|
+
* const keyProvider = new WasmKeyProvider({ sessionManager });
|
|
40
|
+
*
|
|
41
|
+
* // Or create standalone (manages its own session manager)
|
|
42
|
+
* const keyProvider = new WasmKeyProvider();
|
|
43
|
+
*
|
|
44
|
+
* // Create multiple named keys
|
|
45
|
+
* const keyId1 = await keyProvider.createSessionKey("share:abc123");
|
|
46
|
+
* const keyId2 = await keyProvider.createSessionKey("share:def456");
|
|
47
|
+
*
|
|
48
|
+
* // Retrieve keys by ID
|
|
49
|
+
* const jwk1 = keyProvider.getJWK(keyId1);
|
|
50
|
+
* const did1 = await keyProvider.getDID(keyId1);
|
|
51
|
+
*
|
|
52
|
+
* // List all keys
|
|
53
|
+
* console.log(keyProvider.listKeys()); // ["share:abc123", "share:def456"]
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare class WasmKeyProvider implements KeyProvider {
|
|
57
|
+
/** The WASM session manager instance */
|
|
58
|
+
private sessionManager?;
|
|
59
|
+
/** Promise that resolves when initialization is complete */
|
|
60
|
+
private initPromise?;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new WasmKeyProvider.
|
|
63
|
+
*
|
|
64
|
+
* @param config - Optional configuration with session manager
|
|
65
|
+
*/
|
|
66
|
+
constructor(config?: WasmKeyProviderConfig);
|
|
67
|
+
/**
|
|
68
|
+
* Ensure the session manager is initialized.
|
|
69
|
+
* Creates a new one if not provided in config.
|
|
70
|
+
*/
|
|
71
|
+
private ensureInitialized;
|
|
72
|
+
/**
|
|
73
|
+
* Generate a new session key with the given name.
|
|
74
|
+
*
|
|
75
|
+
* This creates a new Ed25519 key pair in the WASM session manager.
|
|
76
|
+
* The key can then be used for signing delegations in sharing links.
|
|
77
|
+
*
|
|
78
|
+
* @param name - A unique name/ID for the key (e.g., "share:timestamp:random")
|
|
79
|
+
* @returns The key ID (same as the name provided)
|
|
80
|
+
*/
|
|
81
|
+
createSessionKey(name: string): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Get the JWK (JSON Web Key) for a key.
|
|
84
|
+
*
|
|
85
|
+
* Returns the full JWK including the private key (d parameter),
|
|
86
|
+
* which is required for signing and for embedding in sharing links.
|
|
87
|
+
*
|
|
88
|
+
* @param keyId - The key ID to retrieve
|
|
89
|
+
* @returns The JWK object with public and private key components
|
|
90
|
+
* @throws Error if the key is not found
|
|
91
|
+
*/
|
|
92
|
+
getJWK(keyId: string): JWK;
|
|
93
|
+
/**
|
|
94
|
+
* Get the DID (Decentralized Identifier) for a key.
|
|
95
|
+
*
|
|
96
|
+
* Returns the did:key format DID derived from the key's public key.
|
|
97
|
+
* The DID can be used as the delegatee in delegations.
|
|
98
|
+
*
|
|
99
|
+
* @param keyId - The key ID to get the DID for
|
|
100
|
+
* @returns The did:key formatted DID string
|
|
101
|
+
* @throws Error if the key is not found
|
|
102
|
+
*/
|
|
103
|
+
getDID(keyId: string): Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* List all session keys currently held by the provider.
|
|
106
|
+
*
|
|
107
|
+
* @returns Array of key IDs
|
|
108
|
+
*/
|
|
109
|
+
listKeys(): string[];
|
|
110
|
+
/**
|
|
111
|
+
* Check if a key exists in the provider.
|
|
112
|
+
*
|
|
113
|
+
* @param keyId - The key ID to check
|
|
114
|
+
* @returns True if the key exists
|
|
115
|
+
*/
|
|
116
|
+
hasKey(keyId: string): boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Create a new WasmKeyProvider instance.
|
|
120
|
+
*
|
|
121
|
+
* @param sessionManager - Optional WASM session manager to use
|
|
122
|
+
* @returns A new WasmKeyProvider instance
|
|
123
|
+
*/
|
|
124
|
+
export declare function createWasmKeyProvider(sessionManager?: TCWSessionManager): WasmKeyProvider;
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=WasmKeyProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WasmKeyProvider.d.ts","sourceRoot":"","sources":["../../../src/modules/keys/WasmKeyProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAe,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEtE,kEAAkE;AAClE,KAAK,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,eAAgB,YAAW,WAAW;IACjD,wCAAwC;IACxC,OAAO,CAAC,cAAc,CAAC,CAAoB;IAE3C,4DAA4D;IAC5D,OAAO,CAAC,WAAW,CAAC,CAAgB;IAEpC;;;;OAIG;gBACS,MAAM,GAAE,qBAA0B;IAM9C;;;OAGG;YACW,iBAAiB;IAgB/B;;;;;;;;OAQG;IACG,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrD;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG;IAa1B;;;;;;;;;OASG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM5C;;;;OAIG;IACH,QAAQ,IAAI,MAAM,EAAE;IAQpB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAO/B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAEzF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/keys/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import { providers } from "ethers";
|
|
3
|
+
export declare const REGISTRY_CONTRACT_ADDRESS: {
|
|
4
|
+
1: string;
|
|
5
|
+
11155111: string;
|
|
6
|
+
};
|
|
7
|
+
export interface RegistryConfig {
|
|
8
|
+
provider: providers.Web3Provider;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Registry provides access to the TinyCloud Registry contract for resolving
|
|
12
|
+
* account addresses to their associated node identifiers.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Registry {
|
|
15
|
+
provider: providers.Web3Provider;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new instance of the Registry class.
|
|
18
|
+
*
|
|
19
|
+
* @param config - Configuration options for the Registry
|
|
20
|
+
* @param config.rpcUrl - The RPC URL to connect to the blockchain
|
|
21
|
+
* @param config.contractAddress - The address of the Registry contract
|
|
22
|
+
*/
|
|
23
|
+
constructor(config: RegistryConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Gets the node identifier associated with an account address.
|
|
26
|
+
*
|
|
27
|
+
* @param account - The account address to look up
|
|
28
|
+
* @returns A Promise containing the node identifier string
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const registry = new Registry({
|
|
33
|
+
* rpcUrl: 'https://mainnet.base.org',
|
|
34
|
+
* contractAddress: '0x...'
|
|
35
|
+
* });
|
|
36
|
+
* const node = await registry.getNode('0x1234...');
|
|
37
|
+
* console.log(node); // 'my-node-id'
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
getNode(account: Address): Promise<string>;
|
|
41
|
+
addressNode(): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if an account has a registered node.
|
|
44
|
+
*
|
|
45
|
+
* @param account - The account address to check
|
|
46
|
+
* @returns A Promise containing a boolean indicating if the account has a node
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const hasNode = await registry.hasNode('0x1234...');
|
|
51
|
+
* if (hasNode) {
|
|
52
|
+
* const node = await registry.getNode('0x1234...');
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
hasNode(account: Address): Promise<boolean>;
|
|
57
|
+
}
|
|
58
|
+
export default Registry;
|
|
59
|
+
//# sourceMappingURL=Registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Registry.d.ts","sourceRoot":"","sources":["../../../src/modules/registry/Registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAsD,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAExF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAkBnC,eAAO,MAAM,yBAAyB;;;CAGrC,CAAA;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC;CAClC;AAED;;;GAGG;AACH,qBAAa,QAAQ;IAEnB,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC;IACjC;;;;;;OAMG;gBACS,MAAM,EAAE,cAAc;IAIlC;;;;;;;;;;;;;;;OAeG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAyB1C,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAWpC;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAclD;AAED,eAAe,QAAQ,CAAC"}
|