@neocompose/cli 0.48.3 → 0.50.0

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
@@ -10166,6 +10166,14 @@ var init_strict_resolver = __esm({
10166
10166
  );
10167
10167
  }
10168
10168
  case "annotated":
10169
+ if (expression.annotations.some(
10170
+ (annotation2) => annotation2.name === "tile"
10171
+ )) {
10172
+ throw new CompileError(
10173
+ "@tile is only supported on persisted literal placements, not executable NeoScript constructions.",
10174
+ expression.pos
10175
+ );
10176
+ }
10169
10177
  return this.resolveExpression(expression.expression, scope, expected);
10170
10178
  case "binary":
10171
10179
  return this.resolveBinary(expression, scope);
@@ -17880,6 +17888,55 @@ var init_project_source_registry = __esm({
17880
17888
  }
17881
17889
  });
17882
17890
 
17891
+ // ../packages/neoscript-language/src/project-source-tile.ts
17892
+ function tileAssetAnnotation(expression) {
17893
+ if (expression.kind !== "annotated") return null;
17894
+ const annotations = expression.annotations.filter(
17895
+ (entry) => entry.name === "tile"
17896
+ );
17897
+ const annotation2 = annotations[0];
17898
+ if (annotation2 === void 0) return null;
17899
+ if (annotations.length > 1) {
17900
+ throw new CompileError(
17901
+ "A placement can have only one @tile annotation.",
17902
+ annotations[1].pos
17903
+ );
17904
+ }
17905
+ if (expression.expression.kind !== "new") {
17906
+ throw new CompileError(
17907
+ "@tile requires a NeoTileInstance construction.",
17908
+ annotation2.pos
17909
+ );
17910
+ }
17911
+ if (annotation2.args.length !== 1) {
17912
+ throw new CompileError(
17913
+ "@tile requires exactly one tile class: @tile(VoidTile) or @tile(asset: VoidTile).",
17914
+ annotation2.pos
17915
+ );
17916
+ }
17917
+ const name = annotation2.argumentNames?.[0];
17918
+ if (name != null && name !== "asset") {
17919
+ throw new CompileError(
17920
+ `@tile has no '${name}' option. Use 'asset'.`,
17921
+ annotation2.pos
17922
+ );
17923
+ }
17924
+ const asset = annotation2.args[0];
17925
+ if (asset.kind !== "ident") {
17926
+ throw new CompileError(
17927
+ "@tile asset must name a concrete tile class.",
17928
+ asset.pos
17929
+ );
17930
+ }
17931
+ return asset.name;
17932
+ }
17933
+ var init_project_source_tile = __esm({
17934
+ "../packages/neoscript-language/src/project-source-tile.ts"() {
17935
+ "use strict";
17936
+ init_strict_compile_error();
17937
+ }
17938
+ });
17939
+
17883
17940
  // ../packages/neoscript-language/src/project-schema-contract.generated.ts
17884
17941
  var PROJECT_FILE_UPLOAD_BATCH_SIZE, NEO_PROJECT_SOURCE_RECORD_CONTRACT;
17885
17942
  var init_project_schema_contract_generated = __esm({
@@ -20094,16 +20151,8 @@ var init_project_source_construction_diagnostics = __esm({
20094
20151
  "parameter-default-type-mismatch": "error",
20095
20152
  /** §2.5 g. An initializer key naming no member of the constructed class. */
20096
20153
  "unknown-initializer-member": "error",
20097
- /**
20098
- * §2.5 f. A construction site leaving a required member unsettled.
20099
- *
20100
- * Ships as a warning for this release (§5 step 1). A value seed whose
20101
- * members are supplied by stored value rows rather than by initializer text
20102
- * reads as unsettled to an analysis that only sees source, so promoting this
20103
- * to an error would reject the existing corpus. Every other rule below is
20104
- * decidable from source alone and is already an error.
20105
- */
20106
- "unsettled-required-member": "warning",
20154
+ /** §2.5 f. Every construction must settle its required members. */
20155
+ "unsettled-required-member": "error",
20107
20156
  /** §2.4. A declared constructor that is not a complete construction path. */
20108
20157
  "constructor-unsettled-member": "error",
20109
20158
  /** §2.4. An S1 header plus `init` block that is not a complete path. */
@@ -20989,19 +21038,34 @@ function buildNeoConstructionIndex(documents) {
20989
21038
  }
20990
21039
  return { classes, interfaceNames, requiredMemberCache: /* @__PURE__ */ new Map() };
20991
21040
  }
20992
- function requiredMembersForClass(index, className) {
20993
- const cached = index.requiredMemberCache.get(className);
21041
+ function requiredMembersForClass(index, className, typeArguments = []) {
21042
+ const cacheKey = JSON.stringify([className, typeArguments]);
21043
+ const cached = index.requiredMemberCache.get(cacheKey);
20994
21044
  if (cached) return cached;
20995
21045
  const entry = index.classes.get(className);
20996
21046
  if (!entry) return [];
20997
21047
  const required2 = [];
20998
21048
  const seen = /* @__PURE__ */ new Set();
20999
- for (const hop of baseChain(index, entry).hops) {
21049
+ const hops = baseChain(index, entry, typeArguments).hops;
21050
+ const defaults = /* @__PURE__ */ new Map();
21051
+ for (const hop of hops) {
21052
+ for (const member of hop.entry.declaration.members) {
21053
+ if (member.kind !== "field") continue;
21054
+ const key = member.name.toLowerCase();
21055
+ if (defaults.has(key)) continue;
21056
+ if (member.initializer !== void 0 || member.flowInitializer !== void 0)
21057
+ defaults.set(key, member);
21058
+ }
21059
+ }
21060
+ for (const hop of hops) {
21000
21061
  for (const member of hop.entry.declaration.members) {
21001
21062
  const key = member.name.toLowerCase();
21002
21063
  if (seen.has(key)) continue;
21003
21064
  seen.add(key);
21004
21065
  if (!isRequiredMember(member, hop.bindings)) continue;
21066
+ const declaredDefault = defaults.get(key);
21067
+ if (declaredDefault !== void 0 && declaredDefault.initializer?.text.trim() !== "null")
21068
+ continue;
21005
21069
  required2.push({
21006
21070
  name: member.name,
21007
21071
  declaringClassName: hop.entry.declaration.name,
@@ -21010,16 +21074,16 @@ function requiredMembersForClass(index, className) {
21010
21074
  });
21011
21075
  }
21012
21076
  }
21013
- index.requiredMemberCache.set(className, required2);
21077
+ index.requiredMemberCache.set(cacheKey, required2);
21014
21078
  return required2;
21015
21079
  }
21016
- function unsettledRequiredMembers(index, className, settledNames) {
21080
+ function unsettledRequiredMembers(index, className, settledNames, typeArguments = []) {
21017
21081
  const entry = index.classes.get(className);
21018
21082
  if (!entry) return [];
21019
21083
  const settled = /* @__PURE__ */ new Set();
21020
21084
  for (const name of settledNames) settled.add(name.toLowerCase());
21021
21085
  for (const name of declarationSettledMembers(index, entry)) settled.add(name);
21022
- return requiredMembersForClass(index, className).filter(
21086
+ return requiredMembersForClass(index, className, typeArguments).filter(
21023
21087
  (member) => !settled.has(member.name.toLowerCase())
21024
21088
  );
21025
21089
  }
@@ -21046,7 +21110,8 @@ function validateNeoConstructionSite(index, call) {
21046
21110
  const unsettled = unsettledRequiredMembers(
21047
21111
  index,
21048
21112
  call.className,
21049
- call.initializerNames
21113
+ call.initializerNames,
21114
+ call.typeArguments
21050
21115
  );
21051
21116
  if (unsettled.length > 0) {
21052
21117
  diagnostics.push({
@@ -21080,6 +21145,7 @@ function validateBaseConstruction(index, entry, diagnostics) {
21080
21145
  }
21081
21146
  for (const diagnostic of validateNeoConstructionSite(index, {
21082
21147
  className: baseClause.type.name,
21148
+ typeArguments: baseClause.type.typeArguments.map(typeShape),
21083
21149
  argumentNames: (baseClause.arguments ?? []).map(
21084
21150
  (argument2) => argument2.name ?? null
21085
21151
  ),
@@ -21354,11 +21420,16 @@ function stripOuterBraces(text) {
21354
21420
  const trimmed = text.trim();
21355
21421
  return trimmed.startsWith("{") && trimmed.endsWith("}") ? trimmed.slice(1, -1) : text;
21356
21422
  }
21357
- function baseChain(index, start) {
21423
+ function baseChain(index, start, typeArguments = []) {
21358
21424
  const hops = [];
21359
21425
  const visited = /* @__PURE__ */ new Set();
21360
21426
  let current = start;
21361
- let bindings = /* @__PURE__ */ new Map();
21427
+ let bindings = new Map(
21428
+ start.declaration.genericParameters.flatMap((parameter4, position) => {
21429
+ const argument2 = typeArguments[position];
21430
+ return argument2 === void 0 ? [] : [[parameter4.name, argument2]];
21431
+ })
21432
+ );
21362
21433
  let complete2 = true;
21363
21434
  while (current !== void 0 && !visited.has(current.declaration.name)) {
21364
21435
  visited.add(current.declaration.name);
@@ -21412,12 +21483,17 @@ function typeShape(type) {
21412
21483
  }
21413
21484
  function substitute(type, bindings) {
21414
21485
  const bound = bindings.get(type.name);
21415
- if (bound !== void 0 && type.arguments.length === 0) {
21416
- return { ...bound, nullable: bound.nullable || type.nullable };
21486
+ if (bound !== void 0 && (type.arguments?.length ?? 0) === 0) {
21487
+ return {
21488
+ ...bound,
21489
+ nullable: bound.nullable === true || type.nullable === true
21490
+ };
21417
21491
  }
21418
21492
  return {
21419
21493
  ...type,
21420
- arguments: type.arguments.map((argument2) => substitute(argument2, bindings))
21494
+ arguments: (type.arguments ?? []).map(
21495
+ (argument2) => substitute(argument2, bindings)
21496
+ )
21421
21497
  };
21422
21498
  }
21423
21499
  function describeParameterList(className, parameters) {
@@ -22892,7 +22968,48 @@ function validateExpression(expression, expected, scope, environment, uri, range
22892
22968
  return;
22893
22969
  }
22894
22970
  if (expression.kind === "annotated") {
22971
+ const assetName = tileAssetAnnotation(expression);
22972
+ if (assetName !== null) {
22973
+ const constructed = expression.expression;
22974
+ const className = constructed.kind === "new" ? constructed.className ?? expected?.name : void 0;
22975
+ const asset = environment.types.get(assetName);
22976
+ if (!className || !classExtends(className, "NeoTileInstance", environment, /* @__PURE__ */ new Set())) {
22977
+ pushDiagnostic(
22978
+ diagnostics,
22979
+ uri,
22980
+ range2,
22981
+ "invalid-tile-placement",
22982
+ "@tile requires a NeoTileInstance construction."
22983
+ );
22984
+ }
22985
+ if (!asset || !classExtends(assetName, "NeoTile", environment, /* @__PURE__ */ new Set())) {
22986
+ pushDiagnostic(
22987
+ diagnostics,
22988
+ uri,
22989
+ range2,
22990
+ "invalid-tile-asset",
22991
+ `@tile asset '${assetName}' must name a tile class.`
22992
+ );
22993
+ } else if (asset.modifiers.includes("abstract")) {
22994
+ pushDiagnostic(
22995
+ diagnostics,
22996
+ uri,
22997
+ range2,
22998
+ "invalid-tile-asset",
22999
+ `@tile asset '${assetName}' must be a concrete tile class.`
23000
+ );
23001
+ } else if (asset.genericParameters.length > 0) {
23002
+ pushDiagnostic(
23003
+ diagnostics,
23004
+ uri,
23005
+ range2,
23006
+ "invalid-tile-asset",
23007
+ `@tile asset '${assetName}' must be a non-generic tile class.`
23008
+ );
23009
+ }
23010
+ }
22895
23011
  for (const annotation2 of expression.annotations) {
23012
+ if (annotation2.name === "tile") continue;
22896
23013
  validateInlineAnnotation(
22897
23014
  annotation2,
22898
23015
  environment,
@@ -23086,6 +23203,7 @@ function validateExpression(expression, expected, scope, environment, uri, range
23086
23203
  environment.construction,
23087
23204
  {
23088
23205
  className: declaration.name,
23206
+ typeArguments: expression.typeArguments?.map(semanticAstType) ?? (expression.className === null ? expected?.arguments : void 0) ?? [],
23089
23207
  argumentNames: variantSite?.argumentNames ?? siteArgumentNames,
23090
23208
  initializerNames: variantSite?.initializerNames ?? siteInitializerNames
23091
23209
  }
@@ -23424,7 +23542,7 @@ function validateInlineAnnotation(annotation2, environment, uri, range2, diagnos
23424
23542
  uri,
23425
23543
  range2,
23426
23544
  "invalid-inline-annotation",
23427
- `Only @id is valid on an inline persisted value; got @${annotation2.name}.`
23545
+ `Only @id and @tile are valid on an inline persisted value; got @${annotation2.name}.`
23428
23546
  );
23429
23547
  return;
23430
23548
  }
@@ -23991,6 +24109,7 @@ var init_project_source_semantics = __esm({
23991
24109
  "../packages/neoscript-language/src/project-source-semantics.ts"() {
23992
24110
  "use strict";
23993
24111
  init_project_local_values();
24112
+ init_project_source_tile();
23994
24113
  init_language_spec();
23995
24114
  init_project_schema_contract_generated();
23996
24115
  init_strict_compile_error();
@@ -27719,6 +27838,28 @@ function projectCompletions(analysis, document, position) {
27719
27838
  items: [...script.items, variantScopeInBody]
27720
27839
  };
27721
27840
  }
27841
+ const tileCall = activeTileAnnotation(document, position);
27842
+ if (tileCall) {
27843
+ const items = analysis.symbols.filter(
27844
+ (symbol) => symbol.kind === "class" && projectTypeNameAssignable(analysis, symbol.name, "NeoTile")
27845
+ ).filter((symbol) => {
27846
+ const declaration = analysis.documents.get(symbol.location.uri)?.declarations.find(
27847
+ (entry) => entry.kind === "class" && entry.name === symbol.name
27848
+ );
27849
+ return declaration?.kind === "class" && !declaration.modifiers.includes("abstract") && declaration.genericParameters.length === 0;
27850
+ }).map((symbol) => ({
27851
+ label: symbol.name,
27852
+ kind: "class",
27853
+ insertText: symbol.name
27854
+ }));
27855
+ if (!tileCall.named)
27856
+ items.unshift({
27857
+ label: "asset",
27858
+ kind: "property",
27859
+ insertText: "asset: "
27860
+ });
27861
+ return { isIncomplete: false, items };
27862
+ }
27722
27863
  const annotations = projectAnnotationCompletions(
27723
27864
  analysis,
27724
27865
  document,
@@ -27844,12 +27985,32 @@ function projectCompletions(analysis, document, position) {
27844
27985
  }
27845
27986
  return projectFallbackCompletions(analysis, document, position);
27846
27987
  }
27988
+ function isTileAssetToken(tokens, index) {
27989
+ const open = tokens[index - 1]?.text === ":" && tokens[index - 2]?.text === "asset" ? index - 3 : index - 1;
27990
+ return tokens[index + 1]?.text !== ":" && tokens[open]?.text === "(" && tokens[open - 1]?.text === "tile" && tokens[open - 2]?.text === "@";
27991
+ }
27992
+ function activeTileAnnotation(document, position) {
27993
+ const tokens = projectTokens(document);
27994
+ const open = activeCallOpenIndex(tokens, position);
27995
+ if (tokens[open - 1]?.text !== "tile" || tokens[open - 2]?.text !== "@")
27996
+ return null;
27997
+ const before = tokens.slice(open + 1).filter((token) => positionCompare2(token.range.start, position) < 0);
27998
+ if (before.some((token) => token.text === ",")) return null;
27999
+ const named = before.some((token) => token.text === ":");
28000
+ return { named };
28001
+ }
27847
28002
  function projectAnnotationCompletions(analysis, document, position) {
27848
28003
  const source = new SourceText(document.text);
27849
28004
  const offset = source.offsetAt(position);
27850
28005
  const word = projectWordRange(document.text, offset);
27851
28006
  if (document.text[word.start - 1] !== "@") return null;
27852
- if (initializerRootAt(analysis, document, position)) return [];
28007
+ if (initializerRootAt(analysis, document, position)) {
28008
+ return ["id", "tile"].map((name) => ({
28009
+ label: `@${name}`,
28010
+ kind: "snippet",
28011
+ insertText: name
28012
+ }));
28013
+ }
27853
28014
  const names = projectAnnotationNamesAt(analysis, document, position);
27854
28015
  return names.map((name) => ({
27855
28016
  label: `@${name}`,
@@ -29287,7 +29448,7 @@ function indexedProjectSymbolAt(analysis, document, position, index) {
29287
29448
  );
29288
29449
  const source = analysis.documents.get(document.uri);
29289
29450
  const typePosition = source && sourceTypeAt(source, token.range.start);
29290
- if (typePosition || sourceTokens[tokenIndex - 1]?.text === "new") {
29451
+ if (typePosition || sourceTokens[tokenIndex - 1]?.text === "new" || isTileAssetToken(sourceTokens, tokenIndex)) {
29291
29452
  const types = candidates.filter(
29292
29453
  (symbol) => symbol.kind === "class" || symbol.kind === "interface" || symbol.kind === "enum" || symbol.kind === "genericParameter"
29293
29454
  );
@@ -29527,6 +29688,8 @@ function annotationSignatureParameters(name) {
29527
29688
  switch (name) {
29528
29689
  case "id":
29529
29690
  return ["string id"];
29691
+ case "tile":
29692
+ return ["NeoTile class asset"];
29530
29693
  case "settings":
29531
29694
  return ["named settings"];
29532
29695
  case "storage":
@@ -33992,6 +34155,7 @@ var init_src = __esm({
33992
34155
  init_project_source_construction_quick_fixes();
33993
34156
  init_project_source_manifest();
33994
34157
  init_project_source_variants();
34158
+ init_project_source_tile();
33995
34159
  init_project_source_parameter_defaults();
33996
34160
  init_project_source_settlement();
33997
34161
  init_project_source_parser();
@@ -38022,7 +38186,7 @@ function memberToDocumentFields(member, baseData3) {
38022
38186
  }
38023
38187
  function preserveOverrideNulls(fields, member, baseData3) {
38024
38188
  if (member.overrideOf === null || baseData3 === void 0) return;
38025
- for (const field of CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS) {
38189
+ for (const field of NULLABLE_OVERRIDE_MEMBER_FIELDS) {
38026
38190
  if (Object.hasOwn(baseData3, field) && baseData3[field] === null) {
38027
38191
  fields[field] = null;
38028
38192
  }
@@ -38782,7 +38946,7 @@ function invalidDocument(record4, path, message) {
38782
38946
  `${record4.recordKind}:${record4.recordId}.${path} ${message}.`
38783
38947
  );
38784
38948
  }
38785
- var MEMBER_KIND, MEMBER_MODIFIERS, MEMBER_ACCESS, MEMBER_STORAGE, MEMBER_DISTRIBUTION, STRING_FORMAT, MEMBER_SEARCH_BY, MEMBER_SELECTION, FUNCTION_DISPATCH, FUNCTION_BODY, MEMBER_PAYLOAD, DICTIONARY_KEY, LIST_KIND, LIST_INDEX, COLUMN_VISIBILITY, COLUMN_PIN, COLUMN_OVERFLOW, GENERIC_BINDING, TYPE_KIND_BY_MEMBER_KIND, SIMPLE_MEMBER_KIND_BY_KIND, MEMBER_KIND_BY_KIND, TYPE_MEMBER_KIND_BY_KIND, MEMBER_IDENTITY_FIELDS, INHERITED_MEMBER_ORDINAL_FIELDS, CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS;
38949
+ var MEMBER_KIND, MEMBER_MODIFIERS, MEMBER_ACCESS, MEMBER_STORAGE, MEMBER_DISTRIBUTION, STRING_FORMAT, MEMBER_SEARCH_BY, MEMBER_SELECTION, FUNCTION_DISPATCH, FUNCTION_BODY, MEMBER_PAYLOAD, DICTIONARY_KEY, LIST_KIND, LIST_INDEX, COLUMN_VISIBILITY, COLUMN_PIN, COLUMN_OVERFLOW, GENERIC_BINDING, TYPE_KIND_BY_MEMBER_KIND, SIMPLE_MEMBER_KIND_BY_KIND, MEMBER_KIND_BY_KIND, TYPE_MEMBER_KIND_BY_KIND, MEMBER_IDENTITY_FIELDS, INHERITED_MEMBER_ORDINAL_FIELDS, NULLABLE_OVERRIDE_MEMBER_FIELDS;
38786
38950
  var init_codecs = __esm({
38787
38951
  "src/project-manifest/record-adapters/codecs.ts"() {
38788
38952
  "use strict";
@@ -38925,7 +39089,7 @@ var init_codecs = __esm({
38925
39089
  "dispatch",
38926
39090
  "bodyMode"
38927
39091
  ]);
38928
- CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS = [
39092
+ NULLABLE_OVERRIDE_MEMBER_FIELDS = [
38929
39093
  "defaultValue",
38930
39094
  "storageKey",
38931
39095
  "minValue",
@@ -44162,36 +44326,36 @@ var MemberKind;
44162
44326
  var init_member_kind_enum = __esm({
44163
44327
  "../src/models/members/member-kind-enum.ts"() {
44164
44328
  "use strict";
44165
- MemberKind = /* @__PURE__ */ ((MemberKind14) => {
44166
- MemberKind14[MemberKind14["Null"] = 0] = "Null";
44167
- MemberKind14[MemberKind14["Bool"] = 1] = "Bool";
44168
- MemberKind14[MemberKind14["Int"] = 2] = "Int";
44169
- MemberKind14[MemberKind14["String"] = 3] = "String";
44170
- MemberKind14[MemberKind14["Float"] = 4] = "Float";
44171
- MemberKind14[MemberKind14["Dictionary"] = 5] = "Dictionary";
44172
- MemberKind14[MemberKind14["List"] = 6] = "List";
44173
- MemberKind14[MemberKind14["Class"] = 7] = "Class";
44174
- MemberKind14[MemberKind14["Enum"] = 8] = "Enum";
44175
- MemberKind14[MemberKind14["Lookup"] = 9] = "Lookup";
44176
- MemberKind14[MemberKind14["NSProperty"] = 10] = "NSProperty";
44177
- MemberKind14[MemberKind14["Sprite"] = 11] = "Sprite";
44178
- MemberKind14[MemberKind14["Audio"] = 12] = "Audio";
44179
- MemberKind14[MemberKind14["Function"] = 13] = "Function";
44180
- MemberKind14[MemberKind14["Vector2"] = 14] = "Vector2";
44181
- MemberKind14[MemberKind14["Vector2Int"] = 15] = "Vector2Int";
44182
- MemberKind14[MemberKind14["Vector3"] = 16] = "Vector3";
44183
- MemberKind14[MemberKind14["Vector3Int"] = 17] = "Vector3Int";
44184
- MemberKind14[MemberKind14["DialogueLookup"] = 18] = "DialogueLookup";
44185
- MemberKind14[MemberKind14["Color"] = 19] = "Color";
44186
- MemberKind14[MemberKind14["Decimal"] = 20] = "Decimal";
44187
- MemberKind14[MemberKind14["Generic"] = 21] = "Generic";
44188
- MemberKind14[MemberKind14["Interface"] = 22] = "Interface";
44189
- MemberKind14[MemberKind14["NSFunction"] = 23] = "NSFunction";
44190
- MemberKind14[MemberKind14["FunctionRef"] = 24] = "FunctionRef";
44191
- MemberKind14[MemberKind14["NSDelegate"] = 25] = "NSDelegate";
44192
- MemberKind14[MemberKind14["NSAction"] = 26] = "NSAction";
44193
- MemberKind14[MemberKind14["Variant"] = 27] = "Variant";
44194
- return MemberKind14;
44329
+ MemberKind = /* @__PURE__ */ ((MemberKind15) => {
44330
+ MemberKind15[MemberKind15["Null"] = 0] = "Null";
44331
+ MemberKind15[MemberKind15["Bool"] = 1] = "Bool";
44332
+ MemberKind15[MemberKind15["Int"] = 2] = "Int";
44333
+ MemberKind15[MemberKind15["String"] = 3] = "String";
44334
+ MemberKind15[MemberKind15["Float"] = 4] = "Float";
44335
+ MemberKind15[MemberKind15["Dictionary"] = 5] = "Dictionary";
44336
+ MemberKind15[MemberKind15["List"] = 6] = "List";
44337
+ MemberKind15[MemberKind15["Class"] = 7] = "Class";
44338
+ MemberKind15[MemberKind15["Enum"] = 8] = "Enum";
44339
+ MemberKind15[MemberKind15["Lookup"] = 9] = "Lookup";
44340
+ MemberKind15[MemberKind15["NSProperty"] = 10] = "NSProperty";
44341
+ MemberKind15[MemberKind15["Sprite"] = 11] = "Sprite";
44342
+ MemberKind15[MemberKind15["Audio"] = 12] = "Audio";
44343
+ MemberKind15[MemberKind15["Function"] = 13] = "Function";
44344
+ MemberKind15[MemberKind15["Vector2"] = 14] = "Vector2";
44345
+ MemberKind15[MemberKind15["Vector2Int"] = 15] = "Vector2Int";
44346
+ MemberKind15[MemberKind15["Vector3"] = 16] = "Vector3";
44347
+ MemberKind15[MemberKind15["Vector3Int"] = 17] = "Vector3Int";
44348
+ MemberKind15[MemberKind15["DialogueLookup"] = 18] = "DialogueLookup";
44349
+ MemberKind15[MemberKind15["Color"] = 19] = "Color";
44350
+ MemberKind15[MemberKind15["Decimal"] = 20] = "Decimal";
44351
+ MemberKind15[MemberKind15["Generic"] = 21] = "Generic";
44352
+ MemberKind15[MemberKind15["Interface"] = 22] = "Interface";
44353
+ MemberKind15[MemberKind15["NSFunction"] = 23] = "NSFunction";
44354
+ MemberKind15[MemberKind15["FunctionRef"] = 24] = "FunctionRef";
44355
+ MemberKind15[MemberKind15["NSDelegate"] = 25] = "NSDelegate";
44356
+ MemberKind15[MemberKind15["NSAction"] = 26] = "NSAction";
44357
+ MemberKind15[MemberKind15["Variant"] = 27] = "Variant";
44358
+ return MemberKind15;
44195
44359
  })(MemberKind || {});
44196
44360
  }
44197
44361
  });
@@ -46054,6 +46218,7 @@ function isGenericParamDeclaration(value) {
46054
46218
  function isGenericBinding(value) {
46055
46219
  const v = value;
46056
46220
  if (!v || typeof v !== "object") return false;
46221
+ if (Object.hasOwn(v, "defaultValue")) return false;
46057
46222
  if (v.kind === void 0 || v.kind === 0 /* Generic */) {
46058
46223
  if (typeof v.genericParamId !== "string") return false;
46059
46224
  if (v.genericParamId.length === 0) return false;
@@ -47370,7 +47535,7 @@ function isAnyMember(value) {
47370
47535
  function isAnyMemberAuthoredOrCompiled(value) {
47371
47536
  return isAnyMember(value) || isUncompiledMemberNSFunctionOverride(value);
47372
47537
  }
47373
- var FunctionArgumentReservedNames, NSFunctionArgumentReservedNames, ListKind, CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS2, MEMBER_ACCESS_KINDS, DECIMAL_STRING_PATTERN, DECIMAL_MAX_SIGNIFICANT_DIGITS, DECIMAL_MAX_SCALE;
47538
+ var FunctionArgumentReservedNames, NSFunctionArgumentReservedNames, ListKind, CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS, MEMBER_ACCESS_KINDS, DECIMAL_STRING_PATTERN, DECIMAL_MAX_SIGNIFICANT_DIGITS, DECIMAL_MAX_SCALE;
47374
47539
  var init_member_kinds = __esm({
47375
47540
  "../src/models/members/member-kinds.ts"() {
47376
47541
  "use strict";
@@ -47400,8 +47565,7 @@ var init_member_kinds = __esm({
47400
47565
  ListKind3[ListKind3["Unordered"] = 1] = "Unordered";
47401
47566
  return ListKind3;
47402
47567
  })(ListKind || {});
47403
- CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS2 = [
47404
- "defaultValue",
47568
+ CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS = [
47405
47569
  "storageKey",
47406
47570
  "minValue",
47407
47571
  "maxValue",
@@ -47884,6 +48048,7 @@ function resolveMemberWithIndex(member, memberIndex) {
47884
48048
  for (const link of chain) {
47885
48049
  for (const [key, value] of Object.entries(link)) {
47886
48050
  if (value === void 0) continue;
48051
+ if (key === "defaultValue" && value === null) continue;
47887
48052
  merged[key] = value;
47888
48053
  }
47889
48054
  if (getField(link, "code") === null) {
@@ -47896,7 +48061,7 @@ function resolveMemberWithIndex(member, memberIndex) {
47896
48061
  }
47897
48062
  }
47898
48063
  delete merged.extendsMemberId;
47899
- for (const field of CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS2) {
48064
+ for (const field of CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS) {
47900
48065
  if (merged[field] === null) delete merged[field];
47901
48066
  }
47902
48067
  if (member.mutability === void 0) {
@@ -47911,7 +48076,6 @@ function resolveMemberWithIndex(member, memberIndex) {
47911
48076
  }
47912
48077
  if (member.kind === 21 /* Generic */) {
47913
48078
  if (member.requirement === void 0) delete merged.requirement;
47914
- if (member.defaultValue === void 0) delete merged.defaultValue;
47915
48079
  }
47916
48080
  return Object.freeze(merged);
47917
48081
  }
@@ -50054,8 +50218,10 @@ function substituteMember(member, env, members, preResolvedMember) {
50054
50218
  access: resolved.access,
50055
50219
  system: resolved.system ?? void 0
50056
50220
  };
50057
- if (resolved.defaultValue !== void 0) {
50221
+ if (resolved.defaultValue != null) {
50058
50222
  substituted.defaultValue = resolved.defaultValue;
50223
+ } else {
50224
+ delete substituted.defaultValue;
50059
50225
  }
50060
50226
  const slotId = getOptionalString(member, "id");
50061
50227
  if (slotId !== void 0) {
@@ -51021,9 +51187,9 @@ function assertReadOnlyMembersValid(document) {
51021
51187
  );
51022
51188
  }
51023
51189
  if (isAbstractMember(member) === true) continue;
51024
- if (effective.defaultValue === void 0) {
51190
+ if (effective.defaultValue == null) {
51025
51191
  throw new Error(
51026
- `Read-only member "${member.name}" (${member.id}) requires an explicit defaultValue from every closed Generic binding; ${ownerContext}.`
51192
+ `Read-only member "${member.name}" (${member.id}) requires an explicit field defaultValue in every closed Generic placement; ${ownerContext}.`
51027
51193
  );
51028
51194
  }
51029
51195
  if (isMemberStringBase(effective) && effective.searchBy === 1 /* MemberKey */) {
@@ -51910,6 +52076,415 @@ var init_storage_partitions = __esm({
51910
52076
  }
51911
52077
  });
51912
52078
 
52079
+ // ../src/models/constructors/constructors.ts
52080
+ function hasRejectedConstructorKey(value) {
52081
+ return REJECTED_CONSTRUCTOR_KEYS.some((key) => value[key] !== void 0);
52082
+ }
52083
+ function isNamedBaseClauseEntry(value, nameIsValid) {
52084
+ if (typeof value !== "object" || value === null) return false;
52085
+ if (Array.isArray(value)) return false;
52086
+ const candidate = value;
52087
+ if (!Object.keys(candidate).every((key) => key === "name" || key === "code")) {
52088
+ return false;
52089
+ }
52090
+ if (!nameIsValid(candidate.name)) return false;
52091
+ if (typeof candidate.code !== "string") return false;
52092
+ return candidate.code.length > 0;
52093
+ }
52094
+ function isNeoConstructorBaseArgument(value) {
52095
+ return isNamedBaseClauseEntry(value, isValidCallableArgumentIdentifier);
52096
+ }
52097
+ function isNeoConstructorBaseInitializerField(value) {
52098
+ return isNamedBaseClauseEntry(value, isValidSchemaMemberIdentifier);
52099
+ }
52100
+ function isNeoClassConstructorBase(value) {
52101
+ if (typeof value !== "object" || value === null) return false;
52102
+ if (Array.isArray(value)) return false;
52103
+ const v = value;
52104
+ if (hasRejectedConstructorKey(v)) return false;
52105
+ if (!isValidDocsText(v.docsText)) return false;
52106
+ if (typeof v.classId !== "string") return false;
52107
+ if (v.classId.length === 0) return false;
52108
+ if (typeof v.code !== "string" && v.code !== null) return false;
52109
+ if (!Array.isArray(v.argumentTypes)) return false;
52110
+ const parameterNames = /* @__PURE__ */ new Set();
52111
+ const argumentTypes = [];
52112
+ for (const argument2 of v.argumentTypes) {
52113
+ if (!isNSFunctionArgumentTypeInfo(argument2)) return false;
52114
+ if (!isValidCallableArgumentIdentifier(argument2.name)) return false;
52115
+ if (parameterNames.has(argument2.name)) return false;
52116
+ parameterNames.add(argument2.name);
52117
+ argumentTypes.push(argument2);
52118
+ }
52119
+ if (validateParameterDefaults(argumentTypes).length > 0) return false;
52120
+ if (v.baseArguments !== void 0 && v.baseArguments !== null) {
52121
+ if (!Array.isArray(v.baseArguments)) return false;
52122
+ const baseNames = /* @__PURE__ */ new Set();
52123
+ for (const baseArgument of v.baseArguments) {
52124
+ if (!isNeoConstructorBaseArgument(baseArgument)) return false;
52125
+ if (baseNames.has(baseArgument.name)) return false;
52126
+ baseNames.add(baseArgument.name);
52127
+ }
52128
+ }
52129
+ if (v.baseInitializerFields !== void 0 && v.baseInitializerFields !== null) {
52130
+ if (!Array.isArray(v.baseInitializerFields)) return false;
52131
+ const fieldNames = /* @__PURE__ */ new Set();
52132
+ for (const field of v.baseInitializerFields) {
52133
+ if (!isNeoConstructorBaseInitializerField(field)) return false;
52134
+ if (fieldNames.has(field.name)) return false;
52135
+ fieldNames.add(field.name);
52136
+ }
52137
+ }
52138
+ if (v.action !== void 0 && v.action !== null) return false;
52139
+ if (v.compiledBaseArguments !== void 0 && v.compiledBaseArguments !== null) {
52140
+ return false;
52141
+ }
52142
+ return v.compiledBaseInitializerFields === void 0 || v.compiledBaseInitializerFields === null;
52143
+ }
52144
+ function isUncompiledNeoClassConstructor(value) {
52145
+ if (!isNeoClassConstructorBase(value)) return false;
52146
+ const v = value;
52147
+ if (typeof v.id !== "string" || v.id.length === 0) return false;
52148
+ if (typeof v.projectId !== "string" || v.projectId.length === 0) return false;
52149
+ if (!isEpochMillis(v.createdAt)) return false;
52150
+ return isEpochMillis(v.updatedAt);
52151
+ }
52152
+ function hasValidConstructorAction(action, argumentTypes) {
52153
+ if (!isNSFunctionWithReturnType(action)) return false;
52154
+ if (action.typeInfo.type !== 0 /* Null */) return false;
52155
+ if (action.typeInfo.required !== true) return false;
52156
+ if (action.parameters.length !== argumentTypes.length + 2) return false;
52157
+ if (action.parameters[0]?.id !== "__this__") return false;
52158
+ if (action.parameters[1]?.id !== "__root__") return false;
52159
+ for (let index = 0; index < argumentTypes.length; index += 1) {
52160
+ const parameter4 = action.parameters[index + 2];
52161
+ if (parameter4?.id !== `__arg_${index}__`) return false;
52162
+ const declared = argumentTypes[index];
52163
+ if (declared === void 0) return false;
52164
+ if (!typeInfosInvariantlyEqual(parameter4.typeInfo, declared)) return false;
52165
+ }
52166
+ return true;
52167
+ }
52168
+ function compiledBaseClauseGettersAlign(compiled, authored) {
52169
+ const authoredCount = Array.isArray(authored) ? authored.length : 0;
52170
+ if (compiled === void 0 || compiled === null) return authoredCount === 0;
52171
+ if (!Array.isArray(compiled)) return false;
52172
+ if (!compiled.every(isNSGetter)) return false;
52173
+ return compiled.length === authoredCount;
52174
+ }
52175
+ function isNeoClassConstructorProps(value) {
52176
+ if (typeof value !== "object" || value === null) return false;
52177
+ const v = value;
52178
+ const {
52179
+ action: _action,
52180
+ compiledBaseArguments: _compiledBaseArguments,
52181
+ compiledBaseInitializerFields: _compiledBaseInitializerFields,
52182
+ ...authored
52183
+ } = v;
52184
+ void _action;
52185
+ void _compiledBaseArguments;
52186
+ void _compiledBaseInitializerFields;
52187
+ if (!isNeoClassConstructorBase(authored)) return false;
52188
+ if (typeof v.id !== "string") return false;
52189
+ if (v.id.length === 0) return false;
52190
+ if (typeof v.projectId !== "string") return false;
52191
+ if (!isEpochMillis(v.createdAt)) return false;
52192
+ if (!isEpochMillis(v.updatedAt)) return false;
52193
+ const argumentTypes = v.argumentTypes;
52194
+ if (!hasValidConstructorAction(v.action, argumentTypes)) return false;
52195
+ if (!compiledBaseClauseGettersAlign(v.compiledBaseArguments, v.baseArguments)) {
52196
+ return false;
52197
+ }
52198
+ return compiledBaseClauseGettersAlign(
52199
+ v.compiledBaseInitializerFields,
52200
+ v.baseInitializerFields
52201
+ );
52202
+ }
52203
+ function isNeoClassConstructor(value) {
52204
+ return isNeoClassConstructorProps(value);
52205
+ }
52206
+ function constructorActionParameterId(constructor2, index) {
52207
+ const action = "action" in constructor2 ? constructor2.action : void 0;
52208
+ if (action !== null && typeof action === "object") {
52209
+ const parameters = action.parameters;
52210
+ if (Array.isArray(parameters)) {
52211
+ const parameter4 = parameters[index + 2];
52212
+ if (parameter4 !== null && typeof parameter4 === "object" && typeof parameter4.id === "string") {
52213
+ return parameter4.id;
52214
+ }
52215
+ }
52216
+ }
52217
+ return `__arg_${index}__`;
52218
+ }
52219
+ var REJECTED_CONSTRUCTOR_KEYS;
52220
+ var init_constructors = __esm({
52221
+ "../src/models/constructors/constructors.ts"() {
52222
+ "use strict";
52223
+ init_core();
52224
+ init_docs_text2();
52225
+ init_member_kinds();
52226
+ init_schema_identifiers();
52227
+ init_neoscript();
52228
+ REJECTED_CONSTRUCTOR_KEYS = [
52229
+ "bodyMode",
52230
+ "uiAction",
52231
+ "returnTypeInfo",
52232
+ "deferred"
52233
+ ];
52234
+ }
52235
+ });
52236
+
52237
+ // ../src/models/constructors/index.ts
52238
+ var init_constructors2 = __esm({
52239
+ "../src/models/constructors/index.ts"() {
52240
+ "use strict";
52241
+ init_constructors();
52242
+ }
52243
+ });
52244
+
52245
+ // ../src/models/classes/construction-requirements.ts
52246
+ function requiredMembersForConstruction(classId, document, classArguments2) {
52247
+ return unsettledMembers(
52248
+ classId,
52249
+ contextFor(document),
52250
+ classArguments2,
52251
+ /* @__PURE__ */ new Set()
52252
+ );
52253
+ }
52254
+ function contextFor(document, env = /* @__PURE__ */ new Map()) {
52255
+ return {
52256
+ document,
52257
+ membersById: new Map(document.members.map((member) => [member.id, member])),
52258
+ env
52259
+ };
52260
+ }
52261
+ function unsettledMembers(classId, context, classArguments2, path) {
52262
+ const previousEnv = context.env;
52263
+ context.env = resolveInstanceEnv(
52264
+ classId,
52265
+ classArguments2,
52266
+ context.document.classes
52267
+ );
52268
+ try {
52269
+ return constructionMembers(classId, context).filter(
52270
+ ({ member }) => isRequiredMember2(member) && !defaultSettlesConstruction(member, context, path)
52271
+ );
52272
+ } finally {
52273
+ context.env = previousEnv;
52274
+ }
52275
+ }
52276
+ function constructionMembers(classId, context) {
52277
+ const { document, membersById, env } = context;
52278
+ if (firstUnboundParamId(env) !== null) return [];
52279
+ const result = [];
52280
+ for (const entry of mergeStoredInstanceSchema(
52281
+ classId,
52282
+ document.classes,
52283
+ document.members
52284
+ )) {
52285
+ const raw = membersById.get(entry.memberId);
52286
+ if (raw === void 0) continue;
52287
+ const member = {
52288
+ ...raw,
52289
+ ...substituteMember(
52290
+ raw,
52291
+ env,
52292
+ document.members,
52293
+ resolveMember2(raw, document.members)
52294
+ ),
52295
+ id: raw.id
52296
+ };
52297
+ if (isAbstractMember(member)) continue;
52298
+ if (isReadOnlyMember(member)) continue;
52299
+ if (!memberKindOwnsStoredValue(member.kind)) continue;
52300
+ if ("payload" in member && member.payload === 1 /* Partial */)
52301
+ continue;
52302
+ result.push({ schemaKey: entry.schemaKey, member });
52303
+ }
52304
+ return result;
52305
+ }
52306
+ function createMemberDefaultConstructionChecker(document) {
52307
+ const context = contextFor(document);
52308
+ return (member, genericEnv = /* @__PURE__ */ new Map()) => {
52309
+ const previousEnv = context.env;
52310
+ context.env = genericEnv;
52311
+ try {
52312
+ return defaultSettlesConstruction(member, context, /* @__PURE__ */ new Set());
52313
+ } finally {
52314
+ context.env = previousEnv;
52315
+ }
52316
+ };
52317
+ }
52318
+ function storedValueSettlesConstruction(member, sourceValue, document, genericEnv) {
52319
+ return valueSettlesConstruction(
52320
+ member,
52321
+ sourceValue,
52322
+ contextFor(document, genericEnv),
52323
+ /* @__PURE__ */ new Set(),
52324
+ true
52325
+ );
52326
+ }
52327
+ function defaultSettlesConstruction(member, context, path) {
52328
+ const body = member.defaultValue;
52329
+ if (body == null) return false;
52330
+ return valueSettlesConstruction(member, body, context, path);
52331
+ }
52332
+ function valueSettlesConstruction(member, body, context, path, storedRow = false) {
52333
+ if (isInitValueContent(body)) return true;
52334
+ const value = body.value;
52335
+ if (value == null) return !isRequiredMember2(member);
52336
+ const isClass = isMemberClassBase(member);
52337
+ const isCollection = isMemberListBase(member) || isMemberDictionaryBase(member);
52338
+ if (!isClass && !isCollection) return true;
52339
+ if (isClass && member.payload === 1 /* Partial */) return true;
52340
+ if (typeof value !== "object") return false;
52341
+ if (path.has(value)) return false;
52342
+ path.add(value);
52343
+ const previousEnv = context.env;
52344
+ try {
52345
+ if (isCollection) {
52346
+ if (body.genericBindings != null)
52347
+ context.env = envFromStamp(body.genericBindings);
52348
+ const entry = context.membersById.get(member.entryMemberId);
52349
+ if (entry === void 0) return false;
52350
+ const resolvedEntry = substituteMember(
52351
+ entry,
52352
+ context.env,
52353
+ context.document.members
52354
+ );
52355
+ const entries = Array.isArray(value) ? value : Object.values(value);
52356
+ return entries.every(
52357
+ (entryValue) => suppliedValueSettlesConstruction(
52358
+ resolvedEntry,
52359
+ entryValue,
52360
+ context,
52361
+ path
52362
+ )
52363
+ );
52364
+ }
52365
+ if (!isClass || Array.isArray(value)) return false;
52366
+ const classId = body.classId ?? member.classId;
52367
+ const constructor2 = typeof body.instanceConstructorId === "string" ? context.document.constructors.find(
52368
+ (record4) => record4.id === body.instanceConstructorId && record4.classId === classId
52369
+ ) : void 0;
52370
+ if (typeof body.instanceConstructorId === "string" && constructor2 === void 0)
52371
+ return false;
52372
+ if (constructor2 !== void 0 && constructor2.argumentTypes.some(
52373
+ (argument2, index) => !parameterHasDefault(argument2) && !Object.hasOwn(
52374
+ body.constructorArgs ?? {},
52375
+ constructorActionParameterId(constructor2, index)
52376
+ )
52377
+ ))
52378
+ return false;
52379
+ const requiredConstructorId2 = context.document.classes.find(
52380
+ (schemaClass2) => schemaClass2.id === classId
52381
+ )?.requiredConstructorId;
52382
+ if (typeof requiredConstructorId2 === "string" && constructor2?.id !== requiredConstructorId2 && !(storedRow && body.instanceConstructorId == null))
52383
+ return false;
52384
+ const classArguments2 = { ...member.classArguments };
52385
+ for (const [parameterId, memberId] of Object.entries(
52386
+ body.genericBindings ?? {}
52387
+ )) {
52388
+ classArguments2[parameterId] = {
52389
+ kind: 1 /* Member */,
52390
+ memberId
52391
+ };
52392
+ }
52393
+ context.env = resolveInstanceEnv(
52394
+ classId,
52395
+ classArguments2,
52396
+ context.document.classes
52397
+ );
52398
+ if (firstUnboundParamId(context.env) !== null) return false;
52399
+ const members = constructionMembers(classId, context);
52400
+ for (const entry of members) {
52401
+ if (Object.hasOwn(value, entry.schemaKey)) {
52402
+ if (!suppliedValueSettlesConstruction(
52403
+ entry.member,
52404
+ Reflect.get(value, entry.schemaKey),
52405
+ context,
52406
+ path
52407
+ ))
52408
+ return false;
52409
+ continue;
52410
+ }
52411
+ if (!isRequiredMember2(entry.member)) continue;
52412
+ if (constructor2 !== void 0 || typeof body.instanceVariantId === "string")
52413
+ continue;
52414
+ if (!defaultSettlesConstruction(entry.member, context, path))
52415
+ return false;
52416
+ }
52417
+ return true;
52418
+ } finally {
52419
+ path.delete(value);
52420
+ context.env = previousEnv;
52421
+ }
52422
+ }
52423
+ function suppliedValueSettlesConstruction(member, value, context, path) {
52424
+ if (typeof value === "string") {
52425
+ let row;
52426
+ if (context.document.valueById !== void 0) {
52427
+ row = context.document.valueById(value);
52428
+ } else {
52429
+ context.valuesById ??= new Map(
52430
+ context.document.values?.map((entry) => [entry.id, entry]) ?? []
52431
+ );
52432
+ row = context.valuesById.get(value);
52433
+ }
52434
+ if (row !== void 0 && row !== null)
52435
+ return valueSettlesConstruction(member, row, context, path, true);
52436
+ return false;
52437
+ }
52438
+ return valueSettlesConstruction(member, { value }, context, path);
52439
+ }
52440
+ function resolveConstructionTypeArguments(typeArguments, document) {
52441
+ if (typeArguments === void 0) return void 0;
52442
+ const bindings = {};
52443
+ const projected = /* @__PURE__ */ new Map();
52444
+ for (const [parameterId, typeInfo] of Object.entries(typeArguments)) {
52445
+ let binding;
52446
+ for (const member of document.members) {
52447
+ if (!projected.has(member.id)) {
52448
+ try {
52449
+ projected.set(
52450
+ member.id,
52451
+ genericBindingTypeInfo(member, /* @__PURE__ */ new Map(), document.members)
52452
+ );
52453
+ } catch {
52454
+ projected.set(member.id, null);
52455
+ }
52456
+ }
52457
+ const candidate = projected.get(member.id);
52458
+ if (candidate != null && typeInfosInvariantlyEqual(candidate, typeInfo)) {
52459
+ binding = member;
52460
+ break;
52461
+ }
52462
+ }
52463
+ if (binding === void 0) {
52464
+ throw new Error(
52465
+ `Construction type argument "${parameterId}" has no matching type descriptor in the document.`
52466
+ );
52467
+ }
52468
+ bindings[parameterId] = {
52469
+ kind: 1 /* Member */,
52470
+ memberId: binding.id
52471
+ };
52472
+ }
52473
+ return bindings;
52474
+ }
52475
+ var init_construction_requirements = __esm({
52476
+ "../src/models/classes/construction-requirements.ts"() {
52477
+ "use strict";
52478
+ init_type_info_compatibility();
52479
+ init_classes();
52480
+ init_inheritance();
52481
+ init_generics();
52482
+ init_constructors2();
52483
+ init_parameter_defaults();
52484
+ init_members();
52485
+ }
52486
+ });
52487
+
51913
52488
  // ../src/models/unity/unity-import-settings.ts
51914
52489
  function buildDefaultUnityTexture2DImportSettings() {
51915
52490
  return {
@@ -53031,7 +53606,8 @@ function createDefaultValueResolutionCache() {
53031
53606
  materializationPlanByClassAndEnvironment: /* @__PURE__ */ new Map(),
53032
53607
  resolvedMemberById: /* @__PURE__ */ new Map(),
53033
53608
  storedSchemaByClassId: /* @__PURE__ */ new Map(),
53034
- validatedInitializerContainers: /* @__PURE__ */ new WeakSet()
53609
+ validatedInitializerContainers: /* @__PURE__ */ new WeakSet(),
53610
+ memberDefaultConstructionChecker: null
53035
53611
  };
53036
53612
  }
53037
53613
  function withIndexedDefaultValueDocument(document, options = {}) {
@@ -53085,6 +53661,13 @@ function withIndexedDefaultValueDocument(document, options = {}) {
53085
53661
  cache.validatedInitializerContainers.add(value);
53086
53662
  return true;
53087
53663
  },
53664
+ memberDefaultSettlesConstruction: (member, environment) => {
53665
+ cache.memberDefaultConstructionChecker ??= createMemberDefaultConstructionChecker({
53666
+ ...document,
53667
+ constructors: document.constructors ?? []
53668
+ });
53669
+ return cache.memberDefaultConstructionChecker(member, environment);
53670
+ },
53088
53671
  createValueRow: options.createValueRow ?? document.createValueRow
53089
53672
  };
53090
53673
  indexed.storedInstanceMaterializationPlan = (classId, environment) => {
@@ -53113,13 +53696,10 @@ function directScalarDefaultBody(document, member) {
53113
53696
  if (member.kind !== 1 /* Bool */ && member.kind !== 2 /* Int */ && member.kind !== 4 /* Float */ && member.kind !== 3 /* String */ && member.kind !== 20 /* Decimal */ && member.kind !== 8 /* Enum */ && member.kind !== 0 /* Null */) {
53114
53697
  return void 0;
53115
53698
  }
53116
- if (!isRequiredMember2(member) && (member.defaultValue === void 0 || member.defaultValue === null)) {
53117
- return void 0;
53118
- }
53119
- if (documentHasInitValueContent(document, member.defaultValue)) {
53699
+ if (member.defaultValue == null) return void 0;
53700
+ if (documentHasInitValueContent(document, member.defaultValue))
53120
53701
  return void 0;
53121
- }
53122
- const body = member.defaultValue ?? primitiveFallbackValue(document, member);
53702
+ const body = member.defaultValue;
53123
53703
  if (!isLiteralValueContent(body)) return void 0;
53124
53704
  if (body.value !== null && typeof body.value !== "boolean" && typeof body.value !== "number" && typeof body.value !== "string") {
53125
53705
  return void 0;
@@ -53133,6 +53713,10 @@ function directScalarDefaultBody(document, member) {
53133
53713
  return { value: body.value, classId: body.classId };
53134
53714
  }
53135
53715
  function buildDefaultClassMaterializationPlan(document, classId, instanceEnv) {
53716
+ const settlesConstruction = document.memberDefaultSettlesConstruction ?? createMemberDefaultConstructionChecker({
53717
+ ...document,
53718
+ constructors: document.constructors ?? []
53719
+ });
53136
53720
  const merged = document.storedInstanceSchema?.(classId) ?? mergeStoredInstanceSchema(classId, document.classes, document.members);
53137
53721
  return merged.flatMap((entry) => {
53138
53722
  if (entry.memberId === null) return [];
@@ -53148,6 +53732,7 @@ function buildDefaultClassMaterializationPlan(document, classId, instanceEnv) {
53148
53732
  {
53149
53733
  schemaKey: entry.schemaKey,
53150
53734
  member,
53735
+ defaultSettlesConstruction: settlesConstruction(member, instanceEnv),
53151
53736
  directScalarBody: directScalarDefaultBody(document, member)
53152
53737
  }
53153
53738
  ];
@@ -53292,6 +53877,11 @@ function buildDefaultMemberValue(args) {
53292
53877
  `Cannot create a value of missing class "${effectiveClassId}".`
53293
53878
  );
53294
53879
  }
53880
+ if (member.payload !== 1 /* Partial */ && typeof effectiveClass.requiredConstructorId === "string" && args.constructorRoot === void 0 && args.authoredRoot === void 0) {
53881
+ throw new Error(
53882
+ `Class "${effectiveClass.name}" declares a required constructor; provide its constructor arguments.`
53883
+ );
53884
+ }
53295
53885
  if (isAbstractClass(effectiveClass)) {
53296
53886
  throw new Error(
53297
53887
  `Cannot create a value of abstract class "${effectiveClass.name}".`
@@ -53351,6 +53941,7 @@ function buildDefaultMemberValue(args) {
53351
53941
  for (const {
53352
53942
  schemaKey,
53353
53943
  member: resolvedChildMember,
53944
+ defaultSettlesConstruction: defaultSettlesConstruction2,
53354
53945
  directScalarBody
53355
53946
  } of member.payload === 1 /* Partial */ ? [] : materializationPlan) {
53356
53947
  if (storageKeyReferencesParentClass(
@@ -53366,6 +53957,7 @@ function buildDefaultMemberValue(args) {
53366
53957
  args.constructorRoot,
53367
53958
  schemaKey,
53368
53959
  resolvedChildMember,
53960
+ defaultSettlesConstruction2,
53369
53961
  documentHasInitValueContent(
53370
53962
  args.document,
53371
53963
  resolvedChildMember.defaultValue
@@ -53373,9 +53965,17 @@ function buildDefaultMemberValue(args) {
53373
53965
  )) {
53374
53966
  continue;
53375
53967
  }
53968
+ if (isRequiredMember2(resolvedChildMember) && !defaultSettlesConstruction2 && !(isMemberClassBase(resolvedChildMember) && resolvedChildMember.payload === 1 /* Partial */)) {
53969
+ if (args.constructorRoot?.runsMemberInitializers === true) continue;
53970
+ if (args.constructorRoot?.omitMissingRequired === true) continue;
53971
+ throw new Error(
53972
+ `Class "${effectiveClass.name}" cannot be constructed without required member "${schemaKey}"; supply it or declare a member default.`
53973
+ );
53974
+ }
53376
53975
  if (!shouldMaterializeChildDefaultForRoot(
53377
53976
  args.constructorRoot,
53378
53977
  resolvedChildMember,
53978
+ defaultSettlesConstruction2,
53379
53979
  documentHasInitValueContent(
53380
53980
  args.document,
53381
53981
  resolvedChildMember.defaultValue
@@ -53383,7 +53983,6 @@ function buildDefaultMemberValue(args) {
53383
53983
  )) {
53384
53984
  continue;
53385
53985
  }
53386
- if (shouldSkipRequiredChildDefault(resolvedChildMember)) continue;
53387
53986
  const childValue = directScalarBody === void 0 ? buildDefaultMemberValue({
53388
53987
  document: args.document,
53389
53988
  projectId: args.projectId,
@@ -53716,15 +54315,43 @@ function cloneDefaultValueForMember(args) {
53716
54315
  );
53717
54316
  return evaluatedRow;
53718
54317
  }
54318
+ if (args.path.size === 0 && !storedValueSettlesConstruction(
54319
+ member,
54320
+ sourceValue,
54321
+ {
54322
+ classes: args.document.classes,
54323
+ members: args.document.members,
54324
+ constructors: args.document.constructors ?? [],
54325
+ values: args.document.values,
54326
+ valueById: args.document.valueById
54327
+ },
54328
+ args.genericEnv
54329
+ )) {
54330
+ throw new Error(
54331
+ `Default value "${args.sourceValueId}" in ${args.referenceLocation} does not satisfy its construction requirements.`
54332
+ );
54333
+ }
53719
54334
  let body;
53720
- if (isMemberClassBase(member)) {
54335
+ if (isMemberClassBase(member) && sourceValue.value === null) {
54336
+ body = cloneMemberValueBase(sourceValue);
54337
+ } else if (isMemberClassBase(member)) {
53721
54338
  const effectiveClassId = typeof sourceValue.classId === "string" ? sourceValue.classId : member.classId;
53722
- const childEnv = args.document.instanceEnv?.(effectiveClassId, member.classArguments) ?? resolveInstanceEnv(
54339
+ const classArguments2 = { ...member.classArguments };
54340
+ for (const [parameterId, memberId] of Object.entries(
54341
+ sourceValue.genericBindings ?? {}
54342
+ )) {
54343
+ classArguments2[parameterId] = {
54344
+ kind: 1 /* Member */,
54345
+ memberId
54346
+ };
54347
+ }
54348
+ const childEnv = args.document.instanceEnv?.(effectiveClassId, classArguments2) ?? resolveInstanceEnv(
53723
54349
  effectiveClassId,
53724
- member.classArguments,
54350
+ classArguments2,
53725
54351
  args.document.classes
53726
54352
  );
53727
54353
  body = {
54354
+ ...cloneMemberValueBase(sourceValue),
53728
54355
  value: cloneDefaultClassRecord({
53729
54356
  document: args.document,
53730
54357
  projectId: args.projectId,
@@ -53738,7 +54365,7 @@ function cloneDefaultValueForMember(args) {
53738
54365
  path: nextPath,
53739
54366
  position: args.position
53740
54367
  }),
53741
- classId: effectiveClassId !== member.classId ? effectiveClassId : void 0
54368
+ classId: effectiveClassId !== member.classId || sourceValue.constructorArgs != null ? effectiveClassId : void 0
53742
54369
  };
53743
54370
  } else if (isMemberListBase(member)) {
53744
54371
  body = cloneDefaultListRecord({
@@ -53749,7 +54376,7 @@ function cloneDefaultValueForMember(args) {
53749
54376
  createdValues: args.createdValues,
53750
54377
  storageKeyDeclarations: args.storageKeyDeclarations,
53751
54378
  initEvaluator: args.initEvaluator,
53752
- genericEnv: args.genericEnv,
54379
+ genericEnv: sourceValue.genericBindings == null ? args.genericEnv : envFromStamp(sourceValue.genericBindings),
53753
54380
  path: nextPath,
53754
54381
  position: args.position
53755
54382
  });
@@ -53762,7 +54389,7 @@ function cloneDefaultValueForMember(args) {
53762
54389
  createdValues: args.createdValues,
53763
54390
  storageKeyDeclarations: args.storageKeyDeclarations,
53764
54391
  initEvaluator: args.initEvaluator,
53765
- genericEnv: args.genericEnv,
54392
+ genericEnv: sourceValue.genericBindings == null ? args.genericEnv : envFromStamp(sourceValue.genericBindings),
53766
54393
  path: nextPath,
53767
54394
  position: args.position
53768
54395
  });
@@ -53779,7 +54406,9 @@ function cloneDefaultValueForMember(args) {
53779
54406
  }
53780
54407
  const value = createDocumentValueRow(args.document, args.projectId, body);
53781
54408
  value.sourceValueId = sourceValue.sourceValueId ?? sourceValue.id;
53782
- if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
54409
+ if (sourceValue.genericBindings != null) {
54410
+ value.genericBindings = { ...sourceValue.genericBindings };
54411
+ } else if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
53783
54412
  stampGenericBindings(value, member, args);
53784
54413
  }
53785
54414
  args.createdValues.push(value);
@@ -53837,10 +54466,6 @@ function stampGenericBindings(value, member, args) {
53837
54466
  if (stamp === void 0) return;
53838
54467
  value.genericBindings = stamp;
53839
54468
  }
53840
- function shouldSkipRequiredChildDefault(member) {
53841
- if (member.defaultValue !== void 0) return false;
53842
- return isMemberAudioBase(member);
53843
- }
53844
54469
  function shouldMaterializeChildDefault(member) {
53845
54470
  if (isMemberClassBase(member) && member.payload === 1 /* Partial */)
53846
54471
  return false;
@@ -53856,18 +54481,18 @@ function shouldMaterializeConstructorChildDefault(member, isInitializer = isInit
53856
54481
  if (!isRequiredMember2(member)) return false;
53857
54482
  return shouldMaterializeChildDefault(member);
53858
54483
  }
53859
- function skipProvidedConstructorSchemaKey(constructorRoot, schemaKey, member, isInitializer = isInitValueContent(member.defaultValue)) {
54484
+ function skipProvidedConstructorSchemaKey(constructorRoot, schemaKey, member, defaultSettlesConstruction2, isInitializer = isInitValueContent(member.defaultValue)) {
53860
54485
  if (constructorRoot === void 0) return false;
53861
54486
  if (!constructorRoot.providedSchemaKeys.has(schemaKey)) return false;
53862
54487
  if (constructorRoot.runsMemberInitializers !== true) {
53863
54488
  return !isInitializer;
53864
54489
  }
53865
- return member.defaultValue === void 0;
54490
+ return !isInitializer && !defaultSettlesConstruction2;
53866
54491
  }
53867
- function shouldMaterializeChildDefaultForRoot(constructorRoot, member, isInitializer = isInitValueContent(member.defaultValue)) {
54492
+ function shouldMaterializeChildDefaultForRoot(constructorRoot, member, defaultSettlesConstruction2, isInitializer = isInitValueContent(member.defaultValue)) {
53868
54493
  if (constructorRoot === void 0)
53869
54494
  return shouldMaterializeChildDefault(member);
53870
- if (constructorRoot.omitMissingRequired === true && isRequiredMember2(member) && member.defaultValue == null) {
54495
+ if (constructorRoot.omitMissingRequired === true && !defaultSettlesConstruction2) {
53871
54496
  return false;
53872
54497
  }
53873
54498
  if (constructorRoot.runsMemberInitializers === true) {
@@ -54118,6 +54743,7 @@ var DECLARATION_DEFAULT_POSITION, SPRITE_FILE_ID_KEY;
54118
54743
  var init_build_default_member_value = __esm({
54119
54744
  "../src/models/members/build-default-member-value.ts"() {
54120
54745
  "use strict";
54746
+ init_construction_requirements();
54121
54747
  init_deep_clone_plain_data();
54122
54748
  init_dist_node();
54123
54749
  init_inheritance();
@@ -65601,172 +66227,6 @@ var init_lower_variants = __esm({
65601
66227
  }
65602
66228
  });
65603
66229
 
65604
- // ../src/models/constructors/constructors.ts
65605
- function hasRejectedConstructorKey(value) {
65606
- return REJECTED_CONSTRUCTOR_KEYS.some((key) => value[key] !== void 0);
65607
- }
65608
- function isNamedBaseClauseEntry(value, nameIsValid) {
65609
- if (typeof value !== "object" || value === null) return false;
65610
- if (Array.isArray(value)) return false;
65611
- const candidate = value;
65612
- if (!Object.keys(candidate).every((key) => key === "name" || key === "code")) {
65613
- return false;
65614
- }
65615
- if (!nameIsValid(candidate.name)) return false;
65616
- if (typeof candidate.code !== "string") return false;
65617
- return candidate.code.length > 0;
65618
- }
65619
- function isNeoConstructorBaseArgument(value) {
65620
- return isNamedBaseClauseEntry(value, isValidCallableArgumentIdentifier);
65621
- }
65622
- function isNeoConstructorBaseInitializerField(value) {
65623
- return isNamedBaseClauseEntry(value, isValidSchemaMemberIdentifier);
65624
- }
65625
- function isNeoClassConstructorBase(value) {
65626
- if (typeof value !== "object" || value === null) return false;
65627
- if (Array.isArray(value)) return false;
65628
- const v = value;
65629
- if (hasRejectedConstructorKey(v)) return false;
65630
- if (!isValidDocsText(v.docsText)) return false;
65631
- if (typeof v.classId !== "string") return false;
65632
- if (v.classId.length === 0) return false;
65633
- if (typeof v.code !== "string" && v.code !== null) return false;
65634
- if (!Array.isArray(v.argumentTypes)) return false;
65635
- const parameterNames = /* @__PURE__ */ new Set();
65636
- const argumentTypes = [];
65637
- for (const argument2 of v.argumentTypes) {
65638
- if (!isNSFunctionArgumentTypeInfo(argument2)) return false;
65639
- if (!isValidCallableArgumentIdentifier(argument2.name)) return false;
65640
- if (parameterNames.has(argument2.name)) return false;
65641
- parameterNames.add(argument2.name);
65642
- argumentTypes.push(argument2);
65643
- }
65644
- if (validateParameterDefaults(argumentTypes).length > 0) return false;
65645
- if (v.baseArguments !== void 0 && v.baseArguments !== null) {
65646
- if (!Array.isArray(v.baseArguments)) return false;
65647
- const baseNames = /* @__PURE__ */ new Set();
65648
- for (const baseArgument of v.baseArguments) {
65649
- if (!isNeoConstructorBaseArgument(baseArgument)) return false;
65650
- if (baseNames.has(baseArgument.name)) return false;
65651
- baseNames.add(baseArgument.name);
65652
- }
65653
- }
65654
- if (v.baseInitializerFields !== void 0 && v.baseInitializerFields !== null) {
65655
- if (!Array.isArray(v.baseInitializerFields)) return false;
65656
- const fieldNames = /* @__PURE__ */ new Set();
65657
- for (const field of v.baseInitializerFields) {
65658
- if (!isNeoConstructorBaseInitializerField(field)) return false;
65659
- if (fieldNames.has(field.name)) return false;
65660
- fieldNames.add(field.name);
65661
- }
65662
- }
65663
- if (v.action !== void 0 && v.action !== null) return false;
65664
- if (v.compiledBaseArguments !== void 0 && v.compiledBaseArguments !== null) {
65665
- return false;
65666
- }
65667
- return v.compiledBaseInitializerFields === void 0 || v.compiledBaseInitializerFields === null;
65668
- }
65669
- function isUncompiledNeoClassConstructor(value) {
65670
- if (!isNeoClassConstructorBase(value)) return false;
65671
- const v = value;
65672
- if (typeof v.id !== "string" || v.id.length === 0) return false;
65673
- if (typeof v.projectId !== "string" || v.projectId.length === 0) return false;
65674
- if (!isEpochMillis(v.createdAt)) return false;
65675
- return isEpochMillis(v.updatedAt);
65676
- }
65677
- function hasValidConstructorAction(action, argumentTypes) {
65678
- if (!isNSFunctionWithReturnType(action)) return false;
65679
- if (action.typeInfo.type !== 0 /* Null */) return false;
65680
- if (action.typeInfo.required !== true) return false;
65681
- if (action.parameters.length !== argumentTypes.length + 2) return false;
65682
- if (action.parameters[0]?.id !== "__this__") return false;
65683
- if (action.parameters[1]?.id !== "__root__") return false;
65684
- for (let index = 0; index < argumentTypes.length; index += 1) {
65685
- const parameter4 = action.parameters[index + 2];
65686
- if (parameter4?.id !== `__arg_${index}__`) return false;
65687
- const declared = argumentTypes[index];
65688
- if (declared === void 0) return false;
65689
- if (!typeInfosInvariantlyEqual(parameter4.typeInfo, declared)) return false;
65690
- }
65691
- return true;
65692
- }
65693
- function compiledBaseClauseGettersAlign(compiled, authored) {
65694
- const authoredCount = Array.isArray(authored) ? authored.length : 0;
65695
- if (compiled === void 0 || compiled === null) return authoredCount === 0;
65696
- if (!Array.isArray(compiled)) return false;
65697
- if (!compiled.every(isNSGetter)) return false;
65698
- return compiled.length === authoredCount;
65699
- }
65700
- function isNeoClassConstructorProps(value) {
65701
- if (typeof value !== "object" || value === null) return false;
65702
- const v = value;
65703
- const {
65704
- action: _action,
65705
- compiledBaseArguments: _compiledBaseArguments,
65706
- compiledBaseInitializerFields: _compiledBaseInitializerFields,
65707
- ...authored
65708
- } = v;
65709
- void _action;
65710
- void _compiledBaseArguments;
65711
- void _compiledBaseInitializerFields;
65712
- if (!isNeoClassConstructorBase(authored)) return false;
65713
- if (typeof v.id !== "string") return false;
65714
- if (v.id.length === 0) return false;
65715
- if (typeof v.projectId !== "string") return false;
65716
- if (!isEpochMillis(v.createdAt)) return false;
65717
- if (!isEpochMillis(v.updatedAt)) return false;
65718
- const argumentTypes = v.argumentTypes;
65719
- if (!hasValidConstructorAction(v.action, argumentTypes)) return false;
65720
- if (!compiledBaseClauseGettersAlign(v.compiledBaseArguments, v.baseArguments)) {
65721
- return false;
65722
- }
65723
- return compiledBaseClauseGettersAlign(
65724
- v.compiledBaseInitializerFields,
65725
- v.baseInitializerFields
65726
- );
65727
- }
65728
- function isNeoClassConstructor(value) {
65729
- return isNeoClassConstructorProps(value);
65730
- }
65731
- function constructorActionParameterId(constructor2, index) {
65732
- const action = "action" in constructor2 ? constructor2.action : void 0;
65733
- if (action !== null && typeof action === "object") {
65734
- const parameters = action.parameters;
65735
- if (Array.isArray(parameters)) {
65736
- const parameter4 = parameters[index + 2];
65737
- if (parameter4 !== null && typeof parameter4 === "object" && typeof parameter4.id === "string") {
65738
- return parameter4.id;
65739
- }
65740
- }
65741
- }
65742
- return `__arg_${index}__`;
65743
- }
65744
- var REJECTED_CONSTRUCTOR_KEYS;
65745
- var init_constructors = __esm({
65746
- "../src/models/constructors/constructors.ts"() {
65747
- "use strict";
65748
- init_core();
65749
- init_docs_text2();
65750
- init_member_kinds();
65751
- init_schema_identifiers();
65752
- init_neoscript();
65753
- REJECTED_CONSTRUCTOR_KEYS = [
65754
- "bodyMode",
65755
- "uiAction",
65756
- "returnTypeInfo",
65757
- "deferred"
65758
- ];
65759
- }
65760
- });
65761
-
65762
- // ../src/models/constructors/index.ts
65763
- var init_constructors2 = __esm({
65764
- "../src/models/constructors/index.ts"() {
65765
- "use strict";
65766
- init_constructors();
65767
- }
65768
- });
65769
-
65770
66230
  // ../src/models/classes/constructor-parameter-settlement.ts
65771
66231
  function createConstructorSettlementResolver(view) {
65772
66232
  const classesById = new Map(
@@ -76750,16 +77210,35 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
76750
77210
  );
76751
77211
  }
76752
77212
  const genericSlot = ctx.__constructionGenericSlots?.toReversed().find((slot) => slot.classId === classId) ?? ctx.__storedConstructionReplaySlot;
76753
- const classArguments2 = genericSlot?.classId === classId ? genericSlot.classArguments : void 0;
77213
+ const slotArguments = genericSlot?.classId === classId ? genericSlot.classArguments : void 0;
76754
77214
  const descriptorCache = evaluatorResolutionCache(ctx).validatedConstructorDescriptorByInfo;
76755
- const descriptorCacheKey = `${requireEveryRequiredField}:${ctx.storedConstructionReplay === true}:${JSON.stringify(classArguments2 ?? null)}`;
77215
+ const descriptorCacheKey = `${requireEveryRequiredField}:${ctx.storedConstructionReplay === true}:${JSON.stringify(slotArguments ?? info.schemaClassInfo.typeArguments ?? null)}`;
76756
77216
  const cachedDescriptor = descriptorCache.get(info)?.get(descriptorCacheKey);
76757
77217
  if (cachedDescriptor !== void 0) return cachedDescriptor;
77218
+ const constructionDocument = {
77219
+ classes: ctx.vm.classes,
77220
+ members: ctx.vm.members,
77221
+ constructors: ctx.vm.constructors ?? [],
77222
+ values: ctx.vm.values,
77223
+ valueById: ctx.vm.databaseVM?.valueById
77224
+ };
77225
+ const classArguments2 = slotArguments ?? resolveConstructionTypeArguments(
77226
+ info.schemaClassInfo.typeArguments,
77227
+ constructionDocument
77228
+ );
76758
77229
  const cacheDescriptor = (descriptor) => {
77230
+ const complete2 = {
77231
+ ...descriptor,
77232
+ requiredSchemaKeys: requiredMembersForConstruction(
77233
+ classId,
77234
+ constructionDocument,
77235
+ classArguments2
77236
+ ).map((entry) => entry.schemaKey)
77237
+ };
76759
77238
  const variants = descriptorCache.get(info) ?? /* @__PURE__ */ new Map();
76760
- variants.set(descriptorCacheKey, descriptor);
77239
+ variants.set(descriptorCacheKey, complete2);
76761
77240
  descriptorCache.set(info, variants);
76762
- return descriptor;
77241
+ return complete2;
76763
77242
  };
76764
77243
  const instanceEnv = cachedInstanceEnv(classId, classArguments2, ctx);
76765
77244
  if (firstUnboundParamId(instanceEnv) !== null) {
@@ -77375,6 +77854,7 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
77375
77854
  project: ctx.vm.project,
77376
77855
  members: ctx.vm.members,
77377
77856
  classes: ctx.vm.classes,
77857
+ constructors: ctx.vm.constructors,
77378
77858
  enums: ctx.vm.enums,
77379
77859
  // Declaration defaults only reference durable rows. Supplying the
77380
77860
  // immutable base plus its indexes avoids copying and linearly scanning
@@ -77461,6 +77941,15 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
77461
77941
  `Failed to construct '${schemaClass2.name}': ${error instanceof Error ? error.message : String(error)}`
77462
77942
  );
77463
77943
  }
77944
+ if (ctx.constructionBaselineReplay !== true) {
77945
+ for (const schemaKey of descriptor.requiredSchemaKeys) {
77946
+ if (typeof root.value === "object" && root.value !== null && Reflect.get(root.value, schemaKey) != null)
77947
+ continue;
77948
+ throw new NSGetterRuntimeError(
77949
+ `Class '${schemaClass2.name}' was constructed without settling required member '${schemaKey}'.`
77950
+ );
77951
+ }
77952
+ }
77464
77953
  publishConstructedRows({
77465
77954
  root,
77466
77955
  classId,
@@ -78957,6 +79446,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
78957
79446
  project: ctx.vm.project,
78958
79447
  members: ctx.vm.members,
78959
79448
  classes: ctx.vm.classes,
79449
+ constructors: ctx.vm.constructors,
78960
79450
  enums: ctx.vm.enums,
78961
79451
  values: ctx.vm.values,
78962
79452
  memberById: ctx.vm.databaseVM?.memberById,
@@ -79117,6 +79607,15 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
79117
79607
  `Failed to construct '${schemaClass2.name}': ${error instanceof Error ? error.message : String(error)}`
79118
79608
  );
79119
79609
  }
79610
+ if (ctx.constructionBaselineReplay !== true) {
79611
+ for (const schemaKey of descriptor.requiredSchemaKeys) {
79612
+ if (typeof root.value === "object" && root.value !== null && Reflect.get(root.value, schemaKey) != null)
79613
+ continue;
79614
+ throw new NSGetterRuntimeError(
79615
+ `Class '${schemaClass2.name}' was constructed without settling required member '${schemaKey}'.`
79616
+ );
79617
+ }
79618
+ }
79120
79619
  publishConstructedRows({
79121
79620
  root,
79122
79621
  classId,
@@ -80241,6 +80740,7 @@ var DELEGATE_LEXICAL_THIS, DELEGATE_LEXICAL_ROOT, NonCatchableNSGetterRuntimeErr
80241
80740
  var init_evaluateNSGetter = __esm({
80242
80741
  "../src/runtime/neoscript/evaluateNSGetter.ts"() {
80243
80742
  "use strict";
80743
+ init_construction_requirements();
80244
80744
  init_deep_clone_plain_data();
80245
80745
  init_instance_provenance();
80246
80746
  init_NeoScriptScope();
@@ -107077,7 +107577,7 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
107077
107577
  return deferredMember;
107078
107578
  }
107079
107579
  const materialized = materializeInitializerValue2({
107080
- document: { ...document, members, values: [...valuesById.values()] },
107580
+ document: { ...document, values: [...valuesById.values()] },
107081
107581
  member,
107082
107582
  row: {
107083
107583
  id: `animation-validation-default:${member.id}`,
@@ -107111,7 +107611,7 @@ function materializeDeclarationInitializersForAnimationValidation(document) {
107111
107611
  continue;
107112
107612
  }
107113
107613
  const materialized = materializeInitializerValue2({
107114
- document: { ...document, members, values: [...valuesById.values()] },
107614
+ document: { ...document, values: [...valuesById.values()] },
107115
107615
  member,
107116
107616
  row
107117
107617
  });
@@ -113289,7 +113789,6 @@ function buildValueEmitContext(records2, manifest) {
113289
113789
  },
113290
113790
  members,
113291
113791
  classes,
113292
- implicitGenericMembersByClassId: /* @__PURE__ */ new Map(),
113293
113792
  manifestMembers,
113294
113793
  manifestClasses: new Map(
113295
113794
  manifest.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
@@ -113629,7 +114128,18 @@ function animationConstructorProjectionTargetValueIds(context, classId, value) {
113629
114128
  }
113630
114129
  return targetIds;
113631
114130
  }
113632
- function rowBackedDefaultBody(member, isPulledValueRow) {
114131
+ function isTileInstanceClass(classId, classes) {
114132
+ const visited = /* @__PURE__ */ new Set();
114133
+ while (typeof classId === "string" && !visited.has(classId)) {
114134
+ visited.add(classId);
114135
+ const schemaClass2 = classes.get(classId);
114136
+ if (isObjectRecord2(schemaClass2?.system) && schemaClass2.system.worldKind === "tileInstance")
114137
+ return true;
114138
+ classId = schemaClass2?.extendsClassId;
114139
+ }
114140
+ return false;
114141
+ }
114142
+ function rowBackedDefaultBody(member, isPulledValueRow, classes) {
113633
114143
  if (member.modifier === 3) return null;
113634
114144
  const defaultValue = member.defaultValue;
113635
114145
  if (!isObjectRecord2(defaultValue)) return null;
@@ -113638,7 +114148,10 @@ function rowBackedDefaultBody(member, isPulledValueRow) {
113638
114148
  (child) => typeof child === "string" && isPulledValueRow(child)
113639
114149
  );
113640
114150
  if (member.kind === MEMBER_KIND_CLASS2 && isObjectRecord2(body)) {
113641
- const children = Object.values(body);
114151
+ const children = isTileInstanceClass(
114152
+ defaultValue.classId ?? member.classId,
114153
+ classes
114154
+ ) ? Object.entries(body).filter(([key]) => key !== "assetClassId" && key !== "variantId").map(([, value]) => value) : Object.values(body);
113642
114155
  return referencesRows(children) ? { kind: "class", body } : null;
113643
114156
  }
113644
114157
  if (member.kind === MEMBER_KIND_LIST2 && member.listKind !== "unordered" && Array.isArray(body)) {
@@ -113654,15 +114167,18 @@ function rowBackedDefaultBody(member, isPulledValueRow) {
113654
114167
  }
113655
114168
  function rowBackedDefaultMemberIdsV4(state) {
113656
114169
  const values = /* @__PURE__ */ new Set();
114170
+ const classes = /* @__PURE__ */ new Map();
113657
114171
  for (const record4 of Object.values(state)) {
113658
114172
  if (record4.recordKind === "value") values.add(record4.recordId);
114173
+ if (record4.recordKind === "class" && isObjectRecord2(record4.data))
114174
+ classes.set(record4.recordId, record4.data);
113659
114175
  }
113660
114176
  const result = /* @__PURE__ */ new Set();
113661
114177
  for (const record4 of Object.values(state)) {
113662
114178
  if (record4.recordKind !== "member" || !isObjectRecord2(record4.data)) {
113663
114179
  continue;
113664
114180
  }
113665
- if (rowBackedDefaultBody(record4.data, (id2) => values.has(id2)) !== null) {
114181
+ if (rowBackedDefaultBody(record4.data, (id2) => values.has(id2), classes) !== null) {
113666
114182
  result.add(record4.recordId);
113667
114183
  }
113668
114184
  }
@@ -113696,7 +114212,11 @@ function emitMemberDefaultSourcesV4(records2, manifest) {
113696
114212
  context.localizedTextIds.clear();
113697
114213
  continue;
113698
114214
  }
113699
- const backed = rowBackedDefaultBody(member, (id2) => context.values.has(id2));
114215
+ const backed = rowBackedDefaultBody(
114216
+ member,
114217
+ (id2) => context.values.has(id2),
114218
+ context.manifestClasses
114219
+ );
113700
114220
  if (backed === null) continue;
113701
114221
  const visited = /* @__PURE__ */ new Set();
113702
114222
  const environment = declaringClassGenericEnvironment(context, member);
@@ -114423,7 +114943,11 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
114423
114943
  });
114424
114944
  continue;
114425
114945
  }
114426
- const backed = baseData3 === null || requiresEvaluation ? null : rowBackedDefaultBody(baseData3, (id2) => pulledValueIds.has(id2));
114946
+ const backed = baseData3 === null || requiresEvaluation ? null : rowBackedDefaultBody(
114947
+ baseData3,
114948
+ (id2) => pulledValueIds.has(id2),
114949
+ context.classes
114950
+ );
114427
114951
  if (backed !== null && baseData3 !== null) {
114428
114952
  const existingReconstructedKeys = new Set(context.reconstructed.keys());
114429
114953
  const existingPendingValueIds = new Set(context.pendingValues.keys());
@@ -115022,9 +115546,11 @@ function classGenericEnvironment(context, classId) {
115022
115546
  function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
115023
115547
  const baseDefault = isObjectRecord2(baseData3.defaultValue) ? baseData3.defaultValue : {};
115024
115548
  const storedClassId = stringOrNull2(baseDefault.classId);
115025
- const expression = annotatedValue(
115026
- parseCachedInitializer(context.parsedInitializers, binding.initializer)
115027
- ).expression;
115549
+ const sourceExpression = parseCachedInitializer(
115550
+ context.parsedInitializers,
115551
+ binding.initializer
115552
+ );
115553
+ const expression = annotatedValue(sourceExpression).expression;
115028
115554
  const bindingEnvironment = bindingGenericEnvironment(context, binding);
115029
115555
  if (member.kind === "class" && backed.kind === "class") {
115030
115556
  if (expression.kind === "litNull") {
@@ -115063,6 +115589,21 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
115063
115589
  );
115064
115590
  const baseBody = backed.body;
115065
115591
  const body = {};
115592
+ if (isTileInstanceClass(classId, context.classes) && isObjectRecord2(baseBody)) {
115593
+ for (const key of ["assetClassId", "assetValueId", "variantId"]) {
115594
+ if (baseBody[key] !== void 0) body[key] = baseBody[key];
115595
+ }
115596
+ if (typeof body.assetValueId === "string") {
115597
+ retainStoredValueSubgraph(
115598
+ context,
115599
+ body.assetValueId,
115600
+ binding.source,
115601
+ /* @__PURE__ */ new Set(),
115602
+ null,
115603
+ environment
115604
+ );
115605
+ }
115606
+ }
115066
115607
  lowerConstructorProjections(
115067
115608
  context,
115068
115609
  schemaClass2,
@@ -115122,7 +115663,10 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
115122
115663
  );
115123
115664
  }
115124
115665
  return {
115125
- value: body,
115666
+ value: applyTileAnnotation(context, sourceExpression, {
115667
+ classId,
115668
+ value: body
115669
+ }).value,
115126
115670
  classId: classId === currentClassId ? storedClassId : classId
115127
115671
  };
115128
115672
  }
@@ -115488,7 +116032,6 @@ function preserveReboundValue(context, currentValueId, nextValueId, binding) {
115488
116032
  );
115489
116033
  }
115490
116034
  function lowerStaticSeed(context, member, sourceExpression, source, valueId) {
115491
- const expression = annotatedValue(sourceExpression).expression;
115492
116035
  const rows = /* @__PURE__ */ new Map();
115493
116036
  const localizedTexts = /* @__PURE__ */ new Map();
115494
116037
  const existingBindingMemberIds = new Set(
@@ -115499,7 +116042,7 @@ function lowerStaticSeed(context, member, sourceExpression, source, valueId) {
115499
116042
  const root = lowerSeedRow(
115500
116043
  context,
115501
116044
  member,
115502
- expression,
116045
+ sourceExpression,
115503
116046
  source,
115504
116047
  valueId,
115505
116048
  source.label,
@@ -115553,7 +116096,8 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
115553
116096
  localizedTexts,
115554
116097
  containerId,
115555
116098
  inheritedEnvironment,
115556
- authoredSlice
116099
+ authoredSlice,
116100
+ sourceExpression
115557
116101
  );
115558
116102
  }
115559
116103
  if (!isStoredCallableLiteral(resolvedMember.kind, expression) && memberInitializerRequiresEvaluation(
@@ -115562,6 +116106,11 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
115562
116106
  expression,
115563
116107
  source
115564
116108
  )) {
116109
+ if (tileAssetAnnotation(sourceExpression) !== null) {
116110
+ throw new Error(
116111
+ "@tile requires a literal placement construction. Construct NeoTileInstance directly and assign its members in the initializer."
116112
+ );
116113
+ }
115565
116114
  const unattachedId = annotated.id === null ? unattachedAuthoredRowId(authoredSlice) : null;
115566
116115
  if (unattachedId !== null) {
115567
116116
  throw new Error(
@@ -115877,6 +116426,10 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
115877
116426
  value = lowered.value;
115878
116427
  classId = typeof lowered.classId === "string" ? lowered.classId : null;
115879
116428
  }
116429
+ value = applyTileAnnotation(context, sourceExpression, {
116430
+ classId,
116431
+ value
116432
+ }).value;
115880
116433
  const row = {
115881
116434
  nodeType: "literal",
115882
116435
  id: valueId,
@@ -115961,7 +116514,7 @@ function structurallyConstructedClassId(context, member, expression) {
115961
116514
  if (expression.args.length === 0) return null;
115962
116515
  return effective.id;
115963
116516
  }
115964
- function lowerStructuralConstructionRow(context, member, expression, source, valueId, path, rows, localizedTexts, containerId, inheritedEnvironment, authoredSlice) {
116517
+ function lowerStructuralConstructionRow(context, member, expression, source, valueId, path, rows, localizedTexts, containerId, inheritedEnvironment, authoredSlice, annotatedExpression = expression) {
115965
116518
  const effectiveClass = constructedClass(
115966
116519
  context,
115967
116520
  member,
@@ -116089,7 +116642,10 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
116089
116642
  nodeType: "literal",
116090
116643
  id: valueId,
116091
116644
  memberId: member.id,
116092
- value,
116645
+ value: applyTileAnnotation(context, annotatedExpression, {
116646
+ classId: effectiveClass.id,
116647
+ value
116648
+ }).value,
116093
116649
  classId: effectiveClass.id,
116094
116650
  constructorArgs,
116095
116651
  // Provenance is stamped explicitly on every construction this lowerer
@@ -116290,7 +116846,13 @@ function lowerValueRow(context, member, sourceExpression, expectedValueId, sourc
116290
116846
  authoredSlice,
116291
116847
  projectedConstructionEditable ? "reproject" : "preserve"
116292
116848
  );
116293
- addReconstructed(context, "value", expectedValueId, value2, source.source);
116849
+ addReconstructed(
116850
+ context,
116851
+ "value",
116852
+ expectedValueId,
116853
+ applyTileAnnotation(context, sourceExpression, value2),
116854
+ source.source
116855
+ );
116294
116856
  return expectedValueId;
116295
116857
  }
116296
116858
  const literalFields = valueFileFields(base);
@@ -116314,7 +116876,13 @@ function lowerValueRow(context, member, sourceExpression, expectedValueId, sourc
116314
116876
  environment,
116315
116877
  authoredSlice
116316
116878
  );
116317
- addReconstructed(context, "value", expectedValueId, value, source.source);
116879
+ addReconstructed(
116880
+ context,
116881
+ "value",
116882
+ expectedValueId,
116883
+ applyTileAnnotation(context, sourceExpression, value),
116884
+ source.source
116885
+ );
116318
116886
  return expectedValueId;
116319
116887
  }
116320
116888
  function lowerValueBody(context, member, expression, base, source, environment, authoredSlice) {
@@ -118567,6 +119135,38 @@ function memberPath(expression) {
118567
119135
  const receiver = memberPath(expression.receiver);
118568
119136
  return receiver === null ? null : `${receiver}.${expression.name}`;
118569
119137
  }
119138
+ function applyTileAnnotation(context, expression, value) {
119139
+ const assetName = tileAssetAnnotation(expression);
119140
+ if (assetName === null) return value;
119141
+ const instanceBase = requiredClassByName(context, "NeoTileInstance");
119142
+ if (typeof value.classId !== "string" || !classAssignableToClass2(context, value.classId, instanceBase.id)) {
119143
+ throw new Error("@tile requires a NeoTileInstance construction.");
119144
+ }
119145
+ const asset = requiredClassByName(context, assetName);
119146
+ const tileBase = requiredClassByName(context, "NeoTile");
119147
+ if (!classAssignableToClass2(context, asset.id, tileBase.id)) {
119148
+ throw new Error(`@tile asset '${assetName}' must name a tile class.`);
119149
+ }
119150
+ if (asset.declarationModifier === "abstract") {
119151
+ throw new Error(
119152
+ `@tile asset '${assetName}' must be a concrete tile class.`
119153
+ );
119154
+ }
119155
+ if (asset.genericParameters.length > 0) {
119156
+ throw new Error(
119157
+ `@tile asset '${assetName}' must be a non-generic tile class.`
119158
+ );
119159
+ }
119160
+ if (!isObjectRecord2(value.value))
119161
+ throw new Error("@tile requires a stored placement body.");
119162
+ const body = value.value;
119163
+ if (body.assetClassId !== asset.id && (body.assetValueId !== void 0 || body.variantId !== void 0)) {
119164
+ throw new Error(
119165
+ "Cannot change a tile asset while the placement has overrides or a variant. Recreate the placement to select a different tile."
119166
+ );
119167
+ }
119168
+ return { ...value, value: { ...body, assetClassId: asset.id } };
119169
+ }
118570
119170
  function annotatedValue(expression) {
118571
119171
  if (expression.kind !== "annotated") return { expression, id: null };
118572
119172
  const id2 = annotationId2(expression.annotations);
@@ -118808,6 +119408,27 @@ function emitValueBody(context, member, value, visited, targetTyped, environment
118808
119408
  );
118809
119409
  }
118810
119410
  function classValue(context, member, value, visited, targetTyped, outerEnvironment) {
119411
+ const source = classValueBody(
119412
+ context,
119413
+ member,
119414
+ value,
119415
+ visited,
119416
+ targetTyped,
119417
+ outerEnvironment
119418
+ );
119419
+ const assetId = isObjectRecord2(value.value) ? value.value.assetClassId : void 0;
119420
+ if (typeof assetId !== "string") return source;
119421
+ const classId = stringOrNull2(value.classId) ?? stringField3(member, "classId");
119422
+ if (!isTileInstanceClass(classId, context.manifestClasses)) return source;
119423
+ const asset = context.manifestClasses.get(assetId);
119424
+ if (asset === void 0)
119425
+ throw new Error(
119426
+ `Tile placement ${String(value.id)} references unknown asset class ${assetId}.`
119427
+ );
119428
+ return `@tile(${asset.name})
119429
+ ${source}`;
119430
+ }
119431
+ function classValueBody(context, member, value, visited, targetTyped, outerEnvironment) {
118811
119432
  if (value.value === null) return "null";
118812
119433
  const partial = member.payload === 1 /* Partial */;
118813
119434
  const classId = stringOrNull2(value.classId) ?? stringField3(member, "classId");
@@ -118954,41 +119575,6 @@ function classValue(context, member, value, visited, targetTyped, outerEnvironme
118954
119575
  );
118955
119576
  overrideKeys.add(key);
118956
119577
  }
118957
- if (!partial && value.instanceVariantId == null && value.instanceVariantRowValueId == null) {
118958
- for (const [key, genericMember] of implicitGenericMembers(
118959
- context,
118960
- classId
118961
- )) {
118962
- if (key in value.value) continue;
118963
- const parameterId = stringField3(genericMember, "genericParamId");
118964
- if (!environment.has(parameterId)) continue;
118965
- const binding = resolveGenericValueMember(
118966
- context,
118967
- genericMember,
118968
- environment
118969
- );
118970
- const kind = numberField(binding, "kind");
118971
- if (!IMPLICIT_GENERIC_DEFAULT_KINDS.has(kind)) continue;
118972
- if (kind === 3 /* String */ && isLocalizedStringMember(binding))
118973
- continue;
118974
- if (binding.payload === 1 /* Partial */) continue;
118975
- const defaultValue = binding.defaultValue;
118976
- if (!isObjectRecord2(defaultValue) || !("value" in defaultValue)) continue;
118977
- const body = defaultValue.value;
118978
- if (body === null) continue;
118979
- if (Array.isArray(body) && body.length > 0) continue;
118980
- if (isObjectRecord2(body) && Object.keys(body).length > 0) continue;
118981
- const expression = emitValueBody(
118982
- context,
118983
- binding,
118984
- defaultValue,
118985
- /* @__PURE__ */ new Set(),
118986
- (defaultValue.classId ?? binding.classId) === binding.classId,
118987
- environment
118988
- );
118989
- fields.push(`${key} = ${expression}`);
118990
- }
118991
- }
118992
119578
  if (partial) {
118993
119579
  return fields.length === 0 ? "new { }" : `new {
118994
119580
  ${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
@@ -119007,33 +119593,6 @@ ${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
119007
119593
  ${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
119008
119594
  }`;
119009
119595
  }
119010
- function implicitGenericMembers(context, classId) {
119011
- const cached = context.implicitGenericMembersByClassId.get(classId);
119012
- if (cached !== void 0) return cached;
119013
- const result = /* @__PURE__ */ new Map();
119014
- const seenKeys = /* @__PURE__ */ new Set();
119015
- const seenClasses = /* @__PURE__ */ new Set();
119016
- let current = context.manifestClasses.get(classId);
119017
- while (current !== void 0 && !seenClasses.has(current.id)) {
119018
- seenClasses.add(current.id);
119019
- if (current.requiredConstructorId || current.constructorIds?.length) {
119020
- result.clear();
119021
- context.implicitGenericMembersByClassId.set(classId, result);
119022
- return result;
119023
- }
119024
- for (const [key, memberId] of Object.entries(current.schema)) {
119025
- if (seenKeys.has(key)) continue;
119026
- seenKeys.add(key);
119027
- const member = context.members.get(memberId);
119028
- if (member?.kind === 21 /* Generic */ && !isObjectRecord2(member.init)) {
119029
- result.set(key, member);
119030
- }
119031
- }
119032
- current = current.extendsClassId === null ? void 0 : context.manifestClasses.get(current.extendsClassId);
119033
- }
119034
- context.implicitGenericMembersByClassId.set(classId, result);
119035
- return result;
119036
- }
119037
119596
  function emitsAsMemberDefaultDerivedAbsence(context, member, valueId) {
119038
119597
  const value = context.values.get(valueId);
119039
119598
  if (value === void 0) return false;
@@ -120031,7 +120590,13 @@ function resolveGenericValueMember(context, member, environment) {
120031
120590
  `Stored Generic member ${String(member.name ?? member.id)} resolves to missing binding member ${bindingMemberId}.`
120032
120591
  );
120033
120592
  }
120034
- return member.payload === 1 /* Partial */ ? { ...bindingMember, payload: 1 /* Partial */ } : bindingMember;
120593
+ return {
120594
+ ...bindingMember,
120595
+ id: member.id,
120596
+ name: member.name,
120597
+ defaultValue: member.defaultValue,
120598
+ ...member.payload === 1 /* Partial */ ? { payload: 1 /* Partial */ } : {}
120599
+ };
120035
120600
  }
120036
120601
  function declaringClassGenericEnvironment(context, member) {
120037
120602
  const classId = context.ownerClassIds.get(stringField3(member, "id")) ?? memberRecordOwnerClassId(member);
@@ -120103,11 +120668,17 @@ function resolveGenericSchemaMember(context, member, environment) {
120103
120668
  `Stored Generic member ${member.name} resolves to missing binding member ${bindingMemberId}.`
120104
120669
  );
120105
120670
  }
120106
- if (member.partial !== true) return bindingMember;
120107
- if (bindingMember.kind === "class" || bindingMember.kind === "generic") {
120108
- return { ...bindingMember, partial: true };
120671
+ const resolved = {
120672
+ ...bindingMember,
120673
+ id: member.id,
120674
+ name: member.name,
120675
+ defaultValue: member.defaultValue
120676
+ };
120677
+ if (member.partial !== true) return resolved;
120678
+ if (resolved.kind === "class" || resolved.kind === "generic") {
120679
+ return { ...resolved, partial: true };
120109
120680
  }
120110
- return structuredLeafPartialChild(true, bindingMember);
120681
+ return structuredLeafPartialChild(true, resolved);
120111
120682
  }
120112
120683
  function lowerInstanceGenericEnvironment(context, classId, member, outerEnvironment) {
120113
120684
  const bindings = classGenericBindings(context.classes, classId);
@@ -120569,7 +121140,7 @@ function memberDefaultBody(member) {
120569
121140
  if (!("value" in defaultValue)) return null;
120570
121141
  return defaultValue.value;
120571
121142
  }
120572
- var INFERRED_GENERIC_CLASS_PREFIX, MEMBER_KIND_DICTIONARY2, MEMBER_KIND_LIST2, MEMBER_KIND_CLASS2, IMPLICIT_GENERIC_DEFAULT_KINDS, LEADING_AUTHORED_ROW_ID, CANONICAL_CONSTRUCTOR_INLINE_WIDTH;
121143
+ var INFERRED_GENERIC_CLASS_PREFIX, MEMBER_KIND_DICTIONARY2, MEMBER_KIND_LIST2, MEMBER_KIND_CLASS2, LEADING_AUTHORED_ROW_ID, CANONICAL_CONSTRUCTOR_INLINE_WIDTH;
120573
121144
  var init_value_sources = __esm({
120574
121145
  "src/project-source/value-sources.ts"() {
120575
121146
  "use strict";
@@ -120609,16 +121180,6 @@ var init_value_sources = __esm({
120609
121180
  MEMBER_KIND_DICTIONARY2 = 5;
120610
121181
  MEMBER_KIND_LIST2 = 6;
120611
121182
  MEMBER_KIND_CLASS2 = 7;
120612
- IMPLICIT_GENERIC_DEFAULT_KINDS = /* @__PURE__ */ new Set([
120613
- 1 /* Bool */,
120614
- 2 /* Int */,
120615
- 4 /* Float */,
120616
- 20 /* Decimal */,
120617
- 3 /* String */,
120618
- 7 /* Class */,
120619
- 6 /* List */,
120620
- 5 /* Dictionary */
120621
- ]);
120622
121183
  LEADING_AUTHORED_ROW_ID = /^@id\(\s*"((?:[^"\\]|\\.)*)"\s*\)/;
120623
121184
  CANONICAL_CONSTRUCTOR_INLINE_WIDTH = 88;
120624
121185
  }
@@ -120831,7 +121392,9 @@ function emitProjectDocumentFilesV4(records2, options = {}) {
120831
121392
  })
120832
121393
  );
120833
121394
  const errors = analysis.diagnostics.filter(
120834
- (diagnostic) => diagnostic.severity === "error" && !isPullRecoveryDiagnosticCode(diagnostic.code)
121395
+ (diagnostic) => diagnostic.severity === "error" && // Pull must expose incomplete stored objects so source can repair them.
121396
+ // Status, tests, and push still reject these construction errors.
121397
+ diagnostic.code !== "unsettled-required-member" && !isPullRecoveryDiagnosticCode(diagnostic.code)
120835
121398
  );
120836
121399
  if (errors.length > 0) {
120837
121400
  throw new Error(
@@ -131577,7 +132140,7 @@ var init_registry2 = __esm({
131577
132140
  "schema-contract/registry.mjs"() {
131578
132141
  "use strict";
131579
132142
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
131580
- cliVersion: "0.48.3",
132143
+ cliVersion: "0.50.0",
131581
132144
  projectFileUploadBatchSize: 32,
131582
132145
  documentRecords: {
131583
132146
  member: {
@@ -138627,7 +139190,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
138627
139190
  async function main() {
138628
139191
  const args = parseArgs(process.argv.slice(2));
138629
139192
  if (args.command === "--version") {
138630
- console.log("0.48.3");
139193
+ console.log("0.50.0");
138631
139194
  return;
138632
139195
  }
138633
139196
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {