@gadgetinc/substrate 0.1.0-rc.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 (181) hide show
  1. package/dist/assets/kernel.wasm +0 -0
  2. package/dist/assets/manifest.json +32 -0
  3. package/dist/assets/network-driver.js +2 -0
  4. package/dist/assets/network-driver.js.map +1 -0
  5. package/dist/assets/runtime.js +264 -0
  6. package/dist/assets/runtime.js.map +1 -0
  7. package/dist/binaries.d.ts +58 -0
  8. package/dist/binaries.d.ts.map +1 -0
  9. package/dist/boot/index.d.ts +318 -0
  10. package/dist/boot/index.d.ts.map +1 -0
  11. package/dist/index.d.ts +8 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +4589 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/kernel/bridge.d.ts +64 -0
  16. package/dist/kernel/bridge.d.ts.map +1 -0
  17. package/dist/kernel/types.d.ts +518 -0
  18. package/dist/kernel/types.d.ts.map +1 -0
  19. package/dist/kernel/wasm.d.ts +20 -0
  20. package/dist/kernel/wasm.d.ts.map +1 -0
  21. package/dist/node/assert.d.ts +99 -0
  22. package/dist/node/assert.d.ts.map +1 -0
  23. package/dist/node/async_hooks.d.ts +88 -0
  24. package/dist/node/async_hooks.d.ts.map +1 -0
  25. package/dist/node/buffer.d.ts +62 -0
  26. package/dist/node/buffer.d.ts.map +1 -0
  27. package/dist/node/child_process.d.ts +300 -0
  28. package/dist/node/child_process.d.ts.map +1 -0
  29. package/dist/node/cluster.d.ts +37 -0
  30. package/dist/node/cluster.d.ts.map +1 -0
  31. package/dist/node/constants.d.ts +306 -0
  32. package/dist/node/constants.d.ts.map +1 -0
  33. package/dist/node/crypto.d.ts +176 -0
  34. package/dist/node/crypto.d.ts.map +1 -0
  35. package/dist/node/dgram.d.ts +44 -0
  36. package/dist/node/dgram.d.ts.map +1 -0
  37. package/dist/node/diagnostics_channel.d.ts +57 -0
  38. package/dist/node/diagnostics_channel.d.ts.map +1 -0
  39. package/dist/node/dns.d.ts +278 -0
  40. package/dist/node/dns.d.ts.map +1 -0
  41. package/dist/node/domain.d.ts +21 -0
  42. package/dist/node/domain.d.ts.map +1 -0
  43. package/dist/node/events.d.ts +54 -0
  44. package/dist/node/events.d.ts.map +1 -0
  45. package/dist/node/fs/promises.d.ts +116 -0
  46. package/dist/node/fs/promises.d.ts.map +1 -0
  47. package/dist/node/fs.d.ts +536 -0
  48. package/dist/node/fs.d.ts.map +1 -0
  49. package/dist/node/http.d.ts +471 -0
  50. package/dist/node/http.d.ts.map +1 -0
  51. package/dist/node/http2.d.ts +508 -0
  52. package/dist/node/http2.d.ts.map +1 -0
  53. package/dist/node/https.d.ts +42 -0
  54. package/dist/node/https.d.ts.map +1 -0
  55. package/dist/node/inspector.d.ts +25 -0
  56. package/dist/node/inspector.d.ts.map +1 -0
  57. package/dist/node/net.d.ts +231 -0
  58. package/dist/node/net.d.ts.map +1 -0
  59. package/dist/node/os.d.ts +318 -0
  60. package/dist/node/os.d.ts.map +1 -0
  61. package/dist/node/path.d.ts +144 -0
  62. package/dist/node/path.d.ts.map +1 -0
  63. package/dist/node/process.d.ts +105 -0
  64. package/dist/node/process.d.ts.map +1 -0
  65. package/dist/node/punycode.d.ts +34 -0
  66. package/dist/node/punycode.d.ts.map +1 -0
  67. package/dist/node/querystring.d.ts +49 -0
  68. package/dist/node/querystring.d.ts.map +1 -0
  69. package/dist/node/readline.d.ts +99 -0
  70. package/dist/node/readline.d.ts.map +1 -0
  71. package/dist/node/stream.d.ts +409 -0
  72. package/dist/node/stream.d.ts.map +1 -0
  73. package/dist/node/string_decoder.d.ts +46 -0
  74. package/dist/node/string_decoder.d.ts.map +1 -0
  75. package/dist/node/timers.d.ts +79 -0
  76. package/dist/node/timers.d.ts.map +1 -0
  77. package/dist/node/tls.d.ts +159 -0
  78. package/dist/node/tls.d.ts.map +1 -0
  79. package/dist/node/trace_events.d.ts +18 -0
  80. package/dist/node/trace_events.d.ts.map +1 -0
  81. package/dist/node/tty.d.ts +67 -0
  82. package/dist/node/tty.d.ts.map +1 -0
  83. package/dist/node/url.d.ts +85 -0
  84. package/dist/node/url.d.ts.map +1 -0
  85. package/dist/node/util.d.ts +252 -0
  86. package/dist/node/util.d.ts.map +1 -0
  87. package/dist/node/v8.d.ts +134 -0
  88. package/dist/node/v8.d.ts.map +1 -0
  89. package/dist/node/vm.d.ts +89 -0
  90. package/dist/node/vm.d.ts.map +1 -0
  91. package/dist/node/wasi.d.ts +25 -0
  92. package/dist/node/wasi.d.ts.map +1 -0
  93. package/dist/node/worker_threads.d.ts +206 -0
  94. package/dist/node/worker_threads.d.ts.map +1 -0
  95. package/dist/node/ws.d.ts +110 -0
  96. package/dist/node/ws.d.ts.map +1 -0
  97. package/dist/node/zlib.d.ts +328 -0
  98. package/dist/node/zlib.d.ts.map +1 -0
  99. package/dist/persistence/opfs-store.d.ts +93 -0
  100. package/dist/persistence/opfs-store.d.ts.map +1 -0
  101. package/dist/runtime/async-function-shim.d.ts +27 -0
  102. package/dist/runtime/async-function-shim.d.ts.map +1 -0
  103. package/dist/runtime/fs-interface.d.ts +60 -0
  104. package/dist/runtime/fs-interface.d.ts.map +1 -0
  105. package/dist/runtime/index.d.ts +113 -0
  106. package/dist/runtime/index.d.ts.map +1 -0
  107. package/dist/runtime/loader.d.ts +50 -0
  108. package/dist/runtime/loader.d.ts.map +1 -0
  109. package/dist/runtime/loaders/async-transform.d.ts +40 -0
  110. package/dist/runtime/loaders/async-transform.d.ts.map +1 -0
  111. package/dist/runtime/loaders/cjs.d.ts +37 -0
  112. package/dist/runtime/loaders/cjs.d.ts.map +1 -0
  113. package/dist/runtime/loaders/detect-module-type.d.ts +21 -0
  114. package/dist/runtime/loaders/detect-module-type.d.ts.map +1 -0
  115. package/dist/runtime/loaders/esm.d.ts +140 -0
  116. package/dist/runtime/loaders/esm.d.ts.map +1 -0
  117. package/dist/runtime/loaders/source-map-registry.d.ts +43 -0
  118. package/dist/runtime/loaders/source-map-registry.d.ts.map +1 -0
  119. package/dist/runtime/loaders/source-map.d.ts +50 -0
  120. package/dist/runtime/loaders/source-map.d.ts.map +1 -0
  121. package/dist/runtime/loaders/utils.d.ts +6 -0
  122. package/dist/runtime/loaders/utils.d.ts.map +1 -0
  123. package/dist/runtime/native-globals.d.ts +24 -0
  124. package/dist/runtime/native-globals.d.ts.map +1 -0
  125. package/dist/runtime/network-driver.d.ts +78 -0
  126. package/dist/runtime/network-driver.d.ts.map +1 -0
  127. package/dist/runtime/process-context.d.ts +96 -0
  128. package/dist/runtime/process-context.d.ts.map +1 -0
  129. package/dist/runtime/process-event-loop.d.ts +356 -0
  130. package/dist/runtime/process-event-loop.d.ts.map +1 -0
  131. package/dist/runtime/process-handler.d.ts +71 -0
  132. package/dist/runtime/process-handler.d.ts.map +1 -0
  133. package/dist/runtime/process-handlers/node.d.ts +22 -0
  134. package/dist/runtime/process-handlers/node.d.ts.map +1 -0
  135. package/dist/runtime/process-handlers/npm.d.ts +20 -0
  136. package/dist/runtime/process-handlers/npm.d.ts.map +1 -0
  137. package/dist/runtime/process-handlers/npx.d.ts +11 -0
  138. package/dist/runtime/process-handlers/npx.d.ts.map +1 -0
  139. package/dist/runtime/process-handlers/pnpm.d.ts +12 -0
  140. package/dist/runtime/process-handlers/pnpm.d.ts.map +1 -0
  141. package/dist/runtime/process-handlers/shell.d.ts +24 -0
  142. package/dist/runtime/process-handlers/shell.d.ts.map +1 -0
  143. package/dist/runtime/process-handlers/yarn.d.ts +12 -0
  144. package/dist/runtime/process-handlers/yarn.d.ts.map +1 -0
  145. package/dist/runtime/process-helpers.d.ts +17 -0
  146. package/dist/runtime/process-helpers.d.ts.map +1 -0
  147. package/dist/runtime/process-manager.d.ts +87 -0
  148. package/dist/runtime/process-manager.d.ts.map +1 -0
  149. package/dist/runtime/process-scheduler.d.ts +123 -0
  150. package/dist/runtime/process-scheduler.d.ts.map +1 -0
  151. package/dist/runtime/process-waker.d.ts +24 -0
  152. package/dist/runtime/process-waker.d.ts.map +1 -0
  153. package/dist/runtime/promise.d.ts +44 -0
  154. package/dist/runtime/promise.d.ts.map +1 -0
  155. package/dist/runtime/stack-trace.d.ts +52 -0
  156. package/dist/runtime/stack-trace.d.ts.map +1 -0
  157. package/dist/runtime/wasm-package-interceptor.d.ts +141 -0
  158. package/dist/runtime/wasm-package-interceptor.d.ts.map +1 -0
  159. package/dist/runtime/web-streams.d.ts +57 -0
  160. package/dist/runtime/web-streams.d.ts.map +1 -0
  161. package/dist/runtime/websocket.d.ts +102 -0
  162. package/dist/runtime/websocket.d.ts.map +1 -0
  163. package/dist/shim/websocket-shim-inline.d.ts +9 -0
  164. package/dist/shim/websocket-shim-inline.d.ts.map +1 -0
  165. package/dist/shim/websocket-shim.d.ts +15 -0
  166. package/dist/shim/websocket-shim.d.ts.map +1 -0
  167. package/dist/sw/index.d.ts +53 -0
  168. package/dist/sw/index.d.ts.map +1 -0
  169. package/dist/utils/debug.d.ts +75 -0
  170. package/dist/utils/debug.d.ts.map +1 -0
  171. package/dist/utils/path.d.ts +20 -0
  172. package/dist/utils/path.d.ts.map +1 -0
  173. package/dist/utils/tarball.d.ts +37 -0
  174. package/dist/utils/tarball.d.ts.map +1 -0
  175. package/dist/utils/websocket-protocol.d.ts +102 -0
  176. package/dist/utils/websocket-protocol.d.ts.map +1 -0
  177. package/dist/worker/host.d.ts +14 -0
  178. package/dist/worker/host.d.ts.map +1 -0
  179. package/dist/worker/types.d.ts +209 -0
  180. package/dist/worker/types.d.ts.map +1 -0
  181. package/package.json +53 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Node.js assert module implementation for Substrate
