@lifeart/async-dom 2.0.0-alpha.3

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 (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +623 -0
  3. package/dist/base.d.cts +398 -0
  4. package/dist/base.d.cts.map +1 -0
  5. package/dist/base.d.ts +398 -0
  6. package/dist/base.d.ts.map +1 -0
  7. package/dist/cli.cjs +528 -0
  8. package/dist/cli.cjs.map +1 -0
  9. package/dist/cli.d.cts +1 -0
  10. package/dist/cli.d.ts +1 -0
  11. package/dist/cli.js +493 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/debug.d.cts +145 -0
  14. package/dist/debug.d.cts.map +1 -0
  15. package/dist/debug.d.ts +145 -0
  16. package/dist/debug.d.ts.map +1 -0
  17. package/dist/index.cjs +26 -0
  18. package/dist/index.d.cts +560 -0
  19. package/dist/index.d.cts.map +1 -0
  20. package/dist/index.d.ts +560 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +5 -0
  23. package/dist/index2.d.cts +5 -0
  24. package/dist/index2.d.ts +5 -0
  25. package/dist/index3.d.cts +882 -0
  26. package/dist/index3.d.cts.map +1 -0
  27. package/dist/index3.d.ts +882 -0
  28. package/dist/index3.d.ts.map +1 -0
  29. package/dist/main-thread.cjs +5459 -0
  30. package/dist/main-thread.cjs.map +1 -0
  31. package/dist/main-thread.js +5429 -0
  32. package/dist/main-thread.js.map +1 -0
  33. package/dist/react.cjs +116 -0
  34. package/dist/react.cjs.map +1 -0
  35. package/dist/react.d.cts +91 -0
  36. package/dist/react.d.cts.map +1 -0
  37. package/dist/react.d.ts +91 -0
  38. package/dist/react.d.ts.map +1 -0
  39. package/dist/react.js +113 -0
  40. package/dist/react.js.map +1 -0
  41. package/dist/resolve-debug.cjs +24 -0
  42. package/dist/resolve-debug.cjs.map +1 -0
  43. package/dist/resolve-debug.js +19 -0
  44. package/dist/resolve-debug.js.map +1 -0
  45. package/dist/server.cjs +250 -0
  46. package/dist/server.cjs.map +1 -0
  47. package/dist/server.d.cts +127 -0
  48. package/dist/server.d.cts.map +1 -0
  49. package/dist/server.d.ts +127 -0
  50. package/dist/server.d.ts.map +1 -0
  51. package/dist/server.js +245 -0
  52. package/dist/server.js.map +1 -0
  53. package/dist/svelte.cjs +48 -0
  54. package/dist/svelte.cjs.map +1 -0
  55. package/dist/svelte.d.cts +38 -0
  56. package/dist/svelte.d.cts.map +1 -0
  57. package/dist/svelte.d.ts +38 -0
  58. package/dist/svelte.d.ts.map +1 -0
  59. package/dist/svelte.js +47 -0
  60. package/dist/svelte.js.map +1 -0
  61. package/dist/sync-channel.cjs +532 -0
  62. package/dist/sync-channel.cjs.map +1 -0
  63. package/dist/sync-channel.js +425 -0
  64. package/dist/sync-channel.js.map +1 -0
  65. package/dist/transport.cjs +213 -0
  66. package/dist/transport.cjs.map +1 -0
  67. package/dist/transport.d.cts +79 -0
  68. package/dist/transport.d.cts.map +1 -0
  69. package/dist/transport.d.ts +79 -0
  70. package/dist/transport.d.ts.map +1 -0
  71. package/dist/transport.js +202 -0
  72. package/dist/transport.js.map +1 -0
  73. package/dist/vite-plugin.cjs +112 -0
  74. package/dist/vite-plugin.cjs.map +1 -0
  75. package/dist/vite-plugin.d.cts +39 -0
  76. package/dist/vite-plugin.d.cts.map +1 -0
  77. package/dist/vite-plugin.d.ts +39 -0
  78. package/dist/vite-plugin.d.ts.map +1 -0
  79. package/dist/vite-plugin.js +107 -0
  80. package/dist/vite-plugin.js.map +1 -0
  81. package/dist/vue.cjs +123 -0
  82. package/dist/vue.cjs.map +1 -0
  83. package/dist/vue.d.cts +126 -0
  84. package/dist/vue.d.cts.map +1 -0
  85. package/dist/vue.d.ts +126 -0
  86. package/dist/vue.d.ts.map +1 -0
  87. package/dist/vue.js +120 -0
  88. package/dist/vue.js.map +1 -0
  89. package/dist/worker-thread.cjs +2751 -0
  90. package/dist/worker-thread.cjs.map +1 -0
  91. package/dist/worker-thread.js +2692 -0
  92. package/dist/worker-thread.js.map +1 -0
  93. package/dist/worker-transport.cjs +136 -0
  94. package/dist/worker-transport.cjs.map +1 -0
  95. package/dist/worker-transport.d.cts +162 -0
  96. package/dist/worker-transport.d.cts.map +1 -0
  97. package/dist/worker-transport.d.ts +162 -0
  98. package/dist/worker-transport.d.ts.map +1 -0
  99. package/dist/worker-transport.js +125 -0
  100. package/dist/worker-transport.js.map +1 -0
  101. package/dist/worker.cjs +12 -0
  102. package/dist/worker.d.cts +2 -0
  103. package/dist/worker.d.ts +2 -0
  104. package/dist/worker.js +2 -0
  105. package/dist/ws-server-transport.cjs +147 -0
  106. package/dist/ws-server-transport.cjs.map +1 -0
  107. package/dist/ws-server-transport.d.cts +64 -0
  108. package/dist/ws-server-transport.d.cts.map +1 -0
  109. package/dist/ws-server-transport.d.ts +64 -0
  110. package/dist/ws-server-transport.d.ts.map +1 -0
  111. package/dist/ws-server-transport.js +142 -0
  112. package/dist/ws-server-transport.js.map +1 -0
  113. package/dist/ws-transport.cjs +954 -0
  114. package/dist/ws-transport.cjs.map +1 -0
  115. package/dist/ws-transport.js +913 -0
  116. package/dist/ws-transport.js.map +1 -0
  117. package/package.json +145 -0
package/dist/vue.d.ts ADDED
@@ -0,0 +1,126 @@
1
+ import { v as SerializedError } from "./base.js";
2
+ import { n as DebugOptions } from "./debug.js";
3
+ import { g as SchedulerConfig, r as AsyncDomInstance } from "./index.js";
4
+ import * as vue0 from "vue";
5
+ import { PropType, Ref, ShallowRef, SlotsType } from "vue";
6
+
7
+ //#region src/vue/AsyncDom.d.ts
8
+ /** Props for the {@link AsyncDom} Vue component. */
9
+ interface AsyncDomProps {
10
+ /** Worker script path or factory function */
11
+ worker: string | (() => Worker);
12
+ /** Scheduler configuration */
13
+ scheduler?: SchedulerConfig;
14
+ /** Enable debug mode (true for defaults, or pass DebugOptions) */
15
+ debug?: DebugOptions | boolean;
16
+ }
17
+ /**
18
+ * Vue component that renders an async-dom worker application.
19
+ *
20
+ * Wraps the {@link useAsyncDom} composable in a self-contained component.
21
+ * Supports a `fallback` slot for loading state.
22
+ *
23
+ * @example
24
+ * ```vue
25
+ * <template>
26
+ * <AsyncDom worker="./app.worker.ts" @ready="onReady">
27
+ * <template #fallback>
28
+ * <p>Loading...</p>
29
+ * </template>
30
+ * </AsyncDom>
31
+ * </template>
32
+ * ```
33
+ */
34
+ declare const AsyncDom: vue0.DefineComponent<vue0.ExtractPropTypes<{
35
+ worker: {
36
+ type: PropType<string | (() => Worker)>;
37
+ required: true;
38
+ };
39
+ scheduler: {
40
+ type: PropType<SchedulerConfig>;
41
+ default: undefined;
42
+ };
43
+ debug: {
44
+ type: PropType<boolean | DebugOptions>;
45
+ default: undefined;
46
+ };
47
+ }>, () => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
48
+ [key: string]: any;
49
+ }>, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {
50
+ ready: (_instance: AsyncDomInstance) => true;
51
+ error: (_error: SerializedError) => true;
52
+ }, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
53
+ worker: {
54
+ type: PropType<string | (() => Worker)>;
55
+ required: true;
56
+ };
57
+ scheduler: {
58
+ type: PropType<SchedulerConfig>;
59
+ default: undefined;
60
+ };
61
+ debug: {
62
+ type: PropType<boolean | DebugOptions>;
63
+ default: undefined;
64
+ };
65
+ }>> & Readonly<{
66
+ onReady?: ((_instance: AsyncDomInstance) => any) | undefined;
67
+ onError?: ((_error: SerializedError) => any) | undefined;
68
+ }>, {
69
+ scheduler: SchedulerConfig;
70
+ debug: boolean | DebugOptions;
71
+ }, SlotsType<{
72
+ fallback?: Record<string, never>;
73
+ }>, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
74
+ //# sourceMappingURL=AsyncDom.d.ts.map
75
+ //#endregion
76
+ //#region src/vue/use-async-dom.d.ts
77
+ interface UseAsyncDomOptions {
78
+ /** Worker script path or factory function */
79
+ worker: string | (() => Worker);
80
+ /** Scheduler configuration */
81
+ scheduler?: SchedulerConfig;
82
+ /** Debug options (pass `true` for sensible defaults, or a `DebugOptions` object) */
83
+ debug?: DebugOptions | boolean;
84
+ /** Called when the async-dom instance is ready */
85
+ onReady?: (instance: AsyncDomInstance) => void;
86
+ /** Called when a worker error occurs */
87
+ onError?: (error: SerializedError) => void;
88
+ }
89
+ interface UseAsyncDomResult {
90
+ /** Template ref to bind to the container element */
91
+ containerRef: Ref<HTMLDivElement | null>;
92
+ /** The async-dom instance (null until ready) */
93
+ instance: ShallowRef<AsyncDomInstance | null>;
94
+ }
95
+ /**
96
+ * Vue composable that creates and manages an async-dom instance.
97
+ *
98
+ * Attaches an async-dom worker to the container element referenced by
99
+ * `containerRef`. The instance is created on `onMounted` and destroyed on
100
+ * `onBeforeUnmount`. Must be called during component setup.
101
+ *
102
+ * @param options - Configuration for the async-dom instance.
103
+ * @returns An object containing the container template ref and a shallow ref to the instance.
104
+ *
105
+ * @example
106
+ * ```vue
107
+ * <script setup lang="ts">
108
+ * import { useAsyncDom } from "@lifeart/async-dom/vue";
109
+ *
110
+ * const { containerRef, instance } = useAsyncDom({
111
+ * worker: "./my-worker.ts",
112
+ * onReady: (inst) => console.log("Ready!", inst),
113
+ * });
114
+ * </script>
115
+ *
116
+ * <template>
117
+ * <div ref="containerRef" />
118
+ * </template>
119
+ * ```
120
+ */
121
+ declare function useAsyncDom(options: UseAsyncDomOptions): UseAsyncDomResult;
122
+ //# sourceMappingURL=use-async-dom.d.ts.map
123
+
124
+ //#endregion
125
+ export { AsyncDom, type AsyncDomInstance, type AsyncDomProps, type DebugOptions, type SchedulerConfig, type SerializedError, type UseAsyncDomOptions, type UseAsyncDomResult, useAsyncDom };
126
+ //# sourceMappingURL=vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.d.ts","names":[],"sources":["../src/vue/AsyncDom.ts","../src/vue/use-async-dom.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAMiB,aAAA;;0BAEQ;EAFR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;;UA9CpB,kBAAA;;0BAEQ;;EDDR,SAAA,CAAA,ECGJ,eDHiB;EAAA;OAEL,CAAA,ECGhB,YDHgB,GAAA,OAAA;;SAIhB,CAAA,EAAA,CAAA,QAAA,ECCa,gBDDb,EAAA,GAAA,IAAA;EAAY;EAoBR,OAAA,CAAA,EAAA,CA8CX,KAAA,EC/DiB,eD+DjB,EAAA,GAAA,IAAA;;AAzCsD,UCnBvC,iBAAA,CDmBuC;;cAI5B,ECrBb,GDqBa,CCrBT,cDqBS,GAAA,IAAA,CAAA;;UAIqB,ECvBtC,UDuBsC,CCvB3B,gBDuB2B,GAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAb5B,iBCmBL,WAAA,CDnBK,OAAA,ECmBgB,kBDnBhB,CAAA,ECmBqC,iBDnBrC"}
package/dist/vue.js ADDED
@@ -0,0 +1,120 @@
1
+ import { t as resolveDebugOption } from "./resolve-debug.js";
2
+ import { defineComponent, h, onBeforeUnmount, onMounted, ref, shallowRef } from "vue";
3
+ //#region src/vue/use-async-dom.ts
4
+ /**
5
+ * Vue composable that creates and manages an async-dom instance.
6
+ *
7
+ * Attaches an async-dom worker to the container element referenced by
8
+ * `containerRef`. The instance is created on `onMounted` and destroyed on
9
+ * `onBeforeUnmount`. Must be called during component setup.
10
+ *
11
+ * @param options - Configuration for the async-dom instance.
12
+ * @returns An object containing the container template ref and a shallow ref to the instance.
13
+ *
14
+ * @example
15
+ * ```vue
16
+ * <script setup lang="ts">
17
+ * import { useAsyncDom } from "@lifeart/async-dom/vue";
18
+ *
19
+ * const { containerRef, instance } = useAsyncDom({
20
+ * worker: "./my-worker.ts",
21
+ * onReady: (inst) => console.log("Ready!", inst),
22
+ * });
23
+ * <\/script>
24
+ *
25
+ * <template>
26
+ * <div ref="containerRef" />
27
+ * </template>
28
+ * ```
29
+ */
30
+ function useAsyncDom(options) {
31
+ const containerRef = ref(null);
32
+ const instance = shallowRef(null);
33
+ let destroyed = false;
34
+ onMounted(async () => {
35
+ const el = containerRef.value;
36
+ if (!el) return;
37
+ const workerProp = options.worker;
38
+ const worker = typeof workerProp === "string" ? new Worker(new URL(workerProp, import.meta.url), { type: "module" }) : workerProp();
39
+ const { createAsyncDom } = await import("./main-thread.js").then((n) => n.n);
40
+ if (destroyed) {
41
+ worker.terminate();
42
+ return;
43
+ }
44
+ const inst = createAsyncDom({
45
+ target: el,
46
+ worker,
47
+ scheduler: options.scheduler,
48
+ debug: resolveDebugOption(options.debug)
49
+ });
50
+ inst.start();
51
+ instance.value = inst;
52
+ options.onReady?.(inst);
53
+ });
54
+ onBeforeUnmount(() => {
55
+ destroyed = true;
56
+ instance.value?.destroy();
57
+ instance.value = null;
58
+ });
59
+ return {
60
+ containerRef,
61
+ instance
62
+ };
63
+ }
64
+ //#endregion
65
+ //#region src/vue/AsyncDom.ts
66
+ /**
67
+ * Vue component that renders an async-dom worker application.
68
+ *
69
+ * Wraps the {@link useAsyncDom} composable in a self-contained component.
70
+ * Supports a `fallback` slot for loading state.
71
+ *
72
+ * @example
73
+ * ```vue
74
+ * <template>
75
+ * <AsyncDom worker="./app.worker.ts" @ready="onReady">
76
+ * <template #fallback>
77
+ * <p>Loading...</p>
78
+ * </template>
79
+ * </AsyncDom>
80
+ * </template>
81
+ * ```
82
+ */
83
+ const AsyncDom = defineComponent({
84
+ name: "AsyncDom",
85
+ props: {
86
+ worker: {
87
+ type: [String, Function],
88
+ required: true
89
+ },
90
+ scheduler: {
91
+ type: Object,
92
+ default: void 0
93
+ },
94
+ debug: {
95
+ type: [Boolean, Object],
96
+ default: void 0
97
+ }
98
+ },
99
+ emits: {
100
+ ready: (_instance) => true,
101
+ error: (_error) => true
102
+ },
103
+ slots: Object,
104
+ setup(props, { emit, slots }) {
105
+ const { containerRef, instance } = useAsyncDom({
106
+ worker: props.worker,
107
+ scheduler: props.scheduler,
108
+ debug: props.debug,
109
+ onReady: (inst) => emit("ready", inst),
110
+ onError: (err) => emit("error", err)
111
+ });
112
+ return () => {
113
+ return h("div", null, [!instance.value && slots.fallback ? slots.fallback() : null, h("div", { ref: containerRef })]);
114
+ };
115
+ }
116
+ });
117
+ //#endregion
118
+ export { AsyncDom, useAsyncDom };
119
+
120
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","names":[],"sources":["../src/vue/use-async-dom.ts","../src/vue/AsyncDom.ts"],"sourcesContent":["import { onBeforeUnmount, onMounted, type Ref, ref, type ShallowRef, shallowRef } from \"vue\";\nimport type { DebugOptions, SchedulerConfig, SerializedError } from \"../index.ts\";\nimport type { AsyncDomInstance } from \"../main-thread/index.ts\";\nimport { resolveDebugOption } from \"../shared/resolve-debug.ts\";\n\nexport interface UseAsyncDomOptions {\n\t/** Worker script path or factory function */\n\tworker: string | (() => Worker);\n\t/** Scheduler configuration */\n\tscheduler?: SchedulerConfig;\n\t/** Debug options (pass `true` for sensible defaults, or a `DebugOptions` object) */\n\tdebug?: DebugOptions | boolean;\n\t/** Called when the async-dom instance is ready */\n\tonReady?: (instance: AsyncDomInstance) => void;\n\t/** Called when a worker error occurs */\n\tonError?: (error: SerializedError) => void;\n}\n\nexport interface UseAsyncDomResult {\n\t/** Template ref to bind to the container element */\n\tcontainerRef: Ref<HTMLDivElement | null>;\n\t/** The async-dom instance (null until ready) */\n\tinstance: ShallowRef<AsyncDomInstance | null>;\n}\n\n/**\n * Vue composable that creates and manages an async-dom instance.\n *\n * Attaches an async-dom worker to the container element referenced by\n * `containerRef`. The instance is created on `onMounted` and destroyed on\n * `onBeforeUnmount`. Must be called during component setup.\n *\n * @param options - Configuration for the async-dom instance.\n * @returns An object containing the container template ref and a shallow ref to the instance.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useAsyncDom } from \"@lifeart/async-dom/vue\";\n *\n * const { containerRef, instance } = useAsyncDom({\n * worker: \"./my-worker.ts\",\n * onReady: (inst) => console.log(\"Ready!\", inst),\n * });\n * </script>\n *\n * <template>\n * <div ref=\"containerRef\" />\n * </template>\n * ```\n */\nexport function useAsyncDom(options: UseAsyncDomOptions): UseAsyncDomResult {\n\tconst containerRef = ref<HTMLDivElement | null>(null);\n\tconst instance = shallowRef<AsyncDomInstance | null>(null);\n\tlet destroyed = false;\n\n\tonMounted(async () => {\n\t\tconst el = containerRef.value;\n\t\tif (!el) return;\n\n\t\tconst workerProp = options.worker;\n\t\tconst worker =\n\t\t\ttypeof workerProp === \"string\"\n\t\t\t\t? new Worker(new URL(workerProp, import.meta.url), { type: \"module\" })\n\t\t\t\t: workerProp();\n\n\t\tconst { createAsyncDom } = await import(\"../main-thread/index.ts\");\n\n\t\tif (destroyed) {\n\t\t\tworker.terminate();\n\t\t\treturn;\n\t\t}\n\n\t\tconst inst = createAsyncDom({\n\t\t\ttarget: el,\n\t\t\tworker,\n\t\t\tscheduler: options.scheduler,\n\t\t\tdebug: resolveDebugOption(options.debug),\n\t\t});\n\t\tinst.start();\n\t\tinstance.value = inst;\n\t\toptions.onReady?.(inst);\n\t});\n\n\tonBeforeUnmount(() => {\n\t\tdestroyed = true;\n\t\tinstance.value?.destroy();\n\t\tinstance.value = null;\n\t});\n\n\treturn { containerRef, instance };\n}\n","import { defineComponent, h, type PropType, type SlotsType } from \"vue\";\nimport type { DebugOptions, SchedulerConfig, SerializedError } from \"../index.ts\";\nimport type { AsyncDomInstance } from \"../main-thread/index.ts\";\nimport { useAsyncDom } from \"./use-async-dom.ts\";\n\n/** Props for the {@link AsyncDom} Vue component. */\nexport interface AsyncDomProps {\n\t/** Worker script path or factory function */\n\tworker: string | (() => Worker);\n\t/** Scheduler configuration */\n\tscheduler?: SchedulerConfig;\n\t/** Enable debug mode (true for defaults, or pass DebugOptions) */\n\tdebug?: DebugOptions | boolean;\n}\n\n/**\n * Vue component that renders an async-dom worker application.\n *\n * Wraps the {@link useAsyncDom} composable in a self-contained component.\n * Supports a `fallback` slot for loading state.\n *\n * @example\n * ```vue\n * <template>\n * <AsyncDom worker=\"./app.worker.ts\" @ready=\"onReady\">\n * <template #fallback>\n * <p>Loading...</p>\n * </template>\n * </AsyncDom>\n * </template>\n * ```\n */\nexport const AsyncDom = defineComponent({\n\tname: \"AsyncDom\",\n\n\tprops: {\n\t\tworker: {\n\t\t\ttype: [String, Function] as PropType<string | (() => Worker)>,\n\t\t\trequired: true,\n\t\t},\n\t\tscheduler: {\n\t\t\ttype: Object as PropType<SchedulerConfig>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tdebug: {\n\t\t\ttype: [Boolean, Object] as PropType<boolean | DebugOptions>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\n\temits: {\n\t\tready: (_instance: AsyncDomInstance) => true,\n\t\terror: (_error: SerializedError) => true,\n\t},\n\n\tslots: Object as SlotsType<{\n\t\tfallback?: Record<string, never>;\n\t}>,\n\n\tsetup(props, { emit, slots }) {\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: Vue composable, not a React hook\n\t\tconst { containerRef, instance } = useAsyncDom({\n\t\t\tworker: props.worker,\n\t\t\tscheduler: props.scheduler,\n\t\t\tdebug: props.debug,\n\t\t\tonReady: (inst) => emit(\"ready\", inst),\n\t\t\tonError: (err) => emit(\"error\", err),\n\t\t});\n\n\t\treturn () => {\n\t\t\t// Fallback is rendered as a sibling before the container div to avoid\n\t\t\t// Vue's VDOM diffing from clearing the worker-rendered content inside it.\n\t\t\treturn h(\"div\", null, [\n\t\t\t\t!instance.value && slots.fallback ? slots.fallback() : null,\n\t\t\t\th(\"div\", { ref: containerRef }),\n\t\t\t]);\n\t\t};\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,YAAY,SAAgD;CAC3E,MAAM,eAAe,IAA2B,KAAK;CACrD,MAAM,WAAW,WAAoC,KAAK;CAC1D,IAAI,YAAY;AAEhB,WAAU,YAAY;EACrB,MAAM,KAAK,aAAa;AACxB,MAAI,CAAC,GAAI;EAET,MAAM,aAAa,QAAQ;EAC3B,MAAM,SACL,OAAO,eA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