@neocompose/cli 0.46.0 → 0.46.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
@@ -65284,7 +65284,7 @@ var init_project_root_members = __esm({
65284
65284
  }
65285
65285
  });
65286
65286
 
65287
- // ../src/components/projects/member-code/analyzer-types.ts
65287
+ // ../src/runtime/neoscript/analyzer-types.ts
65288
65288
  function createAnalyzerSchemaIndex(context) {
65289
65289
  return projectSchemaIndexFor({
65290
65290
  classes: context.vm.classes,
@@ -65313,7 +65313,7 @@ function analyzerMemberById(context, id2) {
65313
65313
  }
65314
65314
  var AnalyzerRootClassId, AnalyzerDialogueContextClassId, activeSchemaIndexByContext;
65315
65315
  var init_analyzer_types = __esm({
65316
- "../src/components/projects/member-code/analyzer-types.ts"() {
65316
+ "../src/runtime/neoscript/analyzer-types.ts"() {
65317
65317
  "use strict";
65318
65318
  init_project_schema_index();
65319
65319
  AnalyzerRootClassId = "__root__";
@@ -65322,7 +65322,7 @@ var init_analyzer_types = __esm({
65322
65322
  }
65323
65323
  });
65324
65324
 
65325
- // ../src/components/projects/member-code/neoscript-language-context-adapter.ts
65325
+ // ../src/runtime/neoscript/neoscript-language-context-adapter.ts
65326
65326
  function createNeoScriptDocumentContext(context, projectOverride) {
65327
65327
  return withAnalyzerSchemaIndex(
65328
65328
  context,
@@ -66713,7 +66713,7 @@ function virtualRootMemberLine(name, memberId) {
66713
66713
  }
66714
66714
  var NEOSCRIPT_COMPILER_ADAPTER_REVISION, UNKNOWN_TYPE2, storageResolverByContext;
66715
66715
  var init_neoscript_language_context_adapter = __esm({
66716
- "../src/components/projects/member-code/neoscript-language-context-adapter.ts"() {
66716
+ "../src/runtime/neoscript/neoscript-language-context-adapter.ts"() {
66717
66717
  "use strict";
66718
66718
  init_src();
66719
66719
  init_members();
@@ -69170,392 +69170,34 @@ var init_constructor_argument_ownership = __esm({
69170
69170
  }
69171
69171
  });
69172
69172
 
69173
- // ../src/view-models/neoscript-evaluator/NSGetterRuntimeError.ts
69174
- var NSGetterRuntimeError, UncompiledInitializerRuntimeError;
69175
- var init_NSGetterRuntimeError = __esm({
69176
- "../src/view-models/neoscript-evaluator/NSGetterRuntimeError.ts"() {
69177
- "use strict";
69178
- NSGetterRuntimeError = class extends Error {
69179
- constructor(message) {
69180
- super(message);
69181
- this.name = "NSGetterRuntimeError";
69182
- }
69183
- };
69184
- UncompiledInitializerRuntimeError = class extends NSGetterRuntimeError {
69185
- constructor(memberId, memberName, initializer = null, valueId = null) {
69186
- super(
69187
- `Initializer for '${memberName}' has no compiled body; push the project so the server compiles it.`
69188
- );
69189
- this.memberId = memberId;
69190
- this.initializer = initializer;
69191
- this.valueId = valueId;
69192
- this.name = "UncompiledInitializerRuntimeError";
69193
- }
69194
- memberId;
69195
- initializer;
69196
- valueId;
69197
- };
69198
- }
69199
- });
69200
-
69201
- // ../src/view-models/neoscript-evaluator/NeoScriptScope.ts
69202
- var NeoScriptScope;
69203
- var init_NeoScriptScope = __esm({
69204
- "../src/view-models/neoscript-evaluator/NeoScriptScope.ts"() {
69205
- "use strict";
69206
- NeoScriptScope = class {
69207
- constructor(parent = null, initialBindings) {
69208
- this.parent = parent;
69209
- this.#bindings = new Map(initialBindings);
69210
- }
69211
- parent;
69212
- #bindings;
69213
- #readonlyBindingErrors = /* @__PURE__ */ new Map();
69214
- get localBindingCount() {
69215
- return this.#bindings.size;
69216
- }
69217
- get(bindingId) {
69218
- if (this.#bindings.has(bindingId)) return this.#bindings.get(bindingId);
69219
- return this.parent?.get(bindingId);
69220
- }
69221
- has(bindingId) {
69222
- return this.#bindings.has(bindingId) || this.parent?.has(bindingId) === true;
69223
- }
69224
- containsLocal(bindingId) {
69225
- return this.#bindings.has(bindingId);
69226
- }
69227
- setLocal(bindingId, value) {
69228
- this.#bindings.set(bindingId, value);
69229
- }
69230
- bindInvocationEntry(bindingId, value) {
69231
- this.#bindings.set(bindingId, value);
69232
- }
69233
- bindInvocationKeyAndEntry(keyBindingId, key, entryBindingId, entry) {
69234
- this.#bindings.set(keyBindingId, key);
69235
- this.#bindings.set(entryBindingId, entry);
69236
- }
69237
- resetInvocationLocals(parameterCount) {
69238
- if (this.#bindings.size > parameterCount) this.#bindings.clear();
69239
- if (this.#readonlyBindingErrors.size > 0) {
69240
- this.#readonlyBindingErrors.clear();
69241
- }
69242
- }
69243
- *keys() {
69244
- const inherited = /* @__PURE__ */ new Set();
69245
- if (this.parent !== null) {
69246
- for (const bindingId of this.parent.keys()) {
69247
- inherited.add(bindingId);
69248
- yield bindingId;
69249
- }
69250
- }
69251
- for (const bindingId of this.#bindings.keys()) {
69252
- if (!inherited.has(bindingId)) yield bindingId;
69253
- }
69254
- }
69255
- markReadonly(bindingId, errorMessage4) {
69256
- const errors = this.#readonlyBindingErrors.get(bindingId);
69257
- if (errors === void 0) {
69258
- this.#readonlyBindingErrors.set(bindingId, [errorMessage4]);
69259
- return;
69260
- }
69261
- errors.push(errorMessage4);
69262
- }
69263
- unmarkReadonly(bindingId) {
69264
- const errors = this.#readonlyBindingErrors.get(bindingId);
69265
- if (errors === void 0) return;
69266
- errors.pop();
69267
- if (errors.length === 0) this.#readonlyBindingErrors.delete(bindingId);
69268
- }
69269
- readonlyError(bindingId) {
69270
- const errors = this.#readonlyBindingErrors.get(bindingId);
69271
- if (errors !== void 0 && errors.length > 0) {
69272
- return errors[errors.length - 1];
69273
- }
69274
- return this.parent?.readonlyError(bindingId);
69275
- }
69276
- };
69277
- }
69278
- });
69279
-
69280
- // ../src/models/decimal/decimal-math.ts
69281
- function pow10(exponent) {
69282
- return TEN ** BigInt(exponent);
69283
- }
69284
- function assertCanonicalInput(value, argName) {
69285
- const violation = getDecimalStringViolation(value);
69286
- if (violation !== null) {
69287
- throw new Error(
69288
- `Decimal argument "${argName}" (${JSON.stringify(value)}) ${violation}.`
69289
- );
69290
- }
69291
- }
69292
- function parseDecimalArg(value, argName) {
69293
- assertCanonicalInput(value, argName);
69294
- const negative = value.startsWith("-");
69295
- const unsigned = negative ? value.slice(1) : value;
69296
- const pointIndex = unsigned.indexOf(".");
69297
- const digits = pointIndex === -1 ? unsigned : unsigned.slice(0, pointIndex) + unsigned.slice(pointIndex + 1);
69298
- const scale = pointIndex === -1 ? 0 : unsigned.length - pointIndex - 1;
69299
- const magnitude = BigInt(digits);
69300
- return { coefficient: negative ? -magnitude : magnitude, scale };
69301
- }
69302
- function formatDecimalParts(parts) {
69303
- const negative = parts.coefficient < 0n;
69304
- const digits = (negative ? -parts.coefficient : parts.coefficient).toString();
69305
- let unsigned;
69306
- if (parts.scale === 0) {
69307
- unsigned = digits;
69308
- } else {
69309
- const padded = digits.padStart(parts.scale + 1, "0");
69310
- const pointIndex = padded.length - parts.scale;
69311
- unsigned = `${padded.slice(0, pointIndex)}.${padded.slice(pointIndex)}`;
69312
- }
69313
- if (parts.coefficient === 0n) return unsigned;
69314
- return negative ? `-${unsigned}` : unsigned;
69315
- }
69316
- function significantDigitCount(coefficient) {
69317
- const magnitude = coefficient < 0n ? -coefficient : coefficient;
69318
- return magnitude.toString().length;
69319
- }
69320
- function assertWithinEnvelope(parts, operation) {
69321
- if (significantDigitCount(parts.coefficient) > DECIMAL_MAX_SIGNIFICANT_DIGITS) {
69322
- throw new DecimalOverflowError(
69323
- `Decimal overflow in ${operation}: the exact result exceeds ${DECIMAL_MAX_SIGNIFICANT_DIGITS} significant digits. Round explicitly (Round/Divide) to reduce precision.`
69324
- );
69325
- }
69326
- if (parts.scale > DECIMAL_MAX_SCALE) {
69327
- throw new DecimalOverflowError(
69328
- `Decimal overflow in ${operation}: the exact result exceeds scale ${DECIMAL_MAX_SCALE}. Round explicitly (Round/Divide) to reduce precision.`
69329
- );
69330
- }
69331
- return parts;
69332
- }
69333
- function alignScales(a, b) {
69334
- const scale = Math.max(a.scale, b.scale);
69335
- return {
69336
- a: a.coefficient * pow10(scale - a.scale),
69337
- b: b.coefficient * pow10(scale - b.scale),
69338
- scale
69339
- };
69340
- }
69341
- function compareDecimalStrings(a, b) {
69342
- const aligned = alignScales(parseDecimalArg(a, "a"), parseDecimalArg(b, "b"));
69343
- if (aligned.a < aligned.b) return -1;
69344
- if (aligned.a > aligned.b) return 1;
69345
- return 0;
69346
- }
69347
- function minDecimalStrings(a, b) {
69348
- return compareDecimalStrings(a, b) <= 0 ? a : b;
69349
- }
69350
- function maxDecimalStrings(a, b) {
69351
- return compareDecimalStrings(a, b) >= 0 ? a : b;
69352
- }
69353
- function clampDecimalStrings(value, min, max) {
69354
- if (compareDecimalStrings(min, max) > 0) {
69355
- throw new DecimalClampRangeError(MATH_CLAMP_RANGE_MESSAGE);
69356
- }
69357
- if (compareDecimalStrings(value, min) < 0) return min;
69358
- if (compareDecimalStrings(value, max) > 0) return max;
69359
- return value;
69360
- }
69361
- function absDecimalString(value) {
69362
- const parts = parseDecimalArg(value, "value");
69363
- const magnitude = parts.coefficient < 0n ? -parts.coefficient : parts.coefficient;
69364
- return formatDecimalParts({ coefficient: magnitude, scale: parts.scale });
69365
- }
69366
- function addDecimalStrings(a, b) {
69367
- const aligned = alignScales(parseDecimalArg(a, "a"), parseDecimalArg(b, "b"));
69368
- return formatDecimalParts(
69369
- assertWithinEnvelope(
69370
- { coefficient: aligned.a + aligned.b, scale: aligned.scale },
69371
- "addition"
69372
- )
69373
- );
69374
- }
69375
- function subtractDecimalStrings(a, b) {
69376
- const aligned = alignScales(parseDecimalArg(a, "a"), parseDecimalArg(b, "b"));
69377
- return formatDecimalParts(
69378
- assertWithinEnvelope(
69379
- { coefficient: aligned.a - aligned.b, scale: aligned.scale },
69380
- "subtraction"
69381
- )
69382
- );
69383
- }
69384
- function multiplyDecimalStrings(a, b) {
69385
- const left = parseDecimalArg(a, "a");
69386
- const right = parseDecimalArg(b, "b");
69387
- return formatDecimalParts(
69388
- assertWithinEnvelope(
69389
- {
69390
- coefficient: left.coefficient * right.coefficient,
69391
- scale: left.scale + right.scale
69392
- },
69393
- "multiplication"
69394
- )
69395
- );
69396
- }
69397
- function assertDigitsInRange(digits, operation) {
69398
- if (!Number.isInteger(digits)) {
69399
- throw new DecimalDigitsRangeError(
69400
- `Decimal ${operation} digits must be an integer (received ${digits}).`
69401
- );
69402
- }
69403
- if (digits < 0 || digits > DECIMAL_MAX_SCALE) {
69404
- throw new DecimalDigitsRangeError(
69405
- `Decimal ${operation} digits must be between 0 and ${DECIMAL_MAX_SCALE} (received ${digits}).`
69406
- );
69407
- }
69408
- }
69409
- function roundParts(parts, digits) {
69410
- if (digits >= parts.scale) return parts;
69411
- const drop = parts.scale - digits;
69412
- const divisor = pow10(drop);
69413
- const negative = parts.coefficient < 0n;
69414
- const magnitude = negative ? -parts.coefficient : parts.coefficient;
69415
- let quotient = magnitude / divisor;
69416
- const remainder = magnitude % divisor;
69417
- const doubled = remainder * 2n;
69418
- if (doubled > divisor || doubled === divisor && quotient % 2n === 1n) {
69419
- quotient += 1n;
69420
- }
69421
- return { coefficient: negative ? -quotient : quotient, scale: digits };
69422
- }
69423
- function roundDecimalString(value, digits) {
69424
- assertDigitsInRange(digits, "round");
69425
- const rounded = roundParts(parseDecimalArg(value, "value"), digits);
69426
- return formatDecimalParts(assertWithinEnvelope(rounded, "round"));
69427
- }
69428
- function toIntegralParts(parts, direction) {
69429
- if (parts.scale === 0) return parts;
69430
- const divisor = pow10(parts.scale);
69431
- const quotient = parts.coefficient / divisor;
69432
- const remainder = parts.coefficient % divisor;
69433
- if (remainder === 0n) return { coefficient: quotient, scale: 0 };
69434
- if (direction === "floor" && remainder < 0n) {
69435
- return { coefficient: quotient - 1n, scale: 0 };
69436
- }
69437
- if (direction === "ceiling" && remainder > 0n) {
69438
- return { coefficient: quotient + 1n, scale: 0 };
69439
- }
69440
- return { coefficient: quotient, scale: 0 };
69441
- }
69442
- function floorDecimalString(value) {
69443
- const parts = toIntegralParts(parseDecimalArg(value, "value"), "floor");
69444
- return formatDecimalParts(assertWithinEnvelope(parts, "floor"));
69445
- }
69446
- function ceilingDecimalString(value) {
69447
- const parts = toIntegralParts(parseDecimalArg(value, "value"), "ceiling");
69448
- return formatDecimalParts(assertWithinEnvelope(parts, "ceiling"));
69449
- }
69450
- function truncateDecimalString(value) {
69451
- const parts = toIntegralParts(parseDecimalArg(value, "value"), "truncate");
69452
- return formatDecimalParts(assertWithinEnvelope(parts, "truncate"));
69453
- }
69454
- function divideDecimalStrings(a, b, digits) {
69455
- assertDigitsInRange(digits, "divide");
69456
- const dividend = parseDecimalArg(a, "a");
69457
- const divisor = parseDecimalArg(b, "b");
69458
- if (divisor.coefficient === 0n) {
69459
- throw new DecimalDivisionByZeroError(
69460
- `Decimal division by zero: ${JSON.stringify(a)} / ${JSON.stringify(b)}.`
69461
- );
69462
- }
69463
- const exponent = divisor.scale - dividend.scale + digits;
69464
- let numerator = dividend.coefficient;
69465
- let denominator = divisor.coefficient;
69466
- if (exponent >= 0) {
69467
- numerator *= pow10(exponent);
69468
- } else {
69469
- denominator *= pow10(-exponent);
69470
- }
69471
- const negative = numerator < 0n !== denominator < 0n;
69472
- const absNumerator = numerator < 0n ? -numerator : numerator;
69473
- const absDenominator = denominator < 0n ? -denominator : denominator;
69474
- let quotient = absNumerator / absDenominator;
69475
- const remainder = absNumerator % absDenominator;
69476
- const doubled = remainder * 2n;
69477
- if (doubled > absDenominator || doubled === absDenominator && quotient % 2n === 1n) {
69478
- quotient += 1n;
69479
- }
69480
- const parts = {
69481
- coefficient: negative ? -quotient : quotient,
69482
- scale: digits
69483
- };
69484
- return formatDecimalParts(assertWithinEnvelope(parts, "division"));
69485
- }
69486
- function decimalStringFromFloat(value, digits) {
69487
- assertDigitsInRange(digits, "float conversion");
69488
- if (Number.isNaN(value)) {
69489
- throw new DecimalNonFiniteError("Cannot convert NaN to a decimal.");
69490
- }
69491
- if (!Number.isFinite(value)) {
69492
- throw new DecimalNonFiniteError(
69493
- `Cannot convert ${value > 0 ? "Infinity" : "-Infinity"} to a decimal.`
69494
- );
69495
- }
69496
- const view = new DataView(new ArrayBuffer(8));
69497
- view.setFloat64(0, value);
69498
- const bits = view.getBigUint64(0);
69499
- const negative = bits >> 63n === 1n;
69500
- const exponentBits = Number(bits >> 52n & 0x7ffn);
69501
- const mantissaBits = bits & 0xfffffffffffffn;
69502
- let mantissa;
69503
- let exponent;
69504
- if (exponentBits === 0) {
69505
- mantissa = mantissaBits;
69506
- exponent = -1074;
69507
- } else {
69508
- mantissa = mantissaBits | 1n << 52n;
69509
- exponent = exponentBits - 1075;
69510
- }
69511
- if (mantissa === 0n) {
69512
- return "0";
69513
- }
69514
- if (negative) mantissa = -mantissa;
69515
- let parts;
69516
- if (exponent >= 0) {
69517
- parts = { coefficient: mantissa * (1n << BigInt(exponent)), scale: 0 };
69518
- } else {
69519
- parts = {
69520
- coefficient: mantissa * 5n ** BigInt(-exponent),
69521
- scale: -exponent
69522
- };
69523
- }
69524
- while (parts.scale > 0 && parts.coefficient % TEN === 0n) {
69525
- parts = { coefficient: parts.coefficient / TEN, scale: parts.scale - 1 };
69526
- }
69527
- const rounded = roundParts(parts, digits);
69528
- return formatDecimalParts(assertWithinEnvelope(rounded, "float conversion"));
69173
+ // ../src/runtime/neoscript/initializer-context.ts
69174
+ function initializerEvaluatorCacheKey(document) {
69175
+ return document.evaluatorCache?.key ?? document;
69529
69176
  }
69530
- function floatFromDecimalString(value) {
69531
- assertCanonicalInput(value, "value");
69532
- return Number(value);
69177
+ function initializerEvaluatorCacheRevision(document) {
69178
+ return document.evaluatorCache?.revision;
69533
69179
  }
69534
- var DecimalOverflowError, DecimalDivisionByZeroError, DecimalDigitsRangeError, DecimalNonFiniteError, DecimalClampRangeError, MATH_CLAMP_RANGE_MESSAGE, TEN;
69535
- var init_decimal_math = __esm({
69536
- "../src/models/decimal/decimal-math.ts"() {
69180
+ var InitializerReadSet;
69181
+ var init_initializer_context = __esm({
69182
+ "../src/runtime/neoscript/initializer-context.ts"() {
69537
69183
  "use strict";
69538
- init_members();
69539
- DecimalOverflowError = class extends Error {
69540
- };
69541
- DecimalDivisionByZeroError = class extends Error {
69542
- };
69543
- DecimalDigitsRangeError = class extends Error {
69544
- };
69545
- DecimalNonFiniteError = class extends Error {
69546
- };
69547
- DecimalClampRangeError = class extends Error {
69184
+ init_collections();
69185
+ InitializerReadSet = class {
69186
+ valueIds = /* @__PURE__ */ new Set();
69187
+ localizedTextIds = /* @__PURE__ */ new Set();
69188
+ variantIds = /* @__PURE__ */ new Set();
69189
+ containerIds = /* @__PURE__ */ new Set();
69190
+ staticMemberIds = /* @__PURE__ */ new Set();
69191
+ hasValuePlacementRead = false;
69192
+ hasUnattributableValueRead = false;
69193
+ recordUnattributableValueRead = (_reason) => {
69194
+ void _reason;
69195
+ this.hasUnattributableValueRead = true;
69196
+ };
69197
+ recordValuePlacementRead = () => {
69198
+ this.hasValuePlacementRead = true;
69199
+ };
69548
69200
  };
69549
- MATH_CLAMP_RANGE_MESSAGE = "Math.Clamp requires min <= max.";
69550
- TEN = 10n;
69551
- }
69552
- });
69553
-
69554
- // ../src/models/decimal/index.ts
69555
- var init_decimal = __esm({
69556
- "../src/models/decimal/index.ts"() {
69557
- "use strict";
69558
- init_decimal_math();
69559
69201
  }
69560
69202
  });
69561
69203
 
@@ -70347,7 +69989,396 @@ var init_project2 = __esm({
70347
69989
  }
70348
69990
  });
70349
69991
 
70350
- // ../src/view-models/neoscript-evaluator/evaluateNSGetter.ts
69992
+ // ../src/runtime/neoscript/NeoScriptScope.ts
69993
+ var NeoScriptScope;
69994
+ var init_NeoScriptScope = __esm({
69995
+ "../src/runtime/neoscript/NeoScriptScope.ts"() {
69996
+ "use strict";
69997
+ NeoScriptScope = class {
69998
+ constructor(parent = null, initialBindings) {
69999
+ this.parent = parent;
70000
+ this.#bindings = new Map(initialBindings);
70001
+ }
70002
+ parent;
70003
+ #bindings;
70004
+ #readonlyBindingErrors = /* @__PURE__ */ new Map();
70005
+ get localBindingCount() {
70006
+ return this.#bindings.size;
70007
+ }
70008
+ get(bindingId) {
70009
+ if (this.#bindings.has(bindingId)) return this.#bindings.get(bindingId);
70010
+ return this.parent?.get(bindingId);
70011
+ }
70012
+ has(bindingId) {
70013
+ return this.#bindings.has(bindingId) || this.parent?.has(bindingId) === true;
70014
+ }
70015
+ containsLocal(bindingId) {
70016
+ return this.#bindings.has(bindingId);
70017
+ }
70018
+ setLocal(bindingId, value) {
70019
+ this.#bindings.set(bindingId, value);
70020
+ }
70021
+ bindInvocationEntry(bindingId, value) {
70022
+ this.#bindings.set(bindingId, value);
70023
+ }
70024
+ bindInvocationKeyAndEntry(keyBindingId, key, entryBindingId, entry) {
70025
+ this.#bindings.set(keyBindingId, key);
70026
+ this.#bindings.set(entryBindingId, entry);
70027
+ }
70028
+ resetInvocationLocals(parameterCount) {
70029
+ if (this.#bindings.size > parameterCount) this.#bindings.clear();
70030
+ if (this.#readonlyBindingErrors.size > 0) {
70031
+ this.#readonlyBindingErrors.clear();
70032
+ }
70033
+ }
70034
+ *keys() {
70035
+ const inherited = /* @__PURE__ */ new Set();
70036
+ if (this.parent !== null) {
70037
+ for (const bindingId of this.parent.keys()) {
70038
+ inherited.add(bindingId);
70039
+ yield bindingId;
70040
+ }
70041
+ }
70042
+ for (const bindingId of this.#bindings.keys()) {
70043
+ if (!inherited.has(bindingId)) yield bindingId;
70044
+ }
70045
+ }
70046
+ markReadonly(bindingId, errorMessage4) {
70047
+ const errors = this.#readonlyBindingErrors.get(bindingId);
70048
+ if (errors === void 0) {
70049
+ this.#readonlyBindingErrors.set(bindingId, [errorMessage4]);
70050
+ return;
70051
+ }
70052
+ errors.push(errorMessage4);
70053
+ }
70054
+ unmarkReadonly(bindingId) {
70055
+ const errors = this.#readonlyBindingErrors.get(bindingId);
70056
+ if (errors === void 0) return;
70057
+ errors.pop();
70058
+ if (errors.length === 0) this.#readonlyBindingErrors.delete(bindingId);
70059
+ }
70060
+ readonlyError(bindingId) {
70061
+ const errors = this.#readonlyBindingErrors.get(bindingId);
70062
+ if (errors !== void 0 && errors.length > 0) {
70063
+ return errors[errors.length - 1];
70064
+ }
70065
+ return this.parent?.readonlyError(bindingId);
70066
+ }
70067
+ };
70068
+ }
70069
+ });
70070
+
70071
+ // ../src/runtime/neoscript/NSGetterRuntimeError.ts
70072
+ var NSGetterRuntimeError, UncompiledInitializerRuntimeError;
70073
+ var init_NSGetterRuntimeError = __esm({
70074
+ "../src/runtime/neoscript/NSGetterRuntimeError.ts"() {
70075
+ "use strict";
70076
+ NSGetterRuntimeError = class extends Error {
70077
+ constructor(message) {
70078
+ super(message);
70079
+ this.name = "NSGetterRuntimeError";
70080
+ }
70081
+ };
70082
+ UncompiledInitializerRuntimeError = class extends NSGetterRuntimeError {
70083
+ constructor(memberId, memberName, initializer = null, valueId = null) {
70084
+ super(
70085
+ `Initializer for '${memberName}' has no compiled body; push the project so the server compiles it.`
70086
+ );
70087
+ this.memberId = memberId;
70088
+ this.initializer = initializer;
70089
+ this.valueId = valueId;
70090
+ this.name = "UncompiledInitializerRuntimeError";
70091
+ }
70092
+ memberId;
70093
+ initializer;
70094
+ valueId;
70095
+ };
70096
+ }
70097
+ });
70098
+
70099
+ // ../src/models/decimal/decimal-math.ts
70100
+ function pow10(exponent) {
70101
+ return TEN ** BigInt(exponent);
70102
+ }
70103
+ function assertCanonicalInput(value, argName) {
70104
+ const violation = getDecimalStringViolation(value);
70105
+ if (violation !== null) {
70106
+ throw new Error(
70107
+ `Decimal argument "${argName}" (${JSON.stringify(value)}) ${violation}.`
70108
+ );
70109
+ }
70110
+ }
70111
+ function parseDecimalArg(value, argName) {
70112
+ assertCanonicalInput(value, argName);
70113
+ const negative = value.startsWith("-");
70114
+ const unsigned = negative ? value.slice(1) : value;
70115
+ const pointIndex = unsigned.indexOf(".");
70116
+ const digits = pointIndex === -1 ? unsigned : unsigned.slice(0, pointIndex) + unsigned.slice(pointIndex + 1);
70117
+ const scale = pointIndex === -1 ? 0 : unsigned.length - pointIndex - 1;
70118
+ const magnitude = BigInt(digits);
70119
+ return { coefficient: negative ? -magnitude : magnitude, scale };
70120
+ }
70121
+ function formatDecimalParts(parts) {
70122
+ const negative = parts.coefficient < 0n;
70123
+ const digits = (negative ? -parts.coefficient : parts.coefficient).toString();
70124
+ let unsigned;
70125
+ if (parts.scale === 0) {
70126
+ unsigned = digits;
70127
+ } else {
70128
+ const padded = digits.padStart(parts.scale + 1, "0");
70129
+ const pointIndex = padded.length - parts.scale;
70130
+ unsigned = `${padded.slice(0, pointIndex)}.${padded.slice(pointIndex)}`;
70131
+ }
70132
+ if (parts.coefficient === 0n) return unsigned;
70133
+ return negative ? `-${unsigned}` : unsigned;
70134
+ }
70135
+ function significantDigitCount(coefficient) {
70136
+ const magnitude = coefficient < 0n ? -coefficient : coefficient;
70137
+ return magnitude.toString().length;
70138
+ }
70139
+ function assertWithinEnvelope(parts, operation) {
70140
+ if (significantDigitCount(parts.coefficient) > DECIMAL_MAX_SIGNIFICANT_DIGITS) {
70141
+ throw new DecimalOverflowError(
70142
+ `Decimal overflow in ${operation}: the exact result exceeds ${DECIMAL_MAX_SIGNIFICANT_DIGITS} significant digits. Round explicitly (Round/Divide) to reduce precision.`
70143
+ );
70144
+ }
70145
+ if (parts.scale > DECIMAL_MAX_SCALE) {
70146
+ throw new DecimalOverflowError(
70147
+ `Decimal overflow in ${operation}: the exact result exceeds scale ${DECIMAL_MAX_SCALE}. Round explicitly (Round/Divide) to reduce precision.`
70148
+ );
70149
+ }
70150
+ return parts;
70151
+ }
70152
+ function alignScales(a, b) {
70153
+ const scale = Math.max(a.scale, b.scale);
70154
+ return {
70155
+ a: a.coefficient * pow10(scale - a.scale),
70156
+ b: b.coefficient * pow10(scale - b.scale),
70157
+ scale
70158
+ };
70159
+ }
70160
+ function compareDecimalStrings(a, b) {
70161
+ const aligned = alignScales(parseDecimalArg(a, "a"), parseDecimalArg(b, "b"));
70162
+ if (aligned.a < aligned.b) return -1;
70163
+ if (aligned.a > aligned.b) return 1;
70164
+ return 0;
70165
+ }
70166
+ function minDecimalStrings(a, b) {
70167
+ return compareDecimalStrings(a, b) <= 0 ? a : b;
70168
+ }
70169
+ function maxDecimalStrings(a, b) {
70170
+ return compareDecimalStrings(a, b) >= 0 ? a : b;
70171
+ }
70172
+ function clampDecimalStrings(value, min, max) {
70173
+ if (compareDecimalStrings(min, max) > 0) {
70174
+ throw new DecimalClampRangeError(MATH_CLAMP_RANGE_MESSAGE);
70175
+ }
70176
+ if (compareDecimalStrings(value, min) < 0) return min;
70177
+ if (compareDecimalStrings(value, max) > 0) return max;
70178
+ return value;
70179
+ }
70180
+ function absDecimalString(value) {
70181
+ const parts = parseDecimalArg(value, "value");
70182
+ const magnitude = parts.coefficient < 0n ? -parts.coefficient : parts.coefficient;
70183
+ return formatDecimalParts({ coefficient: magnitude, scale: parts.scale });
70184
+ }
70185
+ function addDecimalStrings(a, b) {
70186
+ const aligned = alignScales(parseDecimalArg(a, "a"), parseDecimalArg(b, "b"));
70187
+ return formatDecimalParts(
70188
+ assertWithinEnvelope(
70189
+ { coefficient: aligned.a + aligned.b, scale: aligned.scale },
70190
+ "addition"
70191
+ )
70192
+ );
70193
+ }
70194
+ function subtractDecimalStrings(a, b) {
70195
+ const aligned = alignScales(parseDecimalArg(a, "a"), parseDecimalArg(b, "b"));
70196
+ return formatDecimalParts(
70197
+ assertWithinEnvelope(
70198
+ { coefficient: aligned.a - aligned.b, scale: aligned.scale },
70199
+ "subtraction"
70200
+ )
70201
+ );
70202
+ }
70203
+ function multiplyDecimalStrings(a, b) {
70204
+ const left = parseDecimalArg(a, "a");
70205
+ const right = parseDecimalArg(b, "b");
70206
+ return formatDecimalParts(
70207
+ assertWithinEnvelope(
70208
+ {
70209
+ coefficient: left.coefficient * right.coefficient,
70210
+ scale: left.scale + right.scale
70211
+ },
70212
+ "multiplication"
70213
+ )
70214
+ );
70215
+ }
70216
+ function assertDigitsInRange(digits, operation) {
70217
+ if (!Number.isInteger(digits)) {
70218
+ throw new DecimalDigitsRangeError(
70219
+ `Decimal ${operation} digits must be an integer (received ${digits}).`
70220
+ );
70221
+ }
70222
+ if (digits < 0 || digits > DECIMAL_MAX_SCALE) {
70223
+ throw new DecimalDigitsRangeError(
70224
+ `Decimal ${operation} digits must be between 0 and ${DECIMAL_MAX_SCALE} (received ${digits}).`
70225
+ );
70226
+ }
70227
+ }
70228
+ function roundParts(parts, digits) {
70229
+ if (digits >= parts.scale) return parts;
70230
+ const drop = parts.scale - digits;
70231
+ const divisor = pow10(drop);
70232
+ const negative = parts.coefficient < 0n;
70233
+ const magnitude = negative ? -parts.coefficient : parts.coefficient;
70234
+ let quotient = magnitude / divisor;
70235
+ const remainder = magnitude % divisor;
70236
+ const doubled = remainder * 2n;
70237
+ if (doubled > divisor || doubled === divisor && quotient % 2n === 1n) {
70238
+ quotient += 1n;
70239
+ }
70240
+ return { coefficient: negative ? -quotient : quotient, scale: digits };
70241
+ }
70242
+ function roundDecimalString(value, digits) {
70243
+ assertDigitsInRange(digits, "round");
70244
+ const rounded = roundParts(parseDecimalArg(value, "value"), digits);
70245
+ return formatDecimalParts(assertWithinEnvelope(rounded, "round"));
70246
+ }
70247
+ function toIntegralParts(parts, direction) {
70248
+ if (parts.scale === 0) return parts;
70249
+ const divisor = pow10(parts.scale);
70250
+ const quotient = parts.coefficient / divisor;
70251
+ const remainder = parts.coefficient % divisor;
70252
+ if (remainder === 0n) return { coefficient: quotient, scale: 0 };
70253
+ if (direction === "floor" && remainder < 0n) {
70254
+ return { coefficient: quotient - 1n, scale: 0 };
70255
+ }
70256
+ if (direction === "ceiling" && remainder > 0n) {
70257
+ return { coefficient: quotient + 1n, scale: 0 };
70258
+ }
70259
+ return { coefficient: quotient, scale: 0 };
70260
+ }
70261
+ function floorDecimalString(value) {
70262
+ const parts = toIntegralParts(parseDecimalArg(value, "value"), "floor");
70263
+ return formatDecimalParts(assertWithinEnvelope(parts, "floor"));
70264
+ }
70265
+ function ceilingDecimalString(value) {
70266
+ const parts = toIntegralParts(parseDecimalArg(value, "value"), "ceiling");
70267
+ return formatDecimalParts(assertWithinEnvelope(parts, "ceiling"));
70268
+ }
70269
+ function truncateDecimalString(value) {
70270
+ const parts = toIntegralParts(parseDecimalArg(value, "value"), "truncate");
70271
+ return formatDecimalParts(assertWithinEnvelope(parts, "truncate"));
70272
+ }
70273
+ function divideDecimalStrings(a, b, digits) {
70274
+ assertDigitsInRange(digits, "divide");
70275
+ const dividend = parseDecimalArg(a, "a");
70276
+ const divisor = parseDecimalArg(b, "b");
70277
+ if (divisor.coefficient === 0n) {
70278
+ throw new DecimalDivisionByZeroError(
70279
+ `Decimal division by zero: ${JSON.stringify(a)} / ${JSON.stringify(b)}.`
70280
+ );
70281
+ }
70282
+ const exponent = divisor.scale - dividend.scale + digits;
70283
+ let numerator = dividend.coefficient;
70284
+ let denominator = divisor.coefficient;
70285
+ if (exponent >= 0) {
70286
+ numerator *= pow10(exponent);
70287
+ } else {
70288
+ denominator *= pow10(-exponent);
70289
+ }
70290
+ const negative = numerator < 0n !== denominator < 0n;
70291
+ const absNumerator = numerator < 0n ? -numerator : numerator;
70292
+ const absDenominator = denominator < 0n ? -denominator : denominator;
70293
+ let quotient = absNumerator / absDenominator;
70294
+ const remainder = absNumerator % absDenominator;
70295
+ const doubled = remainder * 2n;
70296
+ if (doubled > absDenominator || doubled === absDenominator && quotient % 2n === 1n) {
70297
+ quotient += 1n;
70298
+ }
70299
+ const parts = {
70300
+ coefficient: negative ? -quotient : quotient,
70301
+ scale: digits
70302
+ };
70303
+ return formatDecimalParts(assertWithinEnvelope(parts, "division"));
70304
+ }
70305
+ function decimalStringFromFloat(value, digits) {
70306
+ assertDigitsInRange(digits, "float conversion");
70307
+ if (Number.isNaN(value)) {
70308
+ throw new DecimalNonFiniteError("Cannot convert NaN to a decimal.");
70309
+ }
70310
+ if (!Number.isFinite(value)) {
70311
+ throw new DecimalNonFiniteError(
70312
+ `Cannot convert ${value > 0 ? "Infinity" : "-Infinity"} to a decimal.`
70313
+ );
70314
+ }
70315
+ const view = new DataView(new ArrayBuffer(8));
70316
+ view.setFloat64(0, value);
70317
+ const bits = view.getBigUint64(0);
70318
+ const negative = bits >> 63n === 1n;
70319
+ const exponentBits = Number(bits >> 52n & 0x7ffn);
70320
+ const mantissaBits = bits & 0xfffffffffffffn;
70321
+ let mantissa;
70322
+ let exponent;
70323
+ if (exponentBits === 0) {
70324
+ mantissa = mantissaBits;
70325
+ exponent = -1074;
70326
+ } else {
70327
+ mantissa = mantissaBits | 1n << 52n;
70328
+ exponent = exponentBits - 1075;
70329
+ }
70330
+ if (mantissa === 0n) {
70331
+ return "0";
70332
+ }
70333
+ if (negative) mantissa = -mantissa;
70334
+ let parts;
70335
+ if (exponent >= 0) {
70336
+ parts = { coefficient: mantissa * (1n << BigInt(exponent)), scale: 0 };
70337
+ } else {
70338
+ parts = {
70339
+ coefficient: mantissa * 5n ** BigInt(-exponent),
70340
+ scale: -exponent
70341
+ };
70342
+ }
70343
+ while (parts.scale > 0 && parts.coefficient % TEN === 0n) {
70344
+ parts = { coefficient: parts.coefficient / TEN, scale: parts.scale - 1 };
70345
+ }
70346
+ const rounded = roundParts(parts, digits);
70347
+ return formatDecimalParts(assertWithinEnvelope(rounded, "float conversion"));
70348
+ }
70349
+ function floatFromDecimalString(value) {
70350
+ assertCanonicalInput(value, "value");
70351
+ return Number(value);
70352
+ }
70353
+ var DecimalOverflowError, DecimalDivisionByZeroError, DecimalDigitsRangeError, DecimalNonFiniteError, DecimalClampRangeError, MATH_CLAMP_RANGE_MESSAGE, TEN;
70354
+ var init_decimal_math = __esm({
70355
+ "../src/models/decimal/decimal-math.ts"() {
70356
+ "use strict";
70357
+ init_members();
70358
+ DecimalOverflowError = class extends Error {
70359
+ };
70360
+ DecimalDivisionByZeroError = class extends Error {
70361
+ };
70362
+ DecimalDigitsRangeError = class extends Error {
70363
+ };
70364
+ DecimalNonFiniteError = class extends Error {
70365
+ };
70366
+ DecimalClampRangeError = class extends Error {
70367
+ };
70368
+ MATH_CLAMP_RANGE_MESSAGE = "Math.Clamp requires min <= max.";
70369
+ TEN = 10n;
70370
+ }
70371
+ });
70372
+
70373
+ // ../src/models/decimal/index.ts
70374
+ var init_decimal = __esm({
70375
+ "../src/models/decimal/index.ts"() {
70376
+ "use strict";
70377
+ init_decimal_math();
70378
+ }
70379
+ });
70380
+
70381
+ // ../src/runtime/neoscript/evaluateNSGetter.ts
70351
70382
  function isCatchableNeoScriptRuntimeError(error) {
70352
70383
  return error instanceof NSGetterRuntimeError && !(error instanceof UncompiledInitializerRuntimeError) && !(error instanceof NonCatchableNSGetterRuntimeError);
70353
70384
  }
@@ -79196,7 +79227,7 @@ function iterateCollection(c, ctx, callback) {
79196
79227
  }
79197
79228
  var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeError, NativeFunctionDelegateUnavailableError, CorruptNeoScriptIRError, NeoScriptResourceLimitError, NeoScriptWallClockTimeoutError, DEFAULT_NEO_SCRIPT_EXECUTION_BUDGET_LIMITS, liveListIndexesByProject, evaluatorOwnershipCachesByBase, MAX_CONSTRUCTION_DEPTH, MAX_LOOP_ITERATIONS, resolutionCacheByMembers, NO_SCHEMA_REVISION, LazyValueOverlay, READONLY_FOREACH_BINDING_ERROR, READONLY_CATCH_BINDING_ERROR, NS_MATH_OP_NAMES, DOUBLE_INTEGRAL_MAGNITUDE, EMPTY_SUPPLIED_CONSTRUCTOR_FIELDS;
79198
79229
  var init_evaluateNSGetter = __esm({
79199
- "../src/view-models/neoscript-evaluator/evaluateNSGetter.ts"() {
79230
+ "../src/runtime/neoscript/evaluateNSGetter.ts"() {
79200
79231
  "use strict";
79201
79232
  init_deep_clone_plain_data();
79202
79233
  init_instance_provenance();
@@ -79575,7 +79606,229 @@ var init_stored_value_placement_index = __esm({
79575
79606
  }
79576
79607
  });
79577
79608
 
79578
- // ../src/database/virtual-instance-values.ts
79609
+ // ../src/runtime/initializer-materialization.ts
79610
+ function declarationInitializerContext(document) {
79611
+ const key = initializerEvaluatorCacheKey(document);
79612
+ const revision = initializerEvaluatorCacheRevision(document);
79613
+ const cached = declarationInitializerContextByDocument.get(key);
79614
+ if (cached !== void 0 && (revision === void 0 ? cached.members === document.members && cached.values === document.values : cached.revision === revision)) {
79615
+ return cached.context;
79616
+ }
79617
+ const initializerValueIds = new Set(
79618
+ document.values.filter(isInitValueContent).map((value) => value.id)
79619
+ );
79620
+ const valuesById = new Map(
79621
+ document.values.map((value) => [value.id, value])
79622
+ );
79623
+ const rootOwners = /* @__PURE__ */ new Map();
79624
+ resolveOwnerMembersForValues(
79625
+ document,
79626
+ initializerValueIds,
79627
+ void 0,
79628
+ rootOwners
79629
+ );
79630
+ const created = { valuesById, rootOwners };
79631
+ declarationInitializerContextByDocument.set(key, {
79632
+ members: document.members,
79633
+ values: document.values,
79634
+ revision,
79635
+ context: created
79636
+ });
79637
+ return created;
79638
+ }
79639
+ function evaluateInitializerMaterialization(args) {
79640
+ const createdValues = [];
79641
+ const storageKeyDeclarations = /* @__PURE__ */ new Map();
79642
+ const evaluated = args.evaluateInitializer({
79643
+ init: args.init,
79644
+ member: args.member,
79645
+ document: args.document,
79646
+ createdValues,
79647
+ storageKeyDeclarations,
79648
+ ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
79649
+ ...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
79650
+ ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
79651
+ sourceValueId: args.sourceValueId ?? null,
79652
+ readTracking: args.readTracking,
79653
+ saveStaticBindings: args.saveStaticBindings,
79654
+ sessionStaticBindings: args.sessionStaticBindings
79655
+ });
79656
+ return { evaluated, createdValues, storageKeyDeclarations };
79657
+ }
79658
+ function finalizeMaterializedRoot(args) {
79659
+ for (const created of args.allCreated) {
79660
+ if (created === args.root) continue;
79661
+ if (created.classId === void 0) delete created.classId;
79662
+ }
79663
+ stampCreatedValuesMapKey(args.allCreated, args.mapKey);
79664
+ if (args.supersededRootId !== void 0) {
79665
+ args.storageKeyDeclarations.delete(args.supersededRootId);
79666
+ }
79667
+ args.storageKeyDeclarations.delete(args.root.id);
79668
+ applyDeclaredStorageKeyOverrides({
79669
+ createdValues: args.allCreated,
79670
+ declarationByValueId: args.storageKeyDeclarations,
79671
+ existingParentContextById: /* @__PURE__ */ new Map([
79672
+ [
79673
+ args.root.id,
79674
+ {
79675
+ mapKey: args.mapKey ?? null,
79676
+ classId: args.root.classId ?? void 0
79677
+ }
79678
+ ]
79679
+ ])
79680
+ });
79681
+ }
79682
+ function materializeInitializerValue(args) {
79683
+ const { evaluated, createdValues, storageKeyDeclarations } = evaluateInitializerMaterialization({
79684
+ evaluateInitializer: args.evaluateInitializer,
79685
+ init: args.row.init,
79686
+ member: args.member,
79687
+ document: args.document,
79688
+ ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
79689
+ ...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
79690
+ ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
79691
+ sourceValueId: args.row.id,
79692
+ readTracking: args.readTracking,
79693
+ saveStaticBindings: args.saveStaticBindings,
79694
+ sessionStaticBindings: args.sessionStaticBindings
79695
+ });
79696
+ const {
79697
+ init: _init,
79698
+ value: _value,
79699
+ classId: _classId,
79700
+ ...envelope
79701
+ } = args.row;
79702
+ void _init;
79703
+ void _value;
79704
+ void _classId;
79705
+ const root = {
79706
+ ...envelope,
79707
+ value: evaluated.value,
79708
+ ...evaluated.classId === null ? {} : { classId: evaluated.classId },
79709
+ ...evaluated.genericBindings === void 0 ? {} : { genericBindings: { ...evaluated.genericBindings } },
79710
+ ...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(evaluated.constructorArgs) },
79711
+ ...evaluated.instanceConstructorId === void 0 ? {} : { instanceConstructorId: evaluated.instanceConstructorId },
79712
+ ...evaluated.instanceVariantId === void 0 ? {} : { instanceVariantId: evaluated.instanceVariantId },
79713
+ ...evaluated.instanceVariantRowValueId === void 0 ? {} : {
79714
+ instanceVariantRowValueId: evaluated.instanceVariantRowValueId
79715
+ }
79716
+ };
79717
+ const allCreated = [root, ...createdValues];
79718
+ if (evaluated.provisionalRootId !== void 0) {
79719
+ retargetDelegateReceiverValueIds(
79720
+ allCreated,
79721
+ evaluated.provisionalRootId,
79722
+ root.id
79723
+ );
79724
+ }
79725
+ finalizeMaterializedRoot({
79726
+ root,
79727
+ allCreated,
79728
+ mapKey: args.row.mapKey,
79729
+ storageKeyDeclarations
79730
+ });
79731
+ return {
79732
+ root,
79733
+ createdValues,
79734
+ pinnedRootSchemaKeys: evaluated.pinnedRootSchemaKeys ?? /* @__PURE__ */ new Set()
79735
+ };
79736
+ }
79737
+ function materializeMemberDefaultValue(args) {
79738
+ const createdValues = [];
79739
+ const storageKeyDeclarations = /* @__PURE__ */ new Map();
79740
+ args.readTracking?.recordUnattributableValueRead(
79741
+ `declaration-owner-resolution:${args.envelope.id}`
79742
+ );
79743
+ const { valuesById, rootOwners } = declarationInitializerContext(
79744
+ args.document
79745
+ );
79746
+ const declarationArguments = (member, init, sourceValueId) => {
79747
+ const ownerClass = typeof sourceValueId === "string" ? initializerOwnerContext(
79748
+ args.document,
79749
+ sourceValueId,
79750
+ rootOwners,
79751
+ valuesById
79752
+ ).ownerClass : typeof Reflect.get(member, "id") === "string" ? findSchemaPlacement(
79753
+ String(Reflect.get(member, "id")),
79754
+ args.document.classes
79755
+ )?.ownerClass ?? null : null;
79756
+ if (ownerClass === null) return [];
79757
+ const constructorId = ownerClass.requiredConstructorId;
79758
+ if (typeof constructorId !== "string") return [];
79759
+ const constructor2 = args.document.constructors?.find(
79760
+ (candidate) => candidate.id === constructorId
79761
+ );
79762
+ if (constructor2 === void 0) return [];
79763
+ const parameterNames = new Set(
79764
+ constructor2.argumentTypes.map((argument2) => argument2.name)
79765
+ );
79766
+ return declarationInitializerArgumentValues(
79767
+ constructor2.argumentTypes,
79768
+ `Declaration template on '${ownerClass.name}'`,
79769
+ initializerReferencesAnyIdentifier(init.code, parameterNames)
79770
+ );
79771
+ };
79772
+ const built = buildDefaultMemberValue({
79773
+ document: args.document,
79774
+ projectId: args.envelope.projectId,
79775
+ member: args.member,
79776
+ createdValues,
79777
+ storageKeyDeclarations,
79778
+ ...args.genericEnv === void 0 ? {} : { genericEnv: args.genericEnv },
79779
+ // A declaration default may itself be init-backed one level down (P43 §2),
79780
+ // and those nested initializers must evaluate against the same document.
79781
+ initEvaluator: (member, init, sourceValueId) => args.evaluateInitializer({
79782
+ init,
79783
+ member,
79784
+ document: args.document,
79785
+ createdValues,
79786
+ storedConstructionReplay: true,
79787
+ argumentValues: declarationArguments(
79788
+ member,
79789
+ init,
79790
+ sourceValueId ?? null
79791
+ ),
79792
+ sourceValueId: sourceValueId ?? null,
79793
+ readTracking: args.readTracking,
79794
+ saveStaticBindings: args.saveStaticBindings,
79795
+ sessionStaticBindings: args.sessionStaticBindings
79796
+ })
79797
+ });
79798
+ const interior = createdValues.filter((created) => created.id !== built.id);
79799
+ const root = {
79800
+ ...args.envelope,
79801
+ value: built.value,
79802
+ ...built.classId === void 0 ? {} : { classId: built.classId },
79803
+ ...built.genericBindings == null ? {} : { genericBindings: { ...built.genericBindings } }
79804
+ };
79805
+ const allCreated = [root, ...interior];
79806
+ retargetDelegateReceiverValueIds(allCreated, built.id, root.id);
79807
+ finalizeMaterializedRoot({
79808
+ root,
79809
+ allCreated,
79810
+ mapKey: args.envelope.mapKey,
79811
+ storageKeyDeclarations,
79812
+ supersededRootId: built.id
79813
+ });
79814
+ return { root, createdValues: interior, pinnedRootSchemaKeys: /* @__PURE__ */ new Set() };
79815
+ }
79816
+ var declarationInitializerContextByDocument;
79817
+ var init_initializer_materialization = __esm({
79818
+ "../src/runtime/initializer-materialization.ts"() {
79819
+ "use strict";
79820
+ init_deep_clone_plain_data();
79821
+ init_members();
79822
+ init_inheritance();
79823
+ init_evaluateNSGetter();
79824
+ init_initializer_context();
79825
+ init_value_row_owner_members();
79826
+ init_compile_ns_property();
79827
+ declarationInitializerContextByDocument = /* @__PURE__ */ new WeakMap();
79828
+ }
79829
+ });
79830
+
79831
+ // ../src/runtime/virtual-instance-graph.ts
79579
79832
  function buildVirtualInstanceMaterializedIndex(args) {
79580
79833
  const rowsById = new Map(
79581
79834
  (args.materializedRows ?? args.document.values).map((row) => [row.id, row])
@@ -79821,6 +80074,7 @@ function expandStoredInstance(args) {
79821
80074
  };
79822
80075
  return trackMaterialization(
79823
80076
  () => materializeInitializerValue({
80077
+ evaluateInitializer: args.evaluateInitializer,
79824
80078
  document: args.document,
79825
80079
  member: replayMember,
79826
80080
  row: { ...envelope, init },
@@ -79836,6 +80090,7 @@ function expandStoredInstance(args) {
79836
80090
  const stampEnv = instanceRoot.genericBindings == null || Object.keys(instanceRoot.genericBindings).length === 0 ? null : envFromStamp(instanceRoot.genericBindings);
79837
80091
  const built = trackMaterialization(
79838
80092
  () => materializeMemberDefaultValue({
80093
+ evaluateInitializer: args.evaluateInitializer,
79839
80094
  document: args.document,
79840
80095
  member: replayMember,
79841
80096
  envelope,
@@ -80213,6 +80468,7 @@ function resolvedStoredInstanceRows(args) {
80213
80468
  if (next === void 0 || resolvedRootIds.has(next.root.id)) continue;
80214
80469
  resolvedRootIds.add(next.root.id);
80215
80470
  const expanded = expandStoredInstance({
80471
+ evaluateInitializer: args.evaluateInitializer,
80216
80472
  document,
80217
80473
  instanceRoot: next.root,
80218
80474
  rootMember: next.member
@@ -81558,6 +81814,7 @@ function resolveVariantInstanceGraphForDocument(args) {
81558
81814
  for (const row of args.localRows) materializedById.set(row.id, row);
81559
81815
  materializedById.set(args.priorInstanceRoot.id, args.priorInstanceRoot);
81560
81816
  const priorExpanded = expandStoredInstance({
81817
+ evaluateInitializer: args.evaluateInitializer,
81561
81818
  document,
81562
81819
  instanceRoot: args.priorInstanceRoot,
81563
81820
  rootMember,
@@ -81596,6 +81853,7 @@ function resolveVariantInstanceGraphForDocument(args) {
81596
81853
  }
81597
81854
  materializedById.set(args.nextInstanceRoot.id, args.nextInstanceRoot);
81598
81855
  const nextExpanded = expandStoredInstance({
81856
+ evaluateInitializer: args.evaluateInitializer,
81599
81857
  document,
81600
81858
  instanceRoot: args.nextInstanceRoot,
81601
81859
  rootMember,
@@ -81681,6 +81939,7 @@ function createHeadlessVirtualInstanceResolver(args) {
81681
81939
  materializedRows: document.values
81682
81940
  });
81683
81941
  const expanded = expandStoredInstance({
81942
+ evaluateInitializer: args.evaluateInitializer,
81684
81943
  document: resolverDocument,
81685
81944
  instanceRoot,
81686
81945
  rootMember: member,
@@ -81740,8 +81999,8 @@ function createHeadlessVirtualInstanceResolver(args) {
81740
81999
  };
81741
82000
  }
81742
82001
  var KEPT_ROW_SAMPLE_LIMIT, CORPUS_SCANNING_MEMBER_KINDS, VirtualExpansionUnsupportedError, ROOT_PATH, SYNTHETIC_LINEAGE_PREFIXES, resolverDocumentsByDocument;
81743
- var init_virtual_instance_values = __esm({
81744
- "../src/database/virtual-instance-values.ts"() {
82002
+ var init_virtual_instance_graph = __esm({
82003
+ "../src/runtime/virtual-instance-graph.ts"() {
81745
82004
  "use strict";
81746
82005
  init_deep_clone_plain_data();
81747
82006
  init_inheritance();
@@ -81755,8 +82014,8 @@ var init_virtual_instance_values = __esm({
81755
82014
  init_instance_provenance();
81756
82015
  init_unordered_list_membership();
81757
82016
  init_neoscript();
81758
- init_evaluateInitializer();
81759
- init_init_backed_value_materialization();
82017
+ init_initializer_context();
82018
+ init_initializer_materialization();
81760
82019
  init_constructor_argument_ownership();
81761
82020
  init_constructors2();
81762
82021
  init_src();
@@ -81777,13 +82036,7 @@ var init_virtual_instance_values = __esm({
81777
82036
  }
81778
82037
  });
81779
82038
 
81780
- // ../src/view-models/neoscript-evaluator/evaluateInitializer.ts
81781
- function initializerEvaluatorCacheKey(document) {
81782
- return document.evaluatorCache?.key ?? document;
81783
- }
81784
- function initializerEvaluatorCacheRevision(document) {
81785
- return document.evaluatorCache?.revision;
81786
- }
82039
+ // ../src/runtime/neoscript/evaluateInitializer.ts
81787
82040
  function initializerEvaluatorLookups(document, readTracking) {
81788
82041
  const trackedHeadless = readTracking !== void 0 && document.databaseVM === void 0;
81789
82042
  const indexKey = initializerEvaluatorCacheKey(document);
@@ -81843,6 +82096,7 @@ function initializerEvaluatorLookups(document, readTracking) {
81843
82096
  revision
81844
82097
  );
81845
82098
  const headlessVirtualResolver = document.databaseVM === void 0 ? createHeadlessVirtualInstanceResolver({
82099
+ evaluateInitializer: evaluateMemberInitializer,
81846
82100
  document,
81847
82101
  resolverLookups: () => lookups,
81848
82102
  ...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) }
@@ -81861,6 +82115,7 @@ function initializerEvaluatorLookups(document, readTracking) {
81861
82115
  // resolves against the plain document, with these lookups as the
81862
82116
  // nested resolver.
81863
82117
  resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
82118
+ evaluateInitializer: evaluateMemberInitializer,
81864
82119
  document,
81865
82120
  resolverLookups: lookups,
81866
82121
  ...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) },
@@ -82094,279 +82349,86 @@ function evaluateMemberInitializer(args) {
82094
82349
  }
82095
82350
  };
82096
82351
  }
82097
- var evaluatorLookupsByDocument, indexedEvaluatorLookupsByDocument, InitializerReadSet;
82352
+ var evaluatorLookupsByDocument, indexedEvaluatorLookupsByDocument;
82098
82353
  var init_evaluateInitializer = __esm({
82099
- "../src/view-models/neoscript-evaluator/evaluateInitializer.ts"() {
82354
+ "../src/runtime/neoscript/evaluateInitializer.ts"() {
82100
82355
  "use strict";
82356
+ init_initializer_context();
82101
82357
  init_deep_clone_plain_data();
82102
- init_collections();
82103
82358
  init_instance_provenance();
82104
82359
  init_members();
82105
82360
  init_project2();
82106
82361
  init_evaluateNSGetter();
82107
- init_virtual_instance_values();
82362
+ init_virtual_instance_graph();
82108
82363
  evaluatorLookupsByDocument = /* @__PURE__ */ new WeakMap();
82109
82364
  indexedEvaluatorLookupsByDocument = /* @__PURE__ */ new WeakMap();
82110
- InitializerReadSet = class {
82111
- valueIds = /* @__PURE__ */ new Set();
82112
- localizedTextIds = /* @__PURE__ */ new Set();
82113
- variantIds = /* @__PURE__ */ new Set();
82114
- containerIds = /* @__PURE__ */ new Set();
82115
- staticMemberIds = /* @__PURE__ */ new Set();
82116
- hasValuePlacementRead = false;
82117
- hasUnattributableValueRead = false;
82118
- recordUnattributableValueRead = (_reason) => {
82119
- void _reason;
82120
- this.hasUnattributableValueRead = true;
82121
- };
82122
- recordValuePlacementRead = () => {
82123
- this.hasValuePlacementRead = true;
82124
- };
82125
- };
82126
82365
  }
82127
82366
  });
82128
82367
 
82129
- // ../src/view-models/neoscript-evaluator/index.ts
82130
- var init_neoscript_evaluator = __esm({
82131
- "../src/view-models/neoscript-evaluator/index.ts"() {
82368
+ // ../src/runtime/materialize-values.ts
82369
+ function materializeInitializerValue2(args) {
82370
+ return materializeInitializerValue({
82371
+ ...args,
82372
+ evaluateInitializer: evaluateMemberInitializer
82373
+ });
82374
+ }
82375
+ var init_materialize_values = __esm({
82376
+ "../src/runtime/materialize-values.ts"() {
82132
82377
  "use strict";
82133
- init_NSGetterRuntimeError();
82134
- init_evaluateNSGetter();
82135
82378
  init_evaluateInitializer();
82379
+ init_initializer_materialization();
82136
82380
  }
82137
82381
  });
82138
82382
 
82139
- // ../src/database/init-backed-value-materialization.ts
82140
- function declarationInitializerContext(document) {
82141
- const key = initializerEvaluatorCacheKey(document);
82142
- const revision = initializerEvaluatorCacheRevision(document);
82143
- const cached = declarationInitializerContextByDocument.get(key);
82144
- if (cached !== void 0 && (revision === void 0 ? cached.members === document.members && cached.values === document.values : cached.revision === revision)) {
82145
- return cached.context;
82146
- }
82147
- const initializerValueIds = new Set(
82148
- document.values.filter(isInitValueContent).map((value) => value.id)
82149
- );
82150
- const valuesById = new Map(
82151
- document.values.map((value) => [value.id, value])
82152
- );
82153
- const rootOwners = /* @__PURE__ */ new Map();
82154
- resolveOwnerMembersForValues(
82155
- document,
82156
- initializerValueIds,
82157
- void 0,
82158
- rootOwners
82159
- );
82160
- const created = { valuesById, rootOwners };
82161
- declarationInitializerContextByDocument.set(key, {
82162
- members: document.members,
82163
- values: document.values,
82164
- revision,
82165
- context: created
82166
- });
82167
- return created;
82168
- }
82169
- function evaluateInitializerMaterialization(args) {
82170
- const createdValues = [];
82171
- const storageKeyDeclarations = /* @__PURE__ */ new Map();
82172
- const evaluated = evaluateMemberInitializer({
82173
- init: args.init,
82174
- member: args.member,
82175
- document: args.document,
82176
- createdValues,
82177
- storageKeyDeclarations,
82178
- ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
82179
- ...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
82180
- ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
82181
- sourceValueId: args.sourceValueId ?? null,
82182
- readTracking: args.readTracking,
82183
- saveStaticBindings: args.saveStaticBindings,
82184
- sessionStaticBindings: args.sessionStaticBindings
82383
+ // ../src/runtime/virtual-instance-values.ts
82384
+ function expandStoredInstance2(args) {
82385
+ return expandStoredInstance({
82386
+ ...args,
82387
+ evaluateInitializer: evaluateMemberInitializer
82185
82388
  });
82186
- return { evaluated, createdValues, storageKeyDeclarations };
82187
82389
  }
82188
- function finalizeMaterializedRoot(args) {
82189
- for (const created of args.allCreated) {
82190
- if (created === args.root) continue;
82191
- if (created.classId === void 0) delete created.classId;
82192
- }
82193
- stampCreatedValuesMapKey(args.allCreated, args.mapKey);
82194
- if (args.supersededRootId !== void 0) {
82195
- args.storageKeyDeclarations.delete(args.supersededRootId);
82196
- }
82197
- args.storageKeyDeclarations.delete(args.root.id);
82198
- applyDeclaredStorageKeyOverrides({
82199
- createdValues: args.allCreated,
82200
- declarationByValueId: args.storageKeyDeclarations,
82201
- existingParentContextById: /* @__PURE__ */ new Map([
82202
- [
82203
- args.root.id,
82204
- {
82205
- mapKey: args.mapKey ?? null,
82206
- classId: args.root.classId ?? void 0
82207
- }
82208
- ]
82209
- ])
82390
+ function resolvedStoredInstanceRows2(args) {
82391
+ return resolvedStoredInstanceRows({
82392
+ ...args,
82393
+ evaluateInitializer: evaluateMemberInitializer
82210
82394
  });
82211
82395
  }
82212
- function materializeInitializerValue(args) {
82213
- const { evaluated, createdValues, storageKeyDeclarations } = evaluateInitializerMaterialization({
82214
- init: args.row.init,
82215
- member: args.member,
82216
- document: args.document,
82217
- ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
82218
- ...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
82219
- ...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
82220
- sourceValueId: args.row.id,
82221
- readTracking: args.readTracking,
82222
- saveStaticBindings: args.saveStaticBindings,
82223
- sessionStaticBindings: args.sessionStaticBindings
82224
- });
82225
- const {
82226
- init: _init,
82227
- value: _value,
82228
- classId: _classId,
82229
- ...envelope
82230
- } = args.row;
82231
- void _init;
82232
- void _value;
82233
- void _classId;
82234
- const root = {
82235
- ...envelope,
82236
- value: evaluated.value,
82237
- ...evaluated.classId === null ? {} : { classId: evaluated.classId },
82238
- ...evaluated.genericBindings === void 0 ? {} : { genericBindings: { ...evaluated.genericBindings } },
82239
- ...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(evaluated.constructorArgs) },
82240
- ...evaluated.instanceConstructorId === void 0 ? {} : { instanceConstructorId: evaluated.instanceConstructorId },
82241
- ...evaluated.instanceVariantId === void 0 ? {} : { instanceVariantId: evaluated.instanceVariantId },
82242
- ...evaluated.instanceVariantRowValueId === void 0 ? {} : {
82243
- instanceVariantRowValueId: evaluated.instanceVariantRowValueId
82244
- }
82245
- };
82246
- const allCreated = [root, ...createdValues];
82247
- if (evaluated.provisionalRootId !== void 0) {
82248
- retargetDelegateReceiverValueIds(
82249
- allCreated,
82250
- evaluated.provisionalRootId,
82251
- root.id
82252
- );
82253
- }
82254
- finalizeMaterializedRoot({
82255
- root,
82256
- allCreated,
82257
- mapKey: args.row.mapKey,
82258
- storageKeyDeclarations
82396
+ function resolveVariantInstanceGraphForDocument2(args) {
82397
+ return resolveVariantInstanceGraphForDocument({
82398
+ ...args,
82399
+ evaluateInitializer: evaluateMemberInitializer
82259
82400
  });
82260
- return {
82261
- root,
82262
- createdValues,
82263
- pinnedRootSchemaKeys: evaluated.pinnedRootSchemaKeys ?? /* @__PURE__ */ new Set()
82264
- };
82265
82401
  }
82266
- function materializeMemberDefaultValue(args) {
82267
- const createdValues = [];
82268
- const storageKeyDeclarations = /* @__PURE__ */ new Map();
82269
- args.readTracking?.recordUnattributableValueRead(
82270
- `declaration-owner-resolution:${args.envelope.id}`
82271
- );
82272
- const { valuesById, rootOwners } = declarationInitializerContext(
82273
- args.document
82274
- );
82275
- const declarationArguments = (member, init, sourceValueId) => {
82276
- const ownerClass = typeof sourceValueId === "string" ? initializerOwnerContext(
82277
- args.document,
82278
- sourceValueId,
82279
- rootOwners,
82280
- valuesById
82281
- ).ownerClass : typeof Reflect.get(member, "id") === "string" ? findSchemaPlacement(
82282
- String(Reflect.get(member, "id")),
82283
- args.document.classes
82284
- )?.ownerClass ?? null : null;
82285
- if (ownerClass === null) return [];
82286
- const constructorId = ownerClass.requiredConstructorId;
82287
- if (typeof constructorId !== "string") return [];
82288
- const constructor2 = args.document.constructors?.find(
82289
- (candidate) => candidate.id === constructorId
82290
- );
82291
- if (constructor2 === void 0) return [];
82292
- const parameterNames = new Set(
82293
- constructor2.argumentTypes.map((argument2) => argument2.name)
82294
- );
82295
- return declarationInitializerArgumentValues(
82296
- constructor2.argumentTypes,
82297
- `Declaration template on '${ownerClass.name}'`,
82298
- initializerReferencesAnyIdentifier(init.code, parameterNames)
82299
- );
82300
- };
82301
- const built = buildDefaultMemberValue({
82302
- document: args.document,
82303
- projectId: args.envelope.projectId,
82304
- member: args.member,
82305
- createdValues,
82306
- storageKeyDeclarations,
82307
- ...args.genericEnv === void 0 ? {} : { genericEnv: args.genericEnv },
82308
- // A declaration default may itself be init-backed one level down (P43 §2),
82309
- // and those nested initializers must evaluate against the same document.
82310
- initEvaluator: (member, init, sourceValueId) => evaluateMemberInitializer({
82311
- init,
82312
- member,
82313
- document: args.document,
82314
- createdValues,
82315
- storedConstructionReplay: true,
82316
- argumentValues: declarationArguments(
82317
- member,
82318
- init,
82319
- sourceValueId ?? null
82320
- ),
82321
- sourceValueId: sourceValueId ?? null,
82322
- readTracking: args.readTracking,
82323
- saveStaticBindings: args.saveStaticBindings,
82324
- sessionStaticBindings: args.sessionStaticBindings
82325
- })
82326
- });
82327
- const interior = createdValues.filter((created) => created.id !== built.id);
82328
- const root = {
82329
- ...args.envelope,
82330
- value: built.value,
82331
- ...built.classId === void 0 ? {} : { classId: built.classId },
82332
- ...built.genericBindings == null ? {} : { genericBindings: { ...built.genericBindings } }
82333
- };
82334
- const allCreated = [root, ...interior];
82335
- retargetDelegateReceiverValueIds(allCreated, built.id, root.id);
82336
- finalizeMaterializedRoot({
82337
- root,
82338
- allCreated,
82339
- mapKey: args.envelope.mapKey,
82340
- storageKeyDeclarations,
82341
- supersededRootId: built.id
82402
+ function createHeadlessVirtualInstanceResolver2(args) {
82403
+ return createHeadlessVirtualInstanceResolver({
82404
+ ...args,
82405
+ evaluateInitializer: evaluateMemberInitializer
82342
82406
  });
82343
- return { root, createdValues: interior, pinnedRootSchemaKeys: /* @__PURE__ */ new Set() };
82344
82407
  }
82345
- var declarationInitializerContextByDocument;
82346
- var init_init_backed_value_materialization = __esm({
82347
- "../src/database/init-backed-value-materialization.ts"() {
82408
+ var init_virtual_instance_values = __esm({
82409
+ "../src/runtime/virtual-instance-values.ts"() {
82348
82410
  "use strict";
82349
- init_deep_clone_plain_data();
82350
- init_members();
82351
- init_inheritance();
82352
- init_neoscript_evaluator();
82353
- init_evaluateNSGetter();
82354
82411
  init_evaluateInitializer();
82355
- init_value_row_owner_members();
82356
- init_compile_ns_property();
82357
- declarationInitializerContextByDocument = /* @__PURE__ */ new WeakMap();
82412
+ init_virtual_instance_graph();
82413
+ init_virtual_instance_graph();
82358
82414
  }
82359
82415
  });
82360
82416
 
82361
82417
  // ../convex/projectDocumentDialogueMaterialization.ts
82362
82418
  function materializeDialogues(dialogueRecords, dialogueNodes) {
82419
+ const nodesByDialogue = /* @__PURE__ */ new Map();
82420
+ for (const node of dialogueNodes) {
82421
+ const dialogueId = getDialogueNodeDialogueId(node);
82422
+ if (dialogueId === null) continue;
82423
+ const nodes = nodesByDialogue.get(dialogueId) ?? [];
82424
+ nodes.push(node);
82425
+ nodesByDialogue.set(dialogueId, nodes);
82426
+ }
82363
82427
  return dialogueRecords.map((dialogue) => {
82364
82428
  if (!isRecordWithStringId(dialogue)) return dialogue;
82365
82429
  const { triggerNodeId: _triggerNodeId, ...dialoguePayload } = dialogue;
82366
82430
  void _triggerNodeId;
82367
- const nodes = dialogueNodes.filter(
82368
- (node) => getDialogueNodeDialogueId(node) === dialogue.id
82369
- );
82431
+ const nodes = nodesByDialogue.get(dialogue.id) ?? [];
82370
82432
  const triggerNode = findDialogueTriggerNode(dialogue, nodes);
82371
82433
  const bodyNodes = Object.fromEntries(
82372
82434
  nodes.flatMap((node) => {
@@ -82540,7 +82602,6 @@ __export(project_document_read_exports, {
82540
82602
  readProjectDocumentContentHashHeads: () => readProjectDocumentContentHashHeads,
82541
82603
  readProjectDocumentManifestPage: () => readProjectDocumentManifestPage,
82542
82604
  readProjectDocumentManifestPageRecords: () => readProjectDocumentManifestPageRecords,
82543
- readProjectDocumentManifestRecords: () => readProjectDocumentManifestRecords,
82544
82605
  readProjectDocumentRevisionMarker: () => readProjectDocumentRevisionMarker,
82545
82606
  withStoredValueBase: () => withStoredValueBase
82546
82607
  });
@@ -82781,7 +82842,10 @@ async function fetchProjectDocumentSnapshots(fetchBatch, snapshotIds) {
82781
82842
  }
82782
82843
  }
82783
82844
  });
82784
- await Promise.all(workers);
82845
+ const outcomes = await Promise.allSettled(workers);
82846
+ for (const outcome of outcomes) {
82847
+ if (outcome.status === "rejected") throw outcome.reason;
82848
+ }
82785
82849
  return snapshotsById;
82786
82850
  }
82787
82851
  function readProjectDocumentSnapshotBatch(value, requestedIds) {
@@ -89476,6 +89540,17 @@ var init_packed_value_parity = __esm({
89476
89540
  }
89477
89541
  });
89478
89542
 
89543
+ // ../src/runtime/neoscript/index.ts
89544
+ var init_neoscript2 = __esm({
89545
+ "../src/runtime/neoscript/index.ts"() {
89546
+ "use strict";
89547
+ init_NSGetterRuntimeError();
89548
+ init_evaluateNSGetter();
89549
+ init_evaluateInitializer();
89550
+ init_initializer_context();
89551
+ }
89552
+ });
89553
+
89479
89554
  // ../src/database/headless-virtual-instance-lookups.ts
89480
89555
  function headlessVirtualInstanceLookups(document, options = {}) {
89481
89556
  const members = document.members;
@@ -89493,7 +89568,7 @@ function headlessVirtualInstanceLookups(document, options = {}) {
89493
89568
  }
89494
89569
  } : {}
89495
89570
  );
89496
- const virtual = createHeadlessVirtualInstanceResolver({
89571
+ const virtual = createHeadlessVirtualInstanceResolver2({
89497
89572
  document: {
89498
89573
  ...expandedDocument,
89499
89574
  ...options.initializerCompiler === void 0 ? {} : { initializerCompiler: options.initializerCompiler }
@@ -89511,7 +89586,7 @@ function headlessVirtualInstanceLookups(document, options = {}) {
89511
89586
  virtualInstanceRowsForValue: (receiverValueId) => virtual.virtualInstanceRowsForValue(receiverValueId),
89512
89587
  // Stored-construction replay evaluates `ToVariant`, and production's
89513
89588
  // variant-constructed placements collapse through exactly this path.
89514
- resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
89589
+ resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument2({
89515
89590
  document,
89516
89591
  resolverLookups: lookups,
89517
89592
  ...args
@@ -89528,7 +89603,7 @@ var init_headless_virtual_instance_lookups = __esm({
89528
89603
  "use strict";
89529
89604
  init_virtual_instance_values();
89530
89605
  init_packed_value_encoding();
89531
- init_neoscript_evaluator();
89606
+ init_neoscript2();
89532
89607
  }
89533
89608
  });
89534
89609
 
@@ -90884,7 +90959,7 @@ function materializedInitializerReconciliationFailuresV4(args) {
90884
90959
  let effectiveCurrentRows = currentRows;
90885
90960
  if (currentRoot !== void 0) {
90886
90961
  try {
90887
- effectiveCurrentRows = resolvedStoredInstanceRows({
90962
+ effectiveCurrentRows = resolvedStoredInstanceRows2({
90888
90963
  // The replay immediately above compiled the constructor records
90889
90964
  // that turn this pulled document into an evaluator document.
90890
90965
  document,
@@ -96104,7 +96179,7 @@ var init_project_migration_runner = __esm({
96104
96179
  "../src/database/project-migration-runner.ts"() {
96105
96180
  "use strict";
96106
96181
  init_compiler_adapter();
96107
- init_neoscript_evaluator();
96182
+ init_neoscript2();
96108
96183
  init_members();
96109
96184
  init_packed_value_encoding();
96110
96185
  init_project_root_members();
@@ -97921,7 +97996,7 @@ function provenVirtualValueIds(args) {
97921
97996
  return /* @__PURE__ */ new Set();
97922
97997
  }
97923
97998
  const document = args.merged.document;
97924
- const expanded = expandStoredInstance({
97999
+ const expanded = expandStoredInstance2({
97925
98000
  document,
97926
98001
  instanceRoot: root,
97927
98002
  rootMember
@@ -99345,7 +99420,7 @@ function materializePreparedInstanceInitializers(args) {
99345
99420
  `Value "${valueId}" carries an initializer but no ownership path resolves its declared member.`
99346
99421
  );
99347
99422
  }
99348
- const materialized = materializeInitializerValue({
99423
+ const materialized = materializeInitializerValue2({
99349
99424
  // Every site that survives the declaration-default guard is source for
99350
99425
  // a persisted instance construction. The trusted replay mode both
99351
99426
  // admits Immutable storage and installs the concrete generic slot; the
@@ -99376,7 +99451,7 @@ function materializePreparedInstanceInitializers(args) {
99376
99451
  replayOnlyIndexes.push(site.index);
99377
99452
  continue;
99378
99453
  }
99379
- const baseline = materializeInitializerValue({
99454
+ const baseline = materializeInitializerValue2({
99380
99455
  document: materializationScope.document,
99381
99456
  member,
99382
99457
  row: {
@@ -99597,7 +99672,7 @@ function reconcileInitializerMaterializationTransport(args) {
99597
99672
  }
99598
99673
  }
99599
99674
  function constructorArgumentsSemanticallyEqual(args) {
99600
- const currentRows = resolvedStoredInstanceRows({
99675
+ const currentRows = resolvedStoredInstanceRows2({
99601
99676
  document: args.currentDocument,
99602
99677
  instanceRoot: args.currentRoot,
99603
99678
  rootMember: args.rootMember
@@ -102789,7 +102864,7 @@ var init_project_version_schema_commit = __esm({
102789
102864
  init_compiler_adapter();
102790
102865
  init_project_fingerprint();
102791
102866
  init_project_migration_runner();
102792
- init_neoscript_evaluator();
102867
+ init_neoscript2();
102793
102868
  init_project_version_intents();
102794
102869
  init_general_function_call_ir_source_recompile();
102795
102870
  init_projectDocumentDialogueMaterialization();
@@ -102798,7 +102873,7 @@ var init_project_version_schema_commit = __esm({
102798
102873
  init_project_version_static_value_writes();
102799
102874
  init_localizable_member_value_writes();
102800
102875
  init_value_row_owner_members();
102801
- init_init_backed_value_materialization();
102876
+ init_materialize_values();
102802
102877
  init_packed_value_write_fold();
102803
102878
  init_constructor_argument_ownership();
102804
102879
  init_constructors2();
@@ -103638,7 +103713,7 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
103638
103713
  delete deferredMember.valueId;
103639
103714
  return deferredMember;
103640
103715
  }
103641
- const materialized = materializeInitializerValue({
103716
+ const materialized = materializeInitializerValue2({
103642
103717
  document: { ...document, members, values: [...valuesById.values()] },
103643
103718
  member,
103644
103719
  row: {
@@ -103672,7 +103747,7 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
103672
103747
  deferred.add(row.id);
103673
103748
  continue;
103674
103749
  }
103675
- const materialized = materializeInitializerValue({
103750
+ const materialized = materializeInitializerValue2({
103676
103751
  document: { ...document, members, values: [...valuesById.values()] },
103677
103752
  member,
103678
103753
  row
@@ -104549,7 +104624,7 @@ var init_project_version_whole_graph_validation = __esm({
104549
104624
  init_inheritance();
104550
104625
  init_neoscript();
104551
104626
  init_constructor_argument_ownership();
104552
- init_init_backed_value_materialization();
104627
+ init_materialize_values();
104553
104628
  init_world_system_classes();
104554
104629
  init_project_world_reference_graph();
104555
104630
  init_project_record_semantics();
@@ -109083,7 +109158,7 @@ function replayStoredConstructionV4(args) {
109083
109158
  } : candidate;
109084
109159
  compilePulledUncompiledConstructorsV4(document, compilationProject);
109085
109160
  assertPulledConstructorsCompiled(document);
109086
- const materialized = materializeInitializerValue({
109161
+ const materialized = materializeInitializerValue2({
109087
109162
  document: {
109088
109163
  ...document,
109089
109164
  // Replays need distinct compiler closures but read one immutable
@@ -109398,7 +109473,7 @@ var init_initializer_replay = __esm({
109398
109473
  "use strict";
109399
109474
  init_members();
109400
109475
  init_compile_ns_property();
109401
- init_init_backed_value_materialization();
109476
+ init_materialize_values();
109402
109477
  init_virtual_instance_values();
109403
109478
  init_value_row_owner_members();
109404
109479
  init_project_document_read();
@@ -123404,7 +123479,7 @@ var init_script = __esm({
123404
123479
  init_game_save_record_read2();
123405
123480
  init_projection();
123406
123481
  init_compiler_adapter();
123407
- init_neoscript_evaluator();
123482
+ init_neoscript2();
123408
123483
  init_evaluator_lookups();
123409
123484
  init_project_root_members();
123410
123485
  init_save_overlay_resolution();
@@ -127422,7 +127497,7 @@ var init_registry2 = __esm({
127422
127497
  "schema-contract/registry.mjs"() {
127423
127498
  "use strict";
127424
127499
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
127425
- cliVersion: "0.46.0",
127500
+ cliVersion: "0.46.1",
127426
127501
  projectFileUploadBatchSize: 32,
127427
127502
  documentRecords: {
127428
127503
  member: {
@@ -130478,7 +130553,7 @@ var init_test = __esm({
130478
130553
  "use strict";
130479
130554
  init_src();
130480
130555
  init_members();
130481
- init_neoscript_evaluator();
130556
+ init_neoscript2();
130482
130557
  init_evaluator_lookups();
130483
130558
  init_neoscript_language_adapter();
130484
130559
  init_workspace_status();
@@ -132219,7 +132294,7 @@ var init_migrate = __esm({
132219
132294
  init_source_diagnostics();
132220
132295
  init_compiler_adapter();
132221
132296
  init_push_body_diagnostics();
132222
- init_neoscript_evaluator();
132297
+ init_neoscript2();
132223
132298
  init_evaluator_lookups();
132224
132299
  init_virtual_instance_values();
132225
132300
  init_script();
@@ -133864,7 +133939,7 @@ var init_dialogue_dryrun = __esm({
133864
133939
  "use strict";
133865
133940
  init_document();
133866
133941
  init_projection();
133867
- init_neoscript_evaluator();
133942
+ init_neoscript2();
133868
133943
  init_evaluator_lookups();
133869
133944
  init_project_root_members();
133870
133945
  init_members();
@@ -134435,7 +134510,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
134435
134510
  async function main() {
134436
134511
  const args = parseArgs(process.argv.slice(2));
134437
134512
  if (args.command === "--version") {
134438
- console.log("0.46.0");
134513
+ console.log("0.46.1");
134439
134514
  return;
134440
134515
  }
134441
134516
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {