@aegis-engine/core 0.5.0 → 0.7.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.
@@ -1,9 +1,9 @@
1
1
  var hs = Object.defineProperty;
2
2
  var bs = (e, t, n) => t in e ? hs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var ee = (e, t, n) => bs(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { keccak256 as xt, zeroAddress as Ee, erc721Abi as Vt, hashTypedData as gs, isAddress as vs, erc20Abi as Nr, encodeFunctionData as Tn, BaseError as Yr, ContractFunctionRevertedError as qi, numberToHex as ws, encodeAbiParameters as Bi, parseAbiParameters as As, RpcRequestError as Fi, isHex as Vi, decodeErrorResult as Ts, ExecutionRevertedError as Ra, getEventSelector as Xe, getAbiItem as Ze } from "viem";
4
+ import { keccak256 as xt, zeroAddress as Ee, erc721Abi as Vt, hashTypedData as gs, isAddress as vs, erc20Abi as Nr, encodeFunctionData as Tn, BaseError as Yr, ContractFunctionRevertedError as Bi, numberToHex as ws, encodeAbiParameters as Fi, parseAbiParameters as As, RpcRequestError as Vi, isHex as Ui, decodeErrorResult as Ts, ExecutionRevertedError as Oa, getEventSelector as Xe, getAbiItem as Ze } from "viem";
5
5
  import "viem/actions";
6
- import { a as Oa, s as Sa } from "./index-DuoaODpB.js";
6
+ import { a as Sa, s as qa } from "./index-DofKgro2.js";
7
7
  class f extends Array {
8
8
  constructor(t, n) {
9
9
  if (super(t), this.sign = n, t > f.__kMaxLength) throw new RangeError("Maximum BigInt size exceeded");
@@ -1018,14 +1018,14 @@ f.__kMaxLength = 33554432, f.__kMaxLengthBits = f.__kMaxLength << 5, f.__kMaxBit
1018
1018
  }, f.__imul = Math.imul || function(e, t) {
1019
1019
  return 0 | e * t;
1020
1020
  };
1021
- var qa;
1021
+ var Ba;
1022
1022
  (function(e) {
1023
1023
  e[e.EXACT_INPUT = 0] = "EXACT_INPUT", e[e.EXACT_OUTPUT = 1] = "EXACT_OUTPUT";
1024
- })(qa || (qa = {}));
1025
- var Ba;
1024
+ })(Ba || (Ba = {}));
1025
+ var Fa;
1026
1026
  (function(e) {
1027
1027
  e[e.ROUND_DOWN = 0] = "ROUND_DOWN", e[e.ROUND_HALF_UP = 1] = "ROUND_HALF_UP", e[e.ROUND_UP = 2] = "ROUND_UP";
1028
- })(Ba || (Ba = {}));
1028
+ })(Fa || (Fa = {}));
1029
1029
  const Gn = f.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
1030
1030
  var Is = "Invariant failed";
1031
1031
  function Ke(e, t) {
@@ -1067,7 +1067,7 @@ var Ht = 1e9, Es = {
1067
1067
  // The natural logarithm of 10.
1068
1068
  // 115 digits
1069
1069
  LN10: "2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"
1070
- }, Xr, xe = !0, ze = "[DecimalError] ", kt = ze + "Invalid argument: ", Qr = ze + "Exponent out of range: ", zt = Math.floor, At = Math.pow, xs = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, He, Ce = 1e7, Te = 7, Ui = 9007199254740991, Cn = zt(Ui / Te), B = {};
1070
+ }, Xr, xe = !0, ze = "[DecimalError] ", kt = ze + "Invalid argument: ", Qr = ze + "Exponent out of range: ", zt = Math.floor, At = Math.pow, xs = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, He, Ce = 1e7, Te = 7, Wi = 9007199254740991, Cn = zt(Wi / Te), B = {};
1071
1071
  B.absoluteValue = B.abs = function() {
1072
1072
  var e = new this.constructor(this);
1073
1073
  return e.s && (e.s = 1), e;
@@ -1132,7 +1132,7 @@ B.logarithm = B.log = function(e) {
1132
1132
  };
1133
1133
  B.minus = B.sub = function(e) {
1134
1134
  var t = this;
1135
- return e = new t.constructor(e), t.s == e.s ? Hi(t, e) : Wi(t, (e.s = -e.s, e));
1135
+ return e = new t.constructor(e), t.s == e.s ? zi(t, e) : $i(t, (e.s = -e.s, e));
1136
1136
  };
1137
1137
  B.modulo = B.mod = function(e) {
1138
1138
  var t, n = this, r = n.constructor, a = r.precision;
@@ -1140,7 +1140,7 @@ B.modulo = B.mod = function(e) {
1140
1140
  return n.s ? (xe = !1, t = dt(n, e, 0, 1).times(e), xe = !0, n.minus(t)) : Ae(new r(n), a);
1141
1141
  };
1142
1142
  B.naturalExponential = B.exp = function() {
1143
- return $i(this);
1143
+ return Hi(this);
1144
1144
  };
1145
1145
  B.naturalLogarithm = B.ln = function() {
1146
1146
  return an(this);
@@ -1151,7 +1151,7 @@ B.negated = B.neg = function() {
1151
1151
  };
1152
1152
  B.plus = B.add = function(e) {
1153
1153
  var t = this;
1154
- return e = new t.constructor(e), t.s == e.s ? Wi(t, e) : Hi(t, (e.s = -e.s, e));
1154
+ return e = new t.constructor(e), t.s == e.s ? $i(t, e) : zi(t, (e.s = -e.s, e));
1155
1155
  };
1156
1156
  B.precision = B.sd = function(e) {
1157
1157
  var t, n, r, a = this;
@@ -1222,13 +1222,13 @@ B.toPower = B.pow = function(e) {
1222
1222
  if (s.eq(He)) return s;
1223
1223
  if (r = l.precision, e.eq(He)) return Ae(s, r);
1224
1224
  if (t = e.e, n = e.d.length - 1, o = t >= n, i = s.s, o) {
1225
- if ((n = d < 0 ? -d : d) <= Ui) {
1226
- for (a = new l(He), t = Math.ceil(r / Te + 4), xe = !1; n % 2 && (a = a.times(s), Va(a.d, t)), n = zt(n / 2), n !== 0; )
1227
- s = s.times(s), Va(s.d, t);
1225
+ if ((n = d < 0 ? -d : d) <= Wi) {
1226
+ for (a = new l(He), t = Math.ceil(r / Te + 4), xe = !1; n % 2 && (a = a.times(s), Ua(a.d, t)), n = zt(n / 2), n !== 0; )
1227
+ s = s.times(s), Ua(s.d, t);
1228
1228
  return xe = !0, e.s < 0 ? new l(He).div(a) : Ae(a, r);
1229
1229
  }
1230
1230
  } else if (i < 0) throw Error(ze + "NaN");
1231
- return i = i < 0 && e.d[Math.max(t, n)] & 1 ? -1 : 1, s.s = 1, xe = !1, a = e.times(an(s, r + u)), xe = !0, a = $i(a), a.s = i, a;
1231
+ return i = i < 0 && e.d[Math.max(t, n)] & 1 ? -1 : 1, s.s = 1, xe = !1, a = e.times(an(s, r + u)), xe = !0, a = Hi(a), a.s = i, a;
1232
1232
  };
1233
1233
  B.toPrecision = function(e, t) {
1234
1234
  var n, r, a = this, i = a.constructor;
@@ -1242,7 +1242,7 @@ B.toString = B.valueOf = B.val = B.toJSON = B[Symbol.for("nodejs.util.inspect.cu
1242
1242
  var e = this, t = Ne(e), n = e.constructor;
1243
1243
  return Pt(e, t <= n.toExpNeg || t >= n.toExpPos);
1244
1244
  };
1245
- function Wi(e, t) {
1245
+ function $i(e, t) {
1246
1246
  var n, r, a, i, o, s, l, u, d = e.constructor, c = d.precision;
1247
1247
  if (!e.s || !t.s)
1248
1248
  return t.s || (t = new d(e)), xe ? Ae(t, c) : t;
@@ -1313,7 +1313,7 @@ var dt = /* @__PURE__ */ (function() {
1313
1313
  return g[0] || g.shift(), y.e = l, Ae(y, o ? i + Ne(y) + 1 : i);
1314
1314
  };
1315
1315
  })();
1316
- function $i(e, t) {
1316
+ function Hi(e, t) {
1317
1317
  var n, r, a, i, o, s, l = 0, u = 0, d = e.constructor, c = d.precision;
1318
1318
  if (Ne(e) > 16) throw Error(Qr + Ne(e));
1319
1319
  if (!e.s) return new d(He);
@@ -1358,7 +1358,7 @@ function an(e, t) {
1358
1358
  s = l, a += 2;
1359
1359
  }
1360
1360
  }
1361
- function Fa(e, t) {
1361
+ function Va(e, t) {
1362
1362
  var n, r, a;
1363
1363
  for ((n = t.indexOf(".")) > -1 && (t = t.replace(".", "")), (r = t.search(/e/i)) > 0 ? (n < 0 && (n = r), n += +t.slice(r + 1), t = t.substring(0, r)) : n < 0 && (n = t.length), r = 0; t.charCodeAt(r) === 48; ) ++r;
1364
1364
  for (a = t.length; t.charCodeAt(a - 1) === 48; ) --a;
@@ -1401,7 +1401,7 @@ function Ae(e, t, n) {
1401
1401
  throw Error(Qr + Ne(e));
1402
1402
  return e;
1403
1403
  }
1404
- function Hi(e, t) {
1404
+ function zi(e, t) {
1405
1405
  var n, r, a, i, o, s, l, u, d, c, p = e.constructor, y = p.precision;
1406
1406
  if (!e.s || !t.s)
1407
1407
  return t.s ? t.s = -t.s : t = new p(e), xe ? Ae(t, y) : t;
@@ -1432,11 +1432,11 @@ function Pt(e, t, n) {
1432
1432
  var r, a = Ne(e), i = Je(e.d), o = i.length;
1433
1433
  return t ? (n && (r = n - o) > 0 ? i = i.charAt(0) + "." + i.slice(1) + mt(r) : o > 1 && (i = i.charAt(0) + "." + i.slice(1)), i = i + (a < 0 ? "e" : "e+") + a) : a < 0 ? (i = "0." + mt(-a - 1) + i, n && (r = n - o) > 0 && (i += mt(r))) : a >= o ? (i += mt(a + 1 - o), n && (r = n - a - 1) > 0 && (i = i + "." + mt(r))) : ((r = a + 1) < o && (i = i.slice(0, r) + "." + i.slice(r)), n && (r = n - o) > 0 && (a + 1 === o && (i += "."), i += mt(r))), e.s < 0 ? "-" + i : i;
1434
1434
  }
1435
- function Va(e, t) {
1435
+ function Ua(e, t) {
1436
1436
  if (e.length > t)
1437
1437
  return e.length = t, !0;
1438
1438
  }
1439
- function zi(e) {
1439
+ function Gi(e) {
1440
1440
  var t, n, r;
1441
1441
  function a(i) {
1442
1442
  var o = this;
@@ -1460,13 +1460,13 @@ function zi(e) {
1460
1460
  o.e = 0, o.d = [i];
1461
1461
  return;
1462
1462
  }
1463
- return Fa(o, i.toString());
1463
+ return Va(o, i.toString());
1464
1464
  } else if (typeof i != "string")
1465
1465
  throw Error(kt + i);
1466
- if (i.charCodeAt(0) === 45 ? (i = i.slice(1), o.s = -1) : o.s = 1, xs.test(i)) Fa(o, i);
1466
+ if (i.charCodeAt(0) === 45 ? (i = i.slice(1), o.s = -1) : o.s = 1, xs.test(i)) Va(o, i);
1467
1467
  else throw Error(kt + i);
1468
1468
  }
1469
- if (a.prototype = B, a.ROUND_UP = 0, a.ROUND_DOWN = 1, a.ROUND_CEIL = 2, a.ROUND_FLOOR = 3, a.ROUND_HALF_UP = 4, a.ROUND_HALF_DOWN = 5, a.ROUND_HALF_EVEN = 6, a.ROUND_HALF_CEIL = 7, a.ROUND_HALF_FLOOR = 8, a.clone = zi, a.config = a.set = ks, e === void 0 && (e = {}), e)
1469
+ if (a.prototype = B, a.ROUND_UP = 0, a.ROUND_DOWN = 1, a.ROUND_CEIL = 2, a.ROUND_FLOOR = 3, a.ROUND_HALF_UP = 4, a.ROUND_HALF_DOWN = 5, a.ROUND_HALF_EVEN = 6, a.ROUND_HALF_CEIL = 7, a.ROUND_HALF_FLOOR = 8, a.clone = Gi, a.config = a.set = ks, e === void 0 && (e = {}), e)
1470
1470
  for (r = ["precision", "rounding", "toExpNeg", "toExpPos", "LN10"], t = 0; t < r.length; ) e.hasOwnProperty(n = r[t++]) || (e[n] = this[n]);
1471
1471
  return a.config(e), a;
1472
1472
  }
@@ -1496,14 +1496,14 @@ function ks(e) {
1496
1496
  else throw Error(kt + n + ": " + r);
1497
1497
  return this;
1498
1498
  }
1499
- var Xr = zi(Es);
1499
+ var Xr = Gi(Es);
1500
1500
  He = new Xr(1);
1501
1501
  const Ds = Xr;
1502
- var Ns = 20, Ls = 1, Mn = 1e6, Ua = 1e6, Ps = -7, _s = 21, Zr = "[big.js] ", fn = Zr + "Invalid ", Jr = fn + "decimal places", Wa = fn + "rounding mode", Gi = Zr + "Division by zero", Ie = {}, _t = void 0, Cs = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
1503
- function ji() {
1502
+ var Ns = 20, Ls = 1, Mn = 1e6, Wa = 1e6, Ps = -7, _s = 21, Zr = "[big.js] ", fn = Zr + "Invalid ", Jr = fn + "decimal places", $a = fn + "rounding mode", ji = Zr + "Division by zero", Ie = {}, _t = void 0, Cs = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
1503
+ function Ki() {
1504
1504
  function e(t) {
1505
1505
  var n = this;
1506
- if (!(n instanceof e)) return t === _t ? ji() : new e(t);
1506
+ if (!(n instanceof e)) return t === _t ? Ki() : new e(t);
1507
1507
  t instanceof e ? (n.s = t.s, n.e = t.e, n.c = t.c.slice()) : Ms(n, t), n.constructor = e;
1508
1508
  }
1509
1509
  return e.prototype = Ie, e.DP = Ns, e.RM = Ls, e.NE = Ps, e.PE = _s, e.version = "5.2.2", e;
@@ -1530,7 +1530,7 @@ function jn(e, t, n, r) {
1530
1530
  r = a[i] > 5 || a[i] == 5 && (r || i < 0 || a[i + 1] !== _t || a[i - 1] & 1);
1531
1531
  else if (n === 3)
1532
1532
  r = r || !!a[0];
1533
- else if (r = !1, n !== 0) throw Error(Wa);
1533
+ else if (r = !1, n !== 0) throw Error($a);
1534
1534
  if (i < 1)
1535
1535
  a.length = 1, r ? (e.e = -t, a[0] = 1) : a[0] = e.e = 0;
1536
1536
  else {
@@ -1540,7 +1540,7 @@ function jn(e, t, n, r) {
1540
1540
  for (i = a.length; !a[--i]; ) a.pop();
1541
1541
  }
1542
1542
  } else if (n < 0 || n > 3 || n !== ~~n)
1543
- throw Error(Wa);
1543
+ throw Error($a);
1544
1544
  return e;
1545
1545
  }
1546
1546
  function mn(e, t, n, r) {
@@ -1577,7 +1577,7 @@ Ie.cmp = function(e) {
1577
1577
  Ie.div = function(e) {
1578
1578
  var t = this, n = t.constructor, r = t.c, a = (e = new n(e)).c, i = t.s == e.s ? 1 : -1, o = n.DP;
1579
1579
  if (o !== ~~o || o < 0 || o > Mn) throw Error(Jr);
1580
- if (!a[0]) throw Error(Gi);
1580
+ if (!a[0]) throw Error(ji);
1581
1581
  if (!r[0]) return new n(i * 0);
1582
1582
  var s, l, u, d, c, p = a.slice(), y = s = a.length, g = r.length, m = r.slice(0, s), h = m.length, b = e, A = b.c = [], T = 0, I = o + (b.e = t.e - e.e) + 1;
1583
1583
  for (b.s = i, i = I < 0 ? 0 : I, p.unshift(0); h++ < s; ) m.push(0);
@@ -1653,7 +1653,7 @@ Ie.minus = Ie.sub = function(e) {
1653
1653
  };
1654
1654
  Ie.mod = function(e) {
1655
1655
  var t, n = this, r = n.constructor, a = n.s, i = (e = new r(e)).s;
1656
- if (!e.c[0]) throw Error(Gi);
1656
+ if (!e.c[0]) throw Error(ji);
1657
1657
  return n.s = e.s = 1, t = e.cmp(n) == 1, n.s = a, e.s = i, t ? new r(n) : (a = r.DP, i = r.RM, r.DP = r.RM = 0, n = n.div(e), r.DP = a, r.RM = i, this.minus(n.times(e)));
1658
1658
  };
1659
1659
  Ie.plus = Ie.add = function(e) {
@@ -1672,7 +1672,7 @@ Ie.plus = Ie.add = function(e) {
1672
1672
  };
1673
1673
  Ie.pow = function(e) {
1674
1674
  var t = this, n = new t.constructor(1), r = n, a = e < 0;
1675
- if (e !== ~~e || e < -Ua || e > Ua) throw Error(fn + "exponent");
1675
+ if (e !== ~~e || e < -Wa || e > Wa) throw Error(fn + "exponent");
1676
1676
  for (a && (e = -e); e & 1 && (r = r.times(t)), e >>= 1, !!e; )
1677
1677
  t = t.times(t);
1678
1678
  return a ? n.div(r) : r;
@@ -1720,13 +1720,13 @@ Ie.toString = function() {
1720
1720
  Ie.valueOf = Ie.toJSON = function() {
1721
1721
  return mn(this, 4);
1722
1722
  };
1723
- ji();
1723
+ Ki();
1724
1724
  function Rs(e) {
1725
1725
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1726
1726
  }
1727
- var ar = { exports: {} }, $a;
1727
+ var ar = { exports: {} }, Ha;
1728
1728
  function Os() {
1729
- return $a || ($a = 1, (function(e) {
1729
+ return Ha || (Ha = 1, (function(e) {
1730
1730
  function t(n) {
1731
1731
  return n.prototype.toFormat = function(a, i, o) {
1732
1732
  if (!this.e && this.e !== 0) return this.toString();
@@ -1750,7 +1750,7 @@ function Os() {
1750
1750
  }
1751
1751
  var Ss = Os();
1752
1752
  const qs = /* @__PURE__ */ Rs(Ss);
1753
- function Ha(e, t) {
1753
+ function za(e, t) {
1754
1754
  (t == null || t > e.length) && (t = e.length);
1755
1755
  for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
1756
1756
  return r;
@@ -1775,9 +1775,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1775
1775
  }
1776
1776
  function Fs(e, t) {
1777
1777
  if (e) {
1778
- if (typeof e == "string") return Ha(e, t);
1778
+ if (typeof e == "string") return za(e, t);
1779
1779
  var n = {}.toString.call(e).slice(8, -1);
1780
- return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ha(e, t) : void 0;
1780
+ return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? za(e, t) : void 0;
1781
1781
  }
1782
1782
  }
1783
1783
  var st, lt;
@@ -1793,7 +1793,7 @@ var ht = /* @__PURE__ */ f.BigInt(0), on = /* @__PURE__ */ f.BigInt(1), It = /*
1793
1793
  return f.notEqual(f.remainder(i, a), ht) && (o = f.add(o, on)), o;
1794
1794
  }, e;
1795
1795
  })(), Vs = /* @__PURE__ */ f.subtract(/* @__PURE__ */ f.exponentiate(/* @__PURE__ */ f.BigInt(2), /* @__PURE__ */ f.BigInt(160)), on);
1796
- function za(e, t) {
1796
+ function Ga(e, t) {
1797
1797
  var n = f.multiply(e, t);
1798
1798
  return f.bitwiseAnd(n, Gn);
1799
1799
  }
@@ -1801,7 +1801,7 @@ function Us(e, t) {
1801
1801
  var n = f.add(e, t);
1802
1802
  return f.bitwiseAnd(n, Gn);
1803
1803
  }
1804
- var Ki = /* @__PURE__ */ (function() {
1804
+ var Yi = /* @__PURE__ */ (function() {
1805
1805
  function e() {
1806
1806
  }
1807
1807
  return e.getAmount0Delta = function(n, r, a, i) {
@@ -1825,7 +1825,7 @@ var Ki = /* @__PURE__ */ (function() {
1825
1825
  if (f.equal(a, ht)) return n;
1826
1826
  var o = f.leftShift(r, f.BigInt(96));
1827
1827
  if (i) {
1828
- var s = za(a, n);
1828
+ var s = Ga(a, n);
1829
1829
  if (f.equal(f.divide(s, a), n)) {
1830
1830
  var l = Us(o, s);
1831
1831
  if (f.greaterThanOrEqual(l, o))
@@ -1833,7 +1833,7 @@ var Ki = /* @__PURE__ */ (function() {
1833
1833
  }
1834
1834
  return wt.mulDivRoundingUp(o, on, f.add(f.divide(o, n), a));
1835
1835
  } else {
1836
- var u = za(a, n);
1836
+ var u = Ga(a, n);
1837
1837
  f.equal(f.divide(u, a), n) || Ke(), f.greaterThan(o, u) || Ke();
1838
1838
  var d = f.subtract(o, u);
1839
1839
  return wt.mulDivRoundingUp(o, n, d);
@@ -1901,7 +1901,7 @@ function Gs(e, t, n) {
1901
1901
  var a = f.multiply(f.multiply(f.BigInt(n), e), t), i = f.multiply(It, f.subtract(t, e));
1902
1902
  return f.divide(a, i);
1903
1903
  }
1904
- function Ga(e, t, n) {
1904
+ function ja(e, t, n) {
1905
1905
  if (f.greaterThan(e, t)) {
1906
1906
  var r = [t, e];
1907
1907
  e = r[0], t = r[1];
@@ -1917,10 +1917,10 @@ function js(e, t, n, r, a, i) {
1917
1917
  if (f.lessThanOrEqual(e, t))
1918
1918
  return s(t, n, r);
1919
1919
  if (f.lessThan(e, n)) {
1920
- var l = s(e, n, r), u = Ga(t, e, a);
1920
+ var l = s(e, n, r), u = ja(t, e, a);
1921
1921
  return f.lessThan(l, u) ? l : u;
1922
1922
  } else
1923
- return Ga(t, n, a);
1923
+ return ja(t, n, a);
1924
1924
  }
1925
1925
  function sn() {
1926
1926
  return sn = Object.assign ? Object.assign.bind() : function(e) {
@@ -1937,10 +1937,10 @@ var P;
1937
1937
  e[e.MAINNET = 1] = "MAINNET", e[e.GOERLI = 5] = "GOERLI", e[e.SEPOLIA = 11155111] = "SEPOLIA", e[e.OPTIMISM = 10] = "OPTIMISM", e[e.OPTIMISM_GOERLI = 420] = "OPTIMISM_GOERLI", e[e.OPTIMISM_SEPOLIA = 11155420] = "OPTIMISM_SEPOLIA", e[e.ARBITRUM_ONE = 42161] = "ARBITRUM_ONE", e[e.ARBITRUM_GOERLI = 421613] = "ARBITRUM_GOERLI", e[e.ARBITRUM_SEPOLIA = 421614] = "ARBITRUM_SEPOLIA", e[e.POLYGON = 137] = "POLYGON", e[e.POLYGON_MUMBAI = 80001] = "POLYGON_MUMBAI", e[e.CELO = 42220] = "CELO", e[e.CELO_ALFAJORES = 44787] = "CELO_ALFAJORES", e[e.GNOSIS = 100] = "GNOSIS", e[e.MOONBEAM = 1284] = "MOONBEAM", e[e.BNB = 56] = "BNB", e[e.AVALANCHE = 43114] = "AVALANCHE", e[e.BASE_GOERLI = 84531] = "BASE_GOERLI", e[e.BASE = 8453] = "BASE", e[e.ZORA = 7777777] = "ZORA", e[e.ZORA_SEPOLIA = 999999999] = "ZORA_SEPOLIA", e[e.ROOTSTOCK = 30] = "ROOTSTOCK", e[e.BLAST = 81457] = "BLAST", e[e.ZKSYNC = 324] = "ZKSYNC", e[e.WORLDCHAIN = 480] = "WORLDCHAIN", e[e.UNICHAIN_SEPOLIA = 1301] = "UNICHAIN_SEPOLIA", e[e.UNICHAIN = 130] = "UNICHAIN", e[e.MONAD_TESTNET = 41454] = "MONAD_TESTNET";
1938
1938
  })(P || (P = {}));
1939
1939
  P.MAINNET, P.OPTIMISM, P.OPTIMISM_GOERLI, P.OPTIMISM_SEPOLIA, P.ARBITRUM_ONE, P.ARBITRUM_GOERLI, P.ARBITRUM_SEPOLIA, P.POLYGON, P.POLYGON_MUMBAI, P.GOERLI, P.SEPOLIA, P.CELO_ALFAJORES, P.CELO, P.BNB, P.AVALANCHE, P.BASE, P.BASE_GOERLI, P.ZORA, P.ZORA_SEPOLIA, P.ROOTSTOCK, P.BLAST, P.ZKSYNC, P.WORLDCHAIN, P.UNICHAIN_SEPOLIA, P.UNICHAIN;
1940
- var ja;
1940
+ var Ka;
1941
1941
  (function(e) {
1942
1942
  e.ETHER = "ETH", e.MATIC = "MATIC", e.CELO = "CELO", e.GNOSIS = "XDAI", e.MOONBEAM = "GLMR", e.BNB = "BNB", e.AVAX = "AVAX", e.ROOTSTOCK = "RBTC";
1943
- })(ja || (ja = {}));
1943
+ })(Ka || (Ka = {}));
1944
1944
  var Re, Fe, we, or, sr, lr, ur, cr, Ks = [P.MAINNET, P.GOERLI, P.SEPOLIA];
1945
1945
  function Ys(e, t) {
1946
1946
  return t === void 0 && (t = []), Ks.concat(t).reduce(function(n, r) {
@@ -1963,7 +1963,7 @@ var yn = {
1963
1963
  }), Zs = yn, Js = /* @__PURE__ */ sn({}, yn, {
1964
1964
  multicallAddress: "0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB",
1965
1965
  tickLensAddress: "0xbfd8137f7d1516D3ea5cA83523914859ec47F573"
1966
- }), Ka = yn, Ya = {
1966
+ }), Ya = yn, Qa = {
1967
1967
  v3CoreFactoryAddress: "0xAfE208a311B21f13EF87E33A90049fC17A7acDEc",
1968
1968
  multicallAddress: "0x633987602DE5C4F337e3DbF265303A1080324204",
1969
1969
  quoterAddress: "0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8",
@@ -2120,16 +2120,16 @@ var yn = {
2120
2120
  tickLensAddress: "0xd5d76fa166ab8d8ad4c9f61aaa81457b66cbe443",
2121
2121
  swapRouter02Address: "0x73855d06de49d0fe4a9c42636ba96c62da12ff9c"
2122
2122
  };
2123
- we = {}, we[P.MAINNET] = Qs, we[P.OPTIMISM] = Zs, we[P.ARBITRUM_ONE] = Js, we[P.POLYGON] = Ka, we[P.POLYGON_MUMBAI] = Ka, we[P.GOERLI] = Xs, we[P.CELO] = Ya, we[P.CELO_ALFAJORES] = Ya, we[P.BNB] = el, we[P.OPTIMISM_GOERLI] = tl, we[P.OPTIMISM_SEPOLIA] = nl, we[P.ARBITRUM_GOERLI] = rl, we[P.ARBITRUM_SEPOLIA] = al, we[P.SEPOLIA] = il, we[P.AVALANCHE] = ol, we[P.BASE] = sl, we[P.BASE_GOERLI] = ll, we[P.ZORA] = ul, we[P.ZORA_SEPOLIA] = cl, we[P.ROOTSTOCK] = dl, we[P.BLAST] = pl, we[P.ZKSYNC] = fl, we[P.WORLDCHAIN] = ml, we[P.UNICHAIN_SEPOLIA] = yl, we[P.UNICHAIN] = hl;
2123
+ we = {}, we[P.MAINNET] = Qs, we[P.OPTIMISM] = Zs, we[P.ARBITRUM_ONE] = Js, we[P.POLYGON] = Ya, we[P.POLYGON_MUMBAI] = Ya, we[P.GOERLI] = Xs, we[P.CELO] = Qa, we[P.CELO_ALFAJORES] = Qa, we[P.BNB] = el, we[P.OPTIMISM_GOERLI] = tl, we[P.OPTIMISM_SEPOLIA] = nl, we[P.ARBITRUM_GOERLI] = rl, we[P.ARBITRUM_SEPOLIA] = al, we[P.SEPOLIA] = il, we[P.AVALANCHE] = ol, we[P.BASE] = sl, we[P.BASE_GOERLI] = ll, we[P.ZORA] = ul, we[P.ZORA_SEPOLIA] = cl, we[P.ROOTSTOCK] = dl, we[P.BLAST] = pl, we[P.ZKSYNC] = fl, we[P.WORLDCHAIN] = ml, we[P.UNICHAIN_SEPOLIA] = yl, we[P.UNICHAIN] = hl;
2124
2124
  or = {}, or[P.MAINNET] = "0xC4e172459f1E7939D522503B81AFAaC1014CE6F6";
2125
2125
  sr = {}, sr[P.MAINNET] = "0x408ED6354d4973f66138C91495F2f2FCbd8724C3";
2126
2126
  lr = {}, lr[P.MAINNET] = "0x090D4613473dEE047c3f2706764f49E0821D256e";
2127
2127
  ur = {}, ur[P.MAINNET] = "0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8";
2128
2128
  cr = {}, cr[P.MAINNET] = "0x65770b5283117639760beA3F867b69b3697a91dd";
2129
- var Qa;
2129
+ var Xa;
2130
2130
  (function(e) {
2131
2131
  e[e.EXACT_INPUT = 0] = "EXACT_INPUT", e[e.EXACT_OUTPUT = 1] = "EXACT_OUTPUT";
2132
- })(Qa || (Qa = {}));
2132
+ })(Xa || (Xa = {}));
2133
2133
  var bt;
2134
2134
  (function(e) {
2135
2135
  e[e.ROUND_DOWN = 0] = "ROUND_DOWN", e[e.ROUND_HALF_UP = 1] = "ROUND_HALF_UP", e[e.ROUND_UP = 2] = "ROUND_UP";
@@ -2153,7 +2153,7 @@ class Dt extends Error {
2153
2153
  return ((a = (r = n.errors) == null ? void 0 : r[0]) == null ? void 0 : a.message) ?? `GraphQL Error (Code: ${String(n.status)})`;
2154
2154
  }
2155
2155
  }
2156
- const Xa = (e) => e.toUpperCase(), pr = (e) => typeof e == "function" ? e() : e, Yi = (e, t) => e.map((n, r) => [n, t[r]]), Ot = (e) => {
2156
+ const Za = (e) => e.toUpperCase(), pr = (e) => typeof e == "function" ? e() : e, Qi = (e, t) => e.map((n, r) => [n, t[r]]), Ot = (e) => {
2157
2157
  let t = {};
2158
2158
  return e instanceof Headers ? t = bl(e) : Array.isArray(e) ? e.forEach(([n, r]) => {
2159
2159
  n && r !== void 0 && (t[n] = r);
@@ -2166,11 +2166,11 @@ const Xa = (e) => e.toUpperCase(), pr = (e) => typeof e == "function" ? e() : e,
2166
2166
  }, gl = (e) => {
2167
2167
  try {
2168
2168
  const t = e();
2169
- return vl(t) ? t.catch((n) => Za(n)) : t;
2169
+ return vl(t) ? t.catch((n) => Ja(n)) : t;
2170
2170
  } catch (t) {
2171
- return Za(t);
2171
+ return Ja(t);
2172
2172
  }
2173
- }, Za = (e) => e instanceof Error ? e : new Error(String(e)), vl = (e) => typeof e == "object" && e !== null && "then" in e && typeof e.then == "function" && "catch" in e && typeof e.catch == "function" && "finally" in e && typeof e.finally == "function", ea = (e) => {
2173
+ }, Ja = (e) => e instanceof Error ? e : new Error(String(e)), vl = (e) => typeof e == "object" && e !== null && "then" in e && typeof e.then == "function" && "catch" in e && typeof e.catch == "function" && "finally" in e && typeof e.finally == "function", ea = (e) => {
2174
2174
  throw new Error(`Unhandled case: ${String(e)}`);
2175
2175
  }, Dn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), wl = (e, t) => e.documents ? e : {
2176
2176
  documents: e,
@@ -2209,26 +2209,26 @@ function Lr(e, t) {
2209
2209
  };
2210
2210
  }
2211
2211
  function xl(e) {
2212
- return Qi(
2212
+ return Xi(
2213
2213
  e.source,
2214
2214
  Lr(e.source, e.start)
2215
2215
  );
2216
2216
  }
2217
- function Qi(e, t) {
2217
+ function Xi(e, t) {
2218
2218
  const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, a = t.line - 1, i = e.locationOffset.line - 1, o = t.line + i, s = t.line === 1 ? n : 0, l = t.column + s, u = `${e.name}:${o}:${l}
2219
2219
  `, d = r.split(/\r\n|[\n\r]/g), c = d[a];
2220
2220
  if (c.length > 120) {
2221
2221
  const p = Math.floor(l / 80), y = l % 80, g = [];
2222
2222
  for (let m = 0; m < c.length; m += 80)
2223
2223
  g.push(c.slice(m, m + 80));
2224
- return u + Ja([
2224
+ return u + ei([
2225
2225
  [`${o} |`, g[0]],
2226
2226
  ...g.slice(1, p + 1).map((m) => ["|", m]),
2227
2227
  ["|", "^".padStart(y)],
2228
2228
  ["|", g[p + 1]]
2229
2229
  ]);
2230
2230
  }
2231
- return u + Ja([
2231
+ return u + ei([
2232
2232
  // Lines specified like this: ["prefix", "string"],
2233
2233
  [`${o - 1} |`, d[a - 1]],
2234
2234
  [`${o} |`, c],
@@ -2236,7 +2236,7 @@ function Qi(e, t) {
2236
2236
  [`${o + 1} |`, d[a + 1]]
2237
2237
  ]);
2238
2238
  }
2239
- function Ja(e) {
2239
+ function ei(e) {
2240
2240
  const t = e.filter(([r, a]) => a !== void 0), n = Math.max(...t.map(([r]) => r.length));
2241
2241
  return t.map(([r, a]) => r.padStart(n) + (a ? " " + a : "")).join(`
2242
2242
  `);
@@ -2368,10 +2368,10 @@ class ta extends Error {
2368
2368
  constructor(t, ...n) {
2369
2369
  var r, a, i;
2370
2370
  const { nodes: o, source: s, positions: l, path: u, originalError: d, extensions: c } = kl(n);
2371
- super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = d ?? void 0, this.nodes = ei(
2371
+ super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = d ?? void 0, this.nodes = ti(
2372
2372
  Array.isArray(o) ? o : o ? [o] : void 0
2373
2373
  );
2374
- const p = ei(
2374
+ const p = ti(
2375
2375
  (r = this.nodes) === null || r === void 0 ? void 0 : r.map((g) => g.loc).filter((g) => g != null)
2376
2376
  );
2377
2377
  this.source = s ?? (p == null || (a = p[0]) === null || a === void 0 ? void 0 : a.source), this.positions = l ?? (p == null ? void 0 : p.map((g) => g.start)), this.locations = l && s ? l.map((g) => Lr(s, g)) : p == null ? void 0 : p.map((g) => Lr(g.source, g.start));
@@ -2442,7 +2442,7 @@ class ta extends Error {
2442
2442
  for (const n of this.locations)
2443
2443
  t += `
2444
2444
 
2445
- ` + Qi(this.source, n);
2445
+ ` + Xi(this.source, n);
2446
2446
  return t;
2447
2447
  }
2448
2448
  /**
@@ -2467,7 +2467,7 @@ class ta extends Error {
2467
2467
  return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
2468
2468
  }
2469
2469
  }
2470
- function ei(e) {
2470
+ function ti(e) {
2471
2471
  return e === void 0 || e.length === 0 ? void 0 : e;
2472
2472
  }
2473
2473
  function _e(e, t, n) {
@@ -2531,7 +2531,7 @@ class Dl {
2531
2531
  };
2532
2532
  }
2533
2533
  }
2534
- class Xi {
2534
+ class Zi {
2535
2535
  /** The kind of Token. */
2536
2536
  /** The character offset at which this Node begins. */
2537
2537
  /** The character offset at which this Node ends. */
@@ -2600,7 +2600,7 @@ class Xi {
2600
2600
  };
2601
2601
  }
2602
2602
  }
2603
- const Zi = {
2603
+ const Ji = {
2604
2604
  Name: [],
2605
2605
  Document: ["definitions"],
2606
2606
  OperationDefinition: [
@@ -2694,8 +2694,8 @@ const Zi = {
2694
2694
  ArgumentCoordinate: ["name", "fieldName", "argumentName"],
2695
2695
  DirectiveCoordinate: ["name"],
2696
2696
  DirectiveArgumentCoordinate: ["name", "argumentName"]
2697
- }, Nl = new Set(Object.keys(Zi));
2698
- function ti(e) {
2697
+ }, Nl = new Set(Object.keys(Ji));
2698
+ function ni(e) {
2699
2699
  const t = e == null ? void 0 : e.kind;
2700
2700
  return typeof t == "string" && Nl.has(t);
2701
2701
  }
@@ -2717,15 +2717,15 @@ function _r(e) {
2717
2717
  function ln(e) {
2718
2718
  return e >= 48 && e <= 57;
2719
2719
  }
2720
- function Ji(e) {
2720
+ function eo(e) {
2721
2721
  return e >= 97 && e <= 122 || // A-Z
2722
2722
  e >= 65 && e <= 90;
2723
2723
  }
2724
- function eo(e) {
2725
- return Ji(e) || e === 95;
2724
+ function to(e) {
2725
+ return eo(e) || e === 95;
2726
2726
  }
2727
2727
  function Ll(e) {
2728
- return Ji(e) || ln(e) || e === 95;
2728
+ return eo(e) || ln(e) || e === 95;
2729
2729
  }
2730
2730
  function Pl(e) {
2731
2731
  var t;
@@ -2783,7 +2783,7 @@ class Ml {
2783
2783
  * ```
2784
2784
  */
2785
2785
  constructor(t) {
2786
- const n = new Xi(N.SOF, 0, 0, 0, 0);
2786
+ const n = new Zi(N.SOF, 0, 0, 0, 0);
2787
2787
  this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
2788
2788
  }
2789
2789
  /**
@@ -2846,12 +2846,12 @@ function Gt(e) {
2846
2846
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
2847
2847
  }
2848
2848
  function Kn(e, t) {
2849
- return to(e.charCodeAt(t)) && no(e.charCodeAt(t + 1));
2849
+ return no(e.charCodeAt(t)) && ro(e.charCodeAt(t + 1));
2850
2850
  }
2851
- function to(e) {
2851
+ function no(e) {
2852
2852
  return e >= 55296 && e <= 56319;
2853
2853
  }
2854
- function no(e) {
2854
+ function ro(e) {
2855
2855
  return e >= 56320 && e <= 57343;
2856
2856
  }
2857
2857
  function Ct(e, t) {
@@ -2866,7 +2866,7 @@ function Ct(e, t) {
2866
2866
  }
2867
2867
  function ke(e, t, n, r, a) {
2868
2868
  const i = e.line, o = 1 + n - e.lineStart;
2869
- return new Xi(t, n, r, i, o, a);
2869
+ return new Zi(t, n, r, i, o, a);
2870
2870
  }
2871
2871
  function Ol(e, t) {
2872
2872
  const n = e.source.body, r = n.length;
@@ -2954,7 +2954,7 @@ function Ol(e, t) {
2954
2954
  }
2955
2955
  if (ln(i) || i === 45)
2956
2956
  return ql(e, a, i);
2957
- if (eo(i))
2957
+ if (to(i))
2958
2958
  return $l(e, a);
2959
2959
  throw _e(
2960
2960
  e.source,
@@ -3001,7 +3001,7 @@ function ql(e, t, n) {
3001
3001
  );
3002
3002
  } else
3003
3003
  a = fr(e, a, i), i = r.charCodeAt(a);
3004
- if (i === 46 && (o = !0, i = r.charCodeAt(++a), a = fr(e, a, i), i = r.charCodeAt(a)), (i === 69 || i === 101) && (o = !0, i = r.charCodeAt(++a), (i === 43 || i === 45) && (i = r.charCodeAt(++a)), a = fr(e, a, i), i = r.charCodeAt(a)), i === 46 || eo(i))
3004
+ if (i === 46 && (o = !0, i = r.charCodeAt(++a), a = fr(e, a, i), i = r.charCodeAt(a)), (i === 69 || i === 101) && (o = !0, i = r.charCodeAt(++a), (i === 43 || i === 45) && (i = r.charCodeAt(++a)), a = fr(e, a, i), i = r.charCodeAt(a)), i === 46 || to(i))
3005
3005
  throw _e(
3006
3006
  e.source,
3007
3007
  a,
@@ -3091,15 +3091,15 @@ function Fl(e, t) {
3091
3091
  );
3092
3092
  }
3093
3093
  function Vl(e, t) {
3094
- const n = e.source.body, r = ni(n, t + 2);
3094
+ const n = e.source.body, r = ri(n, t + 2);
3095
3095
  if (Gt(r))
3096
3096
  return {
3097
3097
  value: String.fromCodePoint(r),
3098
3098
  size: 6
3099
3099
  };
3100
- if (to(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3101
- const a = ni(n, t + 8);
3102
- if (no(a))
3100
+ if (no(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3101
+ const a = ri(n, t + 8);
3102
+ if (ro(a))
3103
3103
  return {
3104
3104
  value: String.fromCodePoint(r, a),
3105
3105
  size: 12
@@ -3111,7 +3111,7 @@ function Vl(e, t) {
3111
3111
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
3112
3112
  );
3113
3113
  }
3114
- function ni(e, t) {
3114
+ function ri(e, t) {
3115
3115
  return en(e.charCodeAt(t)) << 12 | en(e.charCodeAt(t + 1)) << 8 | en(e.charCodeAt(t + 2)) << 4 | en(e.charCodeAt(t + 3));
3116
3116
  }
3117
3117
  function en(e) {
@@ -3232,7 +3232,7 @@ function $l(e, t) {
3232
3232
  n.slice(t, a)
3233
3233
  );
3234
3234
  }
3235
- const Hl = 10, ro = 2;
3235
+ const Hl = 10, ao = 2;
3236
3236
  function na(e) {
3237
3237
  return Yn(e, []);
3238
3238
  }
@@ -3267,14 +3267,14 @@ function Gl(e) {
3267
3267
  }
3268
3268
  function jl(e, t) {
3269
3269
  const n = Object.entries(e);
3270
- return n.length === 0 ? "{}" : t.length > ro ? "[" + Yl(e) + "]" : "{ " + n.map(
3270
+ return n.length === 0 ? "{}" : t.length > ao ? "[" + Yl(e) + "]" : "{ " + n.map(
3271
3271
  ([a, i]) => a + ": " + Yn(i, t)
3272
3272
  ).join(", ") + " }";
3273
3273
  }
3274
3274
  function Kl(e, t) {
3275
3275
  if (e.length === 0)
3276
3276
  return "[]";
3277
- if (t.length > ro)
3277
+ if (t.length > ao)
3278
3278
  return "[Array]";
3279
3279
  const n = Math.min(Hl, e.length), r = e.length - n, a = [];
3280
3280
  for (let i = 0; i < n; ++i)
@@ -3324,7 +3324,7 @@ spurious results.`);
3324
3324
  return !1;
3325
3325
  }
3326
3326
  );
3327
- class ao {
3327
+ class io {
3328
3328
  /** The GraphQL source text. */
3329
3329
  /** Name used in diagnostics for this source, such as a file path or request name. */
3330
3330
  /** One-indexed line and column where this source begins. */
@@ -3369,7 +3369,7 @@ class ao {
3369
3369
  }
3370
3370
  }
3371
3371
  function Zl(e) {
3372
- return Xl(e, ao);
3372
+ return Xl(e, io);
3373
3373
  }
3374
3374
  function Jl(e, t) {
3375
3375
  const n = new eu(e, t), r = n.parseDocument();
@@ -3384,7 +3384,7 @@ class eu {
3384
3384
  if (r)
3385
3385
  this._lexer = r;
3386
3386
  else {
3387
- const i = Zl(t) ? t : new ao(t);
3387
+ const i = Zl(t) ? t : new io(t);
3388
3388
  this._lexer = new Ml(i);
3389
3389
  }
3390
3390
  this._options = a, this._tokenCounter = 0;
@@ -4572,7 +4572,7 @@ class eu {
4572
4572
  throw _e(
4573
4573
  this._lexer.source,
4574
4574
  n.start,
4575
- `Expected ${io(t)}, found ${In(n)}.`
4575
+ `Expected ${oo(t)}, found ${In(n)}.`
4576
4576
  );
4577
4577
  }
4578
4578
  /**
@@ -4698,9 +4698,9 @@ class eu {
4698
4698
  }
4699
4699
  function In(e) {
4700
4700
  const t = e.value;
4701
- return io(e.kind) + (t != null ? ` "${t}"` : "");
4701
+ return oo(e.kind) + (t != null ? ` "${t}"` : "");
4702
4702
  }
4703
- function io(e) {
4703
+ function oo(e) {
4704
4704
  return Rl(e) ? `"${e}"` : e;
4705
4705
  }
4706
4706
  function tu(e) {
@@ -4877,7 +4877,7 @@ const au = [
4877
4877
  "\\u009E",
4878
4878
  "\\u009F"
4879
4879
  ], iu = Object.freeze({});
4880
- function ou(e, t, n = Zi) {
4880
+ function ou(e, t, n = Ji) {
4881
4881
  const r = /* @__PURE__ */ new Map();
4882
4882
  for (const b of Object.values(z))
4883
4883
  r.set(b, su(t, b));
@@ -4909,7 +4909,7 @@ function ou(e, t, n = Zi) {
4909
4909
  let T;
4910
4910
  if (!Array.isArray(u)) {
4911
4911
  var g, m;
4912
- ti(u) || Nn(!1, `Invalid AST Node: ${na(u)}.`);
4912
+ ni(u) || Nn(!1, `Invalid AST Node: ${na(u)}.`);
4913
4913
  const I = b ? (g = r.get(u.kind)) === null || g === void 0 ? void 0 : g.leave : (m = r.get(u.kind)) === null || m === void 0 ? void 0 : m.enter;
4914
4914
  if (T = I == null ? void 0 : I.call(t, u, d, c, p, y), T === iu)
4915
4915
  break;
@@ -4919,7 +4919,7 @@ function ou(e, t, n = Zi) {
4919
4919
  continue;
4920
4920
  }
4921
4921
  } else if (T !== void 0 && (l.push([d, T]), !b))
4922
- if (ti(T))
4922
+ if (ni(T))
4923
4923
  u = T;
4924
4924
  else {
4925
4925
  p.pop();
@@ -5251,20 +5251,20 @@ function mr(e) {
5251
5251
  return (t = e == null ? void 0 : e.some((n) => n.includes(`
5252
5252
  `))) !== null && t !== void 0 ? t : !1;
5253
5253
  }
5254
- const ri = "Accept", Cr = "Content-Type", Mr = "application/json", oo = "application/graphql-response+json", ai = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), du = (e) => {
5254
+ const ai = "Accept", Cr = "Content-Type", Mr = "application/json", so = "application/graphql-response+json", ii = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), du = (e) => {
5255
5255
  const t = e.toLowerCase();
5256
- return t.includes(oo) || t.includes(Mr);
5257
- }, ii = (e) => {
5256
+ return t.includes(so) || t.includes(Mr);
5257
+ }, oi = (e) => {
5258
5258
  try {
5259
5259
  if (Array.isArray(e))
5260
5260
  return {
5261
5261
  _tag: "Batch",
5262
- executionResults: e.map(oi)
5262
+ executionResults: e.map(si)
5263
5263
  };
5264
5264
  if (Dn(e))
5265
5265
  return {
5266
5266
  _tag: "Single",
5267
- executionResult: oi(e)
5267
+ executionResult: si(e)
5268
5268
  };
5269
5269
  throw new Error(`Invalid execution result: result is not object or array.
5270
5270
  Got:
@@ -5272,7 +5272,7 @@ ${String(e)}`);
5272
5272
  } catch (t) {
5273
5273
  return t;
5274
5274
  }
5275
- }, oi = (e) => {
5275
+ }, si = (e) => {
5276
5276
  if (typeof e != "object" || e === null)
5277
5277
  throw new Error("Invalid execution result: result is not object");
5278
5278
  let t, n, r;
@@ -5296,14 +5296,14 @@ ${String(e)}`);
5296
5296
  errors: t,
5297
5297
  extensions: r
5298
5298
  };
5299
- }, pu = (e) => e._tag === "Batch" ? e.executionResults.some(si) : si(e.executionResult), si = (e) => Array.isArray(e.errors) ? e.errors.length > 0 : !!e.errors, so = (e) => typeof e == "object" && e !== null && "kind" in e && e.kind === z.OPERATION_DEFINITION, fu = (e) => {
5299
+ }, pu = (e) => e._tag === "Batch" ? e.executionResults.some(li) : li(e.executionResult), li = (e) => Array.isArray(e.errors) ? e.errors.length > 0 : !!e.errors, lo = (e) => typeof e == "object" && e !== null && "kind" in e && e.kind === z.OPERATION_DEFINITION, fu = (e) => {
5300
5300
  var r;
5301
5301
  let t;
5302
- const n = e.definitions.filter(so);
5302
+ const n = e.definitions.filter(lo);
5303
5303
  return n.length === 1 && (t = (r = n[0].name) == null ? void 0 : r.value), t;
5304
5304
  }, mu = (e) => {
5305
5305
  let t = !1;
5306
- const n = e.definitions.filter(so);
5306
+ const n = e.definitions.filter(lo);
5307
5307
  return n.length === 1 && (t = n[0].operation === "mutation"), t;
5308
5308
  }, yr = (e, t) => {
5309
5309
  const n = typeof e == "string" || "kind" in e ? e : String(e), r = typeof n == "string" ? n : lu(n);
@@ -5315,7 +5315,7 @@ ${String(e)}`);
5315
5315
  }, ra = JSON, hr = async (e) => {
5316
5316
  const t = {
5317
5317
  ...e,
5318
- method: e.request._tag === "Single" ? e.request.document.isMutation ? "POST" : Xa(e.method ?? "post") : e.request.hasMutations ? "POST" : Xa(e.method ?? "post"),
5318
+ method: e.request._tag === "Single" ? e.request.document.isMutation ? "POST" : Za(e.method ?? "post") : e.request.hasMutations ? "POST" : Za(e.method ?? "post"),
5319
5319
  fetchOptions: {
5320
5320
  ...e.fetchOptions,
5321
5321
  errorPolicy: e.fetchOptions.errorPolicy ?? "none"
@@ -5363,24 +5363,24 @@ ${String(e)}`);
5363
5363
  case "Single":
5364
5364
  return {
5365
5365
  ...o,
5366
- ...li(t)(i.executionResult)
5366
+ ...ui(t)(i.executionResult)
5367
5367
  };
5368
5368
  case "Batch":
5369
5369
  return {
5370
5370
  ...o,
5371
- data: i.executionResults.map(li(t))
5371
+ data: i.executionResults.map(ui(t))
5372
5372
  };
5373
5373
  default:
5374
5374
  ea(i);
5375
5375
  }
5376
- }, li = (e) => (t) => ({
5376
+ }, ui = (e) => (t) => ({
5377
5377
  extensions: t.extensions,
5378
5378
  data: t.data,
5379
5379
  errors: e.fetchOptions.errorPolicy === "all" ? t.errors : void 0
5380
- }), yu = (e, t, n) => t && du(t) ? ii(n.parse(e)) : ii(e), hu = (e) => async (t) => {
5380
+ }), yu = (e, t, n) => t && du(t) ? oi(n.parse(e)) : oi(e), hu = (e) => async (t) => {
5381
5381
  const n = new Headers(t.headers);
5382
5382
  let r = null, a;
5383
- n.has(ri) || n.set(ri, [oo, Mr].join(", ")), e === "POST" ? (a = (t.fetchOptions.jsonSerializer ?? ra).stringify(bu(t)), typeof a == "string" && !n.has(Cr) && n.set(Cr, Mr)) : r = gu(t);
5383
+ n.has(ai) || n.set(ai, [so, Mr].join(", ")), e === "POST" ? (a = (t.fetchOptions.jsonSerializer ?? ra).stringify(bu(t)), typeof a == "string" && !n.has(Cr) && n.set(Cr, Mr)) : r = gu(t);
5384
5384
  const i = { method: e, headers: n, body: a, ...t.fetchOptions };
5385
5385
  let o = new URL(t.url), s = i;
5386
5386
  if (t.middleware) {
@@ -5404,7 +5404,7 @@ ${String(e)}`);
5404
5404
  operationName: e.request.document.operationName
5405
5405
  };
5406
5406
  case "Batch":
5407
- return Yi(e.request.query, e.request.variables ?? []).map(([t, n]) => ({
5407
+ return Qi(e.request.query, e.request.variables ?? []).map(([t, n]) => ({
5408
5408
  query: t,
5409
5409
  variables: n
5410
5410
  }));
@@ -5416,9 +5416,9 @@ ${String(e)}`);
5416
5416
  const t = e.fetchOptions.jsonSerializer ?? ra, n = new URLSearchParams();
5417
5417
  switch (e.request._tag) {
5418
5418
  case "Single":
5419
- return n.append("query", ai(e.request.document.expression)), e.request.variables && n.append("variables", t.stringify(e.request.variables)), e.request.document.operationName && n.append("operationName", e.request.document.operationName), n;
5419
+ return n.append("query", ii(e.request.document.expression)), e.request.variables && n.append("variables", t.stringify(e.request.variables)), e.request.document.operationName && n.append("operationName", e.request.document.operationName), n;
5420
5420
  case "Batch": {
5421
- const a = ((r = e.request.variables) == null ? void 0 : r.map((s) => t.stringify(s))) ?? [], i = e.request.query.map(ai), o = Yi(i, a).map(([s, l]) => ({
5421
+ const a = ((r = e.request.variables) == null ? void 0 : r.map((s) => t.stringify(s))) ?? [], i = e.request.query.map(ii), o = Qi(i, a).map(([s, l]) => ({
5422
5422
  query: s,
5423
5423
  variables: l
5424
5424
  }));
@@ -5428,7 +5428,7 @@ ${String(e)}`);
5428
5428
  throw ea(e.request);
5429
5429
  }
5430
5430
  };
5431
- class ui {
5431
+ class ci {
5432
5432
  constructor(t, n = {}) {
5433
5433
  ee(this, "url");
5434
5434
  ee(this, "requestConfig");
@@ -5550,7 +5550,7 @@ function Oe(e, t) {
5550
5550
  var re = 10n ** 18n, Le = 1000000n, wu = 1000n, hn = 950000n;
5551
5551
  function aa(e) {
5552
5552
  return xt(
5553
- Bi(As("address, address, uint24, int24, address"), [
5553
+ Fi(As("address, address, uint24, int24, address"), [
5554
5554
  e.currency0,
5555
5555
  e.currency1,
5556
5556
  e.fee,
@@ -5559,7 +5559,7 @@ function aa(e) {
5559
5559
  ])
5560
5560
  );
5561
5561
  }
5562
- var Au = class lo {
5562
+ var Au = class uo {
5563
5563
  /**
5564
5564
  * Creates a new AegisMarket instance.
5565
5565
  *
@@ -5635,7 +5635,7 @@ var Au = class lo {
5635
5635
  */
5636
5636
  static fromRaw(t) {
5637
5637
  const n = aa(t.key);
5638
- return new lo({
5638
+ return new uo({
5639
5639
  poolId: n,
5640
5640
  poolKey: t.key,
5641
5641
  initialized: t.initialized,
@@ -6006,15 +6006,15 @@ function Ve(e, t) {
6006
6006
  const n = e + t;
6007
6007
  return n > Ft ? e : n;
6008
6008
  }
6009
- function ci(e, t) {
6009
+ function di(e, t) {
6010
6010
  return e < t ? e : t;
6011
6011
  }
6012
- function di(e, t) {
6012
+ function pi(e, t) {
6013
6013
  if (t === 0n)
6014
6014
  throw new Error("divCeil: division by zero");
6015
6015
  return e === 0n ? 0n : (e + t - 1n) / t;
6016
6016
  }
6017
- var Mt = 1n << 96n, pi = gt.MIN_TICK, fi = gt.MAX_TICK;
6017
+ var Mt = 1n << 96n, fi = gt.MIN_TICK, mi = gt.MAX_TICK;
6018
6018
  function Ye(e) {
6019
6019
  return f.BigInt(e.toString());
6020
6020
  }
@@ -6027,7 +6027,7 @@ function pt(e) {
6027
6027
  function On(e, t, n, r) {
6028
6028
  const [a, i] = e <= t ? [e, t] : [t, e];
6029
6029
  return Qn(
6030
- Ki.getAmount0Delta(
6030
+ Yi.getAmount0Delta(
6031
6031
  Ye(a),
6032
6032
  Ye(i),
6033
6033
  Ye(n),
@@ -6038,7 +6038,7 @@ function On(e, t, n, r) {
6038
6038
  function Sn(e, t, n, r) {
6039
6039
  const [a, i] = e <= t ? [e, t] : [t, e];
6040
6040
  return Qn(
6041
- Ki.getAmount1Delta(
6041
+ Yi.getAmount1Delta(
6042
6042
  Ye(a),
6043
6043
  Ye(i),
6044
6044
  Ye(n),
@@ -6092,7 +6092,7 @@ function Cu(e, t) {
6092
6092
  );
6093
6093
  }
6094
6094
  function Mu(e) {
6095
- const t = pt(e.tickLower), n = pt(e.tickUpper), r = On(t, n, e.liquidity, !1), a = Sn(t, n, e.liquidity, !1), i = di(e.liquidity * Mt, n), o = di(e.liquidity * t, Mt);
6095
+ const t = pt(e.tickLower), n = pt(e.tickUpper), r = On(t, n, e.liquidity, !1), a = Sn(t, n, e.liquidity, !1), i = pi(e.liquidity * Mt, n), o = pi(e.liquidity * t, Mt);
6096
6096
  return {
6097
6097
  tickLower: e.tickLower,
6098
6098
  tickUpper: e.tickUpper,
@@ -6238,9 +6238,9 @@ function qu(e, t, n, r, a, i) {
6238
6238
  const q = g(k, T), O = g(L, I);
6239
6239
  if (q.ok && O.ok && A > 0n) {
6240
6240
  const M = ut(q.value, O.value), R = Ve(M, A);
6241
- C = ci(C, R);
6241
+ C = di(C, R);
6242
6242
  }
6243
- if (b = ci(b, C), b === 0n) break;
6243
+ if (b = di(b, C), b === 0n) break;
6244
6244
  }
6245
6245
  if (b === Ft) {
6246
6246
  let w = Ft;
@@ -6577,7 +6577,7 @@ var yt = 0n, Se = 0n, Bu = 0n, Qe = "0x0000000000000000000000000000000000000001"
6577
6577
  * @returns this (for chaining)
6578
6578
  */
6579
6579
  addAction(e, t) {
6580
- const n = Fu[e], r = Bi(
6580
+ const n = Fu[e], r = Fi(
6581
6581
  // Need to cast since encodeAbiParameters expects mutable array
6582
6582
  n,
6583
6583
  t
@@ -6618,7 +6618,7 @@ function ca(e) {
6618
6618
  const t = BigInt.asIntN(128, e >> 128n), n = BigInt.asIntN(128, e & Uu);
6619
6619
  return { amount0: t, amount1: n };
6620
6620
  }
6621
- function uo(e, t) {
6621
+ function co(e, t) {
6622
6622
  if (e > me || e < Rr || t > me || t < Rr)
6623
6623
  throw new Error(
6624
6624
  `encodeBalanceDelta: amount outside signed int128 (amount0=${e}, amount1=${t})`
@@ -6627,12 +6627,12 @@ function uo(e, t) {
6627
6627
  return BigInt.asIntN(256, n | r);
6628
6628
  }
6629
6629
  function nt(e, t) {
6630
- return uo(e, t);
6630
+ return co(e, t);
6631
6631
  }
6632
6632
  function Nt(e, t) {
6633
- return uo(-e, -t);
6633
+ return co(-e, -t);
6634
6634
  }
6635
- function mi(e, t) {
6635
+ function yi(e, t) {
6636
6636
  if (e < -me || e > me)
6637
6637
  throw new RangeError(
6638
6638
  `${t} must be between -int128 max (${-me}) and int128 max (${me}); got ${e}`
@@ -6664,7 +6664,7 @@ var vt = class extends Vu {
6664
6664
  }
6665
6665
  // ── Vault Operations ────────────────────────────────────────────────
6666
6666
  addModifyDebt(e, t, n = 0n, r = 0n, a = 0n) {
6667
- return mi(t, "AegisPositionPlanner.addModifyDebt principalDelta"), this.addAction(145, [
6667
+ return yi(t, "AegisPositionPlanner.addModifyDebt principalDelta"), this.addAction(145, [
6668
6668
  e,
6669
6669
  t,
6670
6670
  n,
@@ -6686,7 +6686,7 @@ var vt = class extends Vu {
6686
6686
  }
6687
6687
  // ── Lending ─────────────────────────────────────────────────────────
6688
6688
  addModifyLiquidity(e, t, n, r = 0n, a = 0n, i = 0n) {
6689
- return mi(t, "AegisPositionPlanner.addModifyLiquidity liquidityDelta"), this.addAction(144, [
6689
+ return yi(t, "AegisPositionPlanner.addModifyLiquidity liquidityDelta"), this.addAction(144, [
6690
6690
  e,
6691
6691
  t,
6692
6692
  n,
@@ -7639,7 +7639,7 @@ var Hu = [
7639
7639
  ],
7640
7640
  PermitDetails: Hu
7641
7641
  };
7642
- function co(e, t) {
7642
+ function po(e, t) {
7643
7643
  return {
7644
7644
  domain: $u(t.chainId, t.permit2Address),
7645
7645
  types: zu,
@@ -7684,14 +7684,14 @@ async function ju(e, t, n, r, a, i) {
7684
7684
  return { amount: o, expiration: s, nonce: l };
7685
7685
  }
7686
7686
  var Ku = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
7687
- function po(e, t, n) {
7688
- return gs(co(e, { chainId: t, permit2Address: n }));
7687
+ function fo(e, t, n) {
7688
+ return gs(po(e, { chainId: t, permit2Address: n }));
7689
7689
  }
7690
- function fo(e) {
7690
+ function mo(e) {
7691
7691
  return { owner: e.owner, permitBatch: e.permitBatch, signature: e.signature };
7692
7692
  }
7693
- async function mo(e, t) {
7694
- const { chainId: n, permit2Address: r, permit: a, blockNumber: i } = t, o = co(a.permitBatch, { chainId: n, permit2Address: r }), [s, l] = await Promise.all([
7693
+ async function yo(e, t) {
7694
+ const { chainId: n, permit2Address: r, permit: a, blockNumber: i } = t, o = po(a.permitBatch, { chainId: n, permit2Address: r }), [s, l] = await Promise.all([
7695
7695
  e.verifyTypedData({
7696
7696
  address: a.owner,
7697
7697
  domain: o.domain,
@@ -7724,7 +7724,7 @@ async function mo(e, t) {
7724
7724
  permit2: r,
7725
7725
  chainId: n,
7726
7726
  blockNumber: i,
7727
- payloadDigest: po(a.permitBatch, n, r),
7727
+ payloadDigest: fo(a.permitBatch, n, r),
7728
7728
  signatureDigest: xt(a.signature),
7729
7729
  signatureValid: s,
7730
7730
  nonces: u,
@@ -7911,7 +7911,7 @@ function gr(e) {
7911
7911
  return et.encodeExecute([p], i);
7912
7912
  }
7913
7913
  var Bn = me, ct = -Rr;
7914
- function yo(e) {
7914
+ function ho(e) {
7915
7915
  const { fn: t, principalLabel: n, principal: r, maxEngineTokenDebit0: a, maxEngineTokenDebit1: i } = e;
7916
7916
  if (r > Bn)
7917
7917
  throw new Error(
@@ -7944,7 +7944,7 @@ function vr(e) {
7944
7944
  throw new Error(
7945
7945
  `buildCloseVault: currentDebt must be a non-negative rL magnitude; got ${o}`
7946
7946
  );
7947
- yo({
7947
+ ho({
7948
7948
  fn: "buildCloseVault",
7949
7949
  principalLabel: "currentDebt",
7950
7950
  principal: o,
@@ -7970,31 +7970,31 @@ function vr(e) {
7970
7970
  const w = l + (r === Ee ? d : a === Ee ? c : 0n);
7971
7971
  return et.encodeExecuteWithOptionalPermit(h, n, w, m);
7972
7972
  }
7973
- var yi = f.exponentiate(f.BigInt(2), f.BigInt(96));
7974
- f.multiply(yi, yi);
7973
+ var hi = f.exponentiate(f.BigInt(2), f.BigInt(96));
7974
+ f.multiply(hi, hi);
7975
7975
  function Zu(e) {
7976
7976
  return Number(e) / Number(Mt);
7977
7977
  }
7978
- function ho(e, t, n) {
7978
+ function bo(e, t, n) {
7979
7979
  const r = Zu(e), a = r * r, i = t - n;
7980
7980
  return a * Math.pow(10, i);
7981
7981
  }
7982
- var bo = 31556736;
7982
+ var go = 31556736;
7983
7983
  function Ju(e, t, n) {
7984
- const r = n / bo;
7984
+ const r = n / go;
7985
7985
  return e / (1 + t * r);
7986
7986
  }
7987
7987
  function Zn(e) {
7988
7988
  return e >= 1 ? 0 : e <= 0 ? 1 : Math.sqrt(1 - e * e);
7989
7989
  }
7990
7990
  function ec(e, t, n, r) {
7991
- return 2 * e * t * n * (r / bo);
7991
+ return 2 * e * t * n * (r / go);
7992
7992
  }
7993
7993
  function Rt(e, t, n) {
7994
- return ho(e, t, n);
7994
+ return bo(e, t, n);
7995
7995
  }
7996
7996
  function ft(e, t, n) {
7997
- return Math.sqrt(ho(e, t, n));
7997
+ return Math.sqrt(bo(e, t, n));
7998
7998
  }
7999
7999
  function Kt(e) {
8000
8000
  return e === 0n ? 0n : (1n << 192n) / e;
@@ -8126,37 +8126,37 @@ function rc(e, t, n) {
8126
8126
  const T = Math.sqrt(A), I = (-h - T) / (2 * m);
8127
8127
  return !Number.isFinite(I) || I <= 0 ? 0n : tc(I, e.market.decimals0);
8128
8128
  }
8129
- function go(e, t) {
8129
+ function vo(e, t) {
8130
8130
  const n = it(e.tauPips);
8131
8131
  if (n <= 0 || n >= 1 || !Number.isFinite(t) || t < 0) return 0;
8132
8132
  const { sqrtP: r, p: a, xEff: i, yEff: o } = ot(e), s = i + t / r;
8133
8133
  return s <= 0 ? 0 : t === 0 ? Math.max(0, o + a * s) : s - t / (n * r) <= 0 ? Math.max(0, o + t * r - t * t / (n * n * s)) : Math.max(0, o + t * r + a * s - 2 * t * r / n);
8134
8134
  }
8135
- function vo(e) {
8136
- return wo(e).yMax;
8137
- }
8138
8135
  function wo(e) {
8136
+ return Ao(e).yMax;
8137
+ }
8138
+ function Ao(e) {
8139
8139
  const t = it(e.tauPips);
8140
8140
  if (t <= 0 || t >= 1) return { yMax: 0n, gammaNewL: 0n };
8141
8141
  const n = Zn(t);
8142
8142
  if (n <= 0 || n >= 1) return { yMax: 0n, gammaNewL: 0n };
8143
8143
  const { sqrtP: r, xEff: a, gammaPreHuman: i, gammaScale: o } = ot(e), s = a > 0 ? a * r * (1 - n) / n : 0, l = Math.max(s, i);
8144
8144
  if (l <= 0) return { yMax: 0n, gammaNewL: 0n };
8145
- const u = rt(go(e, l), e.market.decimals1), d = Math.max(0, l - i), c = Lt(d, o);
8145
+ const u = rt(vo(e, l), e.market.decimals1), d = Math.max(0, l - i), c = Lt(d, o);
8146
8146
  return { yMax: u, gammaNewL: c };
8147
8147
  }
8148
- function Ao(e) {
8148
+ function To(e) {
8149
8149
  const { gammaPreHuman: t } = ot(e);
8150
- return rt(go(e, t), e.market.decimals1);
8150
+ return rt(vo(e, t), e.market.decimals1);
8151
8151
  }
8152
8152
  function ac(e) {
8153
- const t = vo(e), n = Ao(e);
8153
+ const t = wo(e), n = To(e);
8154
8154
  return t > n ? t : n;
8155
8155
  }
8156
8156
  function ic(e) {
8157
8157
  return !Number.isFinite(e) || e < 0 ? 0 : e >= Fn ? 1 : e / Fn;
8158
8158
  }
8159
- function To(e, t, n) {
8159
+ function Io(e, t, n) {
8160
8160
  const r = it(e.tauPips);
8161
8161
  if (r <= 0 || r >= 1 || !Number.isFinite(t) || t < 0) return 0;
8162
8162
  const { sqrtP: a, p: i, xEff: o, yEff: s } = ot(e), l = ic(n), u = i * (1 - l), d = a * Math.sqrt(Math.max(0, 1 - l)), c = o + t / a;
@@ -8173,7 +8173,7 @@ function sc(e, t) {
8173
8173
  const { sqrtP: a, xEff: i, gammaPreHuman: o, gammaScale: s } = ot(e), l = i > 0 ? i * a * (1 - r) / r : 0, u = Math.max(l, o);
8174
8174
  if (u <= 0) return { yMax: 0n, gammaNewL: 0n };
8175
8175
  const d = rt(
8176
- To(e, u, t),
8176
+ Io(e, u, t),
8177
8177
  e.market.decimals1
8178
8178
  ), c = Math.max(0, u - o), p = Lt(c, s);
8179
8179
  return { yMax: d, gammaNewL: p };
@@ -8181,7 +8181,7 @@ function sc(e, t) {
8181
8181
  function lc(e, t) {
8182
8182
  const { gammaPreHuman: n } = ot(e);
8183
8183
  return rt(
8184
- To(e, n, t),
8184
+ Io(e, n, t),
8185
8185
  e.market.decimals1
8186
8186
  );
8187
8187
  }
@@ -8193,7 +8193,7 @@ function uc(e) {
8193
8193
  const { market: r, vault: a } = e, i = ft(r.sqrtPriceX96, r.decimals0, r.decimals1), o = Number(a.rL0) * Number(r.borrowIndexWad) / 1e18, s = Math.pow(10, (r.decimals0 + r.decimals1) / 2), l = o / s;
8194
8194
  return (We(a.x0, r.decimals0) - l / i) * i * (1 - n) / n >= l;
8195
8195
  }
8196
- function Io(e) {
8196
+ function Eo(e) {
8197
8197
  const t = it(e.tauPips);
8198
8198
  if (t <= 0 || t >= 1) return null;
8199
8199
  const n = Zn(t);
@@ -8212,10 +8212,10 @@ function Io(e) {
8212
8212
  const p = (d - c) * (1 + n) / (o * (1 - n)) - l + s / i;
8213
8213
  return Number.isFinite(p) ? rt(Math.max(0, p), r.decimals0) : null;
8214
8214
  }
8215
- var hi = wu * re;
8215
+ var bi = wu * re;
8216
8216
  function cc(e) {
8217
8217
  const t = 1000000000n, n = (e + t - 1n) / t;
8218
- return n > hi ? n : hi;
8218
+ return n > bi ? n : bi;
8219
8219
  }
8220
8220
  function Yt(e, t) {
8221
8221
  return t === 0n ? 0n : (cc(e) + t - 1n) / t;
@@ -8241,19 +8241,19 @@ function St() {
8241
8241
  yV: 0n
8242
8242
  };
8243
8243
  }
8244
- function Eo(e, t) {
8244
+ function xo(e, t) {
8245
8245
  if (t === 0n) throw new Error("divCeil: divide by zero");
8246
8246
  return (e + t - 1n) / t;
8247
8247
  }
8248
8248
  function pa(e, t) {
8249
8249
  if (e <= 0n) return 0n;
8250
8250
  if (t <= 0n) throw new Error("lToRlRoundUp: borrowIndexWad must be positive");
8251
- return Eo(e * re, t);
8251
+ return xo(e * re, t);
8252
8252
  }
8253
8253
  function Ge(e, t) {
8254
8254
  if (e <= 0n) return 0n;
8255
8255
  if (t <= 0n) throw new Error("rlToL: borrowIndexWad must be positive");
8256
- return Eo(e * t, re);
8256
+ return xo(e * t, re);
8257
8257
  }
8258
8258
  function dc(e) {
8259
8259
  const {
@@ -8307,7 +8307,7 @@ function dc(e) {
8307
8307
  const A = c.finalize({ requiresV4Unlock: !0 }), T = h ? r.amount0 : b ? r.amount1 : 0n;
8308
8308
  return et.encodeExecuteWithOptionalPermit([A], l, T, d);
8309
8309
  }
8310
- function bi(e) {
8310
+ function gi(e) {
8311
8311
  const {
8312
8312
  market: t,
8313
8313
  vault: n,
@@ -8326,7 +8326,7 @@ function bi(e) {
8326
8326
  throw new Error(
8327
8327
  `buildRepayRecipe: principalDeltaRl (${r}) exceeds vault.rL0 (${n.rL0}); engine would revert via SafeCast underflow on _safeAdd`
8328
8328
  );
8329
- if (yo({
8329
+ if (ho({
8330
8330
  fn: "buildRepayRecipe",
8331
8331
  principalLabel: "principalDeltaRl",
8332
8332
  principal: r,
@@ -9346,7 +9346,7 @@ var De = [
9346
9346
  stateMutability: "view"
9347
9347
  }
9348
9348
  ];
9349
- async function xo(e, t, n, r) {
9349
+ async function ko(e, t, n, r) {
9350
9350
  const a = await e.readContract({
9351
9351
  address: t,
9352
9352
  abi: De,
@@ -9354,7 +9354,7 @@ async function xo(e, t, n, r) {
9354
9354
  args: [n],
9355
9355
  blockNumber: r
9356
9356
  });
9357
- return Do(a);
9357
+ return No(a);
9358
9358
  }
9359
9359
  async function fa(e, t, n, r) {
9360
9360
  const [a, i] = await Promise.all([
@@ -9374,13 +9374,13 @@ async function fa(e, t, n, r) {
9374
9374
  })
9375
9375
  ]);
9376
9376
  return {
9377
- market: Do(a),
9377
+ market: No(a),
9378
9378
  latestBorrowIndexWad: i[0],
9379
9379
  latestEquityLWad: i[1],
9380
9380
  latestFullUtilRate: i[2]
9381
9381
  };
9382
9382
  }
9383
- async function ko(e, t, n, r) {
9383
+ async function Do(e, t, n, r) {
9384
9384
  return e.readContract({
9385
9385
  address: t,
9386
9386
  abi: De,
@@ -9398,7 +9398,7 @@ async function fc(e, t, n) {
9398
9398
  });
9399
9399
  return { maxLtvPips: r, hardLtvPips: a };
9400
9400
  }
9401
- function Do(e) {
9401
+ function No(e) {
9402
9402
  const t = {
9403
9403
  initialized: e.initialized,
9404
9404
  totalRlBorrowed: e.totalRlBorrowed,
@@ -9458,7 +9458,7 @@ async function ma(e, t, n, r) {
9458
9458
  blockNumber: r
9459
9459
  })).map((i) => ({ kind: i.kind, tokenId: i.tokenId }));
9460
9460
  }
9461
- async function No(e, t, n, r) {
9461
+ async function Lo(e, t, n, r) {
9462
9462
  return e.readContract({
9463
9463
  address: t,
9464
9464
  abi: Vt,
@@ -9467,7 +9467,7 @@ async function No(e, t, n, r) {
9467
9467
  blockNumber: r
9468
9468
  });
9469
9469
  }
9470
- var gi = [
9470
+ var vi = [
9471
9471
  {
9472
9472
  type: "function",
9473
9473
  name: "orders",
@@ -9494,7 +9494,7 @@ var gi = [
9494
9494
  { name: "hooks", type: "address" }
9495
9495
  ]
9496
9496
  }
9497
- ], vi = [
9497
+ ], wi = [
9498
9498
  {
9499
9499
  type: "function",
9500
9500
  name: "getPoolAndPositionInfo",
@@ -9572,7 +9572,7 @@ function qr(e, t) {
9572
9572
  function oe(e, t) {
9573
9573
  if (e != null && e.aborted) throw new Error(`${t}: aborted`);
9574
9574
  }
9575
- async function Lo(e, t) {
9575
+ async function Po(e, t) {
9576
9576
  const { addresses: n } = sa(t.chainId, t.version, t.deployment), r = t.frame.blockNumber, [
9577
9577
  a,
9578
9578
  i,
@@ -9664,9 +9664,9 @@ async function Lo(e, t) {
9664
9664
  }
9665
9665
  function gc(e) {
9666
9666
  const { tokenId: t, tickLower: n, tickUpper: r } = e.data;
9667
- return n < pi || r > fi || n >= r ? `position ${t} has invalid tick range [${n}, ${r}]; expected ${pi} <= lower < upper <= ${fi}` : null;
9667
+ return n < fi || r > mi || n >= r ? `position ${t} has invalid tick range [${n}, ${r}]; expected ${fi} <= lower < upper <= ${mi}` : null;
9668
9668
  }
9669
- function wi(e) {
9669
+ function Ai(e) {
9670
9670
  const t = Number(e & 0xffffffn);
9671
9671
  return t >= 8388608 ? t - 16777216 : t;
9672
9672
  }
@@ -9674,14 +9674,14 @@ async function vc(e, t, n, r) {
9674
9674
  const [[a, i], o] = await Promise.all([
9675
9675
  e.readContract({
9676
9676
  address: t,
9677
- abi: vi,
9677
+ abi: wi,
9678
9678
  functionName: "getPoolAndPositionInfo",
9679
9679
  args: [n],
9680
9680
  blockNumber: r
9681
9681
  }),
9682
9682
  e.readContract({
9683
9683
  address: t,
9684
- abi: vi,
9684
+ abi: wi,
9685
9685
  functionName: "getPositionLiquidity",
9686
9686
  args: [n],
9687
9687
  blockNumber: r
@@ -9693,8 +9693,8 @@ async function vc(e, t, n, r) {
9693
9693
  kind: 0,
9694
9694
  data: {
9695
9695
  tokenId: n,
9696
- tickLower: wi(i >> 8n),
9697
- tickUpper: wi(i >> 32n),
9696
+ tickLower: Ai(i >> 8n),
9697
+ tickUpper: Ai(i >> 32n),
9698
9698
  liquidity: o
9699
9699
  }
9700
9700
  }
@@ -9703,13 +9703,13 @@ async function vc(e, t, n, r) {
9703
9703
  async function wc(e, t, n, r) {
9704
9704
  const [a, , i, , o] = await e.readContract({
9705
9705
  address: t,
9706
- abi: gi,
9706
+ abi: vi,
9707
9707
  functionName: "orders",
9708
9708
  args: [n],
9709
9709
  blockNumber: r
9710
9710
  }), [s, l, u, d, c] = await e.readContract({
9711
9711
  address: t,
9712
- abi: gi,
9712
+ abi: vi,
9713
9713
  functionName: "poolKeys",
9714
9714
  args: [a],
9715
9715
  blockNumber: r
@@ -9750,7 +9750,7 @@ function Ac(e, t, n) {
9750
9750
  const p = r * (d * o) / re, y = r + p, g = a + p * t.totalRlBorrowed;
9751
9751
  return { borrowIndexWadLatest: y, equityLWadLatest: g, fullUtilRateLatest: c };
9752
9752
  }
9753
- var Ai = re, Tc = {
9753
+ var Ti = re, Tc = {
9754
9754
  vertexUtilization: 800000n,
9755
9755
  vertex2Utilization: 900000n,
9756
9756
  vertexRatePercent: 500000000000000000n,
@@ -9789,7 +9789,7 @@ function xc(e, t, n, r) {
9789
9789
  t,
9790
9790
  a,
9791
9791
  r
9792
- ), o = (i - e.zeroUtilRate) * e.vertexRatePercent / Ai + e.zeroUtilRate, s = (i - e.zeroUtilRate) * e.vertex2RatePercent / Ai + e.zeroUtilRate;
9792
+ ), o = (i - e.zeroUtilRate) * e.vertexRatePercent / Ti + e.zeroUtilRate, s = (i - e.zeroUtilRate) * e.vertex2RatePercent / Ti + e.zeroUtilRate;
9793
9793
  let l;
9794
9794
  return a < e.vertexUtilization ? l = e.zeroUtilRate + a * (o - e.zeroUtilRate) / e.vertexUtilization : a < e.vertex2Utilization ? l = o + (a - e.vertexUtilization) * (s - o) / (e.vertex2Utilization - e.vertexUtilization) : l = s + (a - e.vertex2Utilization) * (i - s) / (Le - e.vertex2Utilization), { ratePerSecondWad: l, newFullUtilRateWad: i };
9795
9795
  }
@@ -9885,31 +9885,31 @@ var vn = class Br {
9885
9885
  return this.entries.has(e.toLowerCase());
9886
9886
  }
9887
9887
  };
9888
- function Po(e, t) {
9888
+ function _o(e, t) {
9889
9889
  const n = new kc(e, t), r = jt(e, t);
9890
9890
  return n.register(r.variableInterestRate, {
9891
9891
  type: "VariableInterestRateV1",
9892
9892
  factory: () => vn.default()
9893
9893
  }), n;
9894
9894
  }
9895
- function _o(e) {
9895
+ function Co(e) {
9896
9896
  if (e.rateModel) return { status: "ok", oracle: e.rateModel };
9897
9897
  if (!la(e.chainId, e.version))
9898
9898
  return { status: "unsupported", reason: "chain-version-unregistered" };
9899
9899
  const t = jt(e.chainId, e.version).variableInterestRate;
9900
9900
  if (e.rateOracle.toLowerCase() !== t.toLowerCase())
9901
9901
  return { status: "unsupported", reason: "oracle-not-canonical" };
9902
- const n = Po(e.chainId, e.version);
9902
+ const n = _o(e.chainId, e.version);
9903
9903
  return n.has(e.rateOracle) ? { status: "ok", oracle: n.resolve(e.rateOracle) } : { status: "unsupported", reason: "oracle-not-registered" };
9904
9904
  }
9905
9905
  function Un(e) {
9906
- return e instanceof Yr && e.walk((t) => t instanceof qi) !== null;
9906
+ return e instanceof Yr && e.walk((t) => t instanceof Bi) !== null;
9907
9907
  }
9908
9908
  function Pn(e) {
9909
9909
  if (Un(e)) return null;
9910
9910
  throw e;
9911
9911
  }
9912
- var Co = [
9912
+ var Mo = [
9913
9913
  {
9914
9914
  type: "function",
9915
9915
  name: "getSlot0",
@@ -9967,7 +9967,7 @@ var Co = [
9967
9967
  async function ya(e, t, n, r) {
9968
9968
  const [a, i, o, s] = await e.readContract({
9969
9969
  address: t,
9970
- abi: Co,
9970
+ abi: Mo,
9971
9971
  functionName: "getSlot0",
9972
9972
  args: [n],
9973
9973
  blockNumber: r
@@ -9982,13 +9982,13 @@ async function ya(e, t, n, r) {
9982
9982
  async function ha(e, t, n, r) {
9983
9983
  return e.readContract({
9984
9984
  address: t,
9985
- abi: Co,
9985
+ abi: Mo,
9986
9986
  functionName: "getLiquidity",
9987
9987
  args: [n],
9988
9988
  blockNumber: r
9989
9989
  });
9990
9990
  }
9991
- async function Mo(e, t, n, r) {
9991
+ async function Ro(e, t, n, r) {
9992
9992
  const [a, i] = await Promise.all([
9993
9993
  ya(e, t, n, r),
9994
9994
  ha(e, t, n, r)
@@ -9996,7 +9996,7 @@ async function Mo(e, t, n, r) {
9996
9996
  return { ...a, liquidity: i };
9997
9997
  }
9998
9998
  var wr = 1000000n;
9999
- async function Ro(e, t) {
9999
+ async function Oo(e, t) {
10000
10000
  const { aegisStateView: n, v4StateView: r, poolId: a, blockNumber: i } = t;
10001
10001
  if (!t.rateModel && !t.variableInterestRateV1Address)
10002
10002
  throw new Error(
@@ -10104,7 +10104,7 @@ async function Nc(e, t) {
10104
10104
  frame: await Ut(e, t.blockNumber)
10105
10105
  };
10106
10106
  const i = jt(n, r), o = await Ut(e, t.blockNumber), s = t.rateModel ?? vn.default(), [l, u, d, c, p] = await Promise.all([
10107
- Ro(e, {
10107
+ Oo(e, {
10108
10108
  aegisStateView: i.aegisStateView,
10109
10109
  v4StateView: i.stateView,
10110
10110
  poolId: a,
@@ -10125,7 +10125,7 @@ async function Nc(e, t) {
10125
10125
  args: [t.vaultId],
10126
10126
  blockNumber: o.blockNumber
10127
10127
  }).catch(Pn) : Promise.resolve(null),
10128
- t.owner !== void 0 && t.vaultId !== void 0 ? No(e, i.vaultRegistry, t.vaultId, o.blockNumber).catch(
10128
+ t.owner !== void 0 && t.vaultId !== void 0 ? Lo(e, i.vaultRegistry, t.vaultId, o.blockNumber).catch(
10129
10129
  Pn
10130
10130
  ) : Promise.resolve(null),
10131
10131
  t.owner !== void 0 && t.vaultId !== void 0 ? e.readContract({
@@ -10135,7 +10135,7 @@ async function Nc(e, t) {
10135
10135
  args: [t.vaultId],
10136
10136
  blockNumber: o.blockNumber
10137
10137
  }).catch(Pn) : Promise.resolve(null)
10138
- ]), y = _o({
10138
+ ]), y = Co({
10139
10139
  chainId: n,
10140
10140
  version: r,
10141
10141
  rateOracle: l.rateOracle,
@@ -10196,11 +10196,11 @@ async function ba(e, t, n, r) {
10196
10196
  }
10197
10197
  async function Lc(e, t) {
10198
10198
  const { chainId: n, version: r, poolId: a } = t, i = jt(n, r), o = await Ut(e, t.blockNumber), s = o.blockNumber, [l, u, d, c, p] = await Promise.all([
10199
- xo(e, i.aegisStateView, a, s),
10199
+ ko(e, i.aegisStateView, a, s),
10200
10200
  ya(e, i.stateView, a, s),
10201
10201
  ha(e, i.stateView, a, s),
10202
10202
  ba(e, i.aegisStateView, a, s),
10203
- ko(e, i.aegisStateView, a, s)
10203
+ Do(e, i.aegisStateView, a, s)
10204
10204
  ]), y = {
10205
10205
  poolId: a,
10206
10206
  poolKey: l.poolKey,
@@ -10232,7 +10232,7 @@ async function Lc(e, t) {
10232
10232
  };
10233
10233
  }
10234
10234
  function Pc(e, t, n, r) {
10235
- const a = _o({
10235
+ const a = Co({
10236
10236
  chainId: e.chainId,
10237
10237
  version: e.version,
10238
10238
  rateOracle: t.rateOracle,
@@ -10257,7 +10257,7 @@ async function _c(e, t, n, r) {
10257
10257
  blockNumber: r
10258
10258
  });
10259
10259
  }
10260
- var Oo = [
10260
+ var So = [
10261
10261
  {
10262
10262
  type: "function",
10263
10263
  name: "balanceOf",
@@ -10273,7 +10273,7 @@ async function Cc(e, t, n, r, a) {
10273
10273
  const i = BigInt(r);
10274
10274
  return e.readContract({
10275
10275
  address: t,
10276
- abi: Oo,
10276
+ abi: So,
10277
10277
  functionName: "balanceOf",
10278
10278
  args: [n, i],
10279
10279
  blockNumber: a
@@ -10303,11 +10303,11 @@ async function Mc(e, t) {
10303
10303
  for (const v of r)
10304
10304
  s.push({
10305
10305
  address: a.aegisEngine,
10306
- abi: Oo,
10306
+ abi: So,
10307
10307
  functionName: "balanceOf",
10308
10308
  args: [v.account, BigInt(v.poolId)]
10309
10309
  });
10310
- const l = await Ti(e, s, o);
10310
+ const l = await Ii(e, s, o);
10311
10311
  oe(t.signal, "fetchPositionsBatch");
10312
10312
  const u = n.map((v, E) => {
10313
10313
  const D = l[2 * E], x = l[2 * E + 1];
@@ -10377,7 +10377,7 @@ async function Mc(e, t) {
10377
10377
  functionName: "getVaultLtvPipsLatest",
10378
10378
  args: [v.vaultId]
10379
10379
  });
10380
- const b = await Ti(e, m, o), A = /* @__PURE__ */ new Map();
10380
+ const b = await Ii(e, m, o), A = /* @__PURE__ */ new Map();
10381
10381
  y.forEach((v, E) => {
10382
10382
  const [D, x, _, C] = b.slice(
10383
10383
  E * g,
@@ -10477,7 +10477,7 @@ async function Mc(e, t) {
10477
10477
  });
10478
10478
  return { frame: i, vaults: I, shares: w };
10479
10479
  }
10480
- async function Ti(e, t, n) {
10480
+ async function Ii(e, t, n) {
10481
10481
  var u, d, c;
10482
10482
  if (t.length === 0) return [];
10483
10483
  const r = Math.max(1, n.chunkSize), a = [];
@@ -10550,21 +10550,21 @@ function Ar(e) {
10550
10550
  `)[0] : String(e);
10551
10551
  }
10552
10552
  var Oc = -887272, Sc = 887272;
10553
- function Ii(e, t) {
10553
+ function Ei(e, t) {
10554
10554
  const n = e % t;
10555
10555
  return n === 0 ? e : e - n;
10556
10556
  }
10557
- function So(e) {
10557
+ function qo(e) {
10558
10558
  return {
10559
- tickLower: Ii(Oc, e),
10560
- tickUpper: Ii(Sc, e)
10559
+ tickLower: Ei(Oc, e),
10560
+ tickUpper: Ei(Sc, e)
10561
10561
  };
10562
10562
  }
10563
- function qo(e) {
10563
+ function Bo(e) {
10564
10564
  const { idle0: t, idle1: n, poolKey: r, poolState: a } = e;
10565
10565
  if (t <= 0n && n <= 0n || a.sqrtPriceX96 <= 0n) return null;
10566
10566
  try {
10567
- const { tickLower: i, tickUpper: o } = So(r.tickSpacing), s = pt(i), l = pt(o);
10567
+ const { tickLower: i, tickUpper: o } = qo(r.tickSpacing), s = pt(i), l = pt(o);
10568
10568
  return Pu(
10569
10569
  a.sqrtPriceX96,
10570
10570
  s,
@@ -10584,7 +10584,7 @@ function qc(e, t, n) {
10584
10584
  function Qt(e, t, n, r = !1) {
10585
10585
  if (e <= 0n || n.sqrtPriceX96 <= 0n) return null;
10586
10586
  try {
10587
- const { tickLower: a, tickUpper: i } = So(t.tickSpacing), o = pt(a), s = pt(i), l = n.sqrtPriceX96;
10587
+ const { tickLower: a, tickUpper: i } = qo(t.tickSpacing), o = pt(a), s = pt(i), l = n.sqrtPriceX96;
10588
10588
  return l <= o ? { amount0: On(o, s, e, r), amount1: 0n } : l >= s ? { amount0: 0n, amount1: Sn(o, s, e, r) } : {
10589
10589
  amount0: On(l, s, e, r),
10590
10590
  amount1: Sn(o, l, e, r)
@@ -12246,7 +12246,7 @@ var $e = [
12246
12246
  }
12247
12247
  ]
12248
12248
  }
12249
- ], Bo = [
12249
+ ], Fo = [
12250
12250
  {
12251
12251
  inputs: [
12252
12252
  {
@@ -12885,10 +12885,10 @@ var $e = [
12885
12885
  ];
12886
12886
  function Fc(e, t) {
12887
12887
  if (typeof e == "string")
12888
- return new ui(e);
12888
+ return new ci(e);
12889
12889
  if (t === void 0)
12890
12890
  throw new Error("createSubgraphClient: version is required when passing a chainId");
12891
- return new ui(Du(e, t));
12891
+ return new ci(Du(e, t));
12892
12892
  }
12893
12893
  var Me = class extends String {
12894
12894
  constructor(t, n) {
@@ -13382,10 +13382,10 @@ var Me = class extends String {
13382
13382
  '\n query VaultsAtRisk($minLtvPips: BigInt!, $first: Int, $skip: Int) {\n vaults(\n where: { lastLtvPips_gte: $minLtvPips, principalRl_gt: "0", burnedAtTimestamp: null }\n first: $first\n skip: $skip\n orderBy: lastLtvPips\n orderDirection: desc\n ) {\n id\n owner\n idle0\n idle1\n principalRl\n borrowIndexWadAtLastDebt\n nftCount\n lastLockedAt\n lastLtvPips\n burnedAtTimestamp\n burnedAtBlockNumber\n pool {\n id\n currency0\n currency1\n borrowIndexWad\n maxLtvPips\n hardLtvPips\n }\n nfts {\n id\n kind\n tokenId\n liquidityAtLastAttach\n }\n }\n }\n': td,
13383
13383
  "\n query VaultsByPool($poolId: String!, $first: Int, $skip: Int) {\n vaults(\n where: { pool: $poolId, burnedAtTimestamp: null }\n first: $first\n skip: $skip\n orderBy: createdAtTimestamp\n orderDirection: desc\n ) {\n id\n owner\n idle0\n idle1\n principalRl\n borrowIndexWadAtLastDebt\n nftCount\n lastLockedAt\n lastLtvPips\n createdAtTimestamp\n burnedAtTimestamp\n burnedAtBlockNumber\n nfts {\n id\n kind\n tokenId\n liquidityAtLastAttach\n }\n }\n }\n": nd
13384
13384
  };
13385
- function Fo(e) {
13385
+ function Vo(e) {
13386
13386
  return rd[e] ?? {};
13387
13387
  }
13388
- var ad = Fo(`
13388
+ var ad = Vo(`
13389
13389
  query VaultDebtActions($vaultId: String!, $first: Int, $skip: Int) {
13390
13390
  debtModifiedActions(
13391
13391
  where: { vault: $vaultId }
@@ -13409,7 +13409,7 @@ var ad = Fo(`
13409
13409
  }
13410
13410
  }
13411
13411
  }
13412
- `), id = Fo(`
13412
+ `), id = Vo(`
13413
13413
  query VaultIdleActions($vaultId: String!, $first: Int, $skip: Int) {
13414
13414
  idleModifiedActions(
13415
13415
  where: { vault: $vaultId }
@@ -13445,10 +13445,10 @@ async function sd(e, t, n) {
13445
13445
  skip: (n == null ? void 0 : n.skip) ?? 0
13446
13446
  });
13447
13447
  }
13448
- function Ei(e, t, n, r) {
13448
+ function xi(e, t, n, r) {
13449
13449
  return e > 0 ? e * t + n - 2 * r * Math.sqrt(e) : NaN;
13450
13450
  }
13451
- function Vo(e, t, n, r) {
13451
+ function Uo(e, t, n, r) {
13452
13452
  const a = e + t, i = e, o = n * a - t, s = Math.max(0, Math.min(i, o));
13453
13453
  return r > 0 ? s / r : 0;
13454
13454
  }
@@ -13463,7 +13463,7 @@ function ud(e, t, n, r) {
13463
13463
  function cd(e, t, n) {
13464
13464
  return !(e > 0) || !(n > 0) ? NaN : e * t / n;
13465
13465
  }
13466
- function Uo(e, t, n) {
13466
+ function Wo(e, t, n) {
13467
13467
  if (!(e > 0) || !(t > 0)) return 0;
13468
13468
  if (n <= 0) return e < t ? 1 / 0 : 0;
13469
13469
  const r = t / e - 1;
@@ -13482,11 +13482,11 @@ function dd(e, t, n, r, a, i) {
13482
13482
  return { gamma: d, xb: c, yb: p, q: y, x: g, y: m, collateral: h, ltv: b };
13483
13483
  }
13484
13484
  var pd = 31556736;
13485
- function xi(e, t, n) {
13486
- const r = e / 100, a = Uo(t, n, r);
13485
+ function ki(e, t, n) {
13486
+ const r = e / 100, a = Wo(t, n, r);
13487
13487
  return a === 1 / 0 ? "INF" : a;
13488
13488
  }
13489
- function Wo(e) {
13489
+ function $o(e) {
13490
13490
  const {
13491
13491
  equityLWad: t,
13492
13492
  borrowedLWad: n,
@@ -13498,7 +13498,7 @@ function Wo(e) {
13498
13498
  currentAprPct: l,
13499
13499
  entryLtv: u,
13500
13500
  thetaL: d
13501
- } = e, c = t > 0n ? n * Le / t : 0n, p = t > 0n ? (n + r) * Le / t : 0n, y = xi(l, u, d), g = (T) => ({
13501
+ } = e, c = t > 0n ? n * Le / t : 0n, p = t > 0n ? (n + r) * Le / t : 0n, y = ki(l, u, d), g = (T) => ({
13502
13502
  preBorrowUtilPips: c,
13503
13503
  postBorrowUtilPips: p,
13504
13504
  preBorrowAprPct: l,
@@ -13516,12 +13516,12 @@ function Wo(e) {
13516
13516
  const T = o;
13517
13517
  if (!Object.values(ia).includes(T) || !la(T, s))
13518
13518
  return g("chain-version-unregistered");
13519
- const I = Po(T, s);
13519
+ const I = _o(T, s);
13520
13520
  if (!I.has(i))
13521
13521
  return g("oracle-not-registered");
13522
13522
  m = I.resolve(i);
13523
13523
  }
13524
- const { ratePerSecondWad: h } = m.getNewRate(0n, p, a), b = Number(h) * pd / 1e18 * 100, A = xi(b, u, d);
13524
+ const { ratePerSecondWad: h } = m.getNewRate(0n, p, a), b = Number(h) * pd / 1e18 * 100, A = ki(b, u, d);
13525
13525
  return {
13526
13526
  preBorrowUtilPips: c,
13527
13527
  postBorrowUtilPips: p,
@@ -13559,7 +13559,7 @@ async function md(e, t, n) {
13559
13559
  );
13560
13560
  const { result: r } = await e.simulateContract({
13561
13561
  address: t,
13562
- abi: Bo,
13562
+ abi: Fo,
13563
13563
  functionName: "quoteExactInputSingle",
13564
13564
  args: [
13565
13565
  {
@@ -13572,14 +13572,14 @@ async function md(e, t, n) {
13572
13572
  }), [a, i] = r;
13573
13573
  return { amountOut: a, gasEstimate: i };
13574
13574
  }
13575
- function $o(e, t) {
13575
+ function Ho(e, t) {
13576
13576
  if (e === 0n)
13577
13577
  return t > 0n ? Le : 0n;
13578
13578
  const n = e * re;
13579
13579
  return t * Le / n;
13580
13580
  }
13581
13581
  var yd = 2e-3, hd = 1440 * 365;
13582
- function Ho(e) {
13582
+ function zo(e) {
13583
13583
  const {
13584
13584
  entryPrice: t,
13585
13585
  targetPrice: n,
@@ -13608,7 +13608,7 @@ function Ho(e) {
13608
13608
  ok: !1,
13609
13609
  error: "Target LTV τ_degen must be in (0, θ_L). Try shorter time or lower β."
13610
13610
  };
13611
- const L = Vo(y, g, p, c);
13611
+ const L = Uo(y, g, p, c);
13612
13612
  if (!(L > 0))
13613
13613
  return {
13614
13614
  ok: !1,
@@ -13629,9 +13629,9 @@ function Ho(e) {
13629
13629
  if (!he) continue;
13630
13630
  const { gamma: de, xb: be, yb: ge, q: H, x: V, y: Q, collateral: ie, ltv: ae } = he;
13631
13631
  if (!(ae > 0 && ae < d && ae <= k)) continue;
13632
- const ve = Ei(t, V, Q, de);
13632
+ const ve = xi(t, V, Q, de);
13633
13633
  if (!(ve > 0) || !Number.isFinite(ve)) continue;
13634
- const K = Ei(n, V, Q, de), ne = ld(t, V, ve, de, w);
13634
+ const K = xi(n, V, Q, de), ne = ld(t, V, ve, de, w);
13635
13635
  if (!Number.isFinite(ne)) continue;
13636
13636
  if (r === "long") {
13637
13637
  if (!(ne > 0)) continue;
@@ -13722,7 +13722,7 @@ function bd(e, t) {
13722
13722
  return { ok: !1, error: "For longs, target price must be above entry price." };
13723
13723
  if (r === "short" && !(l < 1))
13724
13724
  return { ok: !1, error: "For shorts, target price must be below entry price." };
13725
- const u = Ho({
13725
+ const u = zo({
13726
13726
  entryPrice: n,
13727
13727
  targetPrice: o,
13728
13728
  direction: r,
@@ -13758,7 +13758,7 @@ function gd(e, t) {
13758
13758
  if (!(n > 0) || !(t.targetPrice > 0) || !(e.M > 0) || !(e.Ucap > 0 && e.Ucap <= 1) || !(e.thetaL > 0 && e.thetaL < 1.5) || !(e.betaTime > 0 && e.betaTime <= 1.1)) return null;
13759
13759
  const r = t.targetPrice / n;
13760
13760
  if (t.direction === "long" && !(r > 1) || t.direction === "short" && !(r < 1)) return null;
13761
- const a = Ho({
13761
+ const a = zo({
13762
13762
  entryPrice: n,
13763
13763
  targetPrice: t.targetPrice,
13764
13764
  direction: t.direction,
@@ -13780,7 +13780,7 @@ function gd(e, t) {
13780
13780
  return Number.isFinite(i) && i > 0 ? i : null;
13781
13781
  }
13782
13782
  var vd = 2n ** 96n, wd = Number(vd);
13783
- function zo(e) {
13783
+ function Go(e) {
13784
13784
  if (e.sqrtPriceX96 <= 0n)
13785
13785
  throw new Error("displayPrice: market.sqrtPriceX96 must be > 0n");
13786
13786
  if (!Number.isInteger(e.decimals0) || !Number.isInteger(e.decimals1) || e.decimals0 < 0 || e.decimals1 < 0 || e.decimals0 > 30 || e.decimals1 > 30)
@@ -13796,7 +13796,7 @@ function Ad(e, t, n) {
13796
13796
  return Math.sqrt(ga(e, t, n));
13797
13797
  }
13798
13798
  var Td = { xV: 0n, yV: 0n, gammaTotalL: 0n };
13799
- function ki(e, t) {
13799
+ function Di(e, t) {
13800
13800
  if (e.xV < 0n || e.yV < 0n || e.gammaTotalL < 0n)
13801
13801
  throw new Error(`computeBammVsBlPayoff: ${t} bigint fields must be >= 0n`);
13802
13802
  }
@@ -13808,11 +13808,11 @@ function Id(e) {
13808
13808
  throw new Error("computeBammVsBlPayoff: alphaMax must be finite and > alphaMin");
13809
13809
  if (!Number.isInteger(l) || l < 1 || l > 1e3)
13810
13810
  throw new Error("computeBammVsBlPayoff: steps must be an integer in [1, 1000]");
13811
- ki(n, "postAction");
13811
+ Di(n, "postAction");
13812
13812
  const u = r ?? Td;
13813
- if (r && ki(r, "preAction"), a && (a.depositT0 < 0n || a.depositT1 < 0n || a.loanT0 < 0n || a.loanT1 < 0n))
13813
+ if (r && Di(r, "preAction"), a && (a.depositT0 < 0n || a.depositT1 < 0n || a.loanT0 < 0n || a.loanT1 < 0n))
13814
13814
  throw new Error("computeBammVsBlPayoff: blAction bigint fields must be >= 0n");
13815
- zo(t);
13815
+ Go(t);
13816
13816
  const { decimals0: d, decimals1: c } = t, p = ga(t.sqrtPriceX96, d, c);
13817
13817
  if (!Number.isFinite(p) || p <= 0)
13818
13818
  throw new Error("computeBammVsBlPayoff: entry price derived from sqrtPriceX96 is non-finite or non-positive");
@@ -13870,7 +13870,7 @@ function Ed(e) {
13870
13870
  const o = Ge(t, r);
13871
13871
  if (n.x <= 0n || n.y <= 0n)
13872
13872
  return { appliedRl: 0n, cappedByBridge: !0, bridgeGapL: o };
13873
- const s = qo({
13873
+ const s = Bo({
13874
13874
  idle0: n.x,
13875
13875
  idle1: n.y,
13876
13876
  poolKey: a,
@@ -13898,7 +13898,7 @@ function Jn(e, t) {
13898
13898
  y: r < 0n ? 0n : r
13899
13899
  };
13900
13900
  }
13901
- function Go(e, t, n, r) {
13901
+ function jo(e, t, n, r) {
13902
13902
  const a = Jn(t, n), i = r > 0n ? Qt(
13903
13903
  r,
13904
13904
  e.poolKey,
@@ -13910,8 +13910,8 @@ function Go(e, t, n, r) {
13910
13910
  idle1: a.y > i.amount1 ? a.y - i.amount1 : 0n
13911
13911
  };
13912
13912
  }
13913
- function jo(e, t, n, r, a) {
13914
- if (a === null) return Go(e, t, n, r);
13913
+ function Ko(e, t, n, r, a) {
13914
+ if (a === null) return jo(e, t, n, r);
13915
13915
  const i = Jn(t, n);
13916
13916
  return {
13917
13917
  idle0: i.x > a.amount0 ? i.x - a.amount0 : 0n,
@@ -13961,7 +13961,7 @@ function wa(e, t, n, r, a) {
13961
13961
  dHuman: A
13962
13962
  };
13963
13963
  }
13964
- function Ko(e, t, n, r) {
13964
+ function Yo(e, t, n, r) {
13965
13965
  const { sqrtP: a, pEff: i, xEff: o, yEff: s, yWHuman: l, gammaPreHuman: u } = e, d = o + t / a, c = s + t * a - l, p = r === "preserve-collateral" ? Math.max(0, (t - u) / a) : d;
13966
13966
  let y;
13967
13967
  if (i <= 0 ? y = c >= 0 ? 0 : Number.POSITIVE_INFINITY : y = Math.max(0, -c / i), i <= 0 || n <= 0 || n >= 1)
@@ -14005,7 +14005,7 @@ function Wt(e, t, n) {
14005
14005
  e.deposit,
14006
14006
  n,
14007
14007
  e.quoteHaircutBps
14008
- ), i = Ko(a, t, r, e.collateralPolicy);
14008
+ ), i = Yo(a, t, r, e.collateralPolicy);
14009
14009
  if (!i.discriminantNonNegative) return Number.NEGATIVE_INFINITY;
14010
14010
  const o = 1 / 10 ** e.market.decimals0, s = Math.max(i.qLtvMinus, i.qLo, o);
14011
14011
  return Math.min(i.qLtvPlus, i.qHi) - s;
@@ -14017,7 +14017,7 @@ function _d(e, t, n) {
14017
14017
  e.deposit,
14018
14018
  n,
14019
14019
  e.quoteHaircutBps
14020
- ), i = Ko(a, t, r, e.collateralPolicy), o = e.market.decimals0, s = 1 / 10 ** o;
14020
+ ), i = Yo(a, t, r, e.collateralPolicy), o = e.market.decimals0, s = 1 / 10 ** o;
14021
14021
  if (!i.discriminantNonNegative)
14022
14022
  return {
14023
14023
  q: 0n,
@@ -14035,11 +14035,11 @@ function _d(e, t, n) {
14035
14035
  integerFeasible: p >= 1n && p <= c
14036
14036
  };
14037
14037
  }
14038
- var Cd = 8, Di = 5, Yo = 1.1, Md = 1e-10, Rd = 50, Tr = 8;
14038
+ var Cd = 8, Ni = 5, Qo = 1.1, Md = 1e-10, Rd = 50, Tr = 8;
14039
14039
  function Fr(e, t) {
14040
14040
  const n = wn(e.tauPips);
14041
14041
  if (n <= 0 || n >= 1 || t <= 0n)
14042
- return Ni("price-unviable", "heuristic");
14042
+ return Li("price-unviable", "heuristic");
14043
14043
  const r = wa(
14044
14044
  e.market,
14045
14045
  e.vault,
@@ -14049,7 +14049,7 @@ function Fr(e, t) {
14049
14049
  ), { gammaPreHuman: a, gammaScale: i } = r, o = Sd(e, r), s = a + o, l = Number.isFinite(e.utilMaxGammaNewHuman) ? a + e.utilMaxGammaNewHuman : Number.POSITIVE_INFINITY, u = [];
14050
14050
  let d = !1, c = !1, p = s, y = s, g = Wt(e, s, t);
14051
14051
  for (u.push({ gammaHuman: s, gap: g, refinedFromPrevious: !1 }), s > l ? y = l : g > 0 && (c = !0, p = a, y = s); !c && y < l; ) {
14052
- const b = Math.min(y * Yo, l);
14052
+ const b = Math.min(y * Qo, l);
14053
14053
  if (b <= y) break;
14054
14054
  const A = Wt(e, b, t);
14055
14055
  if (qd(g, A)) {
@@ -14108,7 +14108,7 @@ function Fr(e, t) {
14108
14108
  };
14109
14109
  return m.infeasibleReason === "price-unviable" ? { ...h, diagnosticCertainty: "heuristic" } : h;
14110
14110
  }
14111
- function Ni(e, t) {
14111
+ function Li(e, t) {
14112
14112
  return { ...{
14113
14113
  feasible: !1,
14114
14114
  gammaNewHuman: 0,
@@ -14161,8 +14161,8 @@ function qd(e, t) {
14161
14161
  }
14162
14162
  function Bd(e, t, n, r, a) {
14163
14163
  let i = t, o = Wt(e, i, r);
14164
- for (let s = 1; s <= Di; s++) {
14165
- const l = s / Di, u = t + (n - t) * l, d = Wt(e, u, r);
14164
+ for (let s = 1; s <= Ni; s++) {
14165
+ const l = s / Ni, u = t + (n - t) * l, d = Wt(e, u, r);
14166
14166
  if (a.push({ gammaHuman: u, gap: d, refinedFromPrevious: !0 }), d > 0)
14167
14167
  return {
14168
14168
  feasibleFound: !0,
@@ -14211,7 +14211,7 @@ function Ud(e, t, n, r, a, i) {
14211
14211
  return { infeasibleReason: "price-unviable" };
14212
14212
  let d = t;
14213
14213
  for (; d < u; ) {
14214
- const c = Math.min(d * Yo, u);
14214
+ const c = Math.min(d * Qo, u);
14215
14215
  if (c <= d) break;
14216
14216
  const p = Wt(e, c, a);
14217
14217
  if (i.push({ gammaHuman: c, gap: p, refinedFromPrevious: !1 }), p > 0)
@@ -14259,9 +14259,9 @@ function Wn(e) {
14259
14259
  if (!Number.isFinite(ue)) return 0n;
14260
14260
  const Be = Math.max(0, Math.min(_, ue));
14261
14261
  return BigInt(Math.floor(Be * 10 ** m));
14262
- })(), R = vo(b), F = Ao(b), X = ac(b), U = t.equityLWad > 0n ? t.borrowedLWad * Le / t.equityLWad : 0n, se = Number(U) / 1e6;
14262
+ })(), R = wo(b), F = To(b), X = ac(b), U = t.equityLWad > 0n ? t.borrowedLWad * Le / t.equityLWad : 0n, se = Number(U) / 1e6;
14263
14263
  let $ = null, le = Number.POSITIVE_INFINITY;
14264
- const Y = Qo(t);
14264
+ const Y = Aa(t);
14265
14265
  if (Y === 0n)
14266
14266
  $ = 0n, le = 0;
14267
14267
  else {
@@ -14270,11 +14270,11 @@ function Wn(e) {
14270
14270
  if (Be >= ue)
14271
14271
  $ = null;
14272
14272
  else {
14273
- const Ma = C + Be / A;
14274
- if (Ma <= 0)
14273
+ const Ra = C + Be / A;
14274
+ if (Ra <= 0)
14275
14275
  $ = 0n;
14276
14276
  else {
14277
- const nr = k + Be * A - Be * Be / (T * T * Ma);
14277
+ const nr = k + Be * A - Be * Be / (T * T * Ra);
14278
14278
  $ = Number.isFinite(nr) && nr > 0 ? BigInt(Math.floor(nr * 10 ** m)) : 0n;
14279
14279
  }
14280
14280
  }
@@ -14293,7 +14293,7 @@ function Wn(e) {
14293
14293
  // exceeds the path-1 idle short-circuit band. Probe from there.
14294
14294
  lowerBound: M + 1n,
14295
14295
  upperBound: te
14296
- }), ue = Li({
14296
+ }), ue = Pi({
14297
14297
  sizingMarket: h,
14298
14298
  canonVault: p,
14299
14299
  deposit: r,
@@ -14306,7 +14306,7 @@ function Wn(e) {
14306
14306
  if (ge = J > ue ? J : ue, s === 0)
14307
14307
  V = ge;
14308
14308
  else {
14309
- const Be = Li({
14309
+ const Be = Pi({
14310
14310
  sizingMarket: h,
14311
14311
  canonVault: p,
14312
14312
  deposit: r,
@@ -14320,7 +14320,7 @@ function Wn(e) {
14320
14320
  }
14321
14321
  } else
14322
14322
  be = Z, ge = te, H = he, V = de;
14323
- const Q = be > ge ? be : ge, ie = H > V ? H : V, ae = Io({
14323
+ const Q = be > ge ? be : ge, ie = H > V ? H : V, ae = Eo({
14324
14324
  market: h,
14325
14325
  vault: p,
14326
14326
  yWtarget: Q,
@@ -14349,7 +14349,7 @@ function Wn(e) {
14349
14349
  break;
14350
14350
  }
14351
14351
  case "ltv": {
14352
- const J = wo(b);
14352
+ const J = Ao(b);
14353
14353
  qe = J.gammaNewL, Ue = J.gammaNewL * ce;
14354
14354
  break;
14355
14355
  }
@@ -14387,7 +14387,7 @@ function Wn(e) {
14387
14387
  };
14388
14388
  return ne !== void 0 && (fe.bindingConstraintAtHaircut = ne), fe;
14389
14389
  }
14390
- function Li(e) {
14390
+ function Pi(e) {
14391
14391
  const {
14392
14392
  sizingMarket: t,
14393
14393
  canonVault: n,
@@ -14466,10 +14466,10 @@ function $d(e) {
14466
14466
  return m;
14467
14467
  }
14468
14468
  function Vr(e) {
14469
- const t = Math.pow(10, (e.decimals0 + e.decimals1) / 2), n = Qo(e);
14469
+ const t = Math.pow(10, (e.decimals0 + e.decimals1) / 2), n = Aa(e);
14470
14470
  return Number(n) / 1e18 / t;
14471
14471
  }
14472
- function Qo(e) {
14472
+ function Aa(e) {
14473
14473
  const t = hn * e.equityLWad / Le - e.borrowedLWad;
14474
14474
  return t <= 0n || e.borrowIndexWad <= 0n ? 0n : t / e.borrowIndexWad * e.borrowIndexWad;
14475
14475
  }
@@ -14522,7 +14522,7 @@ async function zd(e, t, n, r) {
14522
14522
  }
14523
14523
  return Tt(e, o, "above-capacity", 0);
14524
14524
  }
14525
- const s = t > o.yMaxNoDebtAtHaircut, { market: l, vault: u, deposit: d, tauPips: c } = e, p = e.depositIsToken0 ?? !0, y = Aa(e.quoteHaircutBps), g = (u == null ? void 0 : u.x0) ?? 0n, m = (u == null ? void 0 : u.y0) ?? 0n, h = (u == null ? void 0 : u.rL0) ?? 0n, b = {
14525
+ const s = t > o.yMaxNoDebtAtHaircut, { market: l, vault: u, deposit: d, tauPips: c } = e, p = e.depositIsToken0 ?? !0, y = Ta(e.quoteHaircutBps), g = (u == null ? void 0 : u.x0) ?? 0n, m = (u == null ? void 0 : u.y0) ?? 0n, h = (u == null ? void 0 : u.rL0) ?? 0n, b = {
14526
14526
  x0: p ? g : m,
14527
14527
  y0: p ? m : g,
14528
14528
  rL0: h
@@ -14546,7 +14546,7 @@ async function zd(e, t, n, r) {
14546
14546
  W.feasible && W.regime === "no-new-borrow" && (L = {
14547
14547
  feasible: !0,
14548
14548
  dispatch: "no-new-borrow-noswap",
14549
- branch: Pi(
14549
+ branch: _i(
14550
14550
  W.gammaTotalL,
14551
14551
  W.gammaNewL,
14552
14552
  W.xV,
@@ -14607,7 +14607,7 @@ async function zd(e, t, n, r) {
14607
14607
  qe <= Ue && (M = {
14608
14608
  feasible: !0,
14609
14609
  dispatch: "needs-borrow-noswap",
14610
- branch: Pi(
14610
+ branch: _i(
14611
14611
  W.gammaTotalL,
14612
14612
  W.gammaNewL,
14613
14613
  W.xV,
@@ -14845,7 +14845,7 @@ async function Qd(e, t, n, r, a, i, o, s, l) {
14845
14845
  a.decimals1
14846
14846
  );
14847
14847
  if (u <= 0) return { feasible: !1, quoteCount: 0 };
14848
- const d = Aa(o) / 1e4, c = u * (1 - d);
14848
+ const d = Ta(o) / 1e4, c = u * (1 - d);
14849
14849
  if (c <= 0) return { feasible: !1, quoteCount: 0 };
14850
14850
  const p = e.vault.x0 + e.deposit;
14851
14851
  if (p <= 0n)
@@ -15053,10 +15053,10 @@ async function Jd(e, t, n, r, a, i, o, s, l, u, d, c, p) {
15053
15053
  };
15054
15054
  return I && (C.settleAdjusted = !0), C;
15055
15055
  }
15056
- function Aa(e) {
15056
+ function Ta(e) {
15057
15057
  return e == null || !Number.isFinite(e) || e <= 0 ? 0 : e >= 1e4 ? 1e4 : Math.ceil(e);
15058
15058
  }
15059
- function Pi(e, t, n, r, a, i, o) {
15059
+ function _i(e, t, n, r, a, i, o) {
15060
15060
  const { xV: s, yV: l } = a ? { xV: n, yV: r } : { xV: r, yV: n }, u = un(e, s, l, i, o);
15061
15061
  return {
15062
15062
  isSwap: !1,
@@ -15118,7 +15118,7 @@ function np(e, t, n, r, a, i) {
15118
15118
  // silently re-defaults to 50 bps in the builder. Pass the NORMALIZED
15119
15119
  // value (same clamp/round the sizing used): a fractional raw input
15120
15120
  // would size fine and then throw during BigInt route encoding.
15121
- ...n.quoteHaircutBps !== void 0 ? { slippageBps: Aa(n.quoteHaircutBps) } : {}
15121
+ ...n.quoteHaircutBps !== void 0 ? { slippageBps: Ta(n.quoteHaircutBps) } : {}
15122
15122
  },
15123
15123
  maxLtvPips: n.tauPips,
15124
15124
  deadline: u,
@@ -15135,7 +15135,7 @@ function Xo(e) {
15135
15135
  depositIsToken0: e.depositIsToken0 ?? !0
15136
15136
  });
15137
15137
  }
15138
- function _i(e, t) {
15138
+ function Ci(e, t) {
15139
15139
  return Tt(e, Xo(e), t, 0);
15140
15140
  }
15141
15141
  function Tt(e, t, n, r) {
@@ -15214,13 +15214,13 @@ function Jo(e, t, n) {
15214
15214
  };
15215
15215
  }
15216
15216
  function ap(e, t, n) {
15217
- return t <= 0n ? null : e <= 0n ? Le : $o(e, t * n);
15217
+ return t <= 0n ? null : e <= 0n ? Le : Ho(e, t * n);
15218
15218
  }
15219
- function Ta(e) {
15220
- return e.rL <= 0n ? !0 : e.floorL <= 0n ? !1 : $o(e.floorL, e.rL * e.borrowIndexWad) <= BigInt(e.maxLtvPips);
15219
+ function Ia(e) {
15220
+ return e.rL <= 0n ? !0 : e.floorL <= 0n ? !1 : Ho(e.floorL, e.rL * e.borrowIndexWad) <= BigInt(e.maxLtvPips);
15221
15221
  }
15222
15222
  var ip = 200n;
15223
- function Ci(e) {
15223
+ function Mi(e) {
15224
15224
  return (e * (10000n + ip) + 9999n) / 10000n;
15225
15225
  }
15226
15226
  function Wr(e) {
@@ -15281,7 +15281,7 @@ function Wr(e) {
15281
15281
  const M = u < L ? L - u : 0n, R = d < q ? q - d : 0n, F = u > L ? u - L : 0n, X = d > q ? d - q : 0n, U = y * y;
15282
15282
  let se = null;
15283
15283
  if (F > 0n && R > 0n) {
15284
- const te = Ci(BigInt(Math.ceil(Number(R) / U)));
15284
+ const te = Mi(BigInt(Math.ceil(Number(R) / U)));
15285
15285
  te <= F && (se = {
15286
15286
  source: "idle-swap",
15287
15287
  fromIdle0: 0n,
@@ -15293,7 +15293,7 @@ function Wr(e) {
15293
15293
  swapOutputMin: R
15294
15294
  });
15295
15295
  } else if (X > 0n && M > 0n) {
15296
- const te = Ci(BigInt(Math.ceil(Number(M) * U)));
15296
+ const te = Mi(BigInt(Math.ceil(Number(M) * U)));
15297
15297
  te <= X && (se = {
15298
15298
  source: "idle-swap",
15299
15299
  fromIdle0: 0n,
@@ -15332,7 +15332,7 @@ function Wr(e) {
15332
15332
  }), F = R.appliedRl >= a;
15333
15333
  let X = !1;
15334
15334
  if (F && s > 0n) {
15335
- const U = Go(t, n, q, o);
15335
+ const U = jo(t, n, q, o);
15336
15336
  if (U === null)
15337
15337
  X = !0;
15338
15338
  else if (e.collateral) {
@@ -15341,7 +15341,7 @@ function Wr(e) {
15341
15341
  idle1: U.idle1,
15342
15342
  positions: e.collateral.positions
15343
15343
  });
15344
- X = !Ta({
15344
+ X = !Ia({
15345
15345
  floorL: se,
15346
15346
  rL: s,
15347
15347
  borrowIndexWad: t.borrowIndexWad,
@@ -15392,7 +15392,7 @@ function sp(e) {
15392
15392
  const u = un(s, n.x0, n.y0, a, i) / 1e6;
15393
15393
  let d = null;
15394
15394
  if (t.currentRatePerSecWad !== null) {
15395
- const I = Number(t.currentRatePerSecWad) / 1e18 * op, w = Uo(u, o, I);
15395
+ const I = Number(t.currentRatePerSecWad) / 1e18 * op, w = Wo(u, o, I);
15396
15396
  d = w === 1 / 0 ? "INF" : w;
15397
15397
  }
15398
15398
  const c = t.sqrtPriceX96 * t.sqrtPriceX96;
@@ -15439,7 +15439,7 @@ var lp = {
15439
15439
  };
15440
15440
  function up(e) {
15441
15441
  const { market: t, vault: n } = e;
15442
- zo(t);
15442
+ Go(t);
15443
15443
  const { decimals0: r, decimals1: a } = t, i = ga(t.sqrtPriceX96, r, a);
15444
15444
  if (!Number.isFinite(i) || i <= 0)
15445
15445
  throw new Error(
@@ -15497,21 +15497,21 @@ async function dn(e, t, n) {
15497
15497
  }
15498
15498
  return null;
15499
15499
  }
15500
- async function Ia(e, t) {
15500
+ async function Ea(e, t) {
15501
15501
  const { addresses: n } = sa(t.chainId, t.version, t.deployment), r = await Ut(e, t.blockNumber);
15502
15502
  oe(t.signal, t.fn);
15503
15503
  const a = r.blockNumber, [i, o, s, l, u] = await Promise.all([
15504
15504
  // Exits never consume the rate model, so custom-oracle markets must not
15505
15505
  // be blocked: assemble with the canonical model unconditionally and
15506
15506
  // surface a non-canonical oracle as data (the quotes warn).
15507
- Ro(e, {
15507
+ Oo(e, {
15508
15508
  aegisStateView: n.aegisStateView,
15509
15509
  v4StateView: n.stateView,
15510
15510
  poolId: t.poolId,
15511
15511
  rateModel: t.rateModel ?? vn.default(),
15512
15512
  blockNumber: a
15513
15513
  }),
15514
- No(e, n.vaultRegistry, t.vaultId, a).then((m) => ({ exists: !0, owner: m })).catch((m) => {
15514
+ Lo(e, n.vaultRegistry, t.vaultId, a).then((m) => ({ exists: !0, owner: m })).catch((m) => {
15515
15515
  if (Un(m))
15516
15516
  return { exists: !1, owner: null };
15517
15517
  throw m;
@@ -15561,17 +15561,17 @@ async function Ia(e, t) {
15561
15561
  frameReorg: d
15562
15562
  };
15563
15563
  }
15564
- function Ea(e) {
15564
+ function xa(e) {
15565
15565
  return e ? [
15566
15566
  `Market rate oracle ${e} is not the canonical model; the echoed market.currentRatePerSecWad is null (rate unavailable — this exit does not depend on it).`
15567
15567
  ] : [];
15568
15568
  }
15569
- function xa(e, t, n) {
15569
+ function ka(e, t, n) {
15570
15570
  return e.status === "rejected-at-frame" ? [`The complete ${n} call reverted at the quote frame; no calldata is returned.`] : e.status === "re-quote-required" ? [
15571
15571
  `The quote frame ${t.blockNumber} is no longer the current head; re-quote before submission.`
15572
15572
  ] : [];
15573
15573
  }
15574
- function ka(e) {
15574
+ function Da(e) {
15575
15575
  const t = [];
15576
15576
  return e.ownerOnChain.toLowerCase() !== e.expectedOwner.toLowerCase() && t.push({
15577
15577
  gate: "ownership",
@@ -15602,9 +15602,9 @@ async function es(e, t, n, r, a, i) {
15602
15602
  }
15603
15603
  function $r(e, t, n, r) {
15604
15604
  const a = [];
15605
- return t > 0n && a.push(Mi(e.currency0, t, r)), n > 0n && a.push(Mi(e.currency1, n, r)), a;
15605
+ return t > 0n && a.push(Ri(e.currency0, t, r)), n > 0n && a.push(Ri(e.currency1, n, r)), a;
15606
15606
  }
15607
- function Mi(e, t, n) {
15607
+ function Ri(e, t, n) {
15608
15608
  const r = e === Ee;
15609
15609
  return {
15610
15610
  approvalType: "permit2",
@@ -15658,13 +15658,13 @@ function An(e) {
15658
15658
  async function ns(e, t) {
15659
15659
  const n = An(t);
15660
15660
  if (n) return n;
15661
- const r = await mo(e, {
15661
+ const r = await yo(e, {
15662
15662
  chainId: t.chainId,
15663
15663
  permit2Address: t.permit2Address,
15664
15664
  permit: t.permit,
15665
15665
  blockNumber: t.blockNumber
15666
15666
  });
15667
- return Da(
15667
+ return Na(
15668
15668
  { ...t.permit, verification: r },
15669
15669
  t.router,
15670
15670
  {
@@ -15674,7 +15674,7 @@ async function ns(e, t) {
15674
15674
  }
15675
15675
  );
15676
15676
  }
15677
- function Da(e, t, n) {
15677
+ function Na(e, t, n) {
15678
15678
  const r = (l) => ({ gate: "permit-invalid", detail: l }), a = e.verification;
15679
15679
  if (a === void 0)
15680
15680
  return r(
@@ -15699,7 +15699,7 @@ function Da(e, t, n) {
15699
15699
  return r(
15700
15700
  `permit verification ran for chain ${a.chainId}, expected ${n.chainId}`
15701
15701
  );
15702
- const o = po(
15702
+ const o = fo(
15703
15703
  e.permitBatch,
15704
15704
  a.chainId,
15705
15705
  a.permit2
@@ -15821,7 +15821,7 @@ async function pp(e) {
15821
15821
  quoteHaircutBps: e.slippageBps,
15822
15822
  ...e.comfortCapLtvPips !== void 0 ? { comfortCapLtvPips: e.comfortCapLtvPips } : {},
15823
15823
  ...e.owner !== void 0 ? { owner: e.owner } : {}
15824
- }, p = l || o ? _i(c, "invalid-input") : u.status === "unavailable" ? _i(c, "collateral-unavailable") : await zd(c, e.borrowOut, e.fetchQuote, {
15824
+ }, p = l || o ? Ci(c, "invalid-input") : u.status === "unavailable" ? Ci(c, "collateral-unavailable") : await zd(c, e.borrowOut, e.fetchQuote, {
15825
15825
  signal: e.signal,
15826
15826
  ...e.capacity !== void 0 ? { capacity: e.capacity } : {},
15827
15827
  deadline: n,
@@ -15863,7 +15863,7 @@ async function pp(e) {
15863
15863
  let D = null;
15864
15864
  if (g && e.aprProjection && w !== null) {
15865
15865
  const H = (E == null ? void 0 : E.currentLtvFrac) ?? y.actualLtvPips / 1e6;
15866
- D = Wo({
15866
+ D = $o({
15867
15867
  equityLWad: e.market.equityLWad,
15868
15868
  borrowedLWad: e.market.borrowedLWad,
15869
15869
  deltaLWad: A,
@@ -15887,7 +15887,7 @@ async function pp(e) {
15887
15887
  q = {
15888
15888
  ...p.encodeInput,
15889
15889
  maxLtvPips: H,
15890
- ...r ? { permit: fo(r) } : {}
15890
+ ...r ? { permit: mo(r) } : {}
15891
15891
  };
15892
15892
  }
15893
15893
  const O = [];
@@ -15950,7 +15950,7 @@ async function pp(e) {
15950
15950
  if (ie)
15951
15951
  O.push(ie);
15952
15952
  else {
15953
- const ae = Da(
15953
+ const ae = Na(
15954
15954
  H.permit,
15955
15955
  H.router,
15956
15956
  { blockNumber: H.blockNumber, chainId: e.chainId }
@@ -16082,7 +16082,7 @@ function Et(e) {
16082
16082
  execution: e
16083
16083
  };
16084
16084
  }
16085
- function Na(e, t) {
16085
+ function La(e, t) {
16086
16086
  return t === 0n ? { amount0: 0n, amount1: 0n } : Qt(
16087
16087
  t,
16088
16088
  e.poolKey,
@@ -16094,18 +16094,18 @@ var pn = 50, mp = 500;
16094
16094
  function _n(e) {
16095
16095
  return e === void 0 ? !0 : Number.isInteger(e) && e >= 0 && e <= mp;
16096
16096
  }
16097
- function Ri(e, t) {
16097
+ function Oi(e, t) {
16098
16098
  if (e <= 0n) return 1n;
16099
16099
  const r = (e * (10000n + BigInt(t)) + 9999n) / 10000n;
16100
16100
  return r < 1n ? 1n : r;
16101
16101
  }
16102
16102
  function zn(e, t, n = pn) {
16103
16103
  return e <= 0n ? null : {
16104
- amount0: Ri(t.amount0, n),
16105
- amount1: Ri(t.amount1, n)
16104
+ amount0: Oi(t.amount0, n),
16105
+ amount1: Oi(t.amount1, n)
16106
16106
  };
16107
16107
  }
16108
- function La(e) {
16108
+ function Pa(e) {
16109
16109
  const t = Jn(e.vault, e.source), n = (r, a, i, o) => {
16110
16110
  const s = a - r;
16111
16111
  if (s <= 0n) return i;
@@ -16129,7 +16129,7 @@ function La(e) {
16129
16129
  };
16130
16130
  }
16131
16131
  function zr(e) {
16132
- const t = Na(
16132
+ const t = La(
16133
16133
  e.market,
16134
16134
  e.requiredLiquidityL
16135
16135
  ), n = e.synchronized ?? null;
@@ -16163,14 +16163,14 @@ function zr(e) {
16163
16163
  };
16164
16164
  }
16165
16165
  function Gr(e) {
16166
- return e instanceof Ra || e instanceof qi || e instanceof Fi && (e.code === Ra.code || Vi(e.data) && e.data !== "0x");
16166
+ return e instanceof Oa || e instanceof Bi || e instanceof Vi && (e.code === Oa.code || Ui(e.data) && e.data !== "0x");
16167
16167
  }
16168
16168
  function yp(e) {
16169
16169
  return Gr(e) ? !0 : e instanceof Yr ? e.walk(Gr) !== null : !1;
16170
16170
  }
16171
16171
  var hp = [...tn, ...$e];
16172
16172
  function bp(e) {
16173
- const t = e instanceof Yr ? e.walk(Gr) : e, n = t instanceof Fi && Vi(t.data) ? t.data : null;
16173
+ const t = e instanceof Yr ? e.walk(Gr) : e, n = t instanceof Vi && Ui(t.data) ? t.data : null;
16174
16174
  if (n === null || n === "0x") return { errorName: null, args: void 0 };
16175
16175
  try {
16176
16176
  const r = Ts({ abi: hp, data: n });
@@ -16179,7 +16179,7 @@ function bp(e) {
16179
16179
  return { errorName: null, args: void 0 };
16180
16180
  }
16181
16181
  }
16182
- async function Pa(e, t) {
16182
+ async function _a(e, t) {
16183
16183
  const n = t.fn ?? "callRouterAtFrame";
16184
16184
  oe(t.signal, n);
16185
16185
  try {
@@ -16266,14 +16266,14 @@ async function ls(e, t, n, r, a) {
16266
16266
  };
16267
16267
  return i.number !== t.blockNumber || i.hash !== t.blockHash ? tr("head-advanced-during-preflight", i, o) : { status: "rejected-at-frame", reason: "execution-reverted", call: null, evidence: o };
16268
16268
  }
16269
- async function _a(e, t) {
16269
+ async function Ca(e, t) {
16270
16270
  oe(t.signal, t.fn);
16271
16271
  const n = await e.getBlock();
16272
16272
  oe(t.signal, t.fn);
16273
16273
  const r = is(t, t.call, n);
16274
16274
  if (n.number !== t.frame.blockNumber || n.hash !== t.frame.blockHash)
16275
16275
  return os(r);
16276
- const a = await Pa(e, {
16276
+ const a = await _a(e, {
16277
16277
  account: t.account,
16278
16278
  router: t.router,
16279
16279
  call: t.call,
@@ -16313,7 +16313,7 @@ var rn = 1n, us = (1n << 135n) - 1n, Er = {
16313
16313
  maxEngineTokenDebit1: 0n,
16314
16314
  minLiquidityDelta: us
16315
16315
  }
16316
- }, Oi = ["InsufficientIdleAmount0", "InsufficientIdleAmount1"];
16316
+ }, Si = ["InsufficientIdleAmount0", "InsufficientIdleAmount1"];
16317
16317
  async function gp(e, t) {
16318
16318
  oe(t.signal, t.fn);
16319
16319
  const n = await e.getBlock();
@@ -16323,7 +16323,7 @@ async function gp(e, t) {
16323
16323
  return os(r(t.calls.engineTokenDebit0));
16324
16324
  const a = (c) => ls(e, t.frame, r(c), t.signal, t.fn), i = async (c) => {
16325
16325
  oe(t.signal, t.fn);
16326
- const p = await Pa(e, {
16326
+ const p = await _a(e, {
16327
16327
  account: t.account,
16328
16328
  router: t.router,
16329
16329
  call: c,
@@ -16342,11 +16342,11 @@ async function gp(e, t) {
16342
16342
  detail: `the amount${c} Engine debit guard did not trip against a projected ${y} wei requirement`
16343
16343
  } : rn;
16344
16344
  const { errorName: m, args: h } = g.revert;
16345
- if (m !== Oi[c]) return a(p);
16345
+ if (m !== Si[c]) return a(p);
16346
16346
  const [b, A] = h ?? [];
16347
16347
  return typeof b != "bigint" || typeof A != "bigint" || A !== -rn || b >= A ? {
16348
16348
  status: "unavailable",
16349
- detail: `the ${Oi[c]} probe payload did not carry the expected sentinel`
16349
+ detail: `the ${Si[c]} probe payload did not carry the expected sentinel`
16350
16350
  } : -b;
16351
16351
  }, s = await o(0);
16352
16352
  if (typeof s != "bigint") return s;
@@ -16367,7 +16367,7 @@ async function gp(e, t) {
16367
16367
  funding: { appliedLiquidityL: d, engineTokenDebit: { amount0: s, amount1: l } }
16368
16368
  };
16369
16369
  }
16370
- var Ca = class extends Error {
16370
+ var Ma = class extends Error {
16371
16371
  constructor(t, n) {
16372
16372
  super(n instanceof Error ? n.message : t);
16373
16373
  ee(this, "original");
@@ -16384,7 +16384,7 @@ function cs(e, t) {
16384
16384
  requiredLiquidity: t.encode(n, Er.requiredLiquidity)
16385
16385
  };
16386
16386
  } catch (a) {
16387
- throw new Ca(t.builderFallbackMessage, a);
16387
+ throw new Ma(t.builderFallbackMessage, a);
16388
16388
  }
16389
16389
  return gp(e, {
16390
16390
  account: t.account,
@@ -16429,7 +16429,7 @@ async function fs(e) {
16429
16429
  source: t,
16430
16430
  passes: n
16431
16431
  };
16432
- const i = La({
16432
+ const i = Pa({
16433
16433
  vault: e.vault,
16434
16434
  source: t,
16435
16435
  target: a,
@@ -16461,7 +16461,7 @@ var vp = [
16461
16461
  "engine-token-debit-capped-by-router-min-idle",
16462
16462
  "wallet-legs-top-up-toward-tolerance-maximum-subject-to-balance",
16463
16463
  "unconsumed-funding-remains-vault-idle-collateral"
16464
- ], Si = "Repay funding legs exceed the int128 action encoding — split into multiple partial repays.", wp = new AbortController().signal;
16464
+ ], qi = "Repay funding legs exceed the int128 action encoding — split into multiple partial repays.", wp = new AbortController().signal;
16465
16465
  async function Ap(e, t) {
16466
16466
  var ie, ae, ve;
16467
16467
  const {
@@ -16473,7 +16473,7 @@ async function Ap(e, t) {
16473
16473
  routerApproved: s,
16474
16474
  nonCanonicalOracle: l,
16475
16475
  frameReorg: u
16476
- } = await Ia(e, {
16476
+ } = await Ea(e, {
16477
16477
  chainId: t.chainId,
16478
16478
  version: t.version,
16479
16479
  deployment: t.deployment,
@@ -16494,7 +16494,7 @@ async function Ap(e, t) {
16494
16494
  quoteTtlSeconds: t.quoteTtlSeconds,
16495
16495
  permitBatch: (ie = t.permit) == null ? void 0 : ie.permitBatch,
16496
16496
  fn: "quoteRepay"
16497
- }), g = _n(t.engineDebitToleranceBps) ? t.engineDebitToleranceBps ?? pn : pn, m = [...Ea(l), ...y];
16497
+ }), g = _n(t.engineDebitToleranceBps) ? t.engineDebitToleranceBps ?? pn : pn, m = [...xa(l), ...y];
16498
16498
  _n(t.engineDebitToleranceBps) || m.push("quoteRepay requires an integer engineDebitToleranceBps between 0 and 500.");
16499
16499
  const h = {
16500
16500
  kind: "repay",
@@ -16547,7 +16547,7 @@ async function Ap(e, t) {
16547
16547
  infeasibleReason: "vault-not-found",
16548
16548
  collateral: { status: "not-required", reason: "vault-not-found" }
16549
16549
  };
16550
- const T = ka({
16550
+ const T = Da({
16551
16551
  vaultId: t.vaultId,
16552
16552
  ownerOnChain: o,
16553
16553
  expectedOwner: t.owner,
@@ -16643,7 +16643,7 @@ async function Ap(e, t) {
16643
16643
  if (!v) {
16644
16644
  let K;
16645
16645
  try {
16646
- K = await Lo(e, {
16646
+ K = await Po(e, {
16647
16647
  chainId: t.chainId,
16648
16648
  version: t.version,
16649
16649
  deployment: t.deployment,
@@ -16698,7 +16698,7 @@ async function Ap(e, t) {
16698
16698
  swapSlippageBps: t.slippageBps ?? 50
16699
16699
  };
16700
16700
  }
16701
- const se = Na(a, w);
16701
+ const se = La(a, w);
16702
16702
  if (se === null)
16703
16703
  return m.push(
16704
16704
  "Could not derive Engine token-debit guards at the quote frame; refusing unbounded calldata."
@@ -16708,7 +16708,7 @@ async function Ap(e, t) {
16708
16708
  se,
16709
16709
  g
16710
16710
  );
16711
- $ !== null && (U = La({
16711
+ $ !== null && (U = Pa({
16712
16712
  vault: i,
16713
16713
  source: U,
16714
16714
  target: $,
@@ -16748,7 +16748,7 @@ async function Ap(e, t) {
16748
16748
  ...t.signal ? { signal: t.signal } : {},
16749
16749
  fn: "quoteRepay",
16750
16750
  builderFallbackMessage: "buildRepayRecipe failed.",
16751
- encode: (G, ce) => bi(le(G, c, ce))
16751
+ encode: (G, ce) => gi(le(G, c, ce))
16752
16752
  });
16753
16753
  try {
16754
16754
  const G = await fs({
@@ -16764,9 +16764,9 @@ async function Ap(e, t) {
16764
16764
  return m.push(ds(G.detail)), x("engine-debit-bound-unavailable", F, U);
16765
16765
  G.status === "assessment" ? te = G.assessment : (Z = G.funding, ye = G.engineDebitLimit);
16766
16766
  } catch (G) {
16767
- if (!(G instanceof Ca)) throw G;
16767
+ if (!(G instanceof Ma)) throw G;
16768
16768
  if (K.fromWallet0 > me || K.fromWallet1 > me || K.swapInput > me || K.swapOutputMin > me)
16769
- return m.push(Si), x("requires-split", F, K);
16769
+ return m.push(qi), x("requires-split", F, K);
16770
16770
  const ce = [
16771
16771
  { token: a.poolKey.currency0, amount: K.fromWallet0 },
16772
16772
  { token: a.poolKey.currency1, amount: K.fromWallet1 }
@@ -16801,7 +16801,7 @@ async function Ap(e, t) {
16801
16801
  "Engine token-debit guards exceed the negated int128 encoding — split the repayment."
16802
16802
  ), x("requires-split", F, U);
16803
16803
  if (U.fromWallet0 > me || U.fromWallet1 > me || U.swapInput > me || U.swapOutputMin > me)
16804
- return m.push(Si), x("requires-split", F, U);
16804
+ return m.push(qi), x("requires-split", F, U);
16805
16805
  const he = ps(pe, Z), de = Tp(
16806
16806
  a,
16807
16807
  i,
@@ -16818,7 +16818,7 @@ async function Ap(e, t) {
16818
16818
  (R == null ? void 0 : R.refs) ?? [],
16819
16819
  "could not project the post-repay idle state from the verified quote inputs"
16820
16820
  ), m.push("Could not project the partial-repay collateral floor."), x("collateral-unavailable", F, U);
16821
- if (D = de.collateral, D.status === "verified-at-frame" && !Ta({
16821
+ if (D = de.collateral, D.status === "verified-at-frame" && !Ia({
16822
16822
  floorL: D.floorLPost,
16823
16823
  rL: i.rL0 - I,
16824
16824
  borrowIndexWad: a.borrowIndexWad,
@@ -16856,7 +16856,7 @@ async function Ap(e, t) {
16856
16856
  });
16857
16857
  let V;
16858
16858
  try {
16859
- V = bi(H);
16859
+ V = gi(H);
16860
16860
  } catch (K) {
16861
16861
  return Y(H, U, ge, K);
16862
16862
  }
@@ -16865,7 +16865,7 @@ async function Ap(e, t) {
16865
16865
  reason: "execution-gate",
16866
16866
  call: null,
16867
16867
  evidence: null
16868
- } : te ?? await _a(e, {
16868
+ } : te ?? await Ca(e, {
16869
16869
  account: t.owner,
16870
16870
  router: n.aegisRouterV1,
16871
16871
  call: V,
@@ -16873,7 +16873,7 @@ async function Ap(e, t) {
16873
16873
  ...t.signal ? { signal: t.signal } : {},
16874
16874
  fn: "quoteRepay"
16875
16875
  });
16876
- return m.push(...xa(Q, r, "repay")), {
16876
+ return m.push(...ka(Q, r, "repay")), {
16877
16877
  ...h,
16878
16878
  ...Et(Q),
16879
16879
  // Tightened past the base clamp now that the wallet legs — and their
@@ -16924,7 +16924,7 @@ async function Ap(e, t) {
16924
16924
  };
16925
16925
  }
16926
16926
  function Tp(e, t, n, r, a, i, o, s) {
16927
- const l = jo(
16927
+ const l = Ko(
16928
16928
  e,
16929
16929
  t,
16930
16930
  n,
@@ -16994,7 +16994,7 @@ async function kp(e, t) {
16994
16994
  routerApproved: s,
16995
16995
  nonCanonicalOracle: l,
16996
16996
  frameReorg: u
16997
- } = await Ia(e, {
16997
+ } = await Ea(e, {
16998
16998
  chainId: t.chainId,
16999
16999
  version: t.version,
17000
17000
  deployment: t.deployment,
@@ -17007,7 +17007,7 @@ async function kp(e, t) {
17007
17007
  fn: "quoteIdleWithdraw"
17008
17008
  });
17009
17009
  if (u) throw u;
17010
- const d = Ea(l), { expiresAt: c, ttlInvalid: p } = er({
17010
+ const d = xa(l), { expiresAt: c, ttlInvalid: p } = er({
17011
17011
  deadline: t.deadline,
17012
17012
  frame: r,
17013
17013
  quoteTtlSeconds: t.quoteTtlSeconds
@@ -17036,7 +17036,7 @@ async function kp(e, t) {
17036
17036
  encodeInput: null,
17037
17037
  call: null
17038
17038
  };
17039
- const g = ka({
17039
+ const g = Da({
17040
17040
  vaultId: t.vaultId,
17041
17041
  ownerOnChain: o,
17042
17042
  expectedOwner: t.owner,
@@ -17074,7 +17074,7 @@ async function kp(e, t) {
17074
17074
  if (i.rL0 === 0n)
17075
17075
  b = { status: "not-required", reason: "zero-residual-debt" };
17076
17076
  else {
17077
- const q = await Lo(e, {
17077
+ const q = await Po(e, {
17078
17078
  chainId: t.chainId,
17079
17079
  version: t.version,
17080
17080
  deployment: t.deployment,
@@ -17093,7 +17093,7 @@ async function kp(e, t) {
17093
17093
  borrowIndexWad: a.borrowIndexWad
17094
17094
  });
17095
17095
  }
17096
- if (!(b.status === "not-required" || b.status === "verified-at-frame" && Ta({
17096
+ if (!(b.status === "not-required" || b.status === "verified-at-frame" && Ia({
17097
17097
  floorL: b.floorLPost,
17098
17098
  rL: i.rL0,
17099
17099
  borrowIndexWad: a.borrowIndexWad,
@@ -17122,7 +17122,7 @@ async function kp(e, t) {
17122
17122
  return d.push(q instanceof Error ? q.message : "buildIdleWithdrawRecipe failed."), { ...A("builder-error"), encodeInput: x };
17123
17123
  }
17124
17124
  if (g.length === 0) {
17125
- const q = await _a(e, {
17125
+ const q = await Ca(e, {
17126
17126
  account: t.owner,
17127
17127
  router: n.aegisRouterV1,
17128
17128
  call: k,
@@ -17130,7 +17130,7 @@ async function kp(e, t) {
17130
17130
  ...t.signal ? { signal: t.signal } : {},
17131
17131
  fn: "quoteIdleWithdraw"
17132
17132
  });
17133
- q.status !== "verified-at-frame" && (g.push(xp(q, n.aegisRouterV1)), d.push(...xa(q, r, "idle-withdraw")));
17133
+ q.status !== "verified-at-frame" && (g.push(xp(q, n.aegisRouterV1)), d.push(...ka(q, r, "idle-withdraw")));
17134
17134
  }
17135
17135
  const L = g.length === 0;
17136
17136
  return {
@@ -17165,7 +17165,7 @@ async function Np(e, t) {
17165
17165
  routerApproved: s,
17166
17166
  nonCanonicalOracle: l,
17167
17167
  frameReorg: u
17168
- } = await Ia(e, {
17168
+ } = await Ea(e, {
17169
17169
  chainId: t.chainId,
17170
17170
  version: t.version,
17171
17171
  deployment: t.deployment,
@@ -17186,7 +17186,7 @@ async function Np(e, t) {
17186
17186
  quoteTtlSeconds: t.quoteTtlSeconds,
17187
17187
  permitBatch: (W = t.permit) == null ? void 0 : W.permitBatch,
17188
17188
  fn: "quoteCloseVault"
17189
- }), g = _n(t.engineDebitToleranceBps), m = p || !g, h = g ? t.engineDebitToleranceBps ?? pn : pn, b = [...Ea(l), ...y];
17189
+ }), g = _n(t.engineDebitToleranceBps), m = p || !g, h = g ? t.engineDebitToleranceBps ?? pn : pn, b = [...xa(l), ...y];
17190
17190
  g || b.push("quoteCloseVault requires an integer engineDebitToleranceBps between 0 and 500.");
17191
17191
  const A = {
17192
17192
  kind: "close-vault",
@@ -17238,7 +17238,7 @@ async function Np(e, t) {
17238
17238
  ...T,
17239
17239
  infeasibleReason: "vault-not-found"
17240
17240
  };
17241
- const w = i.rL0, v = Ge(w, a.borrowIndexWad), E = Na(a, v), D = E === null ? null : zn(v, E, h), [x, _] = await Promise.all([
17241
+ const w = i.rL0, v = Ge(w, a.borrowIndexWad), E = La(a, v), D = E === null ? null : zn(v, E, h), [x, _] = await Promise.all([
17242
17242
  i.attachedPositionEvidence !== void 0 ? Promise.resolve([...i.attachedPositionEvidence.refs]) : ma(e, n.aegisStateView, t.vaultId, r.blockNumber),
17243
17243
  w > 0n ? es(
17244
17244
  e,
@@ -17260,7 +17260,7 @@ async function Np(e, t) {
17260
17260
  "The current close sequence settles drained tokens to the transaction sender; use the vault owner as recipient."
17261
17261
  )) : w > Bn && (M = !1, R = "requires-split", b.push(
17262
17262
  "Vault principal exceeds the int128 action encoding — repay in parts before closing."
17263
- )), M && _ !== null && (k = Wr({ market: a, vault: i, deltaRl: w, walletBalance0: q, walletBalance1: O }), L = k.source, L !== null && D !== null && (L = La({
17263
+ )), M && _ !== null && (k = Wr({ market: a, vault: i, deltaRl: w, walletBalance0: q, walletBalance1: O }), L = k.source, L !== null && D !== null && (L = Pa({
17264
17264
  vault: i,
17265
17265
  source: L,
17266
17266
  target: D,
@@ -17313,7 +17313,7 @@ async function Np(e, t) {
17313
17313
  } catch (fe) {
17314
17314
  b.push(fe instanceof Error ? fe.message : "buildCloseVault failed."), $ = !0;
17315
17315
  }
17316
- const le = M && !$, Y = ka({
17316
+ const le = M && !$, Y = Da({
17317
17317
  vaultId: t.vaultId,
17318
17318
  ownerOnChain: o,
17319
17319
  expectedOwner: t.owner,
@@ -17350,7 +17350,7 @@ async function Np(e, t) {
17350
17350
  });
17351
17351
  L = ue.source, ue.status === "unavailable" ? (ye = !0, b.push(ds(ue.detail))) : ue.status === "assessment" ? te = ue.assessment : (Z = ue.funding, pe = ue.engineDebitLimit);
17352
17352
  } catch (ue) {
17353
- if (!(ue instanceof Ca)) throw ue;
17353
+ if (!(ue instanceof Ma)) throw ue;
17354
17354
  L = fe, fe.fromWallet0 > me || fe.fromWallet1 > me ? (M = !1, R = "requires-split", b.push(kr)) : ($ = !0, b.push(
17355
17355
  ue.original instanceof Error ? ue.original.message : "buildCloseVault failed."
17356
17356
  ));
@@ -17394,7 +17394,7 @@ async function Np(e, t) {
17394
17394
  }
17395
17395
  let H = null;
17396
17396
  if (de) {
17397
- const J = jo(
17397
+ const J = Ko(
17398
17398
  a,
17399
17399
  i,
17400
17400
  L ?? U,
@@ -17427,7 +17427,7 @@ async function Np(e, t) {
17427
17427
  reason: "execution-gate",
17428
17428
  call: null,
17429
17429
  evidence: null
17430
- } : te ?? await _a(e, {
17430
+ } : te ?? await Ca(e, {
17431
17431
  account: t.owner,
17432
17432
  router: n.aegisRouterV1,
17433
17433
  call: ie,
@@ -17435,7 +17435,7 @@ async function Np(e, t) {
17435
17435
  ...t.signal ? { signal: t.signal } : {},
17436
17436
  fn: "quoteCloseVault"
17437
17437
  });
17438
- b.push(...xa(G, r, "close"));
17438
+ b.push(...ka(G, r, "close"));
17439
17439
  const ce = ae ? {
17440
17440
  rL0Post: 0n,
17441
17441
  debtLPost: 0n,
@@ -17593,7 +17593,7 @@ async function Mp(e) {
17593
17593
  // screening fallback — an expired permit must not ride executable
17594
17594
  // calldata just because no chain clock was supplied.
17595
17595
  blockTimestamp: a
17596
- }), u === null && (u = Da(e.permit, e.approvalSpender, {
17596
+ }), u === null && (u = Na(e.permit, e.approvalSpender, {
17597
17597
  blockNumber: (_ = e.frame) == null ? void 0 : _.blockNumber,
17598
17598
  chainId: e.chainId
17599
17599
  }))), u && u.gate === "permit-invalid" && t.push(`Permit cannot fund this deposit: ${u.detail}`));
@@ -17662,7 +17662,7 @@ async function Mp(e) {
17662
17662
  deadline: e.deadline,
17663
17663
  route: h.quote.route,
17664
17664
  slippageBps: e.slippageBps,
17665
- ...e.permit ? { permit: fo(e.permit) } : {}
17665
+ ...e.permit ? { permit: mo(e.permit) } : {}
17666
17666
  };
17667
17667
  let T = null;
17668
17668
  try {
@@ -17749,7 +17749,7 @@ async function Op(e, t, n) {
17749
17749
  signal: e.signal
17750
17750
  });
17751
17751
  if (r.minAmountOut <= 0n) return null;
17752
- const a = r.minAmountOut, i = r.amountOut ?? a, o = e.inputIsToken0 ? e.amountIn - n : a, s = e.inputIsToken0 ? a : e.amountIn - n, l = qo({
17752
+ const a = r.minAmountOut, i = r.amountOut ?? a, o = e.inputIsToken0 ? e.amountIn - n : a, s = e.inputIsToken0 ? a : e.amountIn - n, l = Bo({
17753
17753
  idle0: o,
17754
17754
  idle1: s,
17755
17755
  poolKey: e.market.poolKey,
@@ -17917,7 +17917,7 @@ async function ef(e, t) {
17917
17917
  try {
17918
17918
  g = await Promise.all([
17919
17919
  fa(e, l.aegisStateView, n, d),
17920
- Mo(e, l.stateView, n, d),
17920
+ Ro(e, l.stateView, n, d),
17921
17921
  ba(e, l.aegisStateView, n, d),
17922
17922
  Cc(e, l.aegisEngine, r, n, d),
17923
17923
  e.readContract({
@@ -18084,7 +18084,7 @@ async function ef(e, t) {
18084
18084
  router: l.aegisRouterV1,
18085
18085
  calldataHash: xt(V.calldata),
18086
18086
  attempts: Q
18087
- }), se = (V) => Pa(e, {
18087
+ }), se = (V) => _a(e, {
18088
18088
  account: r,
18089
18089
  router: l.aegisRouterV1,
18090
18090
  call: V,
@@ -18203,14 +18203,14 @@ function tf(e) {
18203
18203
  const k = /* @__PURE__ */ new Set();
18204
18204
  for (const L of l)
18205
18205
  for (const q of L)
18206
- k.add(Oa(q.tokenIn.address)), k.add(Oa(q.tokenOut.address));
18206
+ k.add(Sa(q.tokenIn.address)), k.add(Sa(q.tokenOut.address));
18207
18207
  Xn(v, l, g, k), v.addSettle(b, Se, !1), v.addTake(A, tt, Se), v.addModifyIdle(
18208
18208
  yt,
18209
18209
  nt(c, p)
18210
18210
  ), v.addSettleAE(A, Se, !1);
18211
18211
  }
18212
18212
  v.addLockVault(yt, y), T && (v.addSweep(t.currency0, Qe), v.addSweep(t.currency1, Qe));
18213
- const E = v.finalize({ requiresV4Unlock: T }), D = Sa(t.currency0, Ee) ? i : Sa(t.currency1, Ee) ? o : 0n, x = m > D ? m : D;
18213
+ const E = v.finalize({ requiresV4Unlock: T }), D = qa(t.currency0, Ee) ? i : qa(t.currency1, Ee) ? o : 0n, x = m > D ? m : D;
18214
18214
  if (h) {
18215
18215
  const _ = et.encodePermitBatch(
18216
18216
  h.owner,
@@ -18229,17 +18229,17 @@ const sf = {
18229
18229
  computeMaxEfficientDeposit: gd,
18230
18230
  computeVaultStateSnapshot: up,
18231
18231
  createSubgraphClient: Fc,
18232
- deltaMaxByUtil: Vo,
18233
- dMinNoSwap: Io,
18234
- estimatePostBorrowRate: Wo,
18232
+ deltaMaxByUtil: Uo,
18233
+ dMinNoSwap: Eo,
18234
+ estimatePostBorrowRate: $o,
18235
18235
  fetchBorrowQuoteContext: Nc,
18236
18236
  fetchLendQuoteContext: Lc,
18237
- fetchMarket: xo,
18237
+ fetchMarket: ko,
18238
18238
  fetchMarketWithAccrual: fa,
18239
18239
  fetchMarketLtvThresholds: fc,
18240
- fetchMarketSharePriceLatest: ko,
18240
+ fetchMarketSharePriceLatest: Do,
18241
18241
  fetchPositionsBatch: Mc,
18242
- fetchPoolState: Mo,
18242
+ fetchPoolState: Ro,
18243
18243
  fetchTotalSupply: ba,
18244
18244
  fetchVaultDebtActions: od,
18245
18245
  fetchVaultIdleActions: sd,
@@ -18258,9 +18258,10 @@ const sf = {
18258
18258
  quoteRepay: Ap,
18259
18259
  quoteExactInputSingle: md,
18260
18260
  tauFromTimeToLiq: Ju,
18261
- uniswapV4QuoterAbi: Bo,
18261
+ uniswapV4QuoterAbi: Fo,
18262
18262
  UTILIZATION_CAP_PIPS: hn,
18263
- verifyPermit2Batch: mo
18263
+ utilizationHeadroomGammaNewLWad: Aa,
18264
+ verifyPermit2Batch: yo
18264
18265
  };
18265
18266
  export {
18266
18267
  sf as engineSdkRuntime