@neocompose/cli 0.38.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs CHANGED
@@ -48287,13 +48287,13 @@ function pickInstanceProvenance(source) {
48287
48287
  }
48288
48288
  function isVirtualInstanceRootShape(value) {
48289
48289
  if (value.instanceConstructorId !== void 0) return true;
48290
- if (value.constructorArgs !== void 0) return true;
48291
48290
  return typeof value.instanceVariantId === "string";
48292
48291
  }
48293
48292
  function carriesCompleteConstructionRecipe(value) {
48293
+ if (!isVirtualInstanceRootShape(value)) return false;
48294
48294
  if (value.instanceConstructorId === null) return true;
48295
- if (value.constructorArgs !== void 0) return true;
48296
- return typeof value.instanceVariantId === "string";
48295
+ if (typeof value.instanceVariantId === "string") return true;
48296
+ return value.constructorArgs !== void 0;
48297
48297
  }
48298
48298
  var init_instance_provenance = __esm({
48299
48299
  "../src/models/members/instance-provenance.ts"() {
@@ -48846,6 +48846,56 @@ var init_storage_partitions = __esm({
48846
48846
  }
48847
48847
  });
48848
48848
 
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
+
48849
48899
  // ../src/models/unity/unity-import-settings.ts
48850
48900
  function buildDefaultUnityTexture2DImportSettings() {
48851
48901
  return {
@@ -50055,7 +50105,7 @@ function evaluateLiteralContainer(args) {
50055
50105
  const literal2 = {
50056
50106
  value: evaluated.value,
50057
50107
  classId: evaluated.classId,
50058
- ...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: structuredClone(evaluated.constructorArgs) },
50108
+ ...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(evaluated.constructorArgs) },
50059
50109
  ...evaluated.instanceConstructorId === void 0 ? {} : { instanceConstructorId: evaluated.instanceConstructorId },
50060
50110
  ...evaluated.instanceVariantId === void 0 ? {} : { instanceVariantId: evaluated.instanceVariantId },
50061
50111
  ...evaluated.instanceVariantRowValueId === void 0 ? {} : {
@@ -51001,6 +51051,7 @@ var ANIMATION_OVERRIDE_GRAPH_MEMBER_IDS, DECLARATION_DEFAULT_POSITION, SPRITE_FI
51001
51051
  var init_build_default_member_value = __esm({
51002
51052
  "../src/models/members/build-default-member-value.ts"() {
51003
51053
  "use strict";
51054
+ init_deep_clone_plain_data();
51004
51055
  init_dist_node();
51005
51056
  init_inheritance();
51006
51057
  init_generics();
@@ -73069,7 +73120,7 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
73069
73120
  classId: rootRow.classId ?? null,
73070
73121
  ...rootRow.genericBindings === void 0 ? {} : { genericBindings: { ...rootRow.genericBindings } },
73071
73122
  provisionalRootId: rootRow.id,
73072
- ...constructorArgs === void 0 ? {} : { constructorArgs: structuredClone(constructorArgs) },
73123
+ ...constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(constructorArgs) },
73073
73124
  ...rootRow.instanceConstructorId === void 0 ? {} : { instanceConstructorId: rootRow.instanceConstructorId },
73074
73125
  ...rootRow.instanceVariantId === void 0 ? {} : { instanceVariantId: rootRow.instanceVariantId },
73075
73126
  ...rootRow.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: rootRow.instanceVariantRowValueId }
@@ -73335,11 +73386,27 @@ function resolveVariantGraph(selection2, ctx) {
73335
73386
  `Variant '${record3.name}' root row is not a class record.`
73336
73387
  );
73337
73388
  }
73389
+ const effectiveRoot = { ...root };
73390
+ const recipe = row.constructorArgs;
73391
+ if (typeof recipe === "object" && recipe !== null) {
73392
+ const settledVariantSlots = [
73393
+ ["Initialize", 0],
73394
+ ["Apply", 1],
73395
+ ["Overrides", 2],
73396
+ ["ChildOverrides", 3]
73397
+ ];
73398
+ for (const [schemaKey, argumentIndex] of settledVariantSlots) {
73399
+ if (effectiveRoot[schemaKey] !== void 0) continue;
73400
+ const argument2 = recipe[`__arg_${argumentIndex}__`];
73401
+ if (argument2 === void 0 || argument2 === null) continue;
73402
+ effectiveRoot[schemaKey] = argument2;
73403
+ }
73404
+ }
73338
73405
  return {
73339
73406
  variantId,
73340
73407
  name: record3.name,
73341
73408
  targetClassId: record3.classId,
73342
- root,
73409
+ root: effectiveRoot,
73343
73410
  binding: record3.folderId === null ? null : (ctx.vm.variantFolders ?? []).find(
73344
73411
  (folder) => folder.id === record3.folderId
73345
73412
  )?.binding ?? null
@@ -73402,21 +73469,22 @@ function resolveVariantRowParameter(args) {
73402
73469
  }
73403
73470
  function invokeVariantClosure(args) {
73404
73471
  const { closureValueId, ctx, label, lexicalThis, parameters } = args;
73405
- if (typeof closureValueId !== "string" || closureValueId.length === 0) {
73472
+ const inline = typeof closureValueId === "object" && closureValueId !== null && !Array.isArray(closureValueId) ? closureValueId : null;
73473
+ if (inline === null && (typeof closureValueId !== "string" || closureValueId.length === 0)) {
73406
73474
  throw new NSGetterRuntimeError(`${label} is not bound to a value row.`);
73407
73475
  }
73408
- const row = evalValueById(
73476
+ const row = inline !== null ? null : evalValueById(
73409
73477
  ctx,
73410
73478
  closureValueId,
73411
73479
  ctx.__runtimeSessionValues,
73412
73480
  ctx.__valueOverlay
73413
73481
  );
73414
- if (row === null) {
73482
+ if (inline === null && row === null) {
73415
73483
  throw new NSGetterRuntimeError(
73416
- `${label} references missing value row '${closureValueId}'.`
73484
+ `${label} references missing value row '${String(closureValueId)}'.`
73417
73485
  );
73418
73486
  }
73419
- const stored = row.value;
73487
+ const stored = inline ?? row?.value;
73420
73488
  if (typeof stored !== "object" || stored === null) {
73421
73489
  throw new NSGetterRuntimeError(`${label} does not hold a delegate value.`);
73422
73490
  }
@@ -73802,7 +73870,7 @@ function evalVariantApply(info, scope, ctx) {
73802
73870
  "ToVariant receiver has no addressable instance root."
73803
73871
  );
73804
73872
  }
73805
- const priorInstanceRoot = structuredClone(rootRow);
73873
+ const priorInstanceRoot = deepClonePlainData(rootRow);
73806
73874
  const answeredSlots = collectVariantDeclarativeAnsweredSlots(
73807
73875
  receiver,
73808
73876
  graph,
@@ -73833,7 +73901,7 @@ function evalVariantApply(info, scope, ctx) {
73833
73901
  } else {
73834
73902
  const resolution = resolver.call(ctx.vm.databaseVM, {
73835
73903
  priorInstanceRoot,
73836
- nextInstanceRoot: structuredClone(rootRow),
73904
+ nextInstanceRoot: deepClonePlainData(rootRow),
73837
73905
  answeredValueIds: [...new Set(answeredSlots.map((slot) => slot.valueId))],
73838
73906
  localRows: [
73839
73907
  ...ctx.__runtimeSessionValues?.values() ?? [],
@@ -73846,7 +73914,7 @@ function evalVariantApply(info, scope, ctx) {
73846
73914
  }
73847
73915
  for (const row of resolution.rows) {
73848
73916
  if (row.id === rootRow.id) continue;
73849
- ctx.__valueOverlay?.set(row.id, structuredClone(row));
73917
+ ctx.__valueOverlay?.set(row.id, deepClonePlainData(row));
73850
73918
  }
73851
73919
  if (typeof receiver !== "object" || receiver === null || Array.isArray(receiver) || typeof resolution.root.value !== "object" || resolution.root.value === null || Array.isArray(resolution.root.value)) {
73852
73920
  throw new NSGetterRuntimeError(
@@ -73994,7 +74062,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
73994
74062
  const argumentsByValue = ctx.__constructedArgumentsByValue ?? (ctx.__constructedArgumentsByValue = /* @__PURE__ */ new WeakMap());
73995
74063
  argumentsByValue.set(rootRecord, encoded);
73996
74064
  recordConstructedFieldSchemaKeys(ctx, rootRecord, descriptor);
73997
- root.constructorArgs = structuredClone(encoded);
74065
+ root.constructorArgs = deepClonePlainData(encoded);
73998
74066
  root.instanceConstructorId = record3.id;
73999
74067
  } else {
74000
74068
  root.constructorArgs = {};
@@ -74304,11 +74372,13 @@ function cloneConstructorArgumentGraph(args) {
74304
74372
  const clone = buildNewValue(args.ctx.vm.project.id, {
74305
74373
  value: cloneConstructorLiteralValue(source.value),
74306
74374
  ...source.classId == null ? {} : { classId: source.classId },
74307
- ...isLiteralValueContent(source) && source.constructorArgs !== void 0 && source.constructorArgs !== null ? {
74308
- constructorArgs: cloneConstructorLiteralValue(
74309
- source.constructorArgs
74310
- )
74311
- } : {}
74375
+ // The clone keeps the SOURCE's creation provenance whole. Copying the
74376
+ // arguments while dropping the constructor that consumed them (or the
74377
+ // variant that delegated it) would leave a row no reader classifies as
74378
+ // an instance root, so its collapse-omitted members would read as
74379
+ // missing. `cloneClassValueGraph` preserves the set by spreading the
74380
+ // source row; this path builds a fresh body, so it projects it.
74381
+ ...isLiteralValueContent(source) ? clonedConstructorProvenance(source) : {}
74312
74382
  });
74313
74383
  clone.containerId = clonedContainerId ?? null;
74314
74384
  if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
@@ -74461,6 +74531,17 @@ function cloneConstructorArgumentGraph(args) {
74461
74531
  };
74462
74532
  return cloneRow2(args.source, args.member, args.genericEnv);
74463
74533
  }
74534
+ function clonedConstructorProvenance(source) {
74535
+ const provenance = pickInstanceProvenance(source);
74536
+ if (provenance.constructorArgs === void 0) return provenance;
74537
+ if (provenance.constructorArgs === null) return provenance;
74538
+ return {
74539
+ ...provenance,
74540
+ constructorArgs: cloneConstructorLiteralValue(
74541
+ provenance.constructorArgs
74542
+ )
74543
+ };
74544
+ }
74464
74545
  function cloneConstructorLiteralValue(value) {
74465
74546
  if (typeof value !== "object" || value === null) return value;
74466
74547
  if (Array.isArray(value)) {
@@ -75045,6 +75126,8 @@ var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeErr
75045
75126
  var init_evaluateNSGetter = __esm({
75046
75127
  "../src/view-models/neoscript-evaluator/evaluateNSGetter.ts"() {
75047
75128
  "use strict";
75129
+ init_deep_clone_plain_data();
75130
+ init_instance_provenance();
75048
75131
  init_NeoScriptScope();
75049
75132
  init_members();
75050
75133
  init_inheritance();
@@ -75404,7 +75487,7 @@ function constructorBodyIsCorpusFree(constructor2) {
75404
75487
  }
75405
75488
  function withoutInitializerConstructionFields(init) {
75406
75489
  if (init.compiled === void 0) return init;
75407
- const baseline = structuredClone(init);
75490
+ const baseline = deepClonePlainData(init);
75408
75491
  for (const instruction of baseline.compiled?.instructions ?? []) {
75409
75492
  if (!isNSInstructionReturn(instruction)) continue;
75410
75493
  if (!isNSPointerFunction(instruction.pointer)) continue;
@@ -75477,7 +75560,12 @@ function expandStoredInstance(args) {
75477
75560
  );
75478
75561
  }
75479
75562
  const constructors = args.document.constructors ?? [];
75480
- const recordedConstructorId = instanceRoot.instanceConstructorId !== void 0 ? instanceRoot.instanceConstructorId : schemaClass2.requiredConstructorId ?? null;
75563
+ if (instanceRoot.instanceConstructorId === void 0 && typeof instanceRoot.instanceVariantId !== "string") {
75564
+ throw new VirtualExpansionUnsupportedError(
75565
+ `Virtual expansion root "${args.instanceRoot.id}" carries no construction stamp for class "${classId}"; keep this historical graph materialized.`
75566
+ );
75567
+ }
75568
+ const recordedConstructorId = instanceRoot.instanceConstructorId === void 0 ? schemaClass2.requiredConstructorId ?? null : instanceRoot.instanceConstructorId;
75481
75569
  const requiredConstructor = recordedConstructorId === null ? null : constructors.find(
75482
75570
  (candidate) => candidate.id === recordedConstructorId
75483
75571
  ) ?? null;
@@ -75702,7 +75790,6 @@ function resolveVirtualInstanceGraph(args) {
75702
75790
  } : {}
75703
75791
  };
75704
75792
  if (isMemberClassBase(indexed.member) && effective.value !== null) {
75705
- const expandedRecord = stringRecord2(indexed.expandedRow.value);
75706
75793
  const storedRecord = stringRecord2(materialized?.value);
75707
75794
  const effectiveRecord = {};
75708
75795
  const classId = effective.classId ?? indexed.member.classId;
@@ -75724,9 +75811,6 @@ function resolveVirtualInstanceGraph(args) {
75724
75811
  for (const [key, childId] of Object.entries(storedRecord)) {
75725
75812
  if (effectiveRecord[key] === void 0) effectiveRecord[key] = childId;
75726
75813
  }
75727
- for (const [key, childId] of Object.entries(expandedRecord)) {
75728
- if (effectiveRecord[key] === void 0) effectiveRecord[key] = childId;
75729
- }
75730
75814
  effective.value = effectiveRecord;
75731
75815
  } else if (isMemberListBase(indexed.member)) {
75732
75816
  const effectiveListValue = materialized === null ? indexed.expandedRow.value : materialized.value;
@@ -77377,6 +77461,7 @@ var KEPT_ROW_SAMPLE_LIMIT, CORPUS_SCANNING_MEMBER_KINDS, CONSTRUCTOR_TYPE_WALK_D
77377
77461
  var init_virtual_instance_values = __esm({
77378
77462
  "../src/database/virtual-instance-values.ts"() {
77379
77463
  "use strict";
77464
+ init_deep_clone_plain_data();
77380
77465
  init_inheritance();
77381
77466
  init_generics();
77382
77467
  init_members();
@@ -77592,7 +77677,7 @@ function evaluateMemberInitializer(args) {
77592
77677
  ...rootRow.genericBindings === void 0 ? {} : { genericBindings: { ...rootRow.genericBindings } },
77593
77678
  ...pinnedRootSchemaKeys === void 0 ? {} : { pinnedRootSchemaKeys },
77594
77679
  provisionalRootId: rootRow.id,
77595
- ...constructorArgs === void 0 ? {} : { constructorArgs: structuredClone(constructorArgs) },
77680
+ ...constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(constructorArgs) },
77596
77681
  ...rootRow.instanceConstructorId === void 0 ? {} : { instanceConstructorId: rootRow.instanceConstructorId },
77597
77682
  ...rootRow.instanceVariantId === void 0 ? {} : { instanceVariantId: rootRow.instanceVariantId },
77598
77683
  ...rootRow.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: rootRow.instanceVariantRowValueId }
@@ -77602,6 +77687,7 @@ var evaluatorLookupsByDocument;
77602
77687
  var init_evaluateInitializer = __esm({
77603
77688
  "../src/view-models/neoscript-evaluator/evaluateInitializer.ts"() {
77604
77689
  "use strict";
77690
+ init_deep_clone_plain_data();
77605
77691
  init_members();
77606
77692
  init_project2();
77607
77693
  init_NSGetterRuntimeError();
@@ -77681,7 +77767,7 @@ function materializeInitializerValue(args) {
77681
77767
  value: evaluated.value,
77682
77768
  ...evaluated.classId === null ? {} : { classId: evaluated.classId },
77683
77769
  ...evaluated.genericBindings === void 0 ? {} : { genericBindings: { ...evaluated.genericBindings } },
77684
- ...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: structuredClone(evaluated.constructorArgs) },
77770
+ ...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(evaluated.constructorArgs) },
77685
77771
  ...evaluated.instanceConstructorId === void 0 ? {} : { instanceConstructorId: evaluated.instanceConstructorId },
77686
77772
  ...evaluated.instanceVariantId === void 0 ? {} : { instanceVariantId: evaluated.instanceVariantId },
77687
77773
  ...evaluated.instanceVariantRowValueId === void 0 ? {} : {
@@ -77748,6 +77834,7 @@ function materializeMemberDefaultValue(args) {
77748
77834
  var init_init_backed_value_materialization = __esm({
77749
77835
  "../src/database/init-backed-value-materialization.ts"() {
77750
77836
  "use strict";
77837
+ init_deep_clone_plain_data();
77751
77838
  init_members();
77752
77839
  init_neoscript_evaluator();
77753
77840
  }
@@ -78262,212 +78349,21 @@ var init_projectRecordBuckets = __esm({
78262
78349
  }
78263
78350
  });
78264
78351
 
78265
- // ../src/database/neoscript-call-receiver-migration.ts
78266
- function rewriteExplicitNeoScriptCallReceivers(data, options = {}) {
78267
- return rewriteValue(
78268
- data,
78269
- /* @__PURE__ */ new WeakMap(),
78270
- false,
78271
- options.sourceDerivedLegacyCalls ?? "ignore"
78272
- );
78273
- }
78274
- function explicitNeoScriptCallReceiverDiagnostic(data, options = {}) {
78275
- const sourceDerivedLegacyCalls = options.sourceDerivedLegacyCalls ?? "ignore";
78276
- const seen = /* @__PURE__ */ new WeakSet();
78277
- const visit = (value, path, sourceDerivedCompanion) => {
78278
- if (typeof value !== "object" || value === null) return null;
78279
- if (seen.has(value)) return null;
78280
- seen.add(value);
78281
- if (Array.isArray(value)) {
78282
- for (let index = 0; index < value.length; index += 1) {
78283
- const diagnostic = visit(
78284
- value[index],
78285
- `${path}[${index}]`,
78286
- sourceDerivedCompanion
78287
- );
78288
- if (diagnostic !== null) return diagnostic;
78289
- }
78290
- return null;
78291
- }
78292
- const record3 = value;
78293
- if (sourceDerivedCompanion && sourceDerivedLegacyCalls === "ignore") {
78294
- return null;
78295
- }
78296
- const pointerType = String(record3.type);
78297
- const isLegacySourceCall = sourceDerivedCompanion && sourceDerivedLegacyCalls === "migrate" && pointerType === LEGACY_NATIVE_CALL_POINTER_TYPE;
78298
- const isCallPointer = CURRENT_CALL_POINTER_TYPES.has(pointerType) || isLegacySourceCall;
78299
- if (pointerType === LEGACY_NATIVE_CALL_POINTER_TYPE && !sourceDerivedCompanion) {
78300
- return `${path}.type retains legacy discriminator ${JSON.stringify(pointerType)} outside a source-derived companion.`;
78301
- }
78302
- const hasLegacy = Object.prototype.hasOwnProperty.call(
78303
- record3,
78304
- "thisPointer"
78305
- );
78306
- if (hasLegacy && !isCallPointer) {
78307
- return `${path}.thisPointer appears outside a callGetter/callFunction pointer.`;
78308
- }
78309
- if (isCallPointer) {
78310
- const hasReceiver = Object.prototype.hasOwnProperty.call(
78311
- record3,
78312
- "receiver"
78313
- );
78314
- if (hasLegacy) {
78315
- return `${path}.thisPointer retains the legacy call-receiver field.`;
78316
- }
78317
- if (!hasReceiver) {
78318
- return `${path}.receiver is required.`;
78319
- }
78320
- const diagnostic = receiverDiagnostic(record3, path);
78321
- if (diagnostic !== null) return diagnostic;
78322
- }
78323
- for (const [key, child] of Object.entries(record3)) {
78324
- const diagnostic = visit(
78325
- child,
78326
- `${path}.${key}`,
78327
- sourceDerivedCompanion || sourceBackedDerivedField(record3, key)
78328
- );
78329
- if (diagnostic !== null) return diagnostic;
78330
- }
78331
- return null;
78332
- };
78333
- return visit(data, "$", false);
78334
- }
78335
- function rewriteValue(value, seen, sourceDerivedCompanion, sourceDerivedLegacyCalls) {
78336
- if (typeof value !== "object" || value === null) return value;
78337
- const existing = seen.get(value);
78338
- if (existing !== void 0) return existing;
78339
- if (Array.isArray(value)) {
78340
- let changed2 = false;
78341
- const next2 = [];
78342
- seen.set(value, next2);
78343
- for (const entry of value) {
78344
- const migrated = rewriteValue(
78345
- entry,
78346
- seen,
78347
- sourceDerivedCompanion,
78348
- sourceDerivedLegacyCalls
78349
- );
78350
- next2.push(migrated);
78351
- if (migrated !== entry) changed2 = true;
78352
- }
78353
- if (!changed2) {
78354
- seen.set(value, value);
78355
- return value;
78356
- }
78357
- return next2;
78358
- }
78359
- const record3 = value;
78360
- if (sourceDerivedCompanion && sourceDerivedLegacyCalls === "ignore") {
78361
- seen.set(value, value);
78362
- return value;
78363
- }
78364
- let changed = false;
78365
- const next = {};
78366
- seen.set(value, next);
78367
- for (const [key, entry] of Object.entries(record3)) {
78368
- const migrated = rewriteValue(
78369
- entry,
78370
- seen,
78371
- sourceDerivedCompanion || sourceBackedDerivedField(record3, key),
78372
- sourceDerivedLegacyCalls
78373
- );
78374
- next[key] = migrated;
78375
- if (migrated !== entry) changed = true;
78376
- }
78377
- if ((CURRENT_CALL_POINTER_TYPES.has(String(next.type)) || sourceDerivedCompanion && sourceDerivedLegacyCalls === "migrate" && next.type === LEGACY_NATIVE_CALL_POINTER_TYPE) && Object.prototype.hasOwnProperty.call(next, "thisPointer") && !Object.prototype.hasOwnProperty.call(next, "receiver") && isPointer(next.thisPointer)) {
78378
- next.receiver = { kind: "instance", pointer: next.thisPointer };
78379
- delete next.thisPointer;
78380
- changed = true;
78381
- }
78382
- if (!changed) {
78383
- seen.set(value, value);
78384
- return value;
78385
- }
78386
- return next;
78387
- }
78388
- function sourceBackedDerivedField(record3, key) {
78389
- if (record3.type === 10) {
78390
- if (key === "getter" && typeof record3.code === "string") return true;
78391
- if (key === "setter" && typeof record3.setterCode === "string") return true;
78392
- }
78393
- if (record3.type === 23) {
78394
- if (key === "action" && typeof record3.code === "string") return true;
78395
- }
78396
- if (typeof record3.code === "string" && (key === "getter" || key === "action")) {
78397
- return true;
78398
- }
78399
- return key === "getter" && typeof record3.sourcePath === "string" && isRecord4(record3.pointer) && isRecord4(record3.typeInfo);
78400
- }
78401
- function receiverDiagnostic(call, path) {
78402
- if (!isRecord4(call.receiver)) {
78403
- return `${path}.receiver must be an object.`;
78404
- }
78405
- const receiver = call.receiver;
78406
- if (receiver.kind === "instance") {
78407
- if (!hasExactKeys2(receiver, ["kind", "pointer"])) {
78408
- return `${path}.receiver instance must contain exactly kind and pointer.`;
78409
- }
78410
- if (!isPointer(receiver.pointer)) {
78411
- return `${path}.receiver.pointer must be a NeoScript pointer object.`;
78412
- }
78413
- return null;
78414
- }
78415
- if (receiver.kind !== "static") {
78416
- return `${path}.receiver.kind must be "instance" or "static".`;
78417
- }
78418
- if (!hasExactKeys2(receiver, ["kind", "memberId"])) {
78419
- return `${path}.receiver static value must contain exactly kind and memberId.`;
78420
- }
78421
- if (typeof receiver.memberId !== "string" || receiver.memberId.length === 0) {
78422
- return `${path}.receiver.memberId must be a non-empty string.`;
78423
- }
78424
- if (typeof call.memberId !== "string" || call.memberId.length === 0) {
78425
- return `${path} uses a static receiver but does not declare a concrete memberId.`;
78426
- }
78427
- if (receiver.memberId !== call.memberId) {
78428
- return `${path}.receiver.memberId ${JSON.stringify(receiver.memberId)} does not match call memberId ${JSON.stringify(call.memberId)}.`;
78429
- }
78430
- return null;
78431
- }
78432
- function isPointer(value) {
78433
- return isRecord4(value) && typeof value.type === "string" && value.type.length > 0;
78434
- }
78435
- function isRecord4(value) {
78436
- return typeof value === "object" && value !== null && !Array.isArray(value);
78437
- }
78438
- function hasExactKeys2(value, expected) {
78439
- const keys = Object.keys(value);
78440
- return keys.length === expected.length && expected.every((key) => key in value);
78441
- }
78442
- var CURRENT_CALL_POINTER_TYPES, LEGACY_NATIVE_CALL_POINTER_TYPE;
78443
- var init_neoscript_call_receiver_migration = __esm({
78444
- "../src/database/neoscript-call-receiver-migration.ts"() {
78445
- "use strict";
78446
- CURRENT_CALL_POINTER_TYPES = /* @__PURE__ */ new Set(["callGetter", "callFunction"]);
78447
- LEGACY_NATIVE_CALL_POINTER_TYPE = "callNativeFunction";
78448
- }
78449
- });
78450
-
78451
78352
  // ../src/database/project-record-migrations.ts
78452
- function migrateMemberStaticOwnership(data) {
78453
- if (!isRecord5(data)) return data;
78454
- if (Object.prototype.hasOwnProperty.call(data, "isStatic")) return data;
78455
- return { ...data, isStatic: false };
78456
- }
78457
78353
  function migrateMemberAccessModifier(data) {
78458
- if (!isRecord5(data)) return data;
78354
+ if (!isRecord4(data)) return data;
78459
78355
  if (Object.prototype.hasOwnProperty.call(data, "accessModifierKind")) {
78460
78356
  return data;
78461
78357
  }
78462
78358
  return { ...data, accessModifierKind: "public" };
78463
78359
  }
78464
78360
  function migrateInterfaceMemberAccessModifiers(data) {
78465
- if (!isRecord5(data)) return data;
78361
+ if (!isRecord4(data)) return data;
78466
78362
  const members = data.members;
78467
- if (!isRecord5(members)) return data;
78363
+ if (!isRecord4(members)) return data;
78468
78364
  let nextMembers = members;
78469
78365
  for (const [memberKey, member] of Object.entries(members)) {
78470
- if (!isRecord5(member)) continue;
78366
+ if (!isRecord4(member)) continue;
78471
78367
  if (Object.prototype.hasOwnProperty.call(member, "accessModifierKind")) {
78472
78368
  continue;
78473
78369
  }
@@ -78496,59 +78392,8 @@ function migrateProjectRecordData(args) {
78496
78392
  }
78497
78393
  return migratedData;
78498
78394
  }
78499
- function migrateDialoguePrimaryLinkedValues(data) {
78500
- if (!isRecord5(data)) return data;
78501
- let nextData = data;
78502
- const migratedDialogue = migrateLinkedValueContainer(nextData);
78503
- if (migratedDialogue !== nextData) nextData = migratedDialogue;
78504
- const triggerNode = nextData.triggerNode;
78505
- if (isRecord5(triggerNode)) {
78506
- const migratedTriggerNode = migrateLinkedValueContainer(triggerNode);
78507
- if (migratedTriggerNode !== triggerNode) {
78508
- nextData = {
78509
- ...nextData,
78510
- triggerNode: migratedTriggerNode
78511
- };
78512
- }
78513
- }
78514
- const nodes = nextData.nodes;
78515
- if (!isRecord5(nodes)) return nextData;
78516
- let nextNodes = nodes;
78517
- for (const [nodeId, node] of Object.entries(nodes)) {
78518
- if (!isRecord5(node)) continue;
78519
- const migratedNode = migrateLinkedValueContainer(node);
78520
- if (migratedNode === node) continue;
78521
- if (nextNodes === nodes) nextNodes = { ...nodes };
78522
- nextNodes[nodeId] = migratedNode;
78523
- }
78524
- if (nextNodes === nodes) return nextData;
78525
- return {
78526
- ...nextData,
78527
- nodes: nextNodes
78528
- };
78529
- }
78530
- function migrateLinkedValueContainer(container) {
78531
- if (typeof container.primaryLinkedValueId === "string") return container;
78532
- const primaryLinkedValueId = findPrimaryLinkedValueId(container.linkedValues);
78533
- if (primaryLinkedValueId === null) return container;
78534
- return {
78535
- ...container,
78536
- primaryLinkedValueId
78537
- };
78538
- }
78539
- function findPrimaryLinkedValueId(linkedValues) {
78540
- if (!Array.isArray(linkedValues)) return null;
78541
- for (const linkedValue of linkedValues) {
78542
- if (!isRecord5(linkedValue)) continue;
78543
- if (linkedValue.source !== 1 /* Primary */) continue;
78544
- if (typeof linkedValue.valueId !== "string") continue;
78545
- if (linkedValue.valueId.trim() === "") continue;
78546
- return linkedValue.valueId;
78547
- }
78548
- return null;
78549
- }
78550
78395
  function migrateLocalizationConfigMainLocale(data) {
78551
- if (!isRecord5(data)) return data;
78396
+ if (!isRecord4(data)) return data;
78552
78397
  const nextData = { ...data };
78553
78398
  if ("rootLocale" in nextData) {
78554
78399
  if ("mainLocale" in nextData) {
@@ -78570,82 +78415,7 @@ function migrateLocalizationConfigMainLocale(data) {
78570
78415
  }
78571
78416
  return nextData;
78572
78417
  }
78573
- function migrateEnumOptionKeyOrder(data) {
78574
- if (!isRecord5(data)) return data;
78575
- if (Array.isArray(data.optionKeyOrder)) return data;
78576
- if (!isRecord5(data.options)) return data;
78577
- return {
78578
- ...data,
78579
- optionKeyOrder: Object.keys(data.options)
78580
- };
78581
- }
78582
- function migrateGeneralFunctionCallIR(data) {
78583
- return migrateExplicitCallReceiverIR(
78584
- rewriteFunctionCallIR(data, "$", /* @__PURE__ */ new WeakMap())
78585
- );
78586
- }
78587
- function migrateExplicitCallReceiverIR(data) {
78588
- const migrated = rewriteExplicitNeoScriptCallReceivers(data, {
78589
- sourceDerivedLegacyCalls: "migrate"
78590
- });
78591
- const diagnostic = explicitNeoScriptCallReceiverDiagnostic(migrated, {
78592
- sourceDerivedLegacyCalls: "migrate"
78593
- });
78594
- if (diagnostic !== null) {
78595
- throw new Error(`Cannot migrate NeoScript call-receiver IR: ${diagnostic}`);
78596
- }
78597
- return migrated;
78598
- }
78599
- function rewriteFunctionCallIR(value, path, seen) {
78600
- if (typeof value !== "object" || value === null) return value;
78601
- const existing = seen.get(value);
78602
- if (existing !== void 0) return existing;
78603
- if (Array.isArray(value)) {
78604
- let changed2 = false;
78605
- const next2 = [];
78606
- seen.set(value, next2);
78607
- for (let index = 0; index < value.length; index += 1) {
78608
- const entry = rewriteFunctionCallIR(
78609
- value[index],
78610
- `${path}[${index}]`,
78611
- seen
78612
- );
78613
- next2.push(entry);
78614
- if (entry !== value[index]) changed2 = true;
78615
- }
78616
- if (!changed2) {
78617
- seen.set(value, value);
78618
- return value;
78619
- }
78620
- return next2;
78621
- }
78622
- const record3 = value;
78623
- let changed = false;
78624
- const next = {};
78625
- seen.set(value, next);
78626
- for (const [key, entry] of Object.entries(record3)) {
78627
- let migrated = rewriteFunctionCallIR(entry, `${path}.${key}`, seen);
78628
- if (key === "type") {
78629
- if (entry === "callNativeFunction") migrated = "callFunction";
78630
- else if (entry === "nativeFunctionErrorCheck") {
78631
- migrated = "functionErrorCheck";
78632
- } else if (entry === "nativeCall") migrated = "functionCall";
78633
- }
78634
- next[key] = migrated;
78635
- if (migrated !== entry) changed = true;
78636
- }
78637
- const pointerType = next.type;
78638
- if (pointerType === "callFunction" && (typeof next.callSiteId !== "string" || next.callSiteId.length === 0)) {
78639
- next.callSiteId = `migrated:${path}`;
78640
- changed = true;
78641
- }
78642
- if (!changed) {
78643
- seen.set(value, value);
78644
- return value;
78645
- }
78646
- return next;
78647
- }
78648
- function isRecord5(value) {
78418
+ function isRecord4(value) {
78649
78419
  if (typeof value !== "object") return false;
78650
78420
  if (value === null) return false;
78651
78421
  if (Array.isArray(value)) return false;
@@ -78655,9 +78425,7 @@ var CURRENT_PROJECT_RECORD_DATA_SCHEMA_VERSION, PROJECT_RECORD_DATA_MIGRATIONS;
78655
78425
  var init_project_record_migrations = __esm({
78656
78426
  "../src/database/project-record-migrations.ts"() {
78657
78427
  "use strict";
78658
- init_dialogue();
78659
78428
  init_project2();
78660
- init_neoscript_call_receiver_migration();
78661
78429
  CURRENT_PROJECT_RECORD_DATA_SCHEMA_VERSION = {
78662
78430
  [ProjectRecordKind.Project]: 1,
78663
78431
  [ProjectRecordKind.Member]: 5,
@@ -78684,9 +78452,6 @@ var init_project_record_migrations = __esm({
78684
78452
  PROJECT_RECORD_DATA_MIGRATIONS = {
78685
78453
  [ProjectRecordKind.Project]: {},
78686
78454
  [ProjectRecordKind.Member]: {
78687
- 1: migrateGeneralFunctionCallIR,
78688
- 2: migrateMemberStaticOwnership,
78689
- 3: migrateExplicitCallReceiverIR,
78690
78455
  4: migrateMemberAccessModifier
78691
78456
  },
78692
78457
  [ProjectRecordKind.Value]: {},
@@ -78695,25 +78460,13 @@ var init_project_record_migrations = __esm({
78695
78460
  [ProjectRecordKind.Variant]: {},
78696
78461
  [ProjectRecordKind.VariantFolder]: {},
78697
78462
  [ProjectRecordKind.InternalRecordRelation]: {},
78698
- [ProjectRecordKind.Enum]: {
78699
- 1: migrateEnumOptionKeyOrder
78700
- },
78463
+ [ProjectRecordKind.Enum]: {},
78701
78464
  [ProjectRecordKind.Interface]: {
78702
78465
  2: migrateInterfaceMemberAccessModifiers
78703
78466
  },
78704
- [ProjectRecordKind.Dialogue]: {
78705
- 1: migrateDialoguePrimaryLinkedValues,
78706
- 2: migrateGeneralFunctionCallIR,
78707
- 3: migrateExplicitCallReceiverIR
78708
- },
78709
- [ProjectRecordKind.DialogueNode]: {
78710
- 1: migrateGeneralFunctionCallIR,
78711
- 2: migrateExplicitCallReceiverIR
78712
- },
78713
- [ProjectRecordKind.DialogueGroup]: {
78714
- 1: migrateGeneralFunctionCallIR,
78715
- 2: migrateExplicitCallReceiverIR
78716
- },
78467
+ [ProjectRecordKind.Dialogue]: {},
78468
+ [ProjectRecordKind.DialogueNode]: {},
78469
+ [ProjectRecordKind.DialogueGroup]: {},
78717
78470
  [ProjectRecordKind.PriorityGroup]: {},
78718
78471
  [ProjectRecordKind.ProjectFile]: {},
78719
78472
  [ProjectRecordKind.UnityTextureTemplate]: {},
@@ -78723,10 +78476,7 @@ var init_project_record_migrations = __esm({
78723
78476
  },
78724
78477
  [ProjectRecordKind.LocalizationStatus]: {},
78725
78478
  [ProjectRecordKind.LocalizedText]: {},
78726
- [ProjectRecordKind.Migration]: {
78727
- 1: migrateGeneralFunctionCallIR,
78728
- 2: migrateExplicitCallReceiverIR
78729
- }
78479
+ [ProjectRecordKind.Migration]: {}
78730
78480
  };
78731
78481
  }
78732
78482
  });
@@ -83509,7 +83259,7 @@ function assertAnimationClipDocumentValid(document) {
83509
83259
  context.validateClipMember(member);
83510
83260
  }
83511
83261
  }
83512
- function isRecord6(value) {
83262
+ function isRecord5(value) {
83513
83263
  return typeof value === "object" && value !== null && !Array.isArray(value);
83514
83264
  }
83515
83265
  var WORLD_RETIRED_TILE_LAYER_LINK_LAYER_MEMBER_ID, WORLD_RETIRED_OBJECT_LAYER_LINK_LAYER_MEMBER_ID, WORLD_ANIMATION_STRUCTURAL_MEMBER_ROOT_IDS, AnimationValidationContext;
@@ -84253,7 +84003,7 @@ var init_animation_clips = __esm({
84253
84003
  }
84254
84004
  args.visited.add(args.overrideNode.id);
84255
84005
  try {
84256
- if (args.overrideNode.classId !== args.targetClassId || !isRecord6(args.overrideNode.value)) {
84006
+ if (args.overrideNode.classId !== args.targetClassId || !isRecord5(args.overrideNode.value)) {
84257
84007
  throw new Error(
84258
84008
  `Animation clip "${args.clipName}" frame ${args.frameIndex} Partial value must preserve target class "${args.targetClassId}".`
84259
84009
  );
@@ -84319,12 +84069,12 @@ var init_animation_clips = __esm({
84319
84069
  member
84320
84070
  );
84321
84071
  const effectiveClassId = typeof definitionChild?.classId === "string" ? definitionChild.classId : member.classId;
84322
- if (overrideChild.value === null || !isRecord6(overrideChild.value) || overrideChild.classId !== effectiveClassId) {
84072
+ if (overrideChild.value === null || !isRecord5(overrideChild.value) || overrideChild.classId !== effectiveClassId) {
84323
84073
  throw new Error(
84324
84074
  `Animation clip "${args.clipName}" frame ${args.frameIndex} Class member "${path.join(".")}" is a sparse path, not a replacement or null write.`
84325
84075
  );
84326
84076
  }
84327
- if (definitionChild === null || !isRecord6(definitionChild.value)) {
84077
+ if (definitionChild === null || !isRecord5(definitionChild.value)) {
84328
84078
  throw new Error(
84329
84079
  `Animation clip "${args.clipName}" frame ${args.frameIndex} cannot descend into null definition member "${path.join(".")}".`
84330
84080
  );
@@ -84418,7 +84168,7 @@ var init_animation_clips = __esm({
84418
84168
  `${descent}; its value row "${resolution.node.id}" holds null, so a field override has no record to merge into.`
84419
84169
  );
84420
84170
  }
84421
- if (!isRecord6(resolution.node.value)) {
84171
+ if (!isRecord5(resolution.node.value)) {
84422
84172
  throw new Error(`${descent}; its value is not a ${kindLabel} record.`);
84423
84173
  }
84424
84174
  }
@@ -84502,7 +84252,7 @@ var init_animation_clips = __esm({
84502
84252
  * depend on it — so callers that care check `node.value` themselves.
84503
84253
  */
84504
84254
  resolveDefinitionChildResolution(definitionNode, schemaKey, member) {
84505
- const mapped = isRecord6(definitionNode?.value) ? definitionNode.value[schemaKey] : void 0;
84255
+ const mapped = isRecord5(definitionNode?.value) ? definitionNode.value[schemaKey] : void 0;
84506
84256
  if (typeof mapped === "string") {
84507
84257
  return this.definitionChildRow(mapped);
84508
84258
  }
@@ -84563,7 +84313,7 @@ var init_animation_clips = __esm({
84563
84313
  optionalMemberRootNode(member) {
84564
84314
  if (member.defaultValue !== void 0) {
84565
84315
  const value = member.defaultValue.value;
84566
- if (!isRecord6(value)) return null;
84316
+ if (!isRecord5(value)) return null;
84567
84317
  return {
84568
84318
  id: `member-default:${member.id}`,
84569
84319
  projectId: member.projectId,
@@ -84580,7 +84330,7 @@ var init_animation_clips = __esm({
84580
84330
  optionalFieldNode(parent, classId, memberId) {
84581
84331
  const field = this.field(classId, memberId);
84582
84332
  if (field === null) return null;
84583
- const mapped = isRecord6(parent.value) ? parent.value[field.schemaKey] : null;
84333
+ const mapped = isRecord5(parent.value) ? parent.value[field.schemaKey] : null;
84584
84334
  if (typeof mapped === "string") return this.valueById.get(mapped) ?? null;
84585
84335
  if (field.member.defaultValue !== void 0) {
84586
84336
  const value = field.member.defaultValue.value;
@@ -84617,7 +84367,7 @@ var init_animation_clips = __esm({
84617
84367
  * when it is dangling, then the member default, then the legacy value row.
84618
84368
  */
84619
84369
  listFieldIds(parent, field) {
84620
- const mapped = isRecord6(parent.value) ? parent.value[field.schemaKey] : null;
84370
+ const mapped = isRecord5(parent.value) ? parent.value[field.schemaKey] : null;
84621
84371
  if (typeof mapped === "string") {
84622
84372
  return this.valueById.get(mapped)?.value;
84623
84373
  }
@@ -84681,7 +84431,7 @@ var init_animation_clips = __esm({
84681
84431
  }
84682
84432
  scalarField(parent, classId, memberId) {
84683
84433
  const field = this.requireField(classId, memberId, `Class "${classId}"`);
84684
- const mapped = isRecord6(parent.value) ? parent.value[field.schemaKey] : null;
84434
+ const mapped = isRecord5(parent.value) ? parent.value[field.schemaKey] : null;
84685
84435
  if (typeof mapped === "string") {
84686
84436
  return this.valueById.get(mapped)?.value;
84687
84437
  }
@@ -84780,7 +84530,7 @@ function headlessVirtualInstanceLookups(document, options = {}) {
84780
84530
  // Raw first, then virtual: a materialized row always wins over the
84781
84531
  // expansion that would otherwise answer for it.
84782
84532
  valueById: (id2) => indexed.valueById(id2) ?? virtual.valueById(id2),
84783
- rowForValueReference: (value) => indexed.rowForValueReference?.(value) ?? virtual.rowForValueReference(value),
84533
+ rowForValueReference: (value) => indexed.rowForValueReference(value) ?? virtual.rowForValueReference(value),
84784
84534
  virtualInstanceRowsForValue: (receiverValueId) => virtual.virtualInstanceRowsForValue(receiverValueId),
84785
84535
  // Stored-construction replay evaluates `ToVariant`, and production's
84786
84536
  // variant-constructed placements collapse through exactly this path.
@@ -85197,6 +84947,9 @@ var init_variant_value_graph = __esm({
85197
84947
  function canonicalJsonStringify(value) {
85198
84948
  return JSON.stringify(toCanonicalJsonValue(value));
85199
84949
  }
84950
+ function canonicallyEqual2(left, right) {
84951
+ return canonicalJsonStringify(left) === canonicalJsonStringify(right);
84952
+ }
85200
84953
  function toCanonicalJsonValue(value) {
85201
84954
  if (value === null) return null;
85202
84955
  if (value === void 0) return void 0;
@@ -87522,7 +87275,8 @@ var init_world_content_sidecar_validation = __esm({
87522
87275
  );
87523
87276
  WORLD_PLACEMENT_ASSET_KIND = /* @__PURE__ */ new Map([
87524
87277
  [NeoWorldSystemClassKind.TileInstance, NeoWorldSystemClassKind.Tile],
87525
- [NeoWorldSystemClassKind.ObjectPlacementTile, NeoWorldSystemClassKind.Object]
87278
+ [NeoWorldSystemClassKind.ObjectPlacementTile, NeoWorldSystemClassKind.Object],
87279
+ [NeoWorldSystemClassKind.Object, NeoWorldSystemClassKind.Object]
87526
87280
  ]);
87527
87281
  }
87528
87282
  });
@@ -87949,7 +87703,7 @@ function assertNoPersistedReadOnlySyntheticLookupId2(value, label) {
87949
87703
  `${label} cannot persist runtime-only read-only synthetic value id "${syntheticId}".`
87950
87704
  );
87951
87705
  }
87952
- function isRecord7(value) {
87706
+ function isRecord6(value) {
87953
87707
  return typeof value === "object" && value !== null && !Array.isArray(value);
87954
87708
  }
87955
87709
  function abstractReadOnlyContractAncestor(member, membersById2) {
@@ -87967,7 +87721,7 @@ function abstractReadOnlyContractAncestor(member, membersById2) {
87967
87721
  return null;
87968
87722
  }
87969
87723
  function readMember(value) {
87970
- if (!isRecord7(value)) throw new Error("Member record is not an object.");
87724
+ if (!isRecord6(value)) throw new Error("Member record is not an object.");
87971
87725
  if (typeof value.id !== "string") throw new Error("Member id is invalid.");
87972
87726
  if (typeof value.name !== "string") {
87973
87727
  throw new Error(`Member "${value.id}" name is invalid.`);
@@ -87991,12 +87745,12 @@ function readMember(value) {
87991
87745
  return value;
87992
87746
  }
87993
87747
  function readClass(value) {
87994
- if (!isRecord7(value)) throw new Error("Class record is not an object.");
87748
+ if (!isRecord6(value)) throw new Error("Class record is not an object.");
87995
87749
  if (typeof value.id !== "string") throw new Error("Class id is invalid.");
87996
87750
  if (typeof value.name !== "string") {
87997
87751
  throw new Error(`Class "${value.id}" name is invalid.`);
87998
87752
  }
87999
- if (!isRecord7(value.schema)) {
87753
+ if (!isRecord6(value.schema)) {
88000
87754
  throw new Error(`Class "${value.id}" schema is invalid.`);
88001
87755
  }
88002
87756
  for (const memberId of Object.values(value.schema)) {
@@ -88023,7 +87777,7 @@ function readClass(value) {
88023
87777
  return value;
88024
87778
  }
88025
87779
  function readConstructor(value) {
88026
- if (!isRecord7(value)) throw new Error("Constructor record is not an object.");
87780
+ if (!isRecord6(value)) throw new Error("Constructor record is not an object.");
88027
87781
  if (typeof value.id !== "string" || value.id.length === 0) {
88028
87782
  throw new Error("Constructor id is invalid.");
88029
87783
  }
@@ -88041,17 +87795,17 @@ function readConstructor(value) {
88041
87795
  return value;
88042
87796
  }
88043
87797
  function readInterface(value) {
88044
- if (!isRecord7(value)) throw new Error("Interface record is not an object.");
87798
+ if (!isRecord6(value)) throw new Error("Interface record is not an object.");
88045
87799
  if (typeof value.id !== "string") throw new Error("Interface id is invalid.");
88046
87800
  if (typeof value.name !== "string") {
88047
87801
  throw new Error(`Interface "${value.id}" name is invalid.`);
88048
87802
  }
88049
- if (!isRecord7(value.members)) {
87803
+ if (!isRecord6(value.members)) {
88050
87804
  throw new Error(`Interface "${value.id}" members are invalid.`);
88051
87805
  }
88052
87806
  const memberIds = /* @__PURE__ */ new Set();
88053
87807
  for (const [memberKey, memberValue] of Object.entries(value.members)) {
88054
- if (!isRecord7(memberValue)) {
87808
+ if (!isRecord6(memberValue)) {
88055
87809
  throw new Error(
88056
87810
  `Interface "${value.id}" member "${memberKey}" is invalid.`
88057
87811
  );
@@ -88079,14 +87833,14 @@ function readInterface(value) {
88079
87833
  return value;
88080
87834
  }
88081
87835
  function typeInfoInterfaceIds(value) {
88082
- if (!isRecord7(value)) return [];
87836
+ if (!isRecord6(value)) return [];
88083
87837
  const ids = [];
88084
87838
  if (value.type === 22 && typeof value.interfaceId === "string") {
88085
87839
  ids.push(value.interfaceId);
88086
87840
  }
88087
87841
  if ("entryTypeInfo" in value)
88088
87842
  ids.push(...typeInfoInterfaceIds(value.entryTypeInfo));
88089
- if (isRecord7(value.typeArguments)) {
87843
+ if (isRecord6(value.typeArguments)) {
88090
87844
  for (const argument2 of Object.values(value.typeArguments)) {
88091
87845
  ids.push(...typeInfoInterfaceIds(argument2));
88092
87846
  }
@@ -88095,7 +87849,7 @@ function typeInfoInterfaceIds(value) {
88095
87849
  }
88096
87850
  function stableValue(value) {
88097
87851
  if (Array.isArray(value)) return value.map(stableValue);
88098
- if (!isRecord7(value)) return value;
87852
+ if (!isRecord6(value)) return value;
88099
87853
  const normalized = Object.fromEntries(
88100
87854
  Object.entries(value).filter(([key]) => key !== "name" && key !== "defaultValue").sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => [key, stableValue(entry)])
88101
87855
  );
@@ -88120,7 +87874,7 @@ function isOpaqueNSFunctionArgumentIdentifier(value) {
88120
87874
  return isOpaqueCallableArgumentIdentifier(value) && value !== "value";
88121
87875
  }
88122
87876
  function isOpaqueNSTypeInfo(value, ancestors = /* @__PURE__ */ new Set()) {
88123
- if (!isRecord7(value) || typeof value.required !== "boolean") return false;
87877
+ if (!isRecord6(value) || typeof value.required !== "boolean") return false;
88124
87878
  if (value.type === "Unknown") return true;
88125
87879
  if (typeof value.type !== "number") return false;
88126
87880
  if ([0, 1, 2, 3, 4, 11, 12, 14, 15, 16, 17, 19, 20].includes(value.type)) {
@@ -88133,7 +87887,7 @@ function isOpaqueNSTypeInfo(value, ancestors = /* @__PURE__ */ new Set()) {
88133
87887
  if (value.typeArguments === void 0 || value.typeArguments === null) {
88134
87888
  return true;
88135
87889
  }
88136
- if (!isRecord7(value.typeArguments) || ancestors.has(value)) return false;
87890
+ if (!isRecord6(value.typeArguments) || ancestors.has(value)) return false;
88137
87891
  ancestors.add(value);
88138
87892
  try {
88139
87893
  return Object.values(value.typeArguments).every(
@@ -88192,20 +87946,20 @@ function isOpaqueNSTypeInfo(value, ancestors = /* @__PURE__ */ new Set()) {
88192
87946
  function opaqueTypeInfoContainsUnknown(value) {
88193
87947
  if (value.type === "Unknown") return true;
88194
87948
  if (value.type === 5 || value.type === 6 || value.type === 9) {
88195
- return isRecord7(value.entryTypeInfo) && opaqueTypeInfoContainsUnknown(value.entryTypeInfo);
87949
+ return isRecord6(value.entryTypeInfo) && opaqueTypeInfoContainsUnknown(value.entryTypeInfo);
88196
87950
  }
88197
87951
  if (value.type === 25) {
88198
- return isRecord7(value.returnTypeInfo) && opaqueTypeInfoContainsUnknown(value.returnTypeInfo) || Array.isArray(value.argumentTypes) && value.argumentTypes.some(
88199
- (argument2) => isRecord7(argument2) && opaqueTypeInfoContainsUnknown(argument2)
87952
+ return isRecord6(value.returnTypeInfo) && opaqueTypeInfoContainsUnknown(value.returnTypeInfo) || Array.isArray(value.argumentTypes) && value.argumentTypes.some(
87953
+ (argument2) => isRecord6(argument2) && opaqueTypeInfoContainsUnknown(argument2)
88200
87954
  );
88201
87955
  }
88202
- if (value.type !== 7 || !isRecord7(value.typeArguments)) return false;
87956
+ if (value.type !== 7 || !isRecord6(value.typeArguments)) return false;
88203
87957
  return Object.values(value.typeArguments).some(
88204
- (argument2) => isRecord7(argument2) && opaqueTypeInfoContainsUnknown(argument2)
87958
+ (argument2) => isRecord6(argument2) && opaqueTypeInfoContainsUnknown(argument2)
88205
87959
  );
88206
87960
  }
88207
87961
  function isOpaqueNSFunctionReturnTypeInfo(value) {
88208
- if (isRecord7(value) && value.type === "Void") {
87962
+ if (isRecord6(value) && value.type === "Void") {
88209
87963
  return value.required === true;
88210
87964
  }
88211
87965
  return isOpaqueNSTypeInfo(value);
@@ -88214,13 +87968,13 @@ function isOpaqueNSFunctionArgumentTypeInfo(value) {
88214
87968
  return isOpaqueNSTypeInfo(value) && isOpaqueNSFunctionArgumentIdentifier(value.name) && !opaqueTypeInfoContainsUnknown(value) && hasValidOpaqueParameterDefault(value);
88215
87969
  }
88216
87970
  function isOpaqueConstructorArgumentTypeInfo(value) {
88217
- if (!isRecord7(value)) return false;
87971
+ if (!isRecord6(value)) return false;
88218
87972
  return isOpaqueNSTypeInfo(value) && isOpaqueCallableArgumentIdentifier(value.name) && !opaqueTypeInfoContainsUnknown(value) && hasValidOpaqueParameterDefault(value);
88219
87973
  }
88220
87974
  function hasValidOpaqueParameterDefault(value) {
88221
87975
  const wrapper = value.defaultValue;
88222
87976
  if (wrapper === void 0) return true;
88223
- if (!isRecord7(wrapper)) return false;
87977
+ if (!isRecord6(wrapper)) return false;
88224
87978
  const keys = Object.keys(wrapper);
88225
87979
  if (keys.length !== 1 || keys[0] !== "value") return false;
88226
87980
  const payload = wrapper.value;
@@ -88250,7 +88004,7 @@ function opaqueParameterDefaultsPlacedLast(argumentTypes) {
88250
88004
  }
88251
88005
  function opaqueArgumentsHaveDefault(argumentTypes) {
88252
88006
  return argumentTypes.some(
88253
- (argument2) => isRecord7(argument2) && argument2.defaultValue !== void 0
88007
+ (argument2) => isRecord6(argument2) && argument2.defaultValue !== void 0
88254
88008
  );
88255
88009
  }
88256
88010
  function assertOpaqueParameterDefaultsValid(member) {
@@ -88274,7 +88028,7 @@ function assertOpaqueParameterDefaultsValid(member) {
88274
88028
  }
88275
88029
  const parameters = [];
88276
88030
  for (const argument2 of argumentTypes) {
88277
- if (!isRecord7(argument2) || !hasValidOpaqueParameterDefault(argument2)) {
88031
+ if (!isRecord6(argument2) || !hasValidOpaqueParameterDefault(argument2)) {
88278
88032
  throw new Error(
88279
88033
  `Function "${member.name}" (${member.id}) declares a parameter default value that does not match the parameter's type.`
88280
88034
  );
@@ -88526,7 +88280,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
88526
88280
  };
88527
88281
  const invariantTypeInfo = (left, right) => stableTypeInfo(left) === stableTypeInfo(right);
88528
88282
  const typeInfoAssignable = (from, to) => {
88529
- if (!isRecord7(from) || !isRecord7(to)) return false;
88283
+ if (!isRecord6(from) || !isRecord6(to)) return false;
88530
88284
  if (to.type === "Unknown") return true;
88531
88285
  if (from.type === "Unknown") return false;
88532
88286
  if (from.required === false && to.required === true) return false;
@@ -88888,7 +88642,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
88888
88642
  return;
88889
88643
  }
88890
88644
  if (owned.kind !== 7 || typeof owned.classId !== "string") return;
88891
- const defaultValue = isRecord7(owned.defaultValue) ? owned.defaultValue : null;
88645
+ const defaultValue = isRecord6(owned.defaultValue) ? owned.defaultValue : null;
88892
88646
  const effectiveClassId = typeof defaultValue?.classId === "string" ? defaultValue.classId : owned.classId;
88893
88647
  const ownedClass = classesById2.get(effectiveClassId);
88894
88648
  if (ownedClass === void 0) {
@@ -88975,7 +88729,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
88975
88729
  current = current.extendsClassId === void 0 ? void 0 : classesById2.get(current.extendsClassId);
88976
88730
  }
88977
88731
  }
88978
- const values = (view.values ?? []).filter(isRecord7);
88732
+ const values = (view.values ?? []).filter(isRecord6);
88979
88733
  const valuesById = new Map(
88980
88734
  values.flatMap(
88981
88735
  (value) => typeof value.id === "string" ? [[value.id, value]] : []
@@ -89019,14 +88773,14 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89019
88773
  }
89020
88774
  return;
89021
88775
  }
89022
- if (inspectedMember.kind === 5 && isRecord7(body)) {
88776
+ if (inspectedMember.kind === 5 && isRecord6(body)) {
89023
88777
  if (typeof inspectedMember.entryMemberId !== "string") return;
89024
88778
  for (const childId of Object.values(body)) {
89025
88779
  inspectChild(inspectedMember.entryMemberId, childId);
89026
88780
  }
89027
88781
  return;
89028
88782
  }
89029
- if (inspectedMember.kind !== 7 || !isRecord7(body)) return;
88783
+ if (inspectedMember.kind !== 7 || !isRecord6(body)) return;
89030
88784
  const effectiveClassId = classId ?? inspectedMember.classId;
89031
88785
  if (typeof effectiveClassId !== "string") return;
89032
88786
  const schemaClass2 = classesById2.get(effectiveClassId);
@@ -89046,7 +88800,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89046
88800
  }
89047
88801
  };
89048
88802
  for (const member of members) {
89049
- if (isRecord7(member.defaultValue) && member.defaultValue.init == null) {
88803
+ if (isRecord6(member.defaultValue) && member.defaultValue.init == null) {
89050
88804
  inspectValueBody(
89051
88805
  member,
89052
88806
  member.defaultValue.value,
@@ -89076,7 +88830,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89076
88830
  inspectValueBody(member, placed.value, placed.classId, placed.valueId);
89077
88831
  }
89078
88832
  for (const value of values) {
89079
- if (typeof value.classId !== "string" || !isRecord7(value.value)) {
88833
+ if (typeof value.classId !== "string" || !isRecord6(value.value)) {
89080
88834
  continue;
89081
88835
  }
89082
88836
  const syntheticMember2 = {
@@ -89205,14 +88959,14 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89205
88959
  schemaClass2,
89206
88960
  nextVisiting
89207
88961
  );
89208
- if (!isRecord7(collectionTypeInfo) || collectionTypeInfo.type !== 5 && collectionTypeInfo.type !== 6) {
88962
+ if (!isRecord6(collectionTypeInfo) || collectionTypeInfo.type !== 5 && collectionTypeInfo.type !== 6) {
89209
88963
  return null;
89210
88964
  }
89211
88965
  const entryTypeInfo = substituteTypeInfoForClass(
89212
88966
  resolved.declaredTypeInfo ?? collectionTypeInfo.entryTypeInfo,
89213
88967
  schemaClass2
89214
88968
  );
89215
- if (!isRecord7(entryTypeInfo)) return null;
88969
+ if (!isRecord6(entryTypeInfo)) return null;
89216
88970
  if (resolved.multiselect !== true) {
89217
88971
  return { ...entryTypeInfo, required: required2 };
89218
88972
  }
@@ -89227,7 +88981,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89227
88981
  return { type: resolved.kind, required: required2 };
89228
88982
  };
89229
88983
  const constrainedGenericTypeInfo = (typeInfo) => {
89230
- if (!isRecord7(typeInfo) || typeInfo.type !== 21 || typeof typeInfo.genericParamId !== "string") {
88984
+ if (!isRecord6(typeInfo) || typeInfo.type !== 21 || typeof typeInfo.genericParamId !== "string") {
89231
88985
  return null;
89232
88986
  }
89233
88987
  const constraint = genericParamDeclarationsById.get(
@@ -89281,7 +89035,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89281
89035
  });
89282
89036
  };
89283
89037
  const substituteTypeInfoForClass = (typeInfo, schemaClass2) => {
89284
- if (!isRecord7(typeInfo)) return typeInfo;
89038
+ if (!isRecord6(typeInfo)) return typeInfo;
89285
89039
  if (typeInfo.type === 21 && typeof typeInfo.genericParamId === "string") {
89286
89040
  const bindingId = genericEnvForClass(schemaClass2).get(
89287
89041
  typeInfo.genericParamId
@@ -89298,7 +89052,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
89298
89052
  )
89299
89053
  };
89300
89054
  }
89301
- if (typeInfo.type !== 7 || !isRecord7(typeInfo.typeArguments)) {
89055
+ if (typeInfo.type !== 7 || !isRecord6(typeInfo.typeArguments)) {
89302
89056
  return typeInfo;
89303
89057
  }
89304
89058
  return {
@@ -89488,7 +89242,7 @@ function resolveOpaqueNSFunctionSignature(member, membersById2) {
89488
89242
  return null;
89489
89243
  }
89490
89244
  function assertOpaqueCompiledNSFunctionAction(member, signature) {
89491
- if (!isRecord7(member.action)) {
89245
+ if (!isRecord6(member.action)) {
89492
89246
  throw new Error(`NSFunction "${member.id}" requires compiled action.`);
89493
89247
  }
89494
89248
  if (!Array.isArray(member.action.parameters)) {
@@ -89496,12 +89250,12 @@ function assertOpaqueCompiledNSFunctionAction(member, signature) {
89496
89250
  `NSFunction "${member.id}" compiled action parameters are invalid.`
89497
89251
  );
89498
89252
  }
89499
- if (!Array.isArray(member.action.instructions) || !member.action.instructions.every(isRecord7)) {
89253
+ if (!Array.isArray(member.action.instructions) || !member.action.instructions.every(isRecord6)) {
89500
89254
  throw new Error(
89501
89255
  `NSFunction "${member.id}" compiled action instructions are invalid.`
89502
89256
  );
89503
89257
  }
89504
- if (!isRecord7(member.action.typeInfo)) {
89258
+ if (!isRecord6(member.action.typeInfo)) {
89505
89259
  throw new Error(
89506
89260
  `NSFunction "${member.id}" compiled action return type is invalid.`
89507
89261
  );
@@ -89523,31 +89277,31 @@ function assertOpaqueCompiledNSFunctionAction(member, signature) {
89523
89277
  `NSFunction "${member.id}" compiled action parameter count is stale.`
89524
89278
  );
89525
89279
  }
89526
- if (!isRecord7(parameters[0]) || parameters[0].id !== "__this__") {
89280
+ if (!isRecord6(parameters[0]) || parameters[0].id !== "__this__") {
89527
89281
  throw new Error(
89528
89282
  `NSFunction "${member.id}" compiled action is missing __this__.`
89529
89283
  );
89530
89284
  }
89531
- if (!isRecord7(parameters[1]) || parameters[1].id !== "__root__") {
89285
+ if (!isRecord6(parameters[1]) || parameters[1].id !== "__root__") {
89532
89286
  throw new Error(
89533
89287
  `NSFunction "${member.id}" compiled action is missing __root__.`
89534
89288
  );
89535
89289
  }
89536
89290
  for (let index = 0; index < signature.argumentTypes.length; index += 1) {
89537
89291
  const parameter4 = parameters[index + 2];
89538
- if (!isRecord7(parameter4) || parameter4.id !== `__arg_${index}__`) {
89292
+ if (!isRecord6(parameter4) || parameter4.id !== `__arg_${index}__`) {
89539
89293
  throw new Error(
89540
89294
  `NSFunction "${member.id}" compiled action parameter ${index + 1} is stale.`
89541
89295
  );
89542
89296
  }
89543
- if (!isRecord7(parameter4.typeInfo) || stableTypeInfo(parameter4.typeInfo) !== stableTypeInfo(signature.argumentTypes[index])) {
89297
+ if (!isRecord6(parameter4.typeInfo) || stableTypeInfo(parameter4.typeInfo) !== stableTypeInfo(signature.argumentTypes[index])) {
89544
89298
  throw new Error(
89545
89299
  `NSFunction "${member.id}" compiled action parameter ${index + 1} type is stale.`
89546
89300
  );
89547
89301
  }
89548
89302
  }
89549
89303
  for (const parameter4 of parameters) {
89550
- if (!isRecord7(parameter4) || typeof parameter4.id !== "string" || !isRecord7(parameter4.typeInfo) || !isRecord7(parameter4.pointer)) {
89304
+ if (!isRecord6(parameter4) || typeof parameter4.id !== "string" || !isRecord6(parameter4.typeInfo) || !isRecord6(parameter4.pointer)) {
89551
89305
  throw new Error(
89552
89306
  `NSFunction "${member.id}" compiled action parameter shape is invalid.`
89553
89307
  );
@@ -89555,14 +89309,14 @@ function assertOpaqueCompiledNSFunctionAction(member, signature) {
89555
89309
  }
89556
89310
  }
89557
89311
  function opaquePositionalTypeSignature(typeInfo) {
89558
- if (!isRecord7(typeInfo)) return stableTypeInfo(typeInfo);
89312
+ if (!isRecord6(typeInfo)) return stableTypeInfo(typeInfo);
89559
89313
  const { required: _required, ...rest } = typeInfo;
89560
89314
  void _required;
89561
89315
  return stableTypeInfo(rest);
89562
89316
  }
89563
89317
  function assertOpaqueCompiledConstructorAction(declaredConstructor, argumentTypes) {
89564
89318
  const action = declaredConstructor.action;
89565
- if (!isRecord7(action)) {
89319
+ if (!isRecord6(action)) {
89566
89320
  throw new Error(
89567
89321
  `Constructor "${declaredConstructor.id}" requires a compiled action.`
89568
89322
  );
@@ -89572,12 +89326,12 @@ function assertOpaqueCompiledConstructorAction(declaredConstructor, argumentType
89572
89326
  `Constructor "${declaredConstructor.id}" compiled action parameters are invalid.`
89573
89327
  );
89574
89328
  }
89575
- if (!Array.isArray(action.instructions) || !action.instructions.every(isRecord7)) {
89329
+ if (!Array.isArray(action.instructions) || !action.instructions.every(isRecord6)) {
89576
89330
  throw new Error(
89577
89331
  `Constructor "${declaredConstructor.id}" compiled action instructions are invalid.`
89578
89332
  );
89579
89333
  }
89580
- if (!isRecord7(action.typeInfo)) {
89334
+ if (!isRecord6(action.typeInfo)) {
89581
89335
  throw new Error(
89582
89336
  `Constructor "${declaredConstructor.id}" compiled action return type is invalid.`
89583
89337
  );
@@ -89598,24 +89352,24 @@ function assertOpaqueCompiledConstructorAction(declaredConstructor, argumentType
89598
89352
  `Constructor "${declaredConstructor.id}" compiled action parameter count is stale.`
89599
89353
  );
89600
89354
  }
89601
- if (!isRecord7(parameters[0]) || parameters[0].id !== "__this__") {
89355
+ if (!isRecord6(parameters[0]) || parameters[0].id !== "__this__") {
89602
89356
  throw new Error(
89603
89357
  `Constructor "${declaredConstructor.id}" compiled action is missing __this__.`
89604
89358
  );
89605
89359
  }
89606
- if (!isRecord7(parameters[1]) || parameters[1].id !== "__root__") {
89360
+ if (!isRecord6(parameters[1]) || parameters[1].id !== "__root__") {
89607
89361
  throw new Error(
89608
89362
  `Constructor "${declaredConstructor.id}" compiled action is missing __root__.`
89609
89363
  );
89610
89364
  }
89611
89365
  for (let index = 0; index < argumentTypes.length; index += 1) {
89612
89366
  const parameter4 = parameters[index + 2];
89613
- if (!isRecord7(parameter4) || parameter4.id !== `__arg_${index}__`) {
89367
+ if (!isRecord6(parameter4) || parameter4.id !== `__arg_${index}__`) {
89614
89368
  throw new Error(
89615
89369
  `Constructor "${declaredConstructor.id}" compiled action parameter ${index + 1} is stale.`
89616
89370
  );
89617
89371
  }
89618
- if (!isRecord7(parameter4.typeInfo)) {
89372
+ if (!isRecord6(parameter4.typeInfo)) {
89619
89373
  throw new Error(
89620
89374
  `Constructor "${declaredConstructor.id}" compiled action parameter ${index + 1} has no type.`
89621
89375
  );
@@ -89627,7 +89381,7 @@ function assertOpaqueCompiledConstructorAction(declaredConstructor, argumentType
89627
89381
  }
89628
89382
  }
89629
89383
  for (const parameter4 of parameters) {
89630
- if (!isRecord7(parameter4)) {
89384
+ if (!isRecord6(parameter4)) {
89631
89385
  throw new Error(
89632
89386
  `Constructor "${declaredConstructor.id}" compiled action parameter shape is invalid.`
89633
89387
  );
@@ -89637,7 +89391,7 @@ function assertOpaqueCompiledConstructorAction(declaredConstructor, argumentType
89637
89391
  `Constructor "${declaredConstructor.id}" compiled action parameter is missing an id.`
89638
89392
  );
89639
89393
  }
89640
- if (!isRecord7(parameter4.pointer)) {
89394
+ if (!isRecord6(parameter4.pointer)) {
89641
89395
  throw new Error(
89642
89396
  `Constructor "${declaredConstructor.id}" compiled action parameter "${parameter4.id}" is missing a pointer.`
89643
89397
  );
@@ -89663,7 +89417,7 @@ function assertOpaqueBaseClauseListValid(declaredConstructor, spec) {
89663
89417
  }
89664
89418
  const names = /* @__PURE__ */ new Set();
89665
89419
  for (const entry of authored) {
89666
- if (!isRecord7(entry)) {
89420
+ if (!isRecord6(entry)) {
89667
89421
  throw new Error(
89668
89422
  `Constructor "${declaredConstructor.id}" has a ${spec.entryLabel} that is not an object.`
89669
89423
  );
@@ -89697,7 +89451,7 @@ function assertOpaqueBaseClauseListValid(declaredConstructor, spec) {
89697
89451
  );
89698
89452
  }
89699
89453
  for (const [index, getter] of compiled.entries()) {
89700
- if (!isRecord7(getter)) {
89454
+ if (!isRecord6(getter)) {
89701
89455
  throw new Error(
89702
89456
  `Constructor "${declaredConstructor.id}" compiled ${spec.entryLabel} ${index + 1} is not an object.`
89703
89457
  );
@@ -89712,7 +89466,7 @@ function assertOpaqueBaseClauseListValid(declaredConstructor, spec) {
89712
89466
  `Constructor "${declaredConstructor.id}" compiled ${spec.entryLabel} ${index + 1} instructions are invalid.`
89713
89467
  );
89714
89468
  }
89715
- if (!isRecord7(getter.typeInfo)) {
89469
+ if (!isRecord6(getter.typeInfo)) {
89716
89470
  throw new Error(
89717
89471
  `Constructor "${declaredConstructor.id}" compiled ${spec.entryLabel} ${index + 1} return type is invalid.`
89718
89472
  );
@@ -89770,12 +89524,12 @@ function assertOpaqueConstructorProjectionsDisjoint(declaredConstructor, owner)
89770
89524
  }
89771
89525
  const projected = new Set(
89772
89526
  projections.filter(
89773
- (projection) => isRecord7(projection) && typeof projection.parameterName === "string"
89527
+ (projection) => isRecord6(projection) && typeof projection.parameterName === "string"
89774
89528
  ).map((projection) => projection.parameterName.toLowerCase())
89775
89529
  );
89776
89530
  if (projected.size === 0) return;
89777
89531
  for (const argument2 of declaredConstructor.argumentTypes) {
89778
- if (!isRecord7(argument2) || typeof argument2.name !== "string") continue;
89532
+ if (!isRecord6(argument2) || typeof argument2.name !== "string") continue;
89779
89533
  if (!projected.has(argument2.name.toLowerCase())) continue;
89780
89534
  throw new Error(
89781
89535
  `Constructor "${declaredConstructor.id}" declares parameter "${argument2.name}", which is also a constructor projection argument on class "${owner.id}"; a call site could not tell the two apart.`
@@ -89916,7 +89670,7 @@ function assertOpaqueConstructorsValid(constructors, classesById2) {
89916
89670
  }
89917
89671
  function assertOpaqueMemberDefaultValueValid(member) {
89918
89672
  const defaultValue = member.defaultValue;
89919
- if (!isRecord7(defaultValue)) return;
89673
+ if (!isRecord6(defaultValue)) return;
89920
89674
  const init = defaultValue.init;
89921
89675
  if (init === void 0 || init === null) return;
89922
89676
  if (defaultValue.value !== void 0) {
@@ -89929,7 +89683,7 @@ function assertOpaqueMemberDefaultValueValid(member) {
89929
89683
  `Member "${member.id}" initializer-backed defaultValue cannot declare classId; the concrete class comes from evaluating the initializer.`
89930
89684
  );
89931
89685
  }
89932
- if (!isRecord7(init)) {
89686
+ if (!isRecord6(init)) {
89933
89687
  throw new Error(
89934
89688
  `Member "${member.id}" defaultValue init is not an object.`
89935
89689
  );
@@ -89947,7 +89701,7 @@ function assertOpaqueMemberDefaultValueValid(member) {
89947
89701
  }
89948
89702
  if (init.compiled === void 0) return;
89949
89703
  const compiled = init.compiled;
89950
- if (!isRecord7(compiled)) {
89704
+ if (!isRecord6(compiled)) {
89951
89705
  throw new Error(
89952
89706
  `Member "${member.id}" defaultValue init compiled body is not an object.`
89953
89707
  );
@@ -89957,12 +89711,12 @@ function assertOpaqueMemberDefaultValueValid(member) {
89957
89711
  `Member "${member.id}" defaultValue init compiled parameters are invalid.`
89958
89712
  );
89959
89713
  }
89960
- if (!Array.isArray(compiled.instructions) || !compiled.instructions.every(isRecord7)) {
89714
+ if (!Array.isArray(compiled.instructions) || !compiled.instructions.every(isRecord6)) {
89961
89715
  throw new Error(
89962
89716
  `Member "${member.id}" defaultValue init compiled instructions are invalid.`
89963
89717
  );
89964
89718
  }
89965
- if (!isRecord7(compiled.typeInfo)) {
89719
+ if (!isRecord6(compiled.typeInfo)) {
89966
89720
  throw new Error(
89967
89721
  `Member "${member.id}" defaultValue init compiled return type is invalid.`
89968
89722
  );
@@ -89990,7 +89744,7 @@ function assertOpaqueNSFunctionValid(member, membersById2) {
89990
89744
  }
89991
89745
  const hasUIBody = member.bodyMode === "ui";
89992
89746
  if (hasUIBody) {
89993
- if (!isRecord7(member.uiAction)) {
89747
+ if (!isRecord6(member.uiAction)) {
89994
89748
  throw new Error(`NSFunction "${member.id}" requires a valid UI action.`);
89995
89749
  }
89996
89750
  if (member.code !== void 0) {
@@ -89998,7 +89752,7 @@ function assertOpaqueNSFunctionValid(member, membersById2) {
89998
89752
  `NSFunction "${member.id}" cannot declare code in UI body mode.`
89999
89753
  );
90000
89754
  }
90001
- if (!isRecord7(member.action) || !Array.isArray(member.action.instructions) || !Array.isArray(member.uiAction.instructions) || stableTypeInfo(member.action.instructions) !== stableTypeInfo(member.uiAction.instructions)) {
89755
+ if (!isRecord6(member.action) || !Array.isArray(member.action.instructions) || !Array.isArray(member.uiAction.instructions) || stableTypeInfo(member.action.instructions) !== stableTypeInfo(member.uiAction.instructions)) {
90002
89756
  throw new Error(
90003
89757
  `NSFunction "${member.id}" compiled action must match its UI action.`
90004
89758
  );
@@ -90054,7 +89808,7 @@ function assertOpaqueNSFunctionValid(member, membersById2) {
90054
89808
  if (member.required !== false) {
90055
89809
  throw new Error(`NSFunction "${member.id}" must set required=false.`);
90056
89810
  }
90057
- if (isRecord7(member.returnTypeInfo) && member.returnTypeInfo.type === "Void" && member.returnTypeInfo.required !== true) {
89811
+ if (isRecord6(member.returnTypeInfo) && member.returnTypeInfo.type === "Void" && member.returnTypeInfo.required !== true) {
90058
89812
  throw new Error(
90059
89813
  `NSFunction "${member.id}" Void return type must be required.`
90060
89814
  );
@@ -90141,7 +89895,7 @@ var init_projectInterfaceValidation = __esm({
90141
89895
  });
90142
89896
 
90143
89897
  // ../src/database/project-schema-identifier-validation.ts
90144
- function isRecord8(value) {
89898
+ function isRecord7(value) {
90145
89899
  return typeof value === "object" && value !== null && !Array.isArray(value);
90146
89900
  }
90147
89901
  function assertIdentifier(value, label, predicate) {
@@ -90154,7 +89908,7 @@ function assertArgumentIdentifiers(value, ownerLabel, predicate) {
90154
89908
  if (!Array.isArray(value)) return;
90155
89909
  for (let index = 0; index < value.length; index += 1) {
90156
89910
  const argument2 = value[index];
90157
- if (!isRecord8(argument2)) continue;
89911
+ if (!isRecord7(argument2)) continue;
90158
89912
  assertIdentifier(
90159
89913
  argument2.name,
90160
89914
  `${ownerLabel} parameter ${index + 1} name ${JSON.stringify(argument2.name)}`,
@@ -90163,13 +89917,13 @@ function assertArgumentIdentifiers(value, ownerLabel, predicate) {
90163
89917
  }
90164
89918
  }
90165
89919
  function assertClassIdentifiers(recordId, value) {
90166
- if (!isRecord8(value)) return;
89920
+ if (!isRecord7(value)) return;
90167
89921
  assertIdentifier(
90168
89922
  value.name,
90169
89923
  `Class "${recordId}" name ${JSON.stringify(value.name)}`,
90170
89924
  isValidSchemaAuthoredIdentifier
90171
89925
  );
90172
- if (isRecord8(value.schema)) {
89926
+ if (isRecord7(value.schema)) {
90173
89927
  for (const schemaKey of Object.keys(value.schema)) {
90174
89928
  assertIdentifier(
90175
89929
  schemaKey,
@@ -90181,7 +89935,7 @@ function assertClassIdentifiers(recordId, value) {
90181
89935
  if (!Array.isArray(value.genericParams)) return;
90182
89936
  for (let index = 0; index < value.genericParams.length; index += 1) {
90183
89937
  const parameter4 = value.genericParams[index];
90184
- if (!isRecord8(parameter4)) continue;
89938
+ if (!isRecord7(parameter4)) continue;
90185
89939
  assertIdentifier(
90186
89940
  parameter4.name,
90187
89941
  `Class "${recordId}" generic parameter ${index + 1} name ${JSON.stringify(parameter4.name)}`,
@@ -90190,16 +89944,16 @@ function assertClassIdentifiers(recordId, value) {
90190
89944
  }
90191
89945
  }
90192
89946
  function assertEnumIdentifiers(recordId, value) {
90193
- if (!isRecord8(value)) return;
89947
+ if (!isRecord7(value)) return;
90194
89948
  assertIdentifier(
90195
89949
  value.name,
90196
89950
  `Enum "${recordId}" name ${JSON.stringify(value.name)}`,
90197
89951
  isValidSchemaAuthoredIdentifier
90198
89952
  );
90199
- if (!isRecord8(value.options)) return;
89953
+ if (!isRecord7(value.options)) return;
90200
89954
  const optionIdsByFoldedName = /* @__PURE__ */ new Map();
90201
89955
  for (const [optionId, option] of Object.entries(value.options)) {
90202
- if (!isRecord8(option)) continue;
89956
+ if (!isRecord7(option)) continue;
90203
89957
  if (!isValidEnumOptionId(optionId)) {
90204
89958
  throw new Error(
90205
89959
  `Enum "${recordId}" option id ${JSON.stringify(optionId)} must be an RFC 4122 UUID.`
@@ -90226,20 +89980,20 @@ function assertEnumIdentifiers(recordId, value) {
90226
89980
  }
90227
89981
  }
90228
89982
  function assertInterfaceIdentifiers(recordId, value) {
90229
- if (!isRecord8(value)) return;
89983
+ if (!isRecord7(value)) return;
90230
89984
  assertIdentifier(
90231
89985
  value.name,
90232
89986
  `Interface "${recordId}" name ${JSON.stringify(value.name)}`,
90233
89987
  isValidSchemaAuthoredIdentifier
90234
89988
  );
90235
- if (!isRecord8(value.members)) return;
89989
+ if (!isRecord7(value.members)) return;
90236
89990
  for (const [memberKey, member] of Object.entries(value.members)) {
90237
89991
  assertIdentifier(
90238
89992
  memberKey,
90239
89993
  `Interface "${recordId}" member name ${JSON.stringify(memberKey)}`,
90240
89994
  isValidSchemaMemberIdentifier
90241
89995
  );
90242
- if (!isRecord8(member) || member.kind !== "function") continue;
89996
+ if (!isRecord7(member) || member.kind !== "function") continue;
90243
89997
  assertArgumentIdentifiers(
90244
89998
  member.argumentTypes,
90245
89999
  `Interface "${recordId}" function "${memberKey}"`,
@@ -90253,7 +90007,7 @@ function isCallableOrPropertyMemberKind(value) {
90253
90007
  );
90254
90008
  }
90255
90009
  function assertMemberIdentifiers(recordId, value, directlyAuthoredMemberIds) {
90256
- if (!isRecord8(value)) return;
90010
+ if (!isRecord7(value)) return;
90257
90011
  if (directlyAuthoredMemberIds.has(recordId) || isCallableOrPropertyMemberKind(value)) {
90258
90012
  assertIdentifier(
90259
90013
  value.name,
@@ -90277,7 +90031,7 @@ function assertSchemaIdentifierWriteChangesValid(changes, directlyAuthoredMember
90277
90031
  assertClassIdentifiers(change.input.recordId, change.storedNextData);
90278
90032
  } else if (kind === "enum") {
90279
90033
  assertEnumIdentifiers(change.input.recordId, change.storedNextData);
90280
- if (isRecord8(change.storedNextData) && isRecord8(change.storedNextData.options)) {
90034
+ if (isRecord7(change.storedNextData) && isRecord7(change.storedNextData.options)) {
90281
90035
  for (const optionId of Object.keys(change.storedNextData.options)) {
90282
90036
  const owner = enumOptionOwners.get(optionId);
90283
90037
  if (owner !== void 0 && owner !== change.input.recordId) {
@@ -90307,6 +90061,46 @@ var init_project_schema_identifier_validation = __esm({
90307
90061
  }
90308
90062
  });
90309
90063
 
90064
+ // ../src/database/constructor-parameter-settlement.ts
90065
+ function constructorSettledSchemaEntry(view, classId, parameterName) {
90066
+ const membersById2 = new Map(
90067
+ view.members.map((member) => [member.id, member])
90068
+ );
90069
+ const visited = /* @__PURE__ */ new Set();
90070
+ let currentId = classId;
90071
+ while (currentId !== null && !visited.has(currentId)) {
90072
+ visited.add(currentId);
90073
+ const schemaClass2 = view.classes.find(
90074
+ (candidate) => candidate.id === currentId
90075
+ );
90076
+ if (schemaClass2 === void 0) return null;
90077
+ for (const [schemaKey, memberId] of Object.entries(
90078
+ schemaClass2.schema ?? {}
90079
+ )) {
90080
+ if (typeof memberId !== "string") continue;
90081
+ const member = membersById2.get(memberId);
90082
+ const defaultRecord = asRecord(member?.defaultValue);
90083
+ const initRecord = asRecord(defaultRecord?.init);
90084
+ if (initRecord !== null && typeof initRecord.code === "string" && initRecord.code.trim() === parameterName) {
90085
+ return { schemaKey, memberId };
90086
+ }
90087
+ }
90088
+ currentId = schemaClass2.extendsClassId ?? null;
90089
+ }
90090
+ return null;
90091
+ }
90092
+ function asRecord(value) {
90093
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
90094
+ return null;
90095
+ }
90096
+ return value;
90097
+ }
90098
+ var init_constructor_parameter_settlement = __esm({
90099
+ "../src/database/constructor-parameter-settlement.ts"() {
90100
+ "use strict";
90101
+ }
90102
+ });
90103
+
90310
90104
  // ../src/database/project-document-value-overlay.ts
90311
90105
  function overlayCreatedValues(documentValues, createdValues) {
90312
90106
  if (createdValues.length === 0) return [...documentValues];
@@ -90752,7 +90546,7 @@ function validateCreatedMigrationGraph(args) {
90752
90546
  if (row.value === null && member !== void 0 && isMemberClassBase(member) && !member.required) {
90753
90547
  return;
90754
90548
  }
90755
- if (!isRecord9(row.value)) {
90549
+ if (!isRecord8(row.value)) {
90756
90550
  throw graphError(
90757
90551
  args,
90758
90552
  `Class value "${valueId}" does not contain a record`
@@ -90818,7 +90612,7 @@ function validateCreatedMigrationGraph(args) {
90818
90612
  `Dictionary value "${valueId}" references missing entry member "${member.entryMemberId}"`
90819
90613
  );
90820
90614
  }
90821
- if (!isRecord9(row.value)) {
90615
+ if (!isRecord8(row.value)) {
90822
90616
  throw graphError(args, `Dictionary value "${valueId}" is not a record`);
90823
90617
  }
90824
90618
  for (const [key, childId] of Object.entries(row.value)) {
@@ -90862,7 +90656,7 @@ function validateCreatedMigrationGraph(args) {
90862
90656
  }
90863
90657
  return [...createdById.values()];
90864
90658
  }
90865
- function isRecord9(value) {
90659
+ function isRecord8(value) {
90866
90660
  return typeof value === "object" && value !== null && !Array.isArray(value);
90867
90661
  }
90868
90662
  function graphError(args, detail) {
@@ -91811,7 +91605,6 @@ var init_general_function_call_ir_source_recompile = __esm({
91811
91605
  init_core();
91812
91606
  init_dialogue();
91813
91607
  init_inheritance();
91814
- init_project_record_migrations();
91815
91608
  init_project_content_hash();
91816
91609
  init_project_document_read();
91817
91610
  init_compile_ns_property();
@@ -91884,7 +91677,6 @@ function valueCreateCannotAffectClassRelations(change, before) {
91884
91677
  function relationEndpointClassId(record3) {
91885
91678
  if (!isPlainRecord(record3)) return void 0;
91886
91679
  if (typeof record3.classId === "string") return record3.classId;
91887
- if (typeof record3.typeId === "string") return record3.typeId;
91888
91680
  return void 0;
91889
91681
  }
91890
91682
  function isPlainRecord(value) {
@@ -93628,8 +93420,8 @@ function attachPreparedConstructorAggregateEdges(prepared, document) {
93628
93420
  );
93629
93421
  if (valueChanges.length === 0) return;
93630
93422
  const needsGraph = valueChanges.some((change) => {
93631
- const constructorArgs = asRecord(
93632
- asRecord(change.nextData)?.constructorArgs
93423
+ const constructorArgs = asRecord2(
93424
+ asRecord2(change.nextData)?.constructorArgs
93633
93425
  );
93634
93426
  return constructorArgs !== null && Object.keys(constructorArgs).length > 0;
93635
93427
  });
@@ -93969,14 +93761,11 @@ function reconcileInitializerMaterializationTransport(args) {
93969
93761
  }
93970
93762
  }
93971
93763
  function constructorArgumentsSemanticallyEqual(args) {
93972
- let currentRows = args.currentGraph.valuesById;
93973
- if (isLiteralValueContent(args.currentRoot) && carriesCompleteConstructionRecipe(args.currentRoot)) {
93974
- currentRows = resolvedStoredInstanceRows({
93975
- document: args.currentDocument,
93976
- instanceRoot: args.currentRoot,
93977
- rootMember: args.rootMember
93978
- });
93979
- }
93764
+ const currentRows = resolvedStoredInstanceRows({
93765
+ document: args.currentDocument,
93766
+ instanceRoot: args.currentRoot,
93767
+ rootMember: args.rootMember
93768
+ });
93980
93769
  const replayRows = new Map(args.currentGraph.valuesById);
93981
93770
  replayRows.set(args.replayRoot.id, args.replayRoot);
93982
93771
  for (const row of args.replayCreated) replayRows.set(row.id, row);
@@ -94016,7 +93805,7 @@ function localizedTextCreateEnvelopeConfig(args) {
94016
93805
  (change) => change.recordKind === "localization-config"
94017
93806
  );
94018
93807
  if (configChange?.operation === "delete") return null;
94019
- const candidate = asRecord(
93808
+ const candidate = asRecord2(
94020
93809
  configChange?.nextData ?? args.document.localizationConfig
94021
93810
  );
94022
93811
  if (candidate === null) return null;
@@ -94282,7 +94071,7 @@ function removeDirectBindingsFromReadOnlySourceTransitions(currentDocument, chan
94282
94071
  continue;
94283
94072
  }
94284
94073
  const current = currentMembers.get(change.recordId);
94285
- const next = asRecord(change.nextData);
94074
+ const next = asRecord2(change.nextData);
94286
94075
  if (current === void 0 || next === null) continue;
94287
94076
  if (current.isAbstract === true || next.isAbstract === true) continue;
94288
94077
  if (current.isReadOnly === true || next.isReadOnly !== true) continue;
@@ -94641,7 +94430,7 @@ function prepareServerOwnedDialogueBodies(args) {
94641
94430
  }
94642
94431
  if (change.recordKind === "dialogue-node") {
94643
94432
  explicitNodeIds.add(change.recordId);
94644
- const next = asRecord(change.nextData);
94433
+ const next = asRecord2(change.nextData);
94645
94434
  const current = currentNodes.get(change.recordId);
94646
94435
  const dialogueId = typeof next?.dialogueId === "string" ? next.dialogueId : typeof current?.dialogueId === "string" ? current.dialogueId : null;
94647
94436
  if (dialogueId !== null) changedDialogueIds.add(dialogueId);
@@ -95484,7 +95273,10 @@ function materializeAuthoredStaticSeed(args) {
95484
95273
  args.document.classes
95485
95274
  ),
95486
95275
  replaceExistingIds: existingValueIds,
95487
- sparseConstructionRoot: carriesSparseConstructionRecipe(
95276
+ // A seed body may be sparse exactly when its provenance can replay the
95277
+ // omitted members. {@link carriesCompleteConstructionRecipe} is that one
95278
+ // question, asked here with the same answer the readers give.
95279
+ sparseConstructionRoot: carriesCompleteConstructionRecipe(
95488
95280
  seedRootRow(args.member, args.seed, requestedRootId)
95489
95281
  )
95490
95282
  });
@@ -95688,10 +95480,8 @@ function materializeAuthoredSeedRow(args) {
95688
95480
  args.createdValues.push(initRow);
95689
95481
  return initRow;
95690
95482
  }
95691
- const rowCarriesSparseConstructionRecipe = carriesSparseConstructionRecipe(
95692
- args.row
95693
- );
95694
- const belongsToSparseConstruction = args.sparseConstructionRoot || rowCarriesSparseConstructionRecipe;
95483
+ const rowCarriesCompleteConstructionRecipe = carriesCompleteConstructionRecipe(args.row);
95484
+ const belongsToSparseConstruction = args.sparseConstructionRoot || rowCarriesCompleteConstructionRecipe;
95695
95485
  if (isMemberClassBase(resolvedStoredMember) && args.row.value !== null && !belongsToSparseConstruction) {
95696
95486
  return materializeLegacyAuthoredClassSeedRow({
95697
95487
  args,
@@ -95703,10 +95493,17 @@ function materializeAuthoredSeedRow(args) {
95703
95493
  projectId: args.document.project.id,
95704
95494
  value: structuredClone(args.row.value),
95705
95495
  ...typeof args.row.classId !== "string" ? {} : { classId: args.row.classId },
95706
- ...isMemberClassBase(resolvedStoredMember) && args.row.value !== null && rowCarriesSparseConstructionRecipe ? {
95496
+ ...isMemberClassBase(resolvedStoredMember) && args.row.value !== null && rowCarriesCompleteConstructionRecipe ? {
95707
95497
  constructorArgs: structuredClone(args.row.constructorArgs ?? {}),
95708
95498
  instanceConstructorId: args.row.instanceConstructorId ?? null
95709
- } : args.row.constructorArgs === void 0 ? {} : { constructorArgs: structuredClone(args.row.constructorArgs) },
95499
+ } : args.row.constructorArgs === void 0 ? {} : {
95500
+ constructorArgs: structuredClone(args.row.constructorArgs),
95501
+ // Creation data without the constructor that consumed it is a
95502
+ // recipe no reader classifies as one. The class arm above pairs
95503
+ // them; this arm — a non-class member, or a null body — must not
95504
+ // let a seed drop half the stamp on its way to storage.
95505
+ instanceConstructorId: args.row.instanceConstructorId ?? null
95506
+ },
95710
95507
  ...args.row.instanceVariantId === void 0 ? {} : { instanceVariantId: args.row.instanceVariantId },
95711
95508
  ...args.row.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: args.row.instanceVariantRowValueId },
95712
95509
  ...args.row.containerId === void 0 ? {} : { containerId: args.row.containerId },
@@ -95744,9 +95541,6 @@ function materializeAuthoredSeedRow(args) {
95744
95541
  }
95745
95542
  return generatedRoot;
95746
95543
  }
95747
- function carriesSparseConstructionRecipe(row) {
95748
- return row.constructorArgs !== void 0 || Object.hasOwn(row, "instanceConstructorId") || Object.hasOwn(row, "instanceVariantId") || Object.hasOwn(row, "instanceVariantRowValueId");
95749
- }
95750
95544
  function materializeLegacyAuthoredClassSeedRow(input) {
95751
95545
  const { args, member } = input;
95752
95546
  if (!isStringValueRecord(args.row.value)) {
@@ -96287,8 +96081,120 @@ function delegateValueRow(value) {
96287
96081
  }
96288
96082
  return typeof value.value.code === "string" ? value : null;
96289
96083
  }
96084
+ function inlineDelegateArgumentRow(value) {
96085
+ if (!isMemberValue(value) || !isLiteralValueContent(value)) return null;
96086
+ const constructorArgs = asRecord2(
96087
+ value.constructorArgs
96088
+ );
96089
+ if (constructorArgs === null) return null;
96090
+ for (const argument2 of Object.values(constructorArgs)) {
96091
+ if (isUncompiledInlineDelegateArgument(argument2)) {
96092
+ return value;
96093
+ }
96094
+ }
96095
+ return null;
96096
+ }
96097
+ function isUncompiledInlineDelegateArgument(argument2) {
96098
+ const closure = asRecord2(argument2);
96099
+ if (closure === null) return false;
96100
+ if (typeof closure.code !== "string") return false;
96101
+ return !("action" in closure);
96102
+ }
96103
+ function compileInlineDelegateConstructorArguments(args) {
96104
+ const { document, row, ownerMember, rootOwner } = args;
96105
+ const constructorArgs = asRecord2(row.constructorArgs);
96106
+ if (constructorArgs === null) {
96107
+ throw new Error(
96108
+ `Value "${row.id}" was collected for inline delegate compilation without constructor arguments.`
96109
+ );
96110
+ }
96111
+ const classId = row.classId;
96112
+ if (typeof classId !== "string") {
96113
+ throw new Error(
96114
+ `Value "${row.id}" carries inline delegate constructor arguments but no class id.`
96115
+ );
96116
+ }
96117
+ const schemaClass2 = document.classes.find(
96118
+ (candidate) => candidate.id === classId
96119
+ );
96120
+ if (schemaClass2 === void 0) {
96121
+ throw new Error(
96122
+ `Value "${row.id}" inline delegate compilation cannot find class "${classId}".`
96123
+ );
96124
+ }
96125
+ const rowConstructorId = row.instanceConstructorId;
96126
+ const constructorId = typeof rowConstructorId === "string" ? rowConstructorId : schemaClass2.requiredConstructorId ?? null;
96127
+ const constructorRecord = (document.constructors ?? []).find(
96128
+ (candidate) => candidate.id === constructorId
96129
+ );
96130
+ if (constructorRecord === void 0) {
96131
+ throw new Error(
96132
+ `Value "${row.id}" inline delegate compilation cannot find constructor "${constructorId ?? "none"}" on class "${schemaClass2.name}".`
96133
+ );
96134
+ }
96135
+ const ownerClassArguments = asRecord2(
96136
+ ownerMember?.classArguments
96137
+ );
96138
+ const env = resolveInstanceEnv(
96139
+ classId,
96140
+ ownerClassArguments === null ? void 0 : ownerClassArguments,
96141
+ document.classes
96142
+ );
96143
+ const thisClass = findSchemaPlacement(rootOwner?.id ?? "", document.classes)?.ownerClass ?? null;
96144
+ const compiled = { ...constructorArgs };
96145
+ for (const [argumentKey, argument2] of Object.entries(constructorArgs)) {
96146
+ if (!isUncompiledInlineDelegateArgument(argument2)) continue;
96147
+ const match = /^__arg_(\d+)__$/.exec(argumentKey);
96148
+ if (match === null) {
96149
+ throw new Error(
96150
+ `Value "${row.id}" stores an inline delegate under argument key "${argumentKey}", which is not positional.`
96151
+ );
96152
+ }
96153
+ const parameter4 = constructorRecord.argumentTypes[Number(match[1])];
96154
+ if (parameter4 === void 0) {
96155
+ throw new Error(
96156
+ `Value "${row.id}" inline delegate argument "${argumentKey}" names no parameter of constructor "${constructorRecord.id}".`
96157
+ );
96158
+ }
96159
+ const settled = constructorSettledSchemaEntry(
96160
+ document,
96161
+ classId,
96162
+ parameter4.name
96163
+ );
96164
+ const settledMember = document.members.find(
96165
+ (candidate) => candidate.id === settled?.memberId
96166
+ );
96167
+ if (!isMemberDelegateBase(settledMember)) {
96168
+ throw new Error(
96169
+ `Value "${row.id}" inline delegate argument "${argumentKey}" settles "${parameter4.name}", which is not a NeoDelegate member of class "${schemaClass2.name}".`
96170
+ );
96171
+ }
96172
+ const substituted = substituteMember(
96173
+ settledMember,
96174
+ env,
96175
+ document.members
96176
+ );
96177
+ compiled[argumentKey] = compileDelegateClosureValue(argument2.code, {
96178
+ project: document.project,
96179
+ projectFiles: document.projectFiles,
96180
+ members: document.members,
96181
+ classes: document.classes,
96182
+ enums: document.enums,
96183
+ interfaces: document.interfaces,
96184
+ constructors: document.constructors ?? [],
96185
+ variants: document.variants ?? [],
96186
+ variantFolders: document.variantFolders ?? [],
96187
+ thisClass,
96188
+ returnTypeInfo: substituted.returnTypeInfo,
96189
+ argumentTypes: substituted.argumentTypes,
96190
+ name: `${settledMember.name} argument`
96191
+ });
96192
+ }
96193
+ return compiled;
96194
+ }
96290
96195
  function prepareServerOwnedDelegateValueBodies(args) {
96291
96196
  const explicitRows = /* @__PURE__ */ new Map();
96197
+ const inlineArgumentRows = /* @__PURE__ */ new Map();
96292
96198
  for (let index = 0; index < args.prepared.length; index += 1) {
96293
96199
  const change = args.prepared[index];
96294
96200
  if (change?.recordKind !== "value" || change.operation === "delete") {
@@ -96296,14 +96202,21 @@ function prepareServerOwnedDelegateValueBodies(args) {
96296
96202
  }
96297
96203
  const row = delegateValueRow(change.nextData);
96298
96204
  if (row !== null) explicitRows.set(index, row);
96205
+ const withInlineArgs = inlineDelegateArgumentRow(change.nextData);
96206
+ if (withInlineArgs !== null) inlineArgumentRows.set(index, withInlineArgs);
96299
96207
  }
96300
96208
  const sweepRows = collectDelegateSweepRows(args);
96301
- if (explicitRows.size === 0 && sweepRows.length === 0) return;
96209
+ if (explicitRows.size === 0 && sweepRows.length === 0 && inlineArgumentRows.size === 0) {
96210
+ return;
96211
+ }
96302
96212
  const committedDocument = applyProjectVersionWriteChanges(
96303
96213
  args.postDocument,
96304
96214
  args.prepared
96305
96215
  );
96306
- const targetIds = valueIdsFromRows(explicitRows.values(), sweepRows);
96216
+ const targetIds = valueIdsFromRows(
96217
+ [...explicitRows.values(), ...inlineArgumentRows.values()],
96218
+ sweepRows
96219
+ );
96307
96220
  const rootOwnerByValueId = /* @__PURE__ */ new Map();
96308
96221
  const delegateScope = withVariantOwnershipRoots(
96309
96222
  committedDocument,
@@ -96359,6 +96272,23 @@ function prepareServerOwnedDelegateValueBodies(args) {
96359
96272
  args.prepared[index] = { ...change, nextData: compiled };
96360
96273
  }
96361
96274
  }
96275
+ for (const [index, row] of inlineArgumentRows) {
96276
+ const ownerMember = ownerByValueId.get(row.id);
96277
+ const rootOwner = rootOwnerByValueId.get(row.id);
96278
+ const compiledArgs = compileInlineDelegateConstructorArguments({
96279
+ document: delegateScope.document,
96280
+ row,
96281
+ ownerMember,
96282
+ rootOwner: rootOwner ?? null
96283
+ });
96284
+ const change = args.prepared[index];
96285
+ if (change !== void 0) {
96286
+ args.prepared[index] = {
96287
+ ...change,
96288
+ nextData: { ...row, constructorArgs: compiledArgs }
96289
+ };
96290
+ }
96291
+ }
96362
96292
  if (sweepRows.length === 0) return;
96363
96293
  const currentById = new Map(
96364
96294
  args.document.values.map((value) => [value.id, value])
@@ -96642,7 +96572,7 @@ function assertUniqueChanges(changes) {
96642
96572
  }
96643
96573
  keys.add(key);
96644
96574
  if (change.operation !== "delete") {
96645
- const nextData = asRecord(change.nextData);
96575
+ const nextData = asRecord2(change.nextData);
96646
96576
  if (nextData === null) {
96647
96577
  throw new Error(`Schema commit change "${key}" requires nextData.`);
96648
96578
  }
@@ -96659,45 +96589,46 @@ function cloneAndStripClientDerivedBodies(change) {
96659
96589
  return { ...change };
96660
96590
  }
96661
96591
  if (change.recordKind === "migration") {
96662
- const nextData2 = asRecord(change.nextData);
96592
+ const nextData2 = asRecord2(change.nextData);
96663
96593
  return {
96664
96594
  ...change,
96665
96595
  nextData: nextData2 === null ? change.nextData : stripMigrationAction(nextData2)
96666
96596
  };
96667
96597
  }
96668
96598
  if (change.recordKind === "dialogue-node") {
96669
- const nextData2 = asRecord(change.nextData);
96599
+ const nextData2 = asRecord2(change.nextData);
96670
96600
  return {
96671
96601
  ...change,
96672
96602
  nextData: nextData2 === null ? change.nextData : stripDialogueNodeDerivedBodies(nextData2)
96673
96603
  };
96674
96604
  }
96675
96605
  if (change.recordKind === "dialogue-group") {
96676
- const nextData2 = asRecord(change.nextData);
96606
+ const nextData2 = asRecord2(change.nextData);
96677
96607
  return {
96678
96608
  ...change,
96679
96609
  nextData: nextData2 === null ? change.nextData : stripDialogueGroupDerivedBodies(nextData2)
96680
96610
  };
96681
96611
  }
96682
96612
  if (change.recordKind === "constructor") {
96683
- const nextData2 = asRecord(change.nextData);
96613
+ const nextData2 = asRecord2(change.nextData);
96684
96614
  return {
96685
96615
  ...change,
96686
96616
  nextData: nextData2 === null ? change.nextData : stripConstructorDerivedBodies(nextData2)
96687
96617
  };
96688
96618
  }
96689
96619
  if (change.recordKind === "value") {
96690
- const nextData2 = asRecord(change.nextData);
96620
+ const nextData2 = asRecord2(change.nextData);
96691
96621
  if (nextData2 === null) return { ...change, nextData: change.nextData };
96692
96622
  const stripped = { ...nextData2 };
96693
96623
  stripInitializerCompanion(stripped, "init");
96694
96624
  stripDelegateClosureCompanion(stripped, "value");
96625
+ stripInlineDelegateArgumentCompanions(stripped);
96695
96626
  return { ...change, nextData: stripped };
96696
96627
  }
96697
96628
  if (change.recordKind !== "member") {
96698
96629
  return { ...change, nextData: change.nextData };
96699
96630
  }
96700
- const nextData = asRecord(change.nextData);
96631
+ const nextData = asRecord2(change.nextData);
96701
96632
  if (nextData === null) return { ...change, nextData: change.nextData };
96702
96633
  return {
96703
96634
  ...change,
@@ -96710,8 +96641,8 @@ function stripDialogueNodeDerivedBodies(node) {
96710
96641
  stripTextVariableCompanions(next.variables);
96711
96642
  if (Array.isArray(next.actions)) {
96712
96643
  for (const actionValue2 of next.actions) {
96713
- const action = asRecord(actionValue2);
96714
- const logic = asRecord(action?.logic);
96644
+ const action = asRecord2(actionValue2);
96645
+ const logic = asRecord2(action?.logic);
96715
96646
  if (logic?.type === 1 && typeof logic.code === "string") {
96716
96647
  delete logic.action;
96717
96648
  }
@@ -96719,17 +96650,17 @@ function stripDialogueNodeDerivedBodies(node) {
96719
96650
  }
96720
96651
  if (Array.isArray(next.outcomes)) {
96721
96652
  for (const outcomeValue of next.outcomes) {
96722
- const outcome = asRecord(outcomeValue);
96653
+ const outcome = asRecord2(outcomeValue);
96723
96654
  if (outcome !== null) stripConditionCompanions(outcome.conditions);
96724
96655
  }
96725
96656
  }
96726
- const optionSettings = asRecord(next.optionSettings);
96657
+ const optionSettings = asRecord2(next.optionSettings);
96727
96658
  if (Array.isArray(optionSettings?.options)) {
96728
96659
  for (const optionValue of optionSettings.options) {
96729
- const option = asRecord(optionValue);
96660
+ const option = asRecord2(optionValue);
96730
96661
  if (option === null) continue;
96731
96662
  stripTextVariableCompanions(option.variables);
96732
- const settings = asRecord(option.settings);
96663
+ const settings = asRecord2(option.settings);
96733
96664
  if (settings === null) continue;
96734
96665
  stripConditionCompanions(settings.conditions);
96735
96666
  stripConditionCompanions(settings.selectableConditions);
@@ -96745,17 +96676,17 @@ function stripDialogueGroupDerivedBodies(group) {
96745
96676
  function stripConditionCompanions(value) {
96746
96677
  if (!Array.isArray(value)) return;
96747
96678
  for (const conditionValue of value) {
96748
- const condition = asRecord(conditionValue);
96679
+ const condition = asRecord2(conditionValue);
96749
96680
  if (condition?.type === 1 && typeof condition.code === "string") {
96750
96681
  delete condition.getter;
96751
96682
  }
96752
96683
  }
96753
96684
  }
96754
96685
  function stripTextVariableCompanions(value) {
96755
- const variables = asRecord(value);
96686
+ const variables = asRecord2(value);
96756
96687
  if (variables === null) return;
96757
96688
  for (const variableValue of Object.values(variables)) {
96758
- const variable2 = asRecord(variableValue);
96689
+ const variable2 = asRecord2(variableValue);
96759
96690
  if (variable2 !== null && typeof variable2.code === "string") {
96760
96691
  delete variable2.getter;
96761
96692
  }
@@ -96776,10 +96707,27 @@ function stripDerivedBodies(member) {
96776
96707
  stripInitializerCompanion(next, "defaultValue");
96777
96708
  return next;
96778
96709
  }
96710
+ function stripInlineDelegateArgumentCompanions(record3) {
96711
+ const constructorArgs = asRecord2(record3.constructorArgs);
96712
+ if (constructorArgs === null) return;
96713
+ let changed = false;
96714
+ const stripped = { ...constructorArgs };
96715
+ for (const [key, argument2] of Object.entries(constructorArgs)) {
96716
+ const closure = asRecord2(argument2);
96717
+ if (closure === null) continue;
96718
+ if (typeof closure.code !== "string") continue;
96719
+ if (!("action" in closure)) continue;
96720
+ const authored = { ...closure };
96721
+ delete authored.action;
96722
+ stripped[key] = authored;
96723
+ changed = true;
96724
+ }
96725
+ if (changed) record3.constructorArgs = stripped;
96726
+ }
96779
96727
  function stripDelegateClosureCompanion(record3, field) {
96780
- const container = field === "value" ? record3 : asRecord(record3.defaultValue);
96728
+ const container = field === "value" ? record3 : asRecord2(record3.defaultValue);
96781
96729
  if (container === null) return;
96782
- const delegate = asRecord(container.value);
96730
+ const delegate = asRecord2(container.value);
96783
96731
  if (delegate === null || typeof delegate.code !== "string") return;
96784
96732
  if (!("action" in delegate)) return;
96785
96733
  const authoredDelegate = { ...delegate };
@@ -96791,9 +96739,9 @@ function stripDelegateClosureCompanion(record3, field) {
96791
96739
  record3.defaultValue = { ...container, value: authoredDelegate };
96792
96740
  }
96793
96741
  function stripInitializerCompanion(record3, field) {
96794
- const container = field === "init" ? record3 : asRecord(record3.defaultValue);
96742
+ const container = field === "init" ? record3 : asRecord2(record3.defaultValue);
96795
96743
  if (container === null) return;
96796
- const init = asRecord(container.init);
96744
+ const init = asRecord2(container.init);
96797
96745
  if (init === null) return;
96798
96746
  const authoredInit = { ...init };
96799
96747
  delete authoredInit.compiled;
@@ -96928,7 +96876,7 @@ function applyArrayChanges(current, changes, recordKind) {
96928
96876
  }
96929
96877
  return [...byId.values()];
96930
96878
  }
96931
- function asRecord(value) {
96879
+ function asRecord2(value) {
96932
96880
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
96933
96881
  return null;
96934
96882
  }
@@ -96939,9 +96887,6 @@ function requiredRecordString(value, field, label) {
96939
96887
  if (typeof candidate === "string" && candidate.length > 0) return candidate;
96940
96888
  throw new Error(`${label} requires a non-empty ${field}.`);
96941
96889
  }
96942
- function canonicallyEqual2(left, right) {
96943
- return canonicalJsonStringify(left) === canonicalJsonStringify(right);
96944
- }
96945
96890
  function reconcileVariantConstructorArgs(args) {
96946
96891
  const changeIndexByValueId = indexChangesByRecordId(args.prepared, "value");
96947
96892
  const commitTouchesProjectionSchema = variantConstructorArgsSchemaIsTouched(
@@ -97035,9 +96980,14 @@ function reconcileVariantConstructorArgs(args) {
97035
96980
  if (canonicallyEqual2(rowValue, defaultValue)) continue;
97036
96981
  nextArgs[parameterId] = rowValue;
97037
96982
  }
97038
- const changed = !canonicallyEqual2(existingArgs, nextArgs);
96983
+ const stampIsMissing = root.instanceConstructorId === void 0;
96984
+ const changed = stampIsMissing || !canonicallyEqual2(existingArgs, nextArgs);
97039
96985
  if (!changed) continue;
97040
- const nextRoot = { ...root, constructorArgs: nextArgs };
96986
+ const nextRoot = {
96987
+ ...root,
96988
+ constructorArgs: nextArgs,
96989
+ ...stampIsMissing ? { instanceConstructorId: constructorId } : {}
96990
+ };
97041
96991
  const existingIndex = changeIndexByValueId.get(root.id);
97042
96992
  if (existingIndex !== void 0) {
97043
96993
  const change = args.prepared[existingIndex];
@@ -97139,6 +97089,7 @@ var init_project_version_schema_commit = __esm({
97139
97089
  init_core();
97140
97090
  init_member_storage_key();
97141
97091
  init_world_content_sidecar_validation();
97092
+ init_constructor_parameter_settlement();
97142
97093
  init_project_document_value_overlay();
97143
97094
  init_project2();
97144
97095
  init_member_access_modifier_validation();
@@ -97146,6 +97097,7 @@ var init_project_version_schema_commit = __esm({
97146
97097
  init_variants2();
97147
97098
  init_localization2();
97148
97099
  init_internal_record_relations();
97100
+ init_canonical_json();
97149
97101
  init_project_content_hash();
97150
97102
  init_compile_ns_property();
97151
97103
  init_compiler_adapter();
@@ -102632,6 +102584,23 @@ function variantReconstructedFields(context, row) {
102632
102584
  }
102633
102585
  function mergedOverStoredRow(base, lowered) {
102634
102586
  const merged = { ...valueFileFields(base), ...lowered };
102587
+ const storedArgs = isObjectRecord2(base.constructorArgs) ? base.constructorArgs : null;
102588
+ const loweredArgs = isObjectRecord2(merged.constructorArgs) ? merged.constructorArgs : null;
102589
+ if (storedArgs !== null && loweredArgs !== null) {
102590
+ let preserved = null;
102591
+ for (const [key, argument2] of Object.entries(loweredArgs)) {
102592
+ if (!isObjectRecord2(argument2)) continue;
102593
+ if (typeof argument2.code !== "string") continue;
102594
+ if ("action" in argument2) continue;
102595
+ const stored = storedArgs[key];
102596
+ if (!isObjectRecord2(stored)) continue;
102597
+ if (stored.code !== argument2.code) continue;
102598
+ if (!("action" in stored)) continue;
102599
+ preserved ??= { ...loweredArgs };
102600
+ preserved[key] = stored;
102601
+ }
102602
+ if (preserved !== null) merged.constructorArgs = preserved;
102603
+ }
102635
102604
  if (lowered.init === void 0) {
102636
102605
  const { init: _init, ...literal2 } = merged;
102637
102606
  void _init;
@@ -102871,6 +102840,7 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
102871
102840
  continue;
102872
102841
  }
102873
102842
  const rootValueId = pendingValueId(binding, `${label}.default`);
102843
+ const pendingValueIdsBeforeSeed = new Set(context.pendingValues.keys());
102874
102844
  const seed = lowerStaticSeed(
102875
102845
  context,
102876
102846
  member,
@@ -102883,6 +102853,18 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
102883
102853
  `Member default ${label} was classified as an owned literal graph but lowered as an initializer.`
102884
102854
  );
102885
102855
  }
102856
+ if (storedDefault !== null && canonicallyEqual(seed.value, storedDefault.value) && (seed.classId ?? null) === (typeof storedDefaultClassId === "string" ? storedDefaultClassId : null) && (seed.values === void 0 || seed.values.length === 0) && (seed.bindingMembers === void 0 || seed.bindingMembers.length === 0) && (seed.localizedTexts === void 0 || seed.localizedTexts.length === 0)) {
102857
+ for (const id2 of context.pendingValues.keys()) {
102858
+ if (!pendingValueIdsBeforeSeed.has(id2)) {
102859
+ context.pendingValues.delete(id2);
102860
+ }
102861
+ }
102862
+ memberDefaultValues.set(memberId, {
102863
+ value: storedDefault.value,
102864
+ classId: typeof storedDefaultClassId === "string" ? storedDefaultClassId : null
102865
+ });
102866
+ continue;
102867
+ }
102886
102868
  seeds.set(memberId, { ...seed, valueId: rootValueId });
102887
102869
  memberDefaultValues.set(memberId, {
102888
102870
  value: seed.value,
@@ -104084,7 +104066,7 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
104084
104066
  );
104085
104067
  }
104086
104068
  const childPath = `${path}.${assignment.name}`;
104087
- body[assignment.name] = lowerSeedChild(
104069
+ const childId = lowerSeedChild(
104088
104070
  context,
104089
104071
  recursivePartialMember(resolvedMember, childMember),
104090
104072
  assignment.value,
@@ -104096,6 +104078,19 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
104096
104078
  environment,
104097
104079
  objectInitializerSlices(authoredSlice).get(assignment.name)
104098
104080
  );
104081
+ if (!partial && typeof childId === "string" && freshChildReplaysDeclaredDefault({
104082
+ context,
104083
+ childMember,
104084
+ childId,
104085
+ rows,
104086
+ localizedTexts,
104087
+ environment
104088
+ })) {
104089
+ rows.delete(childId);
104090
+ context.pendingValues.delete(childId);
104091
+ continue;
104092
+ }
104093
+ body[assignment.name] = childId;
104099
104094
  }
104100
104095
  if (!partial) {
104101
104096
  instanceConstructorId = effectiveClass.requiredConstructorId ?? null;
@@ -104282,7 +104277,6 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
104282
104277
  );
104283
104278
  const settledBy = structuralMemberByParameterName(context, effectiveClass);
104284
104279
  const slices = constructorArgumentValueSlices(authoredSlice);
104285
- const legacyBody = legacyConstructionBody(context, valueId);
104286
104280
  const value = {};
104287
104281
  const constructorArgs = {};
104288
104282
  expression.args.forEach((argument2, index) => {
@@ -104321,10 +104315,8 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
104321
104315
  environment,
104322
104316
  slices[index]
104323
104317
  );
104324
- const settledLegacyKey = legacyBody?.[schemaKey] === childId;
104325
104318
  if (structuralArgumentIsAggregate(context, childMember, environment)) {
104326
104319
  constructorArgs[`__arg_${parameterIndex}__`] = childId;
104327
- if (settledLegacyKey) value[schemaKey] = childId;
104328
104320
  } else {
104329
104321
  const leaf = rows.get(childId);
104330
104322
  if (leaf === void 0 || leaf.value === void 0) {
@@ -104340,12 +104332,8 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
104340
104332
  localizedTexts
104341
104333
  });
104342
104334
  constructorArgs[`__arg_${parameterIndex}__`] = inline;
104343
- if (settledLegacyKey && inline === leaf.value) {
104344
- value[schemaKey] = childId;
104345
- } else {
104346
- rows.delete(childId);
104347
- context.pendingValues.delete(childId);
104348
- }
104335
+ rows.delete(childId);
104336
+ context.pendingValues.delete(childId);
104349
104337
  }
104350
104338
  });
104351
104339
  for (const assignment of expression.initializer ?? []) {
@@ -104354,7 +104342,7 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
104354
104342
  effectiveClass.id,
104355
104343
  assignment.name
104356
104344
  );
104357
- value[assignment.name] = lowerSeedChild(
104345
+ const childId = lowerSeedChild(
104358
104346
  context,
104359
104347
  recursivePartialMember(member, childMember),
104360
104348
  assignment.value,
@@ -104366,6 +104354,19 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
104366
104354
  environment,
104367
104355
  objectInitializerSlices(authoredSlice).get(assignment.name)
104368
104356
  );
104357
+ if (typeof childId === "string" && freshChildReplaysDeclaredDefault({
104358
+ context,
104359
+ childMember,
104360
+ childId,
104361
+ rows,
104362
+ localizedTexts,
104363
+ environment
104364
+ })) {
104365
+ rows.delete(childId);
104366
+ context.pendingValues.delete(childId);
104367
+ continue;
104368
+ }
104369
+ value[assignment.name] = childId;
104369
104370
  }
104370
104371
  const row = {
104371
104372
  id: valueId,
@@ -104373,25 +104374,18 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
104373
104374
  value,
104374
104375
  classId: effectiveClass.id,
104375
104376
  constructorArgs,
104376
- // Stamping a required-constructor id onto a row that never carried one is
104377
- // the other half of the same rewrite: `constructorArgs` alone is already a
104378
- // complete construction recipe (see `carriesCompleteConstructionRecipe`),
104379
- // so adding the derived id changes storage without changing meaning.
104380
- ...legacyBody === null ? { instanceConstructorId: effectiveClass.requiredConstructorId ?? null } : {},
104377
+ // Provenance is stamped explicitly on every construction this lowerer
104378
+ // writes. `constructorArgs` alone is already a complete recipe (see
104379
+ // `carriesCompleteConstructionRecipe`), so the stamp adds no meaning — it
104380
+ // records which constructor produced the row instead of leaving readers to
104381
+ // derive it, and `null` is the honest answer when the class declares none.
104382
+ instanceConstructorId: effectiveClass.requiredConstructorId ?? null,
104381
104383
  ...containerId === void 0 ? {} : { containerId },
104382
104384
  ...genericBindings === void 0 ? {} : { genericBindings }
104383
104385
  };
104384
104386
  registerSeedRow(context, rows, row, source, expression);
104385
104387
  return row;
104386
104388
  }
104387
- function legacyConstructionBody(context, valueId) {
104388
- const data = context.state[`value:${valueId}`]?.data;
104389
- if (!isObjectRecord2(data)) return null;
104390
- if (data.instanceConstructorId !== void 0) return null;
104391
- if (!isObjectRecord2(data.constructorArgs)) return null;
104392
- if (!isObjectRecord2(data.value)) return null;
104393
- return data.value;
104394
- }
104395
104389
  function structuralArgumentIsAggregate(context, member, environment) {
104396
104390
  const resolved = resolveGenericSchemaMember(context, member, environment);
104397
104391
  if (resolved.kind === "class") return true;
@@ -106570,6 +106564,56 @@ function pendingLocalizedTextId(binding, path) {
106570
106564
  }
106571
106565
  return `__pending__:localized-text:${encodeURIComponent(binding.source.uri)}:${binding.source.range.start.line}:${binding.source.range.start.character}:${encodeURIComponent(path)}`;
106572
106566
  }
106567
+ function freshChildReplaysDeclaredDefault(args) {
106568
+ const { context, childMember, childId, rows, localizedTexts, environment } = args;
106569
+ if (!isPendingId(childId)) return false;
106570
+ const child = rows.get(childId);
106571
+ if (child === void 0 || child.value === void 0) return false;
106572
+ if (child.containerId !== void 0) return false;
106573
+ if (child.sourceValueId !== void 0) return false;
106574
+ if (child.genericBindings !== void 0) return false;
106575
+ if (child.instanceVariantId != null) return false;
106576
+ if (child.instanceVariantRowValueId != null) return false;
106577
+ const defaultValue = childMember.defaultValue;
106578
+ if (defaultValue === null || defaultValue === void 0) return false;
106579
+ if (!("value" in defaultValue)) return false;
106580
+ const resolved = resolveGenericSchemaMember(
106581
+ context,
106582
+ childMember,
106583
+ environment
106584
+ );
106585
+ if (resolved.kind === "lookup" || resolved.kind === "dialogueLookup") {
106586
+ return false;
106587
+ }
106588
+ if (resolved.kind === "class") {
106589
+ return freshConstructionReplaysDeclaredDefault(
106590
+ resolved,
106591
+ child,
106592
+ defaultValue
106593
+ );
106594
+ }
106595
+ if (resolved.kind === "list" || resolved.kind === "dictionary") return false;
106596
+ if (resolved.kind === "string" && resolved.localizable === true) return false;
106597
+ if (child.classId !== null && child.classId !== void 0) return false;
106598
+ if (isObjectRecord2(child.constructorArgs)) return false;
106599
+ for (const text of localizedTexts.values()) {
106600
+ if (text.valueId === childId) return false;
106601
+ }
106602
+ if (defaultValue.classId != null) return false;
106603
+ return canonicallyEqual(child.value, defaultValue.value);
106604
+ }
106605
+ function freshConstructionReplaysDeclaredDefault(resolved, child, defaultValue) {
106606
+ if (resolved.partial === true) return false;
106607
+ if (!isObjectRecord2(child.value)) return false;
106608
+ if (Object.keys(child.value).length > 0) return false;
106609
+ if (isObjectRecord2(child.constructorArgs) && Object.keys(child.constructorArgs).length > 0) {
106610
+ return false;
106611
+ }
106612
+ if (child.instanceConstructorId != null) return false;
106613
+ if (!isObjectRecord2(defaultValue.value)) return false;
106614
+ if (Object.keys(defaultValue.value).length > 0) return false;
106615
+ return child.classId === (defaultValue.classId ?? resolved.classId);
106616
+ }
106573
106617
  function classMemberByName(context, classId, name) {
106574
106618
  let current = classId;
106575
106619
  const visited = /* @__PURE__ */ new Set();
@@ -115194,7 +115238,7 @@ function normalizeSourceFiles(inputFiles) {
115194
115238
  return files;
115195
115239
  }
115196
115240
  function readSourceFile(value, index) {
115197
- const record3 = asRecord2(value, `Project source identity file ${index}`);
115241
+ const record3 = asRecord3(value, `Project source identity file ${index}`);
115198
115242
  assertExactKeys(record3, ["path", "kind", "content"]);
115199
115243
  if (typeof record3.path !== "string" || !isSafeSourcePath(record3.path)) {
115200
115244
  throw new Error(
@@ -115229,7 +115273,7 @@ function isSafeSourcePath(path) {
115229
115273
  }
115230
115274
  return neoProjectSourceKind(path) !== null;
115231
115275
  }
115232
- function asRecord2(value, label) {
115276
+ function asRecord3(value, label) {
115233
115277
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
115234
115278
  throw new Error(`${label} must be an object.`);
115235
115279
  }
@@ -118927,7 +118971,7 @@ var init_registry2 = __esm({
118927
118971
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
118928
118972
  formatVersion: 3,
118929
118973
  contractVersion: "3.14",
118930
- cliVersion: "0.38.0",
118974
+ cliVersion: "0.38.1",
118931
118975
  projectFileUploadBatchSize: 32,
118932
118976
  documentRecords: {
118933
118977
  member: {
@@ -120272,7 +120316,7 @@ import {
120272
120316
  sep as sep5
120273
120317
  } from "node:path";
120274
120318
  import { isDeepStrictEqual } from "node:util";
120275
- function isRecord10(value) {
120319
+ function isRecord9(value) {
120276
120320
  return typeof value === "object" && value !== null && !Array.isArray(value);
120277
120321
  }
120278
120322
  function expectation(actual, negated = false) {
@@ -120283,13 +120327,13 @@ function expectation(actual, negated = false) {
120283
120327
  return value;
120284
120328
  }
120285
120329
  function readExpectation(value) {
120286
- if (!isRecord10(value) || value.__neoExpectation !== true) {
120330
+ if (!isRecord9(value) || value.__neoExpectation !== true) {
120287
120331
  throw new NeoTestAssertionError("Matcher receiver is not an expectation.");
120288
120332
  }
120289
120333
  return value;
120290
120334
  }
120291
120335
  function readMockHandle(value) {
120292
- if (!isRecord10(value) || value.__neoMockHandle !== true || typeof value.mockId !== "number") {
120336
+ if (!isRecord9(value) || value.__neoMockHandle !== true || typeof value.mockId !== "number") {
120293
120337
  throw new NeoTestAssertionError(
120294
120338
  "Mock configuration receiver is not a mock handle."
120295
120339
  );
@@ -120400,13 +120444,13 @@ function errorMessage2(error) {
120400
120444
  return error instanceof Error ? error.message : String(error);
120401
120445
  }
120402
120446
  function findDelegateTargetMemberId(value) {
120403
- return isRecord10(value) && typeof value.memberId === "string" ? value.memberId : null;
120447
+ return isRecord9(value) && typeof value.memberId === "string" ? value.memberId : null;
120404
120448
  }
120405
120449
  function sharedEvaluatorBase(rawDocument) {
120406
120450
  const cached = SHARED_EVALUATOR_BASES.get(rawDocument);
120407
120451
  if (cached !== void 0) return cached;
120408
120452
  const document = readDocumentArrays(rawDocument);
120409
- const constructors = Array.isArray(rawDocument.constructors) ? rawDocument.constructors.filter(isRecord10) : [];
120453
+ const constructors = Array.isArray(rawDocument.constructors) ? rawDocument.constructors.filter(isRecord9) : [];
120410
120454
  const lookups = cliEvaluatorLookups(
120411
120455
  { ...document, constructors },
120412
120456
  { includeValueGraphIndexes: true }
@@ -120474,7 +120518,7 @@ function preparedHookCandidate(workspace) {
120474
120518
  const parsed = JSON.parse(
120475
120519
  readFileSync16(join16(directory, "candidate.json"), "utf8")
120476
120520
  );
120477
- if (!isRecord10(parsed)) {
120521
+ if (!isRecord9(parsed)) {
120478
120522
  throw new NeoTestPreparedCandidateError(
120479
120523
  "Configured push hook candidate manifest must be a JSON object."
120480
120524
  );
@@ -120494,7 +120538,7 @@ function preparedHookCandidate(workspace) {
120494
120538
  "Configured push hook candidate inputs no longer match the workspace."
120495
120539
  );
120496
120540
  }
120497
- if (!isRecord10(parsed.document)) {
120541
+ if (!isRecord9(parsed.document)) {
120498
120542
  throw new NeoTestPreparedCandidateError(
120499
120543
  "Configured push hook candidate is missing its project document."
120500
120544
  );
@@ -120543,7 +120587,7 @@ function cachedTestCandidate(workspace, inputFingerprint) {
120543
120587
  try {
120544
120588
  const candidatePath = testCandidateCachePath(workspace, inputFingerprint);
120545
120589
  const parsed = JSON.parse(readFileSync16(candidatePath, "utf8"));
120546
- if (!isRecord10(parsed)) return null;
120590
+ if (!isRecord9(parsed)) return null;
120547
120591
  if (parsed.version !== 1) return null;
120548
120592
  if (parsed.candidateRevision !== TEST_CANDIDATE_CACHE_REVISION) return null;
120549
120593
  if (parsed.cliVersion !== PROJECT_SCHEMA_CONTRACT.cliVersion) return null;
@@ -120561,7 +120605,7 @@ function cachedTestCandidate(workspace, inputFingerprint) {
120561
120605
  return null;
120562
120606
  }
120563
120607
  const document = JSON.parse(documentJson);
120564
- if (!isRecord10(document)) return null;
120608
+ if (!isRecord9(document)) return null;
120565
120609
  return {
120566
120610
  document,
120567
120611
  sourceHash: parsed.sourceHash,
@@ -120605,7 +120649,7 @@ function compileSpec(workspace, document, absolutePath, projectCompilationHash2)
120605
120649
  );
120606
120650
  try {
120607
120651
  const cached = JSON.parse(readFileSync16(artifactPath, "utf8"));
120608
- if (isRecord10(cached) && cached.version === 1 && cached.compilerRevision === NEOSCRIPT_COMPILER_REVISION && cached.projectCompilationHash === projectCompilationHash2 && cached.sourceHash === sourceHash && isRecord10(cached.action) && typeof cached.artifactSha256 === "string" && createHash11("sha256").update(JSON.stringify(cached.action)).digest("hex") === cached.artifactSha256 && cached.action.compilerRevision === NEOSCRIPT_COMPILER_REVISION && Array.isArray(cached.action.parameters) && Array.isArray(cached.action.instructions) && isRecord10(cached.action.typeInfo)) {
120652
+ if (isRecord9(cached) && cached.version === 1 && cached.compilerRevision === NEOSCRIPT_COMPILER_REVISION && cached.projectCompilationHash === projectCompilationHash2 && cached.sourceHash === sourceHash && isRecord9(cached.action) && typeof cached.artifactSha256 === "string" && createHash11("sha256").update(JSON.stringify(cached.action)).digest("hex") === cached.artifactSha256 && cached.action.compilerRevision === NEOSCRIPT_COMPILER_REVISION && Array.isArray(cached.action.parameters) && Array.isArray(cached.action.instructions) && isRecord9(cached.action.typeInfo)) {
120609
120653
  return {
120610
120654
  path,
120611
120655
  source,
@@ -120769,7 +120813,7 @@ function portableDelegate(value) {
120769
120813
  }
120770
120814
  }
120771
120815
  function callMemberId(value) {
120772
- if (!isRecord10(value) || value.type !== "callFunction") return null;
120816
+ if (!isRecord9(value) || value.type !== "callFunction") return null;
120773
120817
  return typeof value.memberId === "string" ? value.memberId : null;
120774
120818
  }
120775
120819
  function assertNoNestedRegistration(value) {
@@ -120777,7 +120821,7 @@ function assertNoNestedRegistration(value) {
120777
120821
  for (const entry of value) assertNoNestedRegistration(entry);
120778
120822
  return;
120779
120823
  }
120780
- if (!isRecord10(value)) return;
120824
+ if (!isRecord9(value)) return;
120781
120825
  const memberId = callMemberId(value);
120782
120826
  if (memberId !== null && REGISTRATION_IDS.has(memberId)) {
120783
120827
  throw new NeoTestRegistrationError(
@@ -120793,8 +120837,8 @@ function compiledDelegateActions(value) {
120793
120837
  for (const child of entry) visit(child);
120794
120838
  return;
120795
120839
  }
120796
- if (!isRecord10(entry)) return;
120797
- if (isRecord10(entry.action) && Array.isArray(entry.action.instructions) && Array.isArray(entry.action.parameters) && isRecord10(entry.action.typeInfo)) {
120840
+ if (!isRecord9(entry)) return;
120841
+ if (isRecord9(entry.action) && Array.isArray(entry.action.instructions) && Array.isArray(entry.action.parameters) && isRecord9(entry.action.typeInfo)) {
120798
120842
  actions.push(entry.action);
120799
120843
  return;
120800
120844
  }
@@ -120805,7 +120849,7 @@ function compiledDelegateActions(value) {
120805
120849
  }
120806
120850
  function validateRegistrationAction(action, allowRegistration) {
120807
120851
  for (const instruction of action.instructions) {
120808
- const record3 = isRecord10(instruction) ? instruction : null;
120852
+ const record3 = isRecord9(instruction) ? instruction : null;
120809
120853
  const call = record3?.type === "functionCall" ? record3.call : null;
120810
120854
  const memberId = callMemberId(call);
120811
120855
  if (memberId !== null && REGISTRATION_IDS.has(memberId)) {
@@ -120938,8 +120982,8 @@ function mockResponse(environment, mock, selected, call) {
120938
120982
  };
120939
120983
  }
120940
120984
  function partialObjectMatch(actual, expected) {
120941
- if (!isRecord10(expected)) return isDeepStrictEqual(actual, expected);
120942
- if (!isRecord10(actual)) return false;
120985
+ if (!isRecord9(expected)) return isDeepStrictEqual(actual, expected);
120986
+ if (!isRecord9(actual)) return false;
120943
120987
  return Object.entries(expected).every(
120944
120988
  ([key, value]) => partialObjectMatch(actual[key], value)
120945
120989
  );
@@ -121131,7 +121175,7 @@ function interceptTestCallCore(environment, call) {
121131
121175
  const contains2 = typeof actual === "string" ? actual.includes(String(call.args[0])) : Array.isArray(actual) && actual.some((entry) => isDeepStrictEqual(entry, call.args[0]));
121132
121176
  assertMatcher(contains2, expectationValue, "toContain", call.args[0]);
121133
121177
  } else if (call.memberId === NEO_TEST_IDS.toHaveLength) {
121134
- const length = typeof actual === "string" || Array.isArray(actual) ? actual.length : isRecord10(actual) ? Object.keys(actual).length : -1;
121178
+ const length = typeof actual === "string" || Array.isArray(actual) ? actual.length : isRecord9(actual) ? Object.keys(actual).length : -1;
121135
121179
  assertMatcher(
121136
121180
  length === call.args[0],
121137
121181
  expectationValue,
@@ -121222,11 +121266,11 @@ function snapshotEnvironmentDocument(environment) {
121222
121266
  const values = [...baseValues];
121223
121267
  const byId = /* @__PURE__ */ new Map();
121224
121268
  values.forEach((value, index) => {
121225
- if (isRecord10(value) && typeof value.id === "string")
121269
+ if (isRecord9(value) && typeof value.id === "string")
121226
121270
  byId.set(value.id, index);
121227
121271
  });
121228
121272
  const mergeRow = (row) => {
121229
- if (!isRecord10(row) || typeof row.id !== "string") return;
121273
+ if (!isRecord9(row) || typeof row.id !== "string") return;
121230
121274
  const cloned = structuredClone(row);
121231
121275
  const index = byId.get(row.id);
121232
121276
  if (index === void 0) {
@@ -121242,7 +121286,7 @@ function snapshotEnvironmentDocument(environment) {
121242
121286
  if (bindings.size > 0) {
121243
121287
  const baseMembers = Array.isArray(snapshot.members) ? snapshot.members : [];
121244
121288
  snapshot.members = baseMembers.map((member) => {
121245
- if (!isRecord10(member) || typeof member.id !== "string" || !bindings.has(member.id)) {
121289
+ if (!isRecord9(member) || typeof member.id !== "string" || !bindings.has(member.id)) {
121246
121290
  return member;
121247
121291
  }
121248
121292
  return { ...member, valueId: bindings.get(member.id) ?? null };
@@ -125650,7 +125694,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
125650
125694
  async function main() {
125651
125695
  const args = parseArgs(process.argv.slice(2));
125652
125696
  if (args.command === "--version") {
125653
- console.log("0.38.0");
125697
+ console.log("0.38.1");
125654
125698
  return;
125655
125699
  }
125656
125700
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {