@suss/adapter-typescript 0.26.0 → 0.28.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/index.cjs CHANGED
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  GENERIC_TERMINALS: () => GENERIC_TERMINALS,
35
35
  NO_BARRIERS: () => NO_BARRIERS,
36
36
  ResolutionStore: () => ResolutionStore,
37
+ TSCONFIG_NAMES: () => TSCONFIG_NAMES,
37
38
  TypeScriptWhySession: () => TypeScriptWhySession,
38
39
  accessContextFor: () => accessContextFor,
39
40
  buildProjectHelperIndex: () => buildProjectHelperIndex,
@@ -78,13 +79,13 @@ module.exports = __toCommonJS(index_exports);
78
79
 
79
80
  // src/adapter.ts
80
81
  var import_node_path11 = __toESM(require("path"), 1);
81
- var import_ts_morph67 = require("ts-morph");
82
+ var import_ts_morph68 = require("ts-morph");
82
83
  var import_behavioral_ir8 = require("@suss/behavioral-ir");
83
- var import_datalog6 = require("@suss/datalog");
84
+ var import_datalog5 = require("@suss/datalog");
84
85
  var import_extractor12 = require("@suss/extractor");
85
86
 
86
87
  // src/assembly.ts
87
- var import_ts_morph54 = require("ts-morph");
88
+ var import_ts_morph55 = require("ts-morph");
88
89
  var import_extractor5 = require("@suss/extractor");
89
90
 
90
91
  // src/conditions.ts
