@bian-womp/spark-remote 0.2.93 → 0.3.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.
Files changed (43) hide show
  1. package/lib/cjs/index.cjs +358 -344
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/cjs/src/RemoteEngine.d.ts +8 -2
  4. package/lib/cjs/src/RemoteEngine.d.ts.map +1 -1
  5. package/lib/cjs/src/RemoteGraphLifecycleApi.d.ts +39 -0
  6. package/lib/cjs/src/RemoteGraphLifecycleApi.d.ts.map +1 -0
  7. package/lib/cjs/src/{RuntimeApiClient.d.ts → RemoteRuntimeClient.d.ts} +22 -38
  8. package/lib/cjs/src/RemoteRuntimeClient.d.ts.map +1 -0
  9. package/lib/cjs/src/examples/shared.d.ts.map +1 -1
  10. package/lib/cjs/src/index.d.ts +6 -3
  11. package/lib/cjs/src/index.d.ts.map +1 -1
  12. package/lib/cjs/src/server/{RuntimeApiServer.d.ts → ServerCommandHandler.d.ts} +5 -5
  13. package/lib/cjs/src/server/ServerCommandHandler.d.ts.map +1 -0
  14. package/lib/cjs/src/server/ServerRuntimeAdapter.d.ts +26 -0
  15. package/lib/cjs/src/server/ServerRuntimeAdapter.d.ts.map +1 -0
  16. package/lib/esm/index.js +356 -343
  17. package/lib/esm/index.js.map +1 -1
  18. package/lib/esm/src/RemoteEngine.d.ts +8 -2
  19. package/lib/esm/src/RemoteEngine.d.ts.map +1 -1
  20. package/lib/esm/src/RemoteGraphLifecycleApi.d.ts +39 -0
  21. package/lib/esm/src/RemoteGraphLifecycleApi.d.ts.map +1 -0
  22. package/lib/esm/src/{RuntimeApiClient.d.ts → RemoteRuntimeClient.d.ts} +22 -38
  23. package/lib/esm/src/RemoteRuntimeClient.d.ts.map +1 -0
  24. package/lib/esm/src/examples/shared.d.ts.map +1 -1
  25. package/lib/esm/src/index.d.ts +6 -3
  26. package/lib/esm/src/index.d.ts.map +1 -1
  27. package/lib/esm/src/server/{RuntimeApiServer.d.ts → ServerCommandHandler.d.ts} +5 -5
  28. package/lib/esm/src/server/ServerCommandHandler.d.ts.map +1 -0
  29. package/lib/esm/src/server/ServerRuntimeAdapter.d.ts +26 -0
  30. package/lib/esm/src/server/ServerRuntimeAdapter.d.ts.map +1 -0
  31. package/package.json +3 -3
  32. package/lib/cjs/src/RuntimeApiClient.d.ts.map +0 -1
  33. package/lib/cjs/src/protocol.d.ts +0 -2
  34. package/lib/cjs/src/protocol.d.ts.map +0 -1
  35. package/lib/cjs/src/server/RuntimeApiServer.d.ts.map +0 -1
  36. package/lib/cjs/src/server/runtime.d.ts +0 -56
  37. package/lib/cjs/src/server/runtime.d.ts.map +0 -1
  38. package/lib/esm/src/RuntimeApiClient.d.ts.map +0 -1
  39. package/lib/esm/src/protocol.d.ts +0 -2
  40. package/lib/esm/src/protocol.d.ts.map +0 -1
  41. package/lib/esm/src/server/RuntimeApiServer.d.ts.map +0 -1
  42. package/lib/esm/src/server/runtime.d.ts +0 -56
  43. package/lib/esm/src/server/runtime.d.ts.map +0 -1
@@ -0,0 +1,39 @@
1
+ import type { GraphDefinition, RegistryDescriptor, RegistryDelta, RuntimeSnapshot, RuntimeSnapshotFull, RunnerOptions, RuntimeHistoryInfo, Viewport } from "@bian-womp/spark-protocol";
2
+ import type { GraphLifecycleApi } from "@bian-womp/spark-graph";
3
+ import type { Transport } from "./transport/Transport";
4
+ /**
5
+ * RemoteGraphLifecycleApi implements GraphLifecycleApi by sending commands over transport.
6
+ * This handles all non-execution operations (graph lifecycle, snapshots, registry, etc.)
7
+ */
8
+ export declare class RemoteGraphLifecycleApi implements GraphLifecycleApi {
9
+ private transport;
10
+ constructor(transport: Transport);
11
+ private ensureConnected;
12
+ build(def: GraphDefinition, opts?: {
13
+ environment?: Record<string, unknown>;
14
+ }): Promise<void>;
15
+ update(def: GraphDefinition, options?: {
16
+ dry?: boolean;
17
+ }): Promise<void>;
18
+ launch(opts?: RunnerOptions): Promise<void>;
19
+ snapshot(): Promise<RuntimeSnapshot>;
20
+ snapshotFull(): Promise<RuntimeSnapshotFull>;
21
+ applySnapshotFull(payload: RuntimeSnapshotFull, options?: {
22
+ skipBuild?: boolean;
23
+ }): Promise<void>;
24
+ describeRegistry(): Promise<RegistryDescriptor>;
25
+ applyRegistry(deltas: Array<RegistryDelta>): Promise<void>;
26
+ setEnvironment(environment: Record<string, unknown>, opts?: {
27
+ merge?: boolean;
28
+ dry?: boolean;
29
+ }): Promise<void>;
30
+ getEnvironment(): Promise<Record<string, unknown>>;
31
+ coerce(from: string, to: string, value: unknown): Promise<unknown>;
32
+ setExtData(data: Record<string, unknown>): Promise<void>;
33
+ getExtData(): Promise<Record<string, unknown>>;
34
+ setViewport(viewport: Viewport): Promise<void>;
35
+ commit(reason?: string): Promise<RuntimeHistoryInfo | undefined>;
36
+ undo(): Promise<boolean>;
37
+ redo(): Promise<boolean>;
38
+ }
39
+ //# sourceMappingURL=RemoteGraphLifecycleApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteGraphLifecycleApi.d.ts","sourceRoot":"","sources":["../../../src/RemoteGraphLifecycleApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IACnD,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;YAE1B,eAAe;IAOvB,KAAK,CACT,GAAG,EAAE,eAAe,EACpB,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAC/C,OAAO,C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AAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAShE,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IASxB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;CAQ/B"}
@@ -1,4 +1,5 @@
1
- import type { GraphDefinition, RegistryDescriptor, RuntimeSnapshot, RuntimeSnapshotFull, Envelope, RunnerOptions, RuntimeHistoryInfo, Viewport } from "@bian-womp/spark-protocol";
1
+ import type { Envelope } from "@bian-womp/spark-protocol";
2
+ import type { GraphLifecycleApi } from "@bian-womp/spark-graph";
2
3
  import { RemoteEngine } from "./RemoteEngine";
3
4
  import type { TransportConnectOptions } from "./transport/Transport";
4
5
  import { WebSocketTransportConnectOptions } from "./transport/WebSocketTransport";
@@ -22,8 +23,15 @@ export type RemoteTransportStatus = {
22
23
  };
23
24
  export type TransportEventListener = (status: RemoteTransportStatus) => void;
24
25
  export type CustomEventListener = (event: Envelope<any>) => void;
25
- export declare class RuntimeApiClient {
26
- private engine?;
26
+ /**
27
+ * RemoteRuntimeClient manages the connection to a remote runtime.
28
+ * It provides access to:
29
+ * - engine: RemoteEngine for execution operations
30
+ * - api: GraphLifecycleApi for graph lifecycle operations
31
+ */
32
+ export declare class RemoteRuntimeClient {
33
+ private _engine?;
34
+ private _api?;
27
35
  private transport?;
28
36
  private customEventListeners;
29
37
  private transportEventListeners;
@@ -32,6 +40,16 @@ export declare class RuntimeApiClient {
32
40
  private config;
33
41
  private connectingPromise?;
34
42
  private runnerId?;
43
+ /**
44
+ * Get the Engine instance for execution operations.
45
+ * Engine provides unified interface for local/remote execution.
46
+ */
47
+ get engine(): RemoteEngine;
48
+ /**
49
+ * Get the GraphLifecycleApi instance for non-execution operations.
50
+ * GraphLifecycleApi handles graph lifecycle, snapshots, registry, environment, etc.
51
+ */
52
+ get api(): GraphLifecycleApi;
35
53
  constructor(config: RemoteClientConfig, options?: {
36
54
  onCustomEvent?: CustomEventListener;
37
55
  runnerId?: string;
@@ -58,44 +76,10 @@ export declare class RuntimeApiClient {
58
76
  */
59
77
  onTransportStatus(listener: TransportEventListener): () => void;
60
78
  private emitTransportStatus;
61
- /**
62
- * Ensure transport is connected. Called automatically by API methods.
63
- * Returns the transport instance, throwing if connection fails or client is disposed.
64
- */
65
- private ensureConnected;
66
- build(def: GraphDefinition, opts?: {
67
- environment?: Record<string, unknown>;
68
- }): Promise<void>;
69
- update(def: GraphDefinition, options?: {
70
- dry?: boolean;
71
- }): Promise<void>;
72
- describeRegistry(): Promise<RegistryDescriptor>;
73
- applyRegistry(deltas: Array<any>): Promise<void>;
74
- snapshot(): Promise<RuntimeSnapshot>;
75
- snapshotFull(): Promise<RuntimeSnapshotFull>;
76
- applySnapshotFull(payload: RuntimeSnapshotFull, options?: {
77
- skipBuild?: boolean;
78
- }): Promise<void>;
79
- setEnvironment(environment: Record<string, unknown>, opts?: {
80
- merge?: boolean;
81
- dry?: boolean;
82
- }): Promise<void>;
83
- getEnvironment(): Promise<Record<string, unknown>>;
84
- coerce(from: string, to: string, value: unknown): Promise<unknown>;
85
- getEngine(): RemoteEngine;
86
- launch(opts?: RunnerOptions): Promise<void>;
87
- step(): Promise<void>;
88
- computeNode(nodeId: string): Promise<void>;
89
- flush(): Promise<void>;
90
- setExtData(data: Record<string, unknown>): Promise<void>;
91
- commit(reason?: string): Promise<RuntimeHistoryInfo | undefined>;
92
- undo(): Promise<boolean>;
93
- redo(): Promise<boolean>;
94
- setViewport(viewport: Viewport): Promise<void>;
95
79
  /**
96
80
  * Dispose the client and close the transport connection.
97
81
  * Idempotent: safe to call multiple times.
98
82
  */
99
83
  dispose(): Promise<void>;
100
84
  }
101
- //# sourceMappingURL=RuntimeApiClient.d.ts.map
85
+ //# sourceMappingURL=RemoteRuntimeClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoteRuntimeClient.d.ts","sourceRoot":"","sources":["../../../src/RemoteRuntimeClient.ts"],"names":[],"mappings":"AAAA,OAAO,KA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oBAAoB,CAAC,CAAa;IAC1C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,iBAAiB,CAAC,CAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,CAAS;IAE1B;;;OAGG;IACH,IAAW,MAAM,IAAI,YAAY,CAKhC;IAED;;;OAGG;IACH,IAAW,GAAG,IAAI,iBAAiB,CAKlC;gBAGC,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,mBAAmB,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAUtE;;;OAGG;YACW,eAAe;IA8B7B;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA0D9B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAe/D,OAAO,CAAC,mBAAmB;IAM3B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAkC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/examples/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,MAAM,EACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;AAEzE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAM9D;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBA+CpE"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/examples/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,MAAM,EACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;AAEzE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAM9D;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBA4DpE"}
@@ -3,8 +3,11 @@ export * from "./transport/WebSocketTransport";
3
3
  export * from "./transport/WebSocketConnector";
4
4
  export * from "./transport/HttpPollingTransport";
5
5
  export * from "./server/errors";
6
- export * from "./server/runtime";
6
+ export * from "./server/ServerRuntimeAdapter";
7
+ export type { ServerRuntimeAdapter, ServerRuntimeAdapterContext, ServerRuntimeAdapterExtension, } from "./server/ServerRuntimeAdapter";
8
+ export { createServerRuntimeAdapter } from "./server/ServerRuntimeAdapter";
7
9
  export * from "./RemoteEngine";
8
- export * from "./RuntimeApiClient";
9
- export * from "./server/RuntimeApiServer";
10
+ export * from "./RemoteGraphLifecycleApi";
11
+ export * from "./RemoteRuntimeClient";
12
+ export * from "./server/ServerCommandHandler";
10
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { Envelope, Command, Json, SystemError, LogHandler } from "@bian-womp/spark-protocol";
2
- import type { RuntimeApi } from "./runtime";
2
+ import type { ServerRuntimeAdapter } from "./ServerRuntimeAdapter";
3
3
  /**
4
4
  * Middleware function that can preprocess commands before they reach the handler.
5
5
  * Call `next()` to continue to the next middleware or handler.
@@ -12,11 +12,11 @@ export type ErrorHandler = (errorEnv: Envelope<{
12
12
  type: "error";
13
13
  payload: SystemError;
14
14
  }>) => void;
15
- export declare class RuntimeApiServer {
16
- private runtimeApi;
15
+ export declare class ServerCommandHandler {
16
+ private adapter;
17
17
  private options?;
18
18
  private middlewares;
19
- constructor(runtimeApi: RuntimeApi, options?: {
19
+ constructor(adapter: ServerRuntimeAdapter, options?: {
20
20
  errorHandler?: ErrorHandler;
21
21
  logHandler?: LogHandler;
22
22
  } | undefined);
@@ -48,4 +48,4 @@ export declare class RuntimeApiServer {
48
48
  */
49
49
  private handleError;
50
50
  }
51
- //# sourceMappingURL=RuntimeApiServer.d.ts.map
51
+ //# sourceMappingURL=ServerCommandHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerCommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/server/ServerCommandHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAInE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,EACtB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,QAAQ,EAAE,QAAQ,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC,KACxD,IAAI,CAAC;AAEV,qBAAa,oBAAoB;IAI7B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO,CAAC;IAJlB,OAAO,CAAC,WAAW,CAA2B;gBAGpC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE;QAChB,YAAY,CAAC,EAAE,YAAY,CAAC;QAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB,YAAA;IAGH;;;OAGG;IACH,GAAG,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAIxC;;OAEG;IACG,aAAa,CACjB,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,EACtB,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,KAAK,IAAI,GAC5B,OAAO,CAAC,IAAI,CAAC;IAWhB;;OAEG;YACW,kBAAkB;IAgBhC;;OAEG;YACW,cAAc;IA2N5B;;OAEG;IACH,OAAO,CAAC,UAAU;IAuBlB;;;;OAIG;IACH,OAAO,CAAC,WAAW;CA6BpB"}
@@ -0,0 +1,26 @@
1
+ import type { Envelope, RuntimeEvent, RuntimeMetadata } from "@bian-womp/spark-protocol";
2
+ import { GraphBuilder, Registry, GraphRuntime, UnifiedEngine, type GraphLifecycleApi, type Engine } from "@bian-womp/spark-graph";
3
+ /**
4
+ * ServerRuntimeAdapter extends GraphLifecycleApi and Engine to provide a unified interface
5
+ * for both lifecycle and execution operations on the server side.
6
+ *
7
+ * Note: All Engine methods (including setInputs, copyOutputs, triggerExternal) already include
8
+ * the `dry` option, so no overrides are needed. Some methods are sync in implementation but
9
+ * match async signatures via wrappers.
10
+ */
11
+ export interface ServerRuntimeAdapter extends GraphLifecycleApi, Omit<Engine, "launch"> {
12
+ }
13
+ export interface ServerRuntimeAdapterContext {
14
+ registry: Registry;
15
+ builder: GraphBuilder;
16
+ graphRuntime: GraphRuntime | undefined;
17
+ engine: UnifiedEngine | undefined;
18
+ extData: {
19
+ runtime?: RuntimeMetadata;
20
+ } & Record<string, unknown>;
21
+ }
22
+ export type ServerRuntimeAdapterExtension = {
23
+ [K in keyof ServerRuntimeAdapter]?: ServerRuntimeAdapter[K] extends (...args: any[]) => any ? (original: ServerRuntimeAdapter[K], context: ServerRuntimeAdapterContext, ...args: Parameters<ServerRuntimeAdapter[K]>) => ReturnType<ServerRuntimeAdapter[K]> : never;
24
+ };
25
+ export declare function createServerRuntimeAdapter(id: string | undefined, createRegistry: (id?: string) => Promise<Registry>, send: (e: Envelope<RuntimeEvent>) => void, extensions?: ServerRuntimeAdapterExtension): Promise<ServerRuntimeAdapter>;
26
+ //# sourceMappingURL=ServerRuntimeAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerRuntimeAdapter.d.ts","sourceRoot":"","sources":["../../../../src/server/ServerRuntimeAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAIZ,eAAe,EAEhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,MAAM,EAGZ,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,WAAW,oBACf,SAAQ,iBAAiB,EACvB,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC;CAEzB;AAED,MAAM,WAAW,2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