@nudojs/lsp 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +435 -177
  2. package/dist/server.js +447 -182
  3. package/package.json +4 -4
package/dist/server.js CHANGED
@@ -223986,7 +223986,12 @@ var app = (fn2, args) => ({ op: "app", fn: fn2, args });
223986
223986
  function termEquals(a, b) {
223987
223987
  if (a === b) return true;
223988
223988
  if (a.op !== b.op) return false;
223989
- if (a.op === "lit" && b.op === "lit") return a.value === b.value;
223989
+ if (a.op === "lit" && b.op === "lit") {
223990
+ if (typeof a.value === "number" && typeof b.value === "number" && Number.isNaN(a.value) && Number.isNaN(b.value)) {
223991
+ return true;
223992
+ }
223993
+ return a.value === b.value;
223994
+ }
223990
223995
  if (a.op === "var" && b.op === "var") return a.id === b.id;
223991
223996
  if (a.op === "app" && b.op === "app") {
223992
223997
  return a.fn === b.fn && a.args.length === b.args.length && a.args.every((x, i) => termEquals(x, b.args[i]));
@@ -224025,18 +224030,10 @@ function simplifyTerm(t) {
224025
224030
  const folded = foldLiterals(fn2, xs);
224026
224031
  if (folded !== void 0) return lit(folded);
224027
224032
  }
224028
- if (fn2 === "+" && args.length === 2) {
224029
- const [a, b] = args;
224030
- if (a.op === "lit" && a.value === 0) return b;
224031
- if (b.op === "lit" && b.value === 0) return a;
224032
- }
224033
224033
  if (fn2 === "*" && args.length === 2) {
224034
224034
  const [a, b] = args;
224035
224035
  if (a.op === "lit" && a.value === 1) return b;
224036
224036
  if (b.op === "lit" && b.value === 1) return a;
224037
- if (a.op === "lit" && a.value === 0 || b.op === "lit" && b.value === 0) {
224038
- return lit(0);
224039
- }
224040
224037
  }
224041
224038
  if (fn2 === "-" && args.length === 2) {
224042
224039
  const [a, b] = args;
@@ -240667,7 +240664,7 @@ function coercibleLit(v2) {
240667
240664
  return v2 !== void 0 && (typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null);
240668
240665
  }
240669
240666
  function toNumberResult(a, b, op) {
240670
- const term = a.term && b.term ? simplifyTerm(app(op, [a.term, b.term])) : void 0;
240667
+ const term = a.term && b.term ? app(op, [a.term, b.term]) : void 0;
240671
240668
  return abs(
240672
240669
  { k: "prim", type: "number" },
240673
240670
  term,
@@ -240834,9 +240831,6 @@ function mul(a, b, phi2 = pTrue) {
240834
240831
  }
240835
240832
  if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
240836
240833
  const term = simplifyTerm(app("*", [a.term, b.term]));
240837
- if (b.term.op === "lit" && b.term.value === 0 || a.term.op === "lit" && a.term.value === 0) {
240838
- return numLit(0);
240839
- }
240840
240834
  let k;
240841
240835
  let base;
240842
240836
  if (b.term.op === "lit" && typeof b.term.value === "number") {
@@ -240948,9 +240942,6 @@ function mod(a, b, phi2 = pTrue) {
240948
240942
  return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(a.conf, b.conf));
240949
240943
  }
240950
240944
  if (typeof va === "number" && typeof vb === "number") {
240951
- if (vb === 0) {
240952
- return abs(num().shape, void 0, void 0, "path");
240953
- }
240954
240945
  return numLit(va % vb);
240955
240946
  }
240956
240947
  if (coercibleLit(va) && coercibleLit(vb)) {
@@ -240958,14 +240949,24 @@ function mod(a, b, phi2 = pTrue) {
240958
240949
  }
240959
240950
  if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
240960
240951
  const term = simplifyTerm(app("%", [a.term, b.term]));
240961
- if (b.term.op === "lit" && typeof b.term.value === "number" && b.term.value !== 0) {
240952
+ if (b.term.op === "lit") {
240953
+ const bv = b.term.value;
240954
+ if (typeof bv === "number" && (bv === 0 || Number.isNaN(bv))) {
240955
+ return numLit(NaN);
240956
+ }
240957
+ }
240958
+ if (b.term.op === "lit" && typeof b.term.value === "number" && Number.isFinite(b.term.value) && b.term.value !== 0) {
240962
240959
  const k = Math.abs(b.term.value);
240963
- return abs(
240964
- num().shape,
240965
- term,
240966
- and(gt(term, lit(-k)), lt(term, lit(k))),
240967
- confJoin(confJoin(a.conf, b.conf), "path")
240968
- );
240960
+ const ab = numericBounds(a, phi2);
240961
+ const finiteDividend = ab?.lo !== void 0 && ab?.hi !== void 0 && Number.isFinite(ab.lo.value) && Number.isFinite(ab.hi.value);
240962
+ if (finiteDividend) {
240963
+ return abs(
240964
+ num().shape,
240965
+ term,
240966
+ and(gt(term, lit(-k)), lt(term, lit(k))),
240967
+ confJoin(confJoin(a.conf, b.conf), "path")
240968
+ );
240969
+ }
240969
240970
  }
240970
240971
  return abs(num().shape, term, void 0, confJoin(confJoin(a.conf, b.conf), "path"));
240971
240972
  }
@@ -240978,11 +240979,18 @@ function mod(a, b, phi2 = pTrue) {
240978
240979
  return abs({ k: "unknown" }, void 0, void 0, "partial");
240979
240980
  }
240980
240981
  function cmp(op, a, b, phi2 = pTrue) {
240981
- const va = litValue(a);
240982
- const vb = litValue(b);
240983
- if (va !== void 0 && vb !== void 0) {
240984
- const result = compareLits(op, va, vb);
240982
+ const ta = a.term;
240983
+ const tb = b.term;
240984
+ if (ta?.op === "lit" && tb?.op === "lit") {
240985
+ const result = compareLits(op, ta.value, tb.value);
240985
240986
  if (result !== void 0) return boolLit(result);
240987
+ } else {
240988
+ const va = litValue(a);
240989
+ const vb = litValue(b);
240990
+ if (va !== void 0 && vb !== void 0) {
240991
+ const result = compareLits(op, va, vb);
240992
+ if (result !== void 0) return boolLit(result);
240993
+ }
240986
240994
  }
240987
240995
  if (a.term && b.term) {
240988
240996
  const pred = op === "lt" ? lt(a.term, b.term) : op === "le" ? le(a.term, b.term) : op === "gt" ? gt(a.term, b.term) : op === "ge" ? ge(a.term, b.term) : op === "eq" ? { op: "eq", a: a.term, b: b.term } : { op: "ne", a: a.term, b: b.term };
@@ -241145,54 +241153,36 @@ function isPrimLike(a) {
241145
241153
  }
241146
241154
 
241147
241155
  // ../core/src/algebra/builtins/math.ts
241156
+ function coerceMathArg(a) {
241157
+ if (!a || a.term?.op !== "lit") return void 0;
241158
+ const v2 = a.term.value;
241159
+ if (typeof v2 === "number") return v2;
241160
+ if (typeof v2 === "string") return Number(v2);
241161
+ if (typeof v2 === "boolean") return v2 ? 1 : 0;
241162
+ if (v2 === null) return 0;
241163
+ if (v2 === void 0) return void 0;
241164
+ return "throw";
241165
+ }
241166
+ function mathMethod(name) {
241167
+ if (!Object.hasOwn(Math, name)) return void 0;
241168
+ const impl = Math[name];
241169
+ return typeof impl === "function" ? impl : void 0;
241170
+ }
241148
241171
  function evalMathMethod(name, args) {
241149
- const a0 = args[0] ? litValue(args[0]) : void 0;
241150
- const a1 = args[1] ? litValue(args[1]) : void 0;
241151
- switch (name) {
241152
- case "abs":
241153
- if (typeof a0 === "number") return numLit(Math.abs(a0));
241154
- return numPrim();
241155
- case "floor":
241156
- if (typeof a0 === "number") return numLit(Math.floor(a0));
241157
- return numPrim();
241158
- case "ceil":
241159
- if (typeof a0 === "number") return numLit(Math.ceil(a0));
241160
- return numPrim();
241161
- case "round":
241162
- if (typeof a0 === "number") return numLit(Math.round(a0));
241163
- return numPrim();
241164
- case "random":
241165
- return numPrim("path");
241166
- case "sqrt":
241167
- if (typeof a0 === "number") return numLit(Math.sqrt(a0));
241168
- return numPrim();
241169
- case "min": {
241170
- const lits = args.map(litValue);
241171
- if (lits.length > 0 && lits.every((x) => typeof x === "number")) {
241172
- return numLit(Math.min(...lits));
241173
- }
241174
- return numPrim();
241175
- }
241176
- case "max": {
241177
- const lits = args.map(litValue);
241178
- if (lits.length > 0 && lits.every((x) => typeof x === "number")) {
241179
- return numLit(Math.max(...lits));
241180
- }
241181
- return numPrim();
241182
- }
241183
- case "pow":
241184
- if (typeof a0 === "number" && typeof a1 === "number") return numLit(Math.pow(a0, a1));
241185
- return numPrim();
241186
- case "sign":
241187
- if (typeof a0 === "number") return numLit(Math.sign(a0));
241188
- return numPrim();
241189
- case "atan2":
241190
- if (typeof a0 === "number" && typeof a1 === "number") {
241191
- return numLit(Math.atan2(a0, a1));
241192
- }
241193
- return numPrim();
241194
- default:
241195
- return void 0;
241172
+ if (name === "random") return numPrim("path");
241173
+ const impl = mathMethod(name);
241174
+ if (!impl) return void 0;
241175
+ const nums = [];
241176
+ for (const a of args) {
241177
+ const n = coerceMathArg(a);
241178
+ if (n === void 0) return numPrim();
241179
+ if (n === "throw") throw new NudoThrow(errorTypeAbs("TypeError"));
241180
+ nums.push(n);
241181
+ }
241182
+ try {
241183
+ return numLit(impl(...nums));
241184
+ } catch {
241185
+ return numPrim();
241196
241186
  }
241197
241187
  }
241198
241188
 
@@ -241802,6 +241792,11 @@ function jsonValueToAbs(v2) {
241802
241792
  }
241803
241793
  return abs({ k: "obj", slots }, void 0, void 0, "exact");
241804
241794
  }
241795
+ function isNonJsonTopLevel(a) {
241796
+ if (a.shape.k === "fn") return true;
241797
+ if (a.shape.k === "prim" && a.shape.type === "symbol") return true;
241798
+ return false;
241799
+ }
241805
241800
  function evalJsonMethod(name, args) {
241806
241801
  if (name === "parse") {
241807
241802
  const a0Abs = args[0];
@@ -241824,7 +241819,10 @@ function evalJsonMethod(name, args) {
241824
241819
  const a0Abs = args[0];
241825
241820
  if (!a0Abs) return undefAbs();
241826
241821
  const v2 = absToJsonNative(a0Abs, /* @__PURE__ */ new Set());
241827
- if (v2 === NOT_LITERAL) return str2("partial");
241822
+ if (v2 === NOT_LITERAL) {
241823
+ if (isNonJsonTopLevel(a0Abs)) return undefAbs();
241824
+ return str2("partial");
241825
+ }
241828
241826
  const replacerArg = args[1];
241829
241827
  let replacer;
241830
241828
  if (replacerArg) {
@@ -241866,34 +241864,60 @@ function evalJsonMethod(name, args) {
241866
241864
  function foldParseInt(s, radix) {
241867
241865
  const str6 = String(s);
241868
241866
  if (radix === void 0) return numLit(parseInt(str6));
241869
- const r = radix | 0;
241867
+ const r = Number(radix) | 0;
241870
241868
  if (r === 0) return numLit(parseInt(str6));
241871
241869
  if (r < 2 || r > 36) return numLit(NaN);
241872
241870
  return numLit(parseInt(str6, r));
241873
241871
  }
241872
+ function foldParseFloat(s) {
241873
+ return numLit(parseFloat(String(s)));
241874
+ }
241875
+ function toStringLitArg(a) {
241876
+ if (!a) return { lit: true, v: void 0 };
241877
+ if (a.term?.op !== "lit") return { lit: false };
241878
+ const v2 = a.term.value;
241879
+ if (typeof v2 === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
241880
+ return { lit: true, v: v2 };
241881
+ }
241882
+ function radixLitArg(a) {
241883
+ if (!a) return { ok: true, v: void 0 };
241884
+ if (a.term?.op !== "lit") return { ok: false };
241885
+ const v2 = a.term.value;
241886
+ if (typeof v2 === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
241887
+ if (v2 === void 0) return { ok: true, v: void 0 };
241888
+ if (typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null) {
241889
+ return { ok: true, v: v2 };
241890
+ }
241891
+ return { ok: false };
241892
+ }
241874
241893
  function evalNumberStatic(name, args) {
241875
- const a0 = args[0] ? litValue(args[0]) : void 0;
241894
+ const a0Arg = args[0];
241895
+ const a0 = a0Arg ? litValue(a0Arg) : void 0;
241896
+ const foldStrictNumberPred = (pred) => {
241897
+ if (!a0Arg) return boolLit(false);
241898
+ if (a0Arg.term?.op !== "lit") return void 0;
241899
+ const v2 = a0Arg.term.value;
241900
+ return boolLit(typeof v2 === "number" && pred(v2));
241901
+ };
241876
241902
  switch (name) {
241877
241903
  case "isInteger":
241878
- if (typeof a0 === "number") return boolLit(Number.isInteger(a0));
241879
- return boolPrim();
241904
+ return foldStrictNumberPred(Number.isInteger) ?? boolPrim();
241880
241905
  case "isNaN":
241881
- if (typeof a0 === "number") return boolLit(Number.isNaN(a0));
241882
- return boolPrim();
241906
+ return foldStrictNumberPred(Number.isNaN) ?? boolPrim();
241883
241907
  case "isFinite":
241884
- if (typeof a0 === "number") return boolLit(Number.isFinite(a0));
241885
- return boolPrim();
241886
- case "parseInt":
241887
- if (typeof a0 === "string" || typeof a0 === "number") {
241888
- const radix = args[1] ? litValue(args[1]) : void 0;
241889
- if (radix === void 0) return foldParseInt(a0, void 0);
241890
- if (typeof radix === "number") return foldParseInt(a0, radix);
241891
- return numPrim();
241892
- }
241893
- return numPrim();
241894
- case "parseFloat":
241895
- if (typeof a0 === "string" || typeof a0 === "number") return numLit(parseFloat(String(a0)));
241896
- return numPrim();
241908
+ return foldStrictNumberPred(Number.isFinite) ?? boolPrim();
241909
+ case "parseInt": {
241910
+ const s = toStringLitArg(a0Arg);
241911
+ if (!s.lit) return numPrim();
241912
+ const radix = radixLitArg(args[1]);
241913
+ if (!radix.ok) return numPrim();
241914
+ return foldParseInt(s.v, radix.v);
241915
+ }
241916
+ case "parseFloat": {
241917
+ const s = toStringLitArg(a0Arg);
241918
+ if (!s.lit) return numPrim();
241919
+ return foldParseFloat(s.v);
241920
+ }
241897
241921
  case "MAX_SAFE_INTEGER":
241898
241922
  return numLit(Number.MAX_SAFE_INTEGER);
241899
241923
  default:
@@ -242681,29 +242705,59 @@ function arrayMethodAbs(name) {
242681
242705
  }
242682
242706
 
242683
242707
  // ../core/src/algebra/builtins/global.ts
242708
+ function litTermOf(a) {
242709
+ return a?.term?.op === "lit" ? a.term : void 0;
242710
+ }
242684
242711
  function evalGlobalFn(name, args) {
242685
242712
  const a0 = args[0] ? litValue(args[0]) : void 0;
242713
+ const a0Lit = litTermOf(args[0]);
242686
242714
  switch (name) {
242687
242715
  case "eval":
242688
242716
  return unknown;
242689
242717
  case "Array":
242690
242718
  return makeArrayCtorAbs(args);
242691
- case "parseInt":
242692
- if (typeof a0 === "string" || typeof a0 === "number") {
242693
- const radix = args[1] ? litValue(args[1]) : void 0;
242694
- if (radix === void 0) return foldParseInt(a0, void 0);
242695
- if (typeof radix === "number") return foldParseInt(a0, radix);
242719
+ case "parseInt": {
242720
+ const sVal = a0Lit ? a0Lit.value : void 0;
242721
+ if (a0Lit && typeof sVal === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
242722
+ if (!a0Lit && args[0] && args[0].term?.op !== "lit") return numPrim();
242723
+ const rAbs = args[1];
242724
+ let radix;
242725
+ if (!rAbs) {
242726
+ radix = void 0;
242727
+ } else if (rAbs.term?.op !== "lit") {
242696
242728
  return numPrim();
242729
+ } else if (typeof rAbs.term.value === "symbol") {
242730
+ throw new NudoThrow(errorTypeAbs("TypeError"));
242731
+ } else {
242732
+ const rv = rAbs.term.value;
242733
+ radix = rv === void 0 ? void 0 : rv;
242734
+ if (rv !== void 0 && typeof rv !== "number" && typeof rv !== "string" && typeof rv !== "boolean" && rv !== null) {
242735
+ return numPrim();
242736
+ }
242737
+ }
242738
+ return foldParseInt(sVal, radix);
242739
+ }
242740
+ case "parseFloat": {
242741
+ if (!a0Lit && args[0] && args[0].term?.op !== "lit") return numPrim();
242742
+ if (a0Lit && typeof a0Lit.value === "symbol") throw new NudoThrow(errorTypeAbs("TypeError"));
242743
+ return foldParseFloat(a0Lit ? a0Lit.value : void 0);
242744
+ }
242745
+ case "isNaN": {
242746
+ if (args[0] && isSymbolAbs2(args[0])) throw new NudoThrow(errorTypeAbs("TypeError"));
242747
+ if (!args[0] || args[0].term?.op === "lit" && args[0].term.value === void 0) {
242748
+ return boolLit(true);
242697
242749
  }
242698
- return numPrim();
242699
- case "parseFloat":
242700
- if (typeof a0 === "string" || typeof a0 === "number") return numLit(parseFloat(String(a0)));
242701
- return numPrim();
242702
- case "isNaN":
242703
242750
  if (typeof a0 === "number") return boolLit(Number.isNaN(a0));
242751
+ if (typeof a0 === "boolean" || a0 === null) return boolLit(false);
242752
+ if (typeof a0 === "string") return boolLit(Number.isNaN(Number(a0)));
242753
+ if (typeof a0 === "bigint") throw new NudoThrow(errorTypeAbs("TypeError"));
242704
242754
  return boolPrim();
242755
+ }
242705
242756
  case "isFinite": {
242706
- if (a0 === void 0 && args.length === 0) return boolLit(false);
242757
+ if (args[0] && isSymbolAbs2(args[0])) throw new NudoThrow(errorTypeAbs("TypeError"));
242758
+ if (!args[0] || args[0].term?.op === "lit" && args[0].term.value === void 0) {
242759
+ return boolLit(false);
242760
+ }
242707
242761
  if (typeof a0 === "number") return boolLit(Number.isFinite(a0));
242708
242762
  if (typeof a0 === "boolean") return boolLit(true);
242709
242763
  if (typeof a0 === "string") return boolLit(Number.isFinite(Number(a0)));
@@ -242712,18 +242766,24 @@ function evalGlobalFn(name, args) {
242712
242766
  }
242713
242767
  case "Number":
242714
242768
  if (args[0] && isSymbolAbs2(args[0])) throw new NudoThrow(errorTypeAbs("TypeError"));
242769
+ if (!args[0]) return numLit(0);
242770
+ if (a0Lit && a0Lit.value === void 0) return numLit(NaN);
242715
242771
  if (typeof a0 === "number") return numLit(a0);
242716
242772
  if (typeof a0 === "string") return numLit(Number(a0));
242717
242773
  if (typeof a0 === "boolean") return numLit(a0 ? 1 : 0);
242774
+ if (a0 === null) return numLit(0);
242775
+ if (typeof a0 === "bigint") return numLit(Number(a0));
242718
242776
  return numPrim();
242719
242777
  case "String":
242720
242778
  if (args[0] && isSymbolAbs2(args[0])) return stringOfSymbol(args[0]);
242721
- if (a0 !== void 0) return strLit(String(a0));
242779
+ if (!args[0]) return strLit("");
242780
+ if (a0Lit) return strLit(String(a0Lit.value));
242722
242781
  return str2();
242723
242782
  case "Symbol":
242724
242783
  return makeSymbolAbs(args[0]);
242725
242784
  case "Boolean":
242726
- if (a0 !== void 0) return boolLit(Boolean(a0));
242785
+ if (!args[0]) return boolLit(false);
242786
+ if (a0Lit) return boolLit(Boolean(a0Lit.value));
242727
242787
  return boolPrim();
242728
242788
  case "Object": {
242729
242789
  const arg = args[0];
@@ -243556,6 +243616,12 @@ function negAbs(a, _phi = pTrue) {
243556
243616
  const v2 = litValue(a);
243557
243617
  if (typeof v2 === "number") return numLitAbs(-v2);
243558
243618
  if (typeof v2 === "bigint") return bigintLit(-v2);
243619
+ if (a.term?.op === "lit") {
243620
+ const tv = a.term.value;
243621
+ if (typeof tv === "string" || typeof tv === "boolean" || tv === null) {
243622
+ return numLitAbs(-Number(tv));
243623
+ }
243624
+ }
243559
243625
  if (a.shape.k === "prim" && a.shape.type === "number") {
243560
243626
  if (!a.term) {
243561
243627
  return abs(num().shape, void 0, void 0, confJoin(a.conf, "widened"));
@@ -243622,7 +243688,7 @@ function isDefinitelyTruthyShape(s) {
243622
243688
  case "eff":
243623
243689
  return true;
243624
243690
  case "prim":
243625
- return s.type === "symbol" || s.type === "bigint";
243691
+ return s.type === "symbol";
243626
243692
  default:
243627
243693
  return false;
243628
243694
  }
@@ -243689,7 +243755,12 @@ function strictEqAbs(a, b) {
243689
243755
  if (bNullish && definitelyNotNullishShape(a.shape)) return false;
243690
243756
  if (aNullish && definitelyNotNullishShape(b.shape)) return false;
243691
243757
  if (a.term && b.term && a.term.op === "var" && b.term.op === "var" && a.term.id === b.term.id) {
243692
- return true;
243758
+ const k = a.shape.k;
243759
+ if (k === "obj" || k === "arr" || k === "tuple" || k === "fn" || k === "brand" || k === "eff") {
243760
+ return true;
243761
+ }
243762
+ if (k === "prim" && a.shape.type !== "number") return true;
243763
+ return void 0;
243693
243764
  }
243694
243765
  return void 0;
243695
243766
  }
@@ -243753,9 +243824,26 @@ function callbackEnv() {
243753
243824
  function isStrRecv(recv) {
243754
243825
  return isTemplateLike(recv) || recv.shape.k === "prim" && recv.shape.type === "string" || recv.term?.op === "lit" && typeof recv.term.value === "string";
243755
243826
  }
243827
+ function isFoldableIndexArg(x) {
243828
+ if (x === void 0) return true;
243829
+ if (x.term?.op !== "lit") return false;
243830
+ const v2 = x.term.value;
243831
+ return v2 === void 0 || typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null;
243832
+ }
243833
+ function toStringArg(x) {
243834
+ if (x === void 0) return "undefined";
243835
+ if (x.term?.op !== "lit") return void 0;
243836
+ const v2 = x.term.value;
243837
+ if (typeof v2 === "symbol") return void 0;
243838
+ return String(v2);
243839
+ }
243840
+ function isUndefinedArg(x) {
243841
+ return x === void 0 || x.term?.op === "lit" && x.term.value === void 0;
243842
+ }
243756
243843
  function callAbsMethod(recv, name, args) {
243757
243844
  if (!isStrRecv(recv)) return void 0;
243758
243845
  const a0 = args[0] ? litValue(args[0]) : void 0;
243846
+ const a0Str = toStringArg(args[0]);
243759
243847
  const lit3 = recv.term?.op === "lit" && typeof recv.term.value === "string" ? recv.term.value : void 0;
243760
243848
  if (isTemplateLike(recv)) {
243761
243849
  const views = absTemplateViews(templatePartsOf(recv));
@@ -243764,20 +243852,20 @@ function callAbsMethod(recv, name, args) {
243764
243852
  switch (name) {
243765
243853
  case "startsWith": {
243766
243854
  if (args[1] && litValue(args[1]) !== void 0) return boolPrim5();
243767
- if (typeof a0 !== "string") return boolPrim5();
243768
- const d = decideStartsWith(prefix2, a0);
243855
+ if (a0Str === void 0) return boolPrim5();
243856
+ const d = decideStartsWith(prefix2, a0Str);
243769
243857
  return d === "unknown" ? boolPrim5() : boolLit(d);
243770
243858
  }
243771
243859
  case "endsWith": {
243772
243860
  if (args[1] && litValue(args[1]) !== void 0) return boolPrim5();
243773
- if (typeof a0 !== "string") return boolPrim5();
243774
- const d = decideEndsWith(suffix, a0);
243861
+ if (a0Str === void 0) return boolPrim5();
243862
+ const d = decideEndsWith(suffix, a0Str);
243775
243863
  return d === "unknown" ? boolPrim5() : boolLit(d);
243776
243864
  }
243777
243865
  case "includes": {
243778
243866
  if (args[1] && litValue(args[1]) !== void 0) return boolPrim5();
243779
- if (typeof a0 !== "string") return boolPrim5();
243780
- const d = decideIncludes(allFixedTextOfViews(views), a0);
243867
+ if (a0Str === void 0) return boolPrim5();
243868
+ const d = decideIncludes(allFixedTextOfViews(views), a0Str);
243781
243869
  return d === "unknown" ? boolPrim5() : boolLit(d);
243782
243870
  }
243783
243871
  case "toUpperCase":
@@ -243803,10 +243891,10 @@ function callAbsMethod(recv, name, args) {
243803
243891
  const a1 = a1Abs ? litValue(a1Abs) : void 0;
243804
243892
  const a1Unknown = a1Abs !== void 0 && a1Abs.term?.op !== "lit";
243805
243893
  if (a1Unknown) return boolPrim5();
243806
- if (lit3 !== void 0 && typeof a0 === "string") {
243807
- if (name === "startsWith") return boolLit(lit3.startsWith(a0, a1));
243808
- if (name === "endsWith") return boolLit(lit3.endsWith(a0, a1));
243809
- return boolLit(lit3.includes(a0, a1));
243894
+ if (lit3 !== void 0 && a0Str !== void 0) {
243895
+ if (name === "startsWith") return boolLit(lit3.startsWith(a0Str, a1));
243896
+ if (name === "endsWith") return boolLit(lit3.endsWith(a0Str, a1));
243897
+ return boolLit(lit3.includes(a0Str, a1));
243810
243898
  }
243811
243899
  return boolPrim5();
243812
243900
  }
@@ -243819,8 +243907,7 @@ function callAbsMethod(recv, name, args) {
243819
243907
  case "slice":
243820
243908
  case "substring":
243821
243909
  if (lit3 !== void 0) {
243822
- const numOrMissing = (x) => x === void 0 || x.term?.op === "lit" && (x.term.value === void 0 || typeof x.term.value === "number");
243823
- if (!numOrMissing(args[0]) || !numOrMissing(args[1])) return strPrim("path");
243910
+ if (!isFoldableIndexArg(args[0]) || !isFoldableIndexArg(args[1])) return strPrim("path");
243824
243911
  const a1 = args[1] ? litValue(args[1]) : void 0;
243825
243912
  if (name === "slice") {
243826
243913
  return strLit(lit3.slice(a0, a1));
@@ -243828,8 +243915,11 @@ function callAbsMethod(recv, name, args) {
243828
243915
  return strLit(lit3.substring(Number(a0 ?? 0), Number(a1 ?? lit3.length)));
243829
243916
  }
243830
243917
  return strPrim("path");
243831
- case "charAt":
243832
- return lit3 !== void 0 && typeof a0 === "number" ? strLit(lit3.charAt(a0)) : strPrim("path");
243918
+ case "charAt": {
243919
+ if (lit3 === void 0) return strPrim("path");
243920
+ if (!isFoldableIndexArg(args[0])) return strPrim("path");
243921
+ return strLit(lit3.charAt(Number(a0 ?? 0)));
243922
+ }
243833
243923
  case "toString":
243834
243924
  case "valueOf":
243835
243925
  return lit3 !== void 0 ? strLit(lit3) : strPrim("path");
@@ -243845,17 +243935,36 @@ function callAbsMethod(recv, name, args) {
243845
243935
  return strPrim("path");
243846
243936
  }
243847
243937
  case "indexOf":
243848
- case "lastIndexOf":
243849
- case "charCodeAt":
243850
- return numPrim5("path");
243938
+ case "lastIndexOf": {
243939
+ if (lit3 === void 0) return numPrim5("path");
243940
+ const search = toStringArg(args[0]);
243941
+ if (search === void 0) return numPrim5("path");
243942
+ if (!isFoldableIndexArg(args[1])) return numPrim5("path");
243943
+ const from = args[1] ? litValue(args[1]) : void 0;
243944
+ return numLit(
243945
+ name === "indexOf" ? lit3.indexOf(search, from) : lit3.lastIndexOf(search, from)
243946
+ );
243947
+ }
243948
+ case "charCodeAt": {
243949
+ if (lit3 === void 0) return numPrim5("path");
243950
+ if (!isFoldableIndexArg(args[0])) return numPrim5("path");
243951
+ return numLit(lit3.charCodeAt(Number(a0 ?? 0)));
243952
+ }
243851
243953
  case "split": {
243852
243954
  if (lit3 !== void 0) {
243853
- const sep5 = typeof a0 === "string" ? a0 : void 0;
243854
- const a1Abs = args[1];
243855
- const a1 = a1Abs ? litValue(a1Abs) : void 0;
243856
- if (a1Abs !== void 0 && a1Abs.term?.op !== "lit") return strArr("path");
243955
+ const limAbs = args[1];
243956
+ const lim = limAbs ? litValue(limAbs) : void 0;
243957
+ if (limAbs !== void 0 && limAbs.term?.op !== "lit") return strArr("path");
243958
+ if (isUndefinedArg(args[0])) {
243959
+ const one = abs({ k: "tuple", elements: [strLit(lit3)] }, void 0, void 0, "exact");
243960
+ if (lim === void 0) return one;
243961
+ const n = Number(lim);
243962
+ if (!(n > 0)) return abs({ k: "tuple", elements: [] }, void 0, void 0, "exact");
243963
+ return one;
243964
+ }
243965
+ const sep5 = toStringArg(args[0]);
243857
243966
  if (sep5 !== void 0) {
243858
- const parts = lit3.split(sep5, a1).map((s) => strLit(s));
243967
+ const parts = lit3.split(sep5, lim).map((s) => strLit(s));
243859
243968
  return abs({ k: "tuple", elements: parts }, void 0, void 0, "exact");
243860
243969
  }
243861
243970
  return strArr("path");
@@ -243867,12 +243976,16 @@ function callAbsMethod(recv, name, args) {
243867
243976
  if (lit3 !== void 0) {
243868
243977
  const patAbs = args[0];
243869
243978
  const repAbs = args[1];
243870
- if (patAbs && repAbs) {
243979
+ {
243871
243980
  let patSrc;
243872
243981
  let patRe;
243873
- const pv = patAbs.term?.op === "lit" ? patAbs.term.value : void 0;
243874
- if (typeof pv === "string") {
243982
+ const pv = patAbs?.term?.op === "lit" ? patAbs.term.value : void 0;
243983
+ if (patAbs === void 0) {
243984
+ patSrc = "undefined";
243985
+ } else if (typeof pv === "string") {
243875
243986
  patSrc = pv;
243987
+ } else if (patAbs.term?.op === "lit" && typeof pv !== "symbol") {
243988
+ patSrc = String(pv);
243876
243989
  } else if (patAbs.shape.k === "brand" && patAbs.shape.name === "RegExp") {
243877
243990
  const inner = patAbs.shape.shape;
243878
243991
  const slots = inner.shape.k === "obj" ? inner.shape.slots : void 0;
@@ -243891,11 +244004,12 @@ function callAbsMethod(recv, name, args) {
243891
244004
  throw new NudoThrow(errorTypeAbs("TypeError"));
243892
244005
  }
243893
244006
  const pat = patSrc ?? patRe;
243894
- const rv = repAbs.term?.op === "lit" ? repAbs.term.value : void 0;
243895
- if (typeof rv === "string") {
244007
+ const rvLit = repAbs?.term?.op === "lit" ? repAbs.term.value : void 0;
244008
+ const rv = repAbs === void 0 ? "undefined" : typeof rvLit === "string" ? rvLit : repAbs.term?.op === "lit" && typeof rvLit !== "symbol" ? String(rvLit) : void 0;
244009
+ if (rv !== void 0) {
243896
244010
  return strLit(name === "replaceAll" ? lit3.replaceAll(pat, rv) : lit3.replace(pat, rv));
243897
244011
  }
243898
- if (repAbs.shape.k === "fn") {
244012
+ if (repAbs && repAbs.shape.k === "fn") {
243899
244013
  let anyUnknown = false;
243900
244014
  const replWrapper = (...caps) => {
243901
244015
  const last = caps[caps.length - 1];
@@ -243996,8 +244110,9 @@ function leqWithPred(src, tgt, phi2, env, depth) {
243996
244110
  if (src.shape.k === "any") return ok();
243997
244111
  const sv = litValue(src);
243998
244112
  const tv = litValue(tgt);
244113
+ const sameLit = sv === tv || typeof sv === "number" && typeof tv === "number" && Number.isNaN(sv) && Number.isNaN(tv);
243999
244114
  if (sv !== void 0 && tv !== void 0) {
244000
- if (sv === tv) return ok();
244115
+ if (sameLit) return ok();
244001
244116
  if (tgt.shape.k === "prim") {
244002
244117
  return fail(`lit ${String(sv)} \u22AD lit ${String(tv)}`);
244003
244118
  }
@@ -247062,7 +247177,7 @@ function litTruth(a) {
247062
247177
  case "eff":
247063
247178
  return true;
247064
247179
  case "prim":
247065
- return a.shape.type === "symbol" || a.shape.type === "bigint" ? true : void 0;
247180
+ return a.shape.type === "symbol" ? true : void 0;
247066
247181
  case "never":
247067
247182
  return false;
247068
247183
  default:
@@ -248155,7 +248270,7 @@ function emitArrMutatorRebinds(expr, opts, pad) {
248155
248270
  if (node.type === "CallExpression" && node.callee?.type === "MemberExpression" && node.callee.computed !== true && node.callee.property?.type === "Identifier" && ARR_MUTATOR_NAMES.has(node.callee.property.name)) {
248156
248271
  const methodName = node.callee.property.name;
248157
248272
  const argSrcs = (node.arguments ?? []).map(
248158
- (a) => a.type === "SpreadElement" ? "$lit(undefined)" : isExpression(a) ? emitTranspileExpression(a, opts) : "$lit(undefined)"
248273
+ (a) => a.type === "SpreadElement" ? "$unknown()" : isExpression(a) ? emitTranspileExpression(a, opts) : "$unknown()"
248159
248274
  ).join(", ");
248160
248275
  const objNode = node.callee.object;
248161
248276
  if (objNode.type === "Identifier") {
@@ -248177,7 +248292,7 @@ function emitArrMutatorRebinds(expr, opts, pad) {
248177
248292
  }
248178
248293
  if (node.type === "CallExpression" && node.callee?.type === "MemberExpression" && node.callee.computed !== true && node.callee.object?.type === "Identifier" && node.callee.object.name === "Object" && node.callee.property?.type === "Identifier" && node.callee.property.name === "defineProperty" && node.arguments?.[0] && node.arguments[0].type === "Identifier") {
248179
248294
  const argSrcs = node.arguments.map(
248180
- (a) => a.type === "SpreadElement" ? "$lit(undefined)" : emitTranspileExpression(a, opts)
248295
+ (a) => a.type === "SpreadElement" ? "$unknown()" : emitTranspileExpression(a, opts)
248181
248296
  ).join(", ");
248182
248297
  const targetName = node.arguments[0].name;
248183
248298
  lines.push(
@@ -248815,7 +248930,7 @@ ${pad}export default ${name};`;
248815
248930
  const methodName = expr.callee.property.name;
248816
248931
  if (["push", "unshift", "splice", "pop", "shift", "reverse", "sort"].includes(methodName)) {
248817
248932
  const argSrcs = expr.arguments.map(
248818
- (a) => a.type === "SpreadElement" ? "$lit(undefined)" : emitTranspileExpression(a, opts)
248933
+ (a) => a.type === "SpreadElement" ? "$unknown()" : emitTranspileExpression(a, opts)
248819
248934
  ).join(", ");
248820
248935
  const objNode = expr.callee.object;
248821
248936
  if (objNode.type === "Identifier") {
@@ -249701,7 +249816,7 @@ function transpileExpression(expr, opts = {}) {
249701
249816
  case "NewExpression": {
249702
249817
  const callee = expr.callee;
249703
249818
  const cname = callee.type === "Identifier" ? callee.name : isExpression(callee) ? transpileExpression(callee, opts) : "$lit(undefined)";
249704
- const args = expr.arguments.map((a) => a.type === "SpreadElement" ? "$lit(undefined)" : transpileExpression(a, opts)).join(", ");
249819
+ const args = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
249705
249820
  return `$new(${cname}, [${args}])`;
249706
249821
  }
249707
249822
  case "LogicalExpression": {
@@ -250137,11 +250252,11 @@ ${mBodyInner}
250137
250252
  const optionalCall = exprAny.type === "OptionalCallExpression" || exprAny.optional === true;
250138
250253
  const callee = expr.callee;
250139
250254
  if (callee.type === "Super" && opts.thisParam && opts.className) {
250140
- const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$lit(undefined)" : transpileExpression(a, opts)).join(", ");
250255
+ const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
250141
250256
  return `${opts.thisParam} = $super(${opts.thisParam}, ${JSON.stringify(opts.className)}, [${args2}])`;
250142
250257
  }
250143
250258
  if (callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Super" && callee.property.type === "Identifier" && opts.thisParam && opts.className) {
250144
- const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$lit(undefined)" : transpileExpression(a, opts)).join(", ");
250259
+ const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
250145
250260
  return `$invokeSuper(${opts.thisParam}, ${JSON.stringify(opts.className)}, ${JSON.stringify(callee.property.name)}, [${args2}])`;
250146
250261
  }
250147
250262
  if (callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Identifier" && callee.object.name === "require" && callee.property.type === "Identifier" && callee.property.name === "resolve") {
@@ -250156,7 +250271,7 @@ ${mBodyInner}
250156
250271
  }
250157
250272
  if ((callee.type === "MemberExpression" || callee.type === "OptionalMemberExpression") && !callee.computed && callee.property.type === "Identifier") {
250158
250273
  const recv = transpileExpression(callee.object, opts);
250159
- const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$lit(undefined)" : transpileExpression(a, opts)).join(", ");
250274
+ const args2 = expr.arguments.map((a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)).join(", ");
250160
250275
  const name = JSON.stringify(callee.property.name);
250161
250276
  const opt = optionalCall || callee.optional === true;
250162
250277
  const loc = expr.loc;
@@ -250172,7 +250287,7 @@ ${mBodyInner}
250172
250287
  const argLocSrcs = [];
250173
250288
  for (const a of expr.arguments) {
250174
250289
  if (a.type === "SpreadElement") {
250175
- argSrcs.push("$lit(undefined)");
250290
+ argSrcs.push("$unknown()");
250176
250291
  argLocSrcs.push("null");
250177
250292
  } else {
250178
250293
  argSrcs.push(transpileExpression(a, opts));
@@ -251325,16 +251440,21 @@ function $arrMutContainer(arr, method, args) {
251325
251440
  function $idx(a, i) {
251326
251441
  if (a?.shape?.k === "any") return anyMemberResult();
251327
251442
  const iv = litValue(i);
251443
+ const idx = iv !== void 0 ? canonicalArrayIndex(iv) : void 0;
251328
251444
  if (a.shape.k === "tuple") {
251329
251445
  const els = a.shape.elements;
251330
- if (typeof iv === "number" && Number.isInteger(iv)) {
251331
- if (iv >= 0 && iv < els.length) return els[iv];
251446
+ if (iv !== void 0 && idx === void 0) return undef();
251447
+ if (idx !== void 0) {
251448
+ if (idx < els.length) return els[idx];
251332
251449
  return undef();
251333
251450
  }
251334
251451
  if (els.length === 0) return undef();
251335
251452
  return els.reduce((x, y) => joinAbs(x, y));
251336
251453
  }
251337
- if (a.shape.k === "arr") return a.shape.element;
251454
+ if (a.shape.k === "arr") {
251455
+ if (iv !== void 0 && idx === void 0) return undef();
251456
+ return a.shape.element;
251457
+ }
251338
251458
  if (a.shape.k === "sum") {
251339
251459
  return a.shape.members.map((m) => $idx(m, i)).reduce((x, y) => joinAbs(x, y));
251340
251460
  }
@@ -251723,6 +251843,46 @@ function namespaceNameOf(v2) {
251723
251843
  function $regex(pattern, flags = "") {
251724
251844
  return regexBrandAbsFrom(pattern, flags);
251725
251845
  }
251846
+ var ARRAY_PROTO_METHOD_NAMES = /* @__PURE__ */ new Set([
251847
+ "at",
251848
+ "concat",
251849
+ "copyWithin",
251850
+ "entries",
251851
+ "every",
251852
+ "fill",
251853
+ "filter",
251854
+ "find",
251855
+ "findIndex",
251856
+ "findLast",
251857
+ "findLastIndex",
251858
+ "flat",
251859
+ "flatMap",
251860
+ "forEach",
251861
+ "includes",
251862
+ "indexOf",
251863
+ "join",
251864
+ "keys",
251865
+ "lastIndexOf",
251866
+ "map",
251867
+ "pop",
251868
+ "push",
251869
+ "reduce",
251870
+ "reduceRight",
251871
+ "reverse",
251872
+ "shift",
251873
+ "slice",
251874
+ "some",
251875
+ "sort",
251876
+ "splice",
251877
+ "toLocaleString",
251878
+ "toString",
251879
+ "unshift",
251880
+ "values",
251881
+ "@@iterator"
251882
+ ]);
251883
+ function isPossiblyProtoMemberKey(key) {
251884
+ return OBJECT_PROTO_METHOD_NAMES.has(key) || ARRAY_PROTO_METHOD_NAMES.has(key) || key === "constructor" || key.startsWith("@@");
251885
+ }
251726
251886
  function $get(o, key, opts) {
251727
251887
  if (!o || typeof o !== "object" || !("shape" in o)) {
251728
251888
  if (o === Object.prototype) {
@@ -251814,10 +251974,19 @@ function $get(o, key, opts) {
251814
251974
  if ((o.shape.k === "tuple" || o.shape.k === "arr") && key === "length") {
251815
251975
  return $len(o);
251816
251976
  }
251817
- if ((o.shape.k === "tuple" || o.shape.k === "arr" || o.shape.k === "prim") && OBJECT_PROTO_METHOD_NAMES.has(key) && !(o.shape.k === "prim" && o.shape.type === "string" && key === "toString")) {
251977
+ if (o.shape.k === "tuple") {
251978
+ const idx = canonicalArrayIndex(key);
251979
+ const els = o.shape.elements;
251980
+ if (idx !== void 0) return idx < els.length ? els[idx] : undef();
251981
+ if (!isPossiblyProtoMemberKey(key)) return undef();
251982
+ }
251983
+ if ((o.shape.k === "tuple" || o.shape.k === "arr" || o.shape.k === "prim") && (OBJECT_PROTO_METHOD_NAMES.has(key) || o.shape.k !== "prim" && ARRAY_PROTO_METHOD_NAMES.has(key)) && !(o.shape.k === "prim" && o.shape.type === "string" && key === "toString")) {
251818
251984
  if ((o.shape.k === "tuple" || o.shape.k === "arr") && (key === "toString" || key === "toLocaleString" || key === "join")) {
251819
251985
  return arrayMethodAbs(key === "join" ? "join" : key);
251820
251986
  }
251987
+ if (o.shape.k !== "prim" && (ARRAY_PROTO_METHOD_NAMES.has(key) || key === "@@iterator")) {
251988
+ return absFunction([], { body: noBody2 });
251989
+ }
251821
251990
  return objectProtoMethodAbs(key);
251822
251991
  }
251823
251992
  if (noteNullishMemberThrows(o, key, "property")) {
@@ -252531,7 +252700,9 @@ __export(calls_exports, {
252531
252700
  $recordBinding: () => $recordBinding,
252532
252701
  MAX_B_CALL_DEPTH: () => MAX_B_CALL_DEPTH,
252533
252702
  MAX_B_TOTAL_CALLS: () => MAX_B_TOTAL_CALLS,
252703
+ blockHostSideEffect: () => blockHostSideEffect,
252534
252704
  getBCallCollector: () => getBCallCollector,
252705
+ neverExecHostName: () => neverExecHostName,
252535
252706
  noteBCallRecord: () => noteBCallRecord,
252536
252707
  resetBCallBudget: () => resetBCallBudget,
252537
252708
  setBAssignCollector: () => setBAssignCollector,
@@ -252600,6 +252771,12 @@ function neverExecHostName(fn2) {
252600
252771
  }
252601
252772
  return null;
252602
252773
  }
252774
+ function blockHostSideEffect(fn2) {
252775
+ const hostName = neverExecHostName(fn2);
252776
+ if (hostName === null) return null;
252777
+ noteHostEffectBlocked(hostName);
252778
+ return abs({ k: "unknown" }, void 0, void 0, "opaque");
252779
+ }
252603
252780
  function noteBCallRecord(r) {
252604
252781
  if (!bCallCollector) return;
252605
252782
  try {
@@ -252681,12 +252858,11 @@ function $callNamed(name, fn2, args, loc, argLocs) {
252681
252858
  try {
252682
252859
  if (typeof fn2 === "function") {
252683
252860
  const g = GLOBAL_FNS.has(name) && fn2 === globalThis[name] ? evalGlobalFn(name, args) : void 0;
252684
- const blockedHost = g === void 0 ? neverExecHostName(fn2) : null;
252861
+ const blockedHost = g === void 0 ? blockHostSideEffect(fn2) : null;
252685
252862
  if (g !== void 0) {
252686
252863
  result = g;
252687
252864
  } else if (blockedHost !== null) {
252688
- noteHostEffectBlocked(blockedHost);
252689
- result = bTruncatedAbs();
252865
+ result = blockedHost;
252690
252866
  } else {
252691
252867
  const entered = bEnterCall(name, fn2, args);
252692
252868
  if (!entered.ok) {
@@ -252957,6 +253133,8 @@ function $new(cls, args) {
252957
253133
  }
252958
253134
  }
252959
253135
  if (typeof cls === "function") {
253136
+ const blockedHost = blockHostSideEffect(cls);
253137
+ if (blockedHost) return blockedHost;
252960
253138
  if (cls === Array) {
252961
253139
  return makeArrayCtorAbs(args);
252962
253140
  }
@@ -253251,13 +253429,11 @@ function $invoke(thisVal, method, args, loc) {
253251
253429
  }
253252
253430
  const brandName = thisVal.shape.k === "brand" ? thisVal.shape.name : void 0;
253253
253431
  if (brandName) {
253254
- if (brandName === "Map" || brandName === "Set") {
253255
- const viaCol = evalBuiltinInstanceMethod(brandName, method, thisVal, args);
253256
- if (viaCol !== void 0) return viaCol;
253257
- if (method === "forEach") {
253258
- const r = $collectionForEach(thisVal, args[0]);
253259
- if (r !== void 0) return r;
253260
- }
253432
+ const viaBuiltin = evalBuiltinInstanceMethod(brandName, method, thisVal, args);
253433
+ if (viaBuiltin !== void 0) return viaBuiltin;
253434
+ if ((brandName === "Map" || brandName === "Set") && method === "forEach") {
253435
+ const r = $collectionForEach(thisVal, args[0]);
253436
+ if (r !== void 0) return r;
253261
253437
  }
253262
253438
  const m = findMethod(brandName, method);
253263
253439
  if (m) {
@@ -258774,37 +258950,105 @@ function parseObjectLiteral(content) {
258774
258950
  }
258775
258951
  return absExact({ k: "obj", slots });
258776
258952
  }
258953
+ function scanWithStrings(s, onChar, onStructural) {
258954
+ let depth = 0;
258955
+ let inString = null;
258956
+ for (let i = 0; i < s.length; i++) {
258957
+ const ch = s[i];
258958
+ if (inString) {
258959
+ onChar(ch, i);
258960
+ if (ch === "\\") {
258961
+ i++;
258962
+ if (i < s.length) onChar(s[i], i);
258963
+ continue;
258964
+ }
258965
+ if (ch === inString) inString = null;
258966
+ continue;
258967
+ }
258968
+ if (ch === '"' || ch === "'") {
258969
+ inString = ch;
258970
+ onChar(ch, i);
258971
+ continue;
258972
+ }
258973
+ if (ch === "(" || ch === "[" || ch === "{") {
258974
+ depth++;
258975
+ onChar(ch, i);
258976
+ onStructural(ch, i, depth);
258977
+ continue;
258978
+ }
258979
+ if (ch === ")" || ch === "]" || ch === "}") {
258980
+ depth--;
258981
+ onChar(ch, i);
258982
+ onStructural(ch, i, depth);
258983
+ continue;
258984
+ }
258985
+ onChar(ch, i);
258986
+ onStructural(ch, i, depth);
258987
+ }
258988
+ }
258777
258989
  function splitTopLevelArgs(s) {
258778
258990
  const result = [];
258779
- let depth = 0;
258780
258991
  let current = "";
258781
- for (const ch of s) {
258992
+ let depth = 0;
258993
+ let inString = null;
258994
+ for (let i = 0; i < s.length; i++) {
258995
+ const ch = s[i];
258996
+ if (inString) {
258997
+ current += ch;
258998
+ if (ch === "\\") {
258999
+ i++;
259000
+ if (i < s.length) current += s[i];
259001
+ continue;
259002
+ }
259003
+ if (ch === inString) inString = null;
259004
+ continue;
259005
+ }
259006
+ if (ch === '"' || ch === "'") {
259007
+ inString = ch;
259008
+ current += ch;
259009
+ continue;
259010
+ }
258782
259011
  if (ch === "(" || ch === "[" || ch === "{") depth++;
258783
259012
  if (ch === ")" || ch === "]" || ch === "}") depth--;
258784
259013
  if (ch === "," && depth === 0) {
258785
259014
  result.push(current.trim());
258786
259015
  current = "";
258787
- } else {
258788
- current += ch;
259016
+ continue;
258789
259017
  }
259018
+ current += ch;
258790
259019
  }
258791
259020
  if (current.trim()) result.push(current.trim());
258792
259021
  return result;
258793
259022
  }
258794
259023
  function findTopLevelColon(s) {
258795
- let depth = 0;
258796
- for (let i = 0; i < s.length; i++) {
258797
- const ch = s[i];
258798
- if (ch === "(" || ch === "[" || ch === "{") depth++;
258799
- if (ch === ")" || ch === "]" || ch === "}") depth--;
258800
- if (ch === ":" && depth === 0) return i;
258801
- }
258802
- return -1;
259024
+ let found = -1;
259025
+ scanWithStrings(
259026
+ s,
259027
+ () => {
259028
+ },
259029
+ (ch, i, depth) => {
259030
+ if (found === -1 && ch === ":" && depth === 0) found = i;
259031
+ }
259032
+ );
259033
+ return found;
258803
259034
  }
258804
259035
  function findTopLevelArrow(s) {
258805
259036
  let depth = 0;
259037
+ let inString = null;
258806
259038
  for (let i = 0; i < s.length - 1; i++) {
258807
259039
  const ch = s[i];
259040
+ if (inString) {
259041
+ if (ch === "\\") {
259042
+ i++;
259043
+ continue;
259044
+ }
259045
+ if (ch === inString) inString = null;
259046
+ continue;
259047
+ }
259048
+ if (ch === '"' || ch === "'") {
259049
+ inString = ch;
259050
+ continue;
259051
+ }
258808
259052
  if (ch === "(" || ch === "[" || ch === "{") depth++;
258809
259053
  else if (ch === ")" || ch === "]" || ch === "}") depth--;
258810
259054
  else if (depth === 0 && ch === "=" && s[i + 1] === ">") return i;
@@ -258814,9 +259058,23 @@ function findTopLevelArrow(s) {
258814
259058
  function extractBalancedParens(text, startIdx) {
258815
259059
  if (text[startIdx] !== "(") return null;
258816
259060
  let depth = 0;
259061
+ let inString = null;
258817
259062
  for (let i = startIdx; i < text.length; i++) {
258818
- if (text[i] === "(") depth++;
258819
- if (text[i] === ")") depth--;
259063
+ const ch = text[i];
259064
+ if (inString) {
259065
+ if (ch === "\\") {
259066
+ i++;
259067
+ continue;
259068
+ }
259069
+ if (ch === inString) inString = null;
259070
+ continue;
259071
+ }
259072
+ if (ch === '"' || ch === "'") {
259073
+ inString = ch;
259074
+ continue;
259075
+ }
259076
+ if (ch === "(") depth++;
259077
+ if (ch === ")") depth--;
258820
259078
  if (depth === 0) return text.slice(startIdx + 1, i);
258821
259079
  }
258822
259080
  return null;
@@ -262539,14 +262797,21 @@ function setSessionCacheFromProject(partial2) {
262539
262797
  function checkConfig(config) {
262540
262798
  const raw = config?.check;
262541
262799
  const rawEntry = raw?.entryThrows;
262800
+ const rawProfile = raw?.profile;
262542
262801
  let entryThrows = "error";
262543
- if (rawEntry === "off" || rawEntry === "warning" || rawEntry === "error") {
262802
+ const entryValid = rawEntry === "off" || rawEntry === "warning" || rawEntry === "error";
262803
+ if (entryValid) {
262544
262804
  entryThrows = rawEntry;
262545
- } else if (rawEntry !== void 0) {
262546
- process.stderr?.write?.(
262547
- `nudo.check.entryThrows: invalid value ${JSON.stringify(rawEntry)} (expected error|warning|off); using error
262805
+ } else {
262806
+ if (rawEntry !== void 0) {
262807
+ process.stderr?.write?.(
262808
+ `nudo.check.entryThrows: invalid value ${JSON.stringify(rawEntry)} (expected error|warning|off); using error
262548
262809
  `
262549
- );
262810
+ );
262811
+ }
262812
+ if (rawProfile === "adoption" || rawProfile === "strict") {
262813
+ entryThrows = rawProfile === "adoption" ? "warning" : "error";
262814
+ }
262550
262815
  }
262551
262816
  const ignore = Array.isArray(raw?.ignoreThrows) ? raw.ignoreThrows.filter((s) => typeof s === "string" && s.length > 0) : [];
262552
262817
  return { entryThrows, ignoreThrows: ignore };
@@ -267452,7 +267717,7 @@ function ifaceCacheKey2(filePath, source, opts) {
267452
267717
  );
267453
267718
  }
267454
267719
 
267455
- // ../service/dist/chunk-ZXVAX7DE.js
267720
+ // ../service/dist/chunk-COMUCF3K.js
267456
267721
  import { readFileSync as readFileSync17, existsSync as existsSync18, statSync as statSync13, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
267457
267722
  import { resolve as resolvePath3, join as joinPath2 } from "path";
267458
267723
  import { pathToFileURL as pathToFileURL2 } from "url";
@@ -268141,7 +268406,7 @@ function resolveNpmJsEntry2(source, fromDir) {
268141
268406
  return tryFile(resolve22(pkgDir, subpath));
268142
268407
  }
268143
268408
 
268144
- // ../service/dist/chunk-NQXAF4LJ.js
268409
+ // ../service/dist/chunk-H2LVQGKH.js
268145
268410
  import traverse2 from "@babel/traverse";
268146
268411
  import { existsSync as existsSync23, statSync as statSync23, readFileSync as readFileSync23 } from "fs";
268147
268412
  import { dirname as dirname23, resolve as resolve23, join as join14 } from "path";