@@ -897,11 +898,11 @@ function tryExpandArrayIncludes(call) {
897
898
  return {
898
899
  type: "compound",
899
900
  op: "or",
900
- operands: literalValues.map((lit6) => ({
901
+ operands: literalValues.map((lit5) => ({
901
902
  type: "comparison",
902
903
  left: subject,
903
904
  op: "eq",
904
- right: lit6
905
+ right: lit5
905
906
  }))
906
907
  };
907
908
  }
@@ -1544,7 +1545,7 @@ function degradedResult(func, terminalNodes, reason) {
1544
1545
  }
1545
1546
 
1546
1547
  // src/resolve/invocationEffects.ts
1547
- var import_ts_morph42 = require("ts-morph");
1548
+ var import_ts_morph43 = require("ts-morph");
1548
1549
  var import_extractor4 = require("@suss/extractor");
1549
1550
 
1550
1551
  // src/lines.ts
@@ -2028,7 +2029,8 @@ function readFileText(project, filePath) {
2028
2029
  return null;
2029
2030
  }
2030
2031
  }
2031
- function parseTsconfig(tsConfigFilePath) {
2032
+ function parseTsconfig(tsConfigFilePath, seen = /* @__PURE__ */ new Set()) {
2033
+ seen.add(tsConfigFilePath);
2032
2034
  const configFile = import_ts_morph10.ts.readConfigFile(tsConfigFilePath, import_ts_morph10.ts.sys.readFile);
2033
2035
  if (configFile.error !== void 0) {
2034
2036
  return { fileNames: [], options: {} };
@@ -2041,7 +2043,18 @@ function parseTsconfig(tsConfigFilePath) {
2041
2043
  void 0,
2042
2044
  tsConfigFilePath
2043
2045
  );
2044
- return { fileNames: parsed.fileNames, options: parsed.options };
2046
+ if (parsed.fileNames.length > 0) {
2047
+ return { fileNames: parsed.fileNames, options: parsed.options };
2048
+ }
2049
+ const referenced = (parsed.projectReferences ?? []).map((reference) => import_ts_morph10.ts.resolveProjectReferencePath(reference)).filter((referencePath) => !seen.has(referencePath));
2050
+ const fileNames = [
2051
+ ...new Set(
2052
+ referenced.flatMap(
2053
+ (referencePath) => parseTsconfig(referencePath, seen).fileNames
2054
+ )
2055
+ )
2056
+ ];
2057
+ return { fileNames, options: parsed.options };
2045
2058
  }
2046
2059
  async function selectCandidateFiles(allFiles, packs, options) {
2047
2060
  const ungatedExists = packs.some(packIsUngated);
@@ -2402,7 +2415,7 @@ function reportUnreadableExports(file) {
2402
2415
  }
2403
2416
 
2404
2417
  // src/resolve/callOps.ts
2405
- var import_ts_morph41 = require("ts-morph");
2418
+ var import_ts_morph42 = require("ts-morph");
2406
2419
 
2407
2420
  // src/configuredCall.ts
2408
2421
  var import_ts_morph12 = require("ts-morph");
@@ -2460,10 +2473,10 @@ function rootIdentifier(node) {
2460
2473
  }
2461
2474
 
2462
2475
  // src/parameterReads.ts
2463
- var import_ts_morph39 = require("ts-morph");
2476
+ var import_ts_morph40 = require("ts-morph");
2464
2477
 
2465
2478
  // src/resolve/functionBehind.ts
2466
- var import_ts_morph38 = require("ts-morph");
2479
+ var import_ts_morph39 = require("ts-morph");
2467
2480
 
2468
2481
  // src/facts/store.ts
2469
2482
  var import_ts_morph16 = require("ts-morph");
@@ -2582,22 +2595,15 @@ function writesToBindingUncached(declaration) {
2582
2595
  }
2583
2596
  return { values, inOrder: writesRunInOrder(declaration, writes) };
2584
2597
  }
2585
- function sameConstructionAcrossWrites(values) {
2586
- const candidates = values.filter((value) => !isNotYetPlaceholder(value));
2587
- if (candidates.length === 0) {
2588
- return null;
2589
- }
2590
- let construction = null;
2591
- for (const value of candidates) {
2592
- if (!isConstruction(value)) {
2593
- return null;
2594
- }
2595
- if (construction !== null && sourceOf(value) !== sourceOf(construction)) {
2596
- return null;
2597
- }
2598
- construction = value;
2599
- }
2600
- return construction;
2598
+ function describeWrites(values) {
2599
+ return values.map((value, index) => ({
2600
+ value: String(index),
2601
+ placeholder: isNotYetPlaceholder(value),
2602
+ construction: isConstruction(value) ? sourceOf(value) : null,
2603
+ // Which name each value was written to does not reach here, and
2604
+ // that is what a narrowing write is compared against.
2605
+ narrowsName: false
2606
+ }));
2601
2607
  }
2602
2608
  function isNotYetPlaceholder(value) {
2603
2609
  return value.getKind() === import_ts_morph14.SyntaxKind.NullKeyword || import_ts_morph14.Node.isIdentifier(value) && value.getText() === "undefined";
@@ -3088,6 +3094,13 @@ function emitValue(db, table, value) {
3088
3094
  fact(db, "writtenValue", id);
3089
3095
  return id;
3090
3096
  }
3097
+ function settledWrite(values, inOrder) {
3098
+ const key = (0, import_resolution.valueLeftByWrites)(describeWrites(values), inOrder);
3099
+ if (key === null) {
3100
+ return null;
3101
+ }
3102
+ return values[Number(key)] ?? null;
3103
+ }
3091
3104
  function emitBindingValues(db, table, declaration) {
3092
3105
  const declarationId = nodeId(declaration);
3093
3106
  if (!isWrittenAgain(declaration)) {
@@ -3098,17 +3111,12 @@ function emitBindingValues(db, table, declaration) {
3098
3111
  return;
3099
3112
  }
3100
3113
  const { values, inOrder } = writesToBinding(declaration);
3101
- const last = values[values.length - 1];
3102
- if (inOrder && last !== void 0) {
3103
- fact(db, "endsHolding", declarationId, emitValue(db, table, last));
3114
+ const settled2 = settledWrite(values, inOrder);
3115
+ if (settled2 === null) {
3116
+ reassignedUnstated.add(declarationId);
3104
3117
  return;
3105
3118
  }
3106
- const construction = sameConstructionAcrossWrites(values);
3107
- if (construction !== null) {
3108
- fact(db, "endsHolding", declarationId, emitValue(db, table, construction));
3109
- return;
3110
- }
3111
- reassignedUnstated.add(declarationId);
3119
+ fact(db, "endsHolding", declarationId, emitValue(db, table, settled2));
3112
3120
  }
3113
3121
  var reassignedUnstated = /* @__PURE__ */ new Set();
3114
3122
  function reassignedNamesUnstated() {
@@ -3119,32 +3127,24 @@ function forgetReassignedNamesUnstated() {
3119
3127
  }
3120
3128
  function emitFieldValues(db, table, declaration) {
3121
3129
  const { values, inOrder } = writesToField(declaration);
3122
- const last = values[values.length - 1];
3123
- if (inOrder && last !== void 0 && import_ts_morph15.Node.isExpression(last)) {
3124
- fact(db, "binds", nodeId(declaration), emitValue(db, table, last));
3130
+ const settled2 = settledWrite(values, inOrder);
3131
+ if (settled2 === null || !import_ts_morph15.Node.isExpression(settled2)) {
3125
3132
  return;
3126
3133
  }
3127
- const construction = sameConstructionAcrossWrites(values);
3128
- if (construction !== null) {
3129
- fact(db, "binds", nodeId(declaration), emitValue(db, table, construction));
3130
- }
3134
+ fact(db, "binds", nodeId(declaration), emitValue(db, table, settled2));
3131
3135
  }
3132
3136
  function emitParameterPropertyRead(db, table, referenceId, declaration) {
3133
3137
  const { values, inOrder } = writesToField(declaration);
3134
- const last = values[values.length - 1];
3135
- if (inOrder && last !== void 0 && import_ts_morph15.Node.isExpression(last)) {
3136
- fact(db, "binds", referenceId, emitValue(db, table, last));
3138
+ const settled2 = settledWrite(values, inOrder);
3139
+ if (settled2 === null) {
3137
3140
  return;
3138
3141
  }
3139
- if (inOrder && last !== void 0) {
3140
- table.byId.set(nodeId(last), last);
3141
- fact(db, "binds", referenceId, nodeId(last));
3142
+ if (import_ts_morph15.Node.isExpression(settled2)) {
3143
+ fact(db, "binds", referenceId, emitValue(db, table, settled2));
3142
3144
  return;
3143
3145
  }
3144
- const construction = sameConstructionAcrossWrites(values);
3145
- if (construction !== null) {
3146
- fact(db, "binds", referenceId, emitValue(db, table, construction));
3147
- }
3146
+ table.byId.set(nodeId(settled2), settled2);
3147
+ fact(db, "binds", referenceId, nodeId(settled2));
3148
3148
  }
3149
3149
  function emitBindingElementFacts(db, table, element) {
3150
3150
  const id = nodeId(element);
@@ -3606,36 +3606,16 @@ var JS_RULES = [
3606
3606
  "bind"
3607
3607
  )
3608
3608
  ];
3609
- var RESOLUTION_PROGRAM = process.env.SUSS_RESOLUTION_ON_DEMAND === "0" ? {
3610
- rules: [...import_resolution2.RESOLUTION_RULES, ...JS_RULES, ...import_resolution2.RESOLUTION_QUESTIONS],
3611
- demandDriven: [],
3612
- demands: []
3613
- } : (0, import_datalog2.deriveOnDemand)(
3614
- [...import_resolution2.RESOLUTION_RULES, ...JS_RULES, ...import_resolution2.RESOLUTION_QUESTIONS],
3615
- import_resolution2.ANSWER_RELATIONS
3616
- );
3609
+ var RESOLUTION_PROGRAM = (0, import_resolution2.resolutionProgram)(JS_RULES);
3617
3610
  var WITNESS_RULES = [...import_resolution2.RESOLUTION_RULES, ...JS_RULES];
3618
3611
  var NOT_BASE_FACTS = /* @__PURE__ */ new Set([
3619
3612
  ...[...import_resolution2.RESOLUTION_RULES, ...JS_RULES, ...import_resolution2.RESOLUTION_QUESTIONS].map(
3620
3613
  (r) => r.head.relation
3621
3614
  ),
3622
3615
  ...RESOLUTION_PROGRAM.rules.map((r) => r.head.relation),
3623
- "wanted",
3624
- "wantedOrigin",
3625
- "wantedCallOrigin",
3626
- "wantedExportsOf",
3627
- "wantedAnchor",
3628
- "wantedSubject"
3616
+ ...import_resolution2.ASKING_RELATIONS
3629
3617
  ]);
3630
- var QUERY_FACTS = RESOLUTION_PROGRAM.demandDriven.length === 0 ? [] : [
3631
- ...RESOLUTION_PROGRAM.demandDriven,
3632
- "wanted",
3633
- "wantedOrigin",
3634
- "wantedCallOrigin",
3635
- "wantedExportsOf",
3636
- "wantedAnchor",
3637
- "wantedSubject"
3638
- ];
3618
+ var QUERY_FACTS = (0, import_resolution2.queryFacts)(RESOLUTION_PROGRAM);
3639
3619
  var MODULE_DEMANDS = RESOLUTION_PROGRAM.demands.filter(
3640
3620
  (one) => (one.relation === "moduleExport" || one.relation === "moduleForwards") && one.bound[0] === true
3641
3621
  ).map((one) => one.demand);
@@ -5244,6 +5224,7 @@ function literalValueOf(value, resolution, isWanted) {
5244
5224
  }
5245
5225
 
5246
5226
  // src/discovery/clientCall.ts
5227
+ var GLOBAL_OBJECTS = /* @__PURE__ */ new Set(["globalThis", "window", "self", "global"]);
5247
5228
  function discoverClientCalls(sourceFile, match, kind, resolution) {
5248
5229
  const results = [];
5249
5230
  const isGlobal = match.importModule === "global";
@@ -5268,9 +5249,15 @@ function discoverClientCalls(sourceFile, match, kind, resolution) {
5268
5249
  if (callee.getText() === match.importName) {
5269
5250
  matched = true;
5270
5251
  }
5252
+ } else if (isGlobal && import_ts_morph19.Node.isPropertyAccessExpression(callee)) {
5253
+ if (callee.getName() === match.importName && GLOBAL_OBJECTS.has(callee.getExpression().getText())) {
5254
+ matched = true;
5255
+ }
5256
+ } else if (match.callable === true && isClientItself(callee, match, clientVarNames, resolution)) {
5257
+ matched = true;
5271
5258
  } else if (import_ts_morph19.Node.isPropertyAccessExpression(callee)) {
5272
5259
  const subject = callee.getExpression();
5273
- if (import_ts_morph19.Node.isIdentifier(subject) && (isClientImport(subject, match, resolution, true) || clientVarNames.has(subject.getText())) || resolvesToKnownInstance(subject, match, resolution)) {
5260
+ if (isClientItself(subject, match, clientVarNames, resolution)) {
5274
5261
  methodName = callee.getName();
5275
5262
  if (methodFilter === null || methodFilter.has(methodName)) {
5276
5263
  matched = true;
@@ -5296,6 +5283,9 @@ function discoverClientCalls(sourceFile, match, kind, resolution) {
5296
5283
  });
5297
5284
  return results;
5298
5285
  }
5286
+ function isClientItself(subject, match, clientVarNames, resolution) {
5287
+ return import_ts_morph19.Node.isIdentifier(subject) && (isClientImport(subject, match, resolution, true) || clientVarNames.has(subject.getText())) || resolvesToKnownInstance(subject, match, resolution);
5288
+ }
5299
5289
  function clientReceiverCheckFor(sourceFile, match, resolution) {
5300
5290
  const localName = resolveImportedLocalName(
5301
5291
  sourceFile,
@@ -7717,7 +7707,7 @@ function discoverPackageImports(sourceFile, match, kind, resolution) {
7717
7707
  }
7718
7708
 
7719
7709
  // src/discovery/registrationCall.ts
7720
- var import_ts_morph33 = require("ts-morph");
7710
+ var import_ts_morph35 = require("ts-morph");
7721
7711
  var import_resolution3 = require("@suss/resolution");
7722
7712
 
7723
7713
  // src/resolve/routePath.ts
@@ -7725,9 +7715,143 @@ var import_values4 = require("@suss/values");
7725
7715
  function pathFromArgument(arg, resolution) {
7726
7716
  return (0, import_values4.pathOf)(evaluatedValue(arg, resolution));
7727
7717
  }
7718
+ function pathFromProperty(arg, property, resolution) {
7719
+ const record2 = evaluatedValue(arg, resolution);
7720
+ if (record2.kind !== "record") {
7721
+ return void 0;
7722
+ }
7723
+ const field = record2.fields.get(property);
7724
+ return field === void 0 ? void 0 : (0, import_values4.pathOf)((0, import_values4.force)(field.value));
7725
+ }
7726
+
7727
+ // src/discovery/wrapperFactory.ts
7728
+ var import_ts_morph34 = require("ts-morph");
7729
+
7730
+ // src/resolve/unfollowedCall.ts
7731
+ var import_ts_morph33 = require("ts-morph");
7732
+ var import_behavioral_ir2 = require("@suss/behavioral-ir");
7733
+ function isInExternalCode(sourceFile) {
7734
+ if (sourceFile.isDeclarationFile()) {
7735
+ return true;
7736
+ }
7737
+ return sourceFile.getFilePath().includes("/node_modules/");
7738
+ }
7739
+ function hasBody(fn) {
7740
+ if (import_ts_morph33.Node.isFunctionDeclaration(fn) || import_ts_morph33.Node.isMethodDeclaration(fn) || import_ts_morph33.Node.isFunctionExpression(fn)) {
7741
+ return fn.getBody?.() !== void 0;
7742
+ }
7743
+ return true;
7744
+ }
7745
+ function isDeclaredShape(declaration) {
7746
+ return (import_ts_morph33.Node.isMethodSignature(declaration) || import_ts_morph33.Node.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
7747
+ }
7748
+ function isExternalDeclaration(declaration) {
7749
+ if (isInExternalCode(declaration.getSourceFile())) {
7750
+ return true;
7751
+ }
7752
+ if (import_ts_morph33.Node.isImportSpecifier(declaration) || import_ts_morph33.Node.isImportClause(declaration) || import_ts_morph33.Node.isNamespaceImport(declaration)) {
7753
+ const target = declaration.getFirstAncestorByKind(import_ts_morph33.SyntaxKind.ImportDeclaration)?.getModuleSpecifierSourceFile();
7754
+ return target === void 0 || isInExternalCode(target);
7755
+ }
7756
+ return declaresAnotherModule(declaration);
7757
+ }
7758
+ function declaresAnotherModule(declaration) {
7759
+ const module2 = declaration.getFirstAncestorByKind(
7760
+ import_ts_morph33.SyntaxKind.ModuleDeclaration
7761
+ );
7762
+ return module2 !== void 0 && import_ts_morph33.Node.isStringLiteral(module2.getNameNode());
7763
+ }
7764
+ function statesShapeOnly(declaration) {
7765
+ if (isExternalDeclaration(declaration)) {
7766
+ return false;
7767
+ }
7768
+ if (import_ts_morph33.Node.isMethodSignature(declaration) || import_ts_morph33.Node.isPropertySignature(declaration)) {
7769
+ return true;
7770
+ }
7771
+ if (import_ts_morph33.Node.isFunctionDeclaration(declaration) || import_ts_morph33.Node.isMethodDeclaration(declaration)) {
7772
+ return declaration.getBody() === void 0;
7773
+ }
7774
+ return false;
7775
+ }
7776
+ function declarationsBehind(symbol) {
7777
+ if (symbol === void 0) {
7778
+ return [];
7779
+ }
7780
+ const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
7781
+ return behind.length > 0 ? behind : symbol.getDeclarations();
7782
+ }
7783
+ function isParameterOf(declaration, scanning) {
7784
+ return import_ts_morph33.Node.isParameterDeclaration(declaration) && declaration.getParent() === scanning;
7785
+ }
7786
+ function parameterIndexOf(declarations, scanning) {
7787
+ if (scanning === void 0) {
7788
+ return void 0;
7789
+ }
7790
+ const params = scanning.getParameters();
7791
+ for (const declaration of declarations) {
7792
+ const index = params.findIndex((param) => param === declaration);
7793
+ if (index !== -1) {
7794
+ return index;
7795
+ }
7796
+ }
7797
+ return void 0;
7798
+ }
7799
+ function classifyStop(declarations, scanning) {
7800
+ if (declarations.length === 0) {
7801
+ return "noDeclaration";
7802
+ }
7803
+ for (const declaration of declarations) {
7804
+ if (!isInExternalCode(declaration.getSourceFile())) {
7805
+ recordFileDependency(declaration.getSourceFile().getFilePath());
7806
+ }
7807
+ }
7808
+ if (scanning !== void 0 && declarations.some((declaration) => isParameterOf(declaration, scanning))) {
7809
+ return "callerSupplied";
7810
+ }
7811
+ if (declarations.every(isExternalDeclaration)) {
7812
+ return "outsideRun";
7813
+ }
7814
+ if (declarations.some(statesShapeOnly)) {
7815
+ return "noBody";
7816
+ }
7817
+ return "unsettledValue";
7818
+ }
7819
+
7820
+ // src/discovery/wrapperFactory.ts
7821
+ function factoryNameOf(targetArg) {
7822
+ const written = factKeyOf(targetArg);
7823
+ if (!import_ts_morph34.Node.isCallExpression(written)) {
7824
+ return void 0;
7825
+ }
7826
+ const callee = written.getExpression();
7827
+ if (import_ts_morph34.Node.isIdentifier(callee)) {
7828
+ return callee.getText();
7829
+ }
7830
+ if (import_ts_morph34.Node.isPropertyAccessExpression(callee)) {
7831
+ return callee.getName();
7832
+ }
7833
+ return void 0;
7834
+ }
7835
+ function factoryStopOf(targetArg) {
7836
+ const written = factKeyOf(targetArg);
7837
+ if (!import_ts_morph34.Node.isCallExpression(written)) {
7838
+ return null;
7839
+ }
7840
+ const callee = factoryNameOf(targetArg);
7841
+ if (callee === void 0) {
7842
+ return null;
7843
+ }
7844
+ const reason = classifyStop(
7845
+ declarationsBehind(written.getExpression().getSymbol())
7846
+ );
7847
+ if (!(0, import_behavioral_ir2.worthRecording)(reason)) {
7848
+ return null;
7849
+ }
7850
+ return { callee, reason: "unresolvedWrapper" };
7851
+ }
7728
7852
 
7729
7853
  // src/discovery/registrationCall.ts
7730
- function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, resolution, mountPrefixes, expandedElsewhere) {
7854
+ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, resolution, mountPrefixes, expandedElsewhere, routeWrapperPattern) {
7731
7855
  const results = [];
7732
7856
  const registrationSubjects = registrationSubjectsOf(
7733
7857
  sourceFile,
@@ -7742,11 +7866,11 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7742
7866
  return results;
7743
7867
  }
7744
7868
  sourceFile.forEachDescendant((node) => {
7745
- if (!import_ts_morph33.Node.isCallExpression(node)) {
7869
+ if (!import_ts_morph35.Node.isCallExpression(node)) {
7746
7870
  return;
7747
7871
  }
7748
7872
  const callee = node.getExpression();
7749
- if (!import_ts_morph33.Node.isPropertyAccessExpression(callee)) {
7873
+ if (!import_ts_morph35.Node.isPropertyAccessExpression(callee)) {
7750
7874
  return;
7751
7875
  }
7752
7876
  const methodName = callee.getName();
@@ -7783,12 +7907,12 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7783
7907
  const registrationSubjectId = nodeId(subjectNode);
7784
7908
  let foundObjectArg = false;
7785
7909
  for (const arg of args) {
7786
- if (!import_ts_morph33.Node.isObjectLiteralExpression(arg)) {
7910
+ if (!import_ts_morph35.Node.isObjectLiteralExpression(arg)) {
7787
7911
  continue;
7788
7912
  }
7789
7913
  foundObjectArg = true;
7790
7914
  for (const prop of arg.getProperties()) {
7791
- if (import_ts_morph33.Node.isMethodDeclaration(prop)) {
7915
+ if (import_ts_morph35.Node.isMethodDeclaration(prop)) {
7792
7916
  results.push({
7793
7917
  func: prop,
7794
7918
  kind,
@@ -7797,7 +7921,7 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7797
7921
  });
7798
7922
  continue;
7799
7923
  }
7800
- if (!import_ts_morph33.Node.isPropertyAssignment(prop)) {
7924
+ if (!import_ts_morph35.Node.isPropertyAssignment(prop)) {
7801
7925
  continue;
7802
7926
  }
7803
7927
  const propInit = prop.getInitializer();
@@ -7829,6 +7953,13 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7829
7953
  mountPrefixes
7830
7954
  );
7831
7955
  if (handler !== null) {
7956
+ const chain = routeWrapperPattern === void 0 ? null : routeChainOf(
7957
+ args.slice(0, -1),
7958
+ routeWrapperPattern,
7959
+ methodName,
7960
+ routeInfo,
7961
+ resolution
7962
+ );
7832
7963
  results.push({
7833
7964
  func: handler,
7834
7965
  kind,
@@ -7836,8 +7967,13 @@ function discoverRegistrationCalls(sourceFile, match, kind, bindingExtraction, r
7836
7967
  name: methodName,
7837
7968
  nameKind: "label",
7838
7969
  registrationSubjectId,
7839
- ...routeInfo !== null ? { routeInfo } : {}
7970
+ ...routeInfo !== null ? { routeInfo } : {},
7971
+ ...chain === null || chain.references.length === 0 ? {} : { routeWrappers: chain.references },
7972
+ ...chain === null || chain.unfollowed.length === 0 ? {} : { routeUnfollowed: chain.unfollowed }
7840
7973
  });
7974
+ if (chain !== null) {
7975
+ results.push(...chain.units);
7976
+ }
7841
7977
  return;
7842
7978
  }
7843
7979
  if (routeInfo !== null && lastArg !== void 0 && namesAParameter(lastArg)) {
@@ -7883,6 +8019,47 @@ function declinedRegistration(call, callee, methodName, kind, receiver, resoluti
7883
8019
  }
7884
8020
  ];
7885
8021
  }
8022
+ function routeChainOf(listed, pattern, methodName, routeInfo, resolution) {
8023
+ const chain = { units: [], references: [], unfollowed: [] };
8024
+ const anonymousLabels = /* @__PURE__ */ new Map();
8025
+ for (const arg of listed) {
8026
+ const elements = import_ts_morph35.Node.isArrayLiteralExpression(arg) ? arg.getElements() : [arg];
8027
+ for (const element of elements) {
8028
+ const target = functionValueOf(element, resolution);
8029
+ if (target === null) {
8030
+ const stop = factoryStopOf(element);
8031
+ if (stop !== null) {
8032
+ chain.unfollowed.push(stop);
8033
+ }
8034
+ continue;
8035
+ }
8036
+ const ownName = functionNameOrAnon(target);
8037
+ const named2 = ownName !== "<anon>";
8038
+ const label = factoryNameOf(element) ?? methodName;
8039
+ const seen = anonymousLabels.get(label) ?? 0;
8040
+ if (!named2) {
8041
+ anonymousLabels.set(label, seen + 1);
8042
+ }
8043
+ const name = named2 ? ownName : routeWrapperLabel(label, routeInfo, element, seen);
8044
+ chain.units.push({
8045
+ func: target,
8046
+ kind: pattern.kind,
8047
+ name,
8048
+ pattern,
8049
+ ...named2 ? {} : { nameKind: "label" }
8050
+ });
8051
+ chain.references.push({
8052
+ file: target.getSourceFile().getFilePath(),
8053
+ name
8054
+ });
8055
+ }
8056
+ }
8057
+ return chain;
8058
+ }
8059
+ function routeWrapperLabel(label, routeInfo, element, seen) {
8060
+ const where = routeInfo === null ? `L${element.getStartLineNumber()}` : `${routeInfo.method} ${routeInfo.path}`;
8061
+ return seen === 0 ? `${label}@${where}` : `${label}@${where}#${seen + 1}`;
8062
+ }
7886
8063
  function withMountPrefix(routeInfo, subjectNode, mountPrefixes) {
7887
8064
  if (routeInfo === null || mountPrefixes === void 0) {
7888
8065
  return routeInfo;
@@ -7910,13 +8087,13 @@ function subjectNodeFor(subject, subjects, match, resolution) {
7910
8087
  }
7911
8088
  var NOT_A_ROUTABLE = { kind: "none" };
7912
8089
  function receiverOf(subject, subjects, match, resolution) {
7913
- if (import_ts_morph33.Node.isIdentifier(subject)) {
8090
+ if (import_ts_morph35.Node.isIdentifier(subject)) {
7914
8091
  const known = subjects.get(subject.getText());
7915
8092
  if (known !== void 0) {
7916
8093
  return { kind: "routable", node: known };
7917
8094
  }
7918
8095
  }
7919
- if (resolution === void 0 || !(import_ts_morph33.Node.isIdentifier(subject) || import_ts_morph33.Node.isPropertyAccessExpression(subject))) {
8096
+ if (resolution === void 0 || !(import_ts_morph35.Node.isIdentifier(subject) || import_ts_morph35.Node.isPropertyAccessExpression(subject))) {
7920
8097
  return NOT_A_ROUTABLE;
7921
8098
  }
7922
8099
  const construction = resolution.subjectConstructionOf(
@@ -7956,18 +8133,18 @@ function collectMethodsCalledOnCallResults(sourceFile) {
7956
8133
  const setToCalls = /* @__PURE__ */ new Set();
7957
8134
  const calledOn = /* @__PURE__ */ new Map();
7958
8135
  sourceFile.forEachDescendant((node) => {
7959
- if (import_ts_morph33.Node.isVariableDeclaration(node)) {
8136
+ if (import_ts_morph35.Node.isVariableDeclaration(node)) {
7960
8137
  const init = node.getInitializer();
7961
- if (init !== void 0 && import_ts_morph33.Node.isCallExpression(init)) {
8138
+ if (init !== void 0 && import_ts_morph35.Node.isCallExpression(init)) {
7962
8139
  setToCalls.add(node.getName());
7963
8140
  }
7964
8141
  return;
7965
8142
  }
7966
- if (!import_ts_morph33.Node.isCallExpression(node)) {
8143
+ if (!import_ts_morph35.Node.isCallExpression(node)) {
7967
8144
  return;
7968
8145
  }
7969
8146
  const callee = node.getExpression();
7970
- if (!import_ts_morph33.Node.isPropertyAccessExpression(callee) || !import_ts_morph33.Node.isIdentifier(callee.getExpression())) {
8147
+ if (!import_ts_morph35.Node.isPropertyAccessExpression(callee) || !import_ts_morph35.Node.isIdentifier(callee.getExpression())) {
7971
8148
  return;
7972
8149
  }
7973
8150
  const receiver = callee.getExpression().getText();
@@ -7994,18 +8171,18 @@ function registrationSubjectsOf(sourceFile, importModule, importName, resolution
7994
8171
  return subjects;
7995
8172
  }
7996
8173
  sourceFile.forEachDescendant((node) => {
7997
- if (import_ts_morph33.Node.isVariableDeclaration(node)) {
8174
+ if (import_ts_morph35.Node.isVariableDeclaration(node)) {
7998
8175
  const init = node.getInitializer();
7999
8176
  if (init === void 0) {
8000
8177
  return;
8001
8178
  }
8002
- const calleeText = import_ts_morph33.Node.isCallExpression(init) || import_ts_morph33.Node.isNewExpression(init) ? init.getExpression().getText() : null;
8179
+ const calleeText = import_ts_morph35.Node.isCallExpression(init) || import_ts_morph35.Node.isNewExpression(init) ? init.getExpression().getText() : null;
8003
8180
  if (calleeText !== null && spellings.includes(calleeText)) {
8004
8181
  subjects.set(node.getName(), init);
8005
8182
  }
8006
8183
  return;
8007
8184
  }
8008
- if (!import_ts_morph33.Node.isParameterDeclaration(node)) {
8185
+ if (!import_ts_morph35.Node.isParameterDeclaration(node)) {
8009
8186
  return;
8010
8187
  }
8011
8188
  const typeNode = node.getTypeNode();
@@ -8026,7 +8203,7 @@ function creationSiteBehind(parameter, resolution) {
8026
8203
  return parameter;
8027
8204
  }
8028
8205
  const written = resolution.resolveWrittenValue(parameter);
8029
- if (written === null || !(import_ts_morph33.Node.isCallExpression(written) || import_ts_morph33.Node.isNewExpression(written))) {
8206
+ if (written === null || !(import_ts_morph35.Node.isCallExpression(written) || import_ts_morph35.Node.isNewExpression(written))) {
8030
8207
  return parameter;
8031
8208
  }
8032
8209
  return written;
@@ -8069,7 +8246,7 @@ function unboundConstructionsOf(sourceFile, importModule, importName) {
8069
8246
  }
8070
8247
  const constructions = [];
8071
8248
  sourceFile.forEachDescendant((node) => {
8072
- if ((import_ts_morph33.Node.isCallExpression(node) || import_ts_morph33.Node.isNewExpression(node)) && spellings.includes(node.getExpression().getText()) && !import_ts_morph33.Node.isVariableDeclaration(node.getParent())) {
8249
+ if ((import_ts_morph35.Node.isCallExpression(node) || import_ts_morph35.Node.isNewExpression(node)) && spellings.includes(node.getExpression().getText()) && !import_ts_morph35.Node.isVariableDeclaration(node.getParent())) {
8073
8250
  constructions.push(node);
8074
8251
  }
8075
8252
  });
@@ -8087,11 +8264,11 @@ function discoverMountEdges(sourceFile, match, mount, knownSubjectIds, resolutio
8087
8264
  }
8088
8265
  const edges = [];
8089
8266
  sourceFile.forEachDescendant((node) => {
8090
- if (!import_ts_morph33.Node.isCallExpression(node)) {
8267
+ if (!import_ts_morph35.Node.isCallExpression(node)) {
8091
8268
  return;
8092
8269
  }
8093
8270
  const callee = node.getExpression();
8094
- if (!import_ts_morph33.Node.isPropertyAccessExpression(callee) || callee.getName() !== mount.method) {
8271
+ if (!import_ts_morph35.Node.isPropertyAccessExpression(callee) || callee.getName() !== mount.method) {
8095
8272
  return;
8096
8273
  }
8097
8274
  const subjectNode = subjectNodeFor(
@@ -8105,7 +8282,7 @@ function discoverMountEdges(sourceFile, match, mount, knownSubjectIds, resolutio
8105
8282
  }
8106
8283
  const args = node.getArguments();
8107
8284
  const prefixArg = args[mount.prefixPosition];
8108
- if (prefixArg === void 0 || !(import_ts_morph33.Node.isStringLiteral(prefixArg) || import_ts_morph33.Node.isNoSubstitutionTemplateLiteral(prefixArg))) {
8285
+ if (prefixArg === void 0 || !(import_ts_morph35.Node.isStringLiteral(prefixArg) || import_ts_morph35.Node.isNoSubstitutionTemplateLiteral(prefixArg))) {
8109
8286
  return;
8110
8287
  }
8111
8288
  const targetNodes = mountTargetsAmong(
@@ -8160,7 +8337,7 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
8160
8337
  } else {
8161
8338
  const args = call.getArguments();
8162
8339
  const arg = args[binding.method.position];
8163
- if (arg === void 0 || !(import_ts_morph33.Node.isStringLiteral(arg) || import_ts_morph33.Node.isNoSubstitutionTemplateLiteral(arg))) {
8340
+ if (arg === void 0 || !(import_ts_morph35.Node.isStringLiteral(arg) || import_ts_morph35.Node.isNoSubstitutionTemplateLiteral(arg))) {
8164
8341
  return null;
8165
8342
  }
8166
8343
  method = arg.getLiteralValue().toUpperCase();
@@ -8171,7 +8348,7 @@ function extractRouteInfoFromBinding(call, methodName, binding, resolution) {
8171
8348
  }
8172
8349
 
8173
8350
  // src/discovery/registrationLoop.ts
8174
- var import_ts_morph34 = require("ts-morph");
8351
+ var import_ts_morph36 = require("ts-morph");
8175
8352
  function discoverRegistrationLoops(sourceFile, match, kind, resolution) {
8176
8353
  const results = [];
8177
8354
  const guard = receiverGuard(sourceFile, match.receiver, resolution);
@@ -8179,7 +8356,7 @@ function discoverRegistrationLoops(sourceFile, match, kind, resolution) {
8179
8356
  return results;
8180
8357
  }
8181
8358
  sourceFile.forEachDescendant((node) => {
8182
- if (!import_ts_morph34.Node.isForOfStatement(node)) {
8359
+ if (!import_ts_morph36.Node.isForOfStatement(node)) {
8183
8360
  return;
8184
8361
  }
8185
8362
  const expanded = tryExpandLoop(node, match, kind, resolution, guard);
@@ -8242,13 +8419,13 @@ function tryExpandLoop(loop, match, kind, resolution, guard) {
8242
8419
  }
8243
8420
  function loopVariableName(loop) {
8244
8421
  const initializer = loop.getInitializer();
8245
- if (import_ts_morph34.Node.isVariableDeclarationList(initializer)) {
8422
+ if (import_ts_morph36.Node.isVariableDeclarationList(initializer)) {
8246
8423
  const decls = initializer.getDeclarations();
8247
8424
  if (decls.length !== 1) {
8248
8425
  return null;
8249
8426
  }
8250
8427
  const nameNode = decls[0]?.getNameNode();
8251
- if (nameNode !== void 0 && import_ts_morph34.Node.isIdentifier(nameNode)) {
8428
+ if (nameNode !== void 0 && import_ts_morph36.Node.isIdentifier(nameNode)) {
8252
8429
  return nameNode.getText();
8253
8430
  }
8254
8431
  }
@@ -8261,14 +8438,14 @@ function bodyReferencesLoopVar(loop, name) {
8261
8438
  if (referenced) {
8262
8439
  return;
8263
8440
  }
8264
- if (!import_ts_morph34.Node.isCallExpression(node)) {
8441
+ if (!import_ts_morph36.Node.isCallExpression(node)) {
8265
8442
  return;
8266
8443
  }
8267
8444
  node.forEachDescendant((inner) => {
8268
8445
  if (referenced) {
8269
8446
  return;
8270
8447
  }
8271
- if (import_ts_morph34.Node.isIdentifier(inner) && inner.getText() === name) {
8448
+ if (import_ts_morph36.Node.isIdentifier(inner) && inner.getText() === name) {
8272
8449
  referenced = true;
8273
8450
  }
8274
8451
  });
@@ -8278,11 +8455,11 @@ function bodyReferencesLoopVar(loop, name) {
8278
8455
  function bodyCallsOnRoutable(loop, guard, resolution) {
8279
8456
  let found = false;
8280
8457
  loop.getStatement().forEachDescendant((node) => {
8281
- if (found || !import_ts_morph34.Node.isCallExpression(node)) {
8458
+ if (found || !import_ts_morph36.Node.isCallExpression(node)) {
8282
8459
  return;
8283
8460
  }
8284
8461
  const callee = node.getExpression();
8285
- if (!import_ts_morph34.Node.isPropertyAccessExpression(callee) && !import_ts_morph34.Node.isElementAccessExpression(callee)) {
8462
+ if (!import_ts_morph36.Node.isPropertyAccessExpression(callee) && !import_ts_morph36.Node.isElementAccessExpression(callee)) {
8286
8463
  return;
8287
8464
  }
8288
8465
  const subject = callee.getExpression();
@@ -8302,11 +8479,11 @@ function readRouteSpec(element, shape, resolution) {
8302
8479
  let path15 = null;
8303
8480
  let handler = null;
8304
8481
  for (const prop of element.getProperties()) {
8305
- if (import_ts_morph34.Node.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
8482
+ if (import_ts_morph36.Node.isMethodDeclaration(prop) && prop.getName() === shape.handlerKey) {
8306
8483
  handler = { func: prop, name: shape.handlerKey };
8307
8484
  continue;
8308
8485
  }
8309
- if (!import_ts_morph34.Node.isPropertyAssignment(prop)) {
8486
+ if (!import_ts_morph36.Node.isPropertyAssignment(prop)) {
8310
8487
  continue;
8311
8488
  }
8312
8489
  const name = prop.getName();
@@ -8329,111 +8506,19 @@ function readRouteSpec(element, shape, resolution) {
8329
8506
  return { method, path: path15, handler: handler.func, handlerName: handler.name };
8330
8507
  }
8331
8508
  function readStringLiteralValue(node) {
8332
- if (import_ts_morph34.Node.isStringLiteral(node) || import_ts_morph34.Node.isNoSubstitutionTemplateLiteral(node)) {
8509
+ if (import_ts_morph36.Node.isStringLiteral(node) || import_ts_morph36.Node.isNoSubstitutionTemplateLiteral(node)) {
8333
8510
  return node.getLiteralValue();
8334
8511
  }
8335
8512
  return null;
8336
8513
  }
8337
8514
  function handlerName(value) {
8338
- return import_ts_morph34.Node.isIdentifier(value) ? value.getText() : value.getKindName();
8515
+ return import_ts_morph36.Node.isIdentifier(value) ? value.getText() : value.getKindName();
8339
8516
  }
8340
8517
 
8341
8518
  // src/discovery/registrationTemplate.ts
8342
8519
  var import_node_path6 = __toESM(require("path"), 1);
8343
- var import_ts_morph36 = require("ts-morph");
8520
+ var import_ts_morph37 = require("ts-morph");
8344
8521
  var import_resolution4 = require("@suss/resolution");
8345
-
8346
- // src/resolve/unfollowedCall.ts
8347
- var import_ts_morph35 = require("ts-morph");
8348
- var import_behavioral_ir2 = require("@suss/behavioral-ir");
8349
- function isInExternalCode(sourceFile) {
8350
- if (sourceFile.isDeclarationFile()) {
8351
- return true;
8352
- }
8353
- return sourceFile.getFilePath().includes("/node_modules/");
8354
- }
8355
- function hasBody(fn) {
8356
- if (import_ts_morph35.Node.isFunctionDeclaration(fn) || import_ts_morph35.Node.isMethodDeclaration(fn) || import_ts_morph35.Node.isFunctionExpression(fn)) {
8357
- return fn.getBody?.() !== void 0;
8358
- }
8359
- return true;
8360
- }
8361
- function isDeclaredShape(declaration) {
8362
- return (import_ts_morph35.Node.isMethodSignature(declaration) || import_ts_morph35.Node.isPropertySignature(declaration)) && !isInExternalCode(declaration.getSourceFile());
8363
- }
8364
- function isExternalDeclaration(declaration) {
8365
- if (isInExternalCode(declaration.getSourceFile())) {
8366
- return true;
8367
- }
8368
- if (import_ts_morph35.Node.isImportSpecifier(declaration) || import_ts_morph35.Node.isImportClause(declaration) || import_ts_morph35.Node.isNamespaceImport(declaration)) {
8369
- const target = declaration.getFirstAncestorByKind(import_ts_morph35.SyntaxKind.ImportDeclaration)?.getModuleSpecifierSourceFile();
8370
- return target === void 0 || isInExternalCode(target);
8371
- }
8372
- return declaresAnotherModule(declaration);
8373
- }
8374
- function declaresAnotherModule(declaration) {
8375
- const module2 = declaration.getFirstAncestorByKind(
8376
- import_ts_morph35.SyntaxKind.ModuleDeclaration
8377
- );
8378
- return module2 !== void 0 && import_ts_morph35.Node.isStringLiteral(module2.getNameNode());
8379
- }
8380
- function statesShapeOnly(declaration) {
8381
- if (isExternalDeclaration(declaration)) {
8382
- return false;
8383
- }
8384
- if (import_ts_morph35.Node.isMethodSignature(declaration) || import_ts_morph35.Node.isPropertySignature(declaration)) {
8385
- return true;
8386
- }
8387
- if (import_ts_morph35.Node.isFunctionDeclaration(declaration) || import_ts_morph35.Node.isMethodDeclaration(declaration)) {
8388
- return declaration.getBody() === void 0;
8389
- }
8390
- return false;
8391
- }
8392
- function declarationsBehind(symbol) {
8393
- if (symbol === void 0) {
8394
- return [];
8395
- }
8396
- const behind = symbol.getAliasedSymbol()?.getDeclarations() ?? [];
8397
- return behind.length > 0 ? behind : symbol.getDeclarations();
8398
- }
8399
- function isParameterOf(declaration, scanning) {
8400
- return import_ts_morph35.Node.isParameterDeclaration(declaration) && declaration.getParent() === scanning;
8401
- }
8402
- function parameterIndexOf(declarations, scanning) {
8403
- if (scanning === void 0) {
8404
- return void 0;
8405
- }
8406
- const params = scanning.getParameters();
8407
- for (const declaration of declarations) {
8408
- const index = params.findIndex((param) => param === declaration);
8409
- if (index !== -1) {
8410
- return index;
8411
- }
8412
- }
8413
- return void 0;
8414
- }
8415
- function classifyStop(declarations, scanning) {
8416
- if (declarations.length === 0) {
8417
- return "noDeclaration";
8418
- }
8419
- for (const declaration of declarations) {
8420
- if (!isInExternalCode(declaration.getSourceFile())) {
8421
- recordFileDependency(declaration.getSourceFile().getFilePath());
8422
- }
8423
- }
8424
- if (scanning !== void 0 && declarations.some((declaration) => isParameterOf(declaration, scanning))) {
8425
- return "callerSupplied";
8426
- }
8427
- if (declarations.every(isExternalDeclaration)) {
8428
- return "outsideRun";
8429
- }
8430
- if (declarations.some(statesShapeOnly)) {
8431
- return "noBody";
8432
- }
8433
- return "unsettledValue";
8434
- }
8435
-
8436
- // src/discovery/registrationTemplate.ts
8437
8522
  function discoverRegistrationTemplates(sourceFile, match, kind, resolution, mountPrefixes) {
8438
8523
  const results = [];
8439
8524
  for (const node of helperCallsOf(sourceFile, match, resolution)) {
@@ -8494,15 +8579,15 @@ function helperCallsOf(sourceFile, match, resolution) {
8494
8579
  return callsResolvingTo(sourceFile, store, {
8495
8580
  module: module2,
8496
8581
  name: match.helperName
8497
- }).filter(import_ts_morph36.Node.isCallExpression);
8582
+ }).filter(import_ts_morph37.Node.isCallExpression);
8498
8583
  }
8499
8584
  const calls = [];
8500
8585
  sourceFile.forEachDescendant((node) => {
8501
- if (!import_ts_morph36.Node.isCallExpression(node)) {
8586
+ if (!import_ts_morph37.Node.isCallExpression(node)) {
8502
8587
  return;
8503
8588
  }
8504
8589
  const callee = node.getExpression();
8505
- if (!import_ts_morph36.Node.isIdentifier(callee) || callee.getText() !== match.helperName) {
8590
+ if (!import_ts_morph37.Node.isIdentifier(callee) || callee.getText() !== match.helperName) {
8506
8591
  return;
8507
8592
  }
8508
8593
  if (module2 === void 0 || declaredInModule(callee, module2)) {
@@ -8546,7 +8631,7 @@ function substitutePath(template, args) {
8546
8631
  return result;
8547
8632
  }
8548
8633
  function readStringLiteral(node) {
8549
- if (import_ts_morph36.Node.isStringLiteral(node) || import_ts_morph36.Node.isNoSubstitutionTemplateLiteral(node)) {
8634
+ if (import_ts_morph37.Node.isStringLiteral(node) || import_ts_morph37.Node.isNoSubstitutionTemplateLiteral(node)) {
8550
8635
  return node.getLiteralValue();
8551
8636
  }
8552
8637
  return null;
@@ -8569,7 +8654,7 @@ function resolveHandler(template, args, resolution) {
8569
8654
  return readPropertyAsFunction(arg, prop, resolution);
8570
8655
  }
8571
8656
  function handlerName2(value) {
8572
- return import_ts_morph36.Node.isIdentifier(value) ? value.getText() : value.getKindName();
8657
+ return import_ts_morph37.Node.isIdentifier(value) ? value.getText() : value.getKindName();
8573
8658
  }
8574
8659
  function readPropertyAsFunction(arg, prop, resolution) {
8575
8660
  const obj = objectLiteralOf(arg, resolution);
@@ -8580,7 +8665,7 @@ function readPropertyAsFunction(arg, prop, resolution) {
8580
8665
  if (propertyName(property) !== prop) {
8581
8666
  continue;
8582
8667
  }
8583
- if (import_ts_morph36.Node.isMethodDeclaration(property)) {
8668
+ if (import_ts_morph37.Node.isMethodDeclaration(property)) {
8584
8669
  return { func: property, name: prop };
8585
8670
  }
8586
8671
  const held = propertyValueOf(property);
@@ -8588,19 +8673,19 @@ function readPropertyAsFunction(arg, prop, resolution) {
8588
8673
  return null;
8589
8674
  }
8590
8675
  const func = functionValueOf(held, resolution);
8591
- return func === null ? null : { func, name: import_ts_morph36.Node.isIdentifier(held) ? held.getText() : prop };
8676
+ return func === null ? null : { func, name: import_ts_morph37.Node.isIdentifier(held) ? held.getText() : prop };
8592
8677
  }
8593
8678
  return null;
8594
8679
  }
8595
8680
  function propertyName(property) {
8596
- if (import_ts_morph36.Node.isPropertyAssignment(property) || import_ts_morph36.Node.isShorthandPropertyAssignment(property) || import_ts_morph36.Node.isMethodDeclaration(property)) {
8681
+ if (import_ts_morph37.Node.isPropertyAssignment(property) || import_ts_morph37.Node.isShorthandPropertyAssignment(property) || import_ts_morph37.Node.isMethodDeclaration(property)) {
8597
8682
  return property.getName();
8598
8683
  }
8599
8684
  return null;
8600
8685
  }
8601
8686
 
8602
8687
  // src/discovery/resolverMap.ts
8603
- var import_ts_morph37 = require("ts-morph");
8688
+ var import_ts_morph38 = require("ts-morph");
8604
8689
  function discoverResolverMaps(sourceFile, match, kind, resolution) {
8605
8690
  const store = resolution ?? new ResolutionStore();
8606
8691
  const mapProperty = match.mapProperty;
@@ -8611,7 +8696,7 @@ function discoverResolverMaps(sourceFile, match, kind, resolution) {
8611
8696
  name: match.importName
8612
8697
  })) {
8613
8698
  const args = node.getArguments();
8614
- if (args.length === 0 || !import_ts_morph37.Node.isObjectLiteralExpression(args[0])) {
8699
+ if (args.length === 0 || !import_ts_morph38.Node.isObjectLiteralExpression(args[0])) {
8615
8700
  continue;
8616
8701
  }
8617
8702
  const config = args[0];
@@ -8665,7 +8750,7 @@ function resolverMapObject(prop, resolution) {
8665
8750
  return held === null ? null : objectLiteralOf(held, resolution);
8666
8751
  }
8667
8752
  function extractTypeDefsSdl(config, resolution) {
8668
- if (!import_ts_morph37.Node.isObjectLiteralExpression(config)) {
8753
+ if (!import_ts_morph38.Node.isObjectLiteralExpression(config)) {
8669
8754
  return null;
8670
8755
  }
8671
8756
  const prop = config.getProperty("typeDefs");
@@ -8687,15 +8772,15 @@ function schemaSdlOf(expr, resolution) {
8687
8772
  return resolved === null ? null : writtenSdl(resolved);
8688
8773
  }
8689
8774
  function writtenSdl(expr) {
8690
- if (import_ts_morph37.Node.isStringLiteral(expr) || import_ts_morph37.Node.isNoSubstitutionTemplateLiteral(expr)) {
8775
+ if (import_ts_morph38.Node.isStringLiteral(expr) || import_ts_morph38.Node.isNoSubstitutionTemplateLiteral(expr)) {
8691
8776
  const value = expr.getLiteralValue();
8692
8777
  return value === "" ? null : value;
8693
8778
  }
8694
- if (import_ts_morph37.Node.isTaggedTemplateExpression(expr)) {
8779
+ if (import_ts_morph38.Node.isTaggedTemplateExpression(expr)) {
8695
8780
  const tag = expr.getTag();
8696
- if (import_ts_morph37.Node.isIdentifier(tag) && tag.getText() === "gql") {
8781
+ if (import_ts_morph38.Node.isIdentifier(tag) && tag.getText() === "gql") {
8697
8782
  const template = expr.getTemplate();
8698
- if (import_ts_morph37.Node.isNoSubstitutionTemplateLiteral(template)) {
8783
+ if (import_ts_morph38.Node.isNoSubstitutionTemplateLiteral(template)) {
8699
8784
  return template.getLiteralValue();
8700
8785
  }
8701
8786
  }
@@ -8704,7 +8789,7 @@ function writtenSdl(expr) {
8704
8789
  }
8705
8790
 
8706
8791
  // src/discovery/index.ts
8707
- function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElsewhere) {
8792
+ function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElsewhere, routeWrapperPattern) {
8708
8793
  if (pattern.match.type === "namedExport") {
8709
8794
  return discoverNamedExports(
8710
8795
  sourceFile,
@@ -8721,7 +8806,8 @@ function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElse
8721
8806
  pattern.bindingExtraction,
8722
8807
  resolution,
8723
8808
  mountPrefixes,
8724
- expandedElsewhere
8809
+ expandedElsewhere,
8810
+ routeWrapperPattern
8725
8811
  );
8726
8812
  }
8727
8813
  if (pattern.match.type === "registrationTemplate") {
@@ -8827,19 +8913,26 @@ function runPattern(sourceFile, pattern, resolution, mountPrefixes, expandedElse
8827
8913
  }
8828
8914
  return [];
8829
8915
  }
8916
+ function routeWrapperPatternOf(patterns) {
8917
+ return patterns.find(
8918
+ (pattern) => pattern.wraps !== void 0 && "method" in pattern.wraps && pattern.wraps.continuationParam !== void 0 && pattern.wraps.throwParam === void 0 && pattern.wraps.arity === void 0 && pattern.wraps.scopePosition === void 0
8919
+ );
8920
+ }
8830
8921
  function discoverUnits(sourceFile, patterns, resolution, mountPrefixes, expandedElsewhere) {
8831
8922
  const store = resolution ?? new ResolutionStore();
8832
8923
  const allResults = [];
8924
+ const routeWrapperPattern = routeWrapperPatternOf(patterns);
8833
8925
  for (const pattern of patterns) {
8834
8926
  const found = runPattern(
8835
8927
  sourceFile,
8836
8928
  pattern,
8837
8929
  store,
8838
8930
  mountPrefixes,
8839
- expandedElsewhere
8931
+ expandedElsewhere,
8932
+ routeWrapperPattern
8840
8933
  );
8841
8934
  for (const unit of found) {
8842
- unit.pattern = pattern;
8935
+ unit.pattern ??= pattern;
8843
8936
  }
8844
8937
  allResults.push(...found);
8845
8938
  }
@@ -8858,7 +8951,7 @@ function discoverUnits(sourceFile, patterns, resolution, mountPrefixes, expanded
8858
8951
  // src/resolve/functionBehind.ts
8859
8952
  function symbolBehind(node) {
8860
8953
  const parent = node.getParent();
8861
- if (parent !== void 0 && import_ts_morph38.Node.isShorthandPropertyAssignment(parent)) {
8954
+ if (parent !== void 0 && import_ts_morph39.Node.isShorthandPropertyAssignment(parent)) {
8862
8955
  return parent.getValueSymbol();
8863
8956
  }
8864
8957
  return node.getSymbol();
@@ -8888,9 +8981,9 @@ function resolveDecl(decl, calleeName) {
8888
8981
  }
8889
8982
  return { func: fn, name: declName(decl) ?? calleeName };
8890
8983
  }
8891
- if (import_ts_morph38.Node.isVariableDeclaration(decl)) {
8984
+ if (import_ts_morph39.Node.isVariableDeclaration(decl)) {
8892
8985
  const init = decl.getInitializer();
8893
- if (init !== void 0 && (import_ts_morph38.Node.isArrowFunction(init) || import_ts_morph38.Node.isFunctionExpression(init))) {
8986
+ if (init !== void 0 && (import_ts_morph39.Node.isArrowFunction(init) || import_ts_morph39.Node.isFunctionExpression(init))) {
8894
8987
  return { func: init, name: decl.getName() };
8895
8988
  }
8896
8989
  return null;
@@ -8898,20 +8991,20 @@ function resolveDecl(decl, calleeName) {
8898
8991
  return null;
8899
8992
  }
8900
8993
  function declName(decl) {
8901
- if (import_ts_morph38.Node.isFunctionDeclaration(decl) || import_ts_morph38.Node.isMethodDeclaration(decl)) {
8994
+ if (import_ts_morph39.Node.isFunctionDeclaration(decl) || import_ts_morph39.Node.isMethodDeclaration(decl)) {
8902
8995
  const n = decl.getName?.();
8903
8996
  if (typeof n === "string" && n.length > 0) {
8904
8997
  return n;
8905
8998
  }
8906
8999
  }
8907
- if (import_ts_morph38.Node.isFunctionExpression(decl)) {
9000
+ if (import_ts_morph39.Node.isFunctionExpression(decl)) {
8908
9001
  const n = decl.getName();
8909
9002
  if (typeof n === "string" && n.length > 0) {
8910
9003
  return n;
8911
9004
  }
8912
9005
  }
8913
9006
  const parent = decl.getParent();
8914
- if (parent !== void 0 && import_ts_morph38.Node.isVariableDeclaration(parent)) {
9007
+ if (parent !== void 0 && import_ts_morph39.Node.isVariableDeclaration(parent)) {
8915
9008
  return parent.getName();
8916
9009
  }
8917
9010
  return null;
@@ -8923,14 +9016,14 @@ function pathAbove(reference) {
8923
9016
  let current2 = reference;
8924
9017
  for (; ; ) {
8925
9018
  const parent = current2.getParent();
8926
- if (parent !== void 0 && import_ts_morph39.Node.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
9019
+ if (parent !== void 0 && import_ts_morph40.Node.isPropertyAccessExpression(parent) && parent.getExpression() === current2) {
8927
9020
  path15.push(parent.getName());
8928
9021
  current2 = parent;
8929
9022
  continue;
8930
9023
  }
8931
- if (parent !== void 0 && import_ts_morph39.Node.isElementAccessExpression(parent) && parent.getExpression() === current2) {
9024
+ if (parent !== void 0 && import_ts_morph40.Node.isElementAccessExpression(parent) && parent.getExpression() === current2) {
8932
9025
  const argument = parent.getArgumentExpression();
8933
- if (argument !== void 0 && import_ts_morph39.Node.isStringLiteral(argument)) {
9026
+ if (argument !== void 0 && import_ts_morph40.Node.isStringLiteral(argument)) {
8934
9027
  path15.push(argument.getLiteralValue());
8935
9028
  current2 = parent;
8936
9029
  continue;
@@ -8940,11 +9033,11 @@ function pathAbove(reference) {
8940
9033
  }
8941
9034
  }
8942
9035
  function declaresParameterOf(node, func) {
8943
- if (import_ts_morph39.Node.isParameterDeclaration(node)) {
9036
+ if (import_ts_morph40.Node.isParameterDeclaration(node)) {
8944
9037
  return node.getParent() === func;
8945
9038
  }
8946
- if (import_ts_morph39.Node.isBindingElement(node)) {
8947
- const parameter = node.getFirstAncestor(import_ts_morph39.Node.isParameterDeclaration);
9039
+ if (import_ts_morph40.Node.isBindingElement(node)) {
9040
+ const parameter = node.getFirstAncestor(import_ts_morph40.Node.isParameterDeclaration);
8948
9041
  return parameter !== void 0 && parameter.getParent() === func;
8949
9042
  }
8950
9043
  return false;
@@ -8960,7 +9053,7 @@ function parameterReads(func, parameterNames2, barriers = NO_BARRIERS) {
8960
9053
  traversal.skip();
8961
9054
  return;
8962
9055
  }
8963
- if (!import_ts_morph39.Node.isIdentifier(node) || !wanted.has(node.getText())) {
9056
+ if (!import_ts_morph40.Node.isIdentifier(node) || !wanted.has(node.getText())) {
8964
9057
  return;
8965
9058
  }
8966
9059
  const declarations = symbolBehind(node)?.getDeclarations() ?? [];
@@ -8983,7 +9076,7 @@ function parameterReads(func, parameterNames2, barriers = NO_BARRIERS) {
8983
9076
  }
8984
9077
 
8985
9078
  // src/resolve/readName.ts
8986
- var import_ts_morph40 = require("ts-morph");
9079
+ var import_ts_morph41 = require("ts-morph");
8987
9080
  var import_behavioral_ir3 = require("@suss/behavioral-ir");
8988
9081
  var MAX_HELPER_HOPS = 2;
8989
9082
  var UNNAMED_HOLE = "param";
@@ -9018,11 +9111,11 @@ function referenceIn(expr) {
9018
9111
  function parameterPath(expr) {
9019
9112
  const fields = [];
9020
9113
  let step = expr;
9021
- while (import_ts_morph40.Node.isPropertyAccessExpression(step)) {
9114
+ while (import_ts_morph41.Node.isPropertyAccessExpression(step)) {
9022
9115
  fields.unshift(step.getName());
9023
9116
  step = step.getExpression();
9024
9117
  }
9025
- if (!import_ts_morph40.Node.isIdentifier(step) || !isParameter(step)) {
9118
+ if (!import_ts_morph41.Node.isIdentifier(step) || !isParameter(step)) {
9026
9119
  return null;
9027
9120
  }
9028
9121
  return { root: step.getText(), fields };
@@ -9030,7 +9123,7 @@ function parameterPath(expr) {
9030
9123
  function isParameter(identifier) {
9031
9124
  const declarations = identifier.getSymbol()?.getDeclarations() ?? [];
9032
9125
  return declarations.some(
9033
- (declaration) => import_ts_morph40.Node.isParameterDeclaration(declaration)
9126
+ (declaration) => import_ts_morph41.Node.isParameterDeclaration(declaration)
9034
9127
  );
9035
9128
  }
9036
9129
  function read(expr, ctx) {
@@ -9039,25 +9132,25 @@ function read(expr, ctx) {
9039
9132
  }
9040
9133
  const seen = new Set(ctx.seen).add(expr);
9041
9134
  const inner = { ...ctx, seen };
9042
- if (import_ts_morph40.Node.isStringLiteral(expr) || import_ts_morph40.Node.isNoSubstitutionTemplateLiteral(expr)) {
9135
+ if (import_ts_morph41.Node.isStringLiteral(expr) || import_ts_morph41.Node.isNoSubstitutionTemplateLiteral(expr)) {
9043
9136
  return expr.getLiteralValue();
9044
9137
  }
9045
- if (import_ts_morph40.Node.isNumericLiteral(expr)) {
9138
+ if (import_ts_morph41.Node.isNumericLiteral(expr)) {
9046
9139
  return expr.getLiteralText();
9047
9140
  }
9048
- if (import_ts_morph40.Node.isTemplateExpression(expr)) {
9141
+ if (import_ts_morph41.Node.isTemplateExpression(expr)) {
9049
9142
  return fromTemplate(expr, inner);
9050
9143
  }
9051
- if (import_ts_morph40.Node.isParenthesizedExpression(expr)) {
9144
+ if (import_ts_morph41.Node.isParenthesizedExpression(expr)) {
9052
9145
  return read(peelParens(expr), inner);
9053
9146
  }
9054
- if (import_ts_morph40.Node.isBinaryExpression(expr)) {
9147
+ if (import_ts_morph41.Node.isBinaryExpression(expr)) {
9055
9148
  return fromBinary(expr, inner);
9056
9149
  }
9057
- if (import_ts_morph40.Node.isCallExpression(expr)) {
9150
+ if (import_ts_morph41.Node.isCallExpression(expr)) {
9058
9151
  return fromCall(expr, inner);
9059
9152
  }
9060
- if (import_ts_morph40.Node.isIdentifier(expr)) {
9153
+ if (import_ts_morph41.Node.isIdentifier(expr)) {
9061
9154
  const only = boundOnce(expr, ctx);
9062
9155
  if (only !== null) {
9063
9156
  return read(only.node, { ...inner, bindings: only.scope });
@@ -9077,17 +9170,17 @@ function read(expr, ctx) {
9077
9170
  }
9078
9171
  function isFallbackBranch(node) {
9079
9172
  let step = node.getParent();
9080
- while (step !== void 0 && import_ts_morph40.Node.isParenthesizedExpression(step)) {
9173
+ while (step !== void 0 && import_ts_morph41.Node.isParenthesizedExpression(step)) {
9081
9174
  step = step.getParent();
9082
9175
  }
9083
- if (step === void 0 || !import_ts_morph40.Node.isBinaryExpression(step)) {
9176
+ if (step === void 0 || !import_ts_morph41.Node.isBinaryExpression(step)) {
9084
9177
  return false;
9085
9178
  }
9086
9179
  const operator = step.getOperatorToken().getKind();
9087
- return operator === import_ts_morph40.SyntaxKind.BarBarToken || operator === import_ts_morph40.SyntaxKind.QuestionQuestionToken;
9180
+ return operator === import_ts_morph41.SyntaxKind.BarBarToken || operator === import_ts_morph41.SyntaxKind.QuestionQuestionToken;
9088
9181
  }
9089
9182
  function fromTemplate(expr, ctx) {
9090
- if (!import_ts_morph40.Node.isTemplateExpression(expr)) {
9183
+ if (!import_ts_morph41.Node.isTemplateExpression(expr)) {
9091
9184
  return null;
9092
9185
  }
9093
9186
  let name = expr.getHead().getLiteralText();
@@ -9098,28 +9191,28 @@ function fromTemplate(expr, ctx) {
9098
9191
  return name;
9099
9192
  }
9100
9193
  function fromBinary(expr, ctx) {
9101
- if (!import_ts_morph40.Node.isBinaryExpression(expr)) {
9194
+ if (!import_ts_morph41.Node.isBinaryExpression(expr)) {
9102
9195
  return null;
9103
9196
  }
9104
9197
  const operator = expr.getOperatorToken().getKind();
9105
- if (operator === import_ts_morph40.SyntaxKind.BarBarToken || operator === import_ts_morph40.SyntaxKind.QuestionQuestionToken) {
9198
+ if (operator === import_ts_morph41.SyntaxKind.BarBarToken || operator === import_ts_morph41.SyntaxKind.QuestionQuestionToken) {
9106
9199
  return ctx.insideHole ? null : read(expr.getRight(), ctx);
9107
9200
  }
9108
- if (operator !== import_ts_morph40.SyntaxKind.PlusToken) {
9201
+ if (operator !== import_ts_morph41.SyntaxKind.PlusToken) {
9109
9202
  return null;
9110
9203
  }
9111
9204
  const parts = { ...ctx, insideHole: true };
9112
9205
  return readOrHole(expr.getLeft(), parts) + readOrHole(expr.getRight(), parts);
9113
9206
  }
9114
9207
  function fromCall(expr, ctx) {
9115
- if (!import_ts_morph40.Node.isCallExpression(expr)) {
9208
+ if (!import_ts_morph41.Node.isCallExpression(expr)) {
9116
9209
  return null;
9117
9210
  }
9118
9211
  const callee = expr.getExpression();
9119
- if (import_ts_morph40.Node.isPropertyAccessExpression(callee) && callee.getName() === "join") {
9212
+ if (import_ts_morph41.Node.isPropertyAccessExpression(callee) && callee.getName() === "join") {
9120
9213
  return fromJoin(callee.getExpression(), expr.getArguments(), ctx);
9121
9214
  }
9122
- if (import_ts_morph40.Node.isIdentifier(callee) && callee.getText() === "String") {
9215
+ if (import_ts_morph41.Node.isIdentifier(callee) && callee.getText() === "String") {
9123
9216
  const only = expr.getArguments()[0];
9124
9217
  return only === void 0 ? null : readOrHole(only, ctx);
9125
9218
  }
@@ -9138,7 +9231,7 @@ function fromCall(expr, ctx) {
9138
9231
  }
9139
9232
  function fromJoin(subject, args, ctx) {
9140
9233
  const separator = args[0];
9141
- if (separator === void 0 || !import_ts_morph40.Node.isStringLiteral(separator)) {
9234
+ if (separator === void 0 || !import_ts_morph41.Node.isStringLiteral(separator)) {
9142
9235
  return null;
9143
9236
  }
9144
9237
  const parts = elementsOf(subject, ctx);
@@ -9154,17 +9247,17 @@ function fromJoin(subject, args, ctx) {
9154
9247
  ).join(separator.getLiteralValue());
9155
9248
  }
9156
9249
  function elementsOf(subject, ctx) {
9157
- if (import_ts_morph40.Node.isArrayLiteralExpression(subject)) {
9250
+ if (import_ts_morph41.Node.isArrayLiteralExpression(subject)) {
9158
9251
  return subject.getElements().map((element) => here(element, ctx));
9159
9252
  }
9160
- if (import_ts_morph40.Node.isCallExpression(subject)) {
9253
+ if (import_ts_morph41.Node.isCallExpression(subject)) {
9161
9254
  const callee = subject.getExpression();
9162
- if (import_ts_morph40.Node.isPropertyAccessExpression(callee) && callee.getName() === "map") {
9255
+ if (import_ts_morph41.Node.isPropertyAccessExpression(callee) && callee.getName() === "map") {
9163
9256
  return elementsOf(callee.getExpression(), ctx);
9164
9257
  }
9165
9258
  return null;
9166
9259
  }
9167
- if (!import_ts_morph40.Node.isIdentifier(subject)) {
9260
+ if (!import_ts_morph41.Node.isIdentifier(subject)) {
9168
9261
  return null;
9169
9262
  }
9170
9263
  const bound = ctx.bindings.get(subject.getText());
@@ -9172,7 +9265,7 @@ function elementsOf(subject, ctx) {
9172
9265
  return null;
9173
9266
  }
9174
9267
  const only = bound.length === 1 ? bound[0] : void 0;
9175
- return only !== void 0 && import_ts_morph40.Node.isArrayLiteralExpression(only.node) ? only.node.getElements().map((element) => here(element, ctx)) : bound;
9268
+ return only !== void 0 && import_ts_morph41.Node.isArrayLiteralExpression(only.node) ? only.node.getElements().map((element) => here(element, ctx)) : bound;
9176
9269
  }
9177
9270
  function singleReturnBody(callee, ctx) {
9178
9271
  const declaration = declarationOf2(callee, ctx);
@@ -9187,22 +9280,22 @@ function singleReturnBody(callee, ctx) {
9187
9280
  if (body === void 0) {
9188
9281
  return null;
9189
9282
  }
9190
- if (import_ts_morph40.Node.isExpression(body)) {
9283
+ if (import_ts_morph41.Node.isExpression(body)) {
9191
9284
  return { parameters, returned: body };
9192
9285
  }
9193
- if (!import_ts_morph40.Node.isBlock(body)) {
9286
+ if (!import_ts_morph41.Node.isBlock(body)) {
9194
9287
  return null;
9195
9288
  }
9196
9289
  const statements = body.getStatements();
9197
9290
  const only = statements[0];
9198
- if (statements.length !== 1 || only === void 0 || !import_ts_morph40.Node.isReturnStatement(only)) {
9291
+ if (statements.length !== 1 || only === void 0 || !import_ts_morph41.Node.isReturnStatement(only)) {
9199
9292
  return null;
9200
9293
  }
9201
9294
  const returned = only.getExpression();
9202
9295
  return returned === void 0 ? null : { parameters, returned };
9203
9296
  }
9204
9297
  function declarationOf2(callee, ctx) {
9205
- const symbol = import_ts_morph40.Node.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : callee.getSymbol();
9298
+ const symbol = import_ts_morph41.Node.isPropertyAccessExpression(callee) ? callee.getNameNode().getSymbol() : callee.getSymbol();
9206
9299
  const declarations = symbol?.getAliasedSymbol()?.getDeclarations() ?? symbol?.getDeclarations() ?? [];
9207
9300
  for (const declaration of declarations) {
9208
9301
  const callable = asCallable(declaration);
@@ -9214,14 +9307,14 @@ function declarationOf2(callee, ctx) {
9214
9307
  return written === null || written === callee ? null : declarationOf2(written, { ...ctx, resolve: () => null });
9215
9308
  }
9216
9309
  function asCallable(declaration) {
9217
- if (import_ts_morph40.Node.isFunctionDeclaration(declaration) || import_ts_morph40.Node.isMethodDeclaration(declaration) || import_ts_morph40.Node.isArrowFunction(declaration) || import_ts_morph40.Node.isFunctionExpression(declaration)) {
9310
+ if (import_ts_morph41.Node.isFunctionDeclaration(declaration) || import_ts_morph41.Node.isMethodDeclaration(declaration) || import_ts_morph41.Node.isArrowFunction(declaration) || import_ts_morph41.Node.isFunctionExpression(declaration)) {
9218
9311
  return declaration;
9219
9312
  }
9220
- if (!import_ts_morph40.Node.isVariableDeclaration(declaration)) {
9313
+ if (!import_ts_morph41.Node.isVariableDeclaration(declaration)) {
9221
9314
  return null;
9222
9315
  }
9223
9316
  const initializer = declaration.getInitializer();
9224
- if (initializer !== void 0 && (import_ts_morph40.Node.isArrowFunction(initializer) || import_ts_morph40.Node.isFunctionExpression(initializer))) {
9317
+ if (initializer !== void 0 && (import_ts_morph41.Node.isArrowFunction(initializer) || import_ts_morph41.Node.isFunctionExpression(initializer))) {
9225
9318
  return initializer;
9226
9319
  }
9227
9320
  return null;
@@ -9243,7 +9336,7 @@ function here(node, ctx) {
9243
9336
  return { node, scope: ctx.bindings };
9244
9337
  }
9245
9338
  function boundOnce(expr, ctx) {
9246
- const bound = import_ts_morph40.Node.isIdentifier(expr) ? ctx.bindings.get(expr.getText()) : void 0;
9339
+ const bound = import_ts_morph41.Node.isIdentifier(expr) ? ctx.bindings.get(expr.getText()) : void 0;
9247
9340
  return bound !== void 0 && bound.length === 1 ? bound[0] : null;
9248
9341
  }
9249
9342
  function readOrHole(expr, ctx) {
@@ -9255,10 +9348,10 @@ function holeName(expr, ctx) {
9255
9348
  if (bound !== null) {
9256
9349
  return holeName(bound.node, { ...ctx, bindings: bound.scope });
9257
9350
  }
9258
- if (import_ts_morph40.Node.isIdentifier(expr)) {
9351
+ if (import_ts_morph41.Node.isIdentifier(expr)) {
9259
9352
  return expr.getText();
9260
9353
  }
9261
- if (import_ts_morph40.Node.isPropertyAccessExpression(expr)) {
9354
+ if (import_ts_morph41.Node.isPropertyAccessExpression(expr)) {
9262
9355
  return expr.getName();
9263
9356
  }
9264
9357
  return UNNAMED_HOLE;
@@ -9285,8 +9378,8 @@ function madeFromNamed(origin, made) {
9285
9378
  return origin.named.includes(constructorName(made));
9286
9379
  }
9287
9380
  function constructorName(made) {
9288
- const expression = import_ts_morph41.Node.isNewExpression(made) || import_ts_morph41.Node.isCallExpression(made) ? made.getExpression() : made;
9289
- return import_ts_morph41.Node.isPropertyAccessExpression(expression) ? expression.getName() : expression.getText();
9381
+ const expression = import_ts_morph42.Node.isNewExpression(made) || import_ts_morph42.Node.isCallExpression(made) ? made.getExpression() : made;
9382
+ return import_ts_morph42.Node.isPropertyAccessExpression(expression) ? expression.getName() : expression.getText();
9290
9383
  }
9291
9384
  var CALL_ORIGIN = {
9292
9385
  declaredBy: ORIGIN.declaredBy,
@@ -9300,7 +9393,7 @@ var CALL_ORIGIN = {
9300
9393
  };
9301
9394
  function madeBy(receiver) {
9302
9395
  const made = madeExpression(receiver);
9303
- const expression = import_ts_morph41.Node.isNewExpression(made) || import_ts_morph41.Node.isCallExpression(made) ? made.getExpression() : made;
9396
+ const expression = import_ts_morph42.Node.isNewExpression(made) || import_ts_morph42.Node.isCallExpression(made) ? made.getExpression() : made;
9304
9397
  return rootIdentifier(expression) ?? expression;
9305
9398
  }
9306
9399
  function madeExpression(receiver) {
@@ -9308,7 +9401,7 @@ function madeExpression(receiver) {
9308
9401
  return receiver.expression;
9309
9402
  }
9310
9403
  const written = receiver.resolve(receiver.callee.getExpression());
9311
- if (written === null || !import_ts_morph41.Node.isNewExpression(written) && !import_ts_morph41.Node.isCallExpression(written)) {
9404
+ if (written === null || !import_ts_morph42.Node.isNewExpression(written) && !import_ts_morph42.Node.isCallExpression(written)) {
9312
9405
  return receiver.callee;
9313
9406
  }
9314
9407
  return written;
@@ -9316,7 +9409,7 @@ function madeExpression(receiver) {
9316
9409
  function callOpsFor(call, resolveWrittenValue, originatesFrom, anchorCallsOf) {
9317
9410
  const resolve2 = resolveWrittenValue ?? (() => null);
9318
9411
  const expression = calleeOf3(call);
9319
- const callee = import_ts_morph41.Node.isPropertyAccessExpression(expression) ? expression : null;
9412
+ const callee = import_ts_morph42.Node.isPropertyAccessExpression(expression) ? expression : null;
9320
9413
  let args = null;
9321
9414
  const argumentsOf = () => {
9322
9415
  args ??= argumentsIn(call);
@@ -9339,7 +9432,7 @@ function callOpsFor(call, resolveWrittenValue, originatesFrom, anchorCallsOf) {
9339
9432
  argumentCount: () => argumentsOf().length,
9340
9433
  nameAt: (index, unsettled) => nameAt(argumentsOf()[index], unsettled, resolve2),
9341
9434
  calleeText: () => expression.getText(),
9342
- namedCallee: () => import_ts_morph41.Node.isIdentifier(expression),
9435
+ namedCallee: () => import_ts_morph42.Node.isIdentifier(expression),
9343
9436
  parameterReadsAt: (index) => selectorReadsOf(argumentsOf()[index]),
9344
9437
  receiver: () => callee === null ? null : opsOverCall(callee.getExpression(), resolve2),
9345
9438
  argument: (index) => opsOverCall(argumentsOf()[index], resolve2),
@@ -9364,7 +9457,7 @@ function anchorCallBehind(subject, origin, resolve2, originatesFrom, anchorCalls
9364
9457
  return null;
9365
9458
  }
9366
9459
  const found = anchorCallsOf(subject, (candidate) => {
9367
- if (!import_ts_morph41.Node.isCallExpression(candidate) && !import_ts_morph41.Node.isNewExpression(candidate)) {
9460
+ if (!import_ts_morph42.Node.isCallExpression(candidate) && !import_ts_morph42.Node.isNewExpression(candidate)) {
9368
9461
  return false;
9369
9462
  }
9370
9463
  const candidateCallee = calleeOf3(candidate);
@@ -9379,7 +9472,7 @@ function anchorCallBehind(subject, origin, resolve2, originatesFrom, anchorCalls
9379
9472
  if (distinct.length !== 1 || only === void 0) {
9380
9473
  return null;
9381
9474
  }
9382
- if (!import_ts_morph41.Node.isCallExpression(only) && !import_ts_morph41.Node.isNewExpression(only)) {
9475
+ if (!import_ts_morph42.Node.isCallExpression(only) && !import_ts_morph42.Node.isNewExpression(only)) {
9383
9476
  return null;
9384
9477
  }
9385
9478
  return callOpsFor(only, resolve2, originatesFrom, anchorCallsOf);
@@ -9399,7 +9492,7 @@ function valueOpsFor(value, resolve2) {
9399
9492
  asArg: () => effectArgOf(written()),
9400
9493
  property: (name) => {
9401
9494
  const object = written();
9402
- const inside = import_ts_morph41.Node.isObjectLiteralExpression(object) ? initializerOf(object, name) : null;
9495
+ const inside = import_ts_morph42.Node.isObjectLiteralExpression(object) ? initializerOf(object, name) : null;
9403
9496
  return inside === null ? null : valueOpsFor(inside, resolve2);
9404
9497
  },
9405
9498
  parts: () => literalParts(written()),
@@ -9412,7 +9505,7 @@ function literalParts(value) {
9412
9505
  if (whole !== null) {
9413
9506
  return [whole];
9414
9507
  }
9415
- if (!import_ts_morph41.Node.isTemplateExpression(written)) {
9508
+ if (!import_ts_morph42.Node.isTemplateExpression(written)) {
9416
9509
  return null;
9417
9510
  }
9418
9511
  return [
@@ -9422,26 +9515,26 @@ function literalParts(value) {
9422
9515
  }
9423
9516
  function templateHoles(value, resolve2) {
9424
9517
  const written = untagged(value);
9425
- if (!import_ts_morph41.Node.isTemplateExpression(written)) {
9518
+ if (!import_ts_morph42.Node.isTemplateExpression(written)) {
9426
9519
  return [];
9427
9520
  }
9428
9521
  return written.getTemplateSpans().map((span) => opsOverCall(span.getExpression(), resolve2));
9429
9522
  }
9430
9523
  function untagged(value) {
9431
- return import_ts_morph41.Node.isTaggedTemplateExpression(value) ? value.getTemplate() : value;
9524
+ return import_ts_morph42.Node.isTaggedTemplateExpression(value) ? value.getTemplate() : value;
9432
9525
  }
9433
9526
  function entriesOf(value, unsettled, resolve2) {
9434
- if (!import_ts_morph41.Node.isObjectLiteralExpression(value)) {
9527
+ if (!import_ts_morph42.Node.isObjectLiteralExpression(value)) {
9435
9528
  return [];
9436
9529
  }
9437
9530
  const found = [];
9438
9531
  for (const written of value.getProperties()) {
9439
- if (import_ts_morph41.Node.isShorthandPropertyAssignment(written)) {
9532
+ if (import_ts_morph42.Node.isShorthandPropertyAssignment(written)) {
9440
9533
  const name = written.getNameNode();
9441
9534
  found.push({ key: name.getText(), value: valueOpsFor(name, resolve2) });
9442
9535
  continue;
9443
9536
  }
9444
- if (!import_ts_morph41.Node.isPropertyAssignment(written)) {
9537
+ if (!import_ts_morph42.Node.isPropertyAssignment(written)) {
9445
9538
  continue;
9446
9539
  }
9447
9540
  const stated = written.getInitializer();
@@ -9454,35 +9547,35 @@ function entriesOf(value, unsettled, resolve2) {
9454
9547
  }
9455
9548
  function entryKey(written, unsettled, resolve2) {
9456
9549
  const name = written.getNameNode();
9457
- if (import_ts_morph41.Node.isComputedPropertyName(name)) {
9550
+ if (import_ts_morph42.Node.isComputedPropertyName(name)) {
9458
9551
  return readName(name.getExpression(), { resolve: resolve2, unsettled });
9459
9552
  }
9460
9553
  return unquoted(written.getName());
9461
9554
  }
9462
9555
  function itemsOf(value, resolve2) {
9463
- if (!import_ts_morph41.Node.isArrayLiteralExpression(value)) {
9556
+ if (!import_ts_morph42.Node.isArrayLiteralExpression(value)) {
9464
9557
  return [];
9465
9558
  }
9466
9559
  return value.getElements().map((element) => valueOpsFor(element, resolve2));
9467
9560
  }
9468
9561
  function literalText(value) {
9469
- return import_ts_morph41.Node.isStringLiteral(value) || import_ts_morph41.Node.isNoSubstitutionTemplateLiteral(value) ? value.getLiteralValue() : null;
9562
+ return import_ts_morph42.Node.isStringLiteral(value) || import_ts_morph42.Node.isNoSubstitutionTemplateLiteral(value) ? value.getLiteralValue() : null;
9470
9563
  }
9471
9564
  function literalFlag(value) {
9472
- if (import_ts_morph41.Node.isTrueLiteral(value) || import_ts_morph41.Node.isFalseLiteral(value)) {
9473
- return import_ts_morph41.Node.isTrueLiteral(value);
9565
+ if (import_ts_morph42.Node.isTrueLiteral(value) || import_ts_morph42.Node.isFalseLiteral(value)) {
9566
+ return import_ts_morph42.Node.isTrueLiteral(value);
9474
9567
  }
9475
- return import_ts_morph41.Node.isNumericLiteral(value) ? value.getLiteralValue() !== 0 : null;
9568
+ return import_ts_morph42.Node.isNumericLiteral(value) ? value.getLiteralValue() !== 0 : null;
9476
9569
  }
9477
9570
  function unquoted(name) {
9478
9571
  return name.replace(/^["']|["']$/g, "");
9479
9572
  }
9480
9573
  function selectorReadsOf(argument) {
9481
- if (argument === void 0 || !import_ts_morph41.Node.isArrowFunction(argument) && !import_ts_morph41.Node.isFunctionExpression(argument)) {
9574
+ if (argument === void 0 || !import_ts_morph42.Node.isArrowFunction(argument) && !import_ts_morph42.Node.isFunctionExpression(argument)) {
9482
9575
  return null;
9483
9576
  }
9484
9577
  const parameter = argument.getParameters()[0];
9485
- if (parameter === void 0 || !import_ts_morph41.Node.isIdentifier(parameter.getNameNode())) {
9578
+ if (parameter === void 0 || !import_ts_morph42.Node.isIdentifier(parameter.getNameNode())) {
9486
9579
  return null;
9487
9580
  }
9488
9581
  const names = /* @__PURE__ */ new Set();
@@ -9499,17 +9592,17 @@ function opsOverCall(value, resolve2) {
9499
9592
  return callOpsFor(written, resolve2);
9500
9593
  }
9501
9594
  function isCalled(value) {
9502
- return import_ts_morph41.Node.isCallExpression(value) || import_ts_morph41.Node.isNewExpression(value) || import_ts_morph41.Node.isTaggedTemplateExpression(value);
9595
+ return import_ts_morph42.Node.isCallExpression(value) || import_ts_morph42.Node.isNewExpression(value) || import_ts_morph42.Node.isTaggedTemplateExpression(value);
9503
9596
  }
9504
9597
  function calleeOf3(call) {
9505
- return import_ts_morph41.Node.isTaggedTemplateExpression(call) ? call.getTag() : call.getExpression();
9598
+ return import_ts_morph42.Node.isTaggedTemplateExpression(call) ? call.getTag() : call.getExpression();
9506
9599
  }
9507
9600
  function argumentsIn(call) {
9508
- return import_ts_morph41.Node.isTaggedTemplateExpression(call) ? [call.getTemplate()] : call.getArguments();
9601
+ return import_ts_morph42.Node.isTaggedTemplateExpression(call) ? [call.getTemplate()] : call.getArguments();
9509
9602
  }
9510
9603
  function settled(value, resolve2) {
9511
9604
  const step = unwrapped(value ?? null);
9512
- if (step === null || !import_ts_morph41.Node.isIdentifier(step)) {
9605
+ if (step === null || !import_ts_morph42.Node.isIdentifier(step)) {
9513
9606
  return step;
9514
9607
  }
9515
9608
  return unwrapped(resolve2(step));
@@ -9536,11 +9629,11 @@ function objectAt(argument, resolve2) {
9536
9629
  if (isCalled(written)) {
9537
9630
  return objectAt(argumentsIn(written)[0], resolve2);
9538
9631
  }
9539
- return import_ts_morph41.Node.isObjectLiteralExpression(written) ? written : null;
9632
+ return import_ts_morph42.Node.isObjectLiteralExpression(written) ? written : null;
9540
9633
  }
9541
9634
  function initializerOf(object, property) {
9542
9635
  for (const written of object.getProperties()) {
9543
- if (import_ts_morph41.Node.isPropertyAssignment(written) && written.getName() === property) {
9636
+ if (import_ts_morph42.Node.isPropertyAssignment(written) && written.getName() === property) {
9544
9637
  return written.getInitializer() ?? null;
9545
9638
  }
9546
9639
  }
@@ -9570,7 +9663,7 @@ function invocationContextFor(call, resolveWrittenValue, originatesFrom, anchorC
9570
9663
  };
9571
9664
  }
9572
9665
  function isImportedFrom(identifier, expectedModule, originatesFrom) {
9573
- if (!import_ts_morph42.Node.isIdentifier(identifier)) {
9666
+ if (!import_ts_morph43.Node.isIdentifier(identifier)) {
9574
9667
  return false;
9575
9668
  }
9576
9669
  const symbol = identifier.getSymbol();
@@ -9591,7 +9684,7 @@ function isImportedFrom(identifier, expectedModule, originatesFrom) {
9591
9684
  );
9592
9685
  }
9593
9686
  function methodDeclaredIn(callee, expectedModule, resolve2, originatesFrom) {
9594
- if (!import_ts_morph42.Node.isPropertyAccessExpression(callee)) {
9687
+ if (!import_ts_morph43.Node.isPropertyAccessExpression(callee)) {
9595
9688
  return false;
9596
9689
  }
9597
9690
  const declarations = callee.getNameNode().getSymbol()?.getDeclarations();
@@ -9611,37 +9704,37 @@ function maker(written) {
9611
9704
  if (written === null) {
9612
9705
  return null;
9613
9706
  }
9614
- if (import_ts_morph42.Node.isNewExpression(written) || import_ts_morph42.Node.isCallExpression(written)) {
9707
+ if (import_ts_morph43.Node.isNewExpression(written) || import_ts_morph43.Node.isCallExpression(written)) {
9615
9708
  return written.getExpression();
9616
9709
  }
9617
9710
  return null;
9618
9711
  }
9619
9712
  function rootIdentifier2(expression) {
9620
9713
  let root = expression;
9621
- while (import_ts_morph42.Node.isPropertyAccessExpression(root)) {
9714
+ while (import_ts_morph43.Node.isPropertyAccessExpression(root)) {
9622
9715
  root = root.getExpression();
9623
9716
  }
9624
9717
  return root;
9625
9718
  }
9626
9719
  function importSpecifierMatches(decl, expectedModule) {
9627
- if (import_ts_morph42.Node.isImportSpecifier(decl)) {
9720
+ if (import_ts_morph43.Node.isImportSpecifier(decl)) {
9628
9721
  return decl.getImportDeclaration().getModuleSpecifierValue() === expectedModule;
9629
9722
  }
9630
- const owner = import_ts_morph42.Node.isNamespaceImport(decl) ? decl.getParent() : decl;
9631
- if (!import_ts_morph42.Node.isImportClause(owner)) {
9723
+ const owner = import_ts_morph43.Node.isNamespaceImport(decl) ? decl.getParent() : decl;
9724
+ if (!import_ts_morph43.Node.isImportClause(owner)) {
9632
9725
  return false;
9633
9726
  }
9634
9727
  const importDecl = owner.getParent();
9635
- return import_ts_morph42.Node.isImportDeclaration(importDecl) && importDecl.getModuleSpecifierValue() === expectedModule;
9728
+ return import_ts_morph43.Node.isImportDeclaration(importDecl) && importDecl.getModuleSpecifierValue() === expectedModule;
9636
9729
  }
9637
9730
  function extractInvocationEffects(func, barriers = NO_BARRIERS) {
9638
9731
  const calls = [];
9639
9732
  func.forEachDescendant((node, traversal) => {
9640
- if (isDescentStop(node, func, barriers) || import_ts_morph42.Node.isDecorator(node)) {
9733
+ if (isDescentStop(node, func, barriers) || import_ts_morph43.Node.isDecorator(node)) {
9641
9734
  traversal.skip();
9642
9735
  return;
9643
9736
  }
9644
- if (import_ts_morph42.Node.isCallExpression(node)) {
9737
+ if (import_ts_morph43.Node.isCallExpression(node)) {
9645
9738
  calls.push(node);
9646
9739
  }
9647
9740
  });
@@ -9665,10 +9758,10 @@ function invocationAt(call, func) {
9665
9758
  }
9666
9759
  function isAwaited(call) {
9667
9760
  let current2 = call.getParent();
9668
- while (current2 !== void 0 && import_ts_morph42.Node.isParenthesizedExpression(current2)) {
9761
+ while (current2 !== void 0 && import_ts_morph43.Node.isParenthesizedExpression(current2)) {
9669
9762
  current2 = current2.getParent();
9670
9763
  }
9671
- return current2 !== void 0 && import_ts_morph42.Node.isAwaitExpression(current2);
9764
+ return current2 !== void 0 && import_ts_morph43.Node.isAwaitExpression(current2);
9672
9765
  }
9673
9766
  function runInvocationRecognizers(func, recognizers, barriers = NO_BARRIERS, resolveWrittenValue, originatesFrom, anchorCallsOf) {
9674
9767
  if (recognizers.length === 0) {
@@ -9681,7 +9774,7 @@ function runInvocationRecognizers(func, recognizers, barriers = NO_BARRIERS, res
9681
9774
  traversal.skip();
9682
9775
  return;
9683
9776
  }
9684
- if (!import_ts_morph42.Node.isCallExpression(node)) {
9777
+ if (!import_ts_morph43.Node.isCallExpression(node)) {
9685
9778
  return;
9686
9779
  }
9687
9780
  const ctx = invocationContextFor(
@@ -9743,7 +9836,7 @@ function runAccessRecognizersAtModuleScope(sourceFile, recognizers, resolveWritt
9743
9836
  }
9744
9837
  function accessContextFor(node, sourceFile, resolveWrittenValue = () => null, originatesFrom, anchorCallsOf) {
9745
9838
  const given = { access: node, sourceFile, resolveWrittenValue };
9746
- if (import_ts_morph42.Node.isPropertyAccessExpression(node)) {
9839
+ if (import_ts_morph43.Node.isPropertyAccessExpression(node)) {
9747
9840
  return given;
9748
9841
  }
9749
9842
  let ops;
@@ -9772,7 +9865,7 @@ function dispatchAccessRecognizers(root, recognizers, isStop, resolveWrittenValu
9772
9865
  traversal.skip();
9773
9866
  return;
9774
9867
  }
9775
- if (!import_ts_morph42.Node.isPropertyAccessExpression(node) && !import_ts_morph42.Node.isCallExpression(node) && !import_ts_morph42.Node.isTaggedTemplateExpression(node)) {
9868
+ if (!import_ts_morph43.Node.isPropertyAccessExpression(node) && !import_ts_morph43.Node.isCallExpression(node) && !import_ts_morph43.Node.isTaggedTemplateExpression(node)) {
9776
9869
  return;
9777
9870
  }
9778
9871
  const ctx = accessContextFor(
@@ -9828,35 +9921,35 @@ function extractArg(node, depth) {
9828
9921
  return extractArg(bare, depth);
9829
9922
  }
9830
9923
  }
9831
- if (import_ts_morph42.Node.isStringLiteral(node) || import_ts_morph42.Node.isNoSubstitutionTemplateLiteral(node)) {
9924
+ if (import_ts_morph43.Node.isStringLiteral(node) || import_ts_morph43.Node.isNoSubstitutionTemplateLiteral(node)) {
9832
9925
  return { kind: "string", value: node.getLiteralValue() };
9833
9926
  }
9834
- if (import_ts_morph42.Node.isNumericLiteral(node)) {
9927
+ if (import_ts_morph43.Node.isNumericLiteral(node)) {
9835
9928
  return { kind: "number", value: node.getLiteralValue() };
9836
9929
  }
9837
- if (import_ts_morph42.Node.isTrueLiteral(node)) {
9930
+ if (import_ts_morph43.Node.isTrueLiteral(node)) {
9838
9931
  return { kind: "boolean", value: true };
9839
9932
  }
9840
- if (import_ts_morph42.Node.isFalseLiteral(node)) {
9933
+ if (import_ts_morph43.Node.isFalseLiteral(node)) {
9841
9934
  return { kind: "boolean", value: false };
9842
9935
  }
9843
- if (import_ts_morph42.Node.isTemplateExpression(node)) {
9936
+ if (import_ts_morph43.Node.isTemplateExpression(node)) {
9844
9937
  return { kind: "template", sourceText: node.getText() };
9845
9938
  }
9846
- if (import_ts_morph42.Node.isIdentifier(node)) {
9939
+ if (import_ts_morph43.Node.isIdentifier(node)) {
9847
9940
  const inlined = inlineModuleBinding(node, depth);
9848
9941
  if (inlined !== null) {
9849
9942
  return inlined;
9850
9943
  }
9851
9944
  return { kind: "identifier", name: node.getText() };
9852
9945
  }
9853
- if (import_ts_morph42.Node.isPropertyAccessExpression(node) || import_ts_morph42.Node.isElementAccessExpression(node)) {
9946
+ if (import_ts_morph43.Node.isPropertyAccessExpression(node) || import_ts_morph43.Node.isElementAccessExpression(node)) {
9854
9947
  return { kind: "identifier", name: node.getText() };
9855
9948
  }
9856
9949
  if (depth <= 0) {
9857
9950
  return null;
9858
9951
  }
9859
- if (import_ts_morph42.Node.isCallExpression(node)) {
9952
+ if (import_ts_morph43.Node.isCallExpression(node)) {
9860
9953
  const element = mapCallbackReturn(node);
9861
9954
  if (element !== null) {
9862
9955
  return { kind: "array", items: [extractArg(element, depth - 1)] };
@@ -9867,19 +9960,19 @@ function extractArg(node, depth) {
9867
9960
  args: node.getArguments().map((a) => extractArg(a, depth - 1))
9868
9961
  };
9869
9962
  }
9870
- if (import_ts_morph42.Node.isNewExpression(node)) {
9963
+ if (import_ts_morph43.Node.isNewExpression(node)) {
9871
9964
  return {
9872
9965
  kind: "call",
9873
9966
  callee: node.getExpression().getText(),
9874
9967
  args: node.getArguments().map((a) => extractArg(a, depth - 1))
9875
9968
  };
9876
9969
  }
9877
- if (import_ts_morph42.Node.isObjectLiteralExpression(node)) {
9970
+ if (import_ts_morph43.Node.isObjectLiteralExpression(node)) {
9878
9971
  const fields = {};
9879
9972
  for (const prop of node.getProperties()) {
9880
- if (import_ts_morph42.Node.isShorthandPropertyAssignment(prop)) {
9973
+ if (import_ts_morph43.Node.isShorthandPropertyAssignment(prop)) {
9881
9974
  const nameNode2 = prop.getNameNode();
9882
- if (import_ts_morph42.Node.isIdentifier(nameNode2)) {
9975
+ if (import_ts_morph43.Node.isIdentifier(nameNode2)) {
9883
9976
  fields[nameNode2.getText()] = {
9884
9977
  kind: "identifier",
9885
9978
  name: nameNode2.getText()
@@ -9887,14 +9980,14 @@ function extractArg(node, depth) {
9887
9980
  }
9888
9981
  continue;
9889
9982
  }
9890
- if (!import_ts_morph42.Node.isPropertyAssignment(prop)) {
9983
+ if (!import_ts_morph43.Node.isPropertyAssignment(prop)) {
9891
9984
  continue;
9892
9985
  }
9893
9986
  const nameNode = prop.getNameNode();
9894
- if (!import_ts_morph42.Node.isIdentifier(nameNode) && !import_ts_morph42.Node.isStringLiteral(nameNode) && !import_ts_morph42.Node.isNoSubstitutionTemplateLiteral(nameNode)) {
9987
+ if (!import_ts_morph43.Node.isIdentifier(nameNode) && !import_ts_morph43.Node.isStringLiteral(nameNode) && !import_ts_morph43.Node.isNoSubstitutionTemplateLiteral(nameNode)) {
9895
9988
  continue;
9896
9989
  }
9897
- const name = import_ts_morph42.Node.isIdentifier(nameNode) ? nameNode.getText() : nameNode.getLiteralValue();
9990
+ const name = import_ts_morph43.Node.isIdentifier(nameNode) ? nameNode.getText() : nameNode.getLiteralValue();
9898
9991
  const initializer = prop.getInitializer();
9899
9992
  if (initializer === void 0) {
9900
9993
  continue;
@@ -9903,7 +9996,7 @@ function extractArg(node, depth) {
9903
9996
  }
9904
9997
  return { kind: "object", fields };
9905
9998
  }
9906
- if (import_ts_morph42.Node.isArrayLiteralExpression(node)) {
9999
+ if (import_ts_morph43.Node.isArrayLiteralExpression(node)) {
9907
10000
  const items = node.getElements().map((el) => extractArg(el, depth - 1));
9908
10001
  return { kind: "array", items };
9909
10002
  }
@@ -9911,20 +10004,20 @@ function extractArg(node, depth) {
9911
10004
  }
9912
10005
  function mapCallbackReturn(call) {
9913
10006
  const callee = call.getExpression();
9914
- if (!import_ts_morph42.Node.isPropertyAccessExpression(callee) || callee.getName() !== "map") {
10007
+ if (!import_ts_morph43.Node.isPropertyAccessExpression(callee) || callee.getName() !== "map") {
9915
10008
  return null;
9916
10009
  }
9917
10010
  const callback = call.getArguments()[0];
9918
- if (callback === void 0 || !(import_ts_morph42.Node.isArrowFunction(callback) || import_ts_morph42.Node.isFunctionExpression(callback))) {
10011
+ if (callback === void 0 || !(import_ts_morph43.Node.isArrowFunction(callback) || import_ts_morph43.Node.isFunctionExpression(callback))) {
9919
10012
  return null;
9920
10013
  }
9921
10014
  const body = callback.getBody();
9922
- if (!import_ts_morph42.Node.isBlock(body)) {
10015
+ if (!import_ts_morph43.Node.isBlock(body)) {
9923
10016
  return body;
9924
10017
  }
9925
10018
  const statements = body.getStatements();
9926
10019
  const only = statements.length === 1 ? statements[0] : void 0;
9927
- return only !== void 0 && import_ts_morph42.Node.isReturnStatement(only) ? only.getExpression() ?? null : null;
10020
+ return only !== void 0 && import_ts_morph43.Node.isReturnStatement(only) ? only.getExpression() ?? null : null;
9928
10021
  }
9929
10022
  function collectPreconditions(node, root) {
9930
10023
  return collectAncestorConditionInfosBelow(node, root).map(
@@ -9935,7 +10028,7 @@ function runsOnEveryPath(node, root) {
9935
10028
  let current2 = node;
9936
10029
  while (current2 !== void 0 && current2 !== root) {
9937
10030
  const parent = current2.getParent();
9938
- if (parent !== void 0 && import_ts_morph42.Node.isTryStatement(parent) && parent.getFinallyBlock() === current2) {
10031
+ if (parent !== void 0 && import_ts_morph43.Node.isTryStatement(parent) && parent.getFinallyBlock() === current2) {
9939
10032
  return true;
9940
10033
  }
9941
10034
  current2 = parent;
@@ -9958,7 +10051,7 @@ function withPreconditions(effect, preconditions) {
9958
10051
  };
9959
10052
  }
9960
10053
  function inlineModuleBinding(ident, depth) {
9961
- if (!import_ts_morph42.Node.isIdentifier(ident)) {
10054
+ if (!import_ts_morph43.Node.isIdentifier(ident)) {
9962
10055
  return null;
9963
10056
  }
9964
10057
  const symbol = ident.getSymbol();
@@ -9966,7 +10059,7 @@ function inlineModuleBinding(ident, depth) {
9966
10059
  return null;
9967
10060
  }
9968
10061
  for (const decl of symbol.getDeclarations()) {
9969
- if (!import_ts_morph42.Node.isVariableDeclaration(decl)) {
10062
+ if (!import_ts_morph43.Node.isVariableDeclaration(decl)) {
9970
10063
  continue;
9971
10064
  }
9972
10065
  if (!isModuleScoped(decl)) {
@@ -9987,10 +10080,10 @@ function inlineModuleBinding(ident, depth) {
9987
10080
  function isModuleScoped(decl) {
9988
10081
  let current2 = decl.getParent();
9989
10082
  while (current2 !== void 0) {
9990
- if (import_ts_morph42.Node.isSourceFile(current2)) {
10083
+ if (import_ts_morph43.Node.isSourceFile(current2)) {
9991
10084
  return true;
9992
10085
  }
9993
- if (import_ts_morph42.Node.isVariableDeclarationList(current2) || import_ts_morph42.Node.isVariableStatement(current2)) {
10086
+ if (import_ts_morph43.Node.isVariableDeclarationList(current2) || import_ts_morph43.Node.isVariableStatement(current2)) {
9994
10087
  current2 = current2.getParent();
9995
10088
  continue;
9996
10089
  }
@@ -10004,7 +10097,7 @@ function unwrapCasts(node) {
10004
10097
  function enclosingStatementLine(node) {
10005
10098
  let current2 = node;
10006
10099
  while (current2 !== void 0) {
10007
- if (import_ts_morph42.Node.isStatement(current2)) {
10100
+ if (import_ts_morph43.Node.isStatement(current2)) {
10008
10101
  return startLineOf(current2);
10009
10102
  }
10010
10103
  current2 = current2.getParent();
@@ -10013,19 +10106,19 @@ function enclosingStatementLine(node) {
10013
10106
  }
10014
10107
 
10015
10108
  // src/terminals/index.ts
10016
- var import_ts_morph53 = require("ts-morph");
10109
+ var import_ts_morph54 = require("ts-morph");
10017
10110
 
10018
10111
  // src/terminals/continuation.ts
10019
- var import_ts_morph44 = require("ts-morph");
10112
+ var import_ts_morph45 = require("ts-morph");
10020
10113
 
10021
10114
  // src/terminals/shared.ts
10022
- var import_ts_morph43 = require("ts-morph");
10115
+ var import_ts_morph44 = require("ts-morph");
10023
10116
  function parameterPositionOf(identifier, func) {
10024
- if (!import_ts_morph43.Node.isIdentifier(identifier)) {
10117
+ if (!import_ts_morph44.Node.isIdentifier(identifier)) {
10025
10118
  return null;
10026
10119
  }
10027
10120
  const declaration = identifier.getSymbol()?.getDeclarations()[0];
10028
- if (declaration === void 0 || !import_ts_morph43.Node.isParameterDeclaration(declaration)) {
10121
+ if (declaration === void 0 || !import_ts_morph44.Node.isParameterDeclaration(declaration)) {
10029
10122
  return null;
10030
10123
  }
10031
10124
  const params = func.getParameters();
@@ -10042,17 +10135,17 @@ function returnPositionOf(value) {
10042
10135
  if (parent === void 0) {
10043
10136
  return null;
10044
10137
  }
10045
- if (import_ts_morph43.Node.isReturnStatement(parent)) {
10138
+ if (import_ts_morph44.Node.isReturnStatement(parent)) {
10046
10139
  return parent;
10047
10140
  }
10048
- if (import_ts_morph43.Node.isArrowFunction(parent)) {
10141
+ if (import_ts_morph44.Node.isArrowFunction(parent)) {
10049
10142
  return parent.getBody() === current2 ? current2 : null;
10050
10143
  }
10051
10144
  if (passesValueThrough(parent)) {
10052
10145
  current2 = parent;
10053
10146
  continue;
10054
10147
  }
10055
- if (import_ts_morph43.Node.isConditionalExpression(parent) && (parent.getWhenTrue() === current2 || parent.getWhenFalse() === current2)) {
10148
+ if (import_ts_morph44.Node.isConditionalExpression(parent) && (parent.getWhenTrue() === current2 || parent.getWhenFalse() === current2)) {
10056
10149
  current2 = parent;
10057
10150
  continue;
10058
10151
  }
@@ -10062,7 +10155,7 @@ function returnPositionOf(value) {
10062
10155
 
10063
10156
  // src/terminals/continuation.ts
10064
10157
  function tryMatchParameterCall(node, func, pattern, match) {
10065
- if (!import_ts_morph44.Node.isCallExpression(node)) {
10158
+ if (!import_ts_morph45.Node.isCallExpression(node)) {
10066
10159
  return null;
10067
10160
  }
10068
10161
  const callee = node.getExpression();
@@ -10085,15 +10178,15 @@ function tryMatchParameterCall(node, func, pattern, match) {
10085
10178
  }
10086
10179
 
10087
10180
  // src/terminals/extract.ts
10088
- var import_ts_morph47 = require("ts-morph");
10181
+ var import_ts_morph48 = require("ts-morph");
10089
10182
  var import_values5 = require("@suss/values");
10090
10183
 
10091
10184
  // src/shapes/shapes.ts
10092
- var import_ts_morph46 = require("ts-morph");
10185
+ var import_ts_morph47 = require("ts-morph");
10093
10186
 
10094
10187
  // src/shapes/typeShapes.ts
10095
10188
  var import_node_crypto = require("crypto");
10096
- var import_ts_morph45 = require("ts-morph");
10189
+ var import_ts_morph46 = require("ts-morph");
10097
10190
 
10098
10191
  // src/shapes/definitions.ts
10099
10192
  var current = null;
@@ -10444,7 +10537,7 @@ function refFromType(type, ctx) {
10444
10537
  }
10445
10538
  return { type: "ref", name: withoutImportQualifiers(type.getText()) };
10446
10539
  }
10447
- var PRINTED_NAME_FLAGS = import_ts_morph45.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope | import_ts_morph45.TypeFormatFlags.UseTypeOfFunction | import_ts_morph45.TypeFormatFlags.NoTruncation | import_ts_morph45.TypeFormatFlags.WriteTypeArgumentsOfSignature;
10540
+ var PRINTED_NAME_FLAGS = import_ts_morph46.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope | import_ts_morph46.TypeFormatFlags.UseTypeOfFunction | import_ts_morph46.TypeFormatFlags.NoTruncation | import_ts_morph46.TypeFormatFlags.WriteTypeArgumentsOfSignature;
10448
10541
  function printedTypeName(type, ctx) {
10449
10542
  return withoutImportQualifiers(
10450
10543
  type.getText(ctx.enclosing, PRINTED_NAME_FLAGS)
@@ -10554,60 +10647,60 @@ function extractShapeWithArguments(node, substitutions) {
10554
10647
  }
10555
10648
  function extractShapeInner(node) {
10556
10649
  const unwrapped2 = peelSyntax(node);
10557
- if (boundArguments !== null && import_ts_morph46.Node.isIdentifier(unwrapped2)) {
10650
+ if (boundArguments !== null && import_ts_morph47.Node.isIdentifier(unwrapped2)) {
10558
10651
  const argument = boundArguments.get(unwrapped2.getText());
10559
10652
  if (argument !== void 0 && argument !== unwrapped2) {
10560
10653
  return extractShape(argument);
10561
10654
  }
10562
10655
  }
10563
- if (import_ts_morph46.Node.isObjectLiteralExpression(unwrapped2)) {
10656
+ if (import_ts_morph47.Node.isObjectLiteralExpression(unwrapped2)) {
10564
10657
  return shapeFromObjectLiteral(unwrapped2);
10565
10658
  }
10566
- if (import_ts_morph46.Node.isArrayLiteralExpression(unwrapped2)) {
10659
+ if (import_ts_morph47.Node.isArrayLiteralExpression(unwrapped2)) {
10567
10660
  return shapeFromArrayLiteral(unwrapped2);
10568
10661
  }
10569
- if (import_ts_morph46.Node.isStringLiteral(unwrapped2) || import_ts_morph46.Node.isNoSubstitutionTemplateLiteral(unwrapped2)) {
10662
+ if (import_ts_morph47.Node.isStringLiteral(unwrapped2) || import_ts_morph47.Node.isNoSubstitutionTemplateLiteral(unwrapped2)) {
10570
10663
  return { type: "literal", value: unwrapped2.getLiteralValue() };
10571
10664
  }
10572
- if (import_ts_morph46.Node.isTemplateExpression(unwrapped2)) {
10665
+ if (import_ts_morph47.Node.isTemplateExpression(unwrapped2)) {
10573
10666
  return { type: "text" };
10574
10667
  }
10575
- if (import_ts_morph46.Node.isNumericLiteral(unwrapped2)) {
10668
+ if (import_ts_morph47.Node.isNumericLiteral(unwrapped2)) {
10576
10669
  return numericLiteralShape(
10577
10670
  unwrapped2.getLiteralValue(),
10578
10671
  unwrapped2.getText()
10579
10672
  );
10580
10673
  }
10581
- if (import_ts_morph46.Node.isPrefixUnaryExpression(unwrapped2)) {
10674
+ if (import_ts_morph47.Node.isPrefixUnaryExpression(unwrapped2)) {
10582
10675
  const op = unwrapped2.getOperatorToken();
10583
- if (op === import_ts_morph46.SyntaxKind.MinusToken || op === import_ts_morph46.SyntaxKind.PlusToken) {
10676
+ if (op === import_ts_morph47.SyntaxKind.MinusToken || op === import_ts_morph47.SyntaxKind.PlusToken) {
10584
10677
  const inner = unwrapped2.getOperand();
10585
- if (import_ts_morph46.Node.isNumericLiteral(inner)) {
10678
+ if (import_ts_morph47.Node.isNumericLiteral(inner)) {
10586
10679
  const v3 = inner.getLiteralValue();
10587
- const signed = op === import_ts_morph46.SyntaxKind.MinusToken ? -v3 : v3;
10680
+ const signed = op === import_ts_morph47.SyntaxKind.MinusToken ? -v3 : v3;
10588
10681
  const rawBody = inner.getText();
10589
- const raw = op === import_ts_morph46.SyntaxKind.MinusToken ? `-${rawBody}` : rawBody;
10682
+ const raw = op === import_ts_morph47.SyntaxKind.MinusToken ? `-${rawBody}` : rawBody;
10590
10683
  return numericLiteralShape(signed, raw);
10591
10684
  }
10592
10685
  }
10593
10686
  }
10594
- if (import_ts_morph46.Node.isBigIntLiteral(unwrapped2)) {
10687
+ if (import_ts_morph47.Node.isBigIntLiteral(unwrapped2)) {
10595
10688
  return { type: "ref", name: "bigint" };
10596
10689
  }
10597
10690
  const kind = unwrapped2.getKind();
10598
- if (kind === import_ts_morph46.SyntaxKind.TrueKeyword) {
10691
+ if (kind === import_ts_morph47.SyntaxKind.TrueKeyword) {
10599
10692
  return { type: "literal", value: true };
10600
10693
  }
10601
- if (kind === import_ts_morph46.SyntaxKind.FalseKeyword) {
10694
+ if (kind === import_ts_morph47.SyntaxKind.FalseKeyword) {
10602
10695
  return { type: "literal", value: false };
10603
10696
  }
10604
- if (kind === import_ts_morph46.SyntaxKind.NullKeyword) {
10697
+ if (kind === import_ts_morph47.SyntaxKind.NullKeyword) {
10605
10698
  return { type: "null" };
10606
10699
  }
10607
- if (import_ts_morph46.Node.isIdentifier(unwrapped2) && unwrapped2.getText() === "undefined") {
10700
+ if (import_ts_morph47.Node.isIdentifier(unwrapped2) && unwrapped2.getText() === "undefined") {
10608
10701
  return { type: "undefined" };
10609
10702
  }
10610
- if (import_ts_morph46.Node.isConditionalExpression(unwrapped2)) {
10703
+ if (import_ts_morph47.Node.isConditionalExpression(unwrapped2)) {
10611
10704
  const whenTrue = extractShape(unwrapped2.getWhenTrue());
10612
10705
  const whenFalse = extractShape(unwrapped2.getWhenFalse());
10613
10706
  const variants = [];
@@ -10638,7 +10731,7 @@ function shapeFromArrayLiteral(arr) {
10638
10731
  }
10639
10732
  const shapes = [];
10640
10733
  for (const el of elements) {
10641
- if (import_ts_morph46.Node.isSpreadElement(el)) {
10734
+ if (import_ts_morph47.Node.isSpreadElement(el)) {
10642
10735
  const inner = el.getExpression();
10643
10736
  const innerShape = extractShape(inner);
10644
10737
  if (innerShape?.type === "array") {
@@ -10657,7 +10750,7 @@ function shapeFromObjectLiteral(obj) {
10657
10750
  const properties = {};
10658
10751
  const unresolvedSpreads = [];
10659
10752
  for (const prop of obj.getProperties()) {
10660
- if (import_ts_morph46.Node.isPropertyAssignment(prop)) {
10753
+ if (import_ts_morph47.Node.isPropertyAssignment(prop)) {
10661
10754
  const name = propertyName2(prop);
10662
10755
  if (name === null) {
10663
10756
  continue;
@@ -10673,7 +10766,7 @@ function shapeFromObjectLiteral(obj) {
10673
10766
  };
10674
10767
  continue;
10675
10768
  }
10676
- if (import_ts_morph46.Node.isShorthandPropertyAssignment(prop)) {
10769
+ if (import_ts_morph47.Node.isShorthandPropertyAssignment(prop)) {
10677
10770
  const name = prop.getName();
10678
10771
  const valueExpr = prop.getNameNode();
10679
10772
  properties[name] = extractShape(valueExpr) ?? {
@@ -10682,7 +10775,7 @@ function shapeFromObjectLiteral(obj) {
10682
10775
  };
10683
10776
  continue;
10684
10777
  }
10685
- if (import_ts_morph46.Node.isSpreadAssignment(prop)) {
10778
+ if (import_ts_morph47.Node.isSpreadAssignment(prop)) {
10686
10779
  const expr = prop.getExpression();
10687
10780
  const spreadShape = extractShape(expr);
10688
10781
  if (spreadShape?.type === "record") {
@@ -10701,7 +10794,7 @@ function shapeFromObjectLiteral(obj) {
10701
10794
  }
10702
10795
  function propertyName2(prop) {
10703
10796
  const nameNode = prop.getNameNode();
10704
- if (import_ts_morph46.Node.isIdentifier(nameNode) || import_ts_morph46.Node.isStringLiteral(nameNode) || import_ts_morph46.Node.isNoSubstitutionTemplateLiteral(nameNode) || import_ts_morph46.Node.isNumericLiteral(nameNode)) {
10797
+ if (import_ts_morph47.Node.isIdentifier(nameNode) || import_ts_morph47.Node.isStringLiteral(nameNode) || import_ts_morph47.Node.isNoSubstitutionTemplateLiteral(nameNode) || import_ts_morph47.Node.isNumericLiteral(nameNode)) {
10705
10798
  return nameNode.getText().replace(/^["']|["']$/g, "");
10706
10799
  }
10707
10800
  return null;
@@ -10732,15 +10825,15 @@ function unwrapAs(node) {
10732
10825
  }
10733
10826
  function unwrapJsonStringify(node) {
10734
10827
  const outer = unwrapAs(node);
10735
- if (!import_ts_morph47.Node.isCallExpression(outer)) {
10828
+ if (!import_ts_morph48.Node.isCallExpression(outer)) {
10736
10829
  return node;
10737
10830
  }
10738
10831
  const callee = outer.getExpression();
10739
- if (!import_ts_morph47.Node.isPropertyAccessExpression(callee) || callee.getName() !== "stringify") {
10832
+ if (!import_ts_morph48.Node.isPropertyAccessExpression(callee) || callee.getName() !== "stringify") {
10740
10833
  return node;
10741
10834
  }
10742
10835
  const receiver = callee.getExpression();
10743
- if (!import_ts_morph47.Node.isIdentifier(receiver) || receiver.getText() !== "JSON") {
10836
+ if (!import_ts_morph48.Node.isIdentifier(receiver) || receiver.getText() !== "JSON") {
10744
10837
  return node;
10745
10838
  }
10746
10839
  const args = outer.getArguments();
@@ -10750,7 +10843,7 @@ function unwrapJsonStringify(node) {
10750
10843
  return unwrapAs(args[0]);
10751
10844
  }
10752
10845
  function substituted(value, ctx) {
10753
- if (ctx.substitutions === void 0 || !import_ts_morph47.Node.isIdentifier(value)) {
10846
+ if (ctx.substitutions === void 0 || !import_ts_morph48.Node.isIdentifier(value)) {
10754
10847
  return value;
10755
10848
  }
10756
10849
  return ctx.substitutions.get(value.getText()) ?? value;
@@ -10794,10 +10887,10 @@ function statusFromProperty(obj, name, ctx) {
10794
10887
  if (prop === void 0) {
10795
10888
  return null;
10796
10889
  }
10797
- if (import_ts_morph47.Node.isShorthandPropertyAssignment(prop)) {
10890
+ if (import_ts_morph48.Node.isShorthandPropertyAssignment(prop)) {
10798
10891
  return { type: "dynamic", sourceText: prop.getName() };
10799
10892
  }
10800
- if (!import_ts_morph47.Node.isPropertyAssignment(prop)) {
10893
+ if (!import_ts_morph48.Node.isPropertyAssignment(prop)) {
10801
10894
  return null;
10802
10895
  }
10803
10896
  const value = prop.getInitializer();
@@ -10820,7 +10913,7 @@ function extractStatusCodeFromRule(ctx) {
10820
10913
  return null;
10821
10914
  }
10822
10915
  const first = ctx.throwCallArgs?.[0];
10823
- if (first !== void 0 && import_ts_morph47.Node.isNumericLiteral(first)) {
10916
+ if (first !== void 0 && import_ts_morph48.Node.isNumericLiteral(first)) {
10824
10917
  const value = first.getLiteralValue();
10825
10918
  if (value >= 100 && value <= 599) {
10826
10919
  return { type: "literal", value };
@@ -10833,7 +10926,7 @@ function extractStatusCodeFromRule(ctx) {
10833
10926
  return null;
10834
10927
  }
10835
10928
  const arg = ctx.throwCallArgs[sc.position];
10836
- if (arg === void 0 || !import_ts_morph47.Node.isNewExpression(arg)) {
10929
+ if (arg === void 0 || !import_ts_morph48.Node.isNewExpression(arg)) {
10837
10930
  return null;
10838
10931
  }
10839
10932
  const ctorText = arg.getExpression().getText();
@@ -10842,7 +10935,7 @@ function extractStatusCodeFromRule(ctx) {
10842
10935
  if (sc.from === "argumentProperty") {
10843
10936
  const args = ctx.throwCallArgs ?? ctx.calls?.[0]?.getArguments();
10844
10937
  const arg = args?.[sc.position];
10845
- if (arg === void 0 || !import_ts_morph47.Node.isObjectLiteralExpression(arg)) {
10938
+ if (arg === void 0 || !import_ts_morph48.Node.isObjectLiteralExpression(arg)) {
10846
10939
  return null;
10847
10940
  }
10848
10941
  return statusFromProperty(arg, sc.name, ctx);
@@ -10852,8 +10945,8 @@ function extractStatusCodeFromRule(ctx) {
10852
10945
  return null;
10853
10946
  }
10854
10947
  for (const prop of ctx.returnedObj.getProperties()) {
10855
- if (!import_ts_morph47.Node.isPropertyAssignment(prop)) {
10856
- if (import_ts_morph47.Node.isShorthandPropertyAssignment(prop)) {
10948
+ if (!import_ts_morph48.Node.isPropertyAssignment(prop)) {
10949
+ if (import_ts_morph48.Node.isShorthandPropertyAssignment(prop)) {
10857
10950
  if (prop.getName() === sc.name) {
10858
10951
  const resolved = ctx.substitutions?.get(prop.getName());
10859
10952
  if (resolved !== void 0) {
@@ -10911,8 +11004,8 @@ function extractBody(ctx) {
10911
11004
  return null;
10912
11005
  }
10913
11006
  for (const prop of ctx.returnedObj.getProperties()) {
10914
- if (!import_ts_morph47.Node.isPropertyAssignment(prop)) {
10915
- if (import_ts_morph47.Node.isShorthandPropertyAssignment(prop)) {
11007
+ if (!import_ts_morph48.Node.isPropertyAssignment(prop)) {
11008
+ if (import_ts_morph48.Node.isShorthandPropertyAssignment(prop)) {
10916
11009
  if (prop.getName() === b.name) {
10917
11010
  const resolved = ctx.substitutions?.get(prop.getName());
10918
11011
  if (resolved !== void 0) {
@@ -10967,16 +11060,16 @@ function extractBody(ctx) {
10967
11060
  }
10968
11061
 
10969
11062
  // src/terminals/jsx.ts
10970
- var import_ts_morph48 = require("ts-morph");
11063
+ var import_ts_morph49 = require("ts-morph");
10971
11064
  function tryMatchJsxReturn(node, pattern) {
10972
11065
  let expr;
10973
11066
  let source;
10974
- if (import_ts_morph48.Node.isReturnStatement(node)) {
11067
+ if (import_ts_morph49.Node.isReturnStatement(node)) {
10975
11068
  expr = node.getExpression();
10976
11069
  source = node;
10977
- } else if (import_ts_morph48.Node.isArrowFunction(node)) {
11070
+ } else if (import_ts_morph49.Node.isArrowFunction(node)) {
10978
11071
  const body = node.getBody();
10979
- if (body !== void 0 && !import_ts_morph48.Node.isBlock(body)) {
11072
+ if (body !== void 0 && !import_ts_morph49.Node.isBlock(body)) {
10980
11073
  expr = body;
10981
11074
  source = body;
10982
11075
  }
@@ -11007,14 +11100,14 @@ function tryMatchJsxReturn(node, pattern) {
11007
11100
  return { node, source, terminal };
11008
11101
  }
11009
11102
  function componentTargetOf(tagNode) {
11010
- if (!import_ts_morph48.Node.isIdentifier(tagNode) || !/^[A-Z]/.test(tagNode.getText())) {
11103
+ if (!import_ts_morph49.Node.isIdentifier(tagNode) || !/^[A-Z]/.test(tagNode.getText())) {
11011
11104
  return null;
11012
11105
  }
11013
11106
  const target = functionTargetOf(tagNode);
11014
11107
  return target === null ? null : { file: target.file, name: target.name };
11015
11108
  }
11016
11109
  function jsxToRenderNode(node) {
11017
- if (import_ts_morph48.Node.isJsxElement(node)) {
11110
+ if (import_ts_morph49.Node.isJsxElement(node)) {
11018
11111
  const opening = node.getOpeningElement();
11019
11112
  const tag = opening.getTagNameNode().getText();
11020
11113
  const attrs = collectJsxAttributes(opening);
@@ -11028,7 +11121,7 @@ function jsxToRenderNode(node) {
11028
11121
  ...target !== null ? { target } : {}
11029
11122
  };
11030
11123
  }
11031
- if (import_ts_morph48.Node.isJsxSelfClosingElement(node)) {
11124
+ if (import_ts_morph49.Node.isJsxSelfClosingElement(node)) {
11032
11125
  const tag = node.getTagNameNode().getText();
11033
11126
  const attrs = collectJsxAttributes(node);
11034
11127
  const target = componentTargetOf(node.getTagNameNode());
@@ -11040,11 +11133,11 @@ function jsxToRenderNode(node) {
11040
11133
  ...target !== null ? { target } : {}
11041
11134
  };
11042
11135
  }
11043
- if (import_ts_morph48.Node.isJsxFragment(node)) {
11136
+ if (import_ts_morph49.Node.isJsxFragment(node)) {
11044
11137
  const children = node.getJsxChildren().map(jsxChildToRenderNode).filter((n) => n !== null);
11045
11138
  return { type: "element", tag: "Fragment", children };
11046
11139
  }
11047
- if (import_ts_morph48.Node.isParenthesizedExpression(node)) {
11140
+ if (import_ts_morph49.Node.isParenthesizedExpression(node)) {
11048
11141
  return jsxToRenderNode(node.getExpression());
11049
11142
  }
11050
11143
  return null;
@@ -11052,12 +11145,12 @@ function jsxToRenderNode(node) {
11052
11145
  function collectJsxAttributes(opening) {
11053
11146
  const entries = {};
11054
11147
  for (const attr of opening.getAttributes()) {
11055
- if (import_ts_morph48.Node.isJsxSpreadAttribute(attr)) {
11148
+ if (import_ts_morph49.Node.isJsxSpreadAttribute(attr)) {
11056
11149
  const exprText = attr.getExpression().getText();
11057
11150
  entries[`...${exprText}`] = exprText;
11058
11151
  continue;
11059
11152
  }
11060
- if (!import_ts_morph48.Node.isJsxAttribute(attr)) {
11153
+ if (!import_ts_morph49.Node.isJsxAttribute(attr)) {
11061
11154
  continue;
11062
11155
  }
11063
11156
  const name = attr.getNameNode().getText();
@@ -11066,7 +11159,7 @@ function collectJsxAttributes(opening) {
11066
11159
  entries[name] = "";
11067
11160
  continue;
11068
11161
  }
11069
- if (import_ts_morph48.Node.isJsxExpression(initializer)) {
11162
+ if (import_ts_morph49.Node.isJsxExpression(initializer)) {
11070
11163
  const inner = initializer.getExpression();
11071
11164
  entries[name] = inner !== void 0 ? inner.getText() : "";
11072
11165
  continue;
@@ -11076,30 +11169,30 @@ function collectJsxAttributes(opening) {
11076
11169
  return Object.keys(entries).length > 0 ? entries : null;
11077
11170
  }
11078
11171
  function jsxChildToRenderNode(child) {
11079
- if (import_ts_morph48.Node.isJsxText(child)) {
11172
+ if (import_ts_morph49.Node.isJsxText(child)) {
11080
11173
  const text = child.getLiteralText().trim();
11081
11174
  if (text.length === 0) {
11082
11175
  return null;
11083
11176
  }
11084
11177
  return { type: "text", value: text };
11085
11178
  }
11086
- if (import_ts_morph48.Node.isJsxExpression(child)) {
11179
+ if (import_ts_morph49.Node.isJsxExpression(child)) {
11087
11180
  const inner = child.getExpression();
11088
11181
  if (inner === void 0) {
11089
11182
  return null;
11090
11183
  }
11091
11184
  return jsxExpressionToRenderNode(inner);
11092
11185
  }
11093
- if (import_ts_morph48.Node.isJsxElement(child) || import_ts_morph48.Node.isJsxSelfClosingElement(child) || import_ts_morph48.Node.isJsxFragment(child)) {
11186
+ if (import_ts_morph49.Node.isJsxElement(child) || import_ts_morph49.Node.isJsxSelfClosingElement(child) || import_ts_morph49.Node.isJsxFragment(child)) {
11094
11187
  return jsxToRenderNode(child);
11095
11188
  }
11096
11189
  return null;
11097
11190
  }
11098
11191
  function jsxExpressionToRenderNode(expr) {
11099
- if (import_ts_morph48.Node.isParenthesizedExpression(expr)) {
11192
+ if (import_ts_morph49.Node.isParenthesizedExpression(expr)) {
11100
11193
  return jsxExpressionToRenderNode(expr.getExpression());
11101
11194
  }
11102
- if (import_ts_morph48.Node.isBinaryExpression(expr)) {
11195
+ if (import_ts_morph49.Node.isBinaryExpression(expr)) {
11103
11196
  const op = expr.getOperatorToken().getText();
11104
11197
  if (op === "&&") {
11105
11198
  const right = renderAlternative(peelParens(expr.getRight()));
@@ -11113,7 +11206,7 @@ function jsxExpressionToRenderNode(expr) {
11113
11206
  }
11114
11207
  }
11115
11208
  }
11116
- if (import_ts_morph48.Node.isConditionalExpression(expr)) {
11209
+ if (import_ts_morph49.Node.isConditionalExpression(expr)) {
11117
11210
  const truthy = renderAlternative(peelParens(expr.getWhenTrue()));
11118
11211
  const falsy = renderAlternative(peelParens(expr.getWhenFalse()));
11119
11212
  if (truthy.kind === "jsx") {
@@ -11136,16 +11229,16 @@ function jsxExpressionToRenderNode(expr) {
11136
11229
  return { type: "expression", sourceText: expr.getText() };
11137
11230
  }
11138
11231
  function renderAlternative(node) {
11139
- if (import_ts_morph48.Node.isNullLiteral(node)) {
11232
+ if (import_ts_morph49.Node.isNullLiteral(node)) {
11140
11233
  return { kind: "noRender" };
11141
11234
  }
11142
- if (import_ts_morph48.Node.isFalseLiteral(node)) {
11235
+ if (import_ts_morph49.Node.isFalseLiteral(node)) {
11143
11236
  return { kind: "noRender" };
11144
11237
  }
11145
- if (import_ts_morph48.Node.isIdentifier(node) && node.getText() === "undefined") {
11238
+ if (import_ts_morph49.Node.isIdentifier(node) && node.getText() === "undefined") {
11146
11239
  return { kind: "noRender" };
11147
11240
  }
11148
- if (import_ts_morph48.Node.isJsxElement(node) || import_ts_morph48.Node.isJsxSelfClosingElement(node) || import_ts_morph48.Node.isJsxFragment(node)) {
11241
+ if (import_ts_morph49.Node.isJsxElement(node) || import_ts_morph49.Node.isJsxSelfClosingElement(node) || import_ts_morph49.Node.isJsxFragment(node)) {
11149
11242
  const tree = jsxToRenderNode(node);
11150
11243
  if (tree !== null) {
11151
11244
  return { kind: "jsx", node: tree };
@@ -11155,13 +11248,13 @@ function renderAlternative(node) {
11155
11248
  }
11156
11249
 
11157
11250
  // src/terminals/returns.ts
11158
- var import_ts_morph51 = require("ts-morph");
11251
+ var import_ts_morph52 = require("ts-morph");
11159
11252
 
11160
11253
  // src/terminals/helperResolution.ts
11161
- var import_ts_morph49 = require("ts-morph");
11254
+ var import_ts_morph50 = require("ts-morph");
11162
11255
  function resolveHelperReturn(call, resolveCallee2) {
11163
11256
  const callee = call.getExpression();
11164
- if (!import_ts_morph49.Node.isIdentifier(callee)) {
11257
+ if (!import_ts_morph50.Node.isIdentifier(callee)) {
11165
11258
  return { kind: "notLocal" };
11166
11259
  }
11167
11260
  const helper = memoizedLocalHelper(callee, resolveCallee2);
@@ -11191,16 +11284,16 @@ function guardsAbove(returnValue) {
11191
11284
  let child = returnValue;
11192
11285
  let current2 = returnValue.getParent();
11193
11286
  while (current2 !== void 0) {
11194
- if (import_ts_morph49.Node.isIfStatement(current2)) {
11287
+ if (import_ts_morph50.Node.isIfStatement(current2)) {
11195
11288
  guards.push({
11196
11289
  condition: current2.getExpression(),
11197
11290
  whenTrue: current2.getThenStatement() === child
11198
11291
  });
11199
11292
  }
11200
- if (import_ts_morph49.Node.isBlock(current2)) {
11293
+ if (import_ts_morph50.Node.isBlock(current2)) {
11201
11294
  guards.push(...earlyReturnGuardsBefore(current2, child));
11202
11295
  }
11203
- if (import_ts_morph49.Node.isFunctionDeclaration(current2) || import_ts_morph49.Node.isArrowFunction(current2) || import_ts_morph49.Node.isFunctionExpression(current2)) {
11296
+ if (import_ts_morph50.Node.isFunctionDeclaration(current2) || import_ts_morph50.Node.isArrowFunction(current2) || import_ts_morph50.Node.isFunctionExpression(current2)) {
11204
11297
  break;
11205
11298
  }
11206
11299
  child = current2;
@@ -11209,7 +11302,7 @@ function guardsAbove(returnValue) {
11209
11302
  return guards;
11210
11303
  }
11211
11304
  function earlyReturnGuardsBefore(block, child) {
11212
- if (!import_ts_morph49.Node.isBlock(block)) {
11305
+ if (!import_ts_morph50.Node.isBlock(block)) {
11213
11306
  return [];
11214
11307
  }
11215
11308
  const guards = [];
@@ -11217,7 +11310,7 @@ function earlyReturnGuardsBefore(block, child) {
11217
11310
  if (statement === child) {
11218
11311
  break;
11219
11312
  }
11220
- if (!import_ts_morph49.Node.isIfStatement(statement) || statement.getElseStatement()) {
11313
+ if (!import_ts_morph50.Node.isIfStatement(statement) || statement.getElseStatement()) {
11221
11314
  continue;
11222
11315
  }
11223
11316
  if (alwaysReturns(statement.getThenStatement())) {
@@ -11227,10 +11320,10 @@ function earlyReturnGuardsBefore(block, child) {
11227
11320
  return guards;
11228
11321
  }
11229
11322
  function alwaysReturns(statement) {
11230
- if (import_ts_morph49.Node.isReturnStatement(statement) || import_ts_morph49.Node.isThrowStatement(statement)) {
11323
+ if (import_ts_morph50.Node.isReturnStatement(statement) || import_ts_morph50.Node.isThrowStatement(statement)) {
11231
11324
  return true;
11232
11325
  }
11233
- if (!import_ts_morph49.Node.isBlock(statement)) {
11326
+ if (!import_ts_morph50.Node.isBlock(statement)) {
11234
11327
  return false;
11235
11328
  }
11236
11329
  const statements = statement.getStatements();
@@ -11248,7 +11341,7 @@ var COMPARISONS = {
11248
11341
  "!=": (a, b) => a !== b
11249
11342
  };
11250
11343
  function evaluateComparison(condition, substitutions) {
11251
- if (!import_ts_morph49.Node.isBinaryExpression(condition)) {
11344
+ if (!import_ts_morph50.Node.isBinaryExpression(condition)) {
11252
11345
  return null;
11253
11346
  }
11254
11347
  const left = numberFor(condition.getLeft(), substitutions);
@@ -11260,8 +11353,8 @@ function evaluateComparison(condition, substitutions) {
11260
11353
  return compare === void 0 ? null : compare(left, right);
11261
11354
  }
11262
11355
  function numberFor(node, substitutions) {
11263
- const resolved = import_ts_morph49.Node.isIdentifier(node) && substitutions.has(node.getText()) ? substitutions.get(node.getText()) : node;
11264
- return import_ts_morph49.Node.isNumericLiteral(resolved) ? Number(resolved.getText()) : null;
11356
+ const resolved = import_ts_morph50.Node.isIdentifier(node) && substitutions.has(node.getText()) ? substitutions.get(node.getText()) : node;
11357
+ return import_ts_morph50.Node.isNumericLiteral(resolved) ? Number(resolved.getText()) : null;
11265
11358
  }
11266
11359
  var helperBySymbol = /* @__PURE__ */ new WeakMap();
11267
11360
  function memoizedLocalHelper(callee, resolveCallee2) {
@@ -11327,8 +11420,8 @@ function implementationBeside(declaration, name) {
11327
11420
  return candidate;
11328
11421
  }
11329
11422
  }
11330
- const variable4 = source.getVariableDeclaration(name);
11331
- const fn = variable4 === void 0 ? null : asFunctionLike(variable4);
11423
+ const variable3 = source.getVariableDeclaration(name);
11424
+ const fn = variable3 === void 0 ? null : asFunctionLike(variable3);
11332
11425
  if (fn !== null) {
11333
11426
  return fn;
11334
11427
  }
@@ -11348,12 +11441,12 @@ function declarationsFor(callee, resolveCallee2) {
11348
11441
  return (aliased ?? symbol).getDeclarations();
11349
11442
  }
11350
11443
  function asFunctionLike(declaration) {
11351
- if (import_ts_morph49.Node.isFunctionDeclaration(declaration) || import_ts_morph49.Node.isArrowFunction(declaration) || import_ts_morph49.Node.isFunctionExpression(declaration)) {
11444
+ if (import_ts_morph50.Node.isFunctionDeclaration(declaration) || import_ts_morph50.Node.isArrowFunction(declaration) || import_ts_morph50.Node.isFunctionExpression(declaration)) {
11352
11445
  return declaration;
11353
11446
  }
11354
- if (import_ts_morph49.Node.isVariableDeclaration(declaration)) {
11447
+ if (import_ts_morph50.Node.isVariableDeclaration(declaration)) {
11355
11448
  const initializer = declaration.getInitializer();
11356
- if (initializer !== void 0 && (import_ts_morph49.Node.isArrowFunction(initializer) || import_ts_morph49.Node.isFunctionExpression(initializer))) {
11449
+ if (initializer !== void 0 && (import_ts_morph50.Node.isArrowFunction(initializer) || import_ts_morph50.Node.isFunctionExpression(initializer))) {
11357
11450
  return initializer;
11358
11451
  }
11359
11452
  }
@@ -11364,13 +11457,13 @@ function returnedObjects(fn) {
11364
11457
  if (body === void 0) {
11365
11458
  return [];
11366
11459
  }
11367
- if (!import_ts_morph49.Node.isBlock(body)) {
11460
+ if (!import_ts_morph50.Node.isBlock(body)) {
11368
11461
  const expression = peelParens(body);
11369
- return import_ts_morph49.Node.isObjectLiteralExpression(expression) ? [expression] : [];
11462
+ return import_ts_morph50.Node.isObjectLiteralExpression(expression) ? [expression] : [];
11370
11463
  }
11371
11464
  const found = [];
11372
11465
  for (const statement of body.getDescendantsOfKind(
11373
- import_ts_morph49.SyntaxKind.ReturnStatement
11466
+ import_ts_morph50.SyntaxKind.ReturnStatement
11374
11467
  )) {
11375
11468
  if (enclosingFunctionOf(statement) !== body) {
11376
11469
  continue;
@@ -11380,7 +11473,7 @@ function returnedObjects(fn) {
11380
11473
  continue;
11381
11474
  }
11382
11475
  const unwrapped2 = peelParens(expression);
11383
- if (import_ts_morph49.Node.isObjectLiteralExpression(unwrapped2)) {
11476
+ if (import_ts_morph50.Node.isObjectLiteralExpression(unwrapped2)) {
11384
11477
  found.push(unwrapped2);
11385
11478
  }
11386
11479
  }
@@ -11389,7 +11482,7 @@ function returnedObjects(fn) {
11389
11482
  function enclosingFunctionOf(node) {
11390
11483
  let current2 = node.getParent();
11391
11484
  while (current2 !== void 0) {
11392
- if (import_ts_morph49.Node.isFunctionDeclaration(current2) || import_ts_morph49.Node.isArrowFunction(current2) || import_ts_morph49.Node.isFunctionExpression(current2) || import_ts_morph49.Node.isMethodDeclaration(current2)) {
11485
+ if (import_ts_morph50.Node.isFunctionDeclaration(current2) || import_ts_morph50.Node.isArrowFunction(current2) || import_ts_morph50.Node.isFunctionExpression(current2) || import_ts_morph50.Node.isMethodDeclaration(current2)) {
11393
11486
  return current2.getBody();
11394
11487
  }
11395
11488
  current2 = current2.getParent();
@@ -11408,7 +11501,7 @@ function bindArguments(callArgs, params) {
11408
11501
  }
11409
11502
 
11410
11503
  // src/terminals/statusBranches.ts
11411
- var import_ts_morph50 = require("ts-morph");
11504
+ var import_ts_morph51 = require("ts-morph");
11412
11505
  var import_values6 = require("@suss/values");
11413
11506
  function statusChoicesOf(argument, resolution) {
11414
11507
  const chosen = asConditional(argument);
@@ -11432,10 +11525,10 @@ function asConditional(node) {
11432
11525
  if (direct !== null) {
11433
11526
  return direct;
11434
11527
  }
11435
- if (!import_ts_morph50.Node.isIdentifier(node)) {
11528
+ if (!import_ts_morph51.Node.isIdentifier(node)) {
11436
11529
  return null;
11437
11530
  }
11438
- const declaration = node.getSymbol()?.getDeclarations().find(import_ts_morph50.Node.isVariableDeclaration);
11531
+ const declaration = node.getSymbol()?.getDeclarations().find(import_ts_morph51.Node.isVariableDeclaration);
11439
11532
  if (declaration === void 0) {
11440
11533
  return null;
11441
11534
  }
@@ -11446,7 +11539,7 @@ function asConditional(node) {
11446
11539
  const only = written.values[0];
11447
11540
  return only === void 0 ? null : toConditional(only);
11448
11541
  }
11449
- var toConditional = (node) => import_ts_morph50.Node.isConditionalExpression(node) ? node : null;
11542
+ var toConditional = (node) => import_ts_morph51.Node.isConditionalExpression(node) ? node : null;
11450
11543
  function numberOf(node, resolution) {
11451
11544
  const value = (0, import_values6.constantOf)(evaluatedValue(node, resolution));
11452
11545
  return typeof value === "number" && Number.isFinite(value) ? value : null;
@@ -11463,7 +11556,7 @@ function unwrapMethodChain(call, match, func) {
11463
11556
  for (let i = methodChain.length - 1; i >= 0; i--) {
11464
11557
  const expectedMethod = methodChain[i];
11465
11558
  const callee = current2.getExpression();
11466
- if (!import_ts_morph51.Node.isPropertyAccessExpression(callee)) {
11559
+ if (!import_ts_morph52.Node.isPropertyAccessExpression(callee)) {
11467
11560
  return null;
11468
11561
  }
11469
11562
  if (callee.getName() !== expectedMethod) {
@@ -11479,7 +11572,7 @@ function unwrapMethodChain(call, match, func) {
11479
11572
  return null;
11480
11573
  }
11481
11574
  } else {
11482
- if (!import_ts_morph51.Node.isCallExpression(subject)) {
11575
+ if (!import_ts_morph52.Node.isCallExpression(subject)) {
11483
11576
  return null;
11484
11577
  }
11485
11578
  current2 = subject;
@@ -11489,9 +11582,9 @@ function unwrapMethodChain(call, match, func) {
11489
11582
  }
11490
11583
  function withoutPassThroughCalls(subject, passThrough) {
11491
11584
  let current2 = subject;
11492
- while (import_ts_morph51.Node.isCallExpression(current2)) {
11585
+ while (import_ts_morph52.Node.isCallExpression(current2)) {
11493
11586
  const callee = current2.getExpression();
11494
- if (!import_ts_morph51.Node.isPropertyAccessExpression(callee) || !passThrough.includes(callee.getName())) {
11587
+ if (!import_ts_morph52.Node.isPropertyAccessExpression(callee) || !passThrough.includes(callee.getName())) {
11495
11588
  break;
11496
11589
  }
11497
11590
  current2 = callee.getExpression();
@@ -11503,12 +11596,12 @@ function returnedValueOf(returnStatement) {
11503
11596
  return written === void 0 ? null : unwrapValue(written);
11504
11597
  }
11505
11598
  function tryMatchReturnShape(node, pattern, match, resolution, resolveCallee2) {
11506
- if (import_ts_morph51.Node.isObjectLiteralExpression(node)) {
11599
+ if (import_ts_morph52.Node.isObjectLiteralExpression(node)) {
11507
11600
  const source = returnPositionOf(node);
11508
11601
  if (source === null) {
11509
11602
  return [];
11510
11603
  }
11511
- if (import_ts_morph51.Node.isReturnStatement(source) && returnedValueOf(source) === node) {
11604
+ if (import_ts_morph52.Node.isReturnStatement(source) && returnedValueOf(source) === node) {
11512
11605
  return [];
11513
11606
  }
11514
11607
  const terminal = terminalFromReturnedObject(
@@ -11521,14 +11614,14 @@ function tryMatchReturnShape(node, pattern, match, resolution, resolveCallee2) {
11521
11614
  );
11522
11615
  return terminal === null ? [] : [{ ...terminal, source }];
11523
11616
  }
11524
- if (!import_ts_morph51.Node.isReturnStatement(node)) {
11617
+ if (!import_ts_morph52.Node.isReturnStatement(node)) {
11525
11618
  return [];
11526
11619
  }
11527
11620
  const returned = returnedValueOf(node);
11528
11621
  if (returned === null) {
11529
11622
  return [];
11530
11623
  }
11531
- if (import_ts_morph51.Node.isObjectLiteralExpression(returned)) {
11624
+ if (import_ts_morph52.Node.isObjectLiteralExpression(returned)) {
11532
11625
  const terminal = terminalFromReturnedObject(
11533
11626
  returned,
11534
11627
  node,
@@ -11539,7 +11632,7 @@ function tryMatchReturnShape(node, pattern, match, resolution, resolveCallee2) {
11539
11632
  );
11540
11633
  return terminal === null ? [] : [terminal];
11541
11634
  }
11542
- if (!import_ts_morph51.Node.isCallExpression(returned)) {
11635
+ if (!import_ts_morph52.Node.isCallExpression(returned)) {
11543
11636
  return [];
11544
11637
  }
11545
11638
  const resolved = resolveHelperReturn(returned, resolveCallee2);
@@ -11576,7 +11669,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
11576
11669
  if (required !== void 0 && required.length > 0) {
11577
11670
  const presentNames = /* @__PURE__ */ new Set();
11578
11671
  for (const prop of obj.getProperties()) {
11579
- if (import_ts_morph51.Node.isPropertyAssignment(prop) || import_ts_morph51.Node.isShorthandPropertyAssignment(prop)) {
11672
+ if (import_ts_morph52.Node.isPropertyAssignment(prop) || import_ts_morph52.Node.isShorthandPropertyAssignment(prop)) {
11580
11673
  presentNames.add(prop.getName());
11581
11674
  }
11582
11675
  }
@@ -11602,7 +11695,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
11602
11695
  // When a helper built the value, the anchor is the caller's own
11603
11696
  // return, so it doubles as the provenance. A value reached any other
11604
11697
  // way leaves this unset and its caller fills it in.
11605
- ...import_ts_morph51.Node.isReturnStatement(anchor) ? { source: anchor } : {},
11698
+ ...import_ts_morph52.Node.isReturnStatement(anchor) ? { source: anchor } : {},
11606
11699
  terminal: {
11607
11700
  kind: pattern.kind,
11608
11701
  statusCode,
@@ -11621,7 +11714,7 @@ function terminalFromReturnedObject(obj, anchor, pattern, match, substitutions,
11621
11714
  };
11622
11715
  }
11623
11716
  function tryMatchParameterMethodCall(node, func, pattern, match, resolution) {
11624
- if (!import_ts_morph51.Node.isCallExpression(node)) {
11717
+ if (!import_ts_morph52.Node.isCallExpression(node)) {
11625
11718
  return [];
11626
11719
  }
11627
11720
  const result = unwrapMethodChain(node, match, func);
@@ -11681,7 +11774,7 @@ function statusArgument(calls, extraction) {
11681
11774
  }
11682
11775
  function returnCoveredByParameterMethodCall(expr, func, patterns) {
11683
11776
  const current2 = unwrapValue(expr);
11684
- if (!import_ts_morph51.Node.isCallExpression(current2)) {
11777
+ if (!import_ts_morph52.Node.isCallExpression(current2)) {
11685
11778
  return false;
11686
11779
  }
11687
11780
  for (const pattern of patterns) {
@@ -11697,7 +11790,7 @@ function returnCoveredByParameterMethodCall(expr, func, patterns) {
11697
11790
  }
11698
11791
  function tryMatchReturnStatement(node, pattern, func, allPatterns) {
11699
11792
  const match = pattern.match.type === "returnStatement" ? pattern.match : null;
11700
- if (import_ts_morph51.Node.isReturnStatement(node)) {
11793
+ if (import_ts_morph52.Node.isReturnStatement(node)) {
11701
11794
  const expr = node.getExpression();
11702
11795
  if (match?.excludeCallReturns === true) {
11703
11796
  if (expr === void 0) {
@@ -11716,9 +11809,9 @@ function tryMatchReturnStatement(node, pattern, func, allPatterns) {
11716
11809
  }
11717
11810
  return buildReturnTerminal(node, pattern, body);
11718
11811
  }
11719
- if (import_ts_morph51.Node.isArrowFunction(node)) {
11812
+ if (import_ts_morph52.Node.isArrowFunction(node)) {
11720
11813
  const body = node.getBody();
11721
- if (body === void 0 || import_ts_morph51.Node.isBlock(body)) {
11814
+ if (body === void 0 || import_ts_morph52.Node.isBlock(body)) {
11722
11815
  return null;
11723
11816
  }
11724
11817
  const shape = extractShape(body);
@@ -11776,20 +11869,20 @@ function unresolvedTerminal(kind, node) {
11776
11869
  };
11777
11870
  }
11778
11871
  function calleeSubject(callee) {
11779
- if (import_ts_morph51.Node.isIdentifier(callee)) {
11872
+ if (import_ts_morph52.Node.isIdentifier(callee)) {
11780
11873
  return callee;
11781
11874
  }
11782
- if (import_ts_morph51.Node.isPropertyAccessExpression(callee)) {
11875
+ if (import_ts_morph52.Node.isPropertyAccessExpression(callee)) {
11783
11876
  const subject = callee.getExpression();
11784
- return import_ts_morph51.Node.isIdentifier(subject) ? subject : null;
11877
+ return import_ts_morph52.Node.isIdentifier(subject) ? subject : null;
11785
11878
  }
11786
11879
  return null;
11787
11880
  }
11788
11881
  function tryMatchFunctionCall(node, pattern, match, resolution, originatesFrom) {
11789
- if (!import_ts_morph51.Node.isCallExpression(node) && !import_ts_morph51.Node.isNewExpression(node)) {
11882
+ if (!import_ts_morph52.Node.isCallExpression(node) && !import_ts_morph52.Node.isNewExpression(node)) {
11790
11883
  return null;
11791
11884
  }
11792
- if (import_ts_morph51.Node.isNewExpression(node) && returnPositionOf(node) === null) {
11885
+ if (import_ts_morph52.Node.isNewExpression(node) && returnPositionOf(node) === null) {
11793
11886
  return null;
11794
11887
  }
11795
11888
  const callee = node.getExpression();
@@ -11828,9 +11921,9 @@ function tryMatchFunctionCall(node, pattern, match, resolution, originatesFrom)
11828
11921
  }
11829
11922
 
11830
11923
  // src/terminals/throws.ts
11831
- var import_ts_morph52 = require("ts-morph");
11924
+ var import_ts_morph53 = require("ts-morph");
11832
11925
  function tryMatchThrowExpression(node, pattern, match, resolution) {
11833
- if (!import_ts_morph52.Node.isThrowStatement(node)) {
11926
+ if (!import_ts_morph53.Node.isThrowStatement(node)) {
11834
11927
  return null;
11835
11928
  }
11836
11929
  const thrownExpr = node.getExpression();
@@ -11872,17 +11965,17 @@ function extractThrowMessage(callArgs) {
11872
11965
  return null;
11873
11966
  }
11874
11967
  for (const arg of callArgs) {
11875
- if (import_ts_morph52.Node.isStringLiteral(arg) || import_ts_morph52.Node.isNoSubstitutionTemplateLiteral(arg)) {
11968
+ if (import_ts_morph53.Node.isStringLiteral(arg) || import_ts_morph53.Node.isNoSubstitutionTemplateLiteral(arg)) {
11876
11969
  return arg.getLiteralValue();
11877
11970
  }
11878
- if (import_ts_morph52.Node.isTemplateExpression(arg)) {
11971
+ if (import_ts_morph53.Node.isTemplateExpression(arg)) {
11879
11972
  return arg.getText();
11880
11973
  }
11881
11974
  }
11882
11975
  return null;
11883
11976
  }
11884
11977
  function classifyThrownExpression(thrown, constructorPattern) {
11885
- if (import_ts_morph52.Node.isCallExpression(thrown) || import_ts_morph52.Node.isNewExpression(thrown)) {
11978
+ if (import_ts_morph53.Node.isCallExpression(thrown) || import_ts_morph53.Node.isNewExpression(thrown)) {
11886
11979
  const calleeText = thrown.getExpression().getText();
11887
11980
  if (constructorPattern !== void 0 && !calleeText.startsWith(constructorPattern)) {
11888
11981
  return null;
@@ -11969,9 +12062,9 @@ function findTerminals(func, patterns, barriers = NO_BARRIERS, resolution, origi
11969
12062
  }
11970
12063
  }
11971
12064
  });
11972
- if (results.length === 0 && import_ts_morph53.Node.isArrowFunction(func)) {
12065
+ if (results.length === 0 && import_ts_morph54.Node.isArrowFunction(func)) {
11973
12066
  const body = func.getBody();
11974
- if (body !== void 0 && !import_ts_morph53.Node.isBlock(body)) {
12067
+ if (body !== void 0 && !import_ts_morph54.Node.isBlock(body)) {
11975
12068
  for (const pattern of patterns) {
11976
12069
  let found = null;
11977
12070
  if (pattern.match.type === "parameterMethodCall") {
@@ -12006,7 +12099,7 @@ function functionMayFallThrough(func) {
12006
12099
  if (body === void 0) {
12007
12100
  return false;
12008
12101
  }
12009
- if (!import_ts_morph53.Node.isBlock(body)) {
12102
+ if (!import_ts_morph54.Node.isBlock(body)) {
12010
12103
  return false;
12011
12104
  }
12012
12105
  const statements = body.getStatements();
@@ -12014,7 +12107,7 @@ function functionMayFallThrough(func) {
12014
12107
  return true;
12015
12108
  }
12016
12109
  const last = statements[statements.length - 1];
12017
- if (import_ts_morph53.Node.isReturnStatement(last) || import_ts_morph53.Node.isThrowStatement(last)) {
12110
+ if (import_ts_morph54.Node.isReturnStatement(last) || import_ts_morph54.Node.isThrowStatement(last)) {
12018
12111
  return false;
12019
12112
  }
12020
12113
  return true;
@@ -12062,7 +12155,7 @@ function writesTerminal(call, terminalNodes) {
12062
12155
  }
12063
12156
  }
12064
12157
  function isReceiverOf(node, parent) {
12065
- return (import_ts_morph54.Node.isPropertyAccessExpression(parent) || import_ts_morph54.Node.isElementAccessExpression(parent) || import_ts_morph54.Node.isCallExpression(parent)) && parent.getExpression() === node;
12158
+ return (import_ts_morph55.Node.isPropertyAccessExpression(parent) || import_ts_morph55.Node.isElementAccessExpression(parent) || import_ts_morph55.Node.isCallExpression(parent)) && parent.getExpression() === node;
12066
12159
  }
12067
12160
  var isDefaultConditionList = (conditions) => conditions.length === 0 || conditions.every(
12068
12161
  (c) => c.source === "earlyReturn" || c.source === "earlyThrow"
@@ -12072,7 +12165,7 @@ function bodyContentOf(func) {
12072
12165
  if (body === void 0) {
12073
12166
  return "absent";
12074
12167
  }
12075
- if (!import_ts_morph54.Node.isBlock(body)) {
12168
+ if (!import_ts_morph55.Node.isBlock(body)) {
12076
12169
  return "statements";
12077
12170
  }
12078
12171
  return body.getStatements().length === 0 ? "empty" : "statements";
@@ -12088,7 +12181,7 @@ function countUnmatchedReturns(func, terminals, barriers = NO_BARRIERS) {
12088
12181
  claimed.add(source);
12089
12182
  }
12090
12183
  }
12091
- if (import_ts_morph54.Node.isArrowFunction(func) && import_ts_morph54.Node.isExpression(body)) {
12184
+ if (import_ts_morph55.Node.isArrowFunction(func) && import_ts_morph55.Node.isExpression(body)) {
12092
12185
  return claimed.has(body) ? 0 : 1;
12093
12186
  }
12094
12187
  let unmatched = 0;
@@ -12101,7 +12194,7 @@ function countUnmatchedReturns(func, terminals, barriers = NO_BARRIERS) {
12101
12194
  traversal.skip();
12102
12195
  return;
12103
12196
  }
12104
- if (!import_ts_morph54.Node.isReturnStatement(node)) {
12197
+ if (!import_ts_morph55.Node.isReturnStatement(node)) {
12105
12198
  return;
12106
12199
  }
12107
12200
  if (node.getExpression() === void 0) {
@@ -12254,7 +12347,7 @@ function accountFor(site, terminalNodes, branches) {
12254
12347
  }
12255
12348
 
12256
12349
  // src/bootstrap/sourceFileLookup.ts
12257
- var import_ts_morph55 = require("ts-morph");
12350
+ var import_ts_morph56 = require("ts-morph");
12258
12351
  function createSourceFileLookup(project) {
12259
12352
  const all = project.getSourceFiles();
12260
12353
  const byAbs = /* @__PURE__ */ new Map();
@@ -12316,7 +12409,7 @@ function spanKey(span) {
12316
12409
  function indexFunctions(sf) {
12317
12410
  const index = /* @__PURE__ */ new Map();
12318
12411
  sf.forEachDescendant((node) => {
12319
- if (!import_ts_morph55.Node.isFunctionDeclaration(node) && !import_ts_morph55.Node.isFunctionExpression(node) && !import_ts_morph55.Node.isArrowFunction(node) && !import_ts_morph55.Node.isMethodDeclaration(node)) {
12412
+ if (!import_ts_morph56.Node.isFunctionDeclaration(node) && !import_ts_morph56.Node.isFunctionExpression(node) && !import_ts_morph56.Node.isArrowFunction(node) && !import_ts_morph56.Node.isMethodDeclaration(node)) {
12320
12413
  return;
12321
12414
  }
12322
12415
  const bySpan = spanKey({ start: node.getStart(), end: node.getEnd() });
@@ -12330,13 +12423,13 @@ function indexFunctions(sf) {
12330
12423
  }
12331
12424
 
12332
12425
  // src/contract.ts
12333
- var import_ts_morph56 = require("ts-morph");
12426
+ var import_ts_morph57 = require("ts-morph");
12334
12427
  var import_behavioral_ir4 = require("@suss/behavioral-ir");
12335
12428
  function extractDeclaredBody(node) {
12336
12429
  if (node === void 0) {
12337
12430
  return null;
12338
12431
  }
12339
- if (!import_ts_morph56.Node.isCallExpression(node)) {
12432
+ if (!import_ts_morph57.Node.isCallExpression(node)) {
12340
12433
  return null;
12341
12434
  }
12342
12435
  const typeArgs = node.getTypeArguments();
@@ -12350,10 +12443,10 @@ function resolveHandlerPropNode(func) {
12350
12443
  if (parent === void 0) {
12351
12444
  return null;
12352
12445
  }
12353
- if (import_ts_morph56.Node.isPropertyAssignment(parent)) {
12446
+ if (import_ts_morph57.Node.isPropertyAssignment(parent)) {
12354
12447
  return parent;
12355
12448
  }
12356
- if (import_ts_morph56.Node.isMethodDeclaration(func)) {
12449
+ if (import_ts_morph57.Node.isMethodDeclaration(func)) {
12357
12450
  return func;
12358
12451
  }
12359
12452
  return null;
@@ -12365,11 +12458,11 @@ function findRouterCall(unit) {
12365
12458
  return null;
12366
12459
  }
12367
12460
  const handlersObj = propNode.getParent();
12368
- if (handlersObj === void 0 || !import_ts_morph56.Node.isObjectLiteralExpression(handlersObj)) {
12461
+ if (handlersObj === void 0 || !import_ts_morph57.Node.isObjectLiteralExpression(handlersObj)) {
12369
12462
  return null;
12370
12463
  }
12371
12464
  const routerCall = handlersObj.getParent();
12372
- if (routerCall === void 0 || !import_ts_morph56.Node.isCallExpression(routerCall)) {
12465
+ if (routerCall === void 0 || !import_ts_morph57.Node.isCallExpression(routerCall)) {
12373
12466
  return null;
12374
12467
  }
12375
12468
  const args = routerCall.getArguments();
@@ -12382,17 +12475,17 @@ function findRouterCall(unit) {
12382
12475
  };
12383
12476
  }
12384
12477
  function resolveContractObject(contractArg, resolution) {
12385
- if (import_ts_morph56.Node.isObjectLiteralExpression(contractArg)) {
12478
+ if (import_ts_morph57.Node.isObjectLiteralExpression(contractArg)) {
12386
12479
  return contractArg;
12387
12480
  }
12388
- if (import_ts_morph56.Node.isPropertyAccessExpression(contractArg)) {
12481
+ if (import_ts_morph57.Node.isPropertyAccessExpression(contractArg)) {
12389
12482
  const base = resolveContractObject(contractArg.getExpression(), resolution);
12390
- if (base === null || !import_ts_morph56.Node.isObjectLiteralExpression(base)) {
12483
+ if (base === null || !import_ts_morph57.Node.isObjectLiteralExpression(base)) {
12391
12484
  return null;
12392
12485
  }
12393
12486
  const propName = contractArg.getName();
12394
12487
  for (const prop of base.getProperties()) {
12395
- if (!import_ts_morph56.Node.isPropertyAssignment(prop)) {
12488
+ if (!import_ts_morph57.Node.isPropertyAssignment(prop)) {
12396
12489
  continue;
12397
12490
  }
12398
12491
  if (prop.getName() !== propName) {
@@ -12402,20 +12495,20 @@ function resolveContractObject(contractArg, resolution) {
12402
12495
  if (value === void 0) {
12403
12496
  return null;
12404
12497
  }
12405
- if (import_ts_morph56.Node.isObjectLiteralExpression(value)) {
12498
+ if (import_ts_morph57.Node.isObjectLiteralExpression(value)) {
12406
12499
  return value;
12407
12500
  }
12408
- if (import_ts_morph56.Node.isIdentifier(value) || import_ts_morph56.Node.isPropertyAccessExpression(value)) {
12501
+ if (import_ts_morph57.Node.isIdentifier(value) || import_ts_morph57.Node.isPropertyAccessExpression(value)) {
12409
12502
  return resolveContractObject(value, resolution);
12410
12503
  }
12411
- if (import_ts_morph56.Node.isCallExpression(value)) {
12504
+ if (import_ts_morph57.Node.isCallExpression(value)) {
12412
12505
  return unwrapContractInit(value);
12413
12506
  }
12414
12507
  return null;
12415
12508
  }
12416
12509
  return null;
12417
12510
  }
12418
- if (!import_ts_morph56.Node.isIdentifier(contractArg)) {
12511
+ if (!import_ts_morph57.Node.isIdentifier(contractArg)) {
12419
12512
  return null;
12420
12513
  }
12421
12514
  const symbol = contractArg.getSymbol();
@@ -12427,7 +12520,7 @@ function resolveContractObject(contractArg, resolution) {
12427
12520
  return null;
12428
12521
  }
12429
12522
  const decl = decls[0];
12430
- if (import_ts_morph56.Node.isImportSpecifier(decl)) {
12523
+ if (import_ts_morph57.Node.isImportSpecifier(decl)) {
12431
12524
  const importDecl = decl.getImportDeclaration();
12432
12525
  const sourceFile = importDecl.getModuleSpecifierSourceFile();
12433
12526
  if (sourceFile !== void 0 && resolution !== void 0) {
@@ -12436,14 +12529,14 @@ function resolveContractObject(contractArg, resolution) {
12436
12529
  );
12437
12530
  if (exported !== void 0 && exported.length > 0) {
12438
12531
  const exportedDecl = exported[0];
12439
- if (import_ts_morph56.Node.isVariableDeclaration(exportedDecl)) {
12532
+ if (import_ts_morph57.Node.isVariableDeclaration(exportedDecl)) {
12440
12533
  return unwrapContractInit(exportedDecl.getInitializer());
12441
12534
  }
12442
12535
  }
12443
12536
  }
12444
12537
  return null;
12445
12538
  }
12446
- if (import_ts_morph56.Node.isVariableDeclaration(decl)) {
12539
+ if (import_ts_morph57.Node.isVariableDeclaration(decl)) {
12447
12540
  return unwrapContractInit(decl.getInitializer());
12448
12541
  }
12449
12542
  return null;
@@ -12453,39 +12546,39 @@ function unwrapContractInit(init) {
12453
12546
  return null;
12454
12547
  }
12455
12548
  const node = peelSyntax(init);
12456
- if (import_ts_morph56.Node.isCallExpression(node)) {
12549
+ if (import_ts_morph57.Node.isCallExpression(node)) {
12457
12550
  const args = node.getArguments();
12458
- if (args.length > 0 && import_ts_morph56.Node.isObjectLiteralExpression(args[0])) {
12551
+ if (args.length > 0 && import_ts_morph57.Node.isObjectLiteralExpression(args[0])) {
12459
12552
  return args[0];
12460
12553
  }
12461
12554
  return null;
12462
12555
  }
12463
- if (import_ts_morph56.Node.isObjectLiteralExpression(node)) {
12556
+ if (import_ts_morph57.Node.isObjectLiteralExpression(node)) {
12464
12557
  return node;
12465
12558
  }
12466
12559
  return null;
12467
12560
  }
12468
12561
  function extractEndpointContract(endpointNode, pattern, framework, resolution) {
12469
- if (!import_ts_morph56.Node.isObjectLiteralExpression(endpointNode)) {
12562
+ if (!import_ts_morph57.Node.isObjectLiteralExpression(endpointNode)) {
12470
12563
  return null;
12471
12564
  }
12472
12565
  const responses = [];
12473
12566
  let method;
12474
12567
  let path15;
12475
12568
  for (const prop of endpointNode.getProperties()) {
12476
- if (!import_ts_morph56.Node.isPropertyAssignment(prop)) {
12569
+ if (!import_ts_morph57.Node.isPropertyAssignment(prop)) {
12477
12570
  continue;
12478
12571
  }
12479
12572
  const propName = prop.getName();
12480
12573
  if (propName === pattern.methodProperty) {
12481
12574
  const val = prop.getInitializer();
12482
- if (val !== void 0 && import_ts_morph56.Node.isStringLiteral(val)) {
12575
+ if (val !== void 0 && import_ts_morph57.Node.isStringLiteral(val)) {
12483
12576
  method = val.getLiteralValue();
12484
12577
  }
12485
12578
  }
12486
12579
  if (propName === pattern.pathProperty) {
12487
12580
  const val = prop.getInitializer();
12488
- if (val !== void 0 && import_ts_morph56.Node.isStringLiteral(val)) {
12581
+ if (val !== void 0 && import_ts_morph57.Node.isStringLiteral(val)) {
12489
12582
  path15 = val.getLiteralValue();
12490
12583
  }
12491
12584
  }
@@ -12494,7 +12587,7 @@ function extractEndpointContract(endpointNode, pattern, framework, resolution) {
12494
12587
  const val = written === void 0 ? null : objectLiteralOf(written, resolution);
12495
12588
  if (val !== null) {
12496
12589
  for (const respProp of propertiesOf(val, resolution)) {
12497
- if (!import_ts_morph56.Node.isPropertyAssignment(respProp)) {
12590
+ if (!import_ts_morph57.Node.isPropertyAssignment(respProp)) {
12498
12591
  continue;
12499
12592
  }
12500
12593
  const statusStr = respProp.getName();
@@ -12544,11 +12637,11 @@ function readContract(unit, pattern, framework, resolution) {
12544
12637
  return null;
12545
12638
  }
12546
12639
  const contractObj = resolveContractObject(routerInfo.contractArg, resolution);
12547
- if (contractObj === null || !import_ts_morph56.Node.isObjectLiteralExpression(contractObj)) {
12640
+ if (contractObj === null || !import_ts_morph57.Node.isObjectLiteralExpression(contractObj)) {
12548
12641
  return null;
12549
12642
  }
12550
12643
  for (const prop of contractObj.getProperties()) {
12551
- if (!import_ts_morph56.Node.isPropertyAssignment(prop)) {
12644
+ if (!import_ts_morph57.Node.isPropertyAssignment(prop)) {
12552
12645
  continue;
12553
12646
  }
12554
12647
  if (prop.getName() !== routerInfo.handlerName) {
@@ -12573,7 +12666,7 @@ function endpointFromRegistrationArgument(unit, position, resolution) {
12573
12666
  return null;
12574
12667
  }
12575
12668
  const call = func.getParent();
12576
- if (call === void 0 || !import_ts_morph56.Node.isCallExpression(call)) {
12669
+ if (call === void 0 || !import_ts_morph57.Node.isCallExpression(call)) {
12577
12670
  return null;
12578
12671
  }
12579
12672
  const args = call.getArguments();
@@ -12585,24 +12678,24 @@ function endpointFromRegistrationArgument(unit, position, resolution) {
12585
12678
  return null;
12586
12679
  }
12587
12680
  let node = arg;
12588
- while (import_ts_morph56.Node.isAsExpression(node)) {
12681
+ while (import_ts_morph57.Node.isAsExpression(node)) {
12589
12682
  node = node.getExpression();
12590
12683
  }
12591
- if (import_ts_morph56.Node.isObjectLiteralExpression(node)) {
12684
+ if (import_ts_morph57.Node.isObjectLiteralExpression(node)) {
12592
12685
  return node;
12593
12686
  }
12594
- if (import_ts_morph56.Node.isCallExpression(node)) {
12687
+ if (import_ts_morph57.Node.isCallExpression(node)) {
12595
12688
  return unwrapContractInit(node);
12596
12689
  }
12597
12690
  return resolveContractObject(node, resolution);
12598
12691
  }
12599
12692
  function readContractForClientCall(callExpression, methodName, pattern, framework, resolution) {
12600
- const callee = import_ts_morph56.Node.isCallExpression(callExpression) ? callExpression.getExpression() : null;
12601
- if (callee === null || !import_ts_morph56.Node.isPropertyAccessExpression(callee)) {
12693
+ const callee = import_ts_morph57.Node.isCallExpression(callExpression) ? callExpression.getExpression() : null;
12694
+ if (callee === null || !import_ts_morph57.Node.isPropertyAccessExpression(callee)) {
12602
12695
  return null;
12603
12696
  }
12604
12697
  const clientIdentifier = callee.getExpression();
12605
- if (!import_ts_morph56.Node.isIdentifier(clientIdentifier)) {
12698
+ if (!import_ts_morph57.Node.isIdentifier(clientIdentifier)) {
12606
12699
  return null;
12607
12700
  }
12608
12701
  const symbol = clientIdentifier.getSymbol();
@@ -12614,11 +12707,11 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
12614
12707
  return null;
12615
12708
  }
12616
12709
  const decl = decls[0];
12617
- if (!import_ts_morph56.Node.isVariableDeclaration(decl)) {
12710
+ if (!import_ts_morph57.Node.isVariableDeclaration(decl)) {
12618
12711
  return null;
12619
12712
  }
12620
12713
  const init = decl.getInitializer();
12621
- if (init === void 0 || !import_ts_morph56.Node.isCallExpression(init)) {
12714
+ if (init === void 0 || !import_ts_morph57.Node.isCallExpression(init)) {
12622
12715
  return null;
12623
12716
  }
12624
12717
  const args = init.getArguments();
@@ -12626,11 +12719,11 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
12626
12719
  return null;
12627
12720
  }
12628
12721
  const contractObj = resolveContractObject(args[0], resolution);
12629
- if (contractObj === null || !import_ts_morph56.Node.isObjectLiteralExpression(contractObj)) {
12722
+ if (contractObj === null || !import_ts_morph57.Node.isObjectLiteralExpression(contractObj)) {
12630
12723
  return null;
12631
12724
  }
12632
12725
  for (const prop of contractObj.getProperties()) {
12633
- if (!import_ts_morph56.Node.isPropertyAssignment(prop)) {
12726
+ if (!import_ts_morph57.Node.isPropertyAssignment(prop)) {
12634
12727
  continue;
12635
12728
  }
12636
12729
  if (prop.getName() !== methodName) {
@@ -12652,26 +12745,26 @@ function readContractForClientCall(callExpression, methodName, pattern, framewor
12652
12745
 
12653
12746
  // src/diagnostics.ts
12654
12747
  var import_node_path7 = __toESM(require("path"), 1);
12655
- var import_ts_morph57 = require("ts-morph");
12748
+ var import_ts_morph58 = require("ts-morph");
12656
12749
  var import_extractor6 = require("@suss/extractor");
12657
12750
  var DEFAULT_RESOLUTION = {
12658
- moduleResolution: import_ts_morph57.ts.ModuleResolutionKind.Bundler,
12659
- target: import_ts_morph57.ts.ScriptTarget.ESNext,
12660
- module: import_ts_morph57.ts.ModuleKind.ESNext
12751
+ moduleResolution: import_ts_morph58.ts.ModuleResolutionKind.Bundler,
12752
+ target: import_ts_morph58.ts.ScriptTarget.ESNext,
12753
+ module: import_ts_morph58.ts.ModuleKind.ESNext
12661
12754
  };
12662
12755
  function resolutionContext(args) {
12663
12756
  if (args.tsConfigFilePath !== void 0) {
12664
- const configFile = import_ts_morph57.ts.readConfigFile(
12757
+ const configFile = import_ts_morph58.ts.readConfigFile(
12665
12758
  args.tsConfigFilePath,
12666
- import_ts_morph57.ts.sys.readFile
12759
+ import_ts_morph58.ts.sys.readFile
12667
12760
  );
12668
12761
  if (configFile.error !== void 0) {
12669
12762
  return null;
12670
12763
  }
12671
12764
  const dir = import_node_path7.default.dirname(args.tsConfigFilePath);
12672
- const parsed = import_ts_morph57.ts.parseJsonConfigFileContent(
12765
+ const parsed = import_ts_morph58.ts.parseJsonConfigFileContent(
12673
12766
  configFile.config,
12674
- import_ts_morph57.ts.sys,
12767
+ import_ts_morph58.ts.sys,
12675
12768
  dir,
12676
12769
  /*existingOptions*/
12677
12770
  void 0,
@@ -12700,11 +12793,11 @@ function unresolvedGatesFor(gates, args) {
12700
12793
  }
12701
12794
  const unresolved = [];
12702
12795
  for (const gate of gates) {
12703
- const resolved = import_ts_morph57.ts.resolveModuleName(
12796
+ const resolved = import_ts_morph58.ts.resolveModuleName(
12704
12797
  gate,
12705
12798
  context.containingFile,
12706
12799
  context.options,
12707
- import_ts_morph57.ts.sys
12800
+ import_ts_morph58.ts.sys
12708
12801
  );
12709
12802
  if (resolved.resolvedModule === void 0) {
12710
12803
  unresolved.push(gate);
@@ -12877,7 +12970,7 @@ var import_node_fs3 = __toESM(require("fs"), 1);
12877
12970
  var import_node_path8 = __toESM(require("path"), 1);
12878
12971
  var import_graphql2 = require("graphql");
12879
12972
  var import_picomatch2 = __toESM(require("picomatch"), 1);
12880
- var import_ts_morph58 = require("ts-morph");
12973
+ var import_ts_morph59 = require("ts-morph");
12881
12974
  var import_behavioral_ir5 = require("@suss/behavioral-ir");
12882
12975
  function stampGraphqlClientRefs(summaries, sourceFiles, packs, resolution) {
12883
12976
  const scopes = compileOperationScopes(packs);
@@ -12917,11 +13010,11 @@ function fragmentsRegisteredIn(sourceFiles) {
12917
13010
  const registered = /* @__PURE__ */ new Set();
12918
13011
  for (const sourceFile of sourceFiles) {
12919
13012
  sourceFile.forEachDescendant((node) => {
12920
- if (!import_ts_morph58.Node.isCallExpression(node)) {
13013
+ if (!import_ts_morph59.Node.isCallExpression(node)) {
12921
13014
  return;
12922
13015
  }
12923
13016
  const argument = node.getArguments()[0];
12924
- if (argument === void 0 || !import_ts_morph58.Node.isNoSubstitutionTemplateLiteral(argument)) {
13017
+ if (argument === void 0 || !import_ts_morph59.Node.isNoSubstitutionTemplateLiteral(argument)) {
12925
13018
  return;
12926
13019
  }
12927
13020
  for (const name of fragmentOnlyDocumentNames(argument.getLiteralText())) {
@@ -13108,7 +13201,7 @@ function constructionRegistryStatus(construction, spec) {
13108
13201
  if (cacheConstruction === null) {
13109
13202
  return "unknown";
13110
13203
  }
13111
- if (!import_ts_morph58.Node.isNewExpression(cacheConstruction) && !import_ts_morph58.Node.isCallExpression(cacheConstruction)) {
13204
+ if (!import_ts_morph59.Node.isNewExpression(cacheConstruction) && !import_ts_morph59.Node.isCallExpression(cacheConstruction)) {
13112
13205
  return "unknown";
13113
13206
  }
13114
13207
  const args = cacheConstruction.getArguments();
@@ -13122,15 +13215,15 @@ function constructionRegistryStatus(construction, spec) {
13122
13215
  if (cacheOptions.getProperty(spec.registryProperty) !== void 0) {
13123
13216
  return "configured";
13124
13217
  }
13125
- const hasSpread = cacheOptions.getProperties().some((property) => import_ts_morph58.Node.isSpreadAssignment(property));
13218
+ const hasSpread = cacheOptions.getProperties().some((property) => import_ts_morph59.Node.isSpreadAssignment(property));
13126
13219
  return hasSpread ? "unknown" : "absent";
13127
13220
  }
13128
13221
  function firstArgumentObjectLiteral(construction) {
13129
- if (!import_ts_morph58.Node.isNewExpression(construction) && !import_ts_morph58.Node.isCallExpression(construction)) {
13222
+ if (!import_ts_morph59.Node.isNewExpression(construction) && !import_ts_morph59.Node.isCallExpression(construction)) {
13130
13223
  return null;
13131
13224
  }
13132
13225
  const arg = construction.getArguments()[0];
13133
- if (arg === void 0 || !import_ts_morph58.Node.isObjectLiteralExpression(arg)) {
13226
+ if (arg === void 0 || !import_ts_morph59.Node.isObjectLiteralExpression(arg)) {
13134
13227
  return null;
13135
13228
  }
13136
13229
  return arg;
@@ -13140,10 +13233,10 @@ function propertyValueOf2(options, name) {
13140
13233
  if (property === void 0) {
13141
13234
  return null;
13142
13235
  }
13143
- if (import_ts_morph58.Node.isPropertyAssignment(property)) {
13236
+ if (import_ts_morph59.Node.isPropertyAssignment(property)) {
13144
13237
  return property.getInitializer() ?? null;
13145
13238
  }
13146
- if (import_ts_morph58.Node.isShorthandPropertyAssignment(property)) {
13239
+ if (import_ts_morph59.Node.isShorthandPropertyAssignment(property)) {
13147
13240
  const symbol = property.getProject().getTypeChecker().getShorthandAssignmentValueSymbol(property);
13148
13241
  return symbol?.getValueDeclaration() ?? null;
13149
13242
  }
@@ -13153,13 +13246,13 @@ function resolveToConstructionOf(expression, cacheClass) {
13153
13246
  let current2 = expression;
13154
13247
  for (let hop = 0; hop < 4 && current2 !== void 0; hop += 1) {
13155
13248
  current2 = unwrapExpression2(current2);
13156
- if (import_ts_morph58.Node.isVariableDeclaration(current2)) {
13249
+ if (import_ts_morph59.Node.isVariableDeclaration(current2)) {
13157
13250
  current2 = current2.getInitializer();
13158
13251
  continue;
13159
13252
  }
13160
- if (import_ts_morph58.Node.isNewExpression(current2) || import_ts_morph58.Node.isCallExpression(current2)) {
13253
+ if (import_ts_morph59.Node.isNewExpression(current2) || import_ts_morph59.Node.isCallExpression(current2)) {
13161
13254
  const callee = current2.getExpression();
13162
- if (callee === void 0 || !import_ts_morph58.Node.isIdentifier(callee)) {
13255
+ if (callee === void 0 || !import_ts_morph59.Node.isIdentifier(callee)) {
13163
13256
  return null;
13164
13257
  }
13165
13258
  const local = localImportName(
@@ -13169,11 +13262,11 @@ function resolveToConstructionOf(expression, cacheClass) {
13169
13262
  );
13170
13263
  return local !== null && callee.getText() === local ? current2 : null;
13171
13264
  }
13172
- if (!import_ts_morph58.Node.isIdentifier(current2)) {
13265
+ if (!import_ts_morph59.Node.isIdentifier(current2)) {
13173
13266
  return null;
13174
13267
  }
13175
13268
  const declaration = current2.getSymbol()?.getValueDeclaration();
13176
- if (declaration === void 0 || !import_ts_morph58.Node.isVariableDeclaration(declaration)) {
13269
+ if (declaration === void 0 || !import_ts_morph59.Node.isVariableDeclaration(declaration)) {
13177
13270
  return null;
13178
13271
  }
13179
13272
  current2 = declaration.getInitializer();
@@ -13184,11 +13277,11 @@ function unwrapExpression2(node) {
13184
13277
  return peelSyntax(node);
13185
13278
  }
13186
13279
  function isConstructionNamed(node, localName) {
13187
- if (!import_ts_morph58.Node.isNewExpression(node) && !import_ts_morph58.Node.isCallExpression(node)) {
13280
+ if (!import_ts_morph59.Node.isNewExpression(node) && !import_ts_morph59.Node.isCallExpression(node)) {
13188
13281
  return false;
13189
13282
  }
13190
13283
  const callee = node.getExpression();
13191
- return callee !== void 0 && import_ts_morph58.Node.isIdentifier(callee) && callee.getText() === localName;
13284
+ return callee !== void 0 && import_ts_morph59.Node.isIdentifier(callee) && callee.getText() === localName;
13192
13285
  }
13193
13286
  function localImportName(sourceFile, importModule, importName) {
13194
13287
  for (const one of namedImportsOf(sourceFile, [importModule], {
@@ -13202,11 +13295,11 @@ function localImportName(sourceFile, importModule, importName) {
13202
13295
  }
13203
13296
  function constructionRef(node, uriProperty, resolution) {
13204
13297
  const optionsArg = node.getArguments()[0];
13205
- if (optionsArg === void 0 || !import_ts_morph58.Node.isObjectLiteralExpression(optionsArg)) {
13298
+ if (optionsArg === void 0 || !import_ts_morph59.Node.isObjectLiteralExpression(optionsArg)) {
13206
13299
  return null;
13207
13300
  }
13208
13301
  const property = optionsArg.getProperty(uriProperty);
13209
- if (property === void 0 || !import_ts_morph58.Node.isPropertyAssignment(property)) {
13302
+ if (property === void 0 || !import_ts_morph59.Node.isPropertyAssignment(property)) {
13210
13303
  return null;
13211
13304
  }
13212
13305
  const value = property.getInitializer();
@@ -13221,10 +13314,10 @@ function constructionRef(node, uriProperty, resolution) {
13221
13314
  }
13222
13315
 
13223
13316
  // src/discovery/helperIndex.ts
13224
- var import_ts_morph60 = require("ts-morph");
13317
+ var import_ts_morph61 = require("ts-morph");
13225
13318
 
13226
13319
  // src/discovery/helperReading.ts
13227
- var import_ts_morph59 = require("ts-morph");
13320
+ var import_ts_morph60 = require("ts-morph");
13228
13321
  var UNREAD = { as: "unread" };
13229
13322
  function readHelperSinks(helper) {
13230
13323
  const positions = parameterPositions(helper);
@@ -13234,11 +13327,11 @@ function readHelperSinks(helper) {
13234
13327
  return sinks;
13235
13328
  }
13236
13329
  body.forEachDescendant((node) => {
13237
- if (!import_ts_morph59.Node.isCallExpression(node)) {
13330
+ if (!import_ts_morph60.Node.isCallExpression(node)) {
13238
13331
  return;
13239
13332
  }
13240
13333
  const callee = node.getExpression();
13241
- const [method, receiver] = import_ts_morph59.Node.isPropertyAccessExpression(callee) ? [callee.getName(), readValue(callee.getExpression(), positions)] : [null, UNREAD];
13334
+ const [method, receiver] = import_ts_morph60.Node.isPropertyAccessExpression(callee) ? [callee.getName(), readValue(callee.getExpression(), positions)] : [null, UNREAD];
13242
13335
  sinks.push({
13243
13336
  method,
13244
13337
  receiver,
@@ -13258,25 +13351,25 @@ function parameterPositions(helper) {
13258
13351
  return positions;
13259
13352
  }
13260
13353
  function readValue(node, positions) {
13261
- if (import_ts_morph59.Node.isStringLiteral(node) || import_ts_morph59.Node.isNoSubstitutionTemplateLiteral(node)) {
13354
+ if (import_ts_morph60.Node.isStringLiteral(node) || import_ts_morph60.Node.isNoSubstitutionTemplateLiteral(node)) {
13262
13355
  return { as: "text", text: node.getLiteralValue() };
13263
13356
  }
13264
- if (import_ts_morph59.Node.isTemplateExpression(node)) {
13357
+ if (import_ts_morph60.Node.isTemplateExpression(node)) {
13265
13358
  return templateText(node, positions);
13266
13359
  }
13267
- if (import_ts_morph59.Node.isIdentifier(node)) {
13360
+ if (import_ts_morph60.Node.isIdentifier(node)) {
13268
13361
  const position = positions.get(node.getText());
13269
13362
  return position === void 0 ? UNREAD : { as: "parameter", position };
13270
13363
  }
13271
- if (import_ts_morph59.Node.isPropertyAccessExpression(node)) {
13364
+ if (import_ts_morph60.Node.isPropertyAccessExpression(node)) {
13272
13365
  const target = node.getExpression();
13273
- const position = import_ts_morph59.Node.isIdentifier(target) ? positions.get(target.getText()) : void 0;
13366
+ const position = import_ts_morph60.Node.isIdentifier(target) ? positions.get(target.getText()) : void 0;
13274
13367
  return position === void 0 ? UNREAD : { as: "parameter", position, property: node.getName() };
13275
13368
  }
13276
- if (import_ts_morph59.Node.isObjectLiteralExpression(node)) {
13369
+ if (import_ts_morph60.Node.isObjectLiteralExpression(node)) {
13277
13370
  return objectValue(node, positions);
13278
13371
  }
13279
- if (import_ts_morph59.Node.isCallExpression(node)) {
13372
+ if (import_ts_morph60.Node.isCallExpression(node)) {
13280
13373
  return {
13281
13374
  as: "call",
13282
13375
  callee: node.getExpression().getText(),
@@ -13286,13 +13379,13 @@ function readValue(node, positions) {
13286
13379
  return UNREAD;
13287
13380
  }
13288
13381
  function templateText(node, positions) {
13289
- if (!import_ts_morph59.Node.isTemplateExpression(node)) {
13382
+ if (!import_ts_morph60.Node.isTemplateExpression(node)) {
13290
13383
  return UNREAD;
13291
13384
  }
13292
13385
  let text = node.getHead().getLiteralText();
13293
13386
  for (const span of node.getTemplateSpans()) {
13294
13387
  const expression = span.getExpression();
13295
- const position = import_ts_morph59.Node.isIdentifier(expression) ? positions.get(expression.getText()) : void 0;
13388
+ const position = import_ts_morph60.Node.isIdentifier(expression) ? positions.get(expression.getText()) : void 0;
13296
13389
  if (position === void 0) {
13297
13390
  return UNREAD;
13298
13391
  }
@@ -13301,12 +13394,12 @@ function templateText(node, positions) {
13301
13394
  return { as: "text", text };
13302
13395
  }
13303
13396
  function objectValue(node, positions) {
13304
- if (!import_ts_morph59.Node.isObjectLiteralExpression(node)) {
13397
+ if (!import_ts_morph60.Node.isObjectLiteralExpression(node)) {
13305
13398
  return UNREAD;
13306
13399
  }
13307
13400
  const properties = {};
13308
13401
  for (const property of node.getProperties()) {
13309
- if (!import_ts_morph59.Node.isPropertyAssignment(property)) {
13402
+ if (!import_ts_morph60.Node.isPropertyAssignment(property)) {
13310
13403
  continue;
13311
13404
  }
13312
13405
  const initializer = property.getInitializer();
@@ -13321,7 +13414,7 @@ function objectValue(node, positions) {
13321
13414
  return { as: "object", properties };
13322
13415
  }
13323
13416
  function propertyKey(name) {
13324
- return import_ts_morph59.Node.isStringLiteral(name) ? name.getLiteralValue() : name.getText();
13417
+ return import_ts_morph60.Node.isStringLiteral(name) ? name.getLiteralValue() : name.getText();
13325
13418
  }
13326
13419
 
13327
13420
  // src/discovery/helperIndex.ts
@@ -13451,11 +13544,11 @@ function registrationMatchesOf(pack) {
13451
13544
  }
13452
13545
  function collectHandOffs(sourceFile, subjects, match, resolution, found) {
13453
13546
  sourceFile.forEachDescendant((node) => {
13454
- if (!import_ts_morph60.Node.isCallExpression(node)) {
13547
+ if (!import_ts_morph61.Node.isCallExpression(node)) {
13455
13548
  return;
13456
13549
  }
13457
13550
  const callee = node.getExpression();
13458
- if (!import_ts_morph60.Node.isIdentifier(callee)) {
13551
+ if (!import_ts_morph61.Node.isIdentifier(callee)) {
13459
13552
  return;
13460
13553
  }
13461
13554
  const handedOver = subjectArgument(node, subjects, match, resolution);
@@ -13470,12 +13563,12 @@ function collectHandOffs(sourceFile, subjects, match, resolution, found) {
13470
13563
  });
13471
13564
  }
13472
13565
  function subjectArgument(call, subjects, match, resolution) {
13473
- if (!import_ts_morph60.Node.isCallExpression(call)) {
13566
+ if (!import_ts_morph61.Node.isCallExpression(call)) {
13474
13567
  return -1;
13475
13568
  }
13476
13569
  const args = call.getArguments();
13477
13570
  for (const [position, argument] of args.entries()) {
13478
- if (!import_ts_morph60.Node.isIdentifier(argument) && !import_ts_morph60.Node.isPropertyAccessExpression(argument)) {
13571
+ if (!import_ts_morph61.Node.isIdentifier(argument) && !import_ts_morph61.Node.isPropertyAccessExpression(argument)) {
13479
13572
  continue;
13480
13573
  }
13481
13574
  if (subjectNodeFor(argument, subjects, match, resolution) !== void 0) {
@@ -13534,10 +13627,10 @@ function declaredFunctions(sourceFile) {
13534
13627
  found.push([name, declaration]);
13535
13628
  }
13536
13629
  }
13537
- for (const variable4 of sourceFile.getVariableDeclarations()) {
13538
- const initializer = variable4.getInitializer();
13539
- if (initializer !== void 0 && (import_ts_morph60.Node.isArrowFunction(initializer) || import_ts_morph60.Node.isFunctionExpression(initializer))) {
13540
- found.push([variable4.getName(), initializer]);
13630
+ for (const variable3 of sourceFile.getVariableDeclarations()) {
13631
+ const initializer = variable3.getInitializer();
13632
+ if (initializer !== void 0 && (import_ts_morph61.Node.isArrowFunction(initializer) || import_ts_morph61.Node.isFunctionExpression(initializer))) {
13633
+ found.push([variable3.getName(), initializer]);
13541
13634
  }
13542
13635
  }
13543
13636
  return found;
@@ -13629,7 +13722,7 @@ function recordEdge(edgesByChild, candidate) {
13629
13722
  }
13630
13723
 
13631
13724
  // src/discovery/wrapperIndex.ts
13632
- var import_ts_morph61 = require("ts-morph");
13725
+ var import_ts_morph62 = require("ts-morph");
13633
13726
  var import_resolution6 = require("@suss/resolution");
13634
13727
  var NO_WRAPPERS = {
13635
13728
  wrappersFor: () => [],
@@ -13753,11 +13846,11 @@ function discoverWrapperRegistrations(sourceFile, pattern, match, wraps, resolut
13753
13846
  const candidates = [];
13754
13847
  const unresolved = [];
13755
13848
  sourceFile.forEachDescendant((node) => {
13756
- if (!import_ts_morph61.Node.isCallExpression(node)) {
13849
+ if (!import_ts_morph62.Node.isCallExpression(node)) {
13757
13850
  return;
13758
13851
  }
13759
13852
  const callee = node.getExpression();
13760
- if (!import_ts_morph61.Node.isPropertyAccessExpression(callee) || callee.getName() !== wraps.method) {
13853
+ if (!import_ts_morph62.Node.isPropertyAccessExpression(callee) || callee.getName() !== wraps.method) {
13761
13854
  return;
13762
13855
  }
13763
13856
  const subjectNode = subjectNodeFor(
@@ -13852,7 +13945,7 @@ function discoverConstructorOptions(sourceFile, pattern, wraps, subjects, resolu
13852
13945
  return { candidates, unresolved };
13853
13946
  }
13854
13947
  function constructorOptionOf(construction, wraps, resolution) {
13855
- if (!(import_ts_morph61.Node.isNewExpression(construction) || import_ts_morph61.Node.isCallExpression(construction))) {
13948
+ if (!(import_ts_morph62.Node.isNewExpression(construction) || import_ts_morph62.Node.isCallExpression(construction))) {
13856
13949
  return void 0;
13857
13950
  }
13858
13951
  const optionsArg = construction.getArguments()[wraps.targetPosition];
@@ -13882,6 +13975,7 @@ function candidateOf(registration, pattern, sourceFile) {
13882
13975
  reference: {
13883
13976
  file: target.getSourceFile().getFilePath(),
13884
13977
  name: named2 ? functionNameOrAnon(target) : label,
13978
+ ...named2 ? {} : { line: target.getStartLineNumber() },
13885
13979
  ...onThrow ? { onThrow: true } : {},
13886
13980
  ...scope === void 0 ? {} : { scope }
13887
13981
  }
@@ -13890,37 +13984,6 @@ function candidateOf(registration, pattern, sourceFile) {
13890
13984
  function labelFor(targetArg, wraps) {
13891
13985
  return factoryNameOf(targetArg) ?? wraps.method;
13892
13986
  }
13893
- function factoryNameOf(targetArg) {
13894
- const written = factKeyOf(targetArg);
13895
- if (!import_ts_morph61.Node.isCallExpression(written)) {
13896
- return void 0;
13897
- }
13898
- const callee = written.getExpression();
13899
- if (import_ts_morph61.Node.isIdentifier(callee)) {
13900
- return callee.getText();
13901
- }
13902
- if (import_ts_morph61.Node.isPropertyAccessExpression(callee)) {
13903
- return callee.getName();
13904
- }
13905
- return void 0;
13906
- }
13907
- function factoryStopOf(targetArg) {
13908
- const written = factKeyOf(targetArg);
13909
- if (!import_ts_morph61.Node.isCallExpression(written)) {
13910
- return null;
13911
- }
13912
- const callee = factoryNameOf(targetArg);
13913
- if (callee === void 0) {
13914
- return null;
13915
- }
13916
- const reason = classifyStop(
13917
- declarationsBehind(written.getExpression().getSymbol())
13918
- );
13919
- if (!(0, import_behavioral_ir2.worthRecording)(reason)) {
13920
- return null;
13921
- }
13922
- return { callee, reason: "unresolvedWrapper" };
13923
- }
13924
13987
  function mountedAt(subjectId, mountPrefixes, scope) {
13925
13988
  const prefix = mountPrefixes?.prefixForId?.(subjectId) ?? "";
13926
13989
  return (0, import_resolution6.joinMountedPath)(prefix, scope);
@@ -13937,7 +14000,7 @@ function scopeOf(args, wraps, resolution) {
13937
14000
  }
13938
14001
 
13939
14002
  // src/discoveryContext.ts
13940
- var import_ts_morph62 = require("ts-morph");
14003
+ var import_ts_morph63 = require("ts-morph");
13941
14004
  function createTsDiscoveryContext(resolution) {
13942
14005
  const store = resolution ?? new ResolutionStore();
13943
14006
  return {
@@ -13972,7 +14035,7 @@ function exportedFunctions(sourceFile, resolution) {
13972
14035
  return out;
13973
14036
  }
13974
14037
  function exportedFunction(decl, resolution) {
13975
- const writtenAgain = import_ts_morph62.Node.isVariableDeclaration(decl) && isWrittenAgain(decl);
14038
+ const writtenAgain = import_ts_morph63.Node.isVariableDeclaration(decl) && isWrittenAgain(decl);
13976
14039
  if (!writtenAgain) {
13977
14040
  const declared = resolveDeclarationToFunction(decl);
13978
14041
  if (declared !== null) {
@@ -13993,7 +14056,7 @@ function valueToAskAbout(decl, writtenAgain) {
13993
14056
  if (writtenAgain) {
13994
14057
  return decl;
13995
14058
  }
13996
- const value = import_ts_morph62.Node.isVariableDeclaration(decl) ? decl.getInitializer() ?? decl : decl;
14059
+ const value = import_ts_morph63.Node.isVariableDeclaration(decl) ? decl.getInitializer() ?? decl : decl;
13997
14060
  return couldStillNameAFunction(value) ? value : null;
13998
14061
  }
13999
14062
  function resolveDeclarationToFunction(decl) {
@@ -14001,18 +14064,18 @@ function resolveDeclarationToFunction(decl) {
14001
14064
  if (fn !== null) {
14002
14065
  return fn;
14003
14066
  }
14004
- if (import_ts_morph62.Node.isVariableDeclaration(decl)) {
14067
+ if (import_ts_morph63.Node.isVariableDeclaration(decl)) {
14005
14068
  const init = decl.getInitializer();
14006
- if (init !== void 0 && (import_ts_morph62.Node.isArrowFunction(init) || import_ts_morph62.Node.isFunctionExpression(init))) {
14069
+ if (init !== void 0 && (import_ts_morph63.Node.isArrowFunction(init) || import_ts_morph63.Node.isFunctionExpression(init))) {
14007
14070
  return init;
14008
14071
  }
14009
14072
  }
14010
14073
  return null;
14011
14074
  }
14012
14075
  function hasJsxReturn(func) {
14013
- if (import_ts_morph62.Node.isArrowFunction(func)) {
14076
+ if (import_ts_morph63.Node.isArrowFunction(func)) {
14014
14077
  const body2 = func.getBody();
14015
- if (import_ts_morph62.Node.isExpression(body2) && isJsxOrFragment(body2)) {
14078
+ if (import_ts_morph63.Node.isExpression(body2) && isJsxOrFragment(body2)) {
14016
14079
  return true;
14017
14080
  }
14018
14081
  }
@@ -14026,11 +14089,11 @@ function hasJsxReturn(func) {
14026
14089
  traversal.stop();
14027
14090
  return;
14028
14091
  }
14029
- if (node !== func && (import_ts_morph62.Node.isFunctionDeclaration(node) || import_ts_morph62.Node.isFunctionExpression(node) || import_ts_morph62.Node.isArrowFunction(node) || import_ts_morph62.Node.isMethodDeclaration(node))) {
14092
+ if (node !== func && (import_ts_morph63.Node.isFunctionDeclaration(node) || import_ts_morph63.Node.isFunctionExpression(node) || import_ts_morph63.Node.isArrowFunction(node) || import_ts_morph63.Node.isMethodDeclaration(node))) {
14030
14093
  traversal.skip();
14031
14094
  return;
14032
14095
  }
14033
- if (import_ts_morph62.Node.isReturnStatement(node)) {
14096
+ if (import_ts_morph63.Node.isReturnStatement(node)) {
14034
14097
  const expr = node.getExpression();
14035
14098
  if (expr !== void 0 && isJsxOrFragment(expr)) {
14036
14099
  found = true;
@@ -14041,7 +14104,7 @@ function hasJsxReturn(func) {
14041
14104
  }
14042
14105
  function isJsxOrFragment(node) {
14043
14106
  const current2 = peelParens(node);
14044
- return import_ts_morph62.Node.isJsxElement(current2) || import_ts_morph62.Node.isJsxSelfClosingElement(current2) || import_ts_morph62.Node.isJsxFragment(current2);
14107
+ return import_ts_morph63.Node.isJsxElement(current2) || import_ts_morph63.Node.isJsxSelfClosingElement(current2) || import_ts_morph63.Node.isJsxFragment(current2);
14045
14108
  }
14046
14109
 
14047
14110
  // src/graphqlContract.ts
@@ -14164,132 +14227,10 @@ function createReferenceIndex(sourceFiles) {
14164
14227
  };
14165
14228
  }
14166
14229
 
14167
- // src/resolve/boundaryEffects.ts
14168
- var import_datalog3 = require("@suss/datalog");
14169
- var EFFECT_RULES = [
14170
- (0, import_datalog3.rule)(
14171
- "reachFrom",
14172
- [(0, import_datalog3.variable)("e"), (0, import_datalog3.variable)("e")],
14173
- [(0, import_datalog3.lit)("entry", (0, import_datalog3.variable)("e"))]
14174
- ),
14175
- (0, import_datalog3.rule)(
14176
- "reachFrom",
14177
- [(0, import_datalog3.variable)("e"), (0, import_datalog3.variable)("v")],
14178
- [
14179
- (0, import_datalog3.lit)("reachFrom", (0, import_datalog3.variable)("e"), (0, import_datalog3.variable)("u")),
14180
- (0, import_datalog3.lit)("calls", (0, import_datalog3.variable)("u"), (0, import_datalog3.variable)("v"))
14181
- ]
14182
- ),
14183
- (0, import_datalog3.rule)(
14184
- "boundaryEffect",
14185
- [(0, import_datalog3.variable)("e"), (0, import_datalog3.variable)("kind"), (0, import_datalog3.variable)("target")],
14186
- [
14187
- (0, import_datalog3.lit)("reachFrom", (0, import_datalog3.variable)("e"), (0, import_datalog3.variable)("u")),
14188
- (0, import_datalog3.lit)("unitEffect", (0, import_datalog3.variable)("u"), (0, import_datalog3.variable)("kind"), (0, import_datalog3.variable)("target"))
14189
- ]
14190
- )
14191
- ];
14192
- function bindingLabel(binding) {
14193
- const semantics = binding.semantics;
14194
- if (semantics.name === "rest") {
14195
- return `${semantics.method} ${semantics.path}`;
14196
- }
14197
- if (semantics.name === "storage") {
14198
- return `${semantics.storageSystem}:${semantics.container}`;
14199
- }
14200
- if (semantics.name === "message-bus") {
14201
- return `${semantics.messageBus}:${semantics.channel}`;
14202
- }
14203
- if (semantics.name === "runtime-config") {
14204
- return semantics.instanceName;
14205
- }
14206
- if (semantics.name === "graphql-resolver") {
14207
- return `${semantics.typeName}.${semantics.fieldName}`;
14208
- }
14209
- if (semantics.name === "graphql-operation") {
14210
- return `${semantics.operationType} ${semantics.operationName ?? ""}`.trim();
14211
- }
14212
- if ("exportName" in semantics || "module" in semantics) {
14213
- return semantics.exportName ?? semantics.module ?? binding.recognition;
14214
- }
14215
- if ("instanceName" in semantics && semantics.instanceName !== null) {
14216
- return `${semantics.deploymentTarget}:${semantics.instanceName}`;
14217
- }
14218
- return binding.recognition;
14219
- }
14220
- function effectFact(effect) {
14221
- if (effect.type === "invocation") {
14222
- return { kind: "invocation", target: effect.callee };
14223
- }
14224
- if (effect.type === "mutation") {
14225
- return { kind: "mutation", target: `${effect.operation}:${effect.target}` };
14226
- }
14227
- if (effect.type === "emission") {
14228
- return { kind: "emission", target: effect.event };
14229
- }
14230
- if (effect.type === "stateChange") {
14231
- return { kind: "stateChange", target: effect.variable };
14232
- }
14233
- if (effect.type === "interaction") {
14234
- return { kind: "interaction", target: bindingLabel(effect.binding) };
14235
- }
14236
- return null;
14237
- }
14238
- function deriveBoundaryEffects(summaries, facts) {
14239
- const { db, unitKeyBySummary } = facts;
14240
- for (const summary of summaries) {
14241
- const key = unitKeyBySummary.get(summary);
14242
- if (key === void 0) {
14243
- continue;
14244
- }
14245
- for (const transition of summary.transitions) {
14246
- for (const effect of transition.effects) {
14247
- const fact2 = effectFact(effect);
14248
- if (fact2 !== null) {
14249
- db.add("unitEffect", [key, fact2.kind, fact2.target]);
14250
- }
14251
- }
14252
- }
14253
- }
14254
- (0, import_datalog3.evaluate)(db, EFFECT_RULES);
14255
- const ownByEntry = /* @__PURE__ */ new Map();
14256
- for (const [unit, kind, target] of db.facts("unitEffect")) {
14257
- const bucket = ownByEntry.get(String(unit)) ?? /* @__PURE__ */ new Set();
14258
- bucket.add(`${kind}\0${target}`);
14259
- ownByEntry.set(String(unit), bucket);
14260
- }
14261
- const closureByEntry = /* @__PURE__ */ new Map();
14262
- for (const [entry, kind, target] of db.facts("boundaryEffect")) {
14263
- const entryKey2 = String(entry);
14264
- const bucket = closureByEntry.get(entryKey2) ?? [];
14265
- bucket.push({
14266
- kind: String(kind),
14267
- target: String(target),
14268
- transitive: !(ownByEntry.get(entryKey2)?.has(`${kind}\0${target}`) ?? false)
14269
- });
14270
- closureByEntry.set(entryKey2, bucket);
14271
- }
14272
- for (const summary of summaries) {
14273
- const key = unitKeyBySummary.get(summary);
14274
- if (key === void 0 || !db.has("entry", [key])) {
14275
- continue;
14276
- }
14277
- const effects = closureByEntry.get(key);
14278
- if (effects === void 0 || effects.length === 0) {
14279
- continue;
14280
- }
14281
- const sorted = [...effects].sort(
14282
- (a, b) => `${a.kind}:${a.target}`.localeCompare(`${b.kind}:${b.target}`)
14283
- );
14284
- summary.metadata = { ...summary.metadata, effectsClosure: sorted };
14285
- }
14286
- return summaries;
14287
- }
14288
-
14289
14230
  // src/resolve/reachableClosure.ts
14290
- var import_ts_morph63 = require("ts-morph");
14231
+ var import_ts_morph64 = require("ts-morph");
14291
14232
  var import_behavioral_ir6 = require("@suss/behavioral-ir");
14292
- var import_datalog4 = require("@suss/datalog");
14233
+ var import_datalog3 = require("@suss/datalog");
14293
14234
  var import_extractor8 = require("@suss/extractor");
14294
14235
  var GENERIC_TERMINALS = [
14295
14236
  { kind: "return", match: { type: "returnStatement" }, extraction: {} },
@@ -14320,7 +14261,7 @@ function targetOf(node) {
14320
14261
  };
14321
14262
  }
14322
14263
  function resolveCallee(call, calleeName, scan) {
14323
- if (!import_ts_morph63.Node.isCallExpression(call)) {
14264
+ if (!import_ts_morph64.Node.isCallExpression(call)) {
14324
14265
  return null;
14325
14266
  }
14326
14267
  const callee = call.getExpression();
@@ -14333,7 +14274,7 @@ function resolveCallee(call, calleeName, scan) {
14333
14274
  }
14334
14275
  }
14335
14276
  const resolveSources = scan.resolveCallableSources;
14336
- if (resolveSources !== void 0 && import_ts_morph63.Node.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
14277
+ if (resolveSources !== void 0 && import_ts_morph64.Node.isPropertyAccessExpression(callee) && declarations.some(isDeclaredShape)) {
14337
14278
  const sources = resolveSources(callee, scan.reachedFrom);
14338
14279
  const only = sources.length === 1 ? sources[0] : void 0;
14339
14280
  const resolved = only === void 0 ? null : resolveDecl(only, calleeName);
@@ -14379,11 +14320,11 @@ function passedPositionKey(target, position) {
14379
14320
  return `${offsetKeyFor(target.file, target.span)}#${position}`;
14380
14321
  }
14381
14322
  function resolveJsxReference(node, scan) {
14382
- if (!import_ts_morph63.Node.isJsxOpeningElement(node) && !import_ts_morph63.Node.isJsxSelfClosingElement(node)) {
14323
+ if (!import_ts_morph64.Node.isJsxOpeningElement(node) && !import_ts_morph64.Node.isJsxSelfClosingElement(node)) {
14383
14324
  return null;
14384
14325
  }
14385
14326
  const tag = node.getTagNameNode();
14386
- if (!import_ts_morph63.Node.isIdentifier(tag) || !/^[A-Z]/.test(tag.getText())) {
14327
+ if (!import_ts_morph64.Node.isIdentifier(tag) || !/^[A-Z]/.test(tag.getText())) {
14387
14328
  return null;
14388
14329
  }
14389
14330
  const name = tag.getText();
@@ -14429,12 +14370,12 @@ function collectReachable(func, scan) {
14429
14370
  candidates.push(outcome.candidate);
14430
14371
  };
14431
14372
  const recordPassedArgs = (call, calleeText, calleeOutcome) => {
14432
- if (!import_ts_morph63.Node.isCallExpression(call)) {
14373
+ if (!import_ts_morph64.Node.isCallExpression(call)) {
14433
14374
  return;
14434
14375
  }
14435
14376
  const calleeTarget = declaredAtOf(calleeOutcome);
14436
14377
  call.getArguments().forEach((arg, position) => {
14437
- if (!import_ts_morph63.Node.isIdentifier(arg)) {
14378
+ if (!import_ts_morph64.Node.isIdentifier(arg)) {
14438
14379
  return;
14439
14380
  }
14440
14381
  const resolved = functionTargetOf(arg);
@@ -14454,7 +14395,7 @@ function collectReachable(func, scan) {
14454
14395
  record2(jsx.outcome);
14455
14396
  return;
14456
14397
  }
14457
- if (!import_ts_morph63.Node.isCallExpression(node)) {
14398
+ if (!import_ts_morph64.Node.isCallExpression(node)) {
14458
14399
  return;
14459
14400
  }
14460
14401
  const calleeText = normalizeCallee(node.getExpression().getText());
@@ -14506,13 +14447,13 @@ function extractReachableSummary(candidate, options, recognizers) {
14506
14447
  return (0, import_extractor8.assembleSummary)(raw, options);
14507
14448
  }
14508
14449
  var REACHABLE_RULES = [
14509
- (0, import_datalog4.rule)("reachable", [(0, import_datalog4.variable)("f")], [(0, import_datalog4.lit)("entry", (0, import_datalog4.variable)("f"))]),
14510
- (0, import_datalog4.rule)(
14450
+ (0, import_datalog3.rule)("reachable", [(0, import_datalog3.variable)("f")], [(0, import_datalog3.lit)("entry", (0, import_datalog3.variable)("f"))]),
14451
+ (0, import_datalog3.rule)(
14511
14452
  "reachable",
14512
- [(0, import_datalog4.variable)("g")],
14453
+ [(0, import_datalog3.variable)("g")],
14513
14454
  [
14514
- (0, import_datalog4.lit)("reachable", (0, import_datalog4.variable)("f")),
14515
- (0, import_datalog4.lit)("calls", (0, import_datalog4.variable)("f"), (0, import_datalog4.variable)("g"))
14455
+ (0, import_datalog3.lit)("reachable", (0, import_datalog3.variable)("f")),
14456
+ (0, import_datalog3.lit)("calls", (0, import_datalog3.variable)("f"), (0, import_datalog3.variable)("g"))
14516
14457
  ]
14517
14458
  )
14518
14459
  ];
@@ -14540,7 +14481,7 @@ function recognizerOnlyRoots(packsByFile) {
14540
14481
  }
14541
14482
  for (const declaration of variableStatement.getDeclarations()) {
14542
14483
  const init = declaration.getInitializer();
14543
- if (init !== void 0 && (import_ts_morph63.Node.isArrowFunction(init) || import_ts_morph63.Node.isFunctionExpression(init)) && hasBody(init)) {
14484
+ if (init !== void 0 && (import_ts_morph64.Node.isArrowFunction(init) || import_ts_morph64.Node.isFunctionExpression(init)) && hasBody(init)) {
14544
14485
  roots.push({ func: init, name: declaration.getName() });
14545
14486
  }
14546
14487
  }
@@ -14550,7 +14491,7 @@ function recognizerOnlyRoots(packsByFile) {
14550
14491
  }
14551
14492
  function expandReachableClosure(seeds, project, options, projectFileSet, facts, recognizers = NO_RECOGNIZERS, alreadySummarized = [], extraRoots = []) {
14552
14493
  const lookup = createSourceFileLookup(project);
14553
- const db = facts?.db ?? new import_datalog4.Database();
14494
+ const db = facts?.db ?? new import_datalog3.Database();
14554
14495
  const functionByKey = /* @__PURE__ */ new Map();
14555
14496
  const seedKeys = /* @__PURE__ */ new Set();
14556
14497
  const scanned = /* @__PURE__ */ new Set();
@@ -14589,7 +14530,7 @@ function expandReachableClosure(seeds, project, options, projectFileSet, facts,
14589
14530
  }
14590
14531
  }
14591
14532
  for (; ; ) {
14592
- (0, import_datalog4.evaluate)(db, REACHABLE_RULES);
14533
+ (0, import_datalog3.evaluate)(db, REACHABLE_RULES);
14593
14534
  const frontier = db.facts("reachable").map(([key]) => String(key)).filter((key) => !scanned.has(key));
14594
14535
  if (frontier.length === 0) {
14595
14536
  break;
@@ -14794,21 +14735,21 @@ function recordParameterGaps(parameterCallsByKey, summariesByKey, passedPosition
14794
14735
  }
14795
14736
 
14796
14737
  // src/resolve/rethrowEnrichment.ts
14797
- var import_ts_morph64 = require("ts-morph");
14798
- var import_datalog5 = require("@suss/datalog");
14738
+ var import_ts_morph65 = require("ts-morph");
14739
+ var import_datalog4 = require("@suss/datalog");
14799
14740
  var RETHROW_RULES = [
14800
- (0, import_datalog5.rule)(
14741
+ (0, import_datalog4.rule)(
14801
14742
  "contributes",
14802
- [(0, import_datalog5.variable)("u"), (0, import_datalog5.variable)("s")],
14803
- [(0, import_datalog5.lit)("throwsDirect", (0, import_datalog5.variable)("u"), (0, import_datalog5.variable)("s"))]
14743
+ [(0, import_datalog4.variable)("u"), (0, import_datalog4.variable)("s")],
14744
+ [(0, import_datalog4.lit)("throwsDirect", (0, import_datalog4.variable)("u"), (0, import_datalog4.variable)("s"))]
14804
14745
  ),
14805
- (0, import_datalog5.rule)(
14746
+ (0, import_datalog4.rule)(
14806
14747
  "contributes",
14807
- [(0, import_datalog5.variable)("u"), (0, import_datalog5.variable)("s")],
14748
+ [(0, import_datalog4.variable)("u"), (0, import_datalog4.variable)("s")],
14808
14749
  [
14809
- (0, import_datalog5.lit)("rethrowSite", (0, import_datalog5.variable)("u"), (0, import_datalog5.variable)("site")),
14810
- (0, import_datalog5.lit)("siteCalls", (0, import_datalog5.variable)("site"), (0, import_datalog5.variable)("c")),
14811
- (0, import_datalog5.lit)("contributes", (0, import_datalog5.variable)("c"), (0, import_datalog5.variable)("s"))
14750
+ (0, import_datalog4.lit)("rethrowSite", (0, import_datalog4.variable)("u"), (0, import_datalog4.variable)("site")),
14751
+ (0, import_datalog4.lit)("siteCalls", (0, import_datalog4.variable)("site"), (0, import_datalog4.variable)("c")),
14752
+ (0, import_datalog4.lit)("contributes", (0, import_datalog4.variable)("c"), (0, import_datalog4.variable)("s"))
14812
14753
  ]
14813
14754
  )
14814
14755
  ];
@@ -14820,7 +14761,7 @@ function enrichRethrows(summaries, project, facts) {
14820
14761
  summary.location.range.start,
14821
14762
  summary.location.range.end
14822
14763
  ));
14823
- const db = facts?.db ?? new import_datalog5.Database();
14764
+ const db = facts?.db ?? new import_datalog4.Database();
14824
14765
  const sourceById = /* @__PURE__ */ new Map();
14825
14766
  const nameByUnit = /* @__PURE__ */ new Map();
14826
14767
  const targets = [];
@@ -14870,7 +14811,7 @@ function enrichRethrows(summaries, project, facts) {
14870
14811
  }
14871
14812
  }
14872
14813
  }
14873
- (0, import_datalog5.evaluate)(db, RETHROW_RULES);
14814
+ (0, import_datalog4.evaluate)(db, RETHROW_RULES);
14874
14815
  const contributesByUnit = /* @__PURE__ */ new Map();
14875
14816
  for (const [unit, sourceId] of db.facts("contributes")) {
14876
14817
  const bucket = contributesByUnit.get(String(unit));
@@ -14931,7 +14872,7 @@ function findBareRethrow(func, location) {
14931
14872
  traversal.stop();
14932
14873
  return;
14933
14874
  }
14934
- if (!import_ts_morph64.Node.isThrowStatement(node)) {
14875
+ if (!import_ts_morph65.Node.isThrowStatement(node)) {
14935
14876
  return;
14936
14877
  }
14937
14878
  if (startLineOf(node) !== location.start) {
@@ -14941,7 +14882,7 @@ function findBareRethrow(func, location) {
14941
14882
  return;
14942
14883
  }
14943
14884
  const thrown = node.getExpression();
14944
- if (thrown !== void 0 && import_ts_morph64.Node.isIdentifier(thrown)) {
14885
+ if (thrown !== void 0 && import_ts_morph65.Node.isIdentifier(thrown)) {
14945
14886
  found = node;
14946
14887
  }
14947
14888
  });
@@ -14951,13 +14892,13 @@ function enclosingTry(throwStmt) {
14951
14892
  let current2 = throwStmt.getParent();
14952
14893
  let sawCatchClause = false;
14953
14894
  while (current2 !== void 0) {
14954
- if (import_ts_morph64.Node.isCatchClause(current2)) {
14895
+ if (import_ts_morph65.Node.isCatchClause(current2)) {
14955
14896
  sawCatchClause = true;
14956
14897
  }
14957
- if (import_ts_morph64.Node.isTryStatement(current2)) {
14898
+ if (import_ts_morph65.Node.isTryStatement(current2)) {
14958
14899
  return sawCatchClause ? current2 : null;
14959
14900
  }
14960
- if (import_ts_morph64.Node.isFunctionDeclaration(current2) || import_ts_morph64.Node.isFunctionExpression(current2) || import_ts_morph64.Node.isArrowFunction(current2) || import_ts_morph64.Node.isMethodDeclaration(current2)) {
14901
+ if (import_ts_morph65.Node.isFunctionDeclaration(current2) || import_ts_morph65.Node.isFunctionExpression(current2) || import_ts_morph65.Node.isArrowFunction(current2) || import_ts_morph65.Node.isMethodDeclaration(current2)) {
14961
14902
  return null;
14962
14903
  }
14963
14904
  current2 = current2.getParent();
@@ -14965,14 +14906,14 @@ function enclosingTry(throwStmt) {
14965
14906
  return null;
14966
14907
  }
14967
14908
  function collectTryBodyCallees(tryStmt, index, keyFor) {
14968
- if (!import_ts_morph64.Node.isTryStatement(tryStmt)) {
14909
+ if (!import_ts_morph65.Node.isTryStatement(tryStmt)) {
14969
14910
  return [];
14970
14911
  }
14971
14912
  const tryBlock = tryStmt.getTryBlock();
14972
14913
  const callees = [];
14973
14914
  const seen = /* @__PURE__ */ new Set();
14974
14915
  tryBlock.forEachDescendant((node) => {
14975
- if (!import_ts_morph64.Node.isCallExpression(node)) {
14916
+ if (!import_ts_morph65.Node.isCallExpression(node)) {
14976
14917
  return;
14977
14918
  }
14978
14919
  const calleeSummary = resolveCalleeSummary(node, index);
@@ -14989,7 +14930,7 @@ function collectTryBodyCallees(tryStmt, index, keyFor) {
14989
14930
  return callees;
14990
14931
  }
14991
14932
  function resolveCalleeSummary(call, index) {
14992
- if (!import_ts_morph64.Node.isCallExpression(call)) {
14933
+ if (!import_ts_morph65.Node.isCallExpression(call)) {
14993
14934
  return null;
14994
14935
  }
14995
14936
  const callee = call.getExpression();
@@ -15019,12 +14960,12 @@ function resolveCalleeSummary(call, index) {
15019
14960
  return null;
15020
14961
  }
15021
14962
  function functionFromDecl(decl) {
15022
- if (import_ts_morph64.Node.isFunctionDeclaration(decl) || import_ts_morph64.Node.isFunctionExpression(decl) || import_ts_morph64.Node.isArrowFunction(decl) || import_ts_morph64.Node.isMethodDeclaration(decl)) {
14963
+ if (import_ts_morph65.Node.isFunctionDeclaration(decl) || import_ts_morph65.Node.isFunctionExpression(decl) || import_ts_morph65.Node.isArrowFunction(decl) || import_ts_morph65.Node.isMethodDeclaration(decl)) {
15023
14964
  return decl;
15024
14965
  }
15025
- if (import_ts_morph64.Node.isVariableDeclaration(decl)) {
14966
+ if (import_ts_morph65.Node.isVariableDeclaration(decl)) {
15026
14967
  const init = decl.getInitializer();
15027
- if (init !== void 0 && (import_ts_morph64.Node.isArrowFunction(init) || import_ts_morph64.Node.isFunctionExpression(init))) {
14968
+ if (init !== void 0 && (import_ts_morph65.Node.isArrowFunction(init) || import_ts_morph65.Node.isFunctionExpression(init))) {
15028
14969
  return init;
15029
14970
  }
15030
14971
  }
@@ -15032,22 +14973,22 @@ function functionFromDecl(decl) {
15032
14973
  }
15033
14974
 
15034
14975
  // src/shapes/fieldAccesses.ts
15035
- var import_ts_morph65 = require("ts-morph");
14976
+ var import_ts_morph66 = require("ts-morph");
15036
14977
  function findResponseAccessor(callExpr) {
15037
14978
  let current2 = callExpr;
15038
14979
  const parent1 = current2.getParent();
15039
- if (parent1 !== void 0 && import_ts_morph65.Node.isAwaitExpression(parent1)) {
14980
+ if (parent1 !== void 0 && import_ts_morph66.Node.isAwaitExpression(parent1)) {
15040
14981
  current2 = parent1;
15041
14982
  }
15042
14983
  const parent2 = current2.getParent();
15043
- if (parent2 === void 0 || !import_ts_morph65.Node.isVariableDeclaration(parent2)) {
14984
+ if (parent2 === void 0 || !import_ts_morph66.Node.isVariableDeclaration(parent2)) {
15044
14985
  return null;
15045
14986
  }
15046
14987
  const nameNode = parent2.getNameNode();
15047
- if (import_ts_morph65.Node.isIdentifier(nameNode)) {
14988
+ if (import_ts_morph66.Node.isIdentifier(nameNode)) {
15048
14989
  return { kind: "identifier", name: nameNode.getText() };
15049
14990
  }
15050
- if (import_ts_morph65.Node.isObjectBindingPattern(nameNode)) {
14991
+ if (import_ts_morph66.Node.isObjectBindingPattern(nameNode)) {
15051
14992
  const bindings = /* @__PURE__ */ new Map();
15052
14993
  for (const element of nameNode.getElements()) {
15053
14994
  if (element.getDotDotDotToken() !== void 0) {
@@ -15068,11 +15009,11 @@ function findResponseAccessor(callExpr) {
15068
15009
  function buildThenChainAccessor(callExpr, func) {
15069
15010
  const bindings = /* @__PURE__ */ new Map();
15070
15011
  func.forEachDescendant((node) => {
15071
- if (!import_ts_morph65.Node.isParameterDeclaration(node)) {
15012
+ if (!import_ts_morph66.Node.isParameterDeclaration(node)) {
15072
15013
  return;
15073
15014
  }
15074
15015
  const nameNode = node.getNameNode();
15075
- if (!import_ts_morph65.Node.isIdentifier(nameNode)) {
15016
+ if (!import_ts_morph66.Node.isIdentifier(nameNode)) {
15076
15017
  return;
15077
15018
  }
15078
15019
  const prefix = prefixOfThenParam(node, callExpr, 0);
@@ -15104,7 +15045,7 @@ function prefixOfExpr(expr, responseCall, depth) {
15104
15045
  if (node === responseCall) {
15105
15046
  return [];
15106
15047
  }
15107
- if (import_ts_morph65.Node.isCallExpression(node)) {
15048
+ if (import_ts_morph66.Node.isCallExpression(node)) {
15108
15049
  const hop = thenLikeCall(node);
15109
15050
  if (hop !== null) {
15110
15051
  if (hop.method === "catch") {
@@ -15136,14 +15077,14 @@ function prefixOfMemberExpr(expr, responseCall, depth) {
15136
15077
  return null;
15137
15078
  }
15138
15079
  const decl = chain.root.getSymbol()?.getDeclarations()?.[0];
15139
- if (decl === void 0 || !import_ts_morph65.Node.isParameterDeclaration(decl)) {
15080
+ if (decl === void 0 || !import_ts_morph66.Node.isParameterDeclaration(decl)) {
15140
15081
  return null;
15141
15082
  }
15142
15083
  const base = prefixOfThenParam(decl, responseCall, depth + 1);
15143
15084
  return base === null ? null : [...base, ...chain.segments];
15144
15085
  }
15145
15086
  function firstCallbackParamName(callback) {
15146
- if (callback === void 0 || !(import_ts_morph65.Node.isArrowFunction(callback) || import_ts_morph65.Node.isFunctionExpression(callback))) {
15087
+ if (callback === void 0 || !(import_ts_morph66.Node.isArrowFunction(callback) || import_ts_morph66.Node.isFunctionExpression(callback))) {
15147
15088
  return null;
15148
15089
  }
15149
15090
  const param = callback.getParameters()[0];
@@ -15151,11 +15092,11 @@ function firstCallbackParamName(callback) {
15151
15092
  return null;
15152
15093
  }
15153
15094
  const nameNode = param.getNameNode();
15154
- return import_ts_morph65.Node.isIdentifier(nameNode) ? nameNode.getText() : null;
15095
+ return import_ts_morph66.Node.isIdentifier(nameNode) ? nameNode.getText() : null;
15155
15096
  }
15156
15097
  function unwrap(expr) {
15157
15098
  let node = expr;
15158
- while (import_ts_morph65.Node.isAwaitExpression(node) || import_ts_morph65.Node.isParenthesizedExpression(node) || import_ts_morph65.Node.isAsExpression(node)) {
15099
+ while (import_ts_morph66.Node.isAwaitExpression(node) || import_ts_morph66.Node.isParenthesizedExpression(node) || import_ts_morph66.Node.isAsExpression(node)) {
15159
15100
  node = node.getExpression();
15160
15101
  }
15161
15102
  return node;
@@ -15165,15 +15106,15 @@ function chainRootedAt(expr, rootName) {
15165
15106
  if (chain === null) {
15166
15107
  return null;
15167
15108
  }
15168
- return import_ts_morph65.Node.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
15109
+ return import_ts_morph66.Node.isIdentifier(chain.root) && chain.root.getText() === rootName ? chain.segments : null;
15169
15110
  }
15170
15111
  function memberChain(expr) {
15171
- let node = import_ts_morph65.Node.isExpression(expr) ? unwrap(expr) : expr;
15172
- if (import_ts_morph65.Node.isCallExpression(node)) {
15112
+ let node = import_ts_morph66.Node.isExpression(expr) ? unwrap(expr) : expr;
15113
+ if (import_ts_morph66.Node.isCallExpression(node)) {
15173
15114
  node = node.getExpression();
15174
15115
  }
15175
15116
  const segments = [];
15176
- while (import_ts_morph65.Node.isPropertyAccessExpression(node)) {
15117
+ while (import_ts_morph66.Node.isPropertyAccessExpression(node)) {
15177
15118
  segments.unshift(node.getName());
15178
15119
  node = node.getExpression();
15179
15120
  }
@@ -15192,16 +15133,16 @@ function collectPropertyAccesses(subtree, accessor) {
15192
15133
  if (accessor.kind === "identifier") {
15193
15134
  const varName = accessor.name;
15194
15135
  subtree.forEachDescendant((node) => {
15195
- if (!import_ts_morph65.Node.isPropertyAccessExpression(node)) {
15136
+ if (!import_ts_morph66.Node.isPropertyAccessExpression(node)) {
15196
15137
  return;
15197
15138
  }
15198
15139
  const chain = [];
15199
15140
  let current2 = node;
15200
- while (import_ts_morph65.Node.isPropertyAccessExpression(current2)) {
15141
+ while (import_ts_morph66.Node.isPropertyAccessExpression(current2)) {
15201
15142
  chain.unshift(current2.getName());
15202
15143
  current2 = current2.getExpression();
15203
15144
  }
15204
- if (import_ts_morph65.Node.isIdentifier(current2) && current2.getText() === varName) {
15145
+ if (import_ts_morph66.Node.isIdentifier(current2) && current2.getText() === varName) {
15205
15146
  pushChain(chain);
15206
15147
  }
15207
15148
  });
@@ -15212,7 +15153,7 @@ function collectPropertyAccesses(subtree, accessor) {
15212
15153
  return source === void 0 ? void 0 : [source];
15213
15154
  } : (name) => accessor.bindings.get(name);
15214
15155
  subtree.forEachDescendant((node) => {
15215
- if (!import_ts_morph65.Node.isIdentifier(node)) {
15156
+ if (!import_ts_morph66.Node.isIdentifier(node)) {
15216
15157
  return;
15217
15158
  }
15218
15159
  const prefix = prefixOf(node.getText());
@@ -15224,13 +15165,13 @@ function collectPropertyAccesses(subtree, accessor) {
15224
15165
  }
15225
15166
  let chainTop = node;
15226
15167
  let parent = chainTop.getParent();
15227
- while (parent !== void 0 && import_ts_morph65.Node.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
15168
+ while (parent !== void 0 && import_ts_morph66.Node.isPropertyAccessExpression(parent) && parent.getExpression() === chainTop) {
15228
15169
  chainTop = parent;
15229
15170
  parent = chainTop.getParent();
15230
15171
  }
15231
15172
  const segments = [];
15232
15173
  let current2 = chainTop;
15233
- while (import_ts_morph65.Node.isPropertyAccessExpression(current2)) {
15174
+ while (import_ts_morph66.Node.isPropertyAccessExpression(current2)) {
15234
15175
  segments.push(current2.getName());
15235
15176
  current2 = current2.getExpression();
15236
15177
  }
@@ -15244,15 +15185,15 @@ function isBindingDeclarationSite(node) {
15244
15185
  return true;
15245
15186
  }
15246
15187
  const parent = node.getParent();
15247
- return parent !== void 0 && import_ts_morph65.Node.isParameterDeclaration(parent) && parent.getNameNode() === node;
15188
+ return parent !== void 0 && import_ts_morph66.Node.isParameterDeclaration(parent) && parent.getNameNode() === node;
15248
15189
  }
15249
15190
  function isInsideObjectBindingPattern(node) {
15250
15191
  let current2 = node.getParent();
15251
15192
  while (current2 !== void 0) {
15252
- if (import_ts_morph65.Node.isObjectBindingPattern(current2)) {
15193
+ if (import_ts_morph66.Node.isObjectBindingPattern(current2)) {
15253
15194
  return true;
15254
15195
  }
15255
- if (import_ts_morph65.Node.isFunctionLikeDeclaration(current2) || import_ts_morph65.Node.isVariableStatement(current2)) {
15196
+ if (import_ts_morph66.Node.isFunctionLikeDeclaration(current2) || import_ts_morph66.Node.isVariableStatement(current2)) {
15256
15197
  break;
15257
15198
  }
15258
15199
  current2 = current2.getParent();
@@ -15315,7 +15256,7 @@ function findBranchSubtree(func, byLineRange, terminalStartLine, terminalEndLine
15315
15256
  if (parent === void 0) {
15316
15257
  break;
15317
15258
  }
15318
- if (import_ts_morph65.Node.isIfStatement(parent)) {
15259
+ if (import_ts_morph66.Node.isIfStatement(parent)) {
15319
15260
  const ifStmt = parent;
15320
15261
  const thenBlock = ifStmt.getThenStatement();
15321
15262
  const elseBlock = ifStmt.getElseStatement();
@@ -15377,7 +15318,7 @@ function buildNonBodyPropertySet(semantics) {
15377
15318
  }
15378
15319
 
15379
15320
  // src/subUnitContext.ts
15380
- var import_ts_morph66 = require("ts-morph");
15321
+ var import_ts_morph67 = require("ts-morph");
15381
15322
  function createTsSubUnitContext() {
15382
15323
  return {
15383
15324
  findJsxAttributes,
@@ -15404,18 +15345,18 @@ function findJsxAttributes(parent) {
15404
15345
  if (skip(node, traversal)) {
15405
15346
  return;
15406
15347
  }
15407
- if (!import_ts_morph66.Node.isJsxOpeningElement(node) && !import_ts_morph66.Node.isJsxSelfClosingElement(node)) {
15348
+ if (!import_ts_morph67.Node.isJsxOpeningElement(node) && !import_ts_morph67.Node.isJsxSelfClosingElement(node)) {
15408
15349
  return;
15409
15350
  }
15410
15351
  const tag = node.getTagNameNode().getText();
15411
15352
  for (const attr of node.getAttributes()) {
15412
- if (!import_ts_morph66.Node.isJsxAttribute(attr)) {
15353
+ if (!import_ts_morph67.Node.isJsxAttribute(attr)) {
15413
15354
  continue;
15414
15355
  }
15415
15356
  const initializer = attr.getInitializer();
15416
15357
  let valueExpression = null;
15417
15358
  if (initializer !== void 0) {
15418
- if (import_ts_morph66.Node.isJsxExpression(initializer)) {
15359
+ if (import_ts_morph67.Node.isJsxExpression(initializer)) {
15419
15360
  const inner = initializer.getExpression();
15420
15361
  valueExpression = inner ?? null;
15421
15362
  } else {
@@ -15438,11 +15379,11 @@ function findCallExpressionsByName(parent, name) {
15438
15379
  if (skip(node, traversal)) {
15439
15380
  return;
15440
15381
  }
15441
- if (!import_ts_morph66.Node.isCallExpression(node)) {
15382
+ if (!import_ts_morph67.Node.isCallExpression(node)) {
15442
15383
  return;
15443
15384
  }
15444
15385
  const callee = node.getExpression();
15445
- if (import_ts_morph66.Node.isIdentifier(callee) && callee.getText() === name) {
15386
+ if (import_ts_morph67.Node.isIdentifier(callee) && callee.getText() === name) {
15446
15387
  out.push(node);
15447
15388
  }
15448
15389
  });
@@ -15453,10 +15394,10 @@ function resolveAttributeValueFunction(attr, parent) {
15453
15394
  if (expr === null) {
15454
15395
  return null;
15455
15396
  }
15456
- if (import_ts_morph66.Node.isArrowFunction(expr) || import_ts_morph66.Node.isFunctionExpression(expr)) {
15397
+ if (import_ts_morph67.Node.isArrowFunction(expr) || import_ts_morph67.Node.isFunctionExpression(expr)) {
15457
15398
  return { func: expr, localName: null };
15458
15399
  }
15459
- if (import_ts_morph66.Node.isIdentifier(expr)) {
15400
+ if (import_ts_morph67.Node.isIdentifier(expr)) {
15460
15401
  const symbol = expr.getSymbol();
15461
15402
  if (symbol === void 0) {
15462
15403
  return null;
@@ -15475,15 +15416,15 @@ function resolveAttributeValueFunction(attr, parent) {
15475
15416
  return null;
15476
15417
  }
15477
15418
  function tryExtractFunction(decl) {
15478
- if (import_ts_morph66.Node.isFunctionDeclaration(decl)) {
15419
+ if (import_ts_morph67.Node.isFunctionDeclaration(decl)) {
15479
15420
  return decl;
15480
15421
  }
15481
- if (import_ts_morph66.Node.isVariableDeclaration(decl)) {
15422
+ if (import_ts_morph67.Node.isVariableDeclaration(decl)) {
15482
15423
  const init = decl.getInitializer();
15483
15424
  if (init === void 0) {
15484
15425
  return null;
15485
15426
  }
15486
- if (import_ts_morph66.Node.isArrowFunction(init) || import_ts_morph66.Node.isFunctionExpression(init)) {
15427
+ if (import_ts_morph67.Node.isArrowFunction(init) || import_ts_morph67.Node.isFunctionExpression(init)) {
15487
15428
  return init;
15488
15429
  }
15489
15430
  }
@@ -15504,7 +15445,7 @@ function getCallArgumentFunction(call, position) {
15504
15445
  if (arg === void 0) {
15505
15446
  return null;
15506
15447
  }
15507
- if (import_ts_morph66.Node.isArrowFunction(arg) || import_ts_morph66.Node.isFunctionExpression(arg)) {
15448
+ if (import_ts_morph67.Node.isArrowFunction(arg) || import_ts_morph67.Node.isFunctionExpression(arg)) {
15508
15449
  return arg;
15509
15450
  }
15510
15451
  return null;
@@ -15516,7 +15457,7 @@ function readArrayLiteralText(node) {
15516
15457
  if (node === null) {
15517
15458
  return null;
15518
15459
  }
15519
- if (import_ts_morph66.Node.isArrayLiteralExpression(node)) {
15460
+ if (import_ts_morph67.Node.isArrayLiteralExpression(node)) {
15520
15461
  return node.getElements().map((e) => e.getText());
15521
15462
  }
15522
15463
  return [node.getText()];
@@ -15765,13 +15706,13 @@ var raise = (msg) => {
15765
15706
  throw new Error(msg);
15766
15707
  };
15767
15708
  function bindingPatternNames(nameNode) {
15768
- if (import_ts_morph67.Node.isObjectBindingPattern(nameNode)) {
15709
+ if (import_ts_morph68.Node.isObjectBindingPattern(nameNode)) {
15769
15710
  return nameNode.getElements().map((e) => e.getName());
15770
15711
  }
15771
- if (import_ts_morph67.Node.isArrayBindingPattern(nameNode)) {
15712
+ if (import_ts_morph68.Node.isArrayBindingPattern(nameNode)) {
15772
15713
  const names = [];
15773
15714
  for (const element of nameNode.getElements()) {
15774
- if (import_ts_morph67.Node.isOmittedExpression(element)) {
15715
+ if (import_ts_morph68.Node.isOmittedExpression(element)) {
15775
15716
  continue;
15776
15717
  }
15777
15718
  names.push(element.getName());
@@ -15801,7 +15742,7 @@ function objectParamInputs(param, position, mapping) {
15801
15742
  }
15802
15743
  function componentPropsParameters(param, mapping) {
15803
15744
  const nameNode = param.getNameNode();
15804
- if (!import_ts_morph67.Node.isObjectBindingPattern(nameNode)) {
15745
+ if (!import_ts_morph68.Node.isObjectBindingPattern(nameNode)) {
15805
15746
  const type = param.getType();
15806
15747
  return [
15807
15748
  {
@@ -15831,7 +15772,7 @@ function bindingRole(element, name) {
15831
15772
  if (property === void 0) {
15832
15773
  return name;
15833
15774
  }
15834
- if (import_ts_morph67.Node.isStringLiteral(property)) {
15775
+ if (import_ts_morph68.Node.isStringLiteral(property)) {
15835
15776
  return property.getLiteralValue();
15836
15777
  }
15837
15778
  return property.getText();
@@ -15863,7 +15804,7 @@ function extractParameters(func, inputMapping) {
15863
15804
  const param = params[i];
15864
15805
  const nameNode = param.getNameNode();
15865
15806
  const boundNames = bindingPatternNames(nameNode);
15866
- if (import_ts_morph67.Node.isObjectBindingPattern(nameNode)) {
15807
+ if (import_ts_morph68.Node.isObjectBindingPattern(nameNode)) {
15867
15808
  for (const element of nameNode.getElements()) {
15868
15809
  result.push({
15869
15810
  name: element.getName(),
@@ -15930,7 +15871,7 @@ function extractDependencyCalls(func, barriers = NO_BARRIERS) {
15930
15871
  traversal.skip();
15931
15872
  return;
15932
15873
  }
15933
- if (!import_ts_morph67.Node.isVariableDeclaration(node)) {
15874
+ if (!import_ts_morph68.Node.isVariableDeclaration(node)) {
15934
15875
  return;
15935
15876
  }
15936
15877
  const init = node.getInitializer();
@@ -15939,19 +15880,19 @@ function extractDependencyCalls(func, barriers = NO_BARRIERS) {
15939
15880
  }
15940
15881
  let isAsync = false;
15941
15882
  let callExpr = init;
15942
- if (import_ts_morph67.Node.isAwaitExpression(init)) {
15883
+ if (import_ts_morph68.Node.isAwaitExpression(init)) {
15943
15884
  isAsync = true;
15944
15885
  callExpr = init.getExpression();
15945
15886
  }
15946
- if (!import_ts_morph67.Node.isCallExpression(callExpr)) {
15887
+ if (!import_ts_morph68.Node.isCallExpression(callExpr)) {
15947
15888
  return;
15948
15889
  }
15949
15890
  const calleeName = callExpr.getExpression().getText();
15950
15891
  const nameNode = node.getNameNode();
15951
- const assignedTo = import_ts_morph67.Node.isIdentifier(nameNode) ? nameNode.getText() : null;
15892
+ const assignedTo = import_ts_morph68.Node.isIdentifier(nameNode) ? nameNode.getText() : null;
15952
15893
  const declList = node.getParent();
15953
15894
  const varStmt = declList?.getParent();
15954
- const locationNode = varStmt !== void 0 && import_ts_morph67.Node.isVariableStatement(varStmt) ? varStmt : node;
15895
+ const locationNode = varStmt !== void 0 && import_ts_morph68.Node.isVariableStatement(varStmt) ? varStmt : node;
15955
15896
  results.push({
15956
15897
  name: calleeName,
15957
15898
  assignedTo,
@@ -16310,6 +16251,10 @@ function extractBindingPath(binding, callSite, pack, resolution) {
16310
16251
  const arg = callSite.callExpression.getArguments()[p.position];
16311
16252
  return arg === void 0 ? void 0 : pathFromArgument(arg, resolution);
16312
16253
  }
16254
+ if (p.type === "fromArgumentProperty") {
16255
+ const arg = callSite.callExpression.getArguments()[p.position];
16256
+ return arg === void 0 ? void 0 : pathFromProperty(arg, p.property, resolution);
16257
+ }
16313
16258
  return void 0;
16314
16259
  }
16315
16260
  function resolveContractField(callSite, pack, field, resolution) {
@@ -16705,20 +16650,23 @@ function extractFromSourceFile(sourceFile, frameworks, claimedUnits, options, ta
16705
16650
  return summaries;
16706
16651
  }
16707
16652
  function stampWrappers(raw, unit, wrappers) {
16708
- if (wrappers === void 0 || unit.registrationSubjectId === void 0) {
16709
- return;
16710
- }
16711
- const applied = wrappers.wrappersFor(unit.registrationSubjectId);
16653
+ const applied = [
16654
+ ...wrappers === void 0 || unit.registrationSubjectId === void 0 ? [] : wrappers.wrappersFor(unit.registrationSubjectId),
16655
+ ...unit.routeWrappers ?? []
16656
+ ];
16712
16657
  if (applied.length === 0) {
16713
16658
  return;
16714
16659
  }
16715
- raw.wrappers = [...applied];
16660
+ raw.wrappers = applied;
16716
16661
  for (const wrapper of applied) {
16717
16662
  recordFileDependency(wrapper.file);
16718
16663
  }
16719
16664
  }
16720
16665
  function unfollowedStopsOf(unit, wrappers) {
16721
- const stops = unit.unfollowed === void 0 ? [] : [unit.unfollowed];
16666
+ const stops = [
16667
+ ...unit.unfollowed === void 0 ? [] : [unit.unfollowed],
16668
+ ...unit.routeUnfollowed ?? []
16669
+ ];
16722
16670
  if (wrappers === void 0 || unit.registrationSubjectId === void 0) {
16723
16671
  return stops;
16724
16672
  }
@@ -16865,9 +16813,9 @@ function findWrapperPathParam(summary, lookup) {
16865
16813
  if (names.length === 0) {
16866
16814
  return null;
16867
16815
  }
16868
- for (const call of func.getDescendantsOfKind(import_ts_morph67.SyntaxKind.CallExpression)) {
16816
+ for (const call of func.getDescendantsOfKind(import_ts_morph68.SyntaxKind.CallExpression)) {
16869
16817
  const first = call.getArguments()[0];
16870
- if (first === void 0 || !import_ts_morph67.Node.isIdentifier(first)) {
16818
+ if (first === void 0 || !import_ts_morph68.Node.isIdentifier(first)) {
16871
16819
  continue;
16872
16820
  }
16873
16821
  const at = names.indexOf(first.getText());
@@ -16916,16 +16864,16 @@ function synthesizeCallerSummaries(wrapper, _project, options, resolution) {
16916
16864
  return out;
16917
16865
  }
16918
16866
  function wrapperNameNode(func) {
16919
- if (import_ts_morph67.Node.isFunctionDeclaration(func) || import_ts_morph67.Node.isMethodDeclaration(func)) {
16867
+ if (import_ts_morph68.Node.isFunctionDeclaration(func) || import_ts_morph68.Node.isMethodDeclaration(func)) {
16920
16868
  const name = func.getNameNode();
16921
- if (name !== void 0 && import_ts_morph67.Node.isIdentifier(name)) {
16869
+ if (name !== void 0 && import_ts_morph68.Node.isIdentifier(name)) {
16922
16870
  return name;
16923
16871
  }
16924
16872
  }
16925
16873
  const parent = func.getParent();
16926
- if (parent !== void 0 && import_ts_morph67.Node.isVariableDeclaration(parent)) {
16874
+ if (parent !== void 0 && import_ts_morph68.Node.isVariableDeclaration(parent)) {
16927
16875
  const nameNode = parent.getNameNode();
16928
- if (import_ts_morph67.Node.isIdentifier(nameNode)) {
16876
+ if (import_ts_morph68.Node.isIdentifier(nameNode)) {
16929
16877
  return nameNode;
16930
16878
  }
16931
16879
  }
@@ -16934,10 +16882,10 @@ function wrapperNameNode(func) {
16934
16882
  function enclosingCall(node) {
16935
16883
  let current2 = node.getParent();
16936
16884
  while (current2 !== void 0) {
16937
- if (import_ts_morph67.Node.isCallExpression(current2)) {
16885
+ if (import_ts_morph68.Node.isCallExpression(current2)) {
16938
16886
  return current2;
16939
16887
  }
16940
- if (import_ts_morph67.Node.isPropertyAccessExpression(current2)) {
16888
+ if (import_ts_morph68.Node.isPropertyAccessExpression(current2)) {
16941
16889
  current2 = current2.getParent();
16942
16890
  continue;
16943
16891
  }
@@ -16948,7 +16896,7 @@ function enclosingCall(node) {
16948
16896
  function enclosingFunction(node) {
16949
16897
  let current2 = node.getParent();
16950
16898
  while (current2 !== void 0) {
16951
- if (import_ts_morph67.Node.isFunctionDeclaration(current2) || import_ts_morph67.Node.isFunctionExpression(current2) || import_ts_morph67.Node.isArrowFunction(current2) || import_ts_morph67.Node.isMethodDeclaration(current2)) {
16899
+ if (import_ts_morph68.Node.isFunctionDeclaration(current2) || import_ts_morph68.Node.isFunctionExpression(current2) || import_ts_morph68.Node.isArrowFunction(current2) || import_ts_morph68.Node.isMethodDeclaration(current2)) {
16952
16900
  return current2;
16953
16901
  }
16954
16902
  current2 = current2.getParent();
@@ -16956,13 +16904,13 @@ function enclosingFunction(node) {
16956
16904
  return null;
16957
16905
  }
16958
16906
  function callerName(func) {
16959
- if (import_ts_morph67.Node.isFunctionDeclaration(func) || import_ts_morph67.Node.isMethodDeclaration(func)) {
16907
+ if (import_ts_morph68.Node.isFunctionDeclaration(func) || import_ts_morph68.Node.isMethodDeclaration(func)) {
16960
16908
  return func.getName() ?? "anonymous";
16961
16909
  }
16962
16910
  const parent = func.getParent();
16963
- if (parent !== void 0 && import_ts_morph67.Node.isVariableDeclaration(parent)) {
16911
+ if (parent !== void 0 && import_ts_morph68.Node.isVariableDeclaration(parent)) {
16964
16912
  const nameNode = parent.getNameNode();
16965
- if (import_ts_morph67.Node.isIdentifier(nameNode)) {
16913
+ if (import_ts_morph68.Node.isIdentifier(nameNode)) {
16966
16914
  return nameNode.getText();
16967
16915
  }
16968
16916
  }
@@ -17061,7 +17009,7 @@ function createTypeScriptAdapter(suppliedConfig) {
17061
17009
  suppliedConfig.projectRoot ?? (suppliedConfig.tsConfigFilePath !== void 0 ? import_node_path11.default.dirname(suppliedConfig.tsConfigFilePath) : void 0)
17062
17010
  )
17063
17011
  };
17064
- const project = config.project ?? new import_ts_morph67.Project(
17012
+ const project = config.project ?? new import_ts_morph68.Project(
17065
17013
  config.tsConfigFilePath !== void 0 ? {
17066
17014
  tsConfigFilePath: config.tsConfigFilePath,
17067
17015
  skipAddingFilesFromTsConfig: true
@@ -17108,7 +17056,11 @@ function createTypeScriptAdapter(suppliedConfig) {
17108
17056
  )
17109
17057
  );
17110
17058
  }
17111
- return named(summaries, config.workspace, runRoot);
17059
+ return named(
17060
+ (0, import_extractor12.composeWrappers)(summaries, config.extractorOptions ?? {}),
17061
+ config.workspace,
17062
+ runRoot
17063
+ );
17112
17064
  },
17113
17065
  async extractAll() {
17114
17066
  const timer = (0, import_extractor9.createTimer)();
@@ -17319,7 +17271,7 @@ function createTypeScriptAdapter(suppliedConfig) {
17319
17271
  )
17320
17272
  );
17321
17273
  const closureFacts = {
17322
- db: new import_datalog6.Database(),
17274
+ db: new import_datalog5.Database(),
17323
17275
  unitKeyBySummary: /* @__PURE__ */ new Map(),
17324
17276
  ...caching ? { filesByKey: /* @__PURE__ */ new Map() } : {}
17325
17277
  };
@@ -17368,12 +17320,6 @@ function createTypeScriptAdapter(suppliedConfig) {
17368
17320
  "enrichRethrows",
17369
17321
  () => enrichRethrows(merged.summaries, project, closureFacts)
17370
17322
  );
17371
- if (config.includeReachable !== false) {
17372
- timer.time(
17373
- "deriveBoundaryEffects",
17374
- () => deriveBoundaryEffects(enriched, closureFacts)
17375
- );
17376
- }
17377
17323
  timer.time(
17378
17324
  "stampModuleImports",
17379
17325
  () => (0, import_extractor12.stampModuleImports)(enriched, (file) => {
@@ -17777,7 +17723,7 @@ function buildSubUnitSummary(subUnit, parent, invocationRecognizers, accessRecog
17777
17723
  // src/bootstrap/noTsconfigProject.ts
17778
17724
  var import_node_fs5 = __toESM(require("fs"), 1);
17779
17725
  var import_node_path12 = __toESM(require("path"), 1);
17780
- var import_ts_morph68 = require("ts-morph");
17726
+ var import_ts_morph69 = require("ts-morph");
17781
17727
  var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
17782
17728
  ".ts",
17783
17729
  ".tsx",
@@ -17825,12 +17771,12 @@ function findSourceFiles(rootDir, depth = 0) {
17825
17771
  return found;
17826
17772
  }
17827
17773
  function createProjectWithoutTsconfig(rootDir) {
17828
- const project = new import_ts_morph68.Project({
17774
+ const project = new import_ts_morph69.Project({
17829
17775
  skipAddingFilesFromTsConfig: true,
17830
17776
  compilerOptions: {
17831
- target: import_ts_morph68.ScriptTarget.ES2022,
17832
- module: import_ts_morph68.ModuleKind.ESNext,
17833
- moduleResolution: import_ts_morph68.ModuleResolutionKind.Bundler,
17777
+ target: import_ts_morph69.ScriptTarget.ES2022,
17778
+ module: import_ts_morph69.ModuleKind.ESNext,
17779
+ moduleResolution: import_ts_morph69.ModuleResolutionKind.Bundler,
17834
17780
  allowJs: true,
17835
17781
  checkJs: false,
17836
17782
  noEmit: true,
@@ -17852,10 +17798,18 @@ function createProjectWithoutTsconfig(rootDir) {
17852
17798
  }
17853
17799
  return { project, files };
17854
17800
  }
17801
+ var TSCONFIG_NAMES = [
17802
+ "tsconfig.json",
17803
+ "jsconfig.json",
17804
+ "tsconfig.base.json"
17805
+ ];
17806
+ var WALK_UP_TSCONFIG_NAMES = ["tsconfig.json", "jsconfig.json"];
17855
17807
  function findNearestTsconfig(startDir) {
17856
- let dir = import_node_path12.default.resolve(startDir);
17808
+ const start = import_node_path12.default.resolve(startDir);
17809
+ let dir = start;
17857
17810
  while (true) {
17858
- for (const name of ["tsconfig.json", "jsconfig.json"]) {
17811
+ const names = dir === start ? TSCONFIG_NAMES : WALK_UP_TSCONFIG_NAMES;
17812
+ for (const name of names) {
17859
17813
  const candidate = import_node_path12.default.join(dir, name);
17860
17814
  if (import_node_fs5.default.existsSync(candidate)) {
17861
17815
  return candidate;
@@ -17871,7 +17825,7 @@ function findNearestTsconfig(startDir) {
17871
17825
 
17872
17826
  // src/facts/why.ts
17873
17827
  var import_node_path13 = __toESM(require("path"), 1);
17874
- var import_ts_morph69 = require("ts-morph");
17828
+ var import_ts_morph70 = require("ts-morph");
17875
17829
  var import_resolution7 = require("@suss/resolution");
17876
17830
  var JS_PHRASES = {
17877
17831
  bind: ({ tuple, describe }) => ({
@@ -17885,7 +17839,7 @@ var TypeScriptWhySession = class {
17885
17839
  constructor(options) {
17886
17840
  this.root = import_node_path13.default.resolve(options.dir);
17887
17841
  const tsconfig = findNearestTsconfig(this.root);
17888
- this.project = tsconfig === null ? createProjectWithoutTsconfig(this.root).project : new import_ts_morph69.Project({ tsConfigFilePath: tsconfig });
17842
+ this.project = tsconfig === null ? createProjectWithoutTsconfig(this.root).project : new import_ts_morph70.Project({ tsConfigFilePath: tsconfig });
17889
17843
  this.store = new ResolutionStore();
17890
17844
  }
17891
17845
  /**
@@ -17900,7 +17854,7 @@ var TypeScriptWhySession = class {
17900
17854
  }
17901
17855
  let found = null;
17902
17856
  sourceFile.forEachDescendant((node) => {
17903
- if (import_ts_morph69.Node.isExpression(node) && node.getStartLineNumber() === line && node.getText() === text && (found === null || node.getWidth() <= found.getWidth())) {
17857
+ if (import_ts_morph70.Node.isExpression(node) && node.getStartLineNumber() === line && node.getText() === text && (found === null || node.getWidth() <= found.getWidth())) {
17904
17858
  found = node;
17905
17859
  }
17906
17860
  });
@@ -17918,7 +17872,7 @@ var TypeScriptWhySession = class {
17918
17872
  return null;
17919
17873
  }
17920
17874
  for (const call of sourceFile.getDescendantsOfKind(
17921
- import_ts_morph69.SyntaxKind.CallExpression
17875
+ import_ts_morph70.SyntaxKind.CallExpression
17922
17876
  )) {
17923
17877
  const line = call.getStartLineNumber();
17924
17878
  if (line < startLine || line > endLine) {
@@ -17992,21 +17946,21 @@ var TypeScriptWhySession = class {
17992
17946
  }
17993
17947
  };
17994
17948
  function displayNameOf(node) {
17995
- if (import_ts_morph69.Node.isIdentifier(node) || import_ts_morph69.Node.isPropertyAccessExpression(node)) {
17949
+ if (import_ts_morph70.Node.isIdentifier(node) || import_ts_morph70.Node.isPropertyAccessExpression(node)) {
17996
17950
  return node.getText();
17997
17951
  }
17998
- if (import_ts_morph69.Node.isCallExpression(node) || import_ts_morph69.Node.isNewExpression(node)) {
17952
+ if (import_ts_morph70.Node.isCallExpression(node) || import_ts_morph70.Node.isNewExpression(node)) {
17999
17953
  return `${node.getExpression()?.getText() ?? "call"}(...)`;
18000
17954
  }
18001
- if (import_ts_morph69.Node.isFunctionDeclaration(node) || import_ts_morph69.Node.isClassDeclaration(node) || import_ts_morph69.Node.isMethodDeclaration(node) || import_ts_morph69.Node.isVariableDeclaration(node)) {
17955
+ if (import_ts_morph70.Node.isFunctionDeclaration(node) || import_ts_morph70.Node.isClassDeclaration(node) || import_ts_morph70.Node.isMethodDeclaration(node) || import_ts_morph70.Node.isVariableDeclaration(node)) {
18002
17956
  const name = node.getName();
18003
17957
  if (name !== void 0) {
18004
17958
  return name;
18005
17959
  }
18006
17960
  }
18007
- if (import_ts_morph69.Node.isArrowFunction(node) || import_ts_morph69.Node.isFunctionExpression(node)) {
17961
+ if (import_ts_morph70.Node.isArrowFunction(node) || import_ts_morph70.Node.isFunctionExpression(node)) {
18008
17962
  const parent = node.getParent();
18009
- if (parent !== void 0 && import_ts_morph69.Node.isVariableDeclaration(parent)) {
17963
+ if (parent !== void 0 && import_ts_morph70.Node.isVariableDeclaration(parent)) {
18010
17964
  return parent.getName();
18011
17965
  }
18012
17966
  }
@@ -18016,7 +17970,7 @@ function displayNameOf(node) {
18016
17970
 
18017
17971
  // src/stubEvidence.ts
18018
17972
  var import_node_path14 = __toESM(require("path"), 1);
18019
- var import_ts_morph70 = require("ts-morph");
17973
+ var import_ts_morph71 = require("ts-morph");
18020
17974
  function stubEvidenceIn(project, packageName, root) {
18021
17975
  const resolution = new ResolutionStore();
18022
17976
  const byExport = /* @__PURE__ */ new Map();
@@ -18043,7 +17997,7 @@ function stubEvidenceIn(project, packageName, root) {
18043
17997
  );
18044
17998
  }
18045
17999
  function stubEvidence(options) {
18046
- const project = new import_ts_morph70.Project(
18000
+ const project = new import_ts_morph71.Project(
18047
18001
  options.tsConfigFilePath !== void 0 ? { tsConfigFilePath: options.tsConfigFilePath } : { compilerOptions: { allowJs: true } }
18048
18002
  );
18049
18003
  const root = options.tsConfigFilePath !== void 0 ? import_node_path14.default.dirname(options.tsConfigFilePath) : import_node_path14.default.resolve(options.directory ?? process.cwd());
@@ -18061,6 +18015,7 @@ function stubEvidence(options) {
18061
18015
  GENERIC_TERMINALS,
18062
18016
  NO_BARRIERS,
18063
18017
  ResolutionStore,
18018
+ TSCONFIG_NAMES,
18064
18019
  TypeScriptWhySession,
18065
18020
  accessContextFor,
18066
18021
  buildProjectHelperIndex,