@almadar/core 10.129.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/behavior-package.d.ts +49 -11
  2. package/dist/behavior-package.js +1 -1
  3. package/dist/{orbital-CkFdDS9f.d.ts → builders-BdgbY7Th.d.ts} +5828 -6917
  4. package/dist/builders.d.ts +6 -6
  5. package/dist/builders.js +7 -6
  6. package/dist/{bus-CcbB__oo.d.ts → bus-C0hFDNFR.d.ts} +262 -354
  7. package/dist/chunk-347APWFM.js +286 -0
  8. package/dist/chunk-347APWFM.js.map +1 -0
  9. package/dist/chunk-5WQ3U7NJ.js +2363 -0
  10. package/dist/chunk-5WQ3U7NJ.js.map +1 -0
  11. package/dist/chunk-5YTPYMPZ.js +99 -0
  12. package/dist/chunk-5YTPYMPZ.js.map +1 -0
  13. package/dist/chunk-66Q5VX2F.js +3810 -0
  14. package/dist/chunk-66Q5VX2F.js.map +1 -0
  15. package/dist/chunk-7GHJU5WI.js +39 -0
  16. package/dist/chunk-7GHJU5WI.js.map +1 -0
  17. package/dist/chunk-B4MNHGBP.js +8 -0
  18. package/dist/chunk-B4MNHGBP.js.map +1 -0
  19. package/dist/chunk-E4T2MQAV.js +24 -0
  20. package/dist/chunk-E4T2MQAV.js.map +1 -0
  21. package/dist/chunk-ENOCKYGA.js +412 -0
  22. package/dist/chunk-ENOCKYGA.js.map +1 -0
  23. package/dist/chunk-FGT5OS2Y.js +918 -0
  24. package/dist/chunk-FGT5OS2Y.js.map +1 -0
  25. package/dist/chunk-GF7KCLNR.js +3284 -0
  26. package/dist/chunk-GF7KCLNR.js.map +1 -0
  27. package/dist/chunk-PNGFWLHD.js +1567 -0
  28. package/dist/chunk-PNGFWLHD.js.map +1 -0
  29. package/dist/{chunk-X4SC7FGF.js → chunk-RGACZEYC.js} +99 -96
  30. package/dist/chunk-RGACZEYC.js.map +1 -0
  31. package/dist/{chunk-RYPVOI6H.js → chunk-SNZYN7UA.js} +2541 -433
  32. package/dist/{chunk-RYPVOI6H.js.map → chunk-SNZYN7UA.js.map} +1 -1
  33. package/dist/{chunk-KDMV222Q.js → chunk-TDNQT3M3.js} +304 -373
  34. package/dist/chunk-TDNQT3M3.js.map +1 -0
  35. package/dist/chunk-VG7BRFUD.js +152 -0
  36. package/dist/chunk-VG7BRFUD.js.map +1 -0
  37. package/dist/chunk-Z7BI7DE7.js +1293 -0
  38. package/dist/chunk-Z7BI7DE7.js.map +1 -0
  39. package/dist/{domain-Dz3jP-UM.d.ts → domain-Cpmja5ak.d.ts} +55 -55
  40. package/dist/{effect-CiEVLsZz.d.ts → effect-DZaXwSAz.d.ts} +283 -453
  41. package/dist/{effect-result-Bebwu9yT.d.ts → effect-result-1HpXgeBc.d.ts} +656 -851
  42. package/dist/{expression-D0Fs0riG.d.ts → expression-DirYKz-f.d.ts} +5 -13
  43. package/dist/factory/index.d.ts +7 -144
  44. package/dist/factory/index.js +8 -8
  45. package/dist/factory-runtime/index.d.ts +7 -6
  46. package/dist/factory-runtime/index.js +527 -8
  47. package/dist/factory-runtime/index.js.map +1 -1
  48. package/dist/fixtures.d.ts +9 -11
  49. package/dist/fixtures.js +12 -8
  50. package/dist/fixtures.js.map +1 -1
  51. package/dist/i18n/index.d.ts +15 -19
  52. package/dist/i18n/index.js +2 -1
  53. package/dist/{index-BC-Jycqj.d.ts → index-D7SxwNdv.d.ts} +34 -734
  54. package/dist/index.d.ts +92 -247
  55. package/dist/index.js +322 -986
  56. package/dist/index.js.map +1 -1
  57. package/dist/kernel-wire.d.ts +3 -3
  58. package/dist/kernel-wire.js +3 -79
  59. package/dist/kernel-wire.js.map +1 -1
  60. package/dist/language/constructs.json +22 -2
  61. package/dist/language/program-types.json +203 -22
  62. package/dist/language/protocols.json +46 -0
  63. package/dist/language/ui-vocabulary.json +1697 -0
  64. package/dist/language/validation-codes.json +1222 -1212
  65. package/dist/language/vocabulary.json +44 -8
  66. package/dist/language-data.d.ts +7 -4
  67. package/dist/language-data.js +20 -14
  68. package/dist/language-data.js.map +1 -1
  69. package/dist/patterns/component-mapping.json +11 -1
  70. package/dist/patterns/definitions.d.ts +2 -2
  71. package/dist/patterns/definitions.js +1 -1
  72. package/dist/patterns/event-contracts.json +1 -15
  73. package/dist/patterns/game-font-families.json +13 -0
  74. package/dist/patterns/index.d.ts +24 -120
  75. package/dist/patterns/index.js +3 -3
  76. package/dist/patterns/pattern-tile-geometry.json +1065 -0
  77. package/dist/patterns/patterns-registry.json +2539 -431
  78. package/dist/patterns/registry.json +2539 -431
  79. package/dist/trait-sRjIivFq.d.ts +3519 -0
  80. package/dist/types/index.d.ts +9 -10
  81. package/dist/types/index.js +11 -5
  82. package/dist/{types-DGwrltUF.d.ts → types-C6_yPMpn.d.ts} +3 -3
  83. package/fixtures/events-wire/client-effects-by-trait/response.json +0 -18
  84. package/fixtures/events-wire/client-effects-provenance/response.json +0 -18
  85. package/fixtures/events-wire/effect-results-every-kind/response.json +2 -27
  86. package/fixtures/events-wire/navigate-1/response.json +8 -5
  87. package/fixtures/events-wire/navigate-2/response.json +11 -8
  88. package/fixtures/events-wire/navigate-3/response.json +14 -11
  89. package/fixtures/events-wire/navigate-back/response.json +7 -4
  90. package/fixtures/events-wire/render-ui-3/response.json +12 -9
  91. package/fixtures/events-wire/render-ui-clear/response.json +0 -7
  92. package/fixtures/events-wire/sse-stream/response.json +0 -20
  93. package/fixtures/events-wire/sse-stream/stream.json +0 -20
  94. package/fixtures/events-wire/stateless-traits/response.json +14 -5
  95. package/fixtures/kernel-wire/golden/basic-entity.json +1687 -0
  96. package/fixtures/kernel-wire/golden/entity-rerender.json +743 -0
  97. package/fixtures/kernel-wire/golden/rollback.json +793 -0
  98. package/fixtures/kernel-wire/golden/tick-counter.json +1538 -0
  99. package/fixtures/kernel-wire/golden/two-orbital-chore.json +847 -0
  100. package/fixtures/kernel-wire/golden/two-orbital-task.json +457 -0
  101. package/fixtures/kernel-wire/played-step.json +136 -0
  102. package/fixtures/kernel-wire/scripts/basic-entity.json +28 -0
  103. package/fixtures/kernel-wire/scripts/entity-rerender.json +13 -0
  104. package/fixtures/kernel-wire/scripts/rollback.json +53 -0
  105. package/fixtures/kernel-wire/scripts/tick-counter.json +26 -0
  106. package/fixtures/kernel-wire/scripts/two-orbital-chore.json +9 -0
  107. package/fixtures/kernel-wire/scripts/two-orbital-task.json +9 -0
  108. package/package.json +28 -19
  109. package/dist/builders-DmZE5By0.d.ts +0 -2663
  110. package/dist/chunk-45I2O4SJ.js +0 -4646
  111. package/dist/chunk-45I2O4SJ.js.map +0 -1
  112. package/dist/chunk-6LR43Z5E.js +0 -3061
  113. package/dist/chunk-6LR43Z5E.js.map +0 -1
  114. package/dist/chunk-GIUA3NUJ.js +0 -809
  115. package/dist/chunk-GIUA3NUJ.js.map +0 -1
  116. package/dist/chunk-GTY53NS5.js +0 -1908
  117. package/dist/chunk-GTY53NS5.js.map +0 -1
  118. package/dist/chunk-JOHDVS6J.js +0 -1614
  119. package/dist/chunk-JOHDVS6J.js.map +0 -1
  120. package/dist/chunk-KDMV222Q.js.map +0 -1
  121. package/dist/chunk-QRHJUS3D.js +0 -23
  122. package/dist/chunk-QRHJUS3D.js.map +0 -1
  123. package/dist/chunk-QUOTJULD.js +0 -4009
  124. package/dist/chunk-QUOTJULD.js.map +0 -1
  125. package/dist/chunk-V5VNGRVU.js +0 -66
  126. package/dist/chunk-V5VNGRVU.js.map +0 -1
  127. package/dist/chunk-X4SC7FGF.js.map +0 -1
  128. package/dist/entityAccess-BPSz1i2n.d.ts +0 -80
  129. package/dist/mock/index.d.ts +0 -153
  130. package/dist/mock/index.js +0 -190
  131. package/dist/mock/index.js.map +0 -1
  132. package/dist/schema-T5RT5s6H.d.ts +0 -282
  133. package/dist/state-machine/index.d.ts +0 -359
  134. package/dist/state-machine/index.js +0 -3
  135. package/dist/state-machine/index.js.map +0 -1
@@ -1,1908 +0,0 @@
1
- import { JsonValueSchema } from './chunk-QRHJUS3D.js';
2
- import { z } from 'zod';
3
-
4
- var ID_PREFIXES = {
5
- orbital: "orb_",
6
- entity: "ent_",
7
- trait: "trt_",
8
- event: "evt_",
9
- page: "pag_",
10
- service: "svc_",
11
- theme: "thm_",
12
- palette: "pal_"
13
- };
14
- function brand(value) {
15
- return value;
16
- }
17
- function makeIdKind(kind) {
18
- const prefix = ID_PREFIXES[kind];
19
- const is = (value) => value.startsWith(prefix) && value.length > prefix.length;
20
- const as = (value) => {
21
- if (!is(value)) {
22
- throw new Error(
23
- `Expected ${kind} id (prefix "${prefix}"), got: ${JSON.stringify(value)}`
24
- );
25
- }
26
- return brand(value);
27
- };
28
- return { prefix, is, as };
29
- }
30
- var orbitalKind = makeIdKind("orbital");
31
- var entityKind = makeIdKind("entity");
32
- var traitKind = makeIdKind("trait");
33
- var eventKind = makeIdKind("event");
34
- var pageKind = makeIdKind("page");
35
- var serviceKind = makeIdKind("service");
36
- var themeKind = makeIdKind("theme");
37
- var paletteKind = makeIdKind("palette");
38
- var isOrbitalId = orbitalKind.is;
39
- var asOrbitalId = orbitalKind.as;
40
- var isEntityId = entityKind.is;
41
- var asEntityId = entityKind.as;
42
- var isTraitId = traitKind.is;
43
- var asTraitId = traitKind.as;
44
- var isEventId = eventKind.is;
45
- var asEventId = eventKind.as;
46
- var isPageId = pageKind.is;
47
- var asPageId = pageKind.as;
48
- var isServiceId = serviceKind.is;
49
- var asServiceId = serviceKind.as;
50
- var isThemeId = themeKind.is;
51
- var asThemeId = themeKind.as;
52
- var isPaletteEntryId = paletteKind.is;
53
- var asPaletteEntryId = paletteKind.as;
54
- function idPrefix(kind) {
55
- return ID_PREFIXES[kind];
56
- }
57
- function idKindOf(id) {
58
- for (const kind of Object.keys(ID_PREFIXES)) {
59
- const prefix = ID_PREFIXES[kind];
60
- if (id.startsWith(prefix) && id.length > prefix.length) return kind;
61
- }
62
- return null;
63
- }
64
- var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
65
- var TIME_LEN = 10;
66
- var RANDOM_LEN = 16;
67
- function randomBytes(len) {
68
- const g = globalThis;
69
- if (g.crypto?.getRandomValues) {
70
- return g.crypto.getRandomValues(new Uint8Array(len));
71
- }
72
- throw new Error("mintId: no crypto.getRandomValues available in this runtime");
73
- }
74
- function encodeTime(now) {
75
- let value = now;
76
- let out = "";
77
- for (let i = 0; i < TIME_LEN; i++) {
78
- const mod = value % 32;
79
- out = CROCKFORD[mod] + out;
80
- value = (value - mod) / 32;
81
- }
82
- return out;
83
- }
84
- function encodeRandom() {
85
- const bytes = randomBytes(RANDOM_LEN);
86
- let out = "";
87
- for (let i = 0; i < RANDOM_LEN; i++) {
88
- out += CROCKFORD[bytes[i] & 31];
89
- }
90
- return out;
91
- }
92
- function ulid() {
93
- return encodeTime(Date.now()) + encodeRandom();
94
- }
95
- function mintId(kind) {
96
- return brand(ID_PREFIXES[kind] + ulid());
97
- }
98
- var U64_MASK = (1n << 64n) - 1n;
99
- var BODY_TIME_MASK = (1n << 50n) - 1n;
100
- var BODY_RANDOM_MASK = (1n << 80n) - 1n;
101
- var FNV_PRIME_64 = 0x100000001b3n;
102
- var FNV_OFFSET_1 = 0xcbf29ce484222325n;
103
- var FNV_OFFSET_2 = (0x100000001b3n ^ 0xdeadbeefn) & U64_MASK;
104
- function splitmix64(x) {
105
- let z13 = x + 0x9e3779b97f4a7c15n & U64_MASK;
106
- z13 = (z13 ^ z13 >> 30n) * 0xbf58476d1ce4e5b9n & U64_MASK;
107
- z13 = (z13 ^ z13 >> 27n) * 0x94d049bb133111ebn & U64_MASK;
108
- return (z13 ^ z13 >> 31n) & U64_MASK;
109
- }
110
- function fnv1a64(data, offset) {
111
- let h = offset & U64_MASK;
112
- for (const b of data) {
113
- h = (h ^ BigInt(b)) & U64_MASK;
114
- h = h * FNV_PRIME_64 & U64_MASK;
115
- }
116
- return h;
117
- }
118
- function pushBase32(value, nChars) {
119
- let v = value;
120
- const chars = new Array(nChars);
121
- for (let i = nChars - 1; i >= 0; i--) {
122
- chars[i] = CROCKFORD[Number(v & 0x1fn)];
123
- v >>= 5n;
124
- }
125
- return chars.join("");
126
- }
127
- function deriveId(parentId, discriminator) {
128
- const kind = idKindOf(parentId) ?? "trait";
129
- const encoder = new TextEncoder();
130
- const parentBytes = encoder.encode(parentId);
131
- const discBytes = encoder.encode(discriminator);
132
- const data = new Uint8Array(parentBytes.length + 1 + discBytes.length);
133
- data.set(parentBytes, 0);
134
- data[parentBytes.length] = 31;
135
- data.set(discBytes, parentBytes.length + 1);
136
- const h1 = splitmix64(fnv1a64(data, FNV_OFFSET_1));
137
- const h2 = splitmix64(fnv1a64(data, FNV_OFFSET_2));
138
- const timeBits = (h1 << 64n | h2) & BODY_TIME_MASK;
139
- const randBits = (h2 << 64n | h1) & BODY_RANDOM_MASK;
140
- return ID_PREFIXES[kind] + pushBase32(timeBits, 10) + pushBase32(randBits, 16);
141
- }
142
- function ledgerResolveName(ledger, kind, name) {
143
- for (const [id, entry] of Object.entries(ledger.entries)) {
144
- if (entry.kind === kind && entry.curName === name) return id;
145
- }
146
- return null;
147
- }
148
- function ledgerRename(ledger, id, to, at) {
149
- const entry = ledger.entries[id];
150
- if (entry === void 0 || entry.curName === to) return ledger;
151
- const updated = {
152
- ...entry,
153
- curName: to,
154
- renames: [...entry.renames, { from: entry.curName, to, at }]
155
- };
156
- return { ...ledger, entries: { ...ledger.entries, [id]: updated } };
157
- }
158
- function ledgerCurName(ledger, id) {
159
- return ledger.entries[id]?.curName ?? null;
160
- }
161
- var OrbitalIdSchema = z.string().refine(isOrbitalId, { message: `Expected an orbital id (prefix "${ID_PREFIXES.orbital}")` });
162
- var EntityIdSchema = z.string().refine(isEntityId, { message: `Expected an entity id (prefix "${ID_PREFIXES.entity}")` });
163
- var TraitIdSchema = z.string().refine(isTraitId, { message: `Expected a trait id (prefix "${ID_PREFIXES.trait}")` });
164
- var EventIdSchema = z.string().refine(isEventId, { message: `Expected an event id (prefix "${ID_PREFIXES.event}")` });
165
- var PageIdSchema = z.string().refine(isPageId, { message: `Expected a page id (prefix "${ID_PREFIXES.page}")` });
166
- var ServiceIdSchema = z.string().refine(isServiceId, { message: `Expected a service id (prefix "${ID_PREFIXES.service}")` });
167
- var ThemeIdSchema = z.string().refine(isThemeId, { message: `Expected a theme id (prefix "${ID_PREFIXES.theme}")` });
168
- var PaletteEntryIdSchema = z.string().refine(isPaletteEntryId, { message: `Expected a palette-entry id (prefix "${ID_PREFIXES.palette}")` });
169
- var LedgerKindSchema = z.enum([
170
- "orbital",
171
- "entity",
172
- "trait",
173
- "event",
174
- "page",
175
- "service",
176
- "theme"
177
- ]);
178
- var LedgerEntrySchema = z.object({
179
- id: z.string(),
180
- kind: LedgerKindSchema,
181
- bakedName: z.string(),
182
- curName: z.string(),
183
- renames: z.array(
184
- z.object({ from: z.string(), to: z.string(), at: z.string() })
185
- ),
186
- owner: z.enum(["std", "io", "workspace"]),
187
- parent: TraitIdSchema.optional()
188
- });
189
- var IdentityLedgerSchema = z.object({
190
- schemaVersion: z.literal(1),
191
- entries: z.record(z.string(), LedgerEntrySchema)
192
- });
193
- var FieldProjectionSchema = z.object({
194
- type: z.string().min(1),
195
- field: z.string().min(1).optional()
196
- });
197
- var FIELD_TYPES = [
198
- "string",
199
- "number",
200
- "int",
201
- "boolean",
202
- "date",
203
- "timestamp",
204
- "datetime",
205
- "instant",
206
- "email",
207
- "url",
208
- "phone",
209
- "uuid",
210
- "image",
211
- "money",
212
- "file",
213
- "bytes",
214
- "array",
215
- "object",
216
- "enum",
217
- "relation",
218
- "trait",
219
- "orbital",
220
- "behavior",
221
- "slot",
222
- "pattern",
223
- "node",
224
- "event",
225
- "EventAddress",
226
- "CallKey",
227
- "SExpr",
228
- "union",
229
- "tuple",
230
- "field"
231
- ];
232
- var SEMANTIC_STRING_TYPES = ["email", "url", "phone", "uuid", "image"];
233
- function isSemanticStringType(type) {
234
- return SEMANTIC_STRING_TYPES.includes(type);
235
- }
236
- var FieldTagSchema = z.enum(FIELD_TYPES);
237
- function isTypeVariable(type) {
238
- return /^\$.+$/.test(type);
239
- }
240
- var TypeVariableSchema = z.custom(
241
- (v) => typeof v === "string" && isTypeVariable(v),
242
- { message: "a type variable is `$<name>`" }
243
- );
244
- var FieldTypeSchema = z.union([FieldTagSchema, TypeVariableSchema]);
245
- var TYPE_POSITION_ONLY = [
246
- "Map",
247
- "any",
248
- "asset",
249
- "bool",
250
- "component",
251
- "duration",
252
- "entity",
253
- "float",
254
- "icon",
255
- "null",
256
- "secret",
257
- "void"
258
- ];
259
- var RelationCardinalitySchema = z.enum([
260
- "one",
261
- "many",
262
- "one-to-many",
263
- "many-to-one",
264
- "many-to-many"
265
- ]);
266
- var RelationConfigSchema = z.object({
267
- entity: z.string().min(1, "Target entity is required"),
268
- entityId: EntityIdSchema.optional(),
269
- field: z.string().optional(),
270
- cardinality: RelationCardinalitySchema.optional(),
271
- onDelete: z.enum(["cascade", "nullify", "restrict"]).optional(),
272
- // Legacy compatibility fields
273
- foreignKey: z.string().optional(),
274
- target: z.string().optional(),
275
- type: RelationCardinalitySchema.optional()
276
- }).transform((data) => {
277
- const cardinality = data.cardinality || data.type;
278
- const normalized = {
279
- entity: data.entity || data.target || "",
280
- ...data.entityId !== void 0 ? { entityId: data.entityId } : {},
281
- ...cardinality !== void 0 ? { cardinality } : {},
282
- ...data.field !== void 0 ? { field: data.field } : {},
283
- ...data.onDelete !== void 0 ? { onDelete: data.onDelete } : {}
284
- };
285
- return normalized;
286
- });
287
- var SEMANTIC_STRING_PATTERNS = {
288
- email: "^[^\\s@]+@[^\\s@.]+\\.[^\\s@]+$",
289
- url: "^https?://[^\\s]+$",
290
- phone: "^[+]?[\\d\\s().-]{7,}$",
291
- uuid: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
292
- };
293
- var EMAIL_RE = new RegExp(SEMANTIC_STRING_PATTERNS.email);
294
- var URL_RE = new RegExp(SEMANTIC_STRING_PATTERNS.url);
295
- var PHONE_RE = new RegExp(SEMANTIC_STRING_PATTERNS.phone);
296
- var UUID_RE = new RegExp(SEMANTIC_STRING_PATTERNS.uuid);
297
- function isEmailValue(value) {
298
- return EMAIL_RE.test(value);
299
- }
300
- function isUrlValue(value) {
301
- return URL_RE.test(value);
302
- }
303
- function isPhoneValue(value) {
304
- return PHONE_RE.test(value);
305
- }
306
- function isUuidValue(value) {
307
- return UUID_RE.test(value);
308
- }
309
- var FileValueSchema = z.object({
310
- name: z.string(),
311
- url: z.string(),
312
- mimeType: z.string(),
313
- sizeBytes: z.number()
314
- });
315
- function isFileValue(value) {
316
- return FileValueSchema.safeParse(value).success;
317
- }
318
- function isSemanticStringValue(type, value) {
319
- switch (type) {
320
- case "email":
321
- return isEmailValue(value);
322
- case "url":
323
- case "image":
324
- return isUrlValue(value);
325
- case "phone":
326
- return isPhoneValue(value);
327
- case "uuid":
328
- return isUuidValue(value);
329
- }
330
- }
331
- function isTypeVariableField(f) {
332
- return isTypeVariable(f.type);
333
- }
334
- var FIELD_TYPE_ALIASES = {
335
- text: "string",
336
- float: "number",
337
- ts: "timestamp"
338
- };
339
- var EntityFieldSchema = z.lazy(() => {
340
- const baseFieldShape = {
341
- name: z.string().min(1, "Field name is required").optional(),
342
- required: z.boolean().optional(),
343
- nullable: z.boolean().optional(),
344
- additionalProperties: EntityFieldSchema.optional(),
345
- primaryKey: z.boolean().optional(),
346
- default: JsonValueSchema.optional(),
347
- min: z.number().optional(),
348
- max: z.number().optional(),
349
- properties: z.record(z.string(), EntityFieldSchema).optional(),
350
- intrinsic: z.boolean().optional(),
351
- description: z.string().optional(),
352
- synonyms: z.string().optional(),
353
- mock: z.string().optional(),
354
- mergedFrom: z.string().optional(),
355
- projectedFrom: FieldProjectionSchema.optional()
356
- };
357
- function scalarVariant(t) {
358
- return z.object({
359
- ...baseFieldShape,
360
- type: z.literal(t),
361
- values: z.array(z.string()).optional()
362
- });
363
- }
364
- return z.preprocess(
365
- (input) => {
366
- if (input === null || typeof input !== "object" || !("type" in input) || typeof input.type !== "string") {
367
- return input;
368
- }
369
- const obj = input;
370
- const next = { ...obj };
371
- const aliased = FIELD_TYPE_ALIASES[obj.type];
372
- if (aliased !== void 0) next.type = aliased;
373
- if (next.enum !== void 0 && next.values === void 0) {
374
- next.values = next.enum;
375
- }
376
- delete next.enum;
377
- return next;
378
- },
379
- z.union([
380
- z.object({ ...baseFieldShape, type: TypeVariableSchema }),
381
- z.discriminatedUnion("type", [
382
- scalarVariant("string"),
383
- scalarVariant("number"),
384
- scalarVariant("int"),
385
- scalarVariant("boolean"),
386
- scalarVariant("date"),
387
- scalarVariant("timestamp"),
388
- scalarVariant("datetime"),
389
- scalarVariant("instant"),
390
- scalarVariant("email"),
391
- scalarVariant("url"),
392
- scalarVariant("phone"),
393
- scalarVariant("uuid"),
394
- scalarVariant("image"),
395
- scalarVariant("trait"),
396
- scalarVariant("orbital"),
397
- scalarVariant("behavior"),
398
- scalarVariant("slot"),
399
- scalarVariant("pattern"),
400
- scalarVariant("node"),
401
- scalarVariant("event"),
402
- scalarVariant("EventAddress"),
403
- scalarVariant("CallKey"),
404
- scalarVariant("money"),
405
- scalarVariant("file"),
406
- scalarVariant("bytes"),
407
- scalarVariant("SExpr"),
408
- // Enum variant — REQUIRES non-empty values.
409
- z.object({
410
- ...baseFieldShape,
411
- type: z.literal("enum"),
412
- values: z.array(z.string()).min(1, "Enum field requires a non-empty `values` array")
413
- }),
414
- // Union variant — tagged struct union; values = variant names,
415
- // per-variant shapes in `properties` (absent on named recursion).
416
- z.object({
417
- ...baseFieldShape,
418
- type: z.literal("union"),
419
- values: z.array(z.string()).min(1, "Union field requires a non-empty `values` array")
420
- }),
421
- // Relation variant — REQUIRES relation config.
422
- z.object({
423
- ...baseFieldShape,
424
- type: z.literal("relation"),
425
- relation: RelationConfigSchema
426
- }),
427
- // Array variant — items optional to match relaxed TS shape.
428
- z.object({
429
- ...baseFieldShape,
430
- type: z.literal("array"),
431
- items: EntityFieldSchema.optional()
432
- }),
433
- // Field-reference variant — `items` is the type the named field must have.
434
- z.object({
435
- ...baseFieldShape,
436
- type: z.literal("field"),
437
- record: z.string().optional(),
438
- items: EntityFieldSchema.optional()
439
- }),
440
- // Tuple variant — slots in `properties`, keyed by index (at least one).
441
- z.object({
442
- ...baseFieldShape,
443
- type: z.literal("tuple"),
444
- properties: z.record(z.string(), EntityFieldSchema).refine((p) => Object.keys(p).length > 0, "Tuple field requires slots in `properties`")
445
- }),
446
- // Object variant — fixed-key struct (`properties`) or dynamic-key
447
- // map (`Map K V`, uniform value schema in `items`).
448
- z.object({
449
- ...baseFieldShape,
450
- type: z.literal("object"),
451
- items: EntityFieldSchema.optional(),
452
- values: z.array(z.string()).optional()
453
- })
454
- ])
455
- ])
456
- );
457
- });
458
- var FieldSchema = EntityFieldSchema;
459
- var ENTITY_ROLES = [
460
- "player",
461
- "enemy",
462
- "npc",
463
- "item",
464
- "tile",
465
- "projectile",
466
- "effect",
467
- "ui",
468
- "decoration",
469
- "vehicle"
470
- ];
471
- var EntityRoleSchema = z.enum(ENTITY_ROLES);
472
- var VISUAL_STYLES = ["pixel", "vector", "hd", "1-bit", "isometric"];
473
- var VisualStyleSchema = z.enum(VISUAL_STYLES);
474
- var ASSET_DIMENSIONS = ["2d", "3d"];
475
- var AssetDimensionSchema = z.enum(ASSET_DIMENSIONS);
476
- var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1", "4:1", "5:3", "1:2"];
477
- var AssetAspectSchema = z.enum(ASSET_ASPECTS);
478
- var FX_KINDS = ["slash", "puff", "heal", "trap", "burst"];
479
- var FxKindSchema = z.enum(FX_KINDS);
480
- var ANIMATION_NAMES = ["idle", "walk", "skate", "jump", "fall", "attack", "hit", "death"];
481
- var AnimationNameSchema = z.enum(ANIMATION_NAMES);
482
- var SPRITE_DIRECTIONS = ["se", "sw", "ne", "nw"];
483
- var SpriteDirectionSchema = z.enum(SPRITE_DIRECTIONS);
484
- var SHEET_PROJECTIONS = ["iso", "front", "back", "top", "perspective"];
485
- var SheetProjectionSchema = z.enum(SHEET_PROJECTIONS);
486
- var AnimationDefSchema = z.object({
487
- row: z.number().int().nonnegative(),
488
- frames: z.number().int().positive(),
489
- frameRate: z.number().positive(),
490
- loop: z.boolean()
491
- });
492
- var SpriteSheetAtlasSchema = z.object({
493
- unit: z.string().optional(),
494
- type: z.string().optional(),
495
- frameWidth: z.number().positive(),
496
- frameHeight: z.number().positive(),
497
- columns: z.number().int().positive(),
498
- rows: z.number().int().positive(),
499
- directions: z.array(SpriteDirectionSchema),
500
- sheets: z.partialRecord(SpriteDirectionSchema, z.string()),
501
- animations: z.record(z.string(), AnimationDefSchema),
502
- projections: z.object({
503
- iso: z.partialRecord(SpriteDirectionSchema, z.string()).optional(),
504
- front: z.string().optional(),
505
- back: z.string().optional(),
506
- top: z.string().optional(),
507
- perspective: z.string().optional()
508
- }).optional()
509
- });
510
- var SubTextureSchema = z.object({
511
- x: z.number().nonnegative(),
512
- y: z.number().nonnegative(),
513
- width: z.number().positive(),
514
- height: z.number().positive(),
515
- frameX: z.number().optional(),
516
- frameY: z.number().optional(),
517
- frameWidth: z.number().positive().optional(),
518
- frameHeight: z.number().positive().optional()
519
- });
520
- var TextureAtlasSchema = z.object({
521
- imagePath: z.string(),
522
- subTextures: z.record(z.string(), SubTextureSchema)
523
- });
524
- var TilesheetSchema = z.object({
525
- imagePath: z.string(),
526
- tileWidth: z.number().positive(),
527
- tileHeight: z.number().positive(),
528
- columns: z.number().int().positive(),
529
- rows: z.number().int().positive(),
530
- margin: z.number().nonnegative().optional(),
531
- spacing: z.number().nonnegative().optional(),
532
- names: z.array(z.string()).optional()
533
- });
534
- var SemanticAssetRefSchema = z.object({
535
- role: z.string().min(1),
536
- category: z.string().min(1),
537
- animations: z.array(z.string()).optional(),
538
- style: VisualStyleSchema.optional(),
539
- variant: z.string().optional(),
540
- dimension: AssetDimensionSchema.optional(),
541
- aspect: AssetAspectSchema.optional()
542
- });
543
- var AssetSchema = SemanticAssetRefSchema.extend({
544
- url: z.string(),
545
- atlas: z.string().optional(),
546
- sprite: z.string().optional(),
547
- name: z.string().optional(),
548
- thumbnailUrl: z.string().optional(),
549
- prompt: z.string().optional(),
550
- choreography: z.record(z.string(), z.array(z.string())).optional(),
551
- fxKind: FxKindSchema.optional()
552
- });
553
- z.object({
554
- pack: z.string().min(1),
555
- version: z.number().int().nonnegative(),
556
- base: z.string(),
557
- assets: z.record(z.string(), AssetSchema)
558
- });
559
- var AssetCatalogEntrySchema = z.object({
560
- url: z.string(),
561
- name: z.string(),
562
- category: z.string(),
563
- kind: z.enum(["image", "spritesheet", "audio", "scene", "portrait", "model", "other"]),
564
- thumbnailUrl: z.string().optional(),
565
- dimension: AssetDimensionSchema.optional(),
566
- aspect: AssetAspectSchema.optional()
567
- });
568
- var AssetCatalogSchema = z.array(AssetCatalogEntrySchema);
569
- var ScenePosSchema = z.object({
570
- x: z.number(),
571
- y: z.number(),
572
- z: z.number().optional()
573
- });
574
- var CAMERA_MODES = ["isometric", "perspective", "top-down", "front", "follow", "chase"];
575
- var CameraModeSchema = z.enum(CAMERA_MODES);
576
- var CameraSchema = z.object({
577
- pos: ScenePosSchema.optional(),
578
- target: ScenePosSchema.optional(),
579
- zoom: z.number().optional(),
580
- fov: z.number().optional(),
581
- mode: CameraModeSchema.optional(),
582
- azimuth: z.number().optional(),
583
- elevation: z.number().optional(),
584
- controls: z.boolean().optional()
585
- });
586
- function createAssetKey(role, category) {
587
- return `${role}:${category}`;
588
- }
589
- function parseAssetKey(key) {
590
- const parts = key.split(":");
591
- if (parts.length !== 2) return null;
592
- return { role: parts[0], category: parts[1] };
593
- }
594
- function getDefaultAnimationsForRole(role) {
595
- switch (role) {
596
- case "player":
597
- return ["idle", "run", "jump", "fall", "attack", "hurt", "die"];
598
- case "enemy":
599
- return ["idle", "walk", "attack", "hurt", "die"];
600
- case "npc":
601
- return ["idle", "walk", "talk"];
602
- case "item":
603
- return ["idle", "collected"];
604
- case "tile":
605
- return ["static"];
606
- case "projectile":
607
- return ["fly", "hit", "expire"];
608
- case "effect":
609
- return ["play"];
610
- case "ui":
611
- return ["normal", "hover", "pressed", "disabled"];
612
- case "decoration":
613
- return ["idle"];
614
- case "vehicle":
615
- return ["idle", "move", "brake"];
616
- default:
617
- return ["idle"];
618
- }
619
- }
620
- function validateAssetAnimations(assetRef, requiredAnimations) {
621
- const provided = assetRef.animations || [];
622
- const missing = requiredAnimations.filter((anim) => !provided.includes(anim));
623
- return { valid: missing.length === 0, missing };
624
- }
625
- var SPRITE_SHEET_LAYOUT = {
626
- frameWidth: 256,
627
- frameHeight: 256,
628
- columns: 8,
629
- rows: 5,
630
- background: "#20202E"
631
- };
632
- var DEFAULT_UNIT_ANIMATION_ROWS = [
633
- { name: "idle", row: 0, frames: 4, loop: true, frameRate: 6 },
634
- { name: "walk", row: 1, frames: 8, loop: true, frameRate: 10 },
635
- { name: "attack", row: 2, frames: 6, loop: false, frameRate: 12 },
636
- { name: "hit", row: 3, frames: 3, loop: false, frameRate: 8 },
637
- { name: "death", row: 4, frames: 6, loop: false, frameRate: 8 }
638
- ];
639
- function defaultUnitAtlas(sheets, opts) {
640
- const directions = opts?.directions ?? SPRITE_DIRECTIONS.filter((direction) => sheets[direction] !== void 0);
641
- const animations = {};
642
- for (const { name, ...def } of DEFAULT_UNIT_ANIMATION_ROWS) {
643
- animations[name] = def;
644
- }
645
- return {
646
- frameWidth: SPRITE_SHEET_LAYOUT.frameWidth,
647
- frameHeight: SPRITE_SHEET_LAYOUT.frameHeight,
648
- columns: SPRITE_SHEET_LAYOUT.columns,
649
- rows: SPRITE_SHEET_LAYOUT.rows,
650
- directions,
651
- sheets,
652
- animations
653
- };
654
- }
655
- var MANIFEST_ENTRY_KINDS = ["model", "image", "spritesheet", "audio", "json"];
656
- var ManifestEntryKindSchema = z.enum(MANIFEST_ENTRY_KINDS);
657
- var SoundEntrySchema = z.object({
658
- path: z.union([z.string(), z.array(z.string())]),
659
- volume: z.number().optional(),
660
- loop: z.boolean().optional(),
661
- poolSize: z.number().optional(),
662
- autostart: z.boolean().optional(),
663
- crossfade: z.boolean().optional(),
664
- crossfadeDurationMs: z.number().optional()
665
- });
666
- var AudioManifestSchema = z.record(z.string(), SoundEntrySchema);
667
- var MANIFEST_CANVAS_AFFINITIES = ["isometric", "hex", "flat", "side", "3d", "none"];
668
- var ManifestCanvasAffinitySchema = z.enum(MANIFEST_CANVAS_AFFINITIES);
669
- var MANIFEST_SOURCE_CATALOGS = ["kenny", "kekec-assets", "iram-assets", "trait-wars-assets", "kflow-assets"];
670
- var ManifestSourceCatalogSchema = z.enum(MANIFEST_SOURCE_CATALOGS);
671
- var MANIFEST_ASSET_LICENSES = ["CC0", "proprietary"];
672
- var ManifestAssetLicenseSchema = z.enum(MANIFEST_ASSET_LICENSES);
673
- var ManifestFrameSpecSchema = z.union([
674
- z.object({ kind: z.literal("iso-tile"), w: z.number(), h: z.number() }),
675
- z.object({ kind: z.literal("sprite-sheet"), frame: z.number(), cols: z.number(), rows: z.number() }),
676
- z.string().min(1),
677
- z.null()
678
- ]);
679
- var ManifestEntrySchema = z.object({
680
- url: z.string(),
681
- name: z.string(),
682
- category: z.string(),
683
- kind: ManifestEntryKindSchema,
684
- width: z.number(),
685
- height: z.number(),
686
- canvasAffinity: ManifestCanvasAffinitySchema,
687
- genreAffinity: z.array(z.string()),
688
- swapClass: z.string(),
689
- sourceCatalog: ManifestSourceCatalogSchema,
690
- frameSpec: ManifestFrameSpecSchema,
691
- license: ManifestAssetLicenseSchema.optional()
692
- });
693
- var ASSET_CATALOG_ENTRY_KINDS = [
694
- "image",
695
- "spritesheet",
696
- "audio",
697
- "scene",
698
- "portrait",
699
- "model",
700
- "other"
701
- ];
702
- var MODEL_URL_EXTENSIONS = [".glb", ".gltf"];
703
- var AUDIO_URL_EXTENSIONS = [".mp3", ".ogg", ".wav"];
704
- function urlEndsWithAny(url, extensions) {
705
- const lower = url.toLowerCase();
706
- return extensions.some((extension) => lower.endsWith(extension));
707
- }
708
- function deriveManifestAssetKind(entry) {
709
- if (typeof entry.frameSpec === "string" || entry.frameSpec?.kind === "sprite-sheet" || entry.kind === "spritesheet") return "spritesheet";
710
- if (entry.kind === "model" || urlEndsWithAny(entry.url, MODEL_URL_EXTENSIONS)) return "model";
711
- if (entry.kind === "audio" || urlEndsWithAny(entry.url, AUDIO_URL_EXTENSIONS)) return "audio";
712
- if (entry.kind === "image") return "image";
713
- return "other";
714
- }
715
- function parseAssetAspectRatio(aspect) {
716
- const [w, h] = aspect.split(":").map(Number);
717
- return w / h;
718
- }
719
- var ASSET_ASPECT_RATIO_TOLERANCE = 0.01;
720
- function deriveManifestAssetAspect(width, height) {
721
- if (width <= 0 || height <= 0) return void 0;
722
- const ratio = width / height;
723
- for (const aspect of ASSET_ASPECTS) {
724
- const expected = parseAssetAspectRatio(aspect);
725
- if (Math.abs(ratio / expected - 1) <= ASSET_ASPECT_RATIO_TOLERANCE) return aspect;
726
- }
727
- return void 0;
728
- }
729
- var ABSOLUTE_URL_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
730
- function resolveManifestUrl(url, cdnPrefix) {
731
- if (!cdnPrefix || ABSOLUTE_URL_PATTERN.test(url)) return url;
732
- const prefix = cdnPrefix.endsWith("/") ? cdnPrefix : `${cdnPrefix}/`;
733
- const rest = url.startsWith("/") ? url.slice(1) : url;
734
- return `${prefix}${rest}`;
735
- }
736
- function manifestToAssetCatalog(entries, opts) {
737
- return entries.map((entry) => {
738
- const kind = deriveManifestAssetKind(entry);
739
- const dimension = entry.canvasAffinity === "3d" ? "3d" : "2d";
740
- const aspect = deriveManifestAssetAspect(entry.width, entry.height);
741
- const url = resolveManifestUrl(entry.url, opts?.cdnPrefix);
742
- const catalogEntry = {
743
- url,
744
- name: entry.name,
745
- category: entry.category,
746
- kind,
747
- dimension
748
- };
749
- if (aspect !== void 0) catalogEntry.aspect = aspect;
750
- if (kind === "image" || kind === "spritesheet") catalogEntry.thumbnailUrl = url;
751
- return catalogEntry;
752
- });
753
- }
754
- var ASSET_QUERY_TYPE_PREFIX = "t:";
755
- var ASSET_QUERY_LABEL_PREFIX = "l:";
756
- function isAssetCatalogEntryKind(value) {
757
- return ASSET_CATALOG_ENTRY_KINDS.some((kind) => kind === value);
758
- }
759
- function parseAssetQueryTokens(q) {
760
- const tokens = q.trim().length > 0 ? q.trim().split(/\s+/) : [];
761
- const textParts = [];
762
- const labels = [];
763
- let kind;
764
- let unknownKind = false;
765
- for (const token of tokens) {
766
- if (token.startsWith(ASSET_QUERY_TYPE_PREFIX)) {
767
- const value = token.slice(ASSET_QUERY_TYPE_PREFIX.length);
768
- if (isAssetCatalogEntryKind(value)) kind = value;
769
- else unknownKind = true;
770
- } else if (token.startsWith(ASSET_QUERY_LABEL_PREFIX)) {
771
- const value = token.slice(ASSET_QUERY_LABEL_PREFIX.length);
772
- if (value.length > 0) labels.push(value);
773
- } else {
774
- textParts.push(token);
775
- }
776
- }
777
- return { text: textParts.join(" "), kind, labels, unknownKind };
778
- }
779
- function parseAssetQuery(q) {
780
- const parsed = parseAssetQueryTokens(q);
781
- return parsed.kind === void 0 ? { text: parsed.text, labels: parsed.labels } : { text: parsed.text, kind: parsed.kind, labels: parsed.labels };
782
- }
783
- function matchAssetQuery(entry, q) {
784
- const parsed = parseAssetQueryTokens(q);
785
- if (parsed.unknownKind) return false;
786
- if (parsed.kind !== void 0 && entry.kind !== parsed.kind) return false;
787
- for (const label of parsed.labels) {
788
- if (entry.category.toLowerCase() !== label.toLowerCase()) return false;
789
- }
790
- if (parsed.text.length > 0) {
791
- const haystack = `${entry.name} ${entry.category}`.toLowerCase();
792
- if (!haystack.includes(parsed.text.toLowerCase())) return false;
793
- }
794
- return true;
795
- }
796
- var SExprDataSchema = z.lazy(
797
- () => z.union([SExprAtomSchema, z.array(SExprDataSchema)])
798
- );
799
- var SExprAtomSchema = z.union([
800
- z.string(),
801
- z.number(),
802
- z.boolean(),
803
- z.null(),
804
- z.record(z.string(), SExprDataSchema)
805
- // Objects for payload data
806
- ]);
807
- var SExprSchema = z.lazy(
808
- () => z.union([
809
- SExprAtomSchema,
810
- z.array(SExprDataSchema).min(1).refine(
811
- (arr) => typeof arr[0] === "string",
812
- { message: "S-expression array must have a string operator as first element" }
813
- )
814
- ])
815
- );
816
- var ExpressionSchema = SExprSchema;
817
- var SExprListSchema = z.array(SExprSchema);
818
- function isSExpr(value) {
819
- return Array.isArray(value) && value.length > 0 && typeof value[0] === "string";
820
- }
821
- function isSExprAtom(value) {
822
- if (value === null) return true;
823
- if (Array.isArray(value)) return false;
824
- const type = typeof value;
825
- return type === "string" || type === "number" || type === "boolean" || type === "object";
826
- }
827
- function isBinding(value) {
828
- return typeof value === "string" && value.startsWith("@");
829
- }
830
- function isSExprCall(value) {
831
- return isSExpr(value);
832
- }
833
- var CORE_BINDINGS = ["entity", "payload", "state", "now", "config", "computed", "trait", "user", "callsitePayload", "pages", "currentTheme"];
834
- function parseBinding(binding) {
835
- if (!binding.startsWith("@")) {
836
- return null;
837
- }
838
- const withoutPrefix = binding.slice(1);
839
- const parts = withoutPrefix.split(".");
840
- if (parts.length === 0 || parts[0] === "") {
841
- return null;
842
- }
843
- const root = parts[0];
844
- const path = parts.slice(1);
845
- const isCore = CORE_BINDINGS.includes(root);
846
- return {
847
- type: isCore ? "core" : "entity",
848
- root,
849
- path,
850
- original: binding
851
- };
852
- }
853
- function isValidBinding(binding) {
854
- const parsed = parseBinding(binding);
855
- if (!parsed) return false;
856
- if (parsed.type === "core") {
857
- if (parsed.root === "state" || parsed.root === "now") {
858
- return parsed.path.length === 0;
859
- }
860
- return true;
861
- }
862
- return parsed.path.length > 0;
863
- }
864
- function getOperator(expr) {
865
- if (!isSExpr(expr)) return null;
866
- return expr[0];
867
- }
868
- function formatSExpr(expr) {
869
- if (expr === null) return "null";
870
- if (typeof expr === "string") return isBinding(expr) ? expr : JSON.stringify(expr);
871
- if (typeof expr === "number" || typeof expr === "boolean") return String(expr);
872
- if (Array.isArray(expr)) {
873
- const quoted = quoteBodyOf(expr);
874
- if (quoted !== void 0) return `(${QUOTE_HEAD} ${formatSExpr(decodeQuoteBody(quoted))})`;
875
- const qq = quasiquoteOf(expr);
876
- if (qq !== void 0) return `(${QUASIQUOTE_HEAD} ${formatTemplate(decodeQuoteBody(qq.body), qq.holes)})`;
877
- const op = getOperator(expr);
878
- if (op !== null) return `(${[op, ...expr.slice(1).map(formatSExpr)].join(" ")})`;
879
- return `[${expr.map(formatSExpr).join(" ")}]`;
880
- }
881
- const entries = Object.keys(expr).sort().map((k) => `${k}: ${formatSExpr(expr[k])}`);
882
- return entries.length === 0 ? "{}" : `{ ${entries.join(", ")} }`;
883
- }
884
- function getArgs(expr) {
885
- if (!isSExpr(expr)) return [];
886
- return expr.slice(1);
887
- }
888
- function sexpr(operator, ...args) {
889
- return [operator, ...args];
890
- }
891
- function walkSExpr(expr, visitor, parent = null, index = 0) {
892
- visitor(expr, parent, index);
893
- if (isSExpr(expr)) {
894
- for (let i = 0; i < expr.length; i++) {
895
- walkSExpr(expr[i], visitor, expr, i);
896
- }
897
- }
898
- }
899
- function collectBindings(expr) {
900
- const bindings = [];
901
- walkSExpr(expr, (node) => {
902
- if (isBinding(node)) {
903
- bindings.push(node);
904
- }
905
- });
906
- return bindings;
907
- }
908
- function isEventPayloadValue(value) {
909
- if (value === null || value === void 0) return true;
910
- const kind = typeof value;
911
- if (kind === "string" || kind === "number" || kind === "boolean") return true;
912
- if (value instanceof Date) return true;
913
- if (Array.isArray(value)) return value.every((item) => isEventPayloadValue(item));
914
- if (kind === "object" && value !== null && typeof value === "object") {
915
- return Object.values(value).every((item) => isEventPayloadValue(item));
916
- }
917
- return false;
918
- }
919
- var EventPayloadValueSchema = z.lazy(
920
- () => z.union([
921
- z.string(),
922
- z.number(),
923
- z.boolean(),
924
- z.date(),
925
- z.null(),
926
- z.undefined(),
927
- EventPayloadSchema,
928
- z.array(EventPayloadValueSchema)
929
- ])
930
- );
931
- var EventPayloadSchema = z.lazy(() => z.record(z.string(), EventPayloadValueSchema));
932
- function isStaticallyFalse(expr, resolve) {
933
- const known = (e) => {
934
- if (typeof e === "string" && e.startsWith("@") && resolve !== void 0) {
935
- const value2 = resolve(e);
936
- return value2 === void 0 ? e : value2;
937
- }
938
- return e;
939
- };
940
- const isLiteral = (e) => e === null || typeof e === "boolean" || typeof e === "number" || typeof e === "string" && !e.startsWith("@");
941
- const value = known(expr);
942
- if (value === false || value === null) return true;
943
- if (typeof value === "number") return value === 0;
944
- if (typeof value === "string") return value === "";
945
- if (Array.isArray(value)) {
946
- const op = value[0];
947
- if (typeof op !== "string") return value.length === 0;
948
- const args = value.slice(1);
949
- switch (op) {
950
- case "and":
951
- return args.some((a) => isStaticallyFalse(a, resolve));
952
- case "or":
953
- return args.length > 0 && args.every((a) => isStaticallyFalse(a, resolve));
954
- case "not":
955
- return args.length === 1 && known(args[0]) === true;
956
- case "==":
957
- case "!=": {
958
- if (args.length !== 2) return false;
959
- const [l, r] = [known(args[0]), known(args[1])];
960
- if (!isLiteral(l) || !isLiteral(r)) return false;
961
- return l === r === (op === "!=");
962
- }
963
- default:
964
- return false;
965
- }
966
- }
967
- if (typeof value === "object") return Object.keys(value).length === 0;
968
- return false;
969
- }
970
- var QUOTE_HEAD = "quote";
971
- function canonicalQuoteValue(expr) {
972
- if (Array.isArray(expr)) return expr.map(canonicalQuoteValue);
973
- if (expr !== null && typeof expr === "object") {
974
- const out = {};
975
- for (const key of Object.keys(expr).sort()) out[key] = canonicalQuoteValue(expr[key]);
976
- return out;
977
- }
978
- return expr;
979
- }
980
- function encodeQuoteBody(expr) {
981
- return JSON.stringify(canonicalQuoteValue(expr)).replace(/@/g, "\\u0040");
982
- }
983
- function decodeQuoteBody(body) {
984
- const value = JSON.parse(body);
985
- return value;
986
- }
987
- function quoteExpr(expr) {
988
- return [QUOTE_HEAD, encodeQuoteBody(expr)];
989
- }
990
- function decodeQuotedValue(expr) {
991
- const body = quoteBodyOf(expr);
992
- return body === void 0 ? expr : decodeQuoteBody(body);
993
- }
994
- function quoteBodyOf(expr) {
995
- return Array.isArray(expr) && expr.length === 2 && expr[0] === QUOTE_HEAD && typeof expr[1] === "string" ? expr[1] : void 0;
996
- }
997
- var QUASIQUOTE_HEAD = "quasiquote";
998
- var UNQUOTE_HEAD = "unquote";
999
- function isHeadedCall(expr, head) {
1000
- return Array.isArray(expr) && expr.length > 0 && expr[0] === head;
1001
- }
1002
- function containsHead(expr, head) {
1003
- if (isHeadedCall(expr, head)) return true;
1004
- if (Array.isArray(expr)) return expr.some((e) => containsHead(e, head));
1005
- if (expr !== null && typeof expr === "object") return Object.values(expr).some((e) => containsHead(e, head));
1006
- return false;
1007
- }
1008
- function extractHoles(expr, holes) {
1009
- if (isHeadedCall(expr, QUASIQUOTE_HEAD)) throw new Error("quasiquote: nested quasiquote is not supported");
1010
- if (isHeadedCall(expr, UNQUOTE_HEAD)) {
1011
- if (expr.length !== 2) throw new Error("quasiquote: (unquote e) takes exactly one expression");
1012
- if (containsHead(expr[1], UNQUOTE_HEAD)) throw new Error("quasiquote: unquote inside an unquote");
1013
- holes.push(expr[1]);
1014
- return [UNQUOTE_HEAD, holes.length - 1];
1015
- }
1016
- if (Array.isArray(expr)) return expr.map((e) => extractHoles(e, holes));
1017
- if (expr !== null && typeof expr === "object") {
1018
- const out = {};
1019
- for (const k of Object.keys(expr).sort()) out[k] = extractHoles(expr[k], holes);
1020
- return out;
1021
- }
1022
- return expr;
1023
- }
1024
- function quasiquoteExpr(template) {
1025
- const holes = [];
1026
- const body = encodeQuoteBody(extractHoles(template, holes));
1027
- return [QUASIQUOTE_HEAD, body, ...holes];
1028
- }
1029
- function quasiquoteOf(expr) {
1030
- if (!Array.isArray(expr) || expr.length < 2 || expr[0] !== QUASIQUOTE_HEAD || typeof expr[1] !== "string") {
1031
- return void 0;
1032
- }
1033
- return { body: expr[1], holes: expr.slice(2) };
1034
- }
1035
- function countMarkers(expr) {
1036
- if (isHeadedCall(expr, UNQUOTE_HEAD) && expr.length === 2 && typeof expr[1] === "number") return 1;
1037
- if (Array.isArray(expr)) return expr.reduce((n, e) => n + countMarkers(e), 0);
1038
- if (expr !== null && typeof expr === "object") return Object.values(expr).reduce((n, e) => n + countMarkers(e), 0);
1039
- return 0;
1040
- }
1041
- function fillMarkers(expr, values) {
1042
- if (isHeadedCall(expr, UNQUOTE_HEAD) && expr.length === 2 && typeof expr[1] === "number") return values[expr[1]];
1043
- if (Array.isArray(expr)) return expr.map((e) => fillMarkers(e, values));
1044
- if (expr !== null && typeof expr === "object") {
1045
- const out = {};
1046
- for (const [k, v] of Object.entries(expr)) out[k] = fillMarkers(v, values);
1047
- return out;
1048
- }
1049
- return expr;
1050
- }
1051
- function toProgramData(value) {
1052
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
1053
- return value;
1054
- }
1055
- if (Array.isArray(value)) return value.map((v) => toProgramData(v));
1056
- if (typeof value === "object" && !(value instanceof Date) && Object.getPrototypeOf(value) === Object.prototype) {
1057
- const out = {};
1058
- for (const [k, v] of Object.entries(value)) out[k] = toProgramData(v);
1059
- return out;
1060
- }
1061
- throw new Error(`quasiquote: a hole evaluated to a ${typeof value} value, which cannot be held as program data`);
1062
- }
1063
- function instantiateQuasiquote(body, values) {
1064
- const template = decodeQuoteBody(body);
1065
- const holes = countMarkers(template);
1066
- if (holes !== values.length) {
1067
- throw new Error(`quasiquote: template has ${holes} hole(s), got ${values.length} value(s)`);
1068
- }
1069
- return fillMarkers(template, values);
1070
- }
1071
- function formatTemplate(expr, holes) {
1072
- if (isHeadedCall(expr, UNQUOTE_HEAD) && expr.length === 2 && typeof expr[1] === "number") {
1073
- return `(${UNQUOTE_HEAD} ${formatSExpr(holes[expr[1]])})`;
1074
- }
1075
- if (Array.isArray(expr)) {
1076
- const op = getOperator(expr);
1077
- if (op !== null) return `(${[op, ...expr.slice(1).map((e) => formatTemplate(e, holes))].join(" ")})`;
1078
- return `[${expr.map((e) => formatTemplate(e, holes)).join(" ")}]`;
1079
- }
1080
- if (expr !== null && typeof expr === "object") {
1081
- const entries = Object.keys(expr).sort().map((k) => `${k}: ${formatTemplate(expr[k], holes)}`);
1082
- return entries.length === 0 ? "{}" : `{ ${entries.join(", ")} }`;
1083
- }
1084
- return formatSExpr(expr);
1085
- }
1086
- var EntityPersistenceSchema = z.enum([
1087
- "persistent",
1088
- "runtime"
1089
- ]);
1090
- var OrbitalEntitySchema = z.object({
1091
- name: z.string().min(1, "Entity name is required"),
1092
- // V4 arena id (`EntityDefinition.id`); declared so the strip-mode zod gate
1093
- // carries an imported entity's id through instead of erasing it.
1094
- id: EntityIdSchema.optional(),
1095
- persistence: EntityPersistenceSchema.default("persistent"),
1096
- shared: z.boolean().optional(),
1097
- // Must stay in step with the Rust serde field (`EntityDefinition.identity`,
1098
- // orbital-core/src/schema/types.rs). `z.object()` STRIPS unknown keys rather
1099
- // than rejecting them, so a Rust-only field works on the compiled path and
1100
- // silently vanishes on the interpreter path.
1101
- identity: z.boolean().optional(),
1102
- // Rust twin: `EntityDefinition.browser`.
1103
- browser: z.boolean().optional(),
1104
- // Rust twin: `EntityDefinition.store`.
1105
- store: z.string().min(1).optional(),
1106
- // Same "must stay in step with Rust serde" hazard as `identity` above —
1107
- // these four mirror `EntityDefinition.{read,create,update,delete}_policy`.
1108
- // Rust has no `rename_all` on this struct, so the wire key IS snake_case
1109
- // (unlike this file's other camelCase fields, which are Rust-side-absent
1110
- // and so never hit this cross-language constraint — see `visual_prompt`
1111
- // just below for the existing precedent).
1112
- read_policy: SExprSchema.optional(),
1113
- create_policy: SExprSchema.optional(),
1114
- update_policy: SExprSchema.optional(),
1115
- delete_policy: SExprSchema.optional(),
1116
- // Snake_case for the same cross-language reason as the four policies above.
1117
- access_waivers: z.object({
1118
- read: z.string().optional(),
1119
- create: z.string().optional(),
1120
- update: z.string().optional(),
1121
- delete: z.string().optional()
1122
- }).optional(),
1123
- invariants: SExprListSchema.optional(),
1124
- collection: z.string().optional(),
1125
- fields: z.array(EntityFieldSchema),
1126
- instances: z.array(z.record(z.string(), JsonValueSchema)).optional(),
1127
- localeInstances: z.record(z.string(), z.array(z.record(z.string(), JsonValueSchema))).optional(),
1128
- timestamps: z.boolean().optional(),
1129
- softDelete: z.boolean().optional(),
1130
- description: z.string().optional(),
1131
- visual_prompt: z.string().optional(),
1132
- assetRef: SemanticAssetRefSchema.optional()
1133
- });
1134
- var EntitySchema = OrbitalEntitySchema;
1135
- function instancesForLocale(entity, locale) {
1136
- const localized = locale !== void 0 ? entity.localeInstances?.[locale] : void 0;
1137
- return localized ?? entity.instances ?? [];
1138
- }
1139
- function deriveCollection(entity) {
1140
- if (entity.persistence !== "persistent") {
1141
- return void 0;
1142
- }
1143
- return entity.name.toLowerCase() + "s";
1144
- }
1145
- function isRuntimeEntity(entity) {
1146
- return entity.persistence === "runtime";
1147
- }
1148
- function isClientResident(entity) {
1149
- return entity.persistence === "runtime" || entity.browser === true;
1150
- }
1151
- function storesRowsInBrowser(entity) {
1152
- return entity.browser === true;
1153
- }
1154
- function persistenceModeAllowsOverrides(persistence, dataBearing = false) {
1155
- return persistence === "persistent" || persistence === void 0 || persistence === "runtime" && dataBearing;
1156
- }
1157
- var FieldValueSchema = z.lazy(
1158
- () => z.union([z.string(), z.number(), z.boolean(), z.date(), z.null(), z.array(FieldValueSchema), z.record(z.string(), FieldValueSchema.optional())])
1159
- );
1160
- function isFieldValue(value) {
1161
- if (value === null) return true;
1162
- const kind = typeof value;
1163
- if (kind === "string" || kind === "number" || kind === "boolean") return true;
1164
- if (value instanceof Date) return true;
1165
- if (Array.isArray(value)) return value.every((item) => isFieldValue(item));
1166
- if (kind === "object" && value !== null && typeof value === "object") {
1167
- return Object.values(value).every((item) => item === void 0 || isFieldValue(item));
1168
- }
1169
- return false;
1170
- }
1171
- var EntityRowSchema = z.object({ id: z.string().optional() }).catchall(FieldValueSchema.optional());
1172
- var UI_SLOTS = [
1173
- // App slots
1174
- "main",
1175
- "sidebar",
1176
- "dock",
1177
- // Right inline panel that pushes main (narrow screens: a drawer)
1178
- "modal",
1179
- "drawer",
1180
- "overlay",
1181
- "center",
1182
- "toast",
1183
- "floating",
1184
- "system",
1185
- // For invisible system components (InputListener, CollisionDetector)
1186
- "content",
1187
- "screen",
1188
- // Game HUD slots
1189
- "hud",
1190
- "hud-top",
1191
- "hud-bottom",
1192
- "hud.health",
1193
- "hud.score",
1194
- "hud.inventory",
1195
- "hud.stamina",
1196
- // Game overlay slots
1197
- "overlay.inventory",
1198
- "overlay.dialogue",
1199
- "overlay.menu",
1200
- "overlay.pause"
1201
- ];
1202
- var RENDERED_SLOTS = UI_SLOTS.filter(
1203
- (slot) => !slot.includes(".") && slot !== "hud" && slot !== "screen"
1204
- );
1205
- var UISlotSchema = z.enum(UI_SLOTS);
1206
- function isRowObject(value) {
1207
- return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
1208
- }
1209
- function isPersistBatchOperation(value) {
1210
- if (!Array.isArray(value) || typeof value[1] !== "string") return false;
1211
- switch (value[0]) {
1212
- case "create":
1213
- return value.length === 2 || value.length === 3 && isRowObject(value[2]);
1214
- case "update":
1215
- return typeof value[2] === "string" && (value.length === 3 || value.length === 4 && isRowObject(value[3]));
1216
- case "delete":
1217
- return value.length === 3 && typeof value[2] === "string";
1218
- default:
1219
- return false;
1220
- }
1221
- }
1222
- var EFFECT_OPERATORS = [
1223
- "render-ui",
1224
- "navigate",
1225
- "navigate-back",
1226
- "emit",
1227
- "set",
1228
- "persist",
1229
- "call-service",
1230
- "cancel-call",
1231
- "random-bytes",
1232
- "credential-status",
1233
- "credential-forget",
1234
- "credential-list",
1235
- "credential-set",
1236
- "credential-remove",
1237
- "credential-test",
1238
- "credential-mode",
1239
- "credential-rotate",
1240
- "access-check",
1241
- "oauth-authorize",
1242
- "oauth-connection-status",
1243
- "oauth-connection-forget",
1244
- "http",
1245
- "redis",
1246
- "postgres",
1247
- "spawn",
1248
- "despawn",
1249
- "do",
1250
- "fetch",
1251
- "fetch-stream",
1252
- "if",
1253
- "when",
1254
- "let",
1255
- "log",
1256
- "wait",
1257
- "ref",
1258
- "deref",
1259
- "swap",
1260
- "watch",
1261
- "atomic",
1262
- "notify",
1263
- "send-server",
1264
- "prob/seed",
1265
- "prob/condition",
1266
- "workspace/write-orbital",
1267
- "workspace/write-file",
1268
- "workspace/write-schema",
1269
- "workspace/write-plan",
1270
- "workspace/archive-orbital",
1271
- "behavior/catalog",
1272
- "behavior/describe",
1273
- "behavior/source",
1274
- "behavior/resolve",
1275
- "behavior/dependencies",
1276
- "program/read",
1277
- "program/print",
1278
- "program/eval",
1279
- "program/validate",
1280
- "program/compose",
1281
- "program/step",
1282
- "program/inputs",
1283
- "program/dispatch",
1284
- "program/live",
1285
- "persist/read-named"
1286
- ];
1287
- var EFFECT_OPERATOR_FAMILIES = [
1288
- "agent",
1289
- "os",
1290
- "browser",
1291
- "llm",
1292
- "session",
1293
- "trace",
1294
- "memory",
1295
- "application"
1296
- ];
1297
- var SERVER_REPORTED_EFFECTS = [
1298
- "set",
1299
- "persist",
1300
- "call-service",
1301
- "http",
1302
- "fetch",
1303
- "fetch-stream",
1304
- "ref",
1305
- "deref",
1306
- "swap",
1307
- "atomic",
1308
- "emit"
1309
- ];
1310
- var EffectShapeSchema = z.array(SExprDataSchema).min(1).refine(
1311
- (arr) => typeof arr[0] === "string",
1312
- { message: "Effect must be an S-expression with a string operator as first element" }
1313
- );
1314
- var EffectSchema = z.custom(
1315
- (value) => EffectShapeSchema.safeParse(value).success,
1316
- { message: "Effect must be an S-expression with a string operator as first element" }
1317
- );
1318
- function isEffect(value) {
1319
- return Array.isArray(value) && value.length > 0 && typeof value[0] === "string";
1320
- }
1321
- var isSExprEffect = isEffect;
1322
- function set(binding, value) {
1323
- return ["set", binding, value];
1324
- }
1325
- function emit(event, payload) {
1326
- return payload ? ["emit", event, payload] : ["emit", event];
1327
- }
1328
- function navigate(path, params, options) {
1329
- if (params && options) return ["navigate", path, params, options];
1330
- return params ? ["navigate", path, params] : ["navigate", path];
1331
- }
1332
- function navigateBack() {
1333
- return ["navigate-back"];
1334
- }
1335
- function renderUI(target, pattern) {
1336
- return ["render-ui", target, pattern];
1337
- }
1338
- function persist(action, entity, data) {
1339
- if (action === "create" || action === "upsert" || action === "update") {
1340
- return ["persist", action, entity, data];
1341
- }
1342
- return data ? ["persist", action, entity, data] : ["persist", action, entity];
1343
- }
1344
- function callService(serviceName, config) {
1345
- return ["call-service", serviceName, config];
1346
- }
1347
- function spawn(entity, initialState) {
1348
- return initialState ? ["spawn", entity, initialState] : ["spawn", entity];
1349
- }
1350
- function despawn(entityId) {
1351
- return ["despawn", entityId];
1352
- }
1353
- function doEffects(...effects) {
1354
- return ["do", ...effects];
1355
- }
1356
- function ref(binding, selector) {
1357
- return selector ? ["ref", binding, selector] : ["ref", binding];
1358
- }
1359
- function deref(binding, selector) {
1360
- return selector ? ["deref", binding, selector] : ["deref", binding];
1361
- }
1362
- function swap(binding, transform) {
1363
- return ["swap", binding, transform];
1364
- }
1365
- function watch(binding, event, options) {
1366
- return options ? ["watch", binding, event, options] : ["watch", binding, event];
1367
- }
1368
- function atomic(...effects) {
1369
- return ["atomic", ...effects];
1370
- }
1371
- var PatternConfigSchema = z.custom(
1372
- (value) => value === null || typeof value === "object" && value !== null && !Array.isArray(value),
1373
- { message: "Expected a pattern config object or null" }
1374
- );
1375
- var PatternObjectSchema = z.custom(
1376
- (value) => typeof value === "object" && value !== null && !Array.isArray(value),
1377
- { message: "Expected a pattern config object" }
1378
- );
1379
- var ResolvedPatternPropsSchema = z.custom(
1380
- (value) => typeof value === "object" && value !== null && !Array.isArray(value),
1381
- { message: "Expected a resolved pattern props object" }
1382
- );
1383
- var CompareOpSchema = z.enum(["==", "!=", "<", "<=", ">", ">="]);
1384
- var RowPredicateSchema = z.lazy(
1385
- () => z.discriminatedUnion("kind", [
1386
- z.object({ kind: z.literal("compare"), field: z.string(), op: CompareOpSchema, value: FieldValueSchema }),
1387
- z.object({ kind: z.literal("member"), field: z.string(), values: z.array(FieldValueSchema) }),
1388
- z.object({ kind: z.literal("hasElement"), field: z.string(), value: FieldValueSchema }),
1389
- z.object({ kind: z.literal("contains"), field: z.string(), text: z.string(), caseSensitive: z.boolean() }),
1390
- z.object({ kind: z.literal("isNull"), field: z.string(), isNull: z.boolean() }),
1391
- z.object({ kind: z.literal("all"), of: z.array(RowPredicateSchema) }),
1392
- z.object({ kind: z.literal("any"), of: z.array(RowPredicateSchema) }),
1393
- z.object({ kind: z.literal("not"), of: RowPredicateSchema }),
1394
- z.object({ kind: z.literal("const"), value: z.boolean() })
1395
- ])
1396
- );
1397
- var RowQuerySchema = z.object({
1398
- policy: RowPredicateSchema.optional(),
1399
- filter: RowPredicateSchema.optional(),
1400
- order: z.object({ field: z.string(), direction: z.enum(["asc", "desc"]) }).optional(),
1401
- offset: z.number().int().nonnegative().optional(),
1402
- limit: z.number().int().nonnegative().optional(),
1403
- total: z.enum(["exact", "none"]).optional(),
1404
- nearest: z.object({ field: z.string(), vector: z.array(z.number()), k: z.number().int().positive() }).optional()
1405
- });
1406
- var RowIdPageSchema = z.object({
1407
- ids: z.array(z.string()),
1408
- total: z.number().int().nonnegative()
1409
- });
1410
- var RowWriteOpSchema = z.discriminatedUnion("kind", [
1411
- z.object({ kind: z.literal("create"), entityType: z.string(), data: EntityRowSchema }),
1412
- z.object({ kind: z.literal("upsert"), entityType: z.string(), data: EntityRowSchema }),
1413
- z.object({ kind: z.literal("update"), entityType: z.string(), id: z.string(), data: EntityRowSchema, guard: RowPredicateSchema.optional() }),
1414
- z.object({ kind: z.literal("delete"), entityType: z.string(), id: z.string(), guard: RowPredicateSchema.optional() }),
1415
- z.object({ kind: z.literal("rekey"), entityType: z.string(), id: z.string(), newId: z.string().min(1), guard: RowPredicateSchema.optional() })
1416
- ]);
1417
- var RowWriteOutcomeSchema = z.discriminatedUnion("kind", [
1418
- z.object({ kind: z.literal("created"), row: EntityRowSchema }),
1419
- z.object({ kind: z.literal("updated"), row: EntityRowSchema, before: EntityRowSchema.optional() }),
1420
- z.object({ kind: z.literal("deleted"), before: EntityRowSchema.optional() }),
1421
- z.object({ kind: z.literal("not-found") }),
1422
- z.object({ kind: z.literal("duplicate-id") }),
1423
- z.object({ kind: z.literal("refused") }),
1424
- z.object({ kind: z.literal("failed"), message: z.string() }),
1425
- z.object({ kind: z.literal("rolled-back") })
1426
- ]);
1427
- var RowWriteBatchSchema = z.object({
1428
- ops: z.array(RowWriteOpSchema),
1429
- onFailure: z.enum(["atomic", "stop"])
1430
- });
1431
- var LeafKindSchema = z.enum(["compare", "member", "hasElement", "contains", "isNull"]);
1432
- var CombinatorSchema = z.enum(["all", "any", "not"]);
1433
- var RowOperatorSchema = z.enum(["==", "!=", "<", "<=", ">", ">=", "member", "hasElement", "contains"]);
1434
- var RowValueKindSchema = z.enum(["string", "number", "boolean", "date", "null"]);
1435
- var RowCommitSchema = z.object({
1436
- entityType: z.string(),
1437
- id: z.string(),
1438
- expected: EntityRowSchema.nullable(),
1439
- write: z.discriminatedUnion("kind", [
1440
- z.object({ kind: z.literal("keep") }),
1441
- z.object({ kind: z.literal("put"), row: EntityRowSchema }),
1442
- z.object({ kind: z.literal("delete") })
1443
- ])
1444
- });
1445
- var QueryCapabilitiesSchema = z.object({
1446
- leaves: z.array(LeafKindSchema),
1447
- combinators: z.array(CombinatorSchema),
1448
- compareOps: z.array(CompareOpSchema),
1449
- operatorValueKinds: z.array(z.object({ operator: RowOperatorSchema, valueKinds: z.array(RowValueKindSchema) })).optional(),
1450
- orderableFields: z.discriminatedUnion("kind", [
1451
- z.object({ kind: z.literal("every-field") }),
1452
- z.object({ kind: z.literal("listed"), fields: z.array(z.string()) })
1453
- ]),
1454
- window: z.boolean(),
1455
- exactTotal: z.boolean(),
1456
- idsOnly: z.boolean().optional(),
1457
- nearest: z.boolean().optional()
1458
- });
1459
- var WriteCapabilitiesSchema = z.object({
1460
- guards: z.object({ leaves: z.array(LeafKindSchema), combinators: z.array(CombinatorSchema), compareOps: z.array(CompareOpSchema) }),
1461
- conditional: z.boolean(),
1462
- returnsRow: z.boolean(),
1463
- stopRuns: z.boolean(),
1464
- atomicBatch: z.boolean(),
1465
- rekey: z.boolean().optional(),
1466
- commitRows: z.boolean().optional()
1467
- });
1468
- var RowQueryPageSchema = z.object({
1469
- rows: z.array(EntityRowSchema),
1470
- total: z.number().int().nonnegative()
1471
- });
1472
- function isMissing(value) {
1473
- return value === null || value === void 0;
1474
- }
1475
- function comparable(value) {
1476
- return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value instanceof Date;
1477
- }
1478
- function codePointOrder(a, b) {
1479
- const x = Array.from(a);
1480
- const y = Array.from(b);
1481
- const n = Math.min(x.length, y.length);
1482
- for (let i = 0; i < n; i++) {
1483
- const cx = x[i].codePointAt(0) ?? 0;
1484
- const cy = y[i].codePointAt(0) ?? 0;
1485
- if (cx !== cy) return cx < cy ? -1 : 1;
1486
- }
1487
- return x.length === y.length ? 0 : x.length < y.length ? -1 : 1;
1488
- }
1489
- function orderValues(a, b) {
1490
- if (typeof a === "string" && typeof b === "string") return codePointOrder(a, b);
1491
- if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
1492
- if (typeof a === "boolean" && typeof b === "boolean") return a === b ? 0 : a ? 1 : -1;
1493
- if (a instanceof Date && b instanceof Date) {
1494
- const x = a.getTime();
1495
- const y = b.getTime();
1496
- return x === y ? 0 : x < y ? -1 : 1;
1497
- }
1498
- return null;
1499
- }
1500
- function sameValue(a, b) {
1501
- if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
1502
- return a === b;
1503
- }
1504
- function compareLeaf(value, op) {
1505
- const target = op.value;
1506
- if (isMissing(value)) return op.op === "!=" && !isMissing(target);
1507
- switch (op.op) {
1508
- case "==":
1509
- return sameValue(value, target);
1510
- case "!=":
1511
- return !sameValue(value, target);
1512
- default: {
1513
- if (!comparable(value) || !comparable(target)) return false;
1514
- const c = orderValues(value, target);
1515
- if (c === null) return false;
1516
- if (op.op === "<") return c < 0;
1517
- if (op.op === "<=") return c <= 0;
1518
- if (op.op === ">") return c > 0;
1519
- return c >= 0;
1520
- }
1521
- }
1522
- }
1523
- function foldCase(text) {
1524
- return text.toUpperCase().toLowerCase();
1525
- }
1526
- var memberLookups = /* @__PURE__ */ new WeakMap();
1527
- function memberLookup(predicate) {
1528
- const cached = memberLookups.get(predicate);
1529
- if (cached !== void 0) return cached;
1530
- const lookup = { plain: /* @__PURE__ */ new Set(), times: /* @__PURE__ */ new Set() };
1531
- for (const v of predicate.values) {
1532
- if (v instanceof Date) lookup.times.add(v.getTime());
1533
- else lookup.plain.add(v);
1534
- }
1535
- memberLookups.set(predicate, lookup);
1536
- return lookup;
1537
- }
1538
- function rowMatchesPredicate(row, predicate) {
1539
- switch (predicate.kind) {
1540
- case "const":
1541
- return predicate.value;
1542
- case "all":
1543
- return predicate.of.every((p) => rowMatchesPredicate(row, p));
1544
- case "any":
1545
- return predicate.of.some((p) => rowMatchesPredicate(row, p));
1546
- case "not":
1547
- return !rowMatchesPredicate(row, predicate.of);
1548
- case "compare":
1549
- return compareLeaf(row[predicate.field], predicate);
1550
- case "isNull":
1551
- return isMissing(row[predicate.field]) === predicate.isNull;
1552
- case "member": {
1553
- const value = row[predicate.field];
1554
- if (isMissing(value)) return false;
1555
- const lookup = memberLookup(predicate);
1556
- if (value instanceof Date) return lookup.times.has(value.getTime());
1557
- return !Number.isNaN(value) && lookup.plain.has(value);
1558
- }
1559
- case "hasElement": {
1560
- const value = row[predicate.field];
1561
- return Array.isArray(value) && value.some((v) => sameValue(v, predicate.value));
1562
- }
1563
- case "contains": {
1564
- const value = row[predicate.field];
1565
- if (typeof value !== "string") return false;
1566
- return predicate.caseSensitive ? value.includes(predicate.text) : foldCase(value).includes(foldCase(predicate.text));
1567
- }
1568
- }
1569
- }
1570
- function rowIdOf(row) {
1571
- return typeof row.id === "string" ? row.id : null;
1572
- }
1573
- function runRowWrite(rows, op) {
1574
- if (op.kind === "rekey") return { rows: [...rows], outcome: { kind: "failed", message: "rekey is unsupported by this store" } };
1575
- if (op.kind === "create") {
1576
- const id = rowIdOf(op.data);
1577
- if (id === null) return { rows: [...rows], outcome: { kind: "failed", message: "create needs a string id" } };
1578
- if (rows.some((r) => r.id === id)) return { rows: [...rows], outcome: { kind: "duplicate-id" } };
1579
- const row2 = { ...op.data };
1580
- return { rows: [...rows, row2], outcome: { kind: "created", row: row2 } };
1581
- }
1582
- if (op.kind === "upsert") {
1583
- const id = rowIdOf(op.data);
1584
- if (id === null) return { rows: [...rows], outcome: { kind: "failed", message: "upsert needs a string id" } };
1585
- const index2 = rows.findIndex((r) => r.id === id);
1586
- if (index2 < 0) {
1587
- const row3 = { ...op.data };
1588
- return { rows: [...rows, row3], outcome: { kind: "created", row: row3 } };
1589
- }
1590
- const kept = rows[index2].createdAt;
1591
- const row2 = kept === void 0 ? { ...op.data } : { ...op.data, createdAt: kept };
1592
- return { rows: rows.map((r, i) => i === index2 ? row2 : r), outcome: { kind: "updated", row: row2 } };
1593
- }
1594
- const index = rows.findIndex((r) => r.id === op.id);
1595
- if (index < 0) return { rows: [...rows], outcome: { kind: "not-found" } };
1596
- const before = rows[index];
1597
- if (op.guard !== void 0 && !rowMatchesPredicate(before, op.guard)) return { rows: [...rows], outcome: { kind: "refused" } };
1598
- const guarded = op.guard !== void 0 ? { before } : {};
1599
- if (op.kind === "delete") {
1600
- return { rows: rows.filter((_, i) => i !== index), outcome: { kind: "deleted", ...guarded } };
1601
- }
1602
- const row = { ...before, ...op.data, id: op.id };
1603
- return { rows: rows.map((r, i) => i === index ? row : r), outcome: { kind: "updated", row, ...guarded } };
1604
- }
1605
- var FULL_QUERY_CAPABILITIES = {
1606
- leaves: ["compare", "member", "hasElement", "contains", "isNull"],
1607
- combinators: ["all", "any", "not"],
1608
- compareOps: ["==", "!=", "<", "<=", ">", ">="]};
1609
- var FULL_WRITE_CAPABILITIES = {
1610
- guards: { leaves: FULL_QUERY_CAPABILITIES.leaves, combinators: FULL_QUERY_CAPABILITIES.combinators, compareOps: FULL_QUERY_CAPABILITIES.compareOps },
1611
- conditional: true,
1612
- returnsRow: true,
1613
- stopRuns: true,
1614
- atomicBatch: true
1615
- };
1616
- var QueryDeclinedError = class extends Error {
1617
- constructor(reason, message) {
1618
- super(message ?? `query declined: ${reason}`);
1619
- this.name = "QueryDeclinedError";
1620
- this.reason = reason;
1621
- }
1622
- };
1623
- var WriteDeclinedError = class extends Error {
1624
- constructor(reason, message) {
1625
- super(message ?? `write declined: ${reason}`);
1626
- this.name = "WriteDeclinedError";
1627
- this.reason = reason;
1628
- }
1629
- };
1630
- var RowSetRefSchema = z.object({
1631
- entityType: z.string(),
1632
- ids: z.array(z.string()),
1633
- total: z.number().int().nonnegative(),
1634
- query: RowQuerySchema
1635
- });
1636
- var ROW_SET_MARKER = "$rowSet";
1637
- function rowSetMarker(ref2) {
1638
- return { [ROW_SET_MARKER]: true, ref: ref2 };
1639
- }
1640
- function isRowSetMarker(value) {
1641
- return typeof value === "object" && value !== null && !Array.isArray(value) && ROW_SET_MARKER in value && value[ROW_SET_MARKER] === true && "ref" in value && RowSetRefSchema.safeParse(value.ref).success;
1642
- }
1643
- var ClaimSchema = z.object({ name: z.string(), value: JsonValueSchema });
1644
- var ViewerSchema = z.object({
1645
- id: z.string(),
1646
- email: z.string().nullish(),
1647
- name: z.string().nullish(),
1648
- role: z.string().optional(),
1649
- permissions: z.array(z.string()).optional(),
1650
- claims: z.array(ClaimSchema)
1651
- });
1652
- var ANONYMOUS_USER = {
1653
- id: "anonymous",
1654
- role: "anonymous",
1655
- permissions: []
1656
- };
1657
- var RawUserClaimsSchema = z.object({
1658
- id: z.string().optional(),
1659
- uid: z.string().optional(),
1660
- email: z.string().nullable().optional(),
1661
- name: z.string().nullable().optional(),
1662
- displayName: z.string().nullable().optional(),
1663
- role: z.string().nullable().optional(),
1664
- permissions: z.array(z.string()).nullable().optional()
1665
- }).catchall(FieldValueSchema.optional());
1666
- var NONE_WHEN_NULL_CLAIM_KEYS = ["role", "permissions"];
1667
- var DERIVED_CLAIM_KEYS = ["id", "name", "displayName", "email"];
1668
- function normalizeUserContext(claims) {
1669
- if (!claims) return void 0;
1670
- const id = claims.id ?? claims.uid;
1671
- if (typeof id !== "string" || id.length === 0) return void 0;
1672
- const user = { id };
1673
- for (const [key, value] of Object.entries(claims)) {
1674
- if (value === void 0 || DERIVED_CLAIM_KEYS.includes(key)) continue;
1675
- if (value === null && NONE_WHEN_NULL_CLAIM_KEYS.includes(key)) continue;
1676
- user[key] = value;
1677
- }
1678
- const name = claims.name ?? claims.displayName;
1679
- if (typeof name === "string" && name.length > 0) user.name = name;
1680
- if (typeof claims.email === "string" && claims.email.length > 0) user.email = claims.email;
1681
- return user;
1682
- }
1683
- function personaFromIdentityRow(row) {
1684
- const id = row["id"];
1685
- if (typeof id !== "string" || id.length === 0) return void 0;
1686
- const persona = { id };
1687
- for (const [key, value] of Object.entries(row)) {
1688
- if (key === "id" || value === void 0) continue;
1689
- persona[key] = value;
1690
- }
1691
- return persona;
1692
- }
1693
- function findPersonaInRoster(roster, idOrRole) {
1694
- return roster.find((p) => p.id === idOrRole) ?? roster.find((p) => p.role === idOrRole);
1695
- }
1696
- function resolvePersonaSpec(spec, roster) {
1697
- const raw = spec.trim();
1698
- if (!raw.startsWith("{")) {
1699
- const declared = findPersonaInRoster(roster, raw);
1700
- if (!declared) {
1701
- const known = roster.map((p) => `${p.id}/${p.role ?? "-"}`).join(", ");
1702
- throw new Error(
1703
- `Persona "${raw}" is not a declared persona id or role. ` + (roster.length > 0 ? `Known: ${known}` : "This app declares no [identity] entity, so only the JSON persona form is accepted.")
1704
- );
1705
- }
1706
- return declared;
1707
- }
1708
- let claims;
1709
- try {
1710
- claims = JSON.parse(raw);
1711
- } catch {
1712
- throw new Error(`Persona is not valid JSON: ${raw}`);
1713
- }
1714
- const user = normalizeUserContext(claims);
1715
- if (!user) {
1716
- throw new Error(`Persona needs an "id" (or "uid"): ${raw}`);
1717
- }
1718
- return user;
1719
- }
1720
- var ServerBatchSummarySchema = z.object({
1721
- operations: z.array(EntityRowSchema),
1722
- completedCount: z.number(),
1723
- totalCount: z.number()
1724
- });
1725
- var ServerEffectResultSchema = z.object({
1726
- effect: z.union([z.enum(SERVER_REPORTED_EFFECTS), z.literal("substrate")]),
1727
- action: z.string().optional(),
1728
- entityType: z.string().optional(),
1729
- name: z.custom((v) => typeof v === "string" && /^[^/]+\/.+$/.test(v)).optional(),
1730
- data: z.union([EntityRowSchema, ServerBatchSummarySchema, EventPayloadValueSchema]).optional(),
1731
- success: z.boolean(),
1732
- denied: z.literal(true).optional(),
1733
- error: z.string().optional(),
1734
- code: z.enum(["not-found", "no-row-key", "duplicate-id", "denied"]).optional(),
1735
- target: z.string().optional(),
1736
- routed: z.string().optional()
1737
- });
1738
- function deliveryRecordValue(record) {
1739
- const s = record.source;
1740
- const source = {
1741
- ...s.orbital !== void 0 ? { orbital: s.orbital } : {},
1742
- ...s.orbitalId !== void 0 ? { orbitalId: s.orbitalId } : {},
1743
- ...s.trait !== void 0 ? { trait: s.trait } : {},
1744
- ...s.traitId !== void 0 ? { traitId: s.traitId } : {},
1745
- ...s.eventId !== void 0 ? { eventId: s.eventId } : {},
1746
- ...s.transition !== void 0 ? { transition: s.transition } : {},
1747
- ...s.tick !== void 0 ? { tick: s.tick } : {},
1748
- ...s.fromBridge !== void 0 ? { fromBridge: s.fromBridge } : {},
1749
- ...s.dispatched !== void 0 ? { dispatched: s.dispatched } : {},
1750
- ...s.originClientId !== void 0 ? { originClientId: s.originClientId } : {}
1751
- };
1752
- return { event: record.event, payload: record.payload ?? null, source };
1753
- }
1754
- var BusEventSourceSchema = z.object({
1755
- orbital: z.string().optional(),
1756
- orbitalId: OrbitalIdSchema.optional(),
1757
- trait: z.string().optional(),
1758
- traitId: TraitIdSchema.optional(),
1759
- eventId: EventIdSchema.optional(),
1760
- transition: z.string().optional(),
1761
- tick: z.string().optional(),
1762
- fromBridge: z.boolean().optional(),
1763
- dispatched: z.boolean().optional(),
1764
- originClientId: z.string().optional(),
1765
- pendingKey: z.string().optional(),
1766
- persistSuccess: z.boolean().optional()
1767
- });
1768
- var DeliveryRecordSchema = z.object({
1769
- event: z.string(),
1770
- payload: EventPayloadSchema.optional(),
1771
- source: BusEventSourceSchema
1772
- });
1773
- var DispatchLogSchema = z.object({
1774
- prevEvents: z.array(DeliveryRecordSchema),
1775
- prevStates: z.array(z.string())
1776
- });
1777
- var EmittedEventSchema = z.object({
1778
- event: z.string(),
1779
- payload: EventPayloadSchema.optional(),
1780
- source: BusEventSourceSchema.optional()
1781
- });
1782
- var ClientRenderUITupleSchema = z.tuple([z.literal("render-ui"), z.string(), PatternConfigSchema]);
1783
- var ClientNavigateTupleSchema = z.union([
1784
- z.tuple([z.literal("navigate"), z.string()]),
1785
- z.tuple([z.literal("navigate"), z.string(), z.record(z.string(), z.string()).nullable()]),
1786
- z.tuple([
1787
- z.literal("navigate"),
1788
- z.string(),
1789
- z.record(z.string(), z.string()).nullable(),
1790
- z.object({ crumb: z.string().optional() })
1791
- ])
1792
- ]);
1793
- var ClientNavigateBackTupleSchema = z.tuple([z.literal("navigate-back")]);
1794
- var ClientEffectTupleSchema = z.union([
1795
- ClientRenderUITupleSchema,
1796
- ClientNavigateTupleSchema,
1797
- ClientNavigateBackTupleSchema
1798
- ]);
1799
- var SYSTEM_UI_EVENTS = ["NAVIGATE", "SIGN_OUT"];
1800
- function isSystemUiEvent(event) {
1801
- return SYSTEM_UI_EVENTS.includes(event);
1802
- }
1803
- var LIFECYCLE_EVENTS = ["INIT", "LOAD", "$MOUNT"];
1804
- var UNMOUNT_EVENT = "$UNMOUNT";
1805
- function normalizeEventKey(eventKey) {
1806
- if (!eventKey) return "";
1807
- return eventKey.startsWith("UI:") ? eventKey.slice(3) : eventKey;
1808
- }
1809
- function tickEventKey(tickName) {
1810
- return `$TICK_${tickName}`;
1811
- }
1812
- var MountSeedSchema = z.object({ trait: z.string(), event: z.enum(LIFECYCLE_EVENTS) });
1813
- var EventStreamItemSchema = z.union([
1814
- z.object({ type: z.literal("event"), data: EmittedEventSchema, timestamp: z.number() }),
1815
- z.object({ type: z.literal("effect"), data: ClientEffectTupleSchema, timestamp: z.number() }),
1816
- z.object({ type: z.literal("complete"), data: z.lazy(() => OrbitalEventResponseSchema), timestamp: z.number() }),
1817
- z.object({ type: z.literal("error"), data: z.object({ message: z.string() }), timestamp: z.number() })
1818
- ]);
1819
- var OrbitalEventRequestSchema = z.object({
1820
- event: z.string(),
1821
- eventId: EventIdSchema.optional(),
1822
- payload: EventPayloadSchema.optional(),
1823
- entityId: z.string().optional(),
1824
- targetTrait: z.string().optional(),
1825
- user: RawUserClaimsSchema.optional(),
1826
- clientId: z.string().optional(),
1827
- locale: z.string().optional(),
1828
- tick: z.string().optional(),
1829
- sourceTrait: z.string().optional(),
1830
- runTick: z.object({ trait: z.string(), tick: z.string() }).optional(),
1831
- traits: z.array(z.object({ trait: z.string(), from: z.string() })).optional(),
1832
- entityByTrait: z.record(z.string(), EntityRowSchema).optional(),
1833
- behavior: z.string().optional(),
1834
- delivery: DeliveryRecordSchema.optional(),
1835
- dispatchLog: DispatchLogSchema.optional(),
1836
- mount: z.array(MountSeedSchema).optional()
1837
- });
1838
- var OrbitalEventResponseSchema = z.object({
1839
- success: z.boolean(),
1840
- transitioned: z.boolean(),
1841
- states: z.record(z.string(), z.string()),
1842
- emittedEvents: z.array(EmittedEventSchema),
1843
- data: z.record(z.string(), z.array(EntityRowSchema)).optional(),
1844
- dataRefs: z.record(z.string(), RowSetRefSchema).optional(),
1845
- entityByTrait: z.record(z.string(), EntityRowSchema).optional(),
1846
- clientEffects: z.array(ClientEffectTupleSchema).optional(),
1847
- clientEffectsByTrait: z.array(z.object({
1848
- traitName: z.string(),
1849
- effect: ClientEffectTupleSchema,
1850
- event: z.string().optional(),
1851
- fromState: z.string().optional(),
1852
- callsitePayload: EventPayloadSchema.optional(),
1853
- repaint: z.literal("rows-changed").optional()
1854
- })).optional(),
1855
- effectResults: z.array(ServerEffectResultSchema).optional(),
1856
- guardFailed: z.string().optional(),
1857
- rejections: z.array(
1858
- z.object({
1859
- code: z.enum(["no-matching-transition", "guard-rejected", "no-dispatchable-traits", "not-an-external-input", "inbound-only-event", "effect-failed"]),
1860
- trait: z.string().optional(),
1861
- from: z.string().optional(),
1862
- event: z.string().optional(),
1863
- statesDeclaringEvent: z.array(z.string()).optional(),
1864
- transition: z.string().optional(),
1865
- guard: z.unknown().optional(),
1866
- error: z.string().optional()
1867
- })
1868
- ).optional(),
1869
- cascadeTruncated: z.array(z.string()).optional(),
1870
- transitions: z.array(
1871
- z.object({
1872
- trait: z.string(),
1873
- from: z.string(),
1874
- to: z.string(),
1875
- event: z.string(),
1876
- guardResult: z.boolean().optional(),
1877
- effects: z.array(
1878
- z.object({
1879
- type: z.string(),
1880
- args: z.array(SExprDataSchema),
1881
- status: z.enum(["executed", "failed", "skipped"]),
1882
- error: z.string().optional()
1883
- })
1884
- )
1885
- })
1886
- ).optional(),
1887
- error: z.string().optional()
1888
- });
1889
- var ServerTopologySchema = z.enum(["stateless", "stateful"]);
1890
- var OrbitalRegisterResponseSchema = z.object({
1891
- success: z.boolean(),
1892
- topology: ServerTopologySchema.optional(),
1893
- message: z.string().optional(),
1894
- orbitals: z.array(z.string()).optional(),
1895
- error: z.string().optional()
1896
- });
1897
- var LiveBroadcastItemSchema = z.object({
1898
- event: z.string(),
1899
- payload: EventPayloadSchema.optional(),
1900
- source: BusEventSourceSchema,
1901
- originClientId: z.string().optional()
1902
- });
1903
- var EventDispatchRequestSchema = OrbitalEventRequestSchema;
1904
- var EventDispatchResponseSchema = OrbitalEventResponseSchema;
1905
-
1906
- export { ANIMATION_NAMES, ANONYMOUS_USER, ASSET_ASPECTS, ASSET_DIMENSIONS, AnimationDefSchema, AnimationNameSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetSchema, AudioManifestSchema, BusEventSourceSchema, CAMERA_MODES, CORE_BINDINGS, CameraModeSchema, CameraSchema, ClientEffectTupleSchema, ClientNavigateBackTupleSchema, ClientNavigateTupleSchema, ClientRenderUITupleSchema, DEFAULT_UNIT_ANIMATION_ROWS, DeliveryRecordSchema, DispatchLogSchema, EFFECT_OPERATORS, EFFECT_OPERATOR_FAMILIES, ENTITY_ROLES, EffectSchema, EmittedEventSchema, EntityFieldSchema, EntityIdSchema, EntityPersistenceSchema, EntityRoleSchema, EntityRowSchema, EntitySchema, EventDispatchRequestSchema, EventDispatchResponseSchema, EventIdSchema, EventPayloadSchema, EventPayloadValueSchema, EventStreamItemSchema, ExpressionSchema, FIELD_TYPES, FULL_WRITE_CAPABILITIES, FX_KINDS, FieldProjectionSchema, FieldSchema, FieldTagSchema, FieldTypeSchema, FieldValueSchema, FileValueSchema, FxKindSchema, IdentityLedgerSchema, LIFECYCLE_EVENTS, LedgerEntrySchema, LedgerKindSchema, LiveBroadcastItemSchema, MANIFEST_ASSET_LICENSES, MANIFEST_CANVAS_AFFINITIES, MANIFEST_ENTRY_KINDS, MANIFEST_SOURCE_CATALOGS, ManifestAssetLicenseSchema, ManifestCanvasAffinitySchema, ManifestEntryKindSchema, ManifestEntrySchema, ManifestFrameSpecSchema, ManifestSourceCatalogSchema, MountSeedSchema, OrbitalEntitySchema, OrbitalEventRequestSchema, OrbitalEventResponseSchema, OrbitalIdSchema, OrbitalRegisterResponseSchema, PageIdSchema, PaletteEntryIdSchema, PatternConfigSchema, PatternObjectSchema, QUASIQUOTE_HEAD, QUOTE_HEAD, QueryCapabilitiesSchema, QueryDeclinedError, RENDERED_SLOTS, ROW_SET_MARKER, RawUserClaimsSchema, RelationConfigSchema, ResolvedPatternPropsSchema, RowCommitSchema, RowIdPageSchema, RowPredicateSchema, RowQueryPageSchema, RowQuerySchema, RowSetRefSchema, RowWriteBatchSchema, RowWriteOpSchema, RowWriteOutcomeSchema, SEMANTIC_STRING_PATTERNS, SEMANTIC_STRING_TYPES, SERVER_REPORTED_EFFECTS, SExprAtomSchema, SExprDataSchema, SExprListSchema, SExprSchema, SHEET_PROJECTIONS, SPRITE_DIRECTIONS, SPRITE_SHEET_LAYOUT, SYSTEM_UI_EVENTS, ScenePosSchema, SemanticAssetRefSchema, ServerBatchSummarySchema, ServerEffectResultSchema, ServerTopologySchema, ServiceIdSchema, SheetProjectionSchema, SoundEntrySchema, SpriteDirectionSchema, SpriteSheetAtlasSchema, SubTextureSchema, TYPE_POSITION_ONLY, TextureAtlasSchema, ThemeIdSchema, TilesheetSchema, TraitIdSchema, TypeVariableSchema, UISlotSchema, UI_SLOTS, UNMOUNT_EVENT, UNQUOTE_HEAD, VISUAL_STYLES, ViewerSchema, VisualStyleSchema, WriteCapabilitiesSchema, WriteDeclinedError, asEntityId, asEventId, asOrbitalId, asPageId, asPaletteEntryId, asServiceId, asThemeId, asTraitId, atomic, callService, collectBindings, createAssetKey, decodeQuoteBody, decodeQuotedValue, defaultUnitAtlas, deliveryRecordValue, deref, deriveCollection, deriveId, despawn, doEffects, emit, encodeQuoteBody, findPersonaInRoster, formatSExpr, getArgs, getDefaultAnimationsForRole, getOperator, idKindOf, idPrefix, instancesForLocale, instantiateQuasiquote, isBinding, isClientResident, isEffect, isEmailValue, isEntityId, isEventId, isEventPayloadValue, isFieldValue, isFileValue, isOrbitalId, isPageId, isPaletteEntryId, isPersistBatchOperation, isPhoneValue, isRowSetMarker, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isSemanticStringType, isSemanticStringValue, isServiceId, isStaticallyFalse, isSystemUiEvent, isThemeId, isTraitId, isTypeVariable, isTypeVariableField, isUrlValue, isUuidValue, isValidBinding, ledgerCurName, ledgerRename, ledgerResolveName, manifestToAssetCatalog, matchAssetQuery, mintId, navigate, navigateBack, normalizeEventKey, normalizeUserContext, parseAssetKey, parseAssetQuery, parseBinding, persist, persistenceModeAllowsOverrides, personaFromIdentityRow, quasiquoteExpr, quasiquoteOf, quoteBodyOf, quoteExpr, ref, renderUI, resolvePersonaSpec, rowMatchesPredicate, rowSetMarker, runRowWrite, set, sexpr, spawn, storesRowsInBrowser, swap, tickEventKey, toProgramData, validateAssetAnimations, walkSExpr, watch };
1907
- //# sourceMappingURL=chunk-GTY53NS5.js.map
1908
- //# sourceMappingURL=chunk-GTY53NS5.js.map