@brickkit/cli 0.15.0 → 0.16.0-beta.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 (86) hide show
  1. package/dashboard-dist/{CollapsiblePanel-CbUysOp5.js → CollapsiblePanel-DvJpFahB.js} +2 -2
  2. package/dashboard-dist/Geist-Variable.woff2 +0 -0
  3. package/dashboard-dist/GeistMono-Variable.woff2 +0 -0
  4. package/dashboard-dist/{api-reference-BP4ULs5J.js → api-reference-C2_JX174.js} +82 -70
  5. package/dashboard-dist/app.css +2 -2
  6. package/dashboard-dist/app.js +5 -5
  7. package/dashboard-dist/{client-CID_ep-s.js → client-DsITZplk.js} +1 -1
  8. package/dashboard-dist/{core-B123mLVe.js → core-sW89OSz5.js} +1 -1
  9. package/dashboard-dist/docs-D3U7gUWq.js +4 -0
  10. package/dashboard-dist/kit.js +1 -1
  11. package/dashboard-dist/{popover-B4rnc_po.js → popover-Bb2Q3jiK.js} +1 -1
  12. package/dist/bin.d.ts +1 -2
  13. package/dist/bin.js +6 -6
  14. package/dist/bin.js.map +1 -1
  15. package/dist/build.js.map +1 -1
  16. package/dist/client-contract-file.js +2 -1
  17. package/dist/client-contract-file.js.map +1 -1
  18. package/dist/compiler.d.ts +1 -2
  19. package/dist/config2.d.ts +1 -2
  20. package/dist/dashboard-extension.d.ts +1 -2
  21. package/dist/dashboard-host.js.map +1 -1
  22. package/dist/dashboard.d.ts +4 -4
  23. package/dist/definitions.js +1 -0
  24. package/dist/definitions.js.map +1 -1
  25. package/dist/dev-application.js.map +1 -1
  26. package/dist/dev-reporter.d.ts +1 -2
  27. package/dist/dev-reporter.js.map +1 -1
  28. package/dist/dev-telemetry.js.map +1 -1
  29. package/dist/dev-worker.js.map +1 -1
  30. package/dist/index.d.ts +1 -2
  31. package/dist/lint/oxlint.d.ts +1 -2
  32. package/dist/plugin.d.ts +1 -2
  33. package/dist/production-dashboard2.d.ts +1 -2
  34. package/dist/project.js +35 -12
  35. package/dist/project.js.map +1 -1
  36. package/dist/serve.d.ts +1 -2
  37. package/dist/serve2.js.map +1 -1
  38. package/dist/vite.d.ts +1 -2
  39. package/dist/vite.js.map +1 -1
  40. package/dist/workflows.d.ts +1 -2
  41. package/inspector-dist/client/assets/app-Wfnqu2Ic.css +4610 -0
  42. package/inspector-dist/client/assets/{dist-BK8w6xOr.js → dist-CEyPxAJU.js} +2008 -334
  43. package/inspector-dist/client/assets/{entry.client-D9jbgmTR.js → entry.client-Cszf0uLP.js} +4628 -2593
  44. package/inspector-dist/client/assets/highlighted-body-JLMTFACH-CgFt8UnP.js +41 -0
  45. package/inspector-dist/client/assets/{home-hwPlkNhv.js → home-B2m1nnIz.js} +191 -105
  46. package/inspector-dist/client/assets/{jsx-runtime-CPEah4WQ.js → jsx-runtime-DRYYXgdJ.js} +2946 -2001
  47. package/inspector-dist/client/assets/{manifest-0e76e9ac.js → manifest-cfc09adc.js} +1 -1
  48. package/inspector-dist/client/assets/mermaid-WFAXDIZX-BoRESrqm.js +1 -0
  49. package/inspector-dist/client/assets/root-CVescmwt.css +4544 -0
  50. package/inspector-dist/client/assets/{root-SLeEf-sT.js → root-CVhM1JOR.js} +3 -3
  51. package/inspector-dist/client/assets/{run-detail-DYbVkIFH.js → run-detail-BdV01jxD.js} +90 -50
  52. package/inspector-dist/client/assets/tabs-BVrPbzfI.css +66 -0
  53. package/inspector-dist/client/assets/{tabs-CaJisoyb.js → tabs-C2hdi5D4.js} +12496 -8708
  54. package/inspector-dist/client/assets/{zstd-browser-decoder-D94wmfAU.js → zstd-browser-decoder-DQWDmc2d.js} +2 -2
  55. package/inspector-dist/server/assets/{app-DGlfWVUI.js → app-w0nTXgJd.js} +51489 -51478
  56. package/inspector-dist/server/assets/{chunk-RLXIAIE6-F0SJZlei.js → chunk-7TTQLYRW-BO6_qAAU.js} +10986 -7848
  57. package/inspector-dist/server/assets/cjs-DPK66Gxq.js +3600 -0
  58. package/inspector-dist/server/assets/{dist-BCbwm6jl.js → dist-DTHqO9VA.js} +149 -1619
  59. package/inspector-dist/server/assets/{dist-Ce0I2PUv.js → dist-OLuKLJ4s.js} +8 -8
  60. package/inspector-dist/server/assets/{encryption-DdQgC8Rk.js → encryption-DMo4uOFN.js} +5 -5
  61. package/inspector-dist/server/assets/{event-metadata-n7E4zEmT.js → event-metadata-Bx8Ts484.js} +1 -1
  62. package/inspector-dist/server/assets/functions-B9XwHSzK.js +6972 -0
  63. package/inspector-dist/server/assets/{global-singleton-D8sIN5du.js → global-singleton-rNtXNHKV.js} +1 -1
  64. package/inspector-dist/server/assets/highlighted-body-JLMTFACH-B0HDNeQE.js +41 -0
  65. package/inspector-dist/server/assets/mermaid-WFAXDIZX-B-AIJZhh.js +1 -0
  66. package/inspector-dist/server/assets/serialization-DsMds3lJ.js +5716 -0
  67. package/inspector-dist/server/assets/{serialization-format-BbuGfHog.js → serialization-format-B27jSUCM.js} +30 -9
  68. package/inspector-dist/server/assets/state-resolver-DVs_zsEO.js +1422 -0
  69. package/inspector-dist/server/assets/{token-BgMmJNP5.js → token-CvvD8Y5H.js} +1 -1
  70. package/inspector-dist/server/assets/token-CxjWFNNq.js +63 -0
  71. package/inspector-dist/server/assets/token-util-D9IsWeEs.js +3 -0
  72. package/inspector-dist/server/assets/{wrapper-CIC3w0oC.js → wrapper-B_u9Z5Up.js} +58 -26
  73. package/inspector-dist/server/assets/{ws-transport-CxTYB11n.js → ws-transport-CamzQ5O8.js} +24379 -24240
  74. package/inspector-dist/server/assets/{zstd-browser-decoder-D7bCXbGg.js → zstd-browser-decoder-DlGbqUuc.js} +2 -2
  75. package/inspector-dist/server/index.js +1 -1
  76. package/package.json +21 -21
  77. package/dashboard-dist/docs-B5JrvjJm.js +0 -4
  78. package/inspector-dist/client/assets/app-CeSwVsRm.css +0 -2
  79. package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-CfRnuITN.js +0 -34
  80. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-ZDR2PNY_.js +0 -1
  81. package/inspector-dist/client/assets/root-ChBNTZd2.css +0 -2
  82. package/inspector-dist/client/assets/tabs-L5XKzOpP.css +0 -1
  83. package/inspector-dist/server/assets/functions-CNVQtbgg.js +0 -1170
  84. package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-CWRzMxYD.js +0 -34
  85. package/inspector-dist/server/assets/mermaid-3ZIDBTTL-D0v0ngVr.js +0 -1
  86. package/inspector-dist/server/assets/parse-Begau9cA.js +0 -469
@@ -0,0 +1,1422 @@
1
+ import "./encryption-DMo4uOFN.js";
2
+ import { t as globalSingleton } from "./global-singleton-rNtXNHKV.js";
3
+ // ../../node_modules/.bun/devalue@6.0.3/node_modules/devalue/src/constants.js
4
+ var MAX_ARRAY_LEN = 2 ** 32 - 1;
5
+ var MAX_ARRAY_INDEX = MAX_ARRAY_LEN - 1;
6
+ // ../../node_modules/.bun/devalue@6.0.3/node_modules/devalue/src/utils.js
7
+ var DevalueError = class extends Error {
8
+ /**
9
+ * @param {string} message
10
+ * @param {string[]} keys
11
+ * @param {any} [value] - The value that failed to be serialized
12
+ * @param {any} [root] - The root value being serialized
13
+ */
14
+ constructor(message, keys, value, root) {
15
+ super(message);
16
+ this.name = "DevalueError";
17
+ this.path = keys.join("");
18
+ this.value = value;
19
+ this.root = root;
20
+ }
21
+ };
22
+ /**
23
+ * Marks a Map key on the path being serialized. The key itself is recorded
24
+ * right after the marker, so nothing is formatted or allocated per entry.
25
+ */
26
+ var MAP_KEY = Symbol();
27
+ /**
28
+ * Formats the path recorded on the way to the value being serialized — a
29
+ * property key, an array index, or `MAP_KEY` followed by a Map key — into
30
+ * the segments a `DevalueError` joins. Only runs when an error is raised.
31
+ * @param {any[]} keys
32
+ * @param {(key: any) => string} format_map_key
33
+ * @returns {string[]}
34
+ */
35
+ function format_path(keys, format_map_key) {
36
+ /** @type {string[]} */
37
+ const path = [];
38
+ for (let i = 0; i < keys.length; i += 1) {
39
+ const segment = keys[i];
40
+ if (segment === MAP_KEY) path.push(`.get(${format_map_key(keys[++i])})`);
41
+ else if (typeof segment === "number") path.push(`[${segment}]`);
42
+ else path.push(stringify_key(segment));
43
+ }
44
+ return path;
45
+ }
46
+ var object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
47
+ /** @param {any} thing */
48
+ function is_plain_object(thing) {
49
+ const proto = Object.getPrototypeOf(thing);
50
+ return proto === Object.prototype || proto === null || Object.getPrototypeOf(proto) === null || Object.getOwnPropertyNames(proto).sort().join("\0") === object_proto_names;
51
+ }
52
+ /** @param {any} thing */
53
+ function get_type(thing) {
54
+ return Object.prototype.toString.call(thing).slice(8, -1);
55
+ }
56
+ /** @param {any} thing */
57
+ function is_buffer(thing) {
58
+ return typeof Buffer !== "undefined" && Buffer.isBuffer(thing);
59
+ }
60
+ var needs_escape = /["<\\\u0000-\u001f\u2028\u2029]/;
61
+ var json_leaves_raw = /[<\u2028\u2029]/g;
62
+ /** @type {Record<string, string>} */
63
+ var raw_escapes = {
64
+ "<": "\\u003C",
65
+ "\u2028": "\\u2028",
66
+ "\u2029": "\\u2029"
67
+ };
68
+ /** @param {string} char */
69
+ function escape_raw(char) {
70
+ return raw_escapes[char];
71
+ }
72
+ /** @param {string} str */
73
+ function stringify_string(str) {
74
+ if (!needs_escape.test(str) && str.isWellFormed()) return `"${str}"`;
75
+ return JSON.stringify(str).replace(json_leaves_raw, escape_raw);
76
+ }
77
+ var MAX_CACHED_KEY_LENGTH = 64;
78
+ /** @type {Map<string, string>} */
79
+ var quoted_keys = /* @__PURE__ */ new Map();
80
+ /** @param {string} key */
81
+ function quote_key(key) {
82
+ if (key.length > MAX_CACHED_KEY_LENGTH) return stringify_string(key);
83
+ let quoted = quoted_keys.get(key);
84
+ if (quoted === void 0) {
85
+ if (quoted_keys.size >= 1024) quoted_keys.clear();
86
+ quoted = stringify_string(key);
87
+ quoted_keys.set(key, quoted);
88
+ }
89
+ return quoted;
90
+ }
91
+ /** @param {Record<string | symbol, any>} object */
92
+ function enumerable_symbols(object) {
93
+ const symbols = Object.getOwnPropertySymbols(object);
94
+ return symbols.length === 0 ? symbols : symbols.filter((symbol) => Object.getOwnPropertyDescriptor(object, symbol)?.enumerable);
95
+ }
96
+ var is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
97
+ /** @param {string} key */
98
+ function stringify_key(key) {
99
+ return is_identifier.test(key) ? "." + key : "[" + JSON.stringify(key) + "]";
100
+ }
101
+ /** @param {number} n */
102
+ function is_valid_array_index(n) {
103
+ if (!Number.isInteger(n)) return false;
104
+ if (n < 0) return false;
105
+ if (n > MAX_ARRAY_INDEX) return false;
106
+ return true;
107
+ }
108
+ /** @param {number} n */
109
+ function is_valid_array_len(n) {
110
+ if (!Number.isInteger(n)) return false;
111
+ if (n < 0) return false;
112
+ if (n > MAX_ARRAY_LEN) return false;
113
+ return true;
114
+ }
115
+ /** @param {string} s */
116
+ function is_valid_array_index_string(s) {
117
+ if (s.length === 0) return false;
118
+ if (s.length > 1 && s.charCodeAt(0) === 48) return false;
119
+ for (let i = 0; i < s.length; i++) {
120
+ const c = s.charCodeAt(i);
121
+ if (c < 48 || c > 57) return false;
122
+ }
123
+ return is_valid_array_index(+s);
124
+ }
125
+ /**
126
+ * Returns the length of the leading run of valid array indices in `keys`.
127
+ * @param {readonly string[]} keys
128
+ */
129
+ function array_index_cut(keys) {
130
+ for (var i = keys.length - 1; i >= 0; i--) if (is_valid_array_index_string(keys[i])) break;
131
+ return i + 1;
132
+ }
133
+ /**
134
+ * Finds the populated indices of an array.
135
+ * @param {unknown[]} array
136
+ */
137
+ function valid_array_indices(array) {
138
+ const keys = Object.keys(array);
139
+ keys.length = array_index_cut(keys);
140
+ return keys;
141
+ }
142
+ // ../../node_modules/.bun/devalue@6.0.3/node_modules/devalue/src/base64.js
143
+ /** @type {(array_buffer: ArrayBuffer) => string} */
144
+ function encode_native(array_buffer) {
145
+ return new Uint8Array(array_buffer).toBase64();
146
+ }
147
+ /** @type {(base64: string) => ArrayBuffer} */
148
+ function decode_native(base64) {
149
+ return Uint8Array.fromBase64(base64).buffer;
150
+ }
151
+ /** @type {(array_buffer: ArrayBuffer) => string} */
152
+ function encode_buffer(array_buffer) {
153
+ return Buffer.from(array_buffer).toString("base64");
154
+ }
155
+ /** @type {(base64: string) => ArrayBuffer} */
156
+ function decode_buffer(base64) {
157
+ return Uint8Array.from(Buffer.from(base64, "base64")).buffer;
158
+ }
159
+ /** @type {(array_buffer: ArrayBuffer) => string} */
160
+ function encode_legacy(array_buffer) {
161
+ const array = new Uint8Array(array_buffer);
162
+ let binary = "";
163
+ const chunk_size = 32768;
164
+ for (let i = 0; i < array.length; i += chunk_size) {
165
+ const chunk = array.subarray(i, i + chunk_size);
166
+ binary += String.fromCharCode.apply(null, chunk);
167
+ }
168
+ return btoa(binary);
169
+ }
170
+ /** @type {(base64: string) => ArrayBuffer} */
171
+ function decode_legacy(base64) {
172
+ const binary_string = atob(base64);
173
+ const len = binary_string.length;
174
+ const array = new Uint8Array(len);
175
+ for (let i = 0; i < len; i++) array[i] = binary_string.charCodeAt(i);
176
+ return array.buffer;
177
+ }
178
+ var native = typeof Uint8Array.fromBase64 === "function";
179
+ var buffer = typeof process === "object" && process.versions?.node !== void 0;
180
+ var encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
181
+ var decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
182
+ // ../../node_modules/.bun/devalue@6.0.3/node_modules/devalue/src/operations.js
183
+ /**
184
+ * Merges caller-provided operation overrides over the defaults. Iterating the
185
+ * default keys (rather than the override's own keys) means nullish members
186
+ * fall back to the default, and inherited members — e.g. from a class
187
+ * instance — are picked up.
188
+ *
189
+ * @template {Record<string, any>} T
190
+ * @param {T} defaults
191
+ * @param {Partial<T> | undefined} overrides
192
+ * @returns {T}
193
+ */
194
+ function merge_operations(defaults, overrides) {
195
+ if (!overrides) return defaults;
196
+ const merged = {};
197
+ for (const key of Object.keys(defaults)) merged[key] = overrides[key] ?? defaults[key];
198
+ return merged;
199
+ }
200
+ /** @type {{ kind: 'not-plain' }} */
201
+ var NOT_PLAIN = /* @__PURE__ */ Object.freeze({ kind: "not-plain" });
202
+ /** @type {{ kind: 'symbol-keys' }} */
203
+ var SYMBOL_KEYS = /* @__PURE__ */ Object.freeze({ kind: "symbol-keys" });
204
+ var default_stringify_operations = /* @__PURE__ */ Object.freeze({
205
+ identify: (value) => value,
206
+ typeOf: (value) => value === null ? "null" : typeof value,
207
+ toPrimitive: (value) => value,
208
+ tagOf: (value) => get_type(value),
209
+ isThenable: (value) => typeof value.then === "function",
210
+ toPromise: (thenable) => Promise.resolve(thenable),
211
+ unbox: (boxed) => boxed.valueOf(),
212
+ toISOString: (date) => isNaN(date.getDate()) ? "" : date.toISOString(),
213
+ toStringValue: (value) => value.toString(),
214
+ regExpInfo: (regexp) => ({
215
+ source: regexp.source,
216
+ flags: regexp.flags
217
+ }),
218
+ valuesOf: (set) => set,
219
+ entriesOf: (map) => map,
220
+ viewInfo: (view) => {
221
+ if (is_buffer(view)) view = new Uint8Array(view);
222
+ return {
223
+ buffer: view.buffer,
224
+ byteOffset: view.byteOffset,
225
+ byteLength: view.byteLength,
226
+ length: view.length,
227
+ bufferByteLength: view.buffer.byteLength
228
+ };
229
+ },
230
+ toArrayBuffer: (buffer) => buffer,
231
+ lengthOf: (array) => array.length,
232
+ hasOwn: (value, key) => Object.hasOwn(value, key),
233
+ indicesOf: (array) => valid_array_indices(array),
234
+ shapeOf: (value) => {
235
+ if (!is_plain_object(value)) return NOT_PLAIN;
236
+ if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
237
+ return {
238
+ kind: Object.getPrototypeOf(value) === null ? "null-proto" : "plain",
239
+ keys: Object.keys(value)
240
+ };
241
+ },
242
+ get: (value, key) => value[key]
243
+ });
244
+ var array_buffer_byte_length = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")?.get;
245
+ var shared_array_buffer_byte_length = typeof SharedArrayBuffer === "undefined" ? void 0 : Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength")?.get;
246
+ var default_parse_operations = /* @__PURE__ */ Object.freeze({
247
+ fromPrimitive: (primitive) => primitive,
248
+ fromISOString: (iso) => new Date(iso),
249
+ fromStringValue: (tag, text) => {
250
+ if (tag === "URL") return new URL(text);
251
+ if (tag === "URLSearchParams") return new URLSearchParams(text);
252
+ return Temporal[tag.slice(9)].from(text);
253
+ },
254
+ fromArrayBuffer: (buffer) => buffer,
255
+ fromRegExpInfo: (source, flags) => new RegExp(source, flags),
256
+ fromViewInfo: (tag, buffer, byteOffset, length) => {
257
+ try {
258
+ array_buffer_byte_length.call(buffer);
259
+ } catch (error) {
260
+ if (!shared_array_buffer_byte_length) throw error;
261
+ shared_array_buffer_byte_length.call(buffer);
262
+ }
263
+ const Constructor = globalThis[tag];
264
+ return byteOffset !== void 0 ? new Constructor(buffer, byteOffset, length) : new Constructor(buffer);
265
+ },
266
+ box: (value) => Object(value),
267
+ createArray: (length) => new Array(length),
268
+ createSparseArray: (length) => {
269
+ /** @type {any[]} */
270
+ const array = [];
271
+ array[MAX_ARRAY_INDEX] = void 0;
272
+ delete array[MAX_ARRAY_INDEX];
273
+ array.length = length;
274
+ return array;
275
+ },
276
+ createObject: () => ({}),
277
+ createNullPrototypeObject: () => Object.create(null),
278
+ createSet: () => /* @__PURE__ */ new Set(),
279
+ createMap: () => /* @__PURE__ */ new Map(),
280
+ set: (target, key, value) => {
281
+ target[key] = value;
282
+ },
283
+ addValue: (set, value) => {
284
+ set.add(value);
285
+ },
286
+ addEntry: (map, key, value) => {
287
+ map.set(key, value);
288
+ }
289
+ });
290
+ // ../../node_modules/.bun/devalue@6.0.3/node_modules/devalue/src/parse.js
291
+ function invalid() {
292
+ throw new Error("Invalid input");
293
+ }
294
+ /**
295
+ * Revive a value serialized with `devalue.stringify`
296
+ * @param {string} serialized
297
+ * @param {Record<string, (value: any) => any>} [revivers]
298
+ * @param {import('./types.js').ParseOptions} [options]
299
+ */
300
+ function parse(serialized, revivers, options) {
301
+ return unflatten(JSON.parse(serialized), revivers, options);
302
+ }
303
+ /**
304
+ * Revive a value flattened with `devalue.stringify`
305
+ * @param {number | any[]} parsed
306
+ * @param {Record<string, (value: any) => any>} [revivers]
307
+ * @param {import('./types.js').ParseOptions} [options]
308
+ */
309
+ function unflatten(parsed, revivers, options) {
310
+ /** @type {import('./types.js').ParseOperations} */
311
+ const ops = merge_operations(default_parse_operations, options?.operations);
312
+ if (typeof parsed === "number") return hydrate(parsed, true);
313
+ if (!Array.isArray(parsed) || parsed.length === 0) invalid();
314
+ const values = parsed;
315
+ const hydrated = Array(values.length);
316
+ /**
317
+ * A set of values currently being hydrated with custom revivers,
318
+ * used to detect invalid cyclical dependencies
319
+ * @type {Set<number> | null}
320
+ */
321
+ let hydrating = null;
322
+ /**
323
+ * @param {number} index
324
+ * @returns {any}
325
+ */
326
+ function get_raw(index) {
327
+ if (!is_valid_array_index(index) || index >= values.length) invalid();
328
+ return values[index];
329
+ }
330
+ /**
331
+ * @param {number} index
332
+ * @returns {any}
333
+ */
334
+ function hydrate(index, standalone = false) {
335
+ if (index === -1) return ops.fromPrimitive(void 0);
336
+ if (index === -3) return ops.fromPrimitive(NaN);
337
+ if (index === -4) return ops.fromPrimitive(Infinity);
338
+ if (index === -5) return ops.fromPrimitive(-Infinity);
339
+ if (index === -6) return ops.fromPrimitive(-0);
340
+ if (standalone || typeof index !== "number") invalid();
341
+ if (index in hydrated) return hydrated[index];
342
+ if (index >= values.length) invalid();
343
+ const value = values[index];
344
+ if (!value || typeof value !== "object") hydrated[index] = ops.fromPrimitive(value);
345
+ else if (Array.isArray(value)) {
346
+ if (typeof value[0] === "string") {
347
+ const type = value[0];
348
+ const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
349
+ if (reviver) {
350
+ let i = value[1];
351
+ if (typeof i !== "number") i = values.push(value[1]) - 1;
352
+ if (Object.hasOwn(hydrated, i)) return hydrated[index] = reviver(hydrated[i]);
353
+ hydrating ??= /* @__PURE__ */ new Set();
354
+ if (hydrating.has(i)) throw new Error("Invalid circular reference");
355
+ hydrating.add(i);
356
+ hydrated[index] = reviver(hydrate(i));
357
+ hydrating.delete(i);
358
+ return hydrated[index];
359
+ }
360
+ switch (type) {
361
+ case "Date":
362
+ hydrated[index] = ops.fromISOString(value[1]);
363
+ break;
364
+ case "Set":
365
+ const set = ops.createSet();
366
+ hydrated[index] = set;
367
+ for (let i = 1; i < value.length; i += 1) ops.addValue(set, hydrate(value[i]));
368
+ break;
369
+ case "Map":
370
+ const map = ops.createMap();
371
+ hydrated[index] = map;
372
+ for (let i = 1; i < value.length; i += 2) ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
373
+ break;
374
+ case "RegExp":
375
+ hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
376
+ break;
377
+ case "Object": {
378
+ const wrapped_index = value[1];
379
+ if (!(wrapped_index === -3 || wrapped_index === -4 || wrapped_index === -5 || wrapped_index === -6)) {
380
+ const wrapped = get_raw(wrapped_index);
381
+ const is_bigint = Array.isArray(wrapped) && wrapped[0] === "BigInt";
382
+ if ((wrapped === void 0 || typeof wrapped === "object") && !is_bigint) invalid();
383
+ }
384
+ hydrated[index] = ops.box(hydrate(wrapped_index));
385
+ break;
386
+ }
387
+ case "BigInt":
388
+ hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
389
+ break;
390
+ case "null":
391
+ const obj = ops.createNullPrototypeObject();
392
+ hydrated[index] = obj;
393
+ for (let i = 1; i < value.length; i += 2) {
394
+ const key = value[i];
395
+ if (typeof key !== "string") throw new Error("Cannot parse an object with a non-string key");
396
+ if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
397
+ ops.set(obj, key, hydrate(value[i + 1]));
398
+ }
399
+ break;
400
+ case "Int8Array":
401
+ case "Uint8Array":
402
+ case "Uint8ClampedArray":
403
+ case "Int16Array":
404
+ case "Uint16Array":
405
+ case "Float16Array":
406
+ case "Int32Array":
407
+ case "Uint32Array":
408
+ case "Float32Array":
409
+ case "Float64Array":
410
+ case "BigInt64Array":
411
+ case "BigUint64Array":
412
+ case "DataView": {
413
+ const buffer_index = value[1];
414
+ const raw = get_raw(buffer_index);
415
+ if (!Array.isArray(raw) || raw[0] !== "ArrayBuffer") invalid();
416
+ const buffer = hydrate(buffer_index);
417
+ hydrated[index] = ops.fromViewInfo(type, buffer, value[2], value[3]);
418
+ break;
419
+ }
420
+ case "ArrayBuffer": {
421
+ const base64 = value[1];
422
+ if (typeof base64 !== "string") throw new Error("Invalid ArrayBuffer encoding");
423
+ hydrated[index] = ops.fromArrayBuffer(decode64(base64));
424
+ break;
425
+ }
426
+ case "URL":
427
+ case "URLSearchParams":
428
+ case "Temporal.Duration":
429
+ case "Temporal.Instant":
430
+ case "Temporal.PlainDate":
431
+ case "Temporal.PlainTime":
432
+ case "Temporal.PlainDateTime":
433
+ case "Temporal.PlainMonthDay":
434
+ case "Temporal.PlainYearMonth":
435
+ case "Temporal.ZonedDateTime":
436
+ hydrated[index] = ops.fromStringValue(type, value[1]);
437
+ break;
438
+ default: throw new Error(`Unknown type ${type}`);
439
+ }
440
+ } else if (value[0] === -7) {
441
+ const len = value[1];
442
+ if (!is_valid_array_len(len)) invalid();
443
+ const array = ops.createSparseArray(len);
444
+ hydrated[index] = array;
445
+ for (let i = 2; i < value.length; i += 2) {
446
+ const idx = value[i];
447
+ if (!is_valid_array_index(idx) || idx >= len) invalid();
448
+ ops.set(array, idx, hydrate(value[i + 1]));
449
+ }
450
+ } else {
451
+ const array = ops.createArray(value.length);
452
+ hydrated[index] = array;
453
+ for (let i = 0; i < value.length; i += 1) {
454
+ const n = value[i];
455
+ if (n === -2) continue;
456
+ ops.set(array, i, hydrate(n));
457
+ }
458
+ }
459
+ } else {
460
+ const object = ops.createObject();
461
+ hydrated[index] = object;
462
+ for (const key of Object.keys(value)) {
463
+ if (key === "__proto__") throw new Error("Cannot parse an object with a `__proto__` property");
464
+ ops.set(object, key, hydrate(value[key]));
465
+ }
466
+ }
467
+ return hydrated[index];
468
+ }
469
+ return hydrate(0);
470
+ }
471
+ // ../../node_modules/.bun/@workflow+core@5.5.0+5f46f5d62fa32f36/node_modules/@workflow/core/dist/state.js
472
+ /**
473
+ * Internal: finding and applying changes between two versions of a frozen
474
+ * value, for storing state passed between steps by reference (see
475
+ * `serialization/state-refs.ts`).
476
+ *
477
+ * A frozen value can't change, so an object that appears in both versions is
478
+ * unchanged and needs no comparison. Changes are recorded in Workflow's own
479
+ * format, which is stored in the event log and never depends on immer.
480
+ */
481
+ /** @internal */
482
+ function isPlainObject(value) {
483
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
484
+ const proto = Object.getPrototypeOf(value);
485
+ return proto === null || Object.getPrototypeOf(proto) === null;
486
+ }
487
+ /**
488
+ * Whether two plain objects are the same kind: both null-prototype
489
+ * dictionaries, or both ordinary objects. Not the prototypes themselves: an
490
+ * object made in workflow code has the workflow VM's `Object.prototype`, one
491
+ * revived from a step output the host's.
492
+ */
493
+ function sameKind(a, b) {
494
+ return Object.getPrototypeOf(a) === null === (Object.getPrototypeOf(b) === null);
495
+ }
496
+ /**
497
+ * @internal
498
+ * Whether two state values hold the same data: identical, or equal plain
499
+ * objects, arrays, dates and byte arrays. Lets a recipe return rebuilt copies
500
+ * without every copied subtree counting as a change.
501
+ */
502
+ function sameState(a, b) {
503
+ if (Object.is(a, b)) return true;
504
+ if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
505
+ if (a instanceof Uint8Array && b instanceof Uint8Array) return a.length === b.length && a.every((byte, i) => byte === b[i]);
506
+ if (Array.isArray(a) && Array.isArray(b)) {
507
+ if (a.length !== b.length) return false;
508
+ for (let i = 0; i < a.length; i++) if (i in a !== i in b || !sameState(a[i], b[i])) return false;
509
+ return true;
510
+ }
511
+ if (isPlainObject(a) && isPlainObject(b)) {
512
+ const keys = Object.keys(a);
513
+ const otherKeys = Object.keys(b);
514
+ return sameKind(a, b) && keys.length === otherKeys.length && keys.every((k, i) => otherKeys[i] === k && sameState(a[k], b[k]));
515
+ }
516
+ return false;
517
+ }
518
+ /**
519
+ * @internal
520
+ * The changes from `base` to `next`, found by identity: immer shares every
521
+ * unchanged subtree, so only changed paths are visited. An array that only grew
522
+ * at the end becomes one `append`; any other array change replaces the array.
523
+ */
524
+ function diffState(base, next, path = [], out = []) {
525
+ if (Object.is(base, next)) return out;
526
+ if (Array.isArray(base) && Array.isArray(next)) {
527
+ if (hasHoles(base) || hasHoles(next)) {
528
+ out.push({
529
+ op: "set",
530
+ path,
531
+ value: next
532
+ });
533
+ return out;
534
+ }
535
+ if (next.length >= base.length && base.every((value, i) => sameState(value, next[i]))) {
536
+ if (next.length > base.length) out.push({
537
+ op: "append",
538
+ path,
539
+ items: next.slice(base.length)
540
+ });
541
+ } else if (next.length === base.length) for (let i = 0; i < next.length; i++) diffState(base[i], next[i], [...path, i], out);
542
+ else out.push({
543
+ op: "set",
544
+ path,
545
+ value: next
546
+ });
547
+ return out;
548
+ }
549
+ if (isPlainObject(base) && isPlainObject(next) && sameKind(base, next)) {
550
+ const baseKeys = Object.keys(base);
551
+ const nextKeys = Object.keys(next);
552
+ for (const key of baseKeys) if (!Object.hasOwn(next, key)) out.push({
553
+ op: "del",
554
+ path: [...path, key]
555
+ });
556
+ for (const key of nextKeys) if (!Object.hasOwn(base, key)) out.push({
557
+ op: "set",
558
+ path: [...path, key],
559
+ value: next[key]
560
+ });
561
+ else diffState(base[key], next[key], [...path, key], out);
562
+ if ([...baseKeys.filter((key) => Object.hasOwn(next, key)), ...nextKeys.filter((key) => !Object.hasOwn(base, key))].some((key, index) => key !== nextKeys[index])) out.push({
563
+ op: "order",
564
+ path,
565
+ keys: nextKeys
566
+ });
567
+ return out;
568
+ }
569
+ if (!sameState(base, next)) out.push({
570
+ op: "set",
571
+ path,
572
+ value: next
573
+ });
574
+ return out;
575
+ }
576
+ function hasHoles(array) {
577
+ for (let i = 0; i < array.length; i++) if (!(i in array)) return true;
578
+ return false;
579
+ }
580
+ /** @internal */
581
+ function opsBytes(ops) {
582
+ try {
583
+ return JSON.stringify(ops)?.length ?? 0;
584
+ } catch {
585
+ return Number.MAX_SAFE_INTEGER;
586
+ }
587
+ }
588
+ /**
589
+ * Plain-object state may have own properties named `__proto__`, `constructor`
590
+ * or `prototype`. Reading only own properties and writing with
591
+ * `defineProperty` keeps them ordinary data and never reaches a prototype.
592
+ */
593
+ function ownValue(object, key) {
594
+ return Object.hasOwn(object, key) ? object[key] : void 0;
595
+ }
596
+ function setOwn(object, key, value) {
597
+ Object.defineProperty(object, key, {
598
+ value,
599
+ enumerable: true,
600
+ writable: true,
601
+ configurable: true
602
+ });
603
+ }
604
+ function copyObject(object) {
605
+ const copy = Object.getPrototypeOf(object) === null ? Object.create(null) : {};
606
+ for (const key of Object.keys(object)) setOwn(copy, key, object[key]);
607
+ return copy;
608
+ }
609
+ /** Copies only the containers on each changed path; everything else stays shared. */
610
+ function updateIn(value, path, at, update) {
611
+ if (at === path.length) return update(value);
612
+ const key = path[at];
613
+ if (Array.isArray(value)) {
614
+ const copy = value.slice();
615
+ copy[Number(key)] = updateIn(value[Number(key)], path, at + 1, update);
616
+ return copy;
617
+ }
618
+ if (!isPlainObject(value)) throw new Error("State change does not match its base");
619
+ const copy = copyObject(value);
620
+ setOwn(copy, String(key), updateIn(ownValue(value, String(key)), path, at + 1, update));
621
+ return copy;
622
+ }
623
+ /** @internal */
624
+ function applyStateOps(base, ops) {
625
+ let value = base;
626
+ for (const change of ops) if (change.op === "set") value = updateIn(value, change.path, 0, () => change.value);
627
+ else if (change.op === "append") value = updateIn(value, change.path, 0, (array) => {
628
+ if (!Array.isArray(array)) throw new Error("State append does not match its base");
629
+ return [...array, ...change.items];
630
+ });
631
+ else if (change.op === "order") value = updateIn(value, change.path, 0, (object) => {
632
+ if (!isPlainObject(object) || change.keys.length !== Object.keys(object).length || !change.keys.every((key) => Object.hasOwn(object, key))) throw new Error("State key order does not match its base");
633
+ const copy = Object.getPrototypeOf(object) === null ? Object.create(null) : {};
634
+ for (const key of change.keys) setOwn(copy, key, object[key]);
635
+ return copy;
636
+ });
637
+ else {
638
+ const parent = change.path.slice(0, -1);
639
+ const key = change.path[change.path.length - 1];
640
+ value = updateIn(value, parent, 0, (object) => {
641
+ if (!isPlainObject(object)) throw new Error("State delete does not match its base");
642
+ const copy = copyObject(object);
643
+ delete copy[String(key)];
644
+ return copy;
645
+ });
646
+ }
647
+ return value;
648
+ }
649
+ // ../../node_modules/.bun/@workflow+core@5.5.0+5f46f5d62fa32f36/node_modules/@workflow/core/dist/serialization/state-refs.js
650
+ /**
651
+ * Stores frozen values passed between steps by reference.
652
+ *
653
+ * A deeply frozen plain value (for example a result of immer's `produce`)
654
+ * can't change, so Workflow can tell what it already holds by identity. It is
655
+ * written as a reference when it is a version this invocation knows, as only
656
+ * its change from the known version its unchanged objects belong to, and
657
+ * whole otherwise. Long strings that already arrived in a
658
+ * hook payload or the run input are written as references to that payload.
659
+ * Readers rebuild values from the run's own log, so nothing refers outside it.
660
+ *
661
+ * Only versions a reader of the log can see are referenceable: step outputs,
662
+ * and the hook payloads and run input registered with `addSource`. Step inputs
663
+ * are never read back (replay and recovery skip them), so the versions a step
664
+ * input carries are not remembered on either side.
665
+ *
666
+ * Hook payloads and run inputs keep their usual format. Each reader knows the
667
+ * event a payload came from and registers its strings under that event's id
668
+ * (see `stateSourceId`), so a runtime without this module reads them as before.
669
+ */
670
+ var STATE_REF_REDUCER = "StateRefV1";
671
+ var STATE_SOURCE_REDUCER = "StateSrcV1";
672
+ /**
673
+ * A value is written whole again once its changes since the last whole copy
674
+ * pass this many bytes and half the value's size (for a growing value: each
675
+ * time it doubles), or after {@link SNAPSHOT_MAX_RECORDS} changes. That bounds
676
+ * how much of the log a rebuild applies to about twice the value's size, and
677
+ * adds whole copies totalling about twice its final size.
678
+ */
679
+ var SNAPSHOT_MIN_BYTES = 65536;
680
+ var SNAPSHOT_MAX_RECORDS = 1e3;
681
+ /** Shorter strings are not worth a reference. */
682
+ var SOURCE_STRING_MIN = 128;
683
+ var MAX_ID = 256;
684
+ var MAX_PATH = 64;
685
+ var MAX_DEPTH = 256;
686
+ /** How many recent step-input versions a new value is compared with by value. */
687
+ var MAX_RECENT_INPUTS = 4;
688
+ /**
689
+ * A record refers to a version, base or source this context has not seen: the
690
+ * log it was rebuilt from is missing what the writer saw.
691
+ */
692
+ var WorkflowStateMissingError = class extends Error {
693
+ name = "WorkflowStateMissingError";
694
+ };
695
+ /**
696
+ * Set on a step input by a workflow that reads state records (the Node VM
697
+ * engine). A step writes records only when its input has it: the run's
698
+ * workflow reads the step's output, and a QuickJS workflow can't read them,
699
+ * whatever the step process's own `WORKFLOW_VM` says.
700
+ */
701
+ var STATE_REFS_FIELD = "stateRefs";
702
+ /** The id a reader registers a payload's strings under (see `addSource`). */
703
+ function stateSourceId(event) {
704
+ if (event === "run-input") return "run";
705
+ return event.eventType === "hook_received" && event.eventId ? `hook:${event.eventId}` : void 0;
706
+ }
707
+ /** A string in a state change that is stored in a hook payload or run input instead. */
708
+ var StateSourceRef = class {
709
+ id;
710
+ path;
711
+ constructor(id, path) {
712
+ this.id = id;
713
+ this.path = path;
714
+ }
715
+ };
716
+ var OPAQUE = Symbol.for("@workflow/core//state-refs-opaque");
717
+ /**
718
+ * Tags devalue decodes itself and Workflow's reducers never write, such as
719
+ * `null` for null-prototype objects or a `Float16Array`. Recovery leaves them
720
+ * to devalue; only unknown custom types become placeholders.
721
+ */
722
+ var DEVALUE_BUILTIN_TAGS = /* @__PURE__ */ new Set([
723
+ "null",
724
+ "Object",
725
+ "DataView",
726
+ "Float16Array",
727
+ "Temporal.Duration",
728
+ "Temporal.Instant",
729
+ "Temporal.PlainDate",
730
+ "Temporal.PlainTime",
731
+ "Temporal.PlainDateTime",
732
+ "Temporal.PlainMonthDay",
733
+ "Temporal.PlainYearMonth",
734
+ "Temporal.ZonedDateTime"
735
+ ]);
736
+ function base64Bytes(value) {
737
+ const text = globalThis.atob(value === "." ? "" : value);
738
+ const bytes = new Uint8Array(text.length);
739
+ for (let i = 0; i < text.length; i++) bytes[i] = text.charCodeAt(i);
740
+ return bytes.buffer;
741
+ }
742
+ var typedArray = (Ctor) => (value) => new Ctor(base64Bytes(value));
743
+ /**
744
+ * Plain data types in the formats Workflow's own reducers write them, decoded
745
+ * without Node built-ins, so state rebuilds the same way in a browser.
746
+ * Callers' revivers take precedence.
747
+ */
748
+ var VALUE_REVIVERS = {
749
+ ArrayBuffer: base64Bytes,
750
+ BigInt: (value) => BigInt(value),
751
+ BigInt64Array: typedArray(BigInt64Array),
752
+ BigUint64Array: typedArray(BigUint64Array),
753
+ DataViewBytes: typedArray(DataView),
754
+ Date: (value) => new Date(value),
755
+ Float32Array: typedArray(Float32Array),
756
+ Float64Array: typedArray(Float64Array),
757
+ Int8Array: typedArray(Int8Array),
758
+ Int16Array: typedArray(Int16Array),
759
+ Int32Array: typedArray(Int32Array),
760
+ Map: (value) => new Map(value),
761
+ RegExp: (value) => new RegExp(value.source, value.flags),
762
+ Set: (value) => new Set(value),
763
+ URL: (value) => new URL(value),
764
+ URLSearchParams: (value) => new URLSearchParams(value === "." ? "" : value),
765
+ Uint8Array: typedArray(Uint8Array),
766
+ Uint8ClampedArray: typedArray(Uint8ClampedArray),
767
+ Uint16Array: typedArray(Uint16Array),
768
+ Uint32Array: typedArray(Uint32Array)
769
+ };
770
+ function deepFreeze(value) {
771
+ if (!value || typeof value !== "object" || Object.isFrozen(value)) return;
772
+ if (ArrayBuffer.isView(value)) return;
773
+ Object.freeze(value);
774
+ for (const key of Object.keys(value)) deepFreeze(value[key]);
775
+ }
776
+ function shallowCopy(value) {
777
+ if (Array.isArray(value)) return value.slice();
778
+ return Object.getPrototypeOf(value) === null ? Object.assign(Object.create(null), value) : { ...value };
779
+ }
780
+ function jsonBytes(value) {
781
+ try {
782
+ return JSON.stringify(value)?.length ?? 0;
783
+ } catch {
784
+ return 0;
785
+ }
786
+ }
787
+ function checkedId(id, what) {
788
+ if (typeof id !== "string" || id.length === 0 || id.length > MAX_ID) throw new Error(`Invalid ${what}`);
789
+ return id;
790
+ }
791
+ /**
792
+ * Values that may sit inside tracked state without being frozen themselves.
793
+ * `Date`, `Map` and `Set` can still be changed after freezing, and byte views
794
+ * can't be frozen at all; they are trusted not to change, and are compared
795
+ * and replaced whole (see the serialization docs). Immer freezes `Map` and
796
+ * `Set` against changes and never drafts a `Date`.
797
+ */
798
+ function isTrustedLeaf(value) {
799
+ if (ArrayBuffer.isView(value)) return true;
800
+ switch (Object.prototype.toString.call(value)) {
801
+ case "[object Date]": return hasBrand(() => Date.prototype.getTime.call(value));
802
+ case "[object Map]": return hasBrand(() => Map.prototype.has.call(value, void 0));
803
+ case "[object Set]": return hasBrand(() => Set.prototype.has.call(value, void 0));
804
+ case "[object ArrayBuffer]": return hasBrand(() => Reflect.apply(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")?.get, value, []));
805
+ default: return false;
806
+ }
807
+ }
808
+ /** Whether a built-in method accepts a value, which only its own type does, from any realm. */
809
+ function hasBrand(check) {
810
+ try {
811
+ check();
812
+ return true;
813
+ } catch {
814
+ return false;
815
+ }
816
+ }
817
+ /**
818
+ * Whether a trusted leaf holds only what tracked state may: a `Map` or `Set`
819
+ * whose keys and values are primitives, trusted leaves or frozen state. A
820
+ * class instance inside one couldn't be rebuilt without workflow code, so the
821
+ * value holding it is stored in full. Not cached: a `Map` or `Set` can change.
822
+ */
823
+ function holdsOnlyState(leaf, depth) {
824
+ const tag = Object.prototype.toString.call(leaf);
825
+ if (tag !== "[object Map]" && tag !== "[object Set]") return true;
826
+ if (depth > MAX_DEPTH) return false;
827
+ let ok = true;
828
+ const check = (entry) => {
829
+ if (!ok) return;
830
+ if (entry === null || typeof entry !== "object") {
831
+ if (typeof entry === "function" || typeof entry === "symbol") ok = false;
832
+ return;
833
+ }
834
+ if (frozenState.has(entry)) return;
835
+ if (isTrustedLeaf(entry)) {
836
+ if (!holdsOnlyState(entry, depth + 1)) ok = false;
837
+ return;
838
+ }
839
+ if (!isFrozenState(entry, depth + 1)) ok = false;
840
+ };
841
+ if (tag === "[object Map]") Map.prototype.forEach.call(leaf, (value, key) => {
842
+ check(key);
843
+ check(value);
844
+ });
845
+ else Set.prototype.forEach.call(leaf, (value) => check(value));
846
+ return ok;
847
+ }
848
+ /** Plain objects and arrays already found deeply frozen; freezing can't be undone. */
849
+ var frozenState = globalSingleton("@workflow/core//frozen-state", 1, () => /* @__PURE__ */ new WeakSet());
850
+ /**
851
+ * Whether a value is tracked state: a plain object or array, frozen, holding
852
+ * only primitives, trusted leaves and more such values. Anything else (class
853
+ * instances, functions, streams) is stored as it was before.
854
+ */
855
+ function isFrozenState(value, depth = 0) {
856
+ if (value === null || typeof value !== "object") return false;
857
+ if (frozenState.has(value)) return true;
858
+ if (depth > MAX_DEPTH || !Object.isFrozen(value)) return false;
859
+ if (!Array.isArray(value) && !isPlainObject(value)) return false;
860
+ for (const key of Object.keys(value)) {
861
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
862
+ if (descriptor === void 0 || !("value" in descriptor)) return false;
863
+ }
864
+ const children = Array.isArray(value) ? value : Object.keys(value).map((key) => value[key]);
865
+ for (const child of children) {
866
+ if (child === null || typeof child !== "object") {
867
+ if (typeof child === "function" || typeof child === "symbol") return false;
868
+ continue;
869
+ }
870
+ if (frozenState.has(child)) continue;
871
+ if (isTrustedLeaf(child)) {
872
+ if (!holdsOnlyState(child, depth + 1)) return false;
873
+ continue;
874
+ }
875
+ if (!isFrozenState(child, depth + 1)) return false;
876
+ }
877
+ frozenState.add(value);
878
+ return true;
879
+ }
880
+ /**
881
+ * The values a value holds: object properties, array items, and a `Map`'s
882
+ * keys and values or a `Set`'s members, from any realm.
883
+ */
884
+ function childrenOf(value) {
885
+ const out = [];
886
+ const tag = Object.prototype.toString.call(value);
887
+ if (tag === "[object Map]" || tag === "[object Set]") try {
888
+ if (tag === "[object Map]") Map.prototype.forEach.call(value, (v, k) => {
889
+ out.push(k, v);
890
+ });
891
+ else Set.prototype.forEach.call(value, (v) => {
892
+ out.push(v);
893
+ });
894
+ return out;
895
+ } catch {}
896
+ for (const key of Object.keys(value)) out.push(value[key]);
897
+ return out;
898
+ }
899
+ function newId() {
900
+ return globalThis.crypto.randomUUID();
901
+ }
902
+ /** One invocation's view of the tracked values and sources in a run's log. */
903
+ var StateContext = class StateContext {
904
+ versions = /* @__PURE__ */ new Map();
905
+ /** The version each known value is, for writing references. */
906
+ versionOf = /* @__PURE__ */ new WeakMap();
907
+ /**
908
+ * The newest version each known object is part of, for finding which
909
+ * version a new frozen value was made from: its unchanged parts are objects
910
+ * a known version already holds.
911
+ */
912
+ owners = /* @__PURE__ */ new WeakMap();
913
+ /**
914
+ * Known versions read most recently as step inputs. A step's output is
915
+ * usually made from its input, so when a new value shares no objects with
916
+ * a known version (state of strings and numbers, say), it is compared with
917
+ * these by value instead.
918
+ */
919
+ recentInputs = [];
920
+ /** Registration order of versions, to prefer the newest when choosing a base. */
921
+ order = /* @__PURE__ */ new Map();
922
+ /** Objects inside a record being written, which are not records themselves. */
923
+ inside = /* @__PURE__ */ new WeakSet();
924
+ /**
925
+ * Payloads read without this run's log (run inputs and return values, hook
926
+ * payloads) are written as plain values, so any reader can read them.
927
+ */
928
+ standalone = false;
929
+ /**
930
+ * Whether changes refer to hook-payload strings. A context rebuilt by cold
931
+ * recovery registers every hook payload in the log, but replay registers
932
+ * only those it delivers, so only replay's context may refer to them.
933
+ */
934
+ writesSourceRefs = true;
935
+ /**
936
+ * Whether this context writes state records at all. Off for a step whose
937
+ * run's workflow can't read them (a QuickJS run): see `STATE_REFS_FIELD`.
938
+ */
939
+ writesRecords = true;
940
+ /**
941
+ * A context for writing one step's output. It sees every version this
942
+ * context knows, but the versions the step writes stay its own: they join
943
+ * this context only when replay reads the step's committed `step_completed`.
944
+ * Steps running side by side therefore never build on each other's
945
+ * uncommitted output, which a reader of the log might not find.
946
+ */
947
+ forStep() {
948
+ const child = new StateContext();
949
+ child.parent = this;
950
+ child.registrations = this.registrations;
951
+ child.sources = this.sources;
952
+ child.strings = this.strings;
953
+ child.recentInputs = [...this.recentInputs];
954
+ child.standalone = this.standalone;
955
+ child.writesSourceRefs = this.writesSourceRefs;
956
+ child.writesRecords = this.writesRecords;
957
+ Object.assign(child.stats, this.stats);
958
+ return child;
959
+ }
960
+ version(id) {
961
+ return this.versions.get(id) ?? this.parent?.version(id);
962
+ }
963
+ versionOfValue(value) {
964
+ return this.versionOf.get(value) ?? this.parent?.versionOfValue(value);
965
+ }
966
+ ownerOf(value) {
967
+ return this.owners.get(value) ?? this.parent?.ownerOf(value);
968
+ }
969
+ rank(version) {
970
+ return this.order.get(version) ?? this.parent?.rank(version) ?? 0;
971
+ }
972
+ /** A context for payloads read without the run's log: it writes no records. */
973
+ static standalone() {
974
+ const context = new StateContext();
975
+ context.standalone = true;
976
+ return context;
977
+ }
978
+ /**
979
+ * Each source's referenceable strings by path, captured when the source is
980
+ * first seen. Code may edit a revived hook payload or run input later; state
981
+ * changes must still resolve to the strings that were stored.
982
+ */
983
+ sources = /* @__PURE__ */ new Map();
984
+ strings = /* @__PURE__ */ new Map();
985
+ /**
986
+ * The context a step's output is written against (see `forStep`): its
987
+ * versions can be bases and references; this context's own versions are
988
+ * the step's, until replay reads them back from the committed log.
989
+ */
990
+ parent;
991
+ /**
992
+ * Registration order, shared with the layers made from this context, so a
993
+ * step's versions rank after the ones it can see.
994
+ */
995
+ registrations = { count: 0 };
996
+ stats = {
997
+ refs: 0,
998
+ patches: 0,
999
+ full: 0,
1000
+ sourceRefs: 0,
1001
+ recoveryFetches: 0,
1002
+ recoveryBytes: 0,
1003
+ recoveryMs: 0
1004
+ };
1005
+ /** Starts writing one payload: what counted as inside its records is forgotten. */
1006
+ beginWrite() {
1007
+ this.inside = /* @__PURE__ */ new WeakSet();
1008
+ }
1009
+ /** devalue reducer: returns a record for tracked values, `false` otherwise. */
1010
+ reduce = (value) => this.reduceValue(value, true);
1011
+ /**
1012
+ * devalue reducer for a step input. Its versions are written like any
1013
+ * other, but not remembered: no reader reads step inputs back, so a later
1014
+ * payload must not refer to them.
1015
+ */
1016
+ reduceInput = (value) => this.reduceValue(value, false);
1017
+ reduceValue(value, register) {
1018
+ if (value === null || typeof value !== "object") return false;
1019
+ if (this.inside.has(value)) {
1020
+ this.markInside(value);
1021
+ return false;
1022
+ }
1023
+ if (this.standalone || !this.writesRecords || !stateRefsEnabled() || !isFrozenState(value)) return false;
1024
+ return this.reduceTracked(value, register);
1025
+ }
1026
+ /** Marks a value's children as part of the record being written. */
1027
+ markInside(value) {
1028
+ if (isTrustedLeaf(value)) return;
1029
+ const children = Array.isArray(value) ? value : Object.keys(value).map((key) => value[key]);
1030
+ for (const child of children) if (child !== null && typeof child === "object" && !this.isKnown(child)) this.inside.add(child);
1031
+ }
1032
+ /** A version this context can write a reference to. */
1033
+ isKnown(value) {
1034
+ const version = this.versionOfValue(value);
1035
+ return version !== void 0 && this.version(version) !== void 0;
1036
+ }
1037
+ /** Marks the values a change carries as part of the record being written. */
1038
+ markOps(ops) {
1039
+ for (const op of ops) {
1040
+ const carried = op.op === "set" ? [op.value] : op.op === "append" ? op.items : [];
1041
+ for (const value of carried) if (value !== null && typeof value === "object" && !this.isKnown(value)) this.inside.add(value);
1042
+ }
1043
+ }
1044
+ /**
1045
+ * The known version a new frozen value was most likely made from: the one
1046
+ * most of its unchanged parts belong to, newest first on a tie. Only the
1047
+ * value's new objects are walked, down to the first known object on each
1048
+ * path. A known version held whole is contained, not built on: it is
1049
+ * written as its own reference inside the record.
1050
+ */
1051
+ findBase(value) {
1052
+ const counts = /* @__PURE__ */ new Map();
1053
+ const stack = [value];
1054
+ while (stack.length > 0) {
1055
+ const node = stack.pop();
1056
+ if (node === null || typeof node !== "object") continue;
1057
+ if (node !== value && this.versionOfValue(node) !== void 0) continue;
1058
+ const owner = node === value ? void 0 : this.ownerOf(node);
1059
+ if (owner !== void 0) {
1060
+ counts.set(owner, (counts.get(owner) ?? 0) + 1);
1061
+ continue;
1062
+ }
1063
+ if (isTrustedLeaf(node)) continue;
1064
+ if (Array.isArray(node)) for (const child of node) stack.push(child);
1065
+ else for (const key of Object.keys(node)) stack.push(node[key]);
1066
+ }
1067
+ if (counts.size === 0) return this.closestInput(value);
1068
+ let best;
1069
+ for (const [version, count] of counts) {
1070
+ if (this.version(version) === void 0) continue;
1071
+ const bestCount = best === void 0 ? -1 : counts.get(best);
1072
+ if (count > bestCount || count === bestCount && this.rank(version) > this.rank(best)) best = version;
1073
+ }
1074
+ return best;
1075
+ }
1076
+ /**
1077
+ * Of the versions recently read as step inputs, the one a new value differs
1078
+ * least from, unless every one would be replaced whole.
1079
+ */
1080
+ closestInput(value) {
1081
+ let best;
1082
+ let bestBytes = Number.POSITIVE_INFINITY;
1083
+ for (const version of this.recentInputs) {
1084
+ const entry = this.version(version);
1085
+ if (entry === void 0) continue;
1086
+ const ops = diffState(entry.value, value);
1087
+ if (ops.some((op) => op.op === "set" && op.path.length === 0)) continue;
1088
+ const bytes = opsBytes(ops);
1089
+ if (bytes < bestBytes) {
1090
+ best = version;
1091
+ bestBytes = bytes;
1092
+ }
1093
+ }
1094
+ return best;
1095
+ }
1096
+ /** Remembers a version, its value, and which objects it holds. */
1097
+ register(version, entry) {
1098
+ this.versions.set(version, entry);
1099
+ this.order.set(version, ++this.registrations.count);
1100
+ const { value } = entry;
1101
+ if (value === null || typeof value !== "object") return;
1102
+ this.versionOf.set(value, version);
1103
+ const stack = [value];
1104
+ while (stack.length > 0) {
1105
+ const node = stack.pop();
1106
+ if (node === null || typeof node !== "object") continue;
1107
+ const known = this.ownerOf(node) !== void 0;
1108
+ this.owners.set(node, version);
1109
+ if (known || isTrustedLeaf(node)) continue;
1110
+ if (Array.isArray(node)) for (const child of node) stack.push(child);
1111
+ else for (const key of Object.keys(node)) stack.push(node[key]);
1112
+ }
1113
+ }
1114
+ /** devalue reducer for the strings inside a state change that a source already holds. */
1115
+ reduceSourceRef = (value) => value instanceof StateSourceRef ? [value.id, value.path] : false;
1116
+ reviveSourceRef = ([id, path]) => new StateSourceRef(checkedId(id, "state source id"), path);
1117
+ revive = (d) => this.reviveRecord(d, true);
1118
+ /** devalue reviver for a step input: rebuilds its values without remembering them (see `reduceInput`). */
1119
+ reviveInput = (d) => this.reviveRecord(d, false);
1120
+ reviveRecord(d, register) {
1121
+ switch (d.kind) {
1122
+ case "source": return this.reviveSource(d);
1123
+ case "ref":
1124
+ case "patch":
1125
+ case "full": return this.reviveTracked(d, register);
1126
+ default: throw new Error("Unknown workflow state record");
1127
+ }
1128
+ }
1129
+ reduceTracked(value, register) {
1130
+ const known = this.versionOfValue(value);
1131
+ const knownEntry = known === void 0 ? void 0 : this.version(known);
1132
+ if (known !== void 0 && knownEntry !== void 0) {
1133
+ this.stats.refs++;
1134
+ return {
1135
+ kind: "ref",
1136
+ logId: knownEntry.logId,
1137
+ version: known
1138
+ };
1139
+ }
1140
+ const baseVersion = this.findBase(value);
1141
+ const base = baseVersion === void 0 ? void 0 : this.version(baseVersion);
1142
+ if (baseVersion !== void 0 && base !== void 0) {
1143
+ const ops = diffState(base.value, value);
1144
+ if (ops.length === 0) {
1145
+ if (register) this.versionOf.set(value, baseVersion);
1146
+ this.stats.refs++;
1147
+ return {
1148
+ kind: "ref",
1149
+ logId: base.logId,
1150
+ version: baseVersion
1151
+ };
1152
+ }
1153
+ const bytesSinceFull = base.bytesSinceFull + opsBytes(ops);
1154
+ const recordsSinceFull = base.recordsSinceFull + 1;
1155
+ const rule = this.snapshotRule(value, bytesSinceFull, base.measured);
1156
+ const { measured } = rule;
1157
+ const snapshot = rule.snapshot || recordsSinceFull >= SNAPSHOT_MAX_RECORDS;
1158
+ const replacesWhole = ops.some((op) => op.op === "set" && op.path.length === 0);
1159
+ if (!snapshot && !replacesWhole) {
1160
+ const version = newId();
1161
+ if (register) this.register(version, {
1162
+ logId: base.logId,
1163
+ value,
1164
+ bytesSinceFull,
1165
+ recordsSinceFull,
1166
+ measured
1167
+ });
1168
+ this.stats.patches++;
1169
+ this.markOps(ops);
1170
+ return {
1171
+ kind: "patch",
1172
+ logId: base.logId,
1173
+ base: baseVersion,
1174
+ version,
1175
+ ops: this.withSourceRefs(ops)
1176
+ };
1177
+ }
1178
+ return this.writeFull(value, base.logId, register, measured);
1179
+ }
1180
+ return this.writeFull(value, newId(), register, void 0);
1181
+ }
1182
+ writeFull(value, logId, register, measured) {
1183
+ const version = newId();
1184
+ if (register) this.register(version, {
1185
+ logId,
1186
+ value,
1187
+ bytesSinceFull: 0,
1188
+ recordsSinceFull: 0,
1189
+ measured: measured && {
1190
+ bytes: measured.bytes,
1191
+ at: 0
1192
+ }
1193
+ });
1194
+ this.stats.full++;
1195
+ this.markInside(value);
1196
+ return {
1197
+ kind: "full",
1198
+ logId,
1199
+ version,
1200
+ value: shallowCopy(value)
1201
+ };
1202
+ }
1203
+ /**
1204
+ * Whether to write the value whole: its changes since the last whole value
1205
+ * exceed {@link SNAPSHOT_MIN_BYTES} and half its size. Measuring the size
1206
+ * serializes the whole value, so a measurement is reused while the changes
1207
+ * since it cannot have grown enough for the rule to fire.
1208
+ */
1209
+ snapshotRule(value, bytesSinceFull, measured) {
1210
+ if (bytesSinceFull <= SNAPSHOT_MIN_BYTES) return {
1211
+ snapshot: false,
1212
+ measured
1213
+ };
1214
+ if (measured !== void 0 && bytesSinceFull >= measured.at) {
1215
+ const atLeast = measured.bytes - (bytesSinceFull - measured.at);
1216
+ if (2 * bytesSinceFull <= atLeast) return {
1217
+ snapshot: false,
1218
+ measured
1219
+ };
1220
+ }
1221
+ const bytes = jsonBytes(value);
1222
+ return {
1223
+ snapshot: 2 * bytesSinceFull > bytes,
1224
+ measured: {
1225
+ bytes,
1226
+ at: bytesSinceFull
1227
+ }
1228
+ };
1229
+ }
1230
+ reviveTracked(d, register) {
1231
+ const logId = checkedId(d.logId, "workflow state log");
1232
+ const version = checkedId(d.version, "workflow state version");
1233
+ const known = this.version(version);
1234
+ if (d.kind === "ref") {
1235
+ if (known?.logId !== logId) throw new WorkflowStateMissingError(`Missing workflow state version ${logId}:${version}`);
1236
+ if (!register) this.recentInputs = [version, ...this.recentInputs.filter((v) => v !== version)].slice(0, MAX_RECENT_INPUTS);
1237
+ return known.value;
1238
+ }
1239
+ if (known !== void 0) return known.value;
1240
+ let value;
1241
+ let fresh;
1242
+ let bytesSinceFull = 0;
1243
+ let recordsSinceFull = 0;
1244
+ if (d.kind === "full") {
1245
+ value = d.value;
1246
+ fresh = value;
1247
+ this.assertKnownTypes(value);
1248
+ } else {
1249
+ const base = typeof d.base === "string" ? this.version(d.base) : void 0;
1250
+ if (base?.logId !== logId) throw new WorkflowStateMissingError(`Missing workflow state base ${logId}:${String(d.base)}`);
1251
+ if (!Array.isArray(d.ops)) throw new Error("Invalid workflow state change");
1252
+ const ops = this.resolveSourceRefs(d.ops);
1253
+ this.assertKnownTypes(ops);
1254
+ fresh = ops;
1255
+ value = applyStateOps(base.value, ops);
1256
+ bytesSinceFull = base.bytesSinceFull + opsBytes(ops);
1257
+ recordsSinceFull = base.recordsSinceFull + 1;
1258
+ }
1259
+ if (this.placeholders.size > 0 && this.holdsPlaceholder(fresh)) return value;
1260
+ deepFreeze(value);
1261
+ if (register) this.register(version, {
1262
+ logId,
1263
+ value,
1264
+ bytesSinceFull,
1265
+ recordsSinceFull
1266
+ });
1267
+ return value;
1268
+ }
1269
+ /**
1270
+ * Registers the long strings of a payload later state may refer to: a hook
1271
+ * payload or the run input, as read, under its `stateSourceId`. Every
1272
+ * reader of the log registers the same payloads under the same ids.
1273
+ */
1274
+ addSource(id, value) {
1275
+ checkedId(id, "state source id");
1276
+ if (this.sources.has(id)) return;
1277
+ const captured = /* @__PURE__ */ new Map();
1278
+ this.sources.set(id, captured);
1279
+ const walk = (v, path) => {
1280
+ if (path.length > MAX_PATH) return;
1281
+ if (typeof v === "string") {
1282
+ if (v.length < SOURCE_STRING_MIN) return;
1283
+ captured.set(JSON.stringify(path), v);
1284
+ if (!this.strings.has(v)) this.strings.set(v, {
1285
+ id,
1286
+ path
1287
+ });
1288
+ } else if (Array.isArray(v)) for (let i = 0; i < v.length; i++) walk(v[i], [...path, i]);
1289
+ else if (isPlainObject(v)) for (const key of Object.keys(v)) walk(v[key], [...path, key]);
1290
+ };
1291
+ walk(value, []);
1292
+ }
1293
+ reviveSource(d) {
1294
+ const id = checkedId(d.id, "state source id");
1295
+ this.addSource(id, d.value);
1296
+ return d.value;
1297
+ }
1298
+ /** Replaces long strings a source already holds; the result is serialized, never kept. */
1299
+ withSourceRefs(ops) {
1300
+ if (!this.writesSourceRefs || this.strings.size === 0) return [...ops];
1301
+ const replace = (v) => {
1302
+ if (typeof v === "string") {
1303
+ const at = v.length >= SOURCE_STRING_MIN ? this.strings.get(v) : void 0;
1304
+ if (at === void 0) return v;
1305
+ this.stats.sourceRefs++;
1306
+ return new StateSourceRef(at.id, at.path);
1307
+ }
1308
+ if (Array.isArray(v)) return v.map(replace);
1309
+ if (isPlainObject(v)) {
1310
+ const out = Object.getPrototypeOf(v) === null ? Object.create(null) : {};
1311
+ for (const key of Object.keys(v)) out[key] = replace(v[key]);
1312
+ return out;
1313
+ }
1314
+ return v;
1315
+ };
1316
+ return ops.map(replace);
1317
+ }
1318
+ resolveSourceRefs(v) {
1319
+ if (v instanceof StateSourceRef) {
1320
+ const captured = this.sources.get(v.id);
1321
+ if (captured === void 0) throw new WorkflowStateMissingError(`Missing workflow state source ${v.id}`);
1322
+ const value = captured.get(JSON.stringify(v.path));
1323
+ if (value === void 0) throw new WorkflowStateMissingError("Missing workflow state source field");
1324
+ return value;
1325
+ }
1326
+ if (Array.isArray(v)) return v.map((x) => this.resolveSourceRefs(x));
1327
+ if (v?.[OPAQUE] === true) return v;
1328
+ if (isPlainObject(v)) {
1329
+ const out = Object.getPrototypeOf(v) === null ? Object.create(null) : {};
1330
+ for (const key of Object.keys(v)) out[key] = this.resolveSourceRefs(v[key]);
1331
+ return out;
1332
+ }
1333
+ return v;
1334
+ }
1335
+ /** Inspection tools display values that recovery would refuse to rebuild. */
1336
+ allowPlaceholders = false;
1337
+ /** Placeholders handed out for records this context could not rebuild (inspection only). */
1338
+ placeholders = /* @__PURE__ */ new Set();
1339
+ /** The display placeholder for a record that could not be rebuilt yet. */
1340
+ placeholderFor(record) {
1341
+ if (record.kind === "source" || record.kind === "full") return record.value;
1342
+ const text = `<state ${String(record.version)}>`;
1343
+ this.placeholders.add(text);
1344
+ return text;
1345
+ }
1346
+ holdsPlaceholder(value, depth = 0) {
1347
+ if (typeof value === "string") return this.placeholders.has(value);
1348
+ if (depth > 256 || value === null || typeof value !== "object") return false;
1349
+ for (const child of childrenOf(value)) if (this.holdsPlaceholder(child, depth + 1)) return true;
1350
+ return false;
1351
+ }
1352
+ assertKnownTypes(value, depth = 0) {
1353
+ if (this.allowPlaceholders) return;
1354
+ if (depth > 256 || value === null || typeof value !== "object") return;
1355
+ if (value[OPAQUE] === true) throw new Error("Workflow state holds a value that cannot be recovered without running workflow code");
1356
+ const tag = Object.prototype.toString.call(value);
1357
+ if (tag === "[object Map]") Map.prototype.forEach.call(value, (entry, key) => {
1358
+ this.assertKnownTypes(key, depth + 1);
1359
+ this.assertKnownTypes(entry, depth + 1);
1360
+ });
1361
+ else if (tag === "[object Set]") Set.prototype.forEach.call(value, (entry) => this.assertKnownTypes(entry, depth + 1));
1362
+ else for (const key of Object.keys(value)) this.assertKnownTypes(value[key], depth + 1);
1363
+ }
1364
+ /**
1365
+ * Cold recovery: reads the state records of one decoded payload (JSON text after
1366
+ * the format prefix) without running workflow code. Other custom types become
1367
+ * placeholders, which fail loudly if they end up inside tracked state.
1368
+ */
1369
+ ingest(payload, common = {}, source) {
1370
+ const text = new TextDecoder().decode(payload);
1371
+ if (source === void 0 && !text.includes("StateRefV1")) return;
1372
+ const opaque = () => ({ [OPAQUE]: true });
1373
+ const pick = (key) => typeof key !== "string" ? void 0 : key === "StateRefV1" ? this.revive : key === "StateSrcV1" ? this.reviveSourceRef : Object.hasOwn(common, key) ? common[key] : Object.hasOwn(VALUE_REVIVERS, key) ? VALUE_REVIVERS[key] : DEVALUE_BUILTIN_TAGS.has(key) ? void 0 : opaque;
1374
+ const value = parse(text, new Proxy({}, {
1375
+ get: (_t, key) => pick(key),
1376
+ has: (_t, key) => pick(key) !== void 0,
1377
+ getOwnPropertyDescriptor: (_t, key) => {
1378
+ const value = pick(key);
1379
+ return value === void 0 ? void 0 : {
1380
+ value,
1381
+ enumerable: true,
1382
+ configurable: true
1383
+ };
1384
+ }
1385
+ }));
1386
+ if (source !== void 0) this.addSource(source, value);
1387
+ }
1388
+ /**
1389
+ * Whether reading this decoded payload needs records this context lacks.
1390
+ * Reads it like `ingest`, into a scratch copy, so nothing is remembered.
1391
+ */
1392
+ needsRecovery(payload) {
1393
+ if (!new TextDecoder().decode(payload).includes("StateRefV1")) return false;
1394
+ const scratch = new StateContext();
1395
+ for (const [id, version] of this.versions) scratch.versions.set(id, version);
1396
+ for (const [id, strings] of this.sources) scratch.sources.set(id, strings);
1397
+ try {
1398
+ scratch.ingest(payload);
1399
+ return false;
1400
+ } catch {
1401
+ return true;
1402
+ }
1403
+ }
1404
+ };
1405
+ /** Whether references are written here; reading them always works. */
1406
+ function stateRefsEnabled() {
1407
+ return process.env.WORKFLOW_VM !== "quickjs";
1408
+ }
1409
+ var bindings = globalSingleton("@workflow/core//state-ref-contexts", 1, () => ({
1410
+ globals: /* @__PURE__ */ new WeakMap(),
1411
+ data: /* @__PURE__ */ new WeakMap()
1412
+ }));
1413
+ function stateContextForGlobal(global) {
1414
+ return bindings.globals.get(global);
1415
+ }
1416
+ function bindStateContextData(data, context) {
1417
+ if (data !== null && typeof data === "object" && context) bindings.data.set(data, context);
1418
+ }
1419
+ function stateContextForData(data) {
1420
+ return data !== null && typeof data === "object" ? bindings.data.get(data) : void 0;
1421
+ }
1422
+ export { MAP_KEY as _, WorkflowStateMissingError as a, stringify_string as b, stateContextForGlobal as c, unflatten as d, default_parse_operations as f, DevalueError as g, encode64 as h, StateContext as i, stateSourceId as l, merge_operations as m, STATE_REF_REDUCER as n, bindStateContextData as o, default_stringify_operations as p, STATE_SOURCE_REDUCER as r, stateContextForData as s, STATE_REFS_FIELD as t, parse as u, format_path as v, quote_key as y };