@xmachines/play-vue 1.0.0-beta.2 → 1.0.0-beta.21

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 (74) hide show
  1. package/README.md +214 -84
  2. package/dist/PlayRenderer.js +7 -0
  3. package/dist/PlayRenderer.js.map +1 -0
  4. package/dist/PlayRenderer.vue_vue_type_script_lang.js +57 -0
  5. package/dist/PlayRenderer.vue_vue_type_script_lang.js.map +1 -0
  6. package/dist/define-registry.d.ts +79 -0
  7. package/dist/define-registry.d.ts.map +1 -0
  8. package/dist/define-registry.js +21 -0
  9. package/dist/define-registry.js.map +1 -0
  10. package/dist/index.d.ts +15 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +5 -5
  13. package/dist/node_modules/@json-render/core/dist/chunk-AFLK3Q4T.js +111 -0
  14. package/dist/node_modules/@json-render/core/dist/chunk-AFLK3Q4T.js.map +1 -0
  15. package/dist/node_modules/@json-render/core/dist/index.js +956 -0
  16. package/dist/node_modules/@json-render/core/dist/index.js.map +1 -0
  17. package/dist/node_modules/@json-render/core/dist/store-utils.js +1 -0
  18. package/dist/node_modules/@json-render/vue/dist/chunk-WIPZLAF7.js +57 -0
  19. package/dist/node_modules/@json-render/vue/dist/chunk-WIPZLAF7.js.map +1 -0
  20. package/dist/node_modules/@json-render/vue/dist/index.js +796 -0
  21. package/dist/node_modules/@json-render/vue/dist/index.js.map +1 -0
  22. package/dist/node_modules/@json-render/xstate/dist/index.js +20 -0
  23. package/dist/node_modules/@json-render/xstate/dist/index.js.map +1 -0
  24. package/dist/node_modules/@xstate/store/dist/store-69e7e2d5.esm.js +227 -0
  25. package/dist/node_modules/@xstate/store/dist/store-69e7e2d5.esm.js.map +1 -0
  26. package/dist/node_modules/zod/v4/classic/errors.js +25 -0
  27. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  28. package/dist/node_modules/zod/v4/classic/iso.js +33 -0
  29. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  30. package/dist/node_modules/zod/v4/classic/parse.js +8 -0
  31. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  32. package/dist/node_modules/zod/v4/classic/schemas.js +362 -0
  33. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  34. package/dist/node_modules/zod/v4/core/api.js +530 -0
  35. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  36. package/dist/node_modules/zod/v4/core/checks.js +285 -0
  37. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  38. package/dist/node_modules/zod/v4/core/core.js +46 -0
  39. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  40. package/dist/node_modules/zod/v4/core/doc.js +25 -0
  41. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  42. package/dist/node_modules/zod/v4/core/errors.js +43 -0
  43. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  44. package/dist/node_modules/zod/v4/core/json-schema-processors.js +183 -0
  45. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
  46. package/dist/node_modules/zod/v4/core/parse.js +70 -0
  47. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  48. package/dist/node_modules/zod/v4/core/regexes.js +27 -0
  49. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  50. package/dist/node_modules/zod/v4/core/registries.js +42 -0
  51. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  52. package/dist/node_modules/zod/v4/core/schemas.js +823 -0
  53. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  54. package/dist/node_modules/zod/v4/core/to-json-schema.js +224 -0
  55. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  56. package/dist/node_modules/zod/v4/core/util.js +268 -0
  57. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  58. package/dist/node_modules/zod/v4/core/versions.js +10 -0
  59. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  60. package/dist/types.d.ts +31 -7
  61. package/dist/types.d.ts.map +1 -1
  62. package/dist/useActor.d.ts +35 -0
  63. package/dist/useActor.d.ts.map +1 -0
  64. package/dist/useActor.js +15 -0
  65. package/dist/useActor.js.map +1 -0
  66. package/package.json +31 -23
  67. package/dist/PlayRenderer.vue.js +0 -8
  68. package/dist/PlayRenderer.vue.js.map +0 -1
  69. package/dist/PlayRenderer.vue2.js +0 -48
  70. package/dist/PlayRenderer.vue2.js.map +0 -1
  71. package/dist/_virtual/_plugin-vue_export-helper.js +0 -10
  72. package/dist/_virtual/_plugin-vue_export-helper.js.map +0 -1
  73. package/dist/index.css +0 -1
  74. package/dist/index.js.map +0 -1
@@ -0,0 +1,111 @@
1
+ import { _null as e, boolean as t, number as n, object as r, string as i, union as a } from "../../../zod/v4/classic/schemas.js";
2
+ //#region ../../node_modules/@json-render/core/dist/chunk-AFLK3Q4T.mjs
3
+ var o = a([
4
+ i(),
5
+ n(),
6
+ t(),
7
+ e(),
8
+ r({ $state: i() })
9
+ ]);
10
+ a([i(), r({ $state: i() })]), a([n(), r({ $state: i() })]), a([t(), r({ $state: i() })]);
11
+ function s(e, t) {
12
+ if (e != null) return typeof e == "object" && "$state" in e ? u(t, e.$state) : e;
13
+ }
14
+ function c(e) {
15
+ return e.replace(/~1/g, "/").replace(/~0/g, "~");
16
+ }
17
+ function l(e) {
18
+ return (e.startsWith("/") ? e.slice(1).split("/") : e.split("/")).map(c);
19
+ }
20
+ function u(e, t) {
21
+ if (!t || t === "/") return e;
22
+ let n = l(t), r = e;
23
+ for (let e of n) {
24
+ if (r == null) return;
25
+ if (Array.isArray(r)) r = r[parseInt(e, 10)];
26
+ else if (typeof r == "object") r = r[e];
27
+ else return;
28
+ }
29
+ return r;
30
+ }
31
+ var d = "spec";
32
+ `${d}`;
33
+ function f(e, t, n) {
34
+ let r = l(t);
35
+ if (r.length === 0) return e;
36
+ let i = { ...e }, a = i;
37
+ for (let e = 0; e < r.length - 1; e++) {
38
+ let t = r[e], n = a[t];
39
+ if (Array.isArray(n)) a[t] = [...n];
40
+ else if (typeof n == "object" && n) a[t] = { ...n };
41
+ else {
42
+ let n = r[e + 1];
43
+ a[t] = n !== void 0 && /^\d+$/.test(n) ? [] : {};
44
+ }
45
+ a = a[t];
46
+ }
47
+ let o = r[r.length - 1];
48
+ return Array.isArray(a) ? o === "-" ? a.push(n) : a[parseInt(o, 10)] = n : a[o] = n, i;
49
+ }
50
+ function p(e = {}) {
51
+ let t = { ...e }, n = /* @__PURE__ */ new Set();
52
+ function r() {
53
+ for (let e of n) e();
54
+ }
55
+ return {
56
+ get(e) {
57
+ return u(t, e);
58
+ },
59
+ set(e, n) {
60
+ u(t, e) !== n && (t = f(t, e, n), r());
61
+ },
62
+ update(e) {
63
+ let n = !1, i = t;
64
+ for (let [t, r] of Object.entries(e)) u(i, t) !== r && (i = f(i, t, r), n = !0);
65
+ n && (t = i, r());
66
+ },
67
+ getSnapshot() {
68
+ return t;
69
+ },
70
+ getServerSnapshot() {
71
+ return t;
72
+ },
73
+ subscribe(e) {
74
+ return n.add(e), () => {
75
+ n.delete(e);
76
+ };
77
+ }
78
+ };
79
+ }
80
+ function m(e) {
81
+ return {
82
+ get(t) {
83
+ return u(e.getSnapshot(), t);
84
+ },
85
+ set(t, n) {
86
+ let r = e.getSnapshot();
87
+ u(r, t) !== n && e.setSnapshot(f(r, t, n));
88
+ },
89
+ update(t) {
90
+ let n = e.getSnapshot(), r = !1;
91
+ for (let [e, i] of Object.entries(t)) u(n, e) !== i && (n = f(n, e, i), r = !0);
92
+ r && e.setSnapshot(n);
93
+ },
94
+ getSnapshot: e.getSnapshot,
95
+ getServerSnapshot: e.getSnapshot,
96
+ subscribe: e.subscribe
97
+ };
98
+ }
99
+ var h = 20;
100
+ function g(e, t = "", n = 0, r, i) {
101
+ let a = r ?? /* @__PURE__ */ new Set(), o = i ?? { current: !1 }, s = {};
102
+ for (let [r, i] of Object.entries(e)) {
103
+ let e = `${t}/${r}`;
104
+ n < h && typeof i == "object" && i && !Array.isArray(i) && Object.getPrototypeOf(i) === Object.prototype && !a.has(i) ? (a.add(i), Object.assign(s, g(i, e, n + 1, a, o))) : (process.env.NODE_ENV !== "production" && !o.current && n >= h && typeof i == "object" && i && !Array.isArray(i) && Object.getPrototypeOf(i) === Object.prototype && !a.has(i) && (o.current = !0, console.warn(`flattenToPointers: depth limit (${h}) reached. Nested state beyond this depth will be treated as a leaf value.`)), s[e] = i);
105
+ }
106
+ return s;
107
+ }
108
+ //#endregion
109
+ export { o as DynamicValueSchema, d as SPEC_DATA_PART, p as createStateStore, m as createStoreAdapter, g as flattenToPointers, u as getByPath, f as immutableSetByPath, s as resolveDynamicValue };
110
+
111
+ //# sourceMappingURL=chunk-AFLK3Q4T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-AFLK3Q4T.js","names":["z.union","z.string","z.number","z.boolean","z.null","z.object"],"sources":["../../../../../../../node_modules/@json-render/core/dist/chunk-AFLK3Q4T.mjs"],"sourcesContent":["// src/types.ts\nimport { z } from \"zod\";\nvar DynamicValueSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.object({ $state: z.string() })\n]);\nvar DynamicStringSchema = z.union([\n z.string(),\n z.object({ $state: z.string() })\n]);\nvar DynamicNumberSchema = z.union([\n z.number(),\n z.object({ $state: z.string() })\n]);\nvar DynamicBooleanSchema = z.union([\n z.boolean(),\n z.object({ $state: z.string() })\n]);\nfunction resolveDynamicValue(value, stateModel) {\n if (value === null || value === void 0) {\n return void 0;\n }\n if (typeof value === \"object\" && \"$state\" in value) {\n return getByPath(stateModel, value.$state);\n }\n return value;\n}\nfunction unescapeJsonPointer(token) {\n return token.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\nfunction parseJsonPointer(path) {\n const raw = path.startsWith(\"/\") ? path.slice(1).split(\"/\") : path.split(\"/\");\n return raw.map(unescapeJsonPointer);\n}\nfunction getByPath(obj, path) {\n if (!path || path === \"/\") {\n return obj;\n }\n const segments = parseJsonPointer(path);\n let current = obj;\n for (const segment of segments) {\n if (current === null || current === void 0) {\n return void 0;\n }\n if (Array.isArray(current)) {\n const index = parseInt(segment, 10);\n current = current[index];\n } else if (typeof current === \"object\") {\n current = current[segment];\n } else {\n return void 0;\n }\n }\n return current;\n}\nfunction isNumericIndex(str) {\n return /^\\d+$/.test(str);\n}\nfunction setByPath(obj, path, value) {\n const segments = parseJsonPointer(path);\n if (segments.length === 0) return;\n let current = obj;\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i];\n const nextSegment = segments[i + 1];\n const nextIsNumeric = nextSegment !== void 0 && (isNumericIndex(nextSegment) || nextSegment === \"-\");\n if (Array.isArray(current)) {\n const index = parseInt(segment, 10);\n if (current[index] === void 0 || typeof current[index] !== \"object\") {\n current[index] = nextIsNumeric ? [] : {};\n }\n current = current[index];\n } else {\n if (!(segment in current) || typeof current[segment] !== \"object\") {\n current[segment] = nextIsNumeric ? [] : {};\n }\n current = current[segment];\n }\n }\n const lastSegment = segments[segments.length - 1];\n if (Array.isArray(current)) {\n if (lastSegment === \"-\") {\n current.push(value);\n } else {\n const index = parseInt(lastSegment, 10);\n current[index] = value;\n }\n } else {\n current[lastSegment] = value;\n }\n}\nfunction addByPath(obj, path, value) {\n const segments = parseJsonPointer(path);\n if (segments.length === 0) return;\n let current = obj;\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i];\n const nextSegment = segments[i + 1];\n const nextIsNumeric = nextSegment !== void 0 && (isNumericIndex(nextSegment) || nextSegment === \"-\");\n if (Array.isArray(current)) {\n const index = parseInt(segment, 10);\n if (current[index] === void 0 || typeof current[index] !== \"object\") {\n current[index] = nextIsNumeric ? [] : {};\n }\n current = current[index];\n } else {\n if (!(segment in current) || typeof current[segment] !== \"object\") {\n current[segment] = nextIsNumeric ? [] : {};\n }\n current = current[segment];\n }\n }\n const lastSegment = segments[segments.length - 1];\n if (Array.isArray(current)) {\n if (lastSegment === \"-\") {\n current.push(value);\n } else {\n const index = parseInt(lastSegment, 10);\n current.splice(index, 0, value);\n }\n } else {\n current[lastSegment] = value;\n }\n}\nfunction removeByPath(obj, path) {\n const segments = parseJsonPointer(path);\n if (segments.length === 0) return;\n let current = obj;\n for (let i = 0; i < segments.length - 1; i++) {\n const segment = segments[i];\n if (Array.isArray(current)) {\n const index = parseInt(segment, 10);\n if (current[index] === void 0 || typeof current[index] !== \"object\") {\n return;\n }\n current = current[index];\n } else {\n if (!(segment in current) || typeof current[segment] !== \"object\") {\n return;\n }\n current = current[segment];\n }\n }\n const lastSegment = segments[segments.length - 1];\n if (Array.isArray(current)) {\n const index = parseInt(lastSegment, 10);\n if (index >= 0 && index < current.length) {\n current.splice(index, 1);\n }\n } else {\n delete current[lastSegment];\n }\n}\nfunction deepEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (typeof a !== typeof b) return false;\n if (typeof a !== \"object\") return false;\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) return false;\n if (a.length !== b.length) return false;\n return a.every((item, i) => deepEqual(item, b[i]));\n }\n const aObj = a;\n const bObj = b;\n const aKeys = Object.keys(aObj);\n const bKeys = Object.keys(bObj);\n if (aKeys.length !== bKeys.length) return false;\n return aKeys.every((key) => deepEqual(aObj[key], bObj[key]));\n}\nfunction findFormValue(fieldName, params, state) {\n if (params?.[fieldName] !== void 0) {\n const val = params[fieldName];\n if (typeof val !== \"string\" || !val.includes(\".\")) {\n return val;\n }\n }\n if (params) {\n for (const key of Object.keys(params)) {\n if (key.endsWith(`.${fieldName}`)) {\n const val = params[key];\n if (typeof val !== \"string\" || !val.includes(\".\")) {\n return val;\n }\n }\n }\n }\n if (state) {\n for (const key of Object.keys(state)) {\n if (key === fieldName || key.endsWith(`.${fieldName}`)) {\n return state[key];\n }\n }\n const val = getByPath(state, fieldName);\n if (val !== void 0) {\n return val;\n }\n }\n return void 0;\n}\nfunction parseSpecStreamLine(line) {\n const trimmed = line.trim();\n if (!trimmed || !trimmed.startsWith(\"{\")) return null;\n try {\n const patch = JSON.parse(trimmed);\n if (patch.op && patch.path !== void 0) {\n return patch;\n }\n return null;\n } catch {\n return null;\n }\n}\nfunction applySpecStreamPatch(obj, patch) {\n switch (patch.op) {\n case \"add\":\n addByPath(obj, patch.path, patch.value);\n break;\n case \"replace\":\n setByPath(obj, patch.path, patch.value);\n break;\n case \"remove\":\n removeByPath(obj, patch.path);\n break;\n case \"move\": {\n if (!patch.from) break;\n const moveValue = getByPath(obj, patch.from);\n removeByPath(obj, patch.from);\n addByPath(obj, patch.path, moveValue);\n break;\n }\n case \"copy\": {\n if (!patch.from) break;\n const copyValue = getByPath(obj, patch.from);\n addByPath(obj, patch.path, copyValue);\n break;\n }\n case \"test\": {\n const actual = getByPath(obj, patch.path);\n if (!deepEqual(actual, patch.value)) {\n throw new Error(\n `Test operation failed: value at \"${patch.path}\" does not match`\n );\n }\n break;\n }\n }\n return obj;\n}\nfunction applySpecPatch(spec, patch) {\n applySpecStreamPatch(spec, patch);\n return spec;\n}\nfunction nestedToFlat(nested) {\n const elements = {};\n let counter = 0;\n function walk(node) {\n const key = `el-${counter++}`;\n const { type, props, children: rawChildren, ...rest } = node;\n const childKeys = [];\n if (Array.isArray(rawChildren)) {\n for (const child of rawChildren) {\n if (child && typeof child === \"object\" && \"type\" in child) {\n childKeys.push(walk(child));\n }\n }\n }\n const element = {\n type: type ?? \"unknown\",\n props: props ?? {},\n children: childKeys\n };\n for (const [k, v] of Object.entries(rest)) {\n if (k !== \"state\" && v !== void 0) {\n element[k] = v;\n }\n }\n elements[key] = element;\n return key;\n }\n const root = walk(nested);\n const spec = { root, elements };\n if (nested.state && typeof nested.state === \"object\" && !Array.isArray(nested.state)) {\n spec.state = nested.state;\n }\n return spec;\n}\nfunction compileSpecStream(stream, initial = {}) {\n const lines = stream.split(\"\\n\");\n const result = { ...initial };\n for (const line of lines) {\n const patch = parseSpecStreamLine(line);\n if (patch) {\n applySpecStreamPatch(result, patch);\n }\n }\n return result;\n}\nfunction createSpecStreamCompiler(initial = {}) {\n let result = { ...initial };\n let buffer = \"\";\n const appliedPatches = [];\n const processedLines = /* @__PURE__ */ new Set();\n return {\n push(chunk) {\n buffer += chunk;\n const newPatches = [];\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\";\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || processedLines.has(trimmed)) continue;\n processedLines.add(trimmed);\n const patch = parseSpecStreamLine(trimmed);\n if (patch) {\n applySpecStreamPatch(result, patch);\n appliedPatches.push(patch);\n newPatches.push(patch);\n }\n }\n if (newPatches.length > 0) {\n result = { ...result };\n }\n return { result, newPatches };\n },\n getResult() {\n if (buffer.trim()) {\n const patch = parseSpecStreamLine(buffer);\n if (patch && !processedLines.has(buffer.trim())) {\n processedLines.add(buffer.trim());\n applySpecStreamPatch(result, patch);\n appliedPatches.push(patch);\n result = { ...result };\n }\n buffer = \"\";\n }\n return result;\n },\n getPatches() {\n return [...appliedPatches];\n },\n reset(newInitial = {}) {\n result = { ...newInitial };\n buffer = \"\";\n appliedPatches.length = 0;\n processedLines.clear();\n }\n };\n}\nfunction createMixedStreamParser(callbacks) {\n let buffer = \"\";\n let inSpecFence = false;\n function processLine(line) {\n const trimmed = line.trim();\n if (!inSpecFence && trimmed.startsWith(\"```spec\")) {\n inSpecFence = true;\n return;\n }\n if (inSpecFence && trimmed === \"```\") {\n inSpecFence = false;\n return;\n }\n if (!trimmed) return;\n if (inSpecFence) {\n const patch2 = parseSpecStreamLine(trimmed);\n if (patch2) {\n callbacks.onPatch(patch2);\n }\n return;\n }\n const patch = parseSpecStreamLine(trimmed);\n if (patch) {\n callbacks.onPatch(patch);\n } else {\n callbacks.onText(line);\n }\n }\n return {\n push(chunk) {\n buffer += chunk;\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\";\n for (const line of lines) {\n processLine(line);\n }\n },\n flush() {\n if (buffer.trim()) {\n processLine(buffer);\n }\n buffer = \"\";\n }\n };\n}\nvar SPEC_FENCE_OPEN = \"```spec\";\nvar SPEC_FENCE_CLOSE = \"```\";\nfunction createJsonRenderTransform() {\n let lineBuffer = \"\";\n let currentTextId = \"\";\n let buffering = false;\n let inSpecFence = false;\n let inTextBlock = false;\n let textIdCounter = 0;\n function closeTextBlock(controller) {\n if (inTextBlock) {\n controller.enqueue({ type: \"text-end\", id: currentTextId });\n inTextBlock = false;\n }\n }\n function ensureTextBlock(controller) {\n if (!inTextBlock) {\n textIdCounter++;\n currentTextId = String(textIdCounter);\n controller.enqueue({ type: \"text-start\", id: currentTextId });\n inTextBlock = true;\n }\n }\n function emitTextDelta(delta, controller) {\n ensureTextBlock(controller);\n controller.enqueue({ type: \"text-delta\", id: currentTextId, delta });\n }\n function emitPatch(patch, controller) {\n closeTextBlock(controller);\n controller.enqueue({\n type: SPEC_DATA_PART_TYPE,\n data: { type: \"patch\", patch }\n });\n }\n function flushBuffer(controller) {\n if (!lineBuffer) return;\n const trimmed = lineBuffer.trim();\n if (inSpecFence) {\n if (trimmed) {\n const patch = parseSpecStreamLine(trimmed);\n if (patch) emitPatch(patch, controller);\n }\n lineBuffer = \"\";\n buffering = false;\n return;\n }\n if (trimmed) {\n const patch = parseSpecStreamLine(trimmed);\n if (patch) {\n emitPatch(patch, controller);\n } else {\n emitTextDelta(lineBuffer, controller);\n }\n } else {\n emitTextDelta(lineBuffer, controller);\n }\n lineBuffer = \"\";\n buffering = false;\n }\n function processCompleteLine(line, controller) {\n const trimmed = line.trim();\n if (!inSpecFence && trimmed.startsWith(SPEC_FENCE_OPEN)) {\n inSpecFence = true;\n return;\n }\n if (inSpecFence && trimmed === SPEC_FENCE_CLOSE) {\n inSpecFence = false;\n return;\n }\n if (inSpecFence) {\n if (trimmed) {\n const patch2 = parseSpecStreamLine(trimmed);\n if (patch2) emitPatch(patch2, controller);\n }\n return;\n }\n if (!trimmed) {\n emitTextDelta(\"\\n\", controller);\n return;\n }\n const patch = parseSpecStreamLine(trimmed);\n if (patch) {\n emitPatch(patch, controller);\n } else {\n emitTextDelta(line + \"\\n\", controller);\n }\n }\n return new TransformStream({\n transform(chunk, controller) {\n switch (chunk.type) {\n case \"text-start\": {\n const id = chunk.id;\n const idNum = parseInt(id, 10);\n if (!isNaN(idNum) && idNum >= textIdCounter) {\n textIdCounter = idNum;\n }\n currentTextId = id;\n inTextBlock = true;\n controller.enqueue(chunk);\n break;\n }\n case \"text-delta\": {\n const delta = chunk;\n const text = delta.delta;\n for (let i = 0; i < text.length; i++) {\n const ch = text.charAt(i);\n if (ch === \"\\n\") {\n if (buffering) {\n processCompleteLine(lineBuffer, controller);\n lineBuffer = \"\";\n buffering = false;\n } else {\n if (!inSpecFence) {\n emitTextDelta(\"\\n\", controller);\n }\n }\n } else if (lineBuffer.length === 0 && !buffering) {\n if (inSpecFence || ch === \"{\" || ch === \"`\") {\n buffering = true;\n lineBuffer += ch;\n } else {\n emitTextDelta(ch, controller);\n }\n } else if (buffering) {\n lineBuffer += ch;\n } else {\n emitTextDelta(ch, controller);\n }\n }\n break;\n }\n case \"text-end\": {\n flushBuffer(controller);\n if (inTextBlock) {\n controller.enqueue({ type: \"text-end\", id: currentTextId });\n inTextBlock = false;\n }\n break;\n }\n default: {\n controller.enqueue(chunk);\n break;\n }\n }\n },\n flush(controller) {\n flushBuffer(controller);\n closeTextBlock(controller);\n }\n });\n}\nvar SPEC_DATA_PART = \"spec\";\nvar SPEC_DATA_PART_TYPE = `data-${SPEC_DATA_PART}`;\nfunction pipeJsonRender(stream) {\n return stream.pipeThrough(\n createJsonRenderTransform()\n );\n}\n\n// src/state-store.ts\nfunction immutableSetByPath(root, path, value) {\n const segments = parseJsonPointer(path);\n if (segments.length === 0) return root;\n const result = { ...root };\n let current = result;\n for (let i = 0; i < segments.length - 1; i++) {\n const seg = segments[i];\n const child = current[seg];\n if (Array.isArray(child)) {\n current[seg] = [...child];\n } else if (child !== null && typeof child === \"object\") {\n current[seg] = { ...child };\n } else {\n const nextSeg = segments[i + 1];\n current[seg] = nextSeg !== void 0 && /^\\d+$/.test(nextSeg) ? [] : {};\n }\n current = current[seg];\n }\n const lastSeg = segments[segments.length - 1];\n if (Array.isArray(current)) {\n if (lastSeg === \"-\") {\n current.push(value);\n } else {\n current[parseInt(lastSeg, 10)] = value;\n }\n } else {\n current[lastSeg] = value;\n }\n return result;\n}\nfunction createStateStore(initialState = {}) {\n let state = { ...initialState };\n const listeners = /* @__PURE__ */ new Set();\n function notify() {\n for (const listener of listeners) {\n listener();\n }\n }\n return {\n get(path) {\n return getByPath(state, path);\n },\n set(path, value) {\n if (getByPath(state, path) === value) return;\n state = immutableSetByPath(state, path, value);\n notify();\n },\n update(updates) {\n let changed = false;\n let next = state;\n for (const [path, value] of Object.entries(updates)) {\n if (getByPath(next, path) !== value) {\n next = immutableSetByPath(next, path, value);\n changed = true;\n }\n }\n if (!changed) return;\n state = next;\n notify();\n },\n getSnapshot() {\n return state;\n },\n getServerSnapshot() {\n return state;\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n }\n };\n}\nfunction createStoreAdapter(config) {\n return {\n get(path) {\n return getByPath(config.getSnapshot(), path);\n },\n set(path, value) {\n const current = config.getSnapshot();\n if (getByPath(current, path) === value) return;\n config.setSnapshot(immutableSetByPath(current, path, value));\n },\n update(updates) {\n let next = config.getSnapshot();\n let changed = false;\n for (const [path, value] of Object.entries(updates)) {\n if (getByPath(next, path) !== value) {\n next = immutableSetByPath(next, path, value);\n changed = true;\n }\n }\n if (!changed) return;\n config.setSnapshot(next);\n },\n getSnapshot: config.getSnapshot,\n getServerSnapshot: config.getSnapshot,\n subscribe: config.subscribe\n };\n}\nvar MAX_FLATTEN_DEPTH = 20;\nfunction flattenToPointers(obj, prefix = \"\", _depth = 0, _seen, _warned) {\n const seen = _seen ?? /* @__PURE__ */ new Set();\n const warned = _warned ?? { current: false };\n const result = {};\n for (const [key, value] of Object.entries(obj)) {\n const pointer = `${prefix}/${key}`;\n if (_depth < MAX_FLATTEN_DEPTH && value !== null && typeof value === \"object\" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype && !seen.has(value)) {\n seen.add(value);\n Object.assign(\n result,\n flattenToPointers(\n value,\n pointer,\n _depth + 1,\n seen,\n warned\n )\n );\n } else {\n if (process.env.NODE_ENV !== \"production\" && !warned.current && _depth >= MAX_FLATTEN_DEPTH && value !== null && typeof value === \"object\" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype && !seen.has(value)) {\n warned.current = true;\n console.warn(\n `flattenToPointers: depth limit (${MAX_FLATTEN_DEPTH}) reached. Nested state beyond this depth will be treated as a leaf value.`\n );\n }\n result[pointer] = value;\n }\n }\n return result;\n}\n\nexport {\n DynamicValueSchema,\n DynamicStringSchema,\n DynamicNumberSchema,\n DynamicBooleanSchema,\n resolveDynamicValue,\n getByPath,\n setByPath,\n addByPath,\n removeByPath,\n findFormValue,\n parseSpecStreamLine,\n applySpecStreamPatch,\n applySpecPatch,\n nestedToFlat,\n compileSpecStream,\n createSpecStreamCompiler,\n createMixedStreamParser,\n createJsonRenderTransform,\n SPEC_DATA_PART,\n SPEC_DATA_PART_TYPE,\n pipeJsonRender,\n immutableSetByPath,\n createStateStore,\n createStoreAdapter,\n flattenToPointers\n};\n//# sourceMappingURL=chunk-AFLK3Q4T.mjs.map"],"x_google_ignoreList":[0],"mappings":";;AAEA,IAAI,IAAqBA,EAAQ;CAC/BC,GAAU;CACVC,GAAU;CACVC,GAAW;CACXC,GAAQ;CACRC,EAAS,EAAE,QAAQJ,GAAU,EAAE,CAAC;CACjC,CAAC;AACwBD,EAAQ,CAChCC,GAAU,EACVI,EAAS,EAAE,QAAQJ,GAAU,EAAE,CAAC,CACjC,CAAC,EACwBD,EAAQ,CAChCE,GAAU,EACVG,EAAS,EAAE,QAAQJ,GAAU,EAAE,CAAC,CACjC,CAAC,EACyBD,EAAQ,CACjCG,GAAW,EACXE,EAAS,EAAE,QAAQJ,GAAU,EAAE,CAAC,CACjC,CAAC;AACF,SAAS,EAAoB,GAAO,GAAY;AAC1C,UAAU,KAMd,QAHI,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