@agentuity/sandbox 3.0.12 → 3.1.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.
Files changed (122) hide show
  1. package/AGENTS.md +3 -3
  2. package/dist/api-reference.d.ts +1221 -0
  3. package/dist/api-reference.d.ts.map +1 -0
  4. package/dist/api-reference.js +1046 -0
  5. package/dist/api-reference.js.map +1 -0
  6. package/dist/base64.d.ts +2 -0
  7. package/dist/base64.d.ts.map +1 -0
  8. package/dist/base64.js +14 -0
  9. package/dist/base64.js.map +1 -0
  10. package/dist/client.d.ts +431 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +632 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/create.d.ts +203 -0
  15. package/dist/create.d.ts.map +1 -0
  16. package/dist/create.js +235 -0
  17. package/dist/create.js.map +1 -0
  18. package/dist/destroy.d.ts +23 -0
  19. package/dist/destroy.d.ts.map +1 -0
  20. package/dist/destroy.js +30 -0
  21. package/dist/destroy.js.map +1 -0
  22. package/dist/disk-checkpoint.d.ts +108 -0
  23. package/dist/disk-checkpoint.d.ts.map +1 -0
  24. package/dist/disk-checkpoint.js +124 -0
  25. package/dist/disk-checkpoint.js.map +1 -0
  26. package/dist/events.d.ts +56 -0
  27. package/dist/events.d.ts.map +1 -0
  28. package/dist/events.js +54 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/execute.d.ts +99 -0
  31. package/dist/execute.d.ts.map +1 -0
  32. package/dist/execute.js +138 -0
  33. package/dist/execute.js.map +1 -0
  34. package/dist/execution.d.ts +150 -0
  35. package/dist/execution.d.ts.map +1 -0
  36. package/dist/execution.js +120 -0
  37. package/dist/execution.js.map +1 -0
  38. package/dist/files.d.ts +283 -0
  39. package/dist/files.d.ts.map +1 -0
  40. package/dist/files.js +471 -0
  41. package/dist/files.js.map +1 -0
  42. package/dist/get.d.ts +288 -0
  43. package/dist/get.d.ts.map +1 -0
  44. package/dist/get.js +256 -0
  45. package/dist/get.js.map +1 -0
  46. package/dist/getStatus.d.ts +23 -0
  47. package/dist/getStatus.d.ts.map +1 -0
  48. package/dist/getStatus.js +53 -0
  49. package/dist/getStatus.js.map +1 -0
  50. package/dist/index.d.ts +42 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +22 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/job.d.ts +227 -0
  55. package/dist/job.d.ts.map +1 -0
  56. package/dist/job.js +109 -0
  57. package/dist/job.js.map +1 -0
  58. package/dist/list.d.ts +330 -0
  59. package/dist/list.d.ts.map +1 -0
  60. package/dist/list.js +209 -0
  61. package/dist/list.js.map +1 -0
  62. package/dist/pause.d.ts +39 -0
  63. package/dist/pause.d.ts.map +1 -0
  64. package/dist/pause.js +48 -0
  65. package/dist/pause.js.map +1 -0
  66. package/dist/resolve.d.ts +75 -0
  67. package/dist/resolve.d.ts.map +1 -0
  68. package/dist/resolve.js +76 -0
  69. package/dist/resolve.js.map +1 -0
  70. package/dist/resume.d.ts +23 -0
  71. package/dist/resume.d.ts.map +1 -0
  72. package/dist/resume.js +30 -0
  73. package/dist/resume.js.map +1 -0
  74. package/dist/run.d.ts +73 -0
  75. package/dist/run.d.ts.map +1 -0
  76. package/dist/run.js +568 -0
  77. package/dist/run.js.map +1 -0
  78. package/dist/runtime.d.ts +94 -0
  79. package/dist/runtime.d.ts.map +1 -0
  80. package/dist/runtime.js +82 -0
  81. package/dist/runtime.js.map +1 -0
  82. package/dist/snapshot-build.d.ts +48 -0
  83. package/dist/snapshot-build.d.ts.map +1 -0
  84. package/dist/snapshot-build.js +72 -0
  85. package/dist/snapshot-build.js.map +1 -0
  86. package/dist/snapshot.d.ts +596 -0
  87. package/dist/snapshot.d.ts.map +1 -0
  88. package/dist/snapshot.js +612 -0
  89. package/dist/snapshot.js.map +1 -0
  90. package/dist/types.d.ts +1010 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/types.js +853 -0
  93. package/dist/types.js.map +1 -0
  94. package/dist/util.d.ts +296 -0
  95. package/dist/util.d.ts.map +1 -0
  96. package/dist/util.js +234 -0
  97. package/dist/util.js.map +1 -0
  98. package/package.json +7 -2
  99. package/src/api-reference.ts +1094 -0
  100. package/src/base64.ts +14 -0
  101. package/src/client.ts +998 -0
  102. package/src/create.ts +273 -0
  103. package/src/destroy.ts +43 -0
  104. package/src/disk-checkpoint.ts +184 -0
  105. package/src/events.ts +72 -0
  106. package/src/execute.ts +167 -0
  107. package/src/execution.ts +152 -0
  108. package/src/files.ts +637 -0
  109. package/src/get.ts +291 -0
  110. package/src/getStatus.ts +72 -0
  111. package/src/index.ts +252 -18
  112. package/src/job.ts +161 -0
  113. package/src/list.ts +239 -0
  114. package/src/pause.ts +75 -0
  115. package/src/resolve.ts +96 -0
  116. package/src/resume.ts +41 -0
  117. package/src/run.ts +783 -0
  118. package/src/runtime.ts +106 -0
  119. package/src/snapshot-build.ts +94 -0
  120. package/src/snapshot.ts +791 -0
  121. package/src/types.ts +1033 -0
  122. package/src/util.ts +280 -0
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ import { type APIClient } from '@agentuity/api';
3
+ /**
4
+ * Data schema for sandbox resolve endpoint
5
+ */
6
+ export declare const SandboxResolveDataSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodNullable<z.ZodString>;
9
+ region: z.ZodString;
10
+ status: z.ZodString;
11
+ orgId: z.ZodString;
12
+ projectId: z.ZodNullable<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ /**
15
+ * Response schema for sandbox resolve endpoint using standardized discriminated union
16
+ */
17
+ export declare const SandboxResolveResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
18
+ success: z.ZodLiteral<false>;
19
+ message: z.ZodString;
20
+ code: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ success: z.ZodLiteral<true>;
23
+ data: z.ZodOptional<z.ZodObject<{
24
+ id: z.ZodString;
25
+ name: z.ZodNullable<z.ZodString>;
26
+ region: z.ZodString;
27
+ status: z.ZodString;
28
+ orgId: z.ZodString;
29
+ projectId: z.ZodNullable<z.ZodString>;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>], "success">;
32
+ /**
33
+ * Resolved sandbox info returned from the CLI API
34
+ */
35
+ export type ResolvedSandboxInfo = z.infer<typeof SandboxResolveDataSchema>;
36
+ /**
37
+ * Error thrown when sandbox resolution fails.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * try {
42
+ * await sandboxResolve(client, 'sbx_123');
43
+ * } catch (error) {
44
+ * if (error._tag === 'SandboxResolveError') {
45
+ * console.error(`Sandbox not found: ${error.sandboxId}`);
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ export declare const SandboxResolveError: {
51
+ new (args?: ({
52
+ sandboxId?: string;
53
+ statusCode?: number;
54
+ } & {
55
+ message?: string;
56
+ cause?: unknown;
57
+ }) | undefined): import("@agentuity/adapter").RichError & {
58
+ readonly _tag: "SandboxResolveError";
59
+ } & Readonly<{
60
+ sandboxId?: string;
61
+ statusCode?: number;
62
+ }>;
63
+ readonly defaultMessage?: string;
64
+ };
65
+ /**
66
+ * Resolve a sandbox by ID across all organizations the user has access to.
67
+ * Uses the CLI API endpoint which searches across all user's orgs.
68
+ *
69
+ * @param client - API client configured for CLI endpoints
70
+ * @param sandboxId - The sandbox ID to resolve
71
+ * @returns Resolved sandbox info including region and orgId
72
+ * @throws {SandboxResolveError} If sandbox not found or request fails
73
+ */
74
+ export declare function sandboxResolve(client: APIClient, sandboxId: string): Promise<ResolvedSandboxInfo>;
75
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,gBAAgB,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;iBAYqC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;8BAA0D,CAAC;AAEpG;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB;;oBACnB,MAAM;qBACL,MAAM;;;;;;;;;;;CAChB,CAAC;AAEL;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CACnC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAiC9B"}
@@ -0,0 +1,76 @@
1
+ import { StructuredError } from '@agentuity/core';
2
+ import { z } from 'zod';
3
+ import { APIResponseSchemaOptionalData } from '@agentuity/api';
4
+ /**
5
+ * Data schema for sandbox resolve endpoint
6
+ */
7
+ export const SandboxResolveDataSchema = z
8
+ .object({
9
+ id: z.string().describe('Unique identifier for the sandbox.'),
10
+ name: z.string().nullable().describe('Sandbox name, or null if unnamed.'),
11
+ region: z.string().describe('Cloud region where the sandbox is running.'),
12
+ status: z.string().describe('Current status of the sandbox.'),
13
+ orgId: z.string().describe('Organization ID that owns the sandbox.'),
14
+ projectId: z
15
+ .string()
16
+ .nullable()
17
+ .describe('Project ID the sandbox belongs to, or null if unassigned.'),
18
+ })
19
+ .describe('Resolved sandbox information from cross-organization lookup.');
20
+ /**
21
+ * Response schema for sandbox resolve endpoint using standardized discriminated union
22
+ */
23
+ export const SandboxResolveResponseSchema = APIResponseSchemaOptionalData(SandboxResolveDataSchema);
24
+ /**
25
+ * Error thrown when sandbox resolution fails.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * try {
30
+ * await sandboxResolve(client, 'sbx_123');
31
+ * } catch (error) {
32
+ * if (error._tag === 'SandboxResolveError') {
33
+ * console.error(`Sandbox not found: ${error.sandboxId}`);
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
+ export const SandboxResolveError = StructuredError('SandboxResolveError')();
39
+ /**
40
+ * Resolve a sandbox by ID across all organizations the user has access to.
41
+ * Uses the CLI API endpoint which searches across all user's orgs.
42
+ *
43
+ * @param client - API client configured for CLI endpoints
44
+ * @param sandboxId - The sandbox ID to resolve
45
+ * @returns Resolved sandbox info including region and orgId
46
+ * @throws {SandboxResolveError} If sandbox not found or request fails
47
+ */
48
+ export async function sandboxResolve(client, sandboxId) {
49
+ const response = await client.get(`/cli/sandbox/${sandboxId}`, SandboxResolveResponseSchema);
50
+ if (!response.success) {
51
+ // Extract status code from error code if present (e.g., "NOT_FOUND" -> 404)
52
+ // Fall back to 404 if no code is provided
53
+ const statusCode = response.code === 'NOT_FOUND' ? 404 : response.code ? 400 : 404;
54
+ throw new SandboxResolveError({
55
+ message: response.message || 'Sandbox not found',
56
+ sandboxId,
57
+ statusCode,
58
+ });
59
+ }
60
+ if (!response.data) {
61
+ throw new SandboxResolveError({
62
+ message: 'Sandbox not found',
63
+ sandboxId,
64
+ statusCode: 404,
65
+ });
66
+ }
67
+ return {
68
+ id: response.data.id,
69
+ name: response.data.name,
70
+ region: response.data.region,
71
+ status: response.data.status,
72
+ orgId: response.data.orgId,
73
+ projectId: response.data.projectId,
74
+ };
75
+ }
76
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACvC,MAAM,CAAC;IACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAC7D,IAAI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,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,mBAAmB,CAAC;YAC7B,OAAO,EAAE,mBAAmB;YAC5B,SAAS;YACT,UAAU,EAAE,GAAG;SACf,CAAC,CAAC;IACJ,CAAC;IAED,OAAO;QACN,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;QACpB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI;QACxB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;QAC5B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;QAC5B,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK;QAC1B,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS;KAClC,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { type APIClient } from '@agentuity/api';
3
+ export declare const ResumeResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ success: z.ZodLiteral<false>;
5
+ message: z.ZodString;
6
+ code: z.ZodOptional<z.ZodString>;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ success: z.ZodLiteral<true>;
9
+ }, z.core.$strip>], "success">;
10
+ export declare const SandboxResumeParamsSchema: z.ZodObject<{
11
+ sandboxId: z.ZodString;
12
+ orgId: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ export type SandboxResumeParams = z.infer<typeof SandboxResumeParamsSchema>;
15
+ /**
16
+ * Resumes a paused sandbox from its checkpoint.
17
+ *
18
+ * @param client - The API client to use for the request
19
+ * @param params - Parameters including the sandbox ID to resume
20
+ * @throws {SandboxResponseError} If the sandbox is not found or resume fails
21
+ */
22
+ export declare function sandboxResume(client: APIClient, params: SandboxResumeParams): Promise<void>;
23
+ //# sourceMappingURL=resume.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../src/resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,gBAAgB,CAAC;AAGzE,eAAO,MAAM,oBAAoB;;;;;;8BAA4B,CAAC;AAE9D,eAAO,MAAM,yBAAyB;;;iBAGpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBjG"}
package/dist/resume.js ADDED
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { APIResponseSchemaNoData } from '@agentuity/api';
3
+ import { throwSandboxError } from './util.js';
4
+ export const ResumeResponseSchema = APIResponseSchemaNoData();
5
+ export const SandboxResumeParamsSchema = z.object({
6
+ sandboxId: z.string().describe('Sandbox ID to resume'),
7
+ orgId: z.string().optional().describe('Optional org id for CLI auth context'),
8
+ });
9
+ /**
10
+ * Resumes a paused sandbox from its checkpoint.
11
+ *
12
+ * @param client - The API client to use for the request
13
+ * @param params - Parameters including the sandbox ID to resume
14
+ * @throws {SandboxResponseError} If the sandbox is not found or resume fails
15
+ */
16
+ export async function sandboxResume(client, params) {
17
+ const { sandboxId, orgId } = params;
18
+ const queryParams = new URLSearchParams();
19
+ if (orgId) {
20
+ queryParams.set('orgId', orgId);
21
+ }
22
+ const queryString = queryParams.toString();
23
+ const url = `/sandbox/${encodeURIComponent(sandboxId)}/resume${queryString ? `?${queryString}` : ''}`;
24
+ const resp = await client.post(url, undefined, ResumeResponseSchema);
25
+ if (resp.success) {
26
+ return;
27
+ }
28
+ throwSandboxError(resp, { sandboxId });
29
+ }
30
+ //# sourceMappingURL=resume.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.js","sourceRoot":"","sources":["../src/resume.ts"],"names":[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,73 @@
1
+ import type { Logger } from '@agentuity/client';
2
+ import type { Readable, Writable } from 'node:stream';
3
+ import { z } from 'zod';
4
+ import { APIClient } from '@agentuity/api';
5
+ import { type SandboxRunResult } from './types.ts';
6
+ export declare const SandboxRunParamsSchema: z.ZodObject<{
7
+ options: z.ZodObject<{
8
+ projectId: z.ZodOptional<z.ZodString>;
9
+ runtime: z.ZodOptional<z.ZodString>;
10
+ runtimeId: z.ZodOptional<z.ZodString>;
11
+ name: z.ZodOptional<z.ZodString>;
12
+ description: z.ZodOptional<z.ZodString>;
13
+ resources: z.ZodOptional<z.ZodObject<{
14
+ memory: z.ZodOptional<z.ZodString>;
15
+ cpu: z.ZodOptional<z.ZodString>;
16
+ disk: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>>;
18
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
19
+ network: z.ZodOptional<z.ZodObject<{
20
+ enabled: z.ZodOptional<z.ZodBoolean>;
21
+ port: z.ZodOptional<z.ZodNumber>;
22
+ }, z.core.$strip>>;
23
+ stream: z.ZodOptional<z.ZodObject<{
24
+ stdout: z.ZodOptional<z.ZodString>;
25
+ stderr: z.ZodOptional<z.ZodString>;
26
+ stdin: z.ZodOptional<z.ZodString>;
27
+ timestamps: z.ZodOptional<z.ZodBoolean>;
28
+ }, z.core.$strip>>;
29
+ timeout: z.ZodOptional<z.ZodObject<{
30
+ idle: z.ZodOptional<z.ZodString>;
31
+ execution: z.ZodOptional<z.ZodString>;
32
+ paused: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>>;
34
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ path: z.ZodString;
36
+ content: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
37
+ }, z.core.$strip>>>;
38
+ snapshot: z.ZodOptional<z.ZodString>;
39
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
42
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
+ command: z.ZodObject<{
44
+ exec: z.ZodArray<z.ZodString>;
45
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ path: z.ZodString;
47
+ content: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
48
+ }, z.core.$strip>>>;
49
+ }, z.core.$strip>;
50
+ }, z.core.$strip>;
51
+ orgId: z.ZodOptional<z.ZodString>;
52
+ region: z.ZodOptional<z.ZodString>;
53
+ apiKey: z.ZodOptional<z.ZodString>;
54
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
55
+ stdin: z.ZodOptional<z.ZodCustom<Readable, Readable>>;
56
+ stdout: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
57
+ stderr: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
58
+ logger: z.ZodOptional<z.ZodCustom<Logger, Logger>>;
59
+ }, z.core.$strip>;
60
+ export type SandboxRunParams = z.infer<typeof SandboxRunParamsSchema>;
61
+ /**
62
+ * Creates a sandbox, executes a command, and waits for completion.
63
+ *
64
+ * This is a high-level convenience function that handles the full lifecycle:
65
+ * creating a sandbox, streaming I/O, polling for completion, and cleanup.
66
+ *
67
+ * @param client - The API client to use for the request
68
+ * @param params - Parameters including command options, I/O streams, and timeout settings
69
+ * @returns The run result including exit code and duration
70
+ * @throws {SandboxResponseError} If sandbox creation fails, execution times out, or is cancelled
71
+ */
72
+ export declare function sandboxRun(client: APIClient, params: SandboxRunParams): Promise<SandboxRunResult>;
73
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAwB,MAAM,gBAAgB,CAAC;AAMjE,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAkC5E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAgT3B"}