@neocompose/cli 0.38.2 → 0.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs CHANGED
@@ -1008,6 +1008,14 @@ function assertKnownFlags(args) {
1008
1008
  }
1009
1009
  }
1010
1010
  }
1011
+ function assertAllowedFlags(args, allowed) {
1012
+ for (const name of args.flags.keys()) {
1013
+ if (allowed.has(name)) continue;
1014
+ throw new NeoCliUsageError(
1015
+ `Flag "--${name}" is not valid for neo ${args.command ?? "help"}. Run \`neo ${args.command ?? "help"} --help\` for usage.`
1016
+ );
1017
+ }
1018
+ }
1011
1019
  var NeoCliUsageError, BOOLEAN_FLAGS, KNOWN_FLAGS, TEST_ONLY_FLAGS;
1012
1020
  var init_args = __esm({
1013
1021
  "src/args.ts"() {
@@ -40241,7 +40249,6 @@ function assertNeoSchemaClass(value, path) {
40241
40249
  "hiddenInMemberSelector",
40242
40250
  "system",
40243
40251
  "allowedStorage",
40244
- "allowedStorageKeys",
40245
40252
  "genericParameters",
40246
40253
  "extendsGenericBindings",
40247
40254
  "targetMemberId"
@@ -40251,7 +40258,8 @@ function assertNeoSchemaClass(value, path) {
40251
40258
  "isSealed",
40252
40259
  "constructorProjections",
40253
40260
  "constructorIds",
40254
- "requiredConstructorId"
40261
+ "requiredConstructorId",
40262
+ "allowedStorageKeys"
40255
40263
  ]
40256
40264
  );
40257
40265
  assertIdentity2(type, path, "class");
@@ -40272,7 +40280,9 @@ function assertNeoSchemaClass(value, path) {
40272
40280
  booleanAt(type.hiddenInMemberSelector, `${path}.hiddenInMemberSelector`);
40273
40281
  assertSystem(type.system, `${path}.system`);
40274
40282
  nullableStorage(type.allowedStorage, `${path}.allowedStorage`);
40275
- nullableStringArray(type.allowedStorageKeys, `${path}.allowedStorageKeys`);
40283
+ if (type.allowedStorageKeys !== void 0) {
40284
+ nullableStringArray(type.allowedStorageKeys, `${path}.allowedStorageKeys`);
40285
+ }
40276
40286
  arrayOf(
40277
40287
  type.genericParameters,
40278
40288
  `${path}.genericParameters`,
@@ -45755,7 +45765,7 @@ function descendantClassIds(classId, allClasses) {
45755
45765
  }
45756
45766
  return result;
45757
45767
  }
45758
- var CircularInheritanceError, UnresolvedMemberInheritanceError, mergedSchemaEpoch, classIndexes, memberIndexes, instanceSurfaceMemo, storedInstanceMemo, readOnlyMemberMemo, staticMemberMemo, mergeInstanceSchema;
45768
+ var CircularInheritanceError, UnresolvedMemberInheritanceError, mergedSchemaEpoch, classIndexes, memberIndexes, instanceSurfaceMemo, storedInstanceMemo, readOnlyMemberMemo, staticMemberMemo;
45759
45769
  var init_inheritance = __esm({
45760
45770
  "../src/models/classes/inheritance.ts"() {
45761
45771
  "use strict";
@@ -45792,7 +45802,6 @@ var init_inheritance = __esm({
45792
45802
  storedInstanceMemo = createMergeMemo();
45793
45803
  readOnlyMemberMemo = createMergeMemo();
45794
45804
  staticMemberMemo = createMergeMemo();
45795
- mergeInstanceSchema = mergeInstanceSurfaceSchema;
45796
45805
  }
45797
45806
  });
45798
45807
 
@@ -47487,6 +47496,56 @@ var init_world_system_classes_generated = __esm({
47487
47496
  }
47488
47497
  });
47489
47498
 
47499
+ // ../src/models/core/deep-clone-plain-data.ts
47500
+ function deepClonePlainData(value) {
47501
+ return clonePlain(value, "$", /* @__PURE__ */ new Set());
47502
+ }
47503
+ function clonePlain(value, path, visiting) {
47504
+ if (value === null || typeof value !== "object") {
47505
+ if (typeof value === "function") {
47506
+ throw new Error(
47507
+ `Plain-data clone met a function at ${path}; value data never stores callables.`
47508
+ );
47509
+ }
47510
+ if (typeof value === "symbol") {
47511
+ throw new Error(
47512
+ `Plain-data clone met a symbol at ${path}; value data never stores symbols.`
47513
+ );
47514
+ }
47515
+ if (typeof value === "bigint") {
47516
+ throw new Error(
47517
+ `Plain-data clone met a bigint at ${path}; value data stores numbers only.`
47518
+ );
47519
+ }
47520
+ return value;
47521
+ }
47522
+ if (visiting.has(value)) {
47523
+ throw new Error(
47524
+ `Plain-data clone met a cycle at ${path}; value data is acyclic by storage contract.`
47525
+ );
47526
+ }
47527
+ visiting.add(value);
47528
+ try {
47529
+ if (Array.isArray(value)) {
47530
+ return value.map(
47531
+ (entry, index) => clonePlain(entry, `${path}[${index}]`, visiting)
47532
+ );
47533
+ }
47534
+ const clone = {};
47535
+ for (const [key, entry] of Object.entries(value)) {
47536
+ clone[key] = clonePlain(entry, `${path}.${key}`, visiting);
47537
+ }
47538
+ return clone;
47539
+ } finally {
47540
+ visiting.delete(value);
47541
+ }
47542
+ }
47543
+ var init_deep_clone_plain_data = __esm({
47544
+ "../src/models/core/deep-clone-plain-data.ts"() {
47545
+ "use strict";
47546
+ }
47547
+ });
47548
+
47490
47549
  // ../src/models/classes/world-system-classes.ts
47491
47550
  function worldAnimationChildOverrideBindingMemberId(classId) {
47492
47551
  return inSystemRecordNamespaceOf(
@@ -47515,7 +47574,7 @@ function worldAnimationChildOverrideBindingMember(projectId, classId) {
47515
47574
  updatedAt: 0
47516
47575
  };
47517
47576
  }
47518
- var WORLD_ANIMATION_CHILD_OVERRIDE_BINDING_MEMBER_NAME, WORLD_ANIMATION_CHILD_OVERRIDE_BINDING_MEMBER_NAMESPACE, WORLD_SYSTEM_ANIMATION_KIND_MARKER, WORLD_SYSTEM_ANIMATION_KINDS, GENERIC_WORLD_SYSTEM_CLASS_KINDS, WORLD_SYSTEM_ALL_KINDS, WORLD_SYSTEM_CLASS_DEFINITION_BY_KIND, WORLD_SYSTEM_SCHEMA_FIELD_SITES_BY_MEMBER_ID;
47577
+ var WORLD_ANIMATION_CHILD_OVERRIDE_BINDING_MEMBER_NAME, WORLD_ANIMATION_CHILD_OVERRIDE_BINDING_MEMBER_NAMESPACE, WORLD_SYSTEM_CLASS_DEFINITION_BY_KIND, WORLD_SYSTEM_ANIMATION_KIND_MARKER, WORLD_SYSTEM_ANIMATION_KINDS, GENERIC_WORLD_SYSTEM_CLASS_KINDS, WORLD_SYSTEM_ALL_KINDS, WORLD_SYSTEM_SCHEMA_FIELD_SITES_BY_MEMBER_ID;
47519
47578
  var init_world_system_classes = __esm({
47520
47579
  "../src/models/classes/world-system-classes.ts"() {
47521
47580
  "use strict";
@@ -47525,9 +47584,16 @@ var init_world_system_classes = __esm({
47525
47584
  init_dist_node();
47526
47585
  init_system_record_id();
47527
47586
  init_world_system_classes_generated();
47587
+ init_deep_clone_plain_data();
47528
47588
  init_world_system_classes_generated();
47529
47589
  WORLD_ANIMATION_CHILD_OVERRIDE_BINDING_MEMBER_NAME = "NeoAnimationChildBinding";
47530
47590
  WORLD_ANIMATION_CHILD_OVERRIDE_BINDING_MEMBER_NAMESPACE = "2048c3bb-8ae5-51cc-a1dc-15178cc41865";
47591
+ WORLD_SYSTEM_CLASS_DEFINITION_BY_KIND = new Map(
47592
+ WORLD_SYSTEM_CLASS_DEFINITIONS.map((definition2) => [
47593
+ definition2.worldKind,
47594
+ definition2
47595
+ ])
47596
+ );
47531
47597
  WORLD_SYSTEM_ANIMATION_KIND_MARKER = "animation";
47532
47598
  WORLD_SYSTEM_ANIMATION_KINDS = new Set(
47533
47599
  WORLD_SYSTEM_CLASS_DEFINITIONS.map(
@@ -47544,12 +47610,6 @@ var init_world_system_classes = __esm({
47544
47610
  WORLD_SYSTEM_ALL_KINDS = new Set(
47545
47611
  WORLD_SYSTEM_CLASS_DEFINITIONS.map((definition2) => definition2.worldKind)
47546
47612
  );
47547
- WORLD_SYSTEM_CLASS_DEFINITION_BY_KIND = new Map(
47548
- WORLD_SYSTEM_CLASS_DEFINITIONS.map((definition2) => [
47549
- definition2.worldKind,
47550
- definition2
47551
- ])
47552
- );
47553
47613
  WORLD_SYSTEM_SCHEMA_FIELD_SITES_BY_MEMBER_ID = new Map(
47554
47614
  WORLD_SYSTEM_CLASS_DEFINITIONS.flatMap(
47555
47615
  (definition2) => (definition2.schemaFields ?? []).map(
@@ -48302,7 +48362,288 @@ var init_instance_provenance = __esm({
48302
48362
  }
48303
48363
  });
48304
48364
 
48365
+ // ../src/models/members/unordered-list-membership.ts
48366
+ function buildUnorderedListMembershipIndex(values) {
48367
+ const membersByContainerId = /* @__PURE__ */ new Map();
48368
+ for (const candidate of values) {
48369
+ const containerId = candidate.containerId;
48370
+ if (typeof containerId !== "string") continue;
48371
+ const bucket = membersByContainerId.get(containerId);
48372
+ if (bucket === void 0) {
48373
+ membersByContainerId.set(containerId, [candidate.id]);
48374
+ } else {
48375
+ bucket.push(candidate.id);
48376
+ }
48377
+ }
48378
+ for (const bucket of membersByContainerId.values()) {
48379
+ bucket.sort();
48380
+ }
48381
+ return membersByContainerId;
48382
+ }
48383
+ function unorderedListEntryIds(values, listValue2, membershipIndex) {
48384
+ if (!Array.isArray(listValue2.value)) return [];
48385
+ if (membershipIndex !== void 0) {
48386
+ return [...membershipIndex.get(listValue2.id) ?? []];
48387
+ }
48388
+ const ids = [];
48389
+ for (const candidate of values) {
48390
+ if (candidate.containerId === listValue2.id) ids.push(candidate.id);
48391
+ }
48392
+ ids.sort();
48393
+ return ids;
48394
+ }
48395
+ function listEntryIdsForValue(member, listValue2, values) {
48396
+ if (listValue2.value === null) return [];
48397
+ if (listKindOf(member) === "unordered") {
48398
+ return unorderedListEntryIds(values, listValue2);
48399
+ }
48400
+ if (!Array.isArray(listValue2.value)) return [];
48401
+ return listValue2.value.filter(
48402
+ (entry) => typeof entry === "string"
48403
+ );
48404
+ }
48405
+ var init_unordered_list_membership = __esm({
48406
+ "../src/models/members/unordered-list-membership.ts"() {
48407
+ "use strict";
48408
+ init_member_kinds();
48409
+ }
48410
+ });
48411
+
48305
48412
  // ../src/models/members/read-only-members.ts
48413
+ function collectReadOnlyClassValueSites(document, selectedMemberId) {
48414
+ const membersById2 = new Map(
48415
+ document.members.map((member) => [member.id, member])
48416
+ );
48417
+ const valuesById = new Map(document.values.map((value) => [value.id, value]));
48418
+ const unorderedMembership = buildUnorderedListMembershipIndex(
48419
+ document.values
48420
+ );
48421
+ const visited = /* @__PURE__ */ new Set();
48422
+ const siteKeys = /* @__PURE__ */ new Set();
48423
+ const sites = [];
48424
+ const visit = (rawMember, valueId) => {
48425
+ const member = resolveMember2(rawMember, document.members);
48426
+ const memberIdentity = "id" in rawMember && typeof rawMember.id === "string" ? rawMember.id : `class:${isMemberClassBase(member) ? member.classId : member.kind}`;
48427
+ const visitKey = `${memberIdentity}\0${valueId}`;
48428
+ if (visited.has(visitKey)) return;
48429
+ visited.add(visitKey);
48430
+ const value = valuesById.get(valueId);
48431
+ if (value === void 0) return;
48432
+ if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
48433
+ const entry = membersById2.get(member.entryMemberId);
48434
+ if (entry === void 0) return;
48435
+ const childIds = isMemberListBase(member) && listKindOf(member) === "unordered" ? unorderedMembership.get(value.id) ?? [] : Array.isArray(value.value) ? value.value : isStringRecord(value.value) ? Object.values(value.value) : [];
48436
+ for (const childId of childIds) visit(entry, childId);
48437
+ return;
48438
+ }
48439
+ if (!isMemberClassBase(member) || !isStringRecord(value.value)) return;
48440
+ const effectiveClassId = value.classId ?? member.classId;
48441
+ const env = resolveInstanceEnv(
48442
+ effectiveClassId,
48443
+ member.classArguments,
48444
+ document.classes
48445
+ );
48446
+ for (const entry of mergeInstanceSurfaceSchema(
48447
+ effectiveClassId,
48448
+ document.classes,
48449
+ document.members
48450
+ )) {
48451
+ if (entry.memberId === selectedMemberId) {
48452
+ const siteKey = `${value.id}\0${entry.schemaKey}`;
48453
+ if (!siteKeys.has(siteKey)) {
48454
+ siteKeys.add(siteKey);
48455
+ sites.push({
48456
+ value,
48457
+ record: value.value,
48458
+ schemaKey: entry.schemaKey,
48459
+ effectiveClassId
48460
+ });
48461
+ }
48462
+ }
48463
+ const childId = value.value[entry.schemaKey];
48464
+ const childMember = membersById2.get(entry.memberId);
48465
+ if (childMember === void 0 || typeof childId !== "string") continue;
48466
+ visit(substituteMember(childMember, env, document.members), childId);
48467
+ }
48468
+ };
48469
+ for (const member of document.members) {
48470
+ if (typeof member.valueId === "string") visit(member, member.valueId);
48471
+ if (member.defaultValue == null) continue;
48472
+ const synthetic = {
48473
+ id: `__default:${member.id}`,
48474
+ projectId: member.projectId,
48475
+ createdAt: member.createdAt,
48476
+ updatedAt: member.updatedAt,
48477
+ ...member.defaultValue
48478
+ };
48479
+ valuesById.set(synthetic.id, synthetic);
48480
+ visit(member, synthetic.id);
48481
+ }
48482
+ for (const value of document.values) {
48483
+ if (typeof value.classId !== "string") continue;
48484
+ visit(syntheticClassRowMember(value), value.id);
48485
+ }
48486
+ return sites.filter((site) => !site.value.id.startsWith("__default:"));
48487
+ }
48488
+ function collectValuesReachableWithoutReadOnlyBinding(document, excludedMemberId) {
48489
+ const membersById2 = new Map(
48490
+ document.members.map((member) => [member.id, member])
48491
+ );
48492
+ const valuesById = new Map(document.values.map((value) => [value.id, value]));
48493
+ const unorderedMembership = buildUnorderedListMembershipIndex(
48494
+ document.values
48495
+ );
48496
+ const reachable = /* @__PURE__ */ new Set();
48497
+ const visitBody = (rawMember, body, classId, ownerValueId) => {
48498
+ const member = resolveMember2(rawMember, document.members);
48499
+ const visitChild = (childMember, childId) => {
48500
+ if (childMember === void 0 || typeof childId !== "string") return;
48501
+ if (reachable.has(childId)) return;
48502
+ const child = valuesById.get(childId);
48503
+ if (child === void 0) return;
48504
+ reachable.add(childId);
48505
+ visitBody(childMember, child.value, child.classId ?? void 0, child.id);
48506
+ };
48507
+ if (isMemberListBase(member)) {
48508
+ const entry = membersById2.get(member.entryMemberId);
48509
+ if (listKindOf(member) === "unordered" && ownerValueId !== void 0) {
48510
+ for (const childId of unorderedMembership.get(ownerValueId) ?? []) {
48511
+ visitChild(entry, childId);
48512
+ }
48513
+ } else if (Array.isArray(body)) {
48514
+ for (const childId of body) visitChild(entry, childId);
48515
+ }
48516
+ return;
48517
+ }
48518
+ if (isMemberDictionaryBase(member) && isStringRecord(body)) {
48519
+ const entry = membersById2.get(member.entryMemberId);
48520
+ for (const childId of Object.values(body)) visitChild(entry, childId);
48521
+ return;
48522
+ }
48523
+ if (!isMemberClassBase(member) || !isStringRecord(body)) return;
48524
+ const effectiveClassId = classId ?? member.classId;
48525
+ const env = resolveInstanceEnv(
48526
+ effectiveClassId,
48527
+ member.classArguments,
48528
+ document.classes
48529
+ );
48530
+ for (const entry of mergeInstanceSurfaceSchema(
48531
+ effectiveClassId,
48532
+ document.classes,
48533
+ document.members
48534
+ )) {
48535
+ if (entry.memberId === excludedMemberId) continue;
48536
+ const childMember = membersById2.get(entry.memberId);
48537
+ visitChild(
48538
+ childMember === void 0 ? void 0 : substituteMember(childMember, env, document.members),
48539
+ body[entry.schemaKey]
48540
+ );
48541
+ }
48542
+ };
48543
+ for (const member of document.members) {
48544
+ if (member.id !== excludedMemberId && typeof member.valueId === "string") {
48545
+ const value = valuesById.get(member.valueId);
48546
+ if (value !== void 0) {
48547
+ reachable.add(value.id);
48548
+ visitBody(member, value.value, value.classId ?? void 0, value.id);
48549
+ }
48550
+ }
48551
+ if (member.defaultValue != null) {
48552
+ visitBody(
48553
+ member,
48554
+ member.defaultValue.value,
48555
+ member.defaultValue.classId ?? void 0,
48556
+ void 0
48557
+ );
48558
+ }
48559
+ }
48560
+ const referencedValueIds = collectStructurallyReferencedValueIds(
48561
+ document.values
48562
+ );
48563
+ const boundRootIds = new Set(
48564
+ document.members.flatMap(
48565
+ (member) => typeof member.valueId === "string" ? [member.valueId] : []
48566
+ )
48567
+ );
48568
+ for (const value of document.values) {
48569
+ if (typeof value.classId !== "string") continue;
48570
+ if (referencedValueIds.has(value.id) || boundRootIds.has(value.id)) {
48571
+ continue;
48572
+ }
48573
+ reachable.add(value.id);
48574
+ visitBody(
48575
+ syntheticClassRowMember(value),
48576
+ value.value,
48577
+ value.classId,
48578
+ value.id
48579
+ );
48580
+ }
48581
+ return reachable;
48582
+ }
48583
+ function remapReadOnlyConversionValueIds(values, memberId, ownerValueId) {
48584
+ const remapped = /* @__PURE__ */ new Map();
48585
+ values.forEach((value, index) => {
48586
+ remapped.set(
48587
+ value.id,
48588
+ v5_default(
48589
+ `neo-compose:readonly-conversion:${memberId}:${ownerValueId}:${index}`,
48590
+ v5_default.URL
48591
+ )
48592
+ );
48593
+ });
48594
+ const rewrite = (value) => {
48595
+ if (typeof value === "string") return remapped.get(value) ?? value;
48596
+ if (Array.isArray(value)) return value.map(rewrite);
48597
+ if (value === null || typeof value !== "object") return value;
48598
+ return Object.fromEntries(
48599
+ Object.entries(value).map(([key, child]) => [key, rewrite(child)])
48600
+ );
48601
+ };
48602
+ for (const value of values) {
48603
+ value.id = remapped.get(value.id) ?? value.id;
48604
+ value.value = rewrite(value.value);
48605
+ if (typeof value.containerId === "string") {
48606
+ value.containerId = remapped.get(value.containerId) ?? value.containerId;
48607
+ }
48608
+ }
48609
+ }
48610
+ function collectStructurallyReferencedValueIds(values) {
48611
+ const valueIds = new Set(values.map((value) => value.id));
48612
+ const referenced = /* @__PURE__ */ new Set();
48613
+ for (const value of values) {
48614
+ const candidates = Array.isArray(value.value) ? value.value : isStringRecord(value.value) ? Object.values(value.value) : [];
48615
+ for (const candidate of candidates) {
48616
+ if (typeof candidate === "string" && valueIds.has(candidate)) {
48617
+ referenced.add(candidate);
48618
+ }
48619
+ }
48620
+ if (typeof value.containerId === "string") referenced.add(value.id);
48621
+ }
48622
+ return referenced;
48623
+ }
48624
+ function syntheticClassRowMember(value) {
48625
+ const classId = value.classId;
48626
+ if (typeof classId !== "string") {
48627
+ throw new Error(
48628
+ `Partitioned class row "${value.id}" has no effective class id.`
48629
+ );
48630
+ }
48631
+ return {
48632
+ name: "Partitioned class row",
48633
+ kind: 7 /* Class */,
48634
+ classId,
48635
+ locked: false,
48636
+ required: true,
48637
+ isStatic: false,
48638
+ accessModifierKind: "public"
48639
+ };
48640
+ }
48641
+ function isStringRecord(value) {
48642
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
48643
+ return false;
48644
+ }
48645
+ return Object.values(value).every((child) => typeof child === "string");
48646
+ }
48306
48647
  function assertReadOnlyMembersValid(document) {
48307
48648
  const membersById2 = new Map(
48308
48649
  document.members.map((member) => [member.id, member])
@@ -48621,6 +48962,8 @@ var init_read_only_members = __esm({
48621
48962
  init_member_kinds();
48622
48963
  init_instance_provenance();
48623
48964
  init_member_storage();
48965
+ init_unordered_list_membership();
48966
+ init_dist_node();
48624
48967
  VALUELESS_KINDS = /* @__PURE__ */ new Set([
48625
48968
  10 /* NSProperty */,
48626
48969
  13 /* Function */,
@@ -48638,53 +48981,6 @@ var init_member_kinds_db_response = __esm({
48638
48981
  }
48639
48982
  });
48640
48983
 
48641
- // ../src/models/members/unordered-list-membership.ts
48642
- function buildUnorderedListMembershipIndex(values) {
48643
- const membersByContainerId = /* @__PURE__ */ new Map();
48644
- for (const candidate of values) {
48645
- const containerId = candidate.containerId;
48646
- if (typeof containerId !== "string") continue;
48647
- const bucket = membersByContainerId.get(containerId);
48648
- if (bucket === void 0) {
48649
- membersByContainerId.set(containerId, [candidate.id]);
48650
- } else {
48651
- bucket.push(candidate.id);
48652
- }
48653
- }
48654
- for (const bucket of membersByContainerId.values()) {
48655
- bucket.sort();
48656
- }
48657
- return membersByContainerId;
48658
- }
48659
- function unorderedListEntryIds(values, listValue2, membershipIndex) {
48660
- if (!Array.isArray(listValue2.value)) return [];
48661
- if (membershipIndex !== void 0) {
48662
- return [...membershipIndex.get(listValue2.id) ?? []];
48663
- }
48664
- const ids = [];
48665
- for (const candidate of values) {
48666
- if (candidate.containerId === listValue2.id) ids.push(candidate.id);
48667
- }
48668
- ids.sort();
48669
- return ids;
48670
- }
48671
- function listEntryIdsForValue(member, listValue2, values) {
48672
- if (listValue2.value === null) return [];
48673
- if (listKindOf(member) === "unordered") {
48674
- return unorderedListEntryIds(values, listValue2);
48675
- }
48676
- if (!Array.isArray(listValue2.value)) return [];
48677
- return listValue2.value.filter(
48678
- (entry) => typeof entry === "string"
48679
- );
48680
- }
48681
- var init_unordered_list_membership = __esm({
48682
- "../src/models/members/unordered-list-membership.ts"() {
48683
- "use strict";
48684
- init_member_kinds();
48685
- }
48686
- });
48687
-
48688
48984
  // ../src/models/members/member-storage-key.ts
48689
48985
  function normalizeStorageKeyDeclaration(declaration) {
48690
48986
  if (declaration === void 0 || declaration === null) {
@@ -48846,56 +49142,6 @@ var init_storage_partitions = __esm({
48846
49142
  }
48847
49143
  });
48848
49144
 
48849
- // ../src/models/core/deep-clone-plain-data.ts
48850
- function deepClonePlainData(value) {
48851
- return clonePlain(value, "$", /* @__PURE__ */ new Set());
48852
- }
48853
- function clonePlain(value, path, visiting) {
48854
- if (value === null || typeof value !== "object") {
48855
- if (typeof value === "function") {
48856
- throw new Error(
48857
- `Plain-data clone met a function at ${path}; value data never stores callables.`
48858
- );
48859
- }
48860
- if (typeof value === "symbol") {
48861
- throw new Error(
48862
- `Plain-data clone met a symbol at ${path}; value data never stores symbols.`
48863
- );
48864
- }
48865
- if (typeof value === "bigint") {
48866
- throw new Error(
48867
- `Plain-data clone met a bigint at ${path}; value data stores numbers only.`
48868
- );
48869
- }
48870
- return value;
48871
- }
48872
- if (visiting.has(value)) {
48873
- throw new Error(
48874
- `Plain-data clone met a cycle at ${path}; value data is acyclic by storage contract.`
48875
- );
48876
- }
48877
- visiting.add(value);
48878
- try {
48879
- if (Array.isArray(value)) {
48880
- return value.map(
48881
- (entry, index) => clonePlain(entry, `${path}[${index}]`, visiting)
48882
- );
48883
- }
48884
- const clone = {};
48885
- for (const [key, entry] of Object.entries(value)) {
48886
- clone[key] = clonePlain(entry, `${path}.${key}`, visiting);
48887
- }
48888
- return clone;
48889
- } finally {
48890
- visiting.delete(value);
48891
- }
48892
- }
48893
- var init_deep_clone_plain_data = __esm({
48894
- "../src/models/core/deep-clone-plain-data.ts"() {
48895
- "use strict";
48896
- }
48897
- });
48898
-
48899
49145
  // ../src/models/unity/unity-import-settings.ts
48900
49146
  function buildDefaultUnityTexture2DImportSettings() {
48901
49147
  return {
@@ -50423,7 +50669,7 @@ function buildNewValue(projectId, body, timestamp = Date.now()) {
50423
50669
  updatedAt: timestamp
50424
50670
  };
50425
50671
  if (body.constructorArgs !== void 0 && body.constructorArgs !== null) {
50426
- props.constructorArgs = cloneJsonValue(body.constructorArgs);
50672
+ props.constructorArgs = deepClonePlainData(body.constructorArgs);
50427
50673
  }
50428
50674
  if (body.instanceConstructorId !== void 0) {
50429
50675
  props.instanceConstructorId = body.instanceConstructorId;
@@ -50460,7 +50706,7 @@ function retargetDelegateReceiverValueIds(rows, fromValueId, toValueId) {
50460
50706
  }
50461
50707
  function cloneDefaultClassRecord(args) {
50462
50708
  const sourceValue = args.sourceBody?.value;
50463
- if (!isStringRecord(sourceValue)) return {};
50709
+ if (!isStringRecord2(sourceValue)) return {};
50464
50710
  const record3 = {};
50465
50711
  const entries = getSchemaEntryMap(args.document, args.effectiveClassId);
50466
50712
  for (const [schemaKey, sourceValueId] of Object.entries(sourceValue)) {
@@ -50535,7 +50781,7 @@ function cloneDefaultListRecord(args) {
50535
50781
  }
50536
50782
  function cloneDefaultDictionaryRecord(args) {
50537
50783
  const sourceValue = args.sourceBody?.value;
50538
- if (!isStringRecord(sourceValue)) return { value: {} };
50784
+ if (!isStringRecord2(sourceValue)) return { value: {} };
50539
50785
  const entryMember = findMemberInDocument(
50540
50786
  args.document,
50541
50787
  args.member.entryMemberId
@@ -50711,27 +50957,17 @@ function getSchemaEntryMap(document, classId) {
50711
50957
  }
50712
50958
  function cloneMemberValueBase(body) {
50713
50959
  return {
50714
- value: cloneJsonValue(body.value),
50960
+ value: deepClonePlainData(body.value),
50715
50961
  classId: body.classId,
50716
50962
  ...body.instanceConstructorId === void 0 ? {} : { instanceConstructorId: body.instanceConstructorId },
50717
50963
  ...body.instanceVariantId === void 0 ? {} : { instanceVariantId: body.instanceVariantId },
50718
50964
  ...body.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: body.instanceVariantRowValueId },
50719
50965
  ...body.constructorArgs === void 0 || body.constructorArgs === null ? {} : {
50720
- constructorArgs: cloneJsonValue(body.constructorArgs)
50966
+ constructorArgs: deepClonePlainData(body.constructorArgs)
50721
50967
  }
50722
50968
  };
50723
50969
  }
50724
- function cloneJsonValue(value) {
50725
- if (Array.isArray(value)) return value.map((entry) => cloneJsonValue(entry));
50726
- if (value === null) return null;
50727
- if (typeof value !== "object") return value;
50728
- const result = {};
50729
- for (const [key, entry] of Object.entries(value)) {
50730
- result[key] = cloneJsonValue(entry);
50731
- }
50732
- return result;
50733
- }
50734
- function isStringRecord(value) {
50970
+ function isStringRecord2(value) {
50735
50971
  if (value === null) return false;
50736
50972
  if (typeof value !== "object") return false;
50737
50973
  if (Array.isArray(value)) return false;
@@ -51261,7 +51497,7 @@ function validateDocumentListIndexes(ctx) {
51261
51497
  function resolveEffectiveSchemaField(schemaClass2, schemaKey, ctx, entrySlot) {
51262
51498
  let placement;
51263
51499
  try {
51264
- placement = mergeInstanceSchema(
51500
+ placement = mergeInstanceSurfaceSchema(
51265
51501
  schemaClass2.id,
51266
51502
  ctx.classes,
51267
51503
  ctx.members
@@ -51475,7 +51711,7 @@ var init_effective_storage = __esm({
51475
51711
  mergedSchema(classId) {
51476
51712
  const cached = this.mergedSchemaByClassId.get(classId);
51477
51713
  if (cached !== void 0) return cached;
51478
- const merged = mergeInstanceSchema(
51714
+ const merged = mergeInstanceSurfaceSchema(
51479
51715
  classId,
51480
51716
  this.ctx.classes,
51481
51717
  this.ctx.members
@@ -56118,6 +56354,319 @@ var init_dialogue_record_split = __esm({
56118
56354
  }
56119
56355
  });
56120
56356
 
56357
+ // ../src/models/localization/localization-types.ts
56358
+ function memberValueLocalizedTextLink(valueId) {
56359
+ return {
56360
+ kind: "member-value",
56361
+ recordKind: "value",
56362
+ recordId: valueId,
56363
+ fieldPath: "value",
56364
+ valueId
56365
+ };
56366
+ }
56367
+ function memberDefaultLocalizedTextLink(memberId) {
56368
+ return {
56369
+ kind: "member-default-value",
56370
+ recordKind: "member",
56371
+ recordId: memberId,
56372
+ fieldPath: "defaultValue.value"
56373
+ };
56374
+ }
56375
+ function dialogueNodeLocalizedTextLink(nodeId) {
56376
+ return {
56377
+ kind: "dialogue-node-text",
56378
+ recordKind: "dialogue-node",
56379
+ recordId: nodeId,
56380
+ fieldPath: "text",
56381
+ nodeId
56382
+ };
56383
+ }
56384
+ function dialogueChoiceLocalizedTextLink(nodeId, choiceId) {
56385
+ return {
56386
+ kind: "dialogue-choice-text",
56387
+ recordKind: "dialogue-node",
56388
+ recordId: nodeId,
56389
+ fieldPath: `optionSettings.options.${choiceId}.text`,
56390
+ nodeId,
56391
+ choiceId
56392
+ };
56393
+ }
56394
+ function localizedTextLinkIdentity(link) {
56395
+ switch (link.kind) {
56396
+ case "member-value":
56397
+ return JSON.stringify([link.kind, link.valueId]);
56398
+ case "member-default-value":
56399
+ case "dialogue-description":
56400
+ case "dialogue-group-name":
56401
+ case "priority-group-name":
56402
+ return JSON.stringify([link.kind, link.recordId]);
56403
+ case "dialogue-node-text":
56404
+ return JSON.stringify([link.kind, link.nodeId]);
56405
+ case "dialogue-choice-text":
56406
+ return JSON.stringify([link.kind, link.nodeId, link.choiceId]);
56407
+ }
56408
+ }
56409
+ function upsertLocalizedTextLink(links, link) {
56410
+ const identity2 = localizedTextLinkIdentity(link);
56411
+ const existingIndex = links.findIndex(
56412
+ (candidate) => localizedTextLinkIdentity(candidate) === identity2
56413
+ );
56414
+ if (existingIndex === -1) return [...links, link];
56415
+ const next = [...links];
56416
+ next[existingIndex] = { ...next[existingIndex], ...link };
56417
+ return next;
56418
+ }
56419
+ function isProjectLocaleConfig(value) {
56420
+ if (!isObject(value)) return false;
56421
+ const v = value;
56422
+ if (!isLocaleCode(v.locale)) return false;
56423
+ if (!isOptionalNullableString(v.sourceLocale)) return false;
56424
+ if (v.sourceLocale !== void 0 && v.sourceLocale !== null) {
56425
+ if (!isLocaleCode(v.sourceLocale)) return false;
56426
+ }
56427
+ if (!isOptionalNullableString(v.name)) return false;
56428
+ if (!isFiniteNumber(v.sortOrder)) return false;
56429
+ return isOptionalNullableDate(v.archivedAt);
56430
+ }
56431
+ function isProjectLocalizationConfigProps(value) {
56432
+ if (!isWithId(value)) return false;
56433
+ if (!isIWithTimestamps(value)) return false;
56434
+ const v = value;
56435
+ if (v.id !== PROJECT_LOCALIZATION_CONFIG_ID) return false;
56436
+ if (!isString(v.projectId)) return false;
56437
+ if (!isLocaleCode(v.mainLocale)) return false;
56438
+ if (!Array.isArray(v.supportedLocales)) return false;
56439
+ if (!v.supportedLocales.every(isProjectLocaleConfig)) return false;
56440
+ if (!isStringArray2(v.sortedStatusIds)) return false;
56441
+ return isString(v.mainLocaleDefaultStatusId);
56442
+ }
56443
+ function isProjectLocalizationConfig(value) {
56444
+ return isProjectLocalizationConfigProps(value);
56445
+ }
56446
+ function isLocalizationStatusProps(value) {
56447
+ if (!isWithId(value)) return false;
56448
+ if (!isIWithTimestamps(value)) return false;
56449
+ const v = value;
56450
+ if (!isString(v.projectId)) return false;
56451
+ if (!isSlug(v.slug)) return false;
56452
+ if (!isString(v.name)) return false;
56453
+ if (!isOptionalNullableString(v.description)) return false;
56454
+ if (!isOptionalNullableString(v.color)) return false;
56455
+ if (!isOptionalNullableString(v.emoji)) return false;
56456
+ if (!isOptionalNullableDate(v.archivedAt)) return false;
56457
+ if (!isNullableStringArray(v.transitionRules)) return false;
56458
+ if (!isNullableString(v.transitionToStatusIdOnEditText)) return false;
56459
+ if (!isNullableString(v.transitionToWhenSourceBecomesStatusId)) return false;
56460
+ if (v.system !== void 0 && v.system !== null) {
56461
+ return isSystemMetadata(v.system);
56462
+ }
56463
+ return true;
56464
+ }
56465
+ function isLocalizationStatus(value) {
56466
+ return isLocalizationStatusProps(value);
56467
+ }
56468
+ function isLocalizedTextLocaleValue(value) {
56469
+ if (!isObject(value)) return false;
56470
+ const v = value;
56471
+ if (!isNullableString(v.value)) return false;
56472
+ if (!isString(v.statusId)) return false;
56473
+ if (!isOptionalNullableString(v.localeComment)) return false;
56474
+ return isEpochMillis(v.updatedAt);
56475
+ }
56476
+ function isLocalizedTextLinkKind(value) {
56477
+ if (!isString(value)) return false;
56478
+ return LOCALIZED_TEXT_LINK_KINDS.includes(value);
56479
+ }
56480
+ function isLocalizedTextLink(value) {
56481
+ if (!isObject(value)) return false;
56482
+ const v = value;
56483
+ if (!isLocalizedTextLinkKind(v.kind)) return false;
56484
+ if (!isOptionalNullableString(v.recordKind)) return false;
56485
+ if (!isOptionalNullableString(v.recordId)) return false;
56486
+ if (!isOptionalNullableString(v.fieldPath)) return false;
56487
+ if (!isOptionalNullableString(v.valueId)) return false;
56488
+ if (!isOptionalNullableString(v.nodeId)) return false;
56489
+ if (!isOptionalNullableString(v.choiceId)) return false;
56490
+ switch (v.kind) {
56491
+ case "member-value":
56492
+ return isString(v.valueId);
56493
+ case "member-default-value":
56494
+ case "dialogue-description":
56495
+ case "dialogue-group-name":
56496
+ case "priority-group-name":
56497
+ return isString(v.recordId);
56498
+ case "dialogue-node-text":
56499
+ return v.recordKind === "dialogue-node" && isString(v.nodeId);
56500
+ case "dialogue-choice-text":
56501
+ return v.recordKind === "dialogue-node" && isString(v.nodeId) && isString(v.choiceId);
56502
+ }
56503
+ }
56504
+ function isLocalizedTextProps(value) {
56505
+ if (!isWithId(value)) return false;
56506
+ if (!isIWithTimestamps(value)) return false;
56507
+ const v = value;
56508
+ if (!isString(v.projectId)) return false;
56509
+ if (!isOptionalNullableString(v.sourceComment)) return false;
56510
+ if (!Array.isArray(v.links)) return false;
56511
+ if (!v.links.every(isLocalizedTextLink)) return false;
56512
+ if (!isOptionalNullableDate(v.archivedAt)) return false;
56513
+ return isLocaleValueRecord(v.localeValues);
56514
+ }
56515
+ function isLocalizedText(value) {
56516
+ return isLocalizedTextProps(value);
56517
+ }
56518
+ function isLocaleCode(value) {
56519
+ if (!isString(value)) return false;
56520
+ if (value.trim() !== value) return false;
56521
+ if (value.length === 0) return false;
56522
+ return /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(value);
56523
+ }
56524
+ function isLocaleValueRecord(value) {
56525
+ if (!isObject(value)) return false;
56526
+ for (const [locale, localeValue] of Object.entries(value)) {
56527
+ if (!isLocaleCode(locale)) return false;
56528
+ if (!isLocalizedTextLocaleValue(localeValue)) return false;
56529
+ }
56530
+ return true;
56531
+ }
56532
+ function isOptionalNullableDate(value) {
56533
+ if (value === void 0) return true;
56534
+ if (value === null) return true;
56535
+ return isEpochMillis(value);
56536
+ }
56537
+ function isFiniteNumber(value) {
56538
+ if (typeof value !== "number") return false;
56539
+ return Number.isFinite(value);
56540
+ }
56541
+ function isSlug(value) {
56542
+ if (!isString(value)) return false;
56543
+ return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
56544
+ }
56545
+ function isNullableString(value) {
56546
+ if (value === null) return true;
56547
+ return isString(value);
56548
+ }
56549
+ function isStringArray2(value) {
56550
+ if (!Array.isArray(value)) return false;
56551
+ return value.every(isString);
56552
+ }
56553
+ function isNullableStringArray(value) {
56554
+ if (value === null) return true;
56555
+ return isStringArray2(value);
56556
+ }
56557
+ var PROJECT_LOCALIZATION_CONFIG_ID, LOCALIZED_TEXT_LINK_KINDS;
56558
+ var init_localization_types = __esm({
56559
+ "../src/models/localization/localization-types.ts"() {
56560
+ "use strict";
56561
+ init_core();
56562
+ PROJECT_LOCALIZATION_CONFIG_ID = "system_b9f80fd7-7ed2-4344-a2b6-625ced732ed0";
56563
+ LOCALIZED_TEXT_LINK_KINDS = [
56564
+ "member-value",
56565
+ "member-default-value",
56566
+ "dialogue-description",
56567
+ "dialogue-node-text",
56568
+ "dialogue-choice-text",
56569
+ "dialogue-group-name",
56570
+ "priority-group-name"
56571
+ ];
56572
+ }
56573
+ });
56574
+
56575
+ // ../src/models/localization/localization-export.ts
56576
+ var init_localization_export = __esm({
56577
+ "../src/models/localization/localization-export.ts"() {
56578
+ "use strict";
56579
+ init_localization_types();
56580
+ }
56581
+ });
56582
+
56583
+ // ../src/models/localization/localization-import.ts
56584
+ var init_localization_import = __esm({
56585
+ "../src/models/localization/localization-import.ts"() {
56586
+ "use strict";
56587
+ }
56588
+ });
56589
+
56590
+ // ../src/models/localization/localized-text-create-envelope.ts
56591
+ function completeLocalizedTextCreateEnvelope(data, config) {
56592
+ const text = asUnknownRecord(data);
56593
+ if (text === null) return data;
56594
+ const localeValues = asUnknownRecord(text.localeValues);
56595
+ const mainLocaleValue = localeValues === null ? null : asUnknownRecord(localeValues[config.mainLocale]);
56596
+ const completedMainLocaleValue = mainLocaleValue === null ? null : {
56597
+ ...mainLocaleValue,
56598
+ ...mainLocaleValue.statusId === void 0 ? { statusId: config.mainLocaleDefaultStatusId } : {},
56599
+ ...mainLocaleValue.updatedAt === void 0 && text.updatedAt !== void 0 ? { updatedAt: text.updatedAt } : {}
56600
+ };
56601
+ return {
56602
+ ...text,
56603
+ ...text.links === void 0 ? { links: [] } : {},
56604
+ ...localeValues === null || completedMainLocaleValue === null ? {} : {
56605
+ localeValues: {
56606
+ ...localeValues,
56607
+ [config.mainLocale]: completedMainLocaleValue
56608
+ }
56609
+ }
56610
+ };
56611
+ }
56612
+ function buildLocalizedTextCreateForLink(args) {
56613
+ const completed = completeLocalizedTextCreateEnvelope(
56614
+ {
56615
+ id: args.id,
56616
+ projectId: args.projectId,
56617
+ sourceComment: null,
56618
+ links: [args.link],
56619
+ localeValues: {
56620
+ [args.config.mainLocale]: {
56621
+ value: args.value,
56622
+ localeComment: null
56623
+ }
56624
+ },
56625
+ createdAt: args.now,
56626
+ updatedAt: args.now
56627
+ },
56628
+ args.config
56629
+ );
56630
+ if (!isLocalizedText(completed)) {
56631
+ throw new Error(
56632
+ `Localized text "${args.id}" could not be completed into a valid create envelope.`
56633
+ );
56634
+ }
56635
+ return completed;
56636
+ }
56637
+ function asUnknownRecord(value) {
56638
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
56639
+ return null;
56640
+ }
56641
+ return value;
56642
+ }
56643
+ var init_localized_text_create_envelope = __esm({
56644
+ "../src/models/localization/localized-text-create-envelope.ts"() {
56645
+ "use strict";
56646
+ init_localization_types();
56647
+ }
56648
+ });
56649
+
56650
+ // ../src/models/localization/index.ts
56651
+ var init_localization2 = __esm({
56652
+ "../src/models/localization/index.ts"() {
56653
+ "use strict";
56654
+ init_localization_types();
56655
+ init_localization_export();
56656
+ init_localization_import();
56657
+ init_localized_text_create_envelope();
56658
+ }
56659
+ });
56660
+
56661
+ // ../src/models/dialogue/dialogue-localized-text-links.ts
56662
+ var init_dialogue_localized_text_links = __esm({
56663
+ "../src/models/dialogue/dialogue-localized-text-links.ts"() {
56664
+ "use strict";
56665
+ init_localization2();
56666
+ init_dialogue_types();
56667
+ }
56668
+ });
56669
+
56121
56670
  // ../src/models/dialogue/priority-types.ts
56122
56671
  function isPriorityTypeBase(value) {
56123
56672
  const v = value;
@@ -56199,6 +56748,7 @@ var init_dialogue_db_response_types = __esm({
56199
56748
  init_dialogue_types();
56200
56749
  init_dialogue_group_types();
56201
56750
  init_priority_types();
56751
+ init_localization_types();
56202
56752
  }
56203
56753
  });
56204
56754
 
@@ -56254,6 +56804,7 @@ var init_dialogue = __esm({
56254
56804
  init_dialogue_lookup_candidates();
56255
56805
  init_dialogue_diagnostics();
56256
56806
  init_dialogue_record_split();
56807
+ init_dialogue_localized_text_links();
56257
56808
  init_dialogue_group_types();
56258
56809
  init_dialogue_db_response_types();
56259
56810
  init_dialogue_triggering();
@@ -57895,10 +58446,23 @@ function neoVariantSystemClass(classes, lookup = false) {
57895
58446
  const declared = classes.find(
57896
58447
  (item) => item.system?.worldKind === (lookup ? NeoWorldSystemClassKind.LookupVariant : NeoWorldSystemClassKind.Variant)
57897
58448
  );
57898
- if (declared === void 0) return null;
58449
+ if (declared === void 0) {
58450
+ throw new Error(
58451
+ `Canonical ${lookup ? "NeoLookupVariant" : "NeoVariant"} system class is missing.`
58452
+ );
58453
+ }
57899
58454
  const targetParamId = declared.genericParams?.[0]?.id;
57900
- if (targetParamId === void 0) return null;
58455
+ if (targetParamId === void 0) {
58456
+ throw new Error(
58457
+ `Canonical ${lookup ? "NeoLookupVariant" : "NeoVariant"} system class "${declared.id}" is missing its target generic parameter.`
58458
+ );
58459
+ }
57901
58460
  const valueParamId = declared.genericParams?.[1]?.id;
58461
+ if (lookup && valueParamId === void 0) {
58462
+ throw new Error(
58463
+ `Canonical NeoLookupVariant system class "${declared.id}" is missing its value generic parameter.`
58464
+ );
58465
+ }
57902
58466
  return {
57903
58467
  classId: declared.id,
57904
58468
  targetParamId,
@@ -59141,9 +59705,6 @@ function lowerClass(context, declaration) {
59141
59705
  hiddenInMemberSelector: hasAnnotation2(declaration.annotations, "hidden"),
59142
59706
  system: systemMetadata(declaration.annotations),
59143
59707
  allowedStorage: storage ? storageValue(storage, "allowed") : null,
59144
- // Class storage keys never exist in source. Retain only the historical
59145
- // null representation while the clean-break record migration completes.
59146
- allowedStorageKeys: null,
59147
59708
  targetMemberId,
59148
59709
  genericParameters,
59149
59710
  extendsGenericBindings: extendsClassId && declaration.baseTypes[0]?.arguments.length ? lowerExtendsBindings(
@@ -62127,7 +62688,7 @@ function buildStoredValuePlacementIndexV4(records2) {
62127
62688
  } else if (record3.recordKind === "class") {
62128
62689
  classes.push({
62129
62690
  id: record3.recordId,
62130
- ...isStringRecord2(record3.data.schema) ? { schema: record3.data.schema } : {},
62691
+ ...isStringRecord3(record3.data.schema) ? { schema: record3.data.schema } : {},
62131
62692
  ...typeof record3.data.extendsClassId === "string" || record3.data.extendsClassId === null ? { extendsClassId: record3.data.extendsClassId } : {},
62132
62693
  ...typeof record3.data.requiredConstructorId === "string" ? { requiredConstructorId: record3.data.requiredConstructorId } : {},
62133
62694
  ...Array.isArray(record3.data.genericParams) ? {
@@ -62287,7 +62848,7 @@ function memberStoresAggregate(member, parent, membersById2, parentValueId, clas
62287
62848
  }
62288
62849
  return false;
62289
62850
  }
62290
- function isStringRecord2(value) {
62851
+ function isStringRecord3(value) {
62291
62852
  return isObjectRecord2(value) && Object.values(value).every((entry) => typeof entry === "string");
62292
62853
  }
62293
62854
  var init_stored_value_placements = __esm({
@@ -63351,7 +63912,6 @@ function memberRuntimeType(record3, context, seen = /* @__PURE__ */ new Set(), g
63351
63912
  context.vm.classes,
63352
63913
  member.valueTypeInfo != null
63353
63914
  );
63354
- if (systemClass === null) return UNKNOWN_TYPE2;
63355
63915
  const target = toLanguageType(
63356
63916
  member.targetTypeInfo,
63357
63917
  context,
@@ -65473,7 +66033,7 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
65473
66033
  ) : Array.isArray(row.value) ? row.value.map(
65474
66034
  (childId) => typeof childId === "string" ? normalizeTypedRow(childId, typeInfo.entryTypeInfo) : normalizeLiteral(childId)
65475
66035
  ) : normalizeLiteral(row.value);
65476
- } else if (typeInfo.type === 5 /* Dictionary */ && isStringRecord3(row.value)) {
66036
+ } else if (typeInfo.type === 5 /* Dictionary */ && isStringRecord4(row.value)) {
65477
66037
  value = Object.fromEntries(
65478
66038
  Object.entries(row.value).map(([key, childId]) => [
65479
66039
  key,
@@ -65515,7 +66075,7 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
65515
66075
  return normalized;
65516
66076
  };
65517
66077
  const normalizeClassValue = (row, typeInfo) => {
65518
- if (!isStringRecord3(row.value)) return normalizeLiteral(row.value);
66078
+ if (!isStringRecord4(row.value)) return normalizeLiteral(row.value);
65519
66079
  const effectiveClassId = row.classId ?? (typeInfo.type === 7 /* Class */ ? typeInfo.classId : void 0);
65520
66080
  if (effectiveClassId === void 0) return normalizeLiteral(row.value);
65521
66081
  const env = rowGenericEnvironment(document, row);
@@ -65603,7 +66163,7 @@ function collectSoftOwnedConstructorArgumentValueIds(index, ownerValueId, preser
65603
66163
  collectTypedRow(childId, typeInfo.entryTypeInfo);
65604
66164
  }
65605
66165
  }
65606
- } else if (typeInfo.type === 5 /* Dictionary */ && isStringRecord3(row.value)) {
66166
+ } else if (typeInfo.type === 5 /* Dictionary */ && isStringRecord4(row.value)) {
65607
66167
  for (const childId of Object.values(row.value)) {
65608
66168
  collectTypedRow(childId, typeInfo.entryTypeInfo);
65609
66169
  }
@@ -65625,7 +66185,7 @@ function collectSoftOwnedConstructorArgumentValueIds(index, ownerValueId, preser
65625
66185
  collectNestedConstructorArguments(valueId);
65626
66186
  };
65627
66187
  const collectClassChildren = (row, typeInfo) => {
65628
- if (!isStringRecord3(row.value)) return;
66188
+ if (!isStringRecord4(row.value)) return;
65629
66189
  const effectiveClassId = row.classId ?? (typeInfo.type === 7 /* Class */ ? typeInfo.classId : void 0);
65630
66190
  if (effectiveClassId === void 0) return;
65631
66191
  const env = rowGenericEnvironment(index.document, row);
@@ -65694,7 +66254,7 @@ function tryMemberTypeInfo(document, rawMember, env) {
65694
66254
  function isAggregateTypeInfo(typeInfo) {
65695
66255
  return typeInfo.type === 7 /* Class */ || typeInfo.type === 22 /* Interface */ || typeInfo.type === 6 /* List */ || typeInfo.type === 5 /* Dictionary */;
65696
66256
  }
65697
- function isStringRecord3(value) {
66257
+ function isStringRecord4(value) {
65698
66258
  if (value === null || typeof value !== "object" || Array.isArray(value)) {
65699
66259
  return false;
65700
66260
  }
@@ -72571,7 +73131,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
72571
73131
  return cacheDescriptor({ schemaClass: schemaClass2, fields, instanceEnv, classArguments: classArguments2 });
72572
73132
  }
72573
73133
  function assertConstructorFieldSlotWritable(args) {
72574
- const surfaceEntry = mergeInstanceSchema(
73134
+ const surfaceEntry = mergeInstanceSurfaceSchema(
72575
73135
  args.settledClassId,
72576
73136
  args.ctx.vm.classes,
72577
73137
  args.ctx.vm.members
@@ -73465,7 +74025,7 @@ function evaluateBaseInitializerFields(args) {
73465
74025
  );
73466
74026
  }
73467
74027
  const baseKeys = new Set(
73468
- mergeInstanceSchema(baseClassId, ctx.vm.classes, ctx.vm.members).map(
74028
+ mergeInstanceSurfaceSchema(baseClassId, ctx.vm.classes, ctx.vm.members).map(
73469
74029
  (entry) => entry.schemaKey
73470
74030
  )
73471
74031
  );
@@ -73551,6 +74111,16 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
73551
74111
  return null;
73552
74112
  };
73553
74113
  return (member, init, sourceValueId) => {
74114
+ const memberId = Reflect.get(member, "id");
74115
+ const effectiveMemberId = typeof memberId === "string" ? memberId : null;
74116
+ const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? effectiveMemberId;
74117
+ const compiled = ensureInitializerCompiled({
74118
+ init,
74119
+ member,
74120
+ initializerCompiler: ctx.vm.initializerCompiler,
74121
+ sourceValueId: sourceValueId ?? null,
74122
+ compileMemberId: scopeMemberId
74123
+ });
73554
74124
  const evaluate = (argumentValues = []) => {
73555
74125
  return withConstructionGenericSlots(
73556
74126
  member,
@@ -73562,19 +74132,15 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
73562
74132
  ctx,
73563
74133
  createdValues,
73564
74134
  argumentValues,
73565
- sourceValueId ?? null
74135
+ sourceValueId ?? null,
74136
+ scopeMemberId
73566
74137
  )
73567
74138
  );
73568
74139
  };
73569
- if (init.compiled === void 0) {
73570
- return evaluate();
73571
- }
73572
- const memberId = Reflect.get(member, "id");
73573
- const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? (typeof memberId === "string" ? memberId : "");
73574
- const ownerClassId = owningClassId(scopeMemberId);
73575
- const expectedArgumentCount = init.compiled?.parameters.slice(2).length;
74140
+ const ownerClassId = scopeMemberId === null ? null : owningClassId(scopeMemberId);
74141
+ const expectedArgumentCount = compiled.parameters.slice(2).length;
73576
74142
  if (ownerClassId === null) {
73577
- if (expectedArgumentCount !== void 0 && expectedArgumentCount > 0) {
74143
+ if (expectedArgumentCount > 0) {
73578
74144
  throw new NSGetterRuntimeError(
73579
74145
  `Member initializer '${member.name}' has ${expectedArgumentCount} constructor parameter(s), but its declaring class scope could not be resolved.`
73580
74146
  );
@@ -73715,18 +74281,15 @@ function runtimeValueReferencesVariable(value, variableId, visited = /* @__PURE_
73715
74281
  (child) => runtimeValueReferencesVariable(child, variableId, visited)
73716
74282
  );
73717
74283
  }
73718
- function evaluateInitializerInContext(init, member, ctx, createdValues, argumentValues = [], sourceValueId = null) {
74284
+ function evaluateInitializerInContext(init, member, ctx, createdValues, argumentValues = [], sourceValueId = null, compileMemberId) {
73719
74285
  ctx.__constructedArgumentsByValue ??= /* @__PURE__ */ new WeakMap();
73720
- const compiled = init.compiled;
73721
- if (compiled === void 0) {
73722
- const memberId = Reflect.get(member, "id");
73723
- throw new UncompiledInitializerRuntimeError(
73724
- typeof memberId === "string" ? memberId : null,
73725
- member.name,
73726
- init,
73727
- sourceValueId
73728
- );
73729
- }
74286
+ const compiled = ensureInitializerCompiled({
74287
+ init,
74288
+ member,
74289
+ initializerCompiler: ctx.vm.initializerCompiler,
74290
+ sourceValueId,
74291
+ compileMemberId
74292
+ });
73730
74293
  const closeFrame = pushConstructionFrame(ctx, `${member.name} initializer`);
73731
74294
  let result;
73732
74295
  try {
@@ -73783,6 +74346,31 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
73783
74346
  }
73784
74347
  };
73785
74348
  }
74349
+ function ensureInitializerCompiled(args) {
74350
+ let compiled = args.init.compiled;
74351
+ if (compiled === void 0) {
74352
+ const runtimeMemberId = Reflect.get(args.member, "id");
74353
+ let memberId = args.compileMemberId;
74354
+ if (memberId === void 0) {
74355
+ memberId = typeof runtimeMemberId === "string" ? runtimeMemberId : null;
74356
+ }
74357
+ const error = new UncompiledInitializerRuntimeError(
74358
+ memberId,
74359
+ args.member.name,
74360
+ args.init,
74361
+ args.sourceValueId ?? null
74362
+ );
74363
+ args.initializerCompiler?.({
74364
+ init: args.init,
74365
+ memberId,
74366
+ memberName: args.member.name,
74367
+ sourceValueId: args.sourceValueId ?? null
74368
+ });
74369
+ compiled = args.init.compiled;
74370
+ if (compiled === void 0) throw error;
74371
+ }
74372
+ return compiled;
74373
+ }
73786
74374
  function encodeLookupInitializerResult(member, value, created, ctx) {
73787
74375
  const selection2 = encodeLookupInitializerSelection(
73788
74376
  member,
@@ -76042,7 +76630,7 @@ function buildStoredValuePlacementIndex(args) {
76042
76630
  if (isMemberClassBase(member)) {
76043
76631
  const classId = value.classId ?? member.classId;
76044
76632
  appendPlacement(mutablePlacementsByClassId, classId, placement);
76045
- if (!isLiteralValueContent(value) || !isStringRecord4(value.value)) {
76633
+ if (!isLiteralValueContent(value) || !isStringRecord5(value.value)) {
76046
76634
  continue;
76047
76635
  }
76048
76636
  const settledChildrenBySchemaKey = /* @__PURE__ */ new Map();
@@ -76085,7 +76673,7 @@ function buildStoredValuePlacementIndex(args) {
76085
76673
  const entryMember = membersById2.get(member.entryMemberId);
76086
76674
  if (entryMember === void 0) continue;
76087
76675
  if (isMemberDictionaryBase(member)) {
76088
- if (!isStringRecord4(value.value)) continue;
76676
+ if (!isStringRecord5(value.value)) continue;
76089
76677
  for (const [key, childValueId] of Object.entries(value.value)) {
76090
76678
  queue.push({
76091
76679
  memberId: entryMember.id,
@@ -76133,7 +76721,7 @@ function appendPlacement(index, key, placement) {
76133
76721
  placements.push(placement);
76134
76722
  }
76135
76723
  }
76136
- function isStringRecord4(value) {
76724
+ function isStringRecord5(value) {
76137
76725
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
76138
76726
  return false;
76139
76727
  }
@@ -77749,7 +78337,7 @@ function planAtomicCollectionOverrideWrite(args) {
77749
78337
  creates.push(
77750
78338
  createFromVirtual(
77751
78339
  location3,
77752
- location3.pathKey === args.target.pathKey ? args.value : cloneJsonValue2(effective.value)
78340
+ location3.pathKey === args.target.pathKey ? args.value : deepClonePlainData(effective.value)
77753
78341
  )
77754
78342
  );
77755
78343
  }
@@ -78027,14 +78615,7 @@ function stringRecord2(value) {
78027
78615
  );
78028
78616
  }
78029
78617
  function cloneRow(row) {
78030
- return cloneJsonValue2(row);
78031
- }
78032
- function cloneJsonValue2(value) {
78033
- if (Array.isArray(value)) return value.map(cloneJsonValue2);
78034
- if (value === null || typeof value !== "object") return value;
78035
- return Object.fromEntries(
78036
- Object.entries(value).map(([key, entry]) => [key, cloneJsonValue2(entry)])
78037
- );
78618
+ return deepClonePlainData(row);
78038
78619
  }
78039
78620
  function semanticEqual(left, right) {
78040
78621
  return canonicalJson(left) === canonicalJson(right);
@@ -78054,7 +78635,7 @@ function storedArgumentPointer(value, typeInfo) {
78054
78635
  }
78055
78636
  return {
78056
78637
  type: "value" /* value */,
78057
- value: { typeInfo, value: cloneJsonValue2(value) }
78638
+ value: { typeInfo, value: deepClonePlainData(value) }
78058
78639
  };
78059
78640
  }
78060
78641
  function evaluatorEnvelopeParameters() {
@@ -78425,15 +79006,17 @@ function buildInitializerRootValueWithLookups(document, lookups) {
78425
79006
  return rootValue;
78426
79007
  }
78427
79008
  function evaluateMemberInitializer(args) {
78428
- const compiled = args.init.compiled;
78429
- if (compiled === void 0) {
78430
- throw new UncompiledInitializerRuntimeError(
78431
- typeof Reflect.get(args.member, "id") === "string" ? Reflect.get(args.member, "id") : null,
78432
- args.member.name,
78433
- args.init
78434
- );
78435
- }
78436
79009
  const databaseVM = initializerEvaluatorLookups(args.document);
79010
+ const compileMemberId = databaseVM.constructorInitializerIndexes?.initializerScopeMemberIds.get(
79011
+ args.init
79012
+ );
79013
+ const compiled = ensureInitializerCompiled({
79014
+ init: args.init,
79015
+ member: args.member,
79016
+ initializerCompiler: args.document.initializerCompiler,
79017
+ sourceValueId: args.sourceValueId ?? null,
79018
+ compileMemberId
79019
+ });
78437
79020
  const ctx = {
78438
79021
  vm: {
78439
79022
  project: args.document.project,
@@ -78454,7 +79037,8 @@ function evaluateMemberInitializer(args) {
78454
79037
  // initializer evaluator ran (collapse expansion included).
78455
79038
  variants: args.document.variants,
78456
79039
  variantFolders: args.document.variantFolders,
78457
- databaseVM
79040
+ databaseVM,
79041
+ initializerCompiler: args.document.initializerCompiler
78458
79042
  },
78459
79043
  thisValue: null,
78460
79044
  rootValue: buildInitializerRootValueWithLookups(args.document, databaseVM),
@@ -78528,7 +79112,6 @@ var init_evaluateInitializer = __esm({
78528
79112
  init_instance_provenance();
78529
79113
  init_members();
78530
79114
  init_project2();
78531
- init_NSGetterRuntimeError();
78532
79115
  init_evaluateNSGetter();
78533
79116
  init_virtual_instance_values();
78534
79117
  evaluatorLookupsByDocument = /* @__PURE__ */ new WeakMap();
@@ -78577,7 +79160,8 @@ function evaluateInitializerMaterialization(args) {
78577
79160
  storageKeyDeclarations,
78578
79161
  ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
78579
79162
  ...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
78580
- ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues }
79163
+ ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
79164
+ sourceValueId: args.sourceValueId ?? null
78581
79165
  });
78582
79166
  return { evaluated, createdValues, storageKeyDeclarations };
78583
79167
  }
@@ -78612,7 +79196,8 @@ function materializeInitializerValue(args) {
78612
79196
  document: args.document,
78613
79197
  ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
78614
79198
  ...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
78615
- ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues }
79199
+ ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
79200
+ sourceValueId: args.row.id
78616
79201
  });
78617
79202
  const {
78618
79203
  init: _init,
@@ -78704,7 +79289,8 @@ function materializeMemberDefaultValue(args) {
78704
79289
  member,
78705
79290
  init,
78706
79291
  sourceValueId ?? null
78707
- )
79292
+ ),
79293
+ sourceValueId: sourceValueId ?? null
78708
79294
  })
78709
79295
  });
78710
79296
  const interior = createdValues.filter((created) => created.id !== built.id);
@@ -78740,236 +79326,6 @@ var init_init_backed_value_materialization = __esm({
78740
79326
  }
78741
79327
  });
78742
79328
 
78743
- // ../src/models/localization/localization-types.ts
78744
- function isProjectLocaleConfig(value) {
78745
- if (!isObject(value)) return false;
78746
- const v = value;
78747
- if (!isLocaleCode(v.locale)) return false;
78748
- if (!isOptionalNullableString(v.sourceLocale)) return false;
78749
- if (v.sourceLocale !== void 0 && v.sourceLocale !== null) {
78750
- if (!isLocaleCode(v.sourceLocale)) return false;
78751
- }
78752
- if (!isOptionalNullableString(v.name)) return false;
78753
- if (!isFiniteNumber(v.sortOrder)) return false;
78754
- return isOptionalNullableDate(v.archivedAt);
78755
- }
78756
- function isProjectLocalizationConfigProps(value) {
78757
- if (!isWithId(value)) return false;
78758
- if (!isIWithTimestamps(value)) return false;
78759
- const v = value;
78760
- if (v.id !== PROJECT_LOCALIZATION_CONFIG_ID) return false;
78761
- if (!isString(v.projectId)) return false;
78762
- if (!isLocaleCode(v.mainLocale)) return false;
78763
- if (!Array.isArray(v.supportedLocales)) return false;
78764
- if (!v.supportedLocales.every(isProjectLocaleConfig)) return false;
78765
- if (!isStringArray2(v.sortedStatusIds)) return false;
78766
- return isString(v.mainLocaleDefaultStatusId);
78767
- }
78768
- function isProjectLocalizationConfig(value) {
78769
- return isProjectLocalizationConfigProps(value);
78770
- }
78771
- function isLocalizationStatusProps(value) {
78772
- if (!isWithId(value)) return false;
78773
- if (!isIWithTimestamps(value)) return false;
78774
- const v = value;
78775
- if (!isString(v.projectId)) return false;
78776
- if (!isSlug(v.slug)) return false;
78777
- if (!isString(v.name)) return false;
78778
- if (!isOptionalNullableString(v.description)) return false;
78779
- if (!isOptionalNullableString(v.color)) return false;
78780
- if (!isOptionalNullableString(v.emoji)) return false;
78781
- if (!isOptionalNullableDate(v.archivedAt)) return false;
78782
- if (!isNullableStringArray(v.transitionRules)) return false;
78783
- if (!isNullableString(v.transitionToStatusIdOnEditText)) return false;
78784
- if (!isNullableString(v.transitionToWhenSourceBecomesStatusId)) return false;
78785
- if (v.system !== void 0 && v.system !== null) {
78786
- return isSystemMetadata(v.system);
78787
- }
78788
- return true;
78789
- }
78790
- function isLocalizationStatus(value) {
78791
- return isLocalizationStatusProps(value);
78792
- }
78793
- function isLocalizedTextLocaleValue(value) {
78794
- if (!isObject(value)) return false;
78795
- const v = value;
78796
- if (!isNullableString(v.value)) return false;
78797
- if (!isString(v.statusId)) return false;
78798
- if (!isOptionalNullableString(v.localeComment)) return false;
78799
- return isEpochMillis(v.updatedAt);
78800
- }
78801
- function isLocalizedTextLinkKind(value) {
78802
- if (!isString(value)) return false;
78803
- return LOCALIZED_TEXT_LINK_KINDS.includes(value);
78804
- }
78805
- function isLocalizedTextLink(value) {
78806
- if (!isObject(value)) return false;
78807
- const v = value;
78808
- if (!isLocalizedTextLinkKind(v.kind)) return false;
78809
- if (!isOptionalNullableString(v.recordKind)) return false;
78810
- if (!isOptionalNullableString(v.recordId)) return false;
78811
- if (!isOptionalNullableString(v.fieldPath)) return false;
78812
- if (!isOptionalNullableString(v.valueId)) return false;
78813
- if (!isOptionalNullableString(v.nodeId)) return false;
78814
- return isOptionalNullableString(v.choiceId);
78815
- }
78816
- function isLocalizedTextProps(value) {
78817
- if (!isWithId(value)) return false;
78818
- if (!isIWithTimestamps(value)) return false;
78819
- const v = value;
78820
- if (!isString(v.projectId)) return false;
78821
- if (!isOptionalNullableString(v.sourceComment)) return false;
78822
- if (!Array.isArray(v.links)) return false;
78823
- if (!v.links.every(isLocalizedTextLink)) return false;
78824
- if (!isOptionalNullableDate(v.archivedAt)) return false;
78825
- return isLocaleValueRecord(v.localeValues);
78826
- }
78827
- function isLocalizedText(value) {
78828
- return isLocalizedTextProps(value);
78829
- }
78830
- function isLocaleCode(value) {
78831
- if (!isString(value)) return false;
78832
- if (value.trim() !== value) return false;
78833
- if (value.length === 0) return false;
78834
- return /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(value);
78835
- }
78836
- function isLocaleValueRecord(value) {
78837
- if (!isObject(value)) return false;
78838
- for (const [locale, localeValue] of Object.entries(value)) {
78839
- if (!isLocaleCode(locale)) return false;
78840
- if (!isLocalizedTextLocaleValue(localeValue)) return false;
78841
- }
78842
- return true;
78843
- }
78844
- function isOptionalNullableDate(value) {
78845
- if (value === void 0) return true;
78846
- if (value === null) return true;
78847
- return isEpochMillis(value);
78848
- }
78849
- function isFiniteNumber(value) {
78850
- if (typeof value !== "number") return false;
78851
- return Number.isFinite(value);
78852
- }
78853
- function isSlug(value) {
78854
- if (!isString(value)) return false;
78855
- return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
78856
- }
78857
- function isNullableString(value) {
78858
- if (value === null) return true;
78859
- return isString(value);
78860
- }
78861
- function isStringArray2(value) {
78862
- if (!Array.isArray(value)) return false;
78863
- return value.every(isString);
78864
- }
78865
- function isNullableStringArray(value) {
78866
- if (value === null) return true;
78867
- return isStringArray2(value);
78868
- }
78869
- var PROJECT_LOCALIZATION_CONFIG_ID, LOCALIZED_TEXT_LINK_KINDS;
78870
- var init_localization_types = __esm({
78871
- "../src/models/localization/localization-types.ts"() {
78872
- "use strict";
78873
- init_core();
78874
- PROJECT_LOCALIZATION_CONFIG_ID = "system_b9f80fd7-7ed2-4344-a2b6-625ced732ed0";
78875
- LOCALIZED_TEXT_LINK_KINDS = [
78876
- "member-value",
78877
- "member-default-value",
78878
- "dialogue-description",
78879
- "dialogue-node-text",
78880
- "dialogue-choice-text",
78881
- "dialogue-group-name",
78882
- "priority-group-name"
78883
- ];
78884
- }
78885
- });
78886
-
78887
- // ../src/models/localization/localization-export.ts
78888
- var init_localization_export = __esm({
78889
- "../src/models/localization/localization-export.ts"() {
78890
- "use strict";
78891
- init_localization_types();
78892
- }
78893
- });
78894
-
78895
- // ../src/models/localization/localization-import.ts
78896
- var init_localization_import = __esm({
78897
- "../src/models/localization/localization-import.ts"() {
78898
- "use strict";
78899
- }
78900
- });
78901
-
78902
- // ../src/models/localization/localized-text-create-envelope.ts
78903
- function completeLocalizedTextCreateEnvelope(data, config) {
78904
- const text = asUnknownRecord(data);
78905
- if (text === null) return data;
78906
- const localeValues = asUnknownRecord(text.localeValues);
78907
- const mainLocaleValue = localeValues === null ? null : asUnknownRecord(localeValues[config.mainLocale]);
78908
- const completedMainLocaleValue = mainLocaleValue === null ? null : {
78909
- ...mainLocaleValue,
78910
- ...mainLocaleValue.statusId === void 0 ? { statusId: config.mainLocaleDefaultStatusId } : {},
78911
- ...mainLocaleValue.updatedAt === void 0 && text.updatedAt !== void 0 ? { updatedAt: text.updatedAt } : {}
78912
- };
78913
- return {
78914
- ...text,
78915
- ...text.links === void 0 ? { links: [] } : {},
78916
- ...localeValues === null || completedMainLocaleValue === null ? {} : {
78917
- localeValues: {
78918
- ...localeValues,
78919
- [config.mainLocale]: completedMainLocaleValue
78920
- }
78921
- }
78922
- };
78923
- }
78924
- function buildLocalizedTextCreateForLink(args) {
78925
- const completed = completeLocalizedTextCreateEnvelope(
78926
- {
78927
- id: args.id,
78928
- projectId: args.projectId,
78929
- sourceComment: null,
78930
- links: [args.link],
78931
- localeValues: {
78932
- [args.config.mainLocale]: {
78933
- value: args.value,
78934
- localeComment: null
78935
- }
78936
- },
78937
- createdAt: args.now,
78938
- updatedAt: args.now
78939
- },
78940
- args.config
78941
- );
78942
- if (!isLocalizedText(completed)) {
78943
- throw new Error(
78944
- `Localized text "${args.id}" could not be completed into a valid create envelope.`
78945
- );
78946
- }
78947
- return completed;
78948
- }
78949
- function asUnknownRecord(value) {
78950
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
78951
- return null;
78952
- }
78953
- return value;
78954
- }
78955
- var init_localized_text_create_envelope = __esm({
78956
- "../src/models/localization/localized-text-create-envelope.ts"() {
78957
- "use strict";
78958
- init_localization_types();
78959
- }
78960
- });
78961
-
78962
- // ../src/models/localization/index.ts
78963
- var init_localization2 = __esm({
78964
- "../src/models/localization/index.ts"() {
78965
- "use strict";
78966
- init_localization_types();
78967
- init_localization_export();
78968
- init_localization_import();
78969
- init_localized_text_create_envelope();
78970
- }
78971
- });
78972
-
78973
79329
  // ../convex/projectDocumentDialogueMaterialization.ts
78974
79330
  function materializeDialogues(dialogueRecords, dialogueNodes) {
78975
79331
  return dialogueRecords.map((dialogue) => {
@@ -81859,6 +82215,7 @@ function lowerTextNode(context, member, id2, base, common, destination) {
81859
82215
  bindingTypes,
81860
82216
  nullableString3(common.primaryLinkedValueId) ?? context.dialoguePrimaryValueId,
81861
82217
  `node:${id2}`,
82218
+ dialogueNodeLocalizedTextLink(id2),
81862
82219
  member
81863
82220
  );
81864
82221
  const children = member.content?.children.filter((child) => child.graphType === "Option") ?? [];
@@ -81884,6 +82241,7 @@ function lowerTextNode(context, member, id2, base, common, destination) {
81884
82241
  bindingTypes,
81885
82242
  nullableString3(common.primaryLinkedValueId) ?? context.dialoguePrimaryValueId,
81886
82243
  `option:${optionId}`,
82244
+ dialogueChoiceLocalizedTextLink(id2, optionId),
81887
82245
  child
81888
82246
  );
81889
82247
  if (optionText.textRecord) textRecords.push(optionText.textRecord);
@@ -82182,7 +82540,7 @@ function lowerActionLogic(context, prior, fn, fallbackCode, inline, useId, uiRes
82182
82540
  action: isObjectRecord2(prior?.action) ? prior.action : placeholderVoidAction()
82183
82541
  };
82184
82542
  }
82185
- function lowerProse(context, rawProse, baseTextId, baseVariables, baseLinks, bindingTypes, primaryValueId2, owner, source) {
82543
+ function lowerProse(context, rawProse, baseTextId, baseVariables, baseLinks, bindingTypes, primaryValueId2, owner, textLink, source) {
82186
82544
  const textId = baseTextId ?? pendingId("localized-text", source.source.uri, owner, 0, "text");
82187
82545
  const legacyInline = isLegacyInlineText2(context.state, baseTextId);
82188
82546
  const baseText = legacyInline ? {} : baseData2(context.state, "localized-text", textId);
@@ -82315,6 +82673,10 @@ function lowerProse(context, rawProse, baseTextId, baseVariables, baseLinks, bin
82315
82673
  {
82316
82674
  ...baseText,
82317
82675
  id: textId,
82676
+ links: upsertLocalizedTextLink(
82677
+ Array.isArray(baseText.links) ? baseText.links.filter(isLocalizedTextLink) : [],
82678
+ textLink
82679
+ ),
82318
82680
  localeValues: {
82319
82681
  ...localeValues,
82320
82682
  [context.mainLocale]: { ...main2, value }
@@ -83401,6 +83763,7 @@ var init_dialogue_lower = __esm({
83401
83763
  "src/project-source/dialogue-lower.ts"() {
83402
83764
  "use strict";
83403
83765
  init_src();
83766
+ init_localization2();
83404
83767
  init_members();
83405
83768
  init_neoscript();
83406
83769
  init_projection();
@@ -84088,7 +84451,7 @@ function assertAnimationClipDocumentValid(document) {
84088
84451
  function isRecord5(value) {
84089
84452
  return typeof value === "object" && value !== null && !Array.isArray(value);
84090
84453
  }
84091
- var WORLD_RETIRED_TILE_LAYER_LINK_LAYER_MEMBER_ID, WORLD_RETIRED_OBJECT_LAYER_LINK_LAYER_MEMBER_ID, WORLD_ANIMATION_STRUCTURAL_MEMBER_ROOT_IDS, AnimationValidationContext;
84454
+ var WORLD_ANIMATION_STRUCTURAL_MEMBER_ROOT_IDS, AnimationValidationContext;
84092
84455
  var init_animation_clips = __esm({
84093
84456
  "../src/models/animation/animation-clips.ts"() {
84094
84457
  "use strict";
@@ -84103,8 +84466,6 @@ var init_animation_clips = __esm({
84103
84466
  init_neoscript_types();
84104
84467
  init_neoscript_guards();
84105
84468
  init_project_root_members();
84106
- WORLD_RETIRED_TILE_LAYER_LINK_LAYER_MEMBER_ID = "325dba0e-5967-4e18-937e-5c6800b68abc";
84107
- WORLD_RETIRED_OBJECT_LAYER_LINK_LAYER_MEMBER_ID = "9cc0ab67-e138-4d11-8011-fab7d7a75b13";
84108
84469
  WORLD_ANIMATION_STRUCTURAL_MEMBER_ROOT_IDS = /* @__PURE__ */ new Set([
84109
84470
  WORLD_GRID_CHILDREN_MEMBER_ID,
84110
84471
  WORLD_GRID_CHILDREN_ENTRY_MEMBER_ID,
@@ -84113,11 +84474,9 @@ var init_animation_clips = __esm({
84113
84474
  WORLD_OBJECT_PLACEMENT_TILES_MEMBER_ID,
84114
84475
  WORLD_OBJECT_PLACEMENT_TILES_ENTRY_MEMBER_ID,
84115
84476
  WORLD_OBJECT_PLACEMENT_TILE_CELL_MEMBER_ID,
84116
- WORLD_RETIRED_OBJECT_LAYER_LINK_LAYER_MEMBER_ID,
84117
84477
  WORLD_OBJECT_LAYER_LINK_OBJECTS_MEMBER_ID,
84118
84478
  WORLD_OBJECT_LAYER_LINK_OBJECT_ENTRY_MEMBER_ID,
84119
84479
  WORLD_TILE_INSTANCE_CELL_MEMBER_ID,
84120
- WORLD_RETIRED_TILE_LAYER_LINK_LAYER_MEMBER_ID,
84121
84480
  WORLD_TILE_LAYER_LINK_TILES_MEMBER_ID,
84122
84481
  WORLD_TILE_LAYER_LINK_TILE_ENTRY_MEMBER_ID
84123
84482
  ]);
@@ -85346,7 +85705,10 @@ function headlessVirtualInstanceLookups(document, options = {}) {
85346
85705
  } : {}
85347
85706
  );
85348
85707
  const virtual = createHeadlessVirtualInstanceResolver({
85349
- document,
85708
+ document: {
85709
+ ...document,
85710
+ ...options.initializerCompiler === void 0 ? {} : { initializerCompiler: options.initializerCompiler }
85711
+ },
85350
85712
  // A thunk: the resolver resolves nested reads through the lookups being
85351
85713
  // built around it.
85352
85714
  resolverLookups: () => lookups
@@ -85382,7 +85744,18 @@ var init_headless_virtual_instance_lookups = __esm({
85382
85744
 
85383
85745
  // src/evaluator-lookups.ts
85384
85746
  function cliEvaluatorLookups(document, options = {}) {
85385
- return headlessVirtualInstanceLookups(document, options);
85747
+ return cliEvaluatorRuntime(document, options).databaseVM;
85748
+ }
85749
+ function cliEvaluatorRuntime(document, options = {}) {
85750
+ const initializerCompiler = isPulledInitializerCompilationDocumentV4(document) ? pulledInitializerCompilerV4(document) : void 0;
85751
+ const databaseVM = headlessVirtualInstanceLookups(document, {
85752
+ ...options,
85753
+ ...initializerCompiler === void 0 ? {} : { initializerCompiler }
85754
+ });
85755
+ return {
85756
+ databaseVM,
85757
+ ...initializerCompiler === void 0 ? {} : { initializerCompiler }
85758
+ };
85386
85759
  }
85387
85760
  function cliEvaluatorReceiverValue(lookups, valueId) {
85388
85761
  if (typeof valueId !== "string") return null;
@@ -85392,6 +85765,7 @@ var init_evaluator_lookups = __esm({
85392
85765
  "src/evaluator-lookups.ts"() {
85393
85766
  "use strict";
85394
85767
  init_headless_virtual_instance_lookups();
85768
+ init_initializer_replay();
85395
85769
  }
85396
85770
  });
85397
85771
 
@@ -87606,7 +87980,6 @@ function worldPlacementVariantBindings(args) {
87606
87980
  const valuesById = new Map(args.values.map((value) => [value.id, value]));
87607
87981
  let cachedLookups = null;
87608
87982
  const expansionLookups = () => {
87609
- if (args.expansionDocument === void 0) return null;
87610
87983
  return cachedLookups ??= initializerEvaluatorLookups(
87611
87984
  args.expansionDocument
87612
87985
  );
@@ -87638,10 +88011,6 @@ function worldPlacementVariantBindings(args) {
87638
88011
  }
87639
88012
  function lookupCollectionEntryIds(args) {
87640
88013
  const storedRow = args.valuesById.get(args.collectionValueId);
87641
- if (args.lookups === null) {
87642
- if (storedRow === void 0) return [];
87643
- return listEntryIdsForValue(args.collection, storedRow, args.values);
87644
- }
87645
88014
  const graphRows = args.lookups.virtualInstanceRowsForValue(
87646
88015
  args.collectionValueId
87647
88016
  );
@@ -87661,7 +88030,7 @@ function lookupCollectionEntryIds(args) {
87661
88030
  return listEntryIdsForValue(args.collection, collectionRow, effectiveRows);
87662
88031
  }
87663
88032
  function validateWorldContentSidecars(args) {
87664
- const variants = args.variants ?? [];
88033
+ const variants = args.variants;
87665
88034
  const valuesById = new Map(args.values.map((value) => [value.id, value]));
87666
88035
  const classesById2 = new Map(
87667
88036
  args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
@@ -92088,14 +92457,14 @@ function findParentValues(valueId, values) {
92088
92457
  }
92089
92458
  continue;
92090
92459
  }
92091
- if (!isStringRecord5(value.value)) continue;
92460
+ if (!isStringRecord6(value.value)) continue;
92092
92461
  for (const [key, childValueId] of Object.entries(value.value)) {
92093
92462
  if (childValueId === valueId) parents.push({ value, key });
92094
92463
  }
92095
92464
  }
92096
92465
  return parents;
92097
92466
  }
92098
- function isStringRecord5(value) {
92467
+ function isStringRecord6(value) {
92099
92468
  if (typeof value !== "object") return false;
92100
92469
  if (value === null) return false;
92101
92470
  if (Array.isArray(value)) return false;
@@ -92769,7 +93138,6 @@ var init_general_function_call_ir_source_recompile = __esm({
92769
93138
  init_dialogue_logic_compile_pure();
92770
93139
  init_project_migration_runner();
92771
93140
  init_compiler_adapter();
92772
- init_projectDocumentDialogueMaterialization();
92773
93141
  init_neoscript();
92774
93142
  init_dialogue_node_index();
92775
93143
  VOID_ACTION_TYPE_INFO = {
@@ -93113,7 +93481,7 @@ function assertNumberRange(member, value, path) {
93113
93481
  throw new Error(`${path} must be at most ${max}.`);
93114
93482
  }
93115
93483
  }
93116
- function isStringRecord6(value) {
93484
+ function isStringRecord7(value) {
93117
93485
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
93118
93486
  return false;
93119
93487
  }
@@ -93508,7 +93876,7 @@ var init_project_version_static_value_writes = __esm({
93508
93876
  if (!isLiteralValueContent(args.value)) {
93509
93877
  throw new Error(`${args.path} must store a literal Class value.`);
93510
93878
  }
93511
- if (!isStringRecord6(args.value.value)) {
93879
+ if (!isStringRecord7(args.value.value)) {
93512
93880
  throw new Error(`${args.path} must store a Class schema-key map.`);
93513
93881
  }
93514
93882
  const effectiveClassId = args.value.classId ?? args.member.classId;
@@ -93665,7 +94033,7 @@ var init_project_version_static_value_writes = __esm({
93665
94033
  }
93666
94034
  }
93667
94035
  validateDictionary(args) {
93668
- if (!isStringRecord6(args.value.value)) {
94036
+ if (!isStringRecord7(args.value.value)) {
93669
94037
  throw new Error(`${args.path} must store a Dictionary key/value-id map.`);
93670
94038
  }
93671
94039
  const entryRecord = this.memberById.get(args.member.entryMemberId);
@@ -93767,7 +94135,7 @@ var init_project_version_static_value_writes = __esm({
93767
94135
  }
93768
94136
  collectOwnedBody(args) {
93769
94137
  const member = resolveMember2(args.member, this.document.members);
93770
- if (isMemberClassBase(member) && isStringRecord6(args.body)) {
94138
+ if (isMemberClassBase(member) && isStringRecord7(args.body)) {
93771
94139
  const effectiveClassId = args.classId ?? member.classId;
93772
94140
  const env = resolveInstanceEnv(
93773
94141
  effectiveClassId,
@@ -93814,7 +94182,7 @@ var init_project_version_static_value_writes = __esm({
93814
94182
  }
93815
94183
  return;
93816
94184
  }
93817
- if (isMemberDictionaryBase(member) && isStringRecord6(args.body)) {
94185
+ if (isMemberDictionaryBase(member) && isStringRecord7(args.body)) {
93818
94186
  const entryRecord = this.memberById.get(member.entryMemberId);
93819
94187
  if (entryRecord === void 0) return;
93820
94188
  const entryMember = substituteMember(
@@ -93963,12 +94331,7 @@ function materializeLocalizableStringWriteChanges(args) {
93963
94331
  projectId: args.postDocument.project.id,
93964
94332
  config,
93965
94333
  now,
93966
- link: {
93967
- kind: "member-default-value",
93968
- recordKind: "member",
93969
- recordId: change.recordId,
93970
- fieldPath: "defaultValue.value"
93971
- },
94334
+ link: memberDefaultLocalizedTextLink(change.recordId),
93972
94335
  source: "server-localizable-member-default"
93973
94336
  })
93974
94337
  );
@@ -94041,13 +94404,7 @@ function materializeLocalizableStringWriteChanges(args) {
94041
94404
  projectId: args.postDocument.project.id,
94042
94405
  config,
94043
94406
  now,
94044
- link: {
94045
- kind: "member-value",
94046
- recordKind: "value",
94047
- recordId: change.recordId,
94048
- fieldPath: "value",
94049
- valueId: change.recordId
94050
- },
94407
+ link: memberValueLocalizedTextLink(change.recordId),
94051
94408
  source: "server-localizable-member-value"
94052
94409
  })
94053
94410
  );
@@ -95299,236 +95656,6 @@ function removeDirectBindingsFromReadOnlySourceTransitions(currentDocument, chan
95299
95656
  delete next.valueId;
95300
95657
  }
95301
95658
  }
95302
- function remapReadOnlyConversionValueIds(values, memberId, ownerValueId) {
95303
- const remapped = /* @__PURE__ */ new Map();
95304
- values.forEach((value, index) => {
95305
- remapped.set(
95306
- value.id,
95307
- v5_default(
95308
- `neo-compose:readonly-conversion:${memberId}:${ownerValueId}:${index}`,
95309
- v5_default.URL
95310
- )
95311
- );
95312
- });
95313
- const rewrite = (value) => {
95314
- if (typeof value === "string") return remapped.get(value) ?? value;
95315
- if (Array.isArray(value)) return value.map(rewrite);
95316
- if (value === null || typeof value !== "object") return value;
95317
- return Object.fromEntries(
95318
- Object.entries(value).map(([key, child]) => [key, rewrite(child)])
95319
- );
95320
- };
95321
- for (const value of values) {
95322
- value.id = remapped.get(value.id) ?? value.id;
95323
- value.value = rewrite(value.value);
95324
- if (typeof value.containerId === "string") {
95325
- value.containerId = remapped.get(value.containerId) ?? value.containerId;
95326
- }
95327
- }
95328
- }
95329
- function collectReadOnlyClassValueSites(document, selectedMemberId) {
95330
- const membersById2 = new Map(
95331
- document.members.map((member) => [member.id, member])
95332
- );
95333
- const valuesById = new Map(document.values.map((value) => [value.id, value]));
95334
- const visited = /* @__PURE__ */ new Set();
95335
- const siteKeys = /* @__PURE__ */ new Set();
95336
- const sites = [];
95337
- const visit = (rawMember, valueId) => {
95338
- const visitKey = `${rawMember.id}\0${valueId}`;
95339
- if (visited.has(visitKey)) return;
95340
- visited.add(visitKey);
95341
- const value = valuesById.get(valueId);
95342
- if (value === void 0) return;
95343
- const member = resolveMember2(rawMember, document.members);
95344
- if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
95345
- const entry = membersById2.get(member.entryMemberId);
95346
- if (entry === void 0) return;
95347
- const childIds = isMemberListBase(member) && listKindOf(member) === "unordered" ? document.values.filter((child) => child.containerId === value.id).map((child) => child.id) : Array.isArray(value.value) ? value.value : isStringValueRecord(value.value) ? Object.values(value.value) : [];
95348
- for (const childId of childIds) visit(entry, childId);
95349
- return;
95350
- }
95351
- if (!isMemberClassBase(member) || !isStringValueRecord(value.value)) {
95352
- return;
95353
- }
95354
- const effectiveClassId = value.classId ?? member.classId;
95355
- const env = resolveInstanceEnv(
95356
- effectiveClassId,
95357
- member.classArguments,
95358
- document.classes
95359
- );
95360
- for (const entry of mergeInstanceSurfaceSchema(
95361
- effectiveClassId,
95362
- document.classes,
95363
- document.members
95364
- )) {
95365
- if (entry.memberId === selectedMemberId) {
95366
- const siteKey = `${value.id}\0${entry.schemaKey}`;
95367
- if (!siteKeys.has(siteKey)) {
95368
- siteKeys.add(siteKey);
95369
- sites.push({
95370
- value,
95371
- record: value.value,
95372
- schemaKey: entry.schemaKey,
95373
- effectiveClassId
95374
- });
95375
- }
95376
- }
95377
- const childId = value.value[entry.schemaKey];
95378
- const childMember = membersById2.get(entry.memberId);
95379
- if (childMember === void 0 || typeof childId !== "string") continue;
95380
- visit(
95381
- substituteMember(childMember, env, document.members),
95382
- childId
95383
- );
95384
- }
95385
- };
95386
- for (const member of document.members) {
95387
- if (typeof member.valueId === "string") visit(member, member.valueId);
95388
- if (member.defaultValue == null) continue;
95389
- const synthetic = {
95390
- id: `__default:${member.id}`,
95391
- projectId: member.projectId,
95392
- createdAt: member.createdAt,
95393
- updatedAt: member.updatedAt,
95394
- ...member.defaultValue
95395
- };
95396
- valuesById.set(synthetic.id, synthetic);
95397
- visit(member, synthetic.id);
95398
- }
95399
- for (const value of document.values) {
95400
- if (typeof value.classId !== "string") continue;
95401
- visit(syntheticClassRowMember(value), value.id);
95402
- }
95403
- return sites.filter((site) => !site.value.id.startsWith("__default:"));
95404
- }
95405
- function collectValuesReachableWithoutReadOnlyBinding(document, excludedMemberId) {
95406
- const membersById2 = new Map(
95407
- document.members.map((member) => [member.id, member])
95408
- );
95409
- const valuesById = new Map(document.values.map((value) => [value.id, value]));
95410
- const reachable = /* @__PURE__ */ new Set();
95411
- const visitBody = (rawMember, body, classId, ownerValueId) => {
95412
- const member = resolveMember2(rawMember, document.members);
95413
- const visitChild = (childMember, childId) => {
95414
- if (childMember === void 0 || typeof childId !== "string") return;
95415
- if (reachable.has(childId)) return;
95416
- const child = valuesById.get(childId);
95417
- if (child === void 0) return;
95418
- reachable.add(childId);
95419
- visitBody(childMember, child.value, child.classId ?? void 0, child.id);
95420
- };
95421
- if (isMemberListBase(member)) {
95422
- const entry = membersById2.get(member.entryMemberId);
95423
- if (listKindOf(member) === "unordered" && ownerValueId !== void 0) {
95424
- for (const child of document.values) {
95425
- if (child.containerId === ownerValueId) visitChild(entry, child.id);
95426
- }
95427
- } else if (Array.isArray(body)) {
95428
- for (const childId of body) visitChild(entry, childId);
95429
- }
95430
- return;
95431
- }
95432
- if (isMemberDictionaryBase(member) && isStringValueRecord(body)) {
95433
- const entry = membersById2.get(member.entryMemberId);
95434
- for (const childId of Object.values(body)) visitChild(entry, childId);
95435
- return;
95436
- }
95437
- if (!isMemberClassBase(member) || !isStringValueRecord(body)) return;
95438
- const effectiveClassId = classId ?? member.classId;
95439
- const env = resolveInstanceEnv(
95440
- effectiveClassId,
95441
- member.classArguments,
95442
- document.classes
95443
- );
95444
- for (const entry of mergeInstanceSurfaceSchema(
95445
- effectiveClassId,
95446
- document.classes,
95447
- document.members
95448
- )) {
95449
- if (entry.memberId === excludedMemberId) continue;
95450
- const childMember = membersById2.get(entry.memberId);
95451
- visitChild(
95452
- childMember === void 0 ? void 0 : substituteMember(
95453
- childMember,
95454
- env,
95455
- document.members
95456
- ),
95457
- body[entry.schemaKey]
95458
- );
95459
- }
95460
- };
95461
- for (const member of document.members) {
95462
- if (member.id !== excludedMemberId && typeof member.valueId === "string") {
95463
- const value = valuesById.get(member.valueId);
95464
- if (value !== void 0) {
95465
- reachable.add(value.id);
95466
- visitBody(member, value.value, value.classId ?? void 0, value.id);
95467
- }
95468
- }
95469
- if (member.defaultValue != null) {
95470
- visitBody(
95471
- member,
95472
- member.defaultValue.value,
95473
- member.defaultValue.classId ?? void 0,
95474
- void 0
95475
- );
95476
- }
95477
- }
95478
- const referencedValueIds = collectStructurallyReferencedValueIds(document);
95479
- const boundRootIds = new Set(
95480
- document.members.flatMap(
95481
- (member) => typeof member.valueId === "string" ? [member.valueId] : []
95482
- )
95483
- );
95484
- for (const value of document.values) {
95485
- if (typeof value.classId !== "string") continue;
95486
- if (referencedValueIds.has(value.id) || boundRootIds.has(value.id))
95487
- continue;
95488
- reachable.add(value.id);
95489
- visitBody(
95490
- syntheticClassRowMember(value),
95491
- value.value,
95492
- value.classId,
95493
- value.id
95494
- );
95495
- }
95496
- return reachable;
95497
- }
95498
- function collectStructurallyReferencedValueIds(document) {
95499
- const valueIds = new Set(document.values.map((value) => value.id));
95500
- const referenced = /* @__PURE__ */ new Set();
95501
- const collect = (body) => {
95502
- const candidates = Array.isArray(body) ? body : isStringValueRecord(body) ? Object.values(body) : [];
95503
- for (const candidate of candidates) {
95504
- if (typeof candidate === "string" && valueIds.has(candidate)) {
95505
- referenced.add(candidate);
95506
- }
95507
- }
95508
- };
95509
- for (const value of document.values) {
95510
- collect(value.value);
95511
- if (typeof value.containerId === "string") {
95512
- referenced.add(value.id);
95513
- }
95514
- }
95515
- return referenced;
95516
- }
95517
- function syntheticClassRowMember(value) {
95518
- return {
95519
- id: `__class-row:${value.id}`,
95520
- projectId: value.projectId,
95521
- name: "Partitioned class row",
95522
- kind: 7 /* Class */,
95523
- classId: value.classId,
95524
- locked: false,
95525
- required: true,
95526
- isStatic: false,
95527
- accessModifierKind: "public",
95528
- createdAt: value.createdAt,
95529
- updatedAt: value.updatedAt
95530
- };
95531
- }
95532
95659
  function collectReadOnlyConversionDeletes(args) {
95533
95660
  if (args.preserved.has(args.valueId) || args.deleted.has(args.valueId))
95534
95661
  return;
@@ -96727,13 +96854,7 @@ function materializeStaticLocalizedTexts(args) {
96727
96854
  id: seed.id,
96728
96855
  projectId: args.document.project.id,
96729
96856
  value: seed.value,
96730
- link: {
96731
- kind: "member-value",
96732
- recordKind: "value",
96733
- recordId: seed.valueId,
96734
- fieldPath: "value",
96735
- valueId: seed.valueId
96736
- },
96857
+ link: memberValueLocalizedTextLink(seed.valueId),
96737
96858
  config,
96738
96859
  now
96739
96860
  });
@@ -97093,7 +97214,13 @@ function isStringValueRecord(value) {
97093
97214
  return value !== null && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string");
97094
97215
  }
97095
97216
  function commitInitEvaluator(document, createdValues) {
97096
- return (member, init) => evaluateMemberInitializer({ init, member, document, createdValues });
97217
+ return (member, init, sourceValueId) => evaluateMemberInitializer({
97218
+ init,
97219
+ member,
97220
+ document,
97221
+ createdValues,
97222
+ sourceValueId: sourceValueId ?? null
97223
+ });
97097
97224
  }
97098
97225
  function hasAuthoredNeoScriptBody(member) {
97099
97226
  if (member.kind === 10 /* NSProperty */) return true;
@@ -98409,7 +98536,6 @@ var init_project_version_schema_commit = __esm({
98409
98536
  init_constructor_argument_ownership();
98410
98537
  init_constructors2();
98411
98538
  init_dialogue_node_index();
98412
- init_dist_node();
98413
98539
  init_member_value_id();
98414
98540
  init_virtual_instance_values();
98415
98541
  init_world_system_classes();
@@ -99003,7 +99129,7 @@ function toWorldReferenceClassRecord(value) {
99003
99129
  return {
99004
99130
  id: id2,
99005
99131
  extendsClassId: nullableStringField(value, "extendsClassId"),
99006
- schema: isStringRecord7(value.schema) ? value.schema : void 0,
99132
+ schema: isStringRecord8(value.schema) ? value.schema : void 0,
99007
99133
  system: isPlainRecord4(value.system) ? value.system : null
99008
99134
  };
99009
99135
  }
@@ -99021,7 +99147,7 @@ function worldReferenceValueClassId(value) {
99021
99147
  if (value === void 0) return null;
99022
99148
  return typeof value.classId === "string" && value.classId.length > 0 ? value.classId : null;
99023
99149
  }
99024
- function isStringRecord7(value) {
99150
+ function isStringRecord8(value) {
99025
99151
  if (!isPlainRecord4(value)) return false;
99026
99152
  return Object.values(value).every((entry) => typeof entry === "string");
99027
99153
  }
@@ -102557,6 +102683,72 @@ var init_server_preparation_preflight = __esm({
102557
102683
  });
102558
102684
 
102559
102685
  // src/project-source/initializer-replay.ts
102686
+ function isPulledInitializerCompilationDocumentV4(document) {
102687
+ return typeof Reflect.get(document, "project") === "object" && Reflect.get(document, "project") !== null && Array.isArray(Reflect.get(document, "projectFiles")) && Array.isArray(Reflect.get(document, "members")) && Array.isArray(Reflect.get(document, "classes")) && Array.isArray(Reflect.get(document, "enums")) && Array.isArray(Reflect.get(document, "interfaces")) && Array.isArray(Reflect.get(document, "constructors")) && Array.isArray(Reflect.get(document, "values"));
102688
+ }
102689
+ function pulledInitializerCompilerStateV4(document, compilationProject) {
102690
+ const existing = pulledInitializerCompilerStates.get(document);
102691
+ if (existing !== void 0) {
102692
+ if (compilationProject !== void 0) {
102693
+ existing.compilationProject = compilationProject;
102694
+ }
102695
+ return existing;
102696
+ }
102697
+ const created = {
102698
+ compilationProject: compilationProject ?? null
102699
+ };
102700
+ pulledInitializerCompilerStates.set(document, created);
102701
+ return created;
102702
+ }
102703
+ function compilationProjectForPulledDocumentV4(document, state) {
102704
+ state.compilationProject ??= createNeoScriptCompilationProject({
102705
+ project: document.project,
102706
+ projectFiles: document.projectFiles,
102707
+ members: document.members,
102708
+ classes: document.classes,
102709
+ enums: document.enums,
102710
+ interfaces: document.interfaces,
102711
+ constructors: document.constructors ?? []
102712
+ });
102713
+ return state.compilationProject;
102714
+ }
102715
+ function memberCompilationIndexV4(document) {
102716
+ const existing = pulledMemberCompilationIndexes.get(document);
102717
+ if (existing !== void 0) return existing;
102718
+ const created = {
102719
+ membersById: new Map(
102720
+ document.members.map((member) => [member.id, member])
102721
+ ),
102722
+ ownerClassesByMemberId: new Map(
102723
+ document.classes.flatMap(
102724
+ (schemaClass2) => Object.values(schemaClass2.schema).map(
102725
+ (memberId) => [memberId, schemaClass2]
102726
+ )
102727
+ )
102728
+ )
102729
+ };
102730
+ pulledMemberCompilationIndexes.set(document, created);
102731
+ return created;
102732
+ }
102733
+ function pulledInitializerCompilerV4(document, compilationProject) {
102734
+ const state = pulledInitializerCompilerStateV4(document, compilationProject);
102735
+ return (site) => {
102736
+ if (site.sourceValueId !== null) {
102737
+ compilePulledValueInitializerBodyV4(
102738
+ document,
102739
+ site.sourceValueId,
102740
+ compilationProjectForPulledDocumentV4(document, state)
102741
+ );
102742
+ return;
102743
+ }
102744
+ if (site.memberId === null) return;
102745
+ compilePulledMemberInitializerBodyV4(
102746
+ document,
102747
+ site.memberId,
102748
+ compilationProjectForPulledDocumentV4(document, state)
102749
+ );
102750
+ };
102751
+ }
102560
102752
  function describePulledProjectBodyCompileError(error) {
102561
102753
  const fallback = error instanceof Error ? error.message : String(error);
102562
102754
  if (!(error instanceof CompileError)) return fallback;
@@ -102656,42 +102848,22 @@ function replayStoredConstructionV4(args) {
102656
102848
  } : candidate;
102657
102849
  compilePulledUncompiledConstructorsV4(document, compilationProject);
102658
102850
  assertPulledConstructorsCompiled(document);
102659
- const compiledDependencies = /* @__PURE__ */ new Set();
102660
- let materialized;
102661
- for (; ; ) {
102662
- try {
102663
- materialized = materializeInitializerValue({
102851
+ const materialized = materializeInitializerValue({
102852
+ document: {
102853
+ ...document,
102854
+ initializerCompiler: pulledInitializerCompilerV4(
102664
102855
  document,
102665
- // Constructor-only rows have no structural member owner. Use the same
102666
- // explicit typed descriptor for evaluation that compiled the replay.
102667
- member: compileMember,
102668
- row: evaluationRow,
102669
- storedConstructionReplay: true,
102670
- ...args.omitConstructionFields === true ? { constructionBaselineReplay: true } : {},
102671
- ...args.initializerArgumentValues === void 0 ? {} : { argumentValues: args.initializerArgumentValues }
102672
- });
102673
- break;
102674
- } catch (error) {
102675
- const dependencyKey = error instanceof UncompiledInitializerRuntimeError && error.valueId !== null ? error.valueId : error instanceof UncompiledInitializerRuntimeError && error.initializer !== null ? error.initializer : error instanceof UncompiledInitializerRuntimeError ? error.memberId : null;
102676
- if (!(error instanceof UncompiledInitializerRuntimeError) || error.memberId === null || dependencyKey === null || compiledDependencies.has(dependencyKey)) {
102677
- throw error;
102678
- }
102679
- if (error.valueId !== null) {
102680
- compilePulledValueInitializerBodyV4(
102681
- document,
102682
- error.valueId,
102683
- compilationProject
102684
- );
102685
- } else {
102686
- compilePulledMemberInitializerBodyV4(
102687
- document,
102688
- error.memberId,
102689
- compilationProject
102690
- );
102691
- }
102692
- compiledDependencies.add(dependencyKey);
102693
- }
102694
- }
102856
+ compilationProject
102857
+ )
102858
+ },
102859
+ // Constructor-only rows have no structural member owner. Use the same
102860
+ // explicit typed descriptor for evaluation that compiled the replay.
102861
+ member: compileMember,
102862
+ row: evaluationRow,
102863
+ storedConstructionReplay: true,
102864
+ ...args.omitConstructionFields === true ? { constructionBaselineReplay: true } : {},
102865
+ ...args.initializerArgumentValues === void 0 ? {} : { argumentValues: args.initializerArgumentValues }
102866
+ });
102695
102867
  args.onPinnedRootSchemaKeys?.(materialized.pinnedRootSchemaKeys);
102696
102868
  return new Map(
102697
102869
  [materialized.root, ...materialized.createdValues].map((row) => [
@@ -102800,6 +102972,7 @@ function compilePulledProjectDocumentForEvaluationV4(document, compilationProjec
102800
102972
  interfaces: document.interfaces,
102801
102973
  constructors: document.constructors ?? []
102802
102974
  });
102975
+ pulledInitializerCompilerStateV4(document, sharedCompilationProject);
102803
102976
  const compileArgs = {
102804
102977
  project: document.project,
102805
102978
  projectFiles: document.projectFiles,
@@ -102814,19 +102987,13 @@ function compilePulledProjectDocumentForEvaluationV4(document, compilationProjec
102814
102987
  compileConstructorRecord({ ...compileArgs, constructor: constructor2 });
102815
102988
  }
102816
102989
  assertPulledConstructorsCompiled(document);
102817
- const ownerClassByMemberId = new Map(
102818
- compileArgs.classes.flatMap(
102819
- (schemaClass2) => Object.values(schemaClass2.schema).map(
102820
- (memberId) => [memberId, schemaClass2]
102821
- )
102822
- )
102823
- );
102990
+ const memberIndex = memberCompilationIndexV4(document);
102824
102991
  for (const member of compileArgs.members) {
102825
102992
  try {
102826
102993
  compileAuthoredMemberBodies({
102827
102994
  ...compileArgs,
102828
102995
  member,
102829
- thisClass: ownerClassByMemberId.get(member.id) ?? null
102996
+ thisClass: memberIndex.ownerClassesByMemberId.get(member.id) ?? null
102830
102997
  });
102831
102998
  } catch (error) {
102832
102999
  if (error instanceof CompileError) {
@@ -102859,15 +103026,14 @@ function compilePulledMemberInitializerBodyV4(document, memberId, compilationPro
102859
103026
  interfaces: document.interfaces,
102860
103027
  constructors: document.constructors ?? []
102861
103028
  };
102862
- const member = compileArgs.members.find((entry) => entry.id === memberId);
103029
+ const memberIndex = memberCompilationIndexV4(document);
103030
+ const member = memberIndex.membersById.get(memberId);
102863
103031
  if (member === void 0) {
102864
103032
  throw new Error(
102865
103033
  `Cannot compile initializer dependency for missing member "${memberId}".`
102866
103034
  );
102867
103035
  }
102868
- const thisClass = compileArgs.classes.find(
102869
- (schemaClass2) => Object.values(schemaClass2.schema).includes(memberId)
102870
- ) ?? null;
103036
+ const thisClass = memberIndex.ownerClassesByMemberId.get(memberId) ?? null;
102871
103037
  compileMemberInitializerBody({
102872
103038
  ...compileArgs,
102873
103039
  member,
@@ -102988,7 +103154,7 @@ function replayWorkspace(records2) {
102988
103154
  state: { records: stateRecords }
102989
103155
  };
102990
103156
  }
102991
- var pulledBodyCompileSites, pulledValueInitializerCompilationSites;
103157
+ var pulledBodyCompileSites, pulledInitializerCompilerStates, pulledMemberCompilationIndexes, pulledValueInitializerCompilationSites;
102992
103158
  var init_initializer_replay = __esm({
102993
103159
  "src/project-source/initializer-replay.ts"() {
102994
103160
  "use strict";
@@ -103002,9 +103168,10 @@ var init_initializer_replay = __esm({
103002
103168
  init_server_preparation_preflight();
103003
103169
  init_projection();
103004
103170
  init_constructors2();
103005
- init_neoscript_evaluator();
103006
103171
  init_compiler_adapter();
103007
103172
  pulledBodyCompileSites = /* @__PURE__ */ new WeakMap();
103173
+ pulledInitializerCompilerStates = /* @__PURE__ */ new WeakMap();
103174
+ pulledMemberCompilationIndexes = /* @__PURE__ */ new WeakMap();
103008
103175
  pulledValueInitializerCompilationSites = /* @__PURE__ */ new WeakMap();
103009
103176
  }
103010
103177
  });
@@ -103864,6 +104031,9 @@ function lowerVariantGraph(context, binding, created) {
103864
104031
  variantValueRecord(binding, variantRowFields(row), binding.source)
103865
104032
  );
103866
104033
  }
104034
+ for (const text of localizedTexts.values()) {
104035
+ created.push(variantLocalizedTextRecord(context, text, binding.source));
104036
+ }
103867
104037
  }
103868
104038
  function lowerVariantRootRow(context, binding, rootMember, source, rows, localizedTexts) {
103869
104039
  if (rootMember.kind !== "class") {
@@ -104057,6 +104227,27 @@ function variantValueRecord(binding, fileFields, source) {
104057
104227
  }
104058
104228
  };
104059
104229
  }
104230
+ function variantLocalizedTextRecord(context, text, source) {
104231
+ return {
104232
+ recordKind: "localized-text",
104233
+ recordId: text.id,
104234
+ fileFields: {
104235
+ id: text.id,
104236
+ sourceComment: null,
104237
+ links: [memberValueLocalizedTextLink(text.valueId)],
104238
+ localeValues: {
104239
+ [context.mainLocale]: { value: text.value }
104240
+ }
104241
+ },
104242
+ file: source.uri,
104243
+ line: source.range.start.line + 1,
104244
+ sourceSpan: {
104245
+ path: source.uri,
104246
+ start: source.range.start,
104247
+ end: source.range.end
104248
+ }
104249
+ };
104250
+ }
104060
104251
  function variantRootMember(context, binding) {
104061
104252
  const variantClass = context.classesByName.get(binding.variantTypeName);
104062
104253
  if (variantClass === void 0) {
@@ -105547,21 +105738,43 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
105547
105738
  `String member ${member.name} requires a string literal.`
105548
105739
  );
105549
105740
  }
105550
- const textId = pendingLocalizedTextId(source, path);
105551
- if (localizedTexts.has(textId)) {
105552
- throw new Error(`Localized text construction reuses identity ${textId}.`);
105741
+ const stored = context.state[`value:${valueId}`];
105742
+ if (stored !== void 0) {
105743
+ if (!isObjectRecord2(stored.data)) {
105744
+ throw new Error(
105745
+ `Localizable value ${valueId} has invalid stored data.`
105746
+ );
105747
+ }
105748
+ if (typeof stored.data.value !== "string") {
105749
+ throw new Error(
105750
+ `Localizable value ${valueId} has no existing localized-text link.`
105751
+ );
105752
+ }
105753
+ value = lowerLinkedLocalizedText(
105754
+ context,
105755
+ stored.data.value,
105756
+ expression.value,
105757
+ source
105758
+ );
105759
+ } else {
105760
+ const textId = pendingLocalizedTextId(source, path);
105761
+ if (localizedTexts.has(textId)) {
105762
+ throw new Error(
105763
+ `Localized text construction reuses identity ${textId}.`
105764
+ );
105765
+ }
105766
+ localizedTexts.set(textId, {
105767
+ id: textId,
105768
+ valueId,
105769
+ value: expression.value
105770
+ });
105771
+ context.pendingLocalizedTexts.set(textId, {
105772
+ id: textId,
105773
+ valueId,
105774
+ value: expression.value
105775
+ });
105776
+ value = textId;
105553
105777
  }
105554
- localizedTexts.set(textId, {
105555
- id: textId,
105556
- valueId,
105557
- value: expression.value
105558
- });
105559
- context.pendingLocalizedTexts.set(textId, {
105560
- id: textId,
105561
- valueId,
105562
- value: expression.value
105563
- });
105564
- value = textId;
105565
105778
  } else {
105566
105779
  const lowered = lowerValueBody(
105567
105780
  context,
@@ -106277,7 +106490,8 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
106277
106490
  childId,
106278
106491
  source.source,
106279
106492
  /* @__PURE__ */ new Set(),
106280
- memberById(context, storedMemberIds.get(schemaKey))
106493
+ memberById(context, storedMemberIds.get(schemaKey)),
106494
+ environment
106281
106495
  );
106282
106496
  }
106283
106497
  }
@@ -106309,7 +106523,8 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
106309
106523
  valueId,
106310
106524
  source.source,
106311
106525
  /* @__PURE__ */ new Set(),
106312
- null
106526
+ null,
106527
+ environment
106313
106528
  );
106314
106529
  }
106315
106530
  }
@@ -106370,7 +106585,7 @@ function storedRowPlacementMember(context, valueId) {
106370
106585
  }
106371
106586
  return null;
106372
106587
  }
106373
- function retainStoredValueSubgraph(context, valueId, source, visited, member) {
106588
+ function retainStoredValueSubgraph(context, valueId, source, visited, member, environment) {
106374
106589
  if (visited.has(valueId)) return;
106375
106590
  visited.add(valueId);
106376
106591
  const state = context.state[`value:${valueId}`];
@@ -106383,7 +106598,28 @@ function retainStoredValueSubgraph(context, valueId, source, visited, member) {
106383
106598
  source,
106384
106599
  { retained: true }
106385
106600
  );
106386
- const owningMember = member ?? storedRowPlacementMember(context, valueId);
106601
+ const rawOwningMember = member ?? storedRowPlacementMember(context, valueId);
106602
+ const owningMember = rawOwningMember === null ? null : resolveGenericSchemaMember(context, rawOwningMember, environment);
106603
+ if (owningMember?.kind === "string" && owningMember.localizable) {
106604
+ const textId = state.data.value;
106605
+ if (typeof textId !== "string") {
106606
+ throw new Error(
106607
+ `Localizable value ${valueId} has no existing localized-text link.`
106608
+ );
106609
+ }
106610
+ const textState = context.state[`localized-text:${textId}`];
106611
+ if (!isObjectRecord2(textState?.data)) {
106612
+ throw new Error(`Localized text ${textId} was not pulled.`);
106613
+ }
106614
+ addReconstructed(
106615
+ context,
106616
+ "localized-text",
106617
+ textId,
106618
+ nonVolatileFields(textState.data),
106619
+ source,
106620
+ { retained: true }
106621
+ );
106622
+ }
106387
106623
  if (owningMember !== null && memberPointsAtForeignRows(owningMember)) return;
106388
106624
  const referenced = /* @__PURE__ */ new Map();
106389
106625
  const add = (id2, childMember) => {
@@ -106405,6 +106641,27 @@ function retainStoredValueSubgraph(context, valueId, source, visited, member) {
106405
106641
  };
106406
106642
  const body = state.data.value;
106407
106643
  const storedClassId = stringOrNull2(state.data.classId);
106644
+ let childEnvironment = environment;
106645
+ if (storedClassId !== null) {
106646
+ if (owningMember?.kind === "class") {
106647
+ childEnvironment = lowerInstanceGenericEnvironment(
106648
+ context,
106649
+ storedClassId,
106650
+ owningMember,
106651
+ environment
106652
+ );
106653
+ } else {
106654
+ const inherited = new Map(environment ?? []);
106655
+ for (const [genericParamId, bindingMemberId] of classGenericEnvironment(
106656
+ context,
106657
+ storedClassId
106658
+ )) {
106659
+ inherited.set(genericParamId, bindingMemberId);
106660
+ }
106661
+ childEnvironment = inherited;
106662
+ }
106663
+ }
106664
+ childEnvironment = valueGenericEnvironment(state.data, childEnvironment);
106408
106665
  if (isObjectRecord2(body) && storedClassId !== null) {
106409
106666
  const storedMemberIds = storedClassSchemaMemberIds(context, storedClassId);
106410
106667
  for (const [schemaKey, child] of Object.entries(body)) {
@@ -106419,7 +106676,14 @@ function retainStoredValueSubgraph(context, valueId, source, visited, member) {
106419
106676
  add(childId, collectionEntryMember(context, owningMember));
106420
106677
  }
106421
106678
  for (const [childId, childMember] of referenced) {
106422
- retainStoredValueSubgraph(context, childId, source, visited, childMember);
106679
+ retainStoredValueSubgraph(
106680
+ context,
106681
+ childId,
106682
+ source,
106683
+ visited,
106684
+ childMember,
106685
+ childEnvironment
106686
+ );
106423
106687
  }
106424
106688
  }
106425
106689
  function lowerConstructorProjections(context, schemaClass2, expression, base, baseBody, body, source, environment, authoredSlice) {
@@ -107097,10 +107361,6 @@ function lowerStringValue(context, member, expression, base, source) {
107097
107361
  `Localizable value ${String(base.id)} has no existing localized-text link.`
107098
107362
  );
107099
107363
  }
107100
- const textState = context.state[`localized-text:${base.value}`];
107101
- if (!isObjectRecord2(textState?.data)) {
107102
- return expression.value;
107103
- }
107104
107364
  return lowerLinkedLocalizedText(
107105
107365
  context,
107106
107366
  base.value,
@@ -108351,6 +108611,14 @@ function emitValue(context, member, valueId, options) {
108351
108611
  function emitValueBody(context, member, value, visited, targetTyped, environment) {
108352
108612
  const kind = numberField(member, "kind");
108353
108613
  const body = value.value;
108614
+ if (body === null) {
108615
+ if (kind !== 0 /* Null */ && member.required === true) {
108616
+ throw new Error(
108617
+ `Stored required member ${String(member.name ?? member.id)} cannot be null.`
108618
+ );
108619
+ }
108620
+ return "null";
108621
+ }
108354
108622
  if (kind === 0) return "null";
108355
108623
  if (kind === 1 || kind === 2 || kind === 4) return scalar(body);
108356
108624
  if (kind === 3)
@@ -109954,7 +110222,9 @@ function localizedString(context, member, body) {
109954
110222
  return String(body ?? "");
109955
110223
  const localized = context.localizedTexts.get(body);
109956
110224
  if (localized === void 0) {
109957
- return body;
110225
+ throw new Error(
110226
+ `Localizable value references missing localized text "${body}".`
110227
+ );
109958
110228
  }
109959
110229
  context.localizedTextIds.add(body);
109960
110230
  const localeValues = isObjectRecord2(localized?.localeValues) ? localized.localeValues : {};
@@ -110097,6 +110367,7 @@ var init_value_sources = __esm({
110097
110367
  init_member_value_id();
110098
110368
  init_instance_provenance();
110099
110369
  init_members();
110370
+ init_localization2();
110100
110371
  init_compile_ns_property();
110101
110372
  init_compile();
110102
110373
  init_constructor_argument_ownership();
@@ -114135,13 +114406,12 @@ function auditDanglingLocalizedTexts(args) {
114135
114406
  const memberId = placement === void 0 ? memberIdByValueId.get(value.id) : args.memberIdBySchemaKey.get(placement.parent.classId ?? "")?.get(placement.schemaKey);
114136
114407
  if (memberId === void 0) continue;
114137
114408
  if (!localizableMemberIds.has(memberId)) continue;
114138
- if (!isLocalizedTextIdShape(body)) continue;
114139
114409
  const memberName = memberNames.get(memberId) ?? memberId;
114140
114410
  findings.push({
114141
114411
  kind: "dangling-localized-text",
114142
114412
  recordKind: "value",
114143
114413
  recordId: value.id,
114144
- message: `Value "${value.id}" holds localizable string "${memberName}" as localized-text "${body}", which is not in this project. The literal is lost: pull re-emits the id as the text and the next push mints a new one, so the push never converges. Re-author the value, or declare the member \`@settings(localizable: false)\` if it is data rather than display copy.`,
114414
+ message: `Value "${value.id}" holds localizable string "${memberName}" as localized-text "${body}", which is not in this project. Source projection fails closed because no localized text exists for that identity. Re-author the value, or declare the member \`@settings(localizable: false)\` if it is data rather than display copy.`,
114145
114415
  repair: { valueId: value.id, memberId, localizedTextId: body }
114146
114416
  });
114147
114417
  }
@@ -114247,9 +114517,6 @@ function collectRecordIdStrings(data, recordsById2, claim) {
114247
114517
  collectRecordIdStrings(entry, recordsById2, claim);
114248
114518
  }
114249
114519
  }
114250
- function isLocalizedTextIdShape(body) {
114251
- return WHOLE_RECORD_ID.test(body);
114252
- }
114253
114520
  function childStorageKeyDeclaration(args) {
114254
114521
  const { placement } = args;
114255
114522
  if (placement.schemaKey === UNORDERED_MEMBERSHIP_KEY) {
@@ -114378,7 +114645,7 @@ function normalizePartition(mapKey) {
114378
114645
  function describePartition(mapKey) {
114379
114646
  return mapKey === null ? `"${MAIN_STORAGE_PARTITION}"` : `"${mapKey}"`;
114380
114647
  }
114381
- var UNORDERED_MEMBERSHIP_KEY, MEMBER_KIND_STRING, RECORD_ID_PATTERN2, EMBEDDED_RECORD_ID, WHOLE_RECORD_ID;
114648
+ var UNORDERED_MEMBERSHIP_KEY, MEMBER_KIND_STRING, RECORD_ID_PATTERN2, EMBEDDED_RECORD_ID;
114382
114649
  var init_project_integrity = __esm({
114383
114650
  "src/project-source/project-integrity.ts"() {
114384
114651
  "use strict";
@@ -114390,7 +114657,6 @@ var init_project_integrity = __esm({
114390
114657
  MEMBER_KIND_STRING = 3;
114391
114658
  RECORD_ID_PATTERN2 = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
114392
114659
  EMBEDDED_RECORD_ID = new RegExp(RECORD_ID_PATTERN2, "gu");
114393
- WHOLE_RECORD_ID = new RegExp(`^${RECORD_ID_PATTERN2}$`, "u");
114394
114660
  }
114395
114661
  });
114396
114662
 
@@ -115860,7 +116126,8 @@ async function runScript(workspace, command, options, dependencies = {}) {
115860
116126
  saveStaticBindings = readSaveStaticBindings(saveOverlay.staticBindings);
115861
116127
  }
115862
116128
  const overlaidDocument = { ...document, values: evalValues };
115863
- const lookups = cliEvaluatorLookups(overlaidDocument);
116129
+ const runtime = cliEvaluatorRuntime(overlaidDocument);
116130
+ const lookups = runtime.databaseVM;
115864
116131
  const vm = {
115865
116132
  project: document.project,
115866
116133
  members: document.members,
@@ -115874,7 +116141,7 @@ async function runScript(workspace, command, options, dependencies = {}) {
115874
116141
  projectFiles: document.projectFiles,
115875
116142
  localizationConfig: document.localizationConfig,
115876
116143
  localizedTexts: document.localizedTexts,
115877
- databaseVM: lookups
116144
+ ...runtime
115878
116145
  };
115879
116146
  const evaluatorContext2 = {
115880
116147
  vm,
@@ -115954,47 +116221,41 @@ async function runScript(workspace, command, options, dependencies = {}) {
115954
116221
  function buildStoredNeoScriptChecks(document) {
115955
116222
  const checks = [];
115956
116223
  const projectData = document;
115957
- const splitDialogues = document.dialogueRecords.length > 0 || document.dialogueNodes.length > 0;
115958
- const dialogueEntries = splitDialogues ? document.dialogueRecords.map((dialogue) => ({
116224
+ const dialogueEntries = document.dialogueRecords.map((dialogue) => ({
115959
116225
  dialogue,
115960
116226
  nodes: document.dialogueNodes.filter(
115961
116227
  (node) => node.dialogueId === dialogue.id
115962
116228
  )
115963
- })) : document.dialogues.map((dialogue) => ({
115964
- dialogue,
115965
- nodes: aggregateDialogueNodes(dialogue)
115966
116229
  }));
115967
- if (splitDialogues) {
115968
- const dialogueIds = new Set(
115969
- document.dialogueRecords.flatMap(
115970
- (dialogue) => typeof dialogue.id === "string" ? [dialogue.id] : []
115971
- )
115972
- );
115973
- for (const node of document.dialogueNodes) {
115974
- if (typeof node.dialogueId === "string" && dialogueIds.has(node.dialogueId)) {
115975
- continue;
115976
- }
115977
- const nodeId = stableRecordId(node, "(unknown-node)");
115978
- checks.push({
115979
- recordKind: "dialogue-node",
115980
- id: nodeId,
115981
- name: nodeId,
115982
- unit: "condition",
115983
- path: `dialogueNodes.${nodeId}`,
115984
- bodySite: {
115985
- recordKind: "dialogue-node",
115986
- recordId: nodeId,
115987
- recordName: nodeId,
115988
- unit: "getter",
115989
- code: ""
115990
- },
115991
- run: () => {
115992
- throw new Error(
115993
- `Dialogue node "${nodeId}" references missing dialogue "${String(node.dialogueId)}".`
115994
- );
115995
- }
115996
- });
116230
+ const dialogueIds = new Set(
116231
+ document.dialogueRecords.flatMap(
116232
+ (dialogue) => typeof dialogue.id === "string" ? [dialogue.id] : []
116233
+ )
116234
+ );
116235
+ for (const node of document.dialogueNodes) {
116236
+ if (typeof node.dialogueId === "string" && dialogueIds.has(node.dialogueId)) {
116237
+ continue;
115997
116238
  }
116239
+ const nodeId = stableRecordId(node, "(unknown-node)");
116240
+ checks.push({
116241
+ recordKind: "dialogue-node",
116242
+ id: nodeId,
116243
+ name: nodeId,
116244
+ unit: "condition",
116245
+ path: `dialogueNodes.${nodeId}`,
116246
+ bodySite: {
116247
+ recordKind: "dialogue-node",
116248
+ recordId: nodeId,
116249
+ recordName: nodeId,
116250
+ unit: "getter",
116251
+ code: ""
116252
+ },
116253
+ run: () => {
116254
+ throw new Error(
116255
+ `Dialogue node "${nodeId}" references missing dialogue "${String(node.dialogueId)}".`
116256
+ );
116257
+ }
116258
+ });
115998
116259
  }
115999
116260
  for (const { dialogue, nodes } of dialogueEntries) {
116000
116261
  const dialogueId = stableRecordId(dialogue, "(unknown-dialogue)");
@@ -116239,20 +116500,6 @@ function buildStoredNeoScriptChecks(document) {
116239
116500
  }
116240
116501
  return checks;
116241
116502
  }
116242
- function aggregateDialogueNodes(dialogue) {
116243
- const result = [];
116244
- if (isObjectRecord2(dialogue.triggerNode)) {
116245
- result.push(dialogue.triggerNode);
116246
- }
116247
- if (!isObjectRecord2(dialogue.nodes)) return result;
116248
- for (const [nodeKey, nodeValue] of Object.entries(dialogue.nodes)) {
116249
- if (!isObjectRecord2(nodeValue)) continue;
116250
- result.push(
116251
- typeof nodeValue.id === "string" ? nodeValue : { ...nodeValue, id: nodeKey }
116252
- );
116253
- }
116254
- return result;
116255
- }
116256
116503
  function buildScriptDialogueContext(dialogue, nodes) {
116257
116504
  const trigger = nodes.find((node) => node.type === 0 /* Trigger */);
116258
116505
  return {
@@ -120386,7 +120633,7 @@ var init_registry2 = __esm({
120386
120633
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
120387
120634
  formatVersion: 3,
120388
120635
  contractVersion: "3.14",
120389
- cliVersion: "0.38.2",
120636
+ cliVersion: "0.38.3",
120390
120637
  projectFileUploadBatchSize: 32,
120391
120638
  documentRecords: {
120392
120639
  member: {
@@ -121866,10 +122113,11 @@ function sharedEvaluatorBase(rawDocument) {
121866
122113
  if (cached !== void 0) return cached;
121867
122114
  const document = readDocumentArrays(rawDocument);
121868
122115
  const constructors = Array.isArray(rawDocument.constructors) ? rawDocument.constructors.filter(isRecord10) : [];
121869
- const lookups = cliEvaluatorLookups(
122116
+ const runtime = cliEvaluatorRuntime(
121870
122117
  { ...document, constructors },
121871
122118
  { includeValueGraphIndexes: true }
121872
122119
  );
122120
+ const lookups = runtime.databaseVM;
121873
122121
  const vm = {
121874
122122
  project: document.project,
121875
122123
  members: document.members,
@@ -121883,7 +122131,7 @@ function sharedEvaluatorBase(rawDocument) {
121883
122131
  projectFiles: document.projectFiles,
121884
122132
  localizationConfig: document.localizationConfig,
121885
122133
  localizedTexts: document.localizedTexts,
121886
- databaseVM: lookups
122134
+ ...runtime
121887
122135
  };
121888
122136
  const created = {
121889
122137
  vm,
@@ -124229,7 +124477,8 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
124229
124477
  const valueById = new Map(
124230
124478
  document.values.map((value) => [String(value.id), value])
124231
124479
  );
124232
- const lookups = cliEvaluatorLookups(document);
124480
+ const runtime = cliEvaluatorRuntime(document);
124481
+ const lookups = runtime.databaseVM;
124233
124482
  const rootValue = buildRootValue(document, lookups);
124234
124483
  const authoredStaticValueIdByMemberId = new Map(
124235
124484
  document.members.flatMap(
@@ -124314,7 +124563,7 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
124314
124563
  projectFiles: document.projectFiles,
124315
124564
  localizationConfig: document.localizationConfig,
124316
124565
  localizedTexts: document.localizedTexts,
124317
- databaseVM: lookups
124566
+ ...runtime
124318
124567
  },
124319
124568
  thisValue: instance === null ? null : instance.value,
124320
124569
  rootValue,
@@ -125907,7 +126156,8 @@ function buildWorld(document, raw) {
125907
126156
  }
125908
126157
  }
125909
126158
  }
125910
- const lookups = cliEvaluatorLookups(document);
126159
+ const runtime = cliEvaluatorRuntime(document);
126160
+ const lookups = runtime.databaseVM;
125911
126161
  return {
125912
126162
  valueById,
125913
126163
  rootValue: buildRootValue(document, lookups),
@@ -125925,7 +126175,7 @@ function buildWorld(document, raw) {
125925
126175
  projectFiles: document.projectFiles,
125926
126176
  localizationConfig: document.localizationConfig,
125927
126177
  localizedTexts: document.localizedTexts,
125928
- databaseVM: lookups
126178
+ ...runtime
125929
126179
  },
125930
126180
  saveOwned,
125931
126181
  sessionOwned,
@@ -126314,6 +126564,7 @@ function cloneDryrunWorld(source) {
126314
126564
  return next;
126315
126565
  };
126316
126566
  const document = { ...source.document, values };
126567
+ const runtime = cliEvaluatorRuntime(document);
126317
126568
  return {
126318
126569
  ...source,
126319
126570
  valueById,
@@ -126322,7 +126573,7 @@ function cloneDryrunWorld(source) {
126322
126573
  vm: {
126323
126574
  ...source.vm,
126324
126575
  values,
126325
- databaseVM: cliEvaluatorLookups(document)
126576
+ ...runtime
126326
126577
  },
126327
126578
  saveOwned: new Set(source.saveOwned),
126328
126579
  sessionOwned: new Set(source.sessionOwned),
@@ -126421,7 +126672,7 @@ function applyEvaluationResult(result, world) {
126421
126672
  const values = [...world.valueById.values()];
126422
126673
  world.document = { ...world.document, values };
126423
126674
  world.vm.values = values;
126424
- world.vm.databaseVM = cliEvaluatorLookups(world.document);
126675
+ Object.assign(world.vm, cliEvaluatorRuntime(world.document));
126425
126676
  }
126426
126677
  function dryrunStoredValueEquals(stored, value, valueId, world) {
126427
126678
  if (valueId !== void 0) return stored === valueId;
@@ -127109,7 +127360,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
127109
127360
  async function main() {
127110
127361
  const args = parseArgs(process.argv.slice(2));
127111
127362
  if (args.command === "--version") {
127112
- console.log("0.38.2");
127363
+ console.log("0.38.3");
127113
127364
  return;
127114
127365
  }
127115
127366
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
@@ -127180,6 +127431,10 @@ async function main() {
127180
127431
  return;
127181
127432
  }
127182
127433
  case "pull": {
127434
+ assertAllowedFlags(
127435
+ args,
127436
+ /* @__PURE__ */ new Set(["api", "force", "reset", "regenerate-source-names"])
127437
+ );
127183
127438
  const workspace = loadWorkspaceForCommand(args);
127184
127439
  const { runPull: runPull2 } = await Promise.resolve().then(() => (init_pull(), pull_exports));
127185
127440
  await runPull2(workspace, {