3
+ */
4
+ export declare class AssertionError extends Error {
5
+ actual: unknown;
6
+ expected: unknown;
7
+ operator: string;
8
+ generatedMessage: boolean;
9
+ code: string;
10
+ constructor(options: {
11
+ message?: string;
12
+ actual?: unknown;
13
+ expected?: unknown;
14
+ operator?: string;
15
+ });
16
+ }
17
+ declare function fail(actual?: unknown, expected?: unknown, message?: string | Error, operator?: string): never;
18
+ declare function assert(value: unknown, message?: string | Error): asserts value;
19
+ declare function ok(value: unknown, message?: string | Error): asserts value;
20
+ declare function equal(actual: unknown, expected: unknown, message?: string | Error): void;
21
+ declare function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
22
+ declare function strictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
23
+ declare function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
24
+ declare function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
25
+ declare function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
26
+ declare function deepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
27
+ declare function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
28
+ declare function throws(block: () => void, errorOrMessage?: RegExp | Function | Error | string, message?: string): void;
29
+ declare function doesNotThrow(block: () => void, errorOrMessage?: RegExp | Function | string, message?: string): void;
30
+ declare function rejects(asyncFn: Promise<unknown> | (() => Promise<unknown>), errorOrMessage?: RegExp | Function | Error | string, message?: string): Promise<void>;
31
+ declare function doesNotReject(asyncFn: Promise<unknown> | (() => Promise<unknown>), errorOrMessage?: RegExp | Function | string, message?: string): Promise<void>;
32
+ declare function ifError(value: unknown): void;
33
+ declare function match(actual: string, regexp: RegExp, message?: string | Error): void;
34
+ declare function doesNotMatch(actual: string, regexp: RegExp, message?: string | Error): void;
35
+ declare const strict: ((value: unknown, message?: string | Error | undefined) => void) & {
36
+ AssertionError: typeof AssertionError;
37
+ fail: typeof fail;
38
+ ok: typeof ok;
39
+ equal: typeof strictEqual;
40
+ notEqual: typeof notStrictEqual;
41
+ deepEqual: typeof deepStrictEqual;
42
+ notDeepEqual: typeof notDeepStrictEqual;
43
+ strictEqual: typeof strictEqual;
44
+ notStrictEqual: typeof notStrictEqual;
45
+ deepStrictEqual: typeof deepStrictEqual;
46
+ notDeepStrictEqual: typeof notDeepStrictEqual;
47
+ throws: typeof throws;
48
+ doesNotThrow: typeof doesNotThrow;
49
+ rejects: typeof rejects;
50
+ doesNotReject: typeof doesNotReject;
51
+ ifError: typeof ifError;
52
+ match: typeof match;
53
+ doesNotMatch: typeof doesNotMatch;
54
+ strict: unknown;
55
+ };
56
+ declare const assertFn: typeof assert & {
57
+ AssertionError: typeof AssertionError;
58
+ fail: typeof fail;
59
+ ok: typeof ok;
60
+ equal: typeof equal;
61
+ notEqual: typeof notEqual;
62
+ deepEqual: typeof deepEqual;
63
+ notDeepEqual: typeof notDeepEqual;
64
+ strictEqual: typeof strictEqual;
65
+ notStrictEqual: typeof notStrictEqual;
66
+ deepStrictEqual: typeof deepStrictEqual;
67
+ notDeepStrictEqual: typeof notDeepStrictEqual;
68
+ throws: typeof throws;
69
+ doesNotThrow: typeof doesNotThrow;
70
+ rejects: typeof rejects;
71
+ doesNotReject: typeof doesNotReject;
72
+ ifError: typeof ifError;
73
+ match: typeof match;
74
+ doesNotMatch: typeof doesNotMatch;
75
+ strict: ((value: unknown, message?: string | Error | undefined) => void) & {
76
+ AssertionError: typeof AssertionError;
77
+ fail: typeof fail;
78
+ ok: typeof ok;
79
+ equal: typeof strictEqual;
80
+ notEqual: typeof notStrictEqual;
81
+ deepEqual: typeof deepStrictEqual;
82
+ notDeepEqual: typeof notDeepStrictEqual;
83
+ strictEqual: typeof strictEqual;
84
+ notStrictEqual: typeof notStrictEqual;
85
+ deepStrictEqual: typeof deepStrictEqual;
86
+ notDeepStrictEqual: typeof notDeepStrictEqual;
87
+ throws: typeof throws;
88
+ doesNotThrow: typeof doesNotThrow;
89
+ rejects: typeof rejects;
90
+ doesNotReject: typeof doesNotReject;
91
+ ifError: typeof ifError;
92
+ match: typeof match;
93
+ doesNotMatch: typeof doesNotMatch;
94
+ strict: unknown;
95
+ };
96
+ };
97
+ export { fail, ok, equal, notEqual, deepEqual, notDeepEqual, strictEqual, notStrictEqual, deepStrictEqual, notDeepStrictEqual, throws, doesNotThrow, rejects, doesNotReject, ifError, match, doesNotMatch, strict, };
98
+ export default assertFn;
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AC,IAAI,CAAC,CAuBf;AAED,iBAAe,aAAa,CAC1B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,EACpD,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,EAC3C,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,iBAAS,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAOrC;AAED,iBAAS,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAI7E;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAIpF;AAGD,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;CAoBV,CAAC;AAIH,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBZ,CAAC;AAEH,OAAO,EACL,IAAI,EACJ,EAAE,EACF,KAAK,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,YAAY,EACZ,OAAO,EACP,aAAa,EACb,OAAO,EACP,KAAK,EACL,YAAY,EACZ,MAAM,GACP,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Node.js async_hooks module implementation
3
+ *
4
+ * Provides AsyncLocalStorage and AsyncResource with real async context
5
+ * propagation across setTimeout, Promise.then, nextTick, setImmediate, etc.
6
+ *
7
+ * Context propagation works by storing a Map<AsyncLocalStorage, store> on the
8
+ * ProcessEventLoop. When callbacks are scheduled, the current context is
9
+ * captured. When callbacks execute, the captured context is restored.
10
+ */
11
+ export declare class AsyncLocalStorage<T = unknown> {
12
+ /**
13
+ * Get the current store value for this AsyncLocalStorage instance.
14
+ * Returns undefined if no store is active (not inside a .run() call).
15
+ */
16
+ getStore(): T | undefined;
17
+ /**
18
+ * Run a function with a given store value. The store is available via
19
+ * getStore() for the duration of the function and all async operations
20
+ * initiated within it (setTimeout, Promise.then, nextTick, etc.)
21
+ */
22
+ run<R>(store: T, callback: (...args: unknown[]) => R, ...args: unknown[]): R;
23
+ /**
24
+ * Run a function with no store value (exit the current storage context).
25
+ */
26
+ exit<R>(callback: (...args: unknown[]) => R, ...args: unknown[]): R;
27
+ /**
28
+ * Transition into a context where getStore() returns the given store for
29
+ * the remainder of the synchronous execution. Unlike run(), this does not
30
+ * restore the previous context when the current function returns.
31
+ */
32
+ enterWith(store: T): void;
33
+ /**
34
+ * Disable this AsyncLocalStorage instance. After calling this,
35
+ * getStore() will always return undefined.
36
+ */
37
+ disable(): void;
38
+ /**
39
+ * Capture a snapshot of the current async context and return a function
40
+ * that runs a given function within that snapshot.
41
+ */
42
+ static snapshot(): <R, TArgs extends unknown[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
43
+ /**
44
+ * Bind a function so it always runs in the current async context.
45
+ */
46
+ static bind<Func extends (...args: unknown[]) => unknown>(fn: Func): Func;
47
+ }
48
+ export declare class AsyncResource {
49
+ readonly type: string;
50
+ private _asyncContext;
51
+ constructor(type: string, _opts?: {
52
+ triggerAsyncId?: number;
53
+ requireManualDestroy?: boolean;
54
+ } | number);
55
+ /**
56
+ * Run a function within the async context captured at construction time.
57
+ */
58
+ runInAsyncScope<R>(fn: (...args: unknown[]) => R, thisArg?: unknown, ...args: unknown[]): R;
59
+ emitDestroy(): this;
60
+ asyncId(): number;
61
+ triggerAsyncId(): number;
62
+ /**
63
+ * Bind a function to run in a new AsyncResource's scope.
64
+ */
65
+ static bind<Func extends (...args: unknown[]) => unknown>(fn: Func, type?: string, thisArg?: unknown): Func;
66
+ }
67
+ interface HookCallbacks {
68
+ init?: (asyncId: number, type: string, triggerAsyncId: number, resource: object) => void;
69
+ before?: (asyncId: number) => void;
70
+ after?: (asyncId: number) => void;
71
+ destroy?: (asyncId: number) => void;
72
+ promiseResolve?: (asyncId: number) => void;
73
+ }
74
+ export declare function createHook(_callbacks: HookCallbacks): {
75
+ enable(): {
76
+ enable(): unknown;
77
+ disable(): unknown;
78
+ };
79
+ disable(): {
80
+ enable(): unknown;
81
+ disable(): unknown;
82
+ };
83
+ };
84
+ export declare function executionAsyncId(): number;
85
+ export declare function executionAsyncResource(): object;
86
+ export declare function triggerAsyncId(): number;
87
+ export {};
88
+ //# sourceMappingURL=async_hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async_hooks.d.ts","sourceRoot":"","sources":["../../src/node/async_hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,qBAAa,iBAAiB,CAAC,CAAC,GAAG,OAAO;IACxC;;;OAGG;IACH,QAAQ,IAAI,CAAC,GAAG,SAAS,CAGxB;IAED;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAO3E;IAED;;OAEG;IACH,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CASlE;IAED;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAMxB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAQd;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,KAAK,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC,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AC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,aAAa,GAAG;IACrD,MAAM,IAAI;QAAE,MAAM,IAAI,OAAO,CAAC;QAAC,OAAO,IAAI,OAAO,CAAA;KAAE,CAAC;IACpD,OAAO,IAAI;QAAE,MAAM,IAAI,OAAO,CAAC;QAAC,OAAO,IAAI,OAAO,CAAA;KAAE,CAAC;CACtD,CASA;AAMD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
@@ -0,0 +1,62 @@
1
+ type BufferEncoding = "utf8" | "utf-8" | "ascii" | "binary" | "latin1" | "hex" | "base64" | "base64url";
2
+ /**
3
+ * Buffer — a Uint8Array subclass matching Node.js semantics.
4
+ *
5
+ * Because it extends Uint8Array natively, Buffer instances work with all
6
+ * browser/native APIs (TextDecoder, fetch, postMessage, crypto.subtle, etc.)
7
+ * and `buf instanceof Uint8Array` returns true, exactly like in Node.js.
8
+ */
9
+ declare class BufferImpl extends Uint8Array {
10
+ static get [Symbol.species](): typeof Buffer;
11
+ static from(input: string | ArrayBuffer | Uint8Array | number[] | ArrayLike<number> | Buffer, encodingOrOffset?: BufferEncoding | number, length?: number): Buffer;
12
+ static alloc(size: number, fill?: number | string): Buffer;
13
+ static allocUnsafe(size: number): Buffer;
14
+ static concat(buffers: (Buffer | Uint8Array)[], totalLength?: number): Buffer;
15
+ static isBuffer(obj: unknown): obj is Buffer;
16
+ static compare(a: Buffer | Uint8Array, b: Buffer | Uint8Array): -1 | 0 | 1;
17
+ static byteLength(input: string | Buffer | ArrayBuffer | Uint8Array | ArrayBufferView, encoding?: BufferEncoding): number;
18
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
19
+ toJSON(): {
20
+ type: "Buffer";
21
+ data: number[];
22
+ };
23
+ write(string: string, offset?: number, length?: number, _encoding?: BufferEncoding): number;
24
+ copy(target: Buffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
25
+ equals(other: Buffer | Uint8Array): boolean;
26
+ compare(other: Buffer | Uint8Array): number;
27
+ indexOf(value: number | string | Uint8Array | Buffer, byteOffset?: number, _encoding?: BufferEncoding): number;
28
+ slice(start?: number, end?: number): Buffer;
29
+ subarray(start?: number, end?: number): Buffer;
30
+ private _bufferSubarray;
31
+ readUInt8(offset?: number): number;
32
+ readUInt16BE(offset?: number): number;
33
+ readUInt16LE(offset?: number): number;
34
+ readUInt32BE(offset?: number): number;
35
+ readUInt32LE(offset?: number): number;
36
+ readInt8(offset?: number): number;
37
+ readInt16BE(offset?: number): number;
38
+ readInt16LE(offset?: number): number;
39
+ readInt32BE(offset?: number): number;
40
+ readInt32LE(offset?: number): number;
41
+ readBigUInt64BE(offset?: number): bigint;
42
+ readBigUInt64LE(offset?: number): bigint;
43
+ readFloatBE(offset?: number): number;
44
+ readFloatLE(offset?: number): number;
45
+ readDoubleBE(offset?: number): number;
46
+ readDoubleLE(offset?: number): number;
47
+ writeUInt8(value: number, offset?: number): number;
48
+ writeUInt16BE(value: number, offset?: number): number;
49
+ writeUInt16LE(value: number, offset?: number): number;
50
+ writeUInt32BE(value: number, offset?: number): number;
51
+ writeUInt32LE(value: number, offset?: number): number;
52
+ writeInt8(value: number, offset?: number): number;
53
+ writeInt16BE(value: number, offset?: number): number;
54
+ writeInt16LE(value: number, offset?: number): number;
55
+ writeInt32BE(value: number, offset?: number): number;
56
+ writeInt32LE(value: number, offset?: number): number;
57
+ toUint8Array(): Uint8Array;
58
+ }
59
+ export declare const Buffer: typeof BufferImpl;
60
+ export type Buffer = BufferImpl;
61
+ export {};
62
+ //# sourceMappingURL=buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer.d.ts","sourceRoot":"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AI,UAAU,CAEzB;CACF;AAoBD,eAAO,MAAM,MAAM,EAAE,OAAO,UAYM,CAAC;AAEnC,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC"}
@@ -0,0 +1,300 @@
1
+ /**
2
+ * Node.js `child_process` Module Implementation
3
+ *
4
+ * Implements spawn, fork, exec, execFile with a command allowlist.
5
+ * Commands are routed to handlers:
6
+ * - node → new Substrate Worker context
7
+ * - npm/yarn/pnpm → our npm implementation
8
+ * - git → isomorphic-git
9
+ *
10
+ * Process management is handled by the kernel:
11
+ * - proc_spawn: register new process, get kernel PID
12
+ * - proc_exit: mark process as exited
13
+ * - proc_kill: send signal to process
14
+ */
15
+ import { Readable, Writable, type BufferEncoding } from "./stream.js";
16
+ import { Buffer } from "./buffer.js";
17
+ export interface SpawnOptions {
18
+ /** Current working directory */
19
+ cwd?: string;
20
+ /** Environment variables */
21
+ env?: Record<string, string | undefined>;
22
+ /** Argument zero (program name) */
23
+ argv0?: string;
24
+ /** stdio configuration */
25
+ stdio?: StdioOptions;
26
+ /** Detach child process */
27
+ detached?: boolean;
28
+ /** User ID */
29
+ uid?: number;
30
+ /** Group ID */
31
+ gid?: number;
32
+ /** Shell to use */
33
+ shell?: boolean | string;
34
+ /** Timeout in milliseconds */
35
+ timeout?: number;
36
+ /** Kill signal */
37
+ killSignal?: string | number;
38
+ /** Max buffer size for stdout/stderr */
39
+ maxBuffer?: number;
40
+ /** Encoding for stdout/stderr */
41
+ encoding?: BufferEncoding;
42
+ /** Windows-specific: hide console window */
43
+ windowsHide?: boolean;
44
+ /** Signal for aborting */
45
+ signal?: AbortSignal;
46
+ }
47
+ export interface ForkOptions extends Omit<SpawnOptions, "stdio" | "shell"> {
48
+ /** Execute in silent mode (no stdout/stderr) */
49
+ silent?: boolean;
50
+ /** Path to Node.js executable (ignored in Substrate) */
51
+ execPath?: string;
52
+ /** Arguments to Node.js executable */
53
+ execArgv?: string[];
54
+ /** Serialization mode for IPC */
55
+ serialization?: "json" | "advanced";
56
+ }
57
+ export interface ExecOptions extends Omit<SpawnOptions, "encoding"> {
58
+ /** Encoding for output */
59
+ encoding?: BufferEncoding | "buffer";
60
+ }
61
+ export interface ExecFileOptions extends ExecOptions {
62
+ /** Max buffer size */
63
+ maxBuffer?: number;
64
+ }
65
+ export interface SpawnSyncOptions extends SpawnOptions {
66
+ /** Input to write to stdin */
67
+ input?: string | Uint8Array | Buffer;
68
+ }
69
+ export interface SpawnSyncResult<T = Buffer> {
70
+ pid: number;
71
+ output: (T | null)[];
72
+ stdout: T;
73
+ stderr: T;
74
+ status: number | null;
75
+ signal: string | null;
76
+ error?: Error;
77
+ }
78
+ export type StdioOptions = "pipe" | "ignore" | "inherit" | ("pipe" | "ignore" | "inherit" | "ipc" | number | null | undefined)[];
79
+ export interface CommandHandler {
80
+ spawn(args: string[], options: SpawnOptions, process: ChildProcess): Promise<void>;
81
+ canHandle(command: string): boolean;
82
+ }
83
+ type EventListener = (...args: unknown[]) => void;
84
+ declare class EventEmitter {
85
+ protected _events: Map<string, Set<EventListener>>;
86
+ on(event: string, listener: EventListener): this;
87
+ once(event: string, listener: EventListener): this;
88
+ off(event: string, listener: EventListener): this;
89
+ removeListener(event: string, listener: EventListener): this;
90
+ removeAllListeners(event?: string): this;
91
+ emit(event: string, ...args: unknown[]): boolean;
92
+ listenerCount(event: string): number;
93
+ addListener(event: string, listener: EventListener): this;
94
+ }
95
+ declare class ChildProcessStdin extends Writable {
96
+ private _process;
97
+ constructor(process: ChildProcess);
98
+ _write(chunk: unknown, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
99
+ _final(callback: (error?: Error | null) => void): void;
100
+ }
101
+ /**
102
+ * Readable stream for child process stdout/stderr
103
+ *
104
+ * This stream receives data pumped from kernel pipes by the parent's event loop.
105
+ * The kernel buffers child output, and the parent periodically reads from its
106
+ * pipe fds (stdout_fd, stderr_fd) and pushes data to this stream.
107
+ *
108
+ * IMPORTANT: Data is pushed asynchronously (via the parent's setImmediate) to ensure
109
+ * that event listeners run in the parent's process context with the parent's globals.
110
+ * Without this, a parent's 'data' listener that calls console.log() would use the
111
+ * child's console (because globals are swapped during child execution), causing
112
+ * infinite recursion.
113
+ */
114
+ declare class ChildProcessOutput extends Readable {
115
+ private _pendingData;
116
+ private _flushScheduled;
117
+ private _parentPid;
118
+ constructor(parentPid: number);
119
+ _read(): void;
120
+ /** Push data received from kernel event */
121
+ pushData(data: Uint8Array | string): void;
122
+ /** Schedule async flush of pending data on the parent's event loop */
123
+ private _scheduleFlush;
124
+ /** Flush all pending data to the stream */
125
+ private _flushPendingData;
126
+ /** Signal end of stream */
127
+ pushEnd(): void;
128
+ }
129
+ /**
130
+ * ChildProcess - represents a spawned child process
131
+ *
132
+ * Events:
133
+ * - 'close' (code: number | null, signal: string | null)
134
+ * - 'exit' (code: number | null, signal: string | null)
135
+ * - 'error' (err: Error)
136
+ * - 'disconnect' ()
137
+ * - 'message' (message: unknown, sendHandle?: unknown) - for fork()
138
+ * - 'spawn' ()
139
+ */
140
+ export declare class ChildProcess extends EventEmitter {
141
+ /** Process ID (from kernel if available, otherwise local) */
142
+ readonly pid: number;
143
+ /** Command being executed */
144
+ readonly spawnfile: string;
145
+ /** Arguments passed to the command */
146
+ readonly spawnargs: string[];
147
+ /** Standard input stream */
148
+ stdin: ChildProcessStdin | null;
149
+ /** Standard output stream */
150
+ stdout: ChildProcessOutput | null;
151
+ /** Standard error stream */
152
+ stderr: ChildProcessOutput | null;
153
+ /** IPC channel connected (for fork) */
154
+ connected: boolean;
155
+ /** Exit code (null if not exited) */
156
+ exitCode: number | null;
157
+ /** Signal that terminated the process (null if not signaled) */
158
+ signalCode: string | null;
159
+ /** Whether the process has been killed */
160
+ killed: boolean;
161
+ /** Internal: has the process exited? */
162
+ private _exited;
163
+ /** Internal: has 'close' been emitted? */
164
+ private _closeEmitted;
165
+ /** Internal: whether this child process keeps the parent event loop alive */
166
+ private _refed;
167
+ /** Internal: abort controller for cleanup */
168
+ private _abortController;
169
+ /** Internal: parent process PID for event loop scheduling */
170
+ _parentPid: number;
171
+ /** Internal: parent's fd to write to child's stdin (kernel pipe) */
172
+ _stdinFd: number | null;
173
+ /** Internal: parent's fd to read from child's stdout (kernel pipe) */
174
+ _stdoutFd: number | null;
175
+ /** Internal: parent's fd to read from child's stderr (kernel pipe) */
176
+ _stderrFd: number | null;
177
+ /** Internal: stdio configuration for this child (to support inherit mode) */
178
+ _stdioCfg: ("pipe" | "ignore" | "inherit" | "ipc")[];
179
+ constructor(command: string, args: string[], pid: number, parentPid: number);
180
+ /** Set the kernel pipe fds for this child process's stdio */
181
+ _setStdioFds(stdinFd: number, stdoutFd: number, stderrFd: number): void;
182
+ /** Initialize stdio streams based on options */
183
+ _setupStdio(options: SpawnOptions): void;
184
+ /** Normalize stdio option to array format */
185
+ private _normalizeStdio;
186
+ /**
187
+ * Send a signal to the process
188
+ *
189
+ * Note: Unlike immediate termination, this sends the signal and lets the
190
+ * child process handle it. The child's signal handlers get a chance to run
191
+ * before the process exits. The exit/close events are emitted later when
192
+ * the child actually exits (handled by ProcessScheduler).
193
+ */
194
+ kill(signal?: string | number): boolean;
195
+ /**
196
+ * Send a message to the child process (for fork IPC)
197
+ */
198
+ send(message: unknown, sendHandle?: unknown, options?: {
199
+ keepOpen?: boolean;
200
+ }, callback?: (error: Error | null) => void): boolean;
201
+ /**
202
+ * Disconnect IPC channel
203
+ */
204
+ disconnect(): void;
205
+ /**
206
+ * Ref the child process, keeping the parent event loop alive.
207
+ */
208
+ ref(): this;
209
+ /**
210
+ * Unref the child process, allowing the parent event loop to exit
211
+ * without waiting for this child to finish.
212
+ */
213
+ unref(): this;
214
+ /** Called by handler when process spawns successfully */
215
+ _handleSpawn(): void;
216
+ /** Called by handler when process exits */
217
+ _handleExit(code: number | null, signal: string | null): void;
218
+ /** Emit 'close' event (only once) */
219
+ private _emitClose;
220
+ /** Called by handler on error */
221
+ _handleError(error: Error): void;
222
+ /** Called by handler for IPC messages */
223
+ _handleMessage(message: unknown, sendHandle?: unknown): void;
224
+ /** Set abort controller for cleanup */
225
+ _setAbortController(controller: AbortController): void;
226
+ }
227
+ /**
228
+ * Register a command handler
229
+ */
230
+ export declare function registerHandler(handler: CommandHandler): void;
231
+ /**
232
+ * Clear all registered handlers (for testing)
233
+ */
234
+ export declare function clearHandlers(): void;
235
+ /**
236
+ * Clear all registered processes (for testing)
237
+ */
238
+ export declare function clearProcessRegistry(): void;
239
+ /**
240
+ * Spawn a child process
241
+ *
242
+ * @param command - Command to run
243
+ * @param args - Arguments
244
+ * @param options - Spawn options
245
+ */
246
+ export declare function spawn(command: string, args?: string[] | SpawnOptions, options?: SpawnOptions): ChildProcess;
247
+ /**
248
+ * Fork a new Node.js process
249
+ *
250
+ * This is a special case of spawn() for Node.js scripts with IPC enabled.
251
+ *
252
+ * @param modulePath - Path to the module to run
253
+ * @param args - Arguments to pass to the module
254
+ * @param options - Fork options
255
+ */
256
+ export declare function fork(modulePath: string, args?: string[] | ForkOptions, options?: ForkOptions): ChildProcess;
257
+ type ExecCallback = (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void;
258
+ /**
259
+ * Execute a command in a shell
260
+ *
261
+ * @param command - Command string to execute
262
+ * @param options - Exec options
263
+ * @param callback - Callback with stdout/stderr
264
+ */
265
+ export declare function exec(command: string, options?: ExecOptions | ExecCallback, callback?: ExecCallback): ChildProcess;
266
+ /**
267
+ * Execute a file directly (without shell)
268
+ *
269
+ * @param file - File to execute
270
+ * @param args - Arguments
271
+ * @param options - Options
272
+ * @param callback - Callback with stdout/stderr
273
+ */
274
+ export declare function execFile(file: string, args?: string[] | ExecFileOptions | ExecCallback, options?: ExecFileOptions | ExecCallback, callback?: ExecCallback): ChildProcess;
275
+ /**
276
+ * Synchronous spawn - NOT RECOMMENDED
277
+ * This implementation throws as we don't support true sync operations
278
+ */
279
+ export declare function spawnSync(_command: string, _args?: string[] | SpawnSyncOptions, _options?: SpawnSyncOptions): SpawnSyncResult;
280
+ /**
281
+ * Synchronous exec - NOT RECOMMENDED
282
+ */
283
+ export declare function execSync(_command: string, _options?: ExecOptions): string | Buffer;
284
+ /**
285
+ * Synchronous execFile - NOT RECOMMENDED
286
+ */
287
+ export declare function execFileSync(_file: string, _args?: string[] | ExecFileOptions, _options?: ExecFileOptions): string | Buffer;
288
+ declare const _default: {
289
+ spawn: typeof spawn;
290
+ fork: typeof fork;
291
+ exec: typeof exec;
292
+ execFile: typeof execFile;
293
+ spawnSync: typeof spawnSync;
294
+ execSync: typeof execSync;
295
+ execFileSync: typeof execFileSync;
296
+ ChildProcess: typeof ChildProcess;
297
+ registerHandler: typeof registerHandler;
298
+ };
299
+ export default _default;
300
+ //# sourceMappingURL=child_process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child_process.d.ts","sourceRoot":"","sources":["../../src/node/child_process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAarC,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,UAAU,CAAC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M,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;AAEpG;;;;;;GAMG;AACH,wBAAgB,IAAI,CAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,WAAW,GAAG,YAAY,EACpC,QAAQ,CAAC,EAAE,YAAY,GACtB,YAAY,CAoEd;AA2CD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,eAAe,GAAG,YAAY,EAChD,OAAO,CAAC,EAAE,eAAe,GAAG,YAAY,EACxC,QAAQ,CAAC,EAAE,YAAY,GACtB,YAAY,CA4Ed;AAMD;;;GAGG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,EACnC,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,eAAe,CAEjB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAIlF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,eAAe,EAClC,QAAQ,CAAC,EAAE,eAAe,GACzB,MAAM,GAAG,MAAM,CAIjB;;;;;;;;;;;;AAMD,wBAUE"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Node.js cluster module implementation
3
+ *
4
+ * In Substrate (browser environment), clustering is not supported.
5
+ * This module reports as the primary/master process and throws on fork().
6
+ */
7
+ import { EventEmitter } from "./events.js";
8
+ export declare class Worker extends EventEmitter {
9
+ id: number;
10
+ process: unknown;
11
+ exitedAfterDisconnect: boolean;
12
+ send(_message: unknown, _sendHandle?: unknown, _options?: unknown, _callback?: (error: Error | null) => void): boolean;
13
+ kill(_signal?: string): void;
14
+ disconnect(): void;
15
+ isConnected(): boolean;
16
+ isDead(): boolean;
17
+ }
18
+ export declare const isPrimary = true;
19
+ export declare const isMaster = true;
20
+ export declare const isWorker = false;
21
+ export declare const workers: Record<number, Worker>;
22
+ export declare const settings: Record<string, unknown>;
23
+ export declare const SCHED_NONE = 1;
24
+ export declare const SCHED_RR = 2;
25
+ export declare const schedulingPolicy = 2;
26
+ export declare function fork(_env?: Record<string, string>): Worker;
27
+ export declare function disconnect(_callback?: () => void): void;
28
+ export declare function setupPrimary(_settings?: Record<string, unknown>): void;
29
+ export declare const setupMaster: typeof setupPrimary;
30
+ export declare const on: (event: string | symbol, listener: (...args: unknown[]) => void) => import("./events.js").default;
31
+ export declare const once: (event: string | symbol, listener: (...args: unknown[]) => void) => import("./events.js").default;
32
+ export declare const off: (event: string | symbol, listener: (...args: unknown[]) => void) => import("./events.js").default;
33
+ export declare const emit: (event: string | symbol, ...args: unknown[]) => boolean;
34
+ export declare const addListener: (event: string | symbol, listener: (...args: unknown[]) => void) => import("./events.js").default;
35
+ export declare const removeListener: (event: string | symbol, listener: (...args: unknown[]) => void) => import("./events.js").default;
36
+ export declare const removeAllListeners: (event?: string | symbol | undefined) => import("./events.js").default;
37
+ //# sourceMappingURL=cluster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/node/cluster.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,qBAAa,MAAO,SAAQ,YAAY;IACtC,EAAE,SAAK;IACP,OAAO,EAAE,OAAO,CAAQ;IACxB,qBAAqB,UAAS;IAE9B,IAAI,CACF,QAAQ,EAAE,OAAO,EACjB,WAAW,CAAC,EAAE,OAAO,EACrB,QAAQ,CAAC,EAAE,OAAO,EAClB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GACxC,OAAO,CAET;IAED,IA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