calcsuite-react 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/calcsuite.js CHANGED
@@ -1,10 +1,10 @@
1
- var da = Object.defineProperty;
2
- var ma = (e, t, n) => t in e ? da(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var ge = (e, t, n) => ma(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var ma = Object.defineProperty;
2
+ var pa = (e, t, n) => t in e ? ma(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var ge = (e, t, n) => pa(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as o, jsxs as b, Fragment as re } from "react/jsx-runtime";
5
- import { useState as M, useCallback as ke, useMemo as ne, useContext as pa, createContext as ha, useRef as de, useEffect as X, Fragment as xn, useSyncExternalStore as fa } from "react";
5
+ import { useState as M, useCallback as ke, useMemo as ne, useContext as ha, createContext as fa, useRef as de, useEffect as X, Fragment as xn, useSyncExternalStore as ya } from "react";
6
6
  import ut from "decimal.js";
7
- const ya = {
7
+ const ba = {
8
8
  money: 2,
9
9
  rate: 6,
10
10
  period: 4,
@@ -13,7 +13,7 @@ const ya = {
13
13
  instalment: "none",
14
14
  residualAbsorption: "last"
15
15
  }, qt = {
16
- rounding: ya,
16
+ rounding: ba,
17
17
  ui: {
18
18
  theme: "system",
19
19
  accent: "#078DEE",
@@ -74,7 +74,7 @@ const Ze = Nt("IN"), H = ut.clone({
74
74
  toExpPos: 60,
75
75
  toExpNeg: -60,
76
76
  modulo: ut.ROUND_DOWN
77
- }), g = (e) => new H(e), cs = (e, t) => g(e).eq(t), us = (e, t) => g(e).gt(t), ds = (e, t) => g(e).lt(t), ce = (e, t = "1e-9") => e.abs().lt(t), ba = {
77
+ }), g = (e) => new H(e), cs = (e, t) => g(e).eq(t), us = (e, t) => g(e).gt(t), ds = (e, t) => g(e).lt(t), ce = (e, t = "1e-9") => e.abs().lt(t), ga = {
78
78
  HALF_UP: H.ROUND_HALF_UP,
79
79
  HALF_EVEN: H.ROUND_HALF_EVEN,
80
80
  HALF_DOWN: H.ROUND_HALF_DOWN,
@@ -83,7 +83,7 @@ const Ze = Nt("IN"), H = ut.clone({
83
83
  CEIL: H.ROUND_CEIL,
84
84
  FLOOR: H.ROUND_FLOOR
85
85
  };
86
- function ga(e) {
86
+ function va(e) {
87
87
  switch (e.numberFormat.grouping) {
88
88
  case "indian":
89
89
  return "en-IN";
@@ -98,7 +98,7 @@ function ga(e) {
98
98
  }
99
99
  }
100
100
  function Sn(e) {
101
- const t = ba[e.rounding.mode], n = (l, p = e.numberFormat.decimalPlaces) => g(l).toDecimalPlaces(p, t), a = (l, p) => e.numberFormat.grouping === "plain" ? l.toFixed(p) : new Intl.NumberFormat(ga(e), {
101
+ const t = ga[e.rounding.mode], n = (l, p = e.numberFormat.decimalPlaces) => g(l).toDecimalPlaces(p, t), a = (l, p) => e.numberFormat.grouping === "plain" ? l.toFixed(p) : new Intl.NumberFormat(va(e), {
102
102
  minimumFractionDigits: e.numberFormat.trimTrailingZeros ? 0 : p,
103
103
  maximumFractionDigits: p
104
104
  }).format(l), r = (l, p) => l ? e.numberFormat.negativeFormat === "parentheses" ? `(${p})` : `-${p}` : p, s = (l) => {
@@ -126,7 +126,7 @@ function dt(e) {
126
126
  const t = Math.floor(e / 12), n = e % 12, a = [];
127
127
  return t && a.push(`${t} yr`), n && a.push(`${n} mo`), a.join(" ") || "0 mo";
128
128
  }
129
- const Cn = ha(null), Pn = "calcsuite:settings";
129
+ const Cn = fa(null), Pn = "calcsuite:settings";
130
130
  function $t(e, t) {
131
131
  if (t == null) return e;
132
132
  const n = Array.isArray(e) ? [...e] : { ...e };
@@ -136,7 +136,7 @@ function $t(e, t) {
136
136
  }
137
137
  return n;
138
138
  }
139
- function va() {
139
+ function ka() {
140
140
  try {
141
141
  const e = localStorage.getItem(Pn);
142
142
  if (e) return $t(Ze, JSON.parse(e));
@@ -151,7 +151,7 @@ function mt(e) {
151
151
  }
152
152
  }
153
153
  function ms({ children: e }) {
154
- const [t, n] = M(va), a = ke((l) => {
154
+ const [t, n] = M(ka), a = ke((l) => {
155
155
  n(l), mt(l);
156
156
  }, []), r = ke((l) => n((p) => {
157
157
  const h = $t(p, l);
@@ -172,17 +172,17 @@ function ms({ children: e }) {
172
172
  return /* @__PURE__ */ o(Cn.Provider, { value: c, children: e });
173
173
  }
174
174
  function ue() {
175
- const e = pa(Cn);
175
+ const e = ha(Cn);
176
176
  if (!e) throw new Error("useSettings must be used within SettingsProvider");
177
177
  return e;
178
178
  }
179
179
  let Xe = 0;
180
- const ka = () => {
180
+ const wa = () => {
181
181
  Xe += 1;
182
- }, wa = () => {
182
+ }, Na = () => {
183
183
  Xe = Math.max(0, Xe - 1);
184
- }, Na = () => Xe > 0, xa = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
185
- function Sa({
184
+ }, xa = () => Xe > 0, Sa = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
185
+ function Ca({
186
186
  open: e,
187
187
  onClose: t,
188
188
  children: n,
@@ -191,7 +191,7 @@ function Sa({
191
191
  }) {
192
192
  const s = de(null), u = de(null), m = ke(() => {
193
193
  const h = s.current;
194
- return h ? Array.from(h.querySelectorAll(xa)).filter(
194
+ return h ? Array.from(h.querySelectorAll(Sa)).filter(
195
195
  (f) => !f.hasAttribute("disabled") && f.getAttribute("aria-hidden") !== "true"
196
196
  ) : [];
197
197
  }, []), [d, i] = M(e), [c, l] = M(!1);
@@ -215,7 +215,7 @@ function Sa({
215
215
  document.body.style.overflow = "hidden";
216
216
  const w = (k) => {
217
217
  if (k.key === "Escape") {
218
- if (Na()) return;
218
+ if (xa()) return;
219
219
  k.preventDefault(), k.stopImmediatePropagation(), t();
220
220
  return;
221
221
  }
@@ -271,7 +271,7 @@ function Tn(e, t, n, a = !1) {
271
271
  let m = s.times(g(1).minus(u.pow(-1))).div(r);
272
272
  return a && (m = m.times(r.plus(1))), m;
273
273
  }
274
- function Ca(e, t, n) {
274
+ function Pa(e, t, n) {
275
275
  return g(e).div(g(t).plus(1).pow(n));
276
276
  }
277
277
  function we(e, t, n, a = 0, r = !1) {
@@ -281,7 +281,7 @@ function we(e, t, n, a = 0, r = !1) {
281
281
  let m = g(e).times(u).plus(a).times(s).div(u.minus(1));
282
282
  return r && (m = m.div(s.plus(1))), m;
283
283
  }
284
- function Pa(e, t, n) {
284
+ function Ta(e, t, n) {
285
285
  const a = g(n), r = g(e), s = g(t);
286
286
  return ce(a) ? r.div(s) : H.ln(s.div(s.minus(r.times(a)))).div(H.ln(a.plus(1)));
287
287
  }
@@ -305,17 +305,17 @@ function At(e, t) {
305
305
  function Fn(e) {
306
306
  return at((t) => At(t, e));
307
307
  }
308
- const Ta = (e, t) => (Date.parse(t) - Date.parse(e)) / 864e5;
308
+ const Fa = (e, t) => (Date.parse(t) - Date.parse(e)) / 864e5;
309
309
  function In(e, t) {
310
310
  const n = g(e), a = t[0].date;
311
311
  let r = g(0);
312
312
  for (const s of t) {
313
- const u = g(Ta(a, s.date)).div(365);
313
+ const u = g(Fa(a, s.date)).div(365);
314
314
  r = r.plus(g(s.amount).div(n.plus(1).pow(u)));
315
315
  }
316
316
  return r;
317
317
  }
318
- function En(e) {
318
+ function Rn(e) {
319
319
  if (e.length < 2) return null;
320
320
  const t = [...e].sort((n, a) => Date.parse(n.date) - Date.parse(a.date));
321
321
  return at((n) => In(n, t), -0.9999, 100);
@@ -330,13 +330,13 @@ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
330
330
  fvAnnuity: be,
331
331
  fvLump: Qe,
332
332
  irr: Fn,
333
- nper: Pa,
333
+ nper: Ta,
334
334
  npv: At,
335
335
  periodic: J,
336
336
  pmt: we,
337
337
  pvAnnuity: Tn,
338
- pvLump: Ca,
339
- xirr: En,
338
+ pvLump: Pa,
339
+ xirr: Rn,
340
340
  xnpv: In
341
341
  }, Symbol.toStringTag, { value: "Module" })), me = {
342
342
  IN: {
@@ -374,13 +374,13 @@ class se extends Error {
374
374
  this.name = "FinCalcError", this.code = n, this.field = r;
375
375
  }
376
376
  }
377
- const Fa = 2, ee = (e) => e.toDecimalPlaces(Fa, H.ROUND_HALF_UP), xt = (e) => e.div(100).div(12);
377
+ const Ia = 2, ee = (e) => e.toDecimalPlaces(Ia, H.ROUND_HALF_UP), xt = (e) => e.div(100).div(12);
378
378
  function St(e, t, n) {
379
379
  if (ce(t)) return e.div(n);
380
380
  const a = t.plus(1).pow(n);
381
381
  return e.times(t).times(a).div(a.minus(1));
382
382
  }
383
- function Ia(e, t, n) {
383
+ function Ra(e, t, n) {
384
384
  if (ce(t)) return e.times(n);
385
385
  const a = t.plus(1).pow(n);
386
386
  return e.times(a.minus(1)).div(t.times(a));
@@ -411,7 +411,7 @@ function Gt(e, t, n, a) {
411
411
  throw new se("SOLVER_DID_NOT_CONVERGE", "Could not find a rate within the allowed range.", "rate");
412
412
  return u;
413
413
  }
414
- function Ra(e, t, n, a) {
414
+ function Ma(e, t, n, a) {
415
415
  const r = [];
416
416
  let s = e, u = g(0);
417
417
  for (let m = 1; m <= n; m++) {
@@ -429,7 +429,7 @@ function Ra(e, t, n, a) {
429
429
  }
430
430
  return r;
431
431
  }
432
- function Ma(e) {
432
+ function $a(e) {
433
433
  const t = [];
434
434
  for (const n of e) {
435
435
  const a = Math.ceil(n.month / 12);
@@ -472,7 +472,7 @@ function Ie(e) {
472
472
  i = ee(St(u, k(), d)), l = "PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
473
473
  break;
474
474
  case "principal":
475
- u = Ia(i, k(), d), l = "P = PMT·((1+r)^n − 1) / (r·(1+r)^n)";
475
+ u = Ra(i, k(), d), l = "P = PMT·((1+r)^n − 1) / (r·(1+r)^n)";
476
476
  break;
477
477
  case "tenure":
478
478
  d = Ea(u, k(), i), l = "n = ln(PMT / (PMT − P·r)) / ln(1 + r)";
@@ -482,7 +482,7 @@ function Ie(e) {
482
482
  break;
483
483
  }
484
484
  }
485
- const p = xt(m), h = n === "flat" ? i : ee(St(u, p, d)), f = Ra(u, p, d, h);
485
+ const p = xt(m), h = n === "flat" ? i : ee(St(u, p, d)), f = Ma(u, p, d, h);
486
486
  d = f.length;
487
487
  const y = f.reduce((k, S) => k.plus(S.interest), g(0)), w = f.reduce((k, S) => k.plus(S.payment), g(0));
488
488
  return {
@@ -496,7 +496,7 @@ function Ie(e) {
496
496
  totalInterest: ee(y),
497
497
  totalPayment: ee(w),
498
498
  schedule: f,
499
- byYear: Ma(f),
499
+ byYear: $a(f),
500
500
  chart: {
501
501
  balance: f.map((k) => k.closingBalance),
502
502
  cumulativeInterest: f.map((k) => k.cumulativeInterest)
@@ -518,7 +518,7 @@ const C = (e, t = 0) => {
518
518
  tone: n,
519
519
  sub: a
520
520
  }), U = (e) => e.toDecimalPlaces(2, H.ROUND_HALF_UP);
521
- function Rn(e, t) {
521
+ function En(e, t) {
522
522
  const n = /* @__PURE__ */ new Map();
523
523
  for (const r of e) {
524
524
  const s = Math.ceil(r.month / 12), u = n.get(s);
@@ -553,7 +553,7 @@ for (let e = 1; e <= 5; e++) {
553
553
  { key: `t${e}`, label: `Loan ${e} tenure`, kind: "tenure", default: 240, optional: !t, showIf: n, labelByRegion: { US: `Loan ${e} term` } }
554
554
  );
555
555
  }
556
- const $a = {
556
+ const Aa = {
557
557
  id: "loan.compare",
558
558
  group: "loans",
559
559
  title: "Compare loans",
@@ -597,7 +597,7 @@ const $a = {
597
597
  raw: i
598
598
  };
599
599
  }
600
- }, Aa = {
600
+ }, Da = {
601
601
  id: "loan.prepay",
602
602
  group: "loans",
603
603
  title: "Prepayment impact",
@@ -633,16 +633,16 @@ const $a = {
633
633
  const A = U(k.times(l));
634
634
  let I = h.minus(A);
635
635
  I.gt(k) && (I = k), k = U(k.minus(I)), S = S.plus(A);
636
- let E = g(0);
636
+ let R = g(0);
637
637
  if (k.gt(0) && N >= m && (d || N === m)) {
638
- E = u.gt(k) ? k : u;
639
- const j = U(E.times(c).div(100));
640
- if (F = F.plus(j), k = U(k.minus(E)), i) {
638
+ R = u.gt(k) ? k : u;
639
+ const j = U(R.times(c).div(100));
640
+ if (F = F.plus(j), k = U(k.minus(R)), i) {
641
641
  const Y = f - N;
642
642
  h = Y > 0 && k.gt(0) ? U(we(k, l, Y)) : h;
643
643
  }
644
644
  }
645
- w.push({ month: N, cells: [U(I), A, U(E), k] });
645
+ w.push({ month: N, cells: [U(I), A, U(R), k] });
646
646
  }
647
647
  const x = w.length, T = f - x, $ = U(y.minus(S)), L = U($.minus(F)), B = [];
648
648
  t.region === "IN" && B.push("RBI bars foreclosure/prepayment charges on floating-rate loans to individuals — penalty defaults to 0. Set it only for a fixed-rate loan."), B.push(i ? "EMI recomputed on the reduced balance; the original end date is kept." : "EMI kept the same; the loan simply finishes earlier.");
@@ -666,7 +666,7 @@ const $a = {
666
666
  schedule: {
667
667
  title: "New amortisation",
668
668
  columns: ["Month", "Principal", "Interest", "Prepay", "Balance"],
669
- groups: Rn(w, t),
669
+ groups: En(w, t),
670
670
  toneCols: { 1: "principal", 2: "interest" }
671
671
  },
672
672
  notes: B,
@@ -681,7 +681,7 @@ const $a = {
681
681
  }
682
682
  };
683
683
  }
684
- }, Da = {
684
+ }, La = {
685
685
  id: "loan.transfer",
686
686
  group: "loans",
687
687
  title: "Balance transfer",
@@ -725,7 +725,7 @@ const $a = {
725
725
  }
726
726
  };
727
727
  }
728
- }, La = {
728
+ }, Ua = {
729
729
  id: "loan.eligibility",
730
730
  group: "loans",
731
731
  title: "Loan eligibility",
@@ -777,7 +777,7 @@ const $a = {
777
777
  }
778
778
  };
779
779
  }
780
- }, Ua = {
780
+ }, Oa = {
781
781
  id: "loan.stepEmi",
782
782
  group: "loans",
783
783
  title: "Step-up / step-down EMI",
@@ -814,7 +814,7 @@ const $a = {
814
814
  schedule: {
815
815
  title: "Amortisation",
816
816
  columns: ["Month", "Principal", "Interest", n.paymentLabel, "Balance"],
817
- groups: Rn(l, t),
817
+ groups: En(l, t),
818
818
  toneCols: { 1: "principal", 2: "interest" }
819
819
  },
820
820
  notes: [`EMI changes by ${t.fmt.pct(g(C(e.annualStepPct)))} every 12 months. A step-up starts lower and pays a little more interest than a flat EMI; a step-down does the reverse.`],
@@ -828,7 +828,7 @@ const $a = {
828
828
  }
829
829
  };
830
830
  }
831
- }, Oa = {
831
+ }, Ba = {
832
832
  id: "loan.moratorium",
833
833
  group: "loans",
834
834
  title: "Moratorium / EMI holiday",
@@ -883,7 +883,7 @@ const $a = {
883
883
  }
884
884
  };
885
885
  }
886
- }, Ba = {
886
+ }, _a = {
887
887
  id: "loan.overdraft",
888
888
  group: "loans",
889
889
  title: "Overdraft / flexi loan",
@@ -913,7 +913,7 @@ const $a = {
913
913
  }
914
914
  };
915
915
  }
916
- }, _a = {
916
+ }, Ha = {
917
917
  id: "loan.refinance",
918
918
  group: "loans",
919
919
  title: "Refinance",
@@ -960,16 +960,16 @@ const $a = {
960
960
  }
961
961
  };
962
962
  }
963
- }, Ha = [
964
- $a,
963
+ }, qa = [
965
964
  Aa,
966
965
  Da,
967
966
  La,
968
967
  Ua,
969
968
  Oa,
970
969
  Ba,
971
- _a
972
- ], ot = Ze.defaults.sipReturnPercent, qa = Ze.defaults.inflationPercent, it = (e, t) => ({
970
+ _a,
971
+ Ha
972
+ ], ot = Ze.defaults.sipReturnPercent, Ga = Ze.defaults.inflationPercent, it = (e, t) => ({
973
973
  labels: e,
974
974
  series: [{ name: "Value", tone: "accent", points: t, area: !0 }]
975
975
  }), Dt = (e) => ({
@@ -979,7 +979,7 @@ const $a = {
979
979
  }), Lt = (e, t) => [
980
980
  { label: "Invested", value: Number(e), tone: "principal" },
981
981
  { label: "Gains", value: Number(t), tone: "interest" }
982
- ], Ga = {
982
+ ], ja = {
983
983
  id: "invest.sip",
984
984
  group: "invest",
985
985
  title: "SIP Calculator",
@@ -1016,7 +1016,7 @@ const $a = {
1016
1016
  }
1017
1017
  };
1018
1018
  }
1019
- }, ja = {
1019
+ }, Va = {
1020
1020
  id: "invest.stepupSip",
1021
1021
  group: "invest",
1022
1022
  title: "Step-up SIP Calculator",
@@ -1050,7 +1050,7 @@ const $a = {
1050
1050
  raw: { maturity: i.toFixed(2), invested: c.toFixed(2), gains: f.toFixed(2), finalMonthly: l.toFixed(2) }
1051
1051
  };
1052
1052
  }
1053
- }, Va = { annual: 1, semiannual: 2, quarterly: 4, monthly: 12 }, Ya = {
1053
+ }, Ya = { annual: 1, semiannual: 2, quarterly: 4, monthly: 12 }, Ka = {
1054
1054
  id: "invest.lumpsum",
1055
1055
  group: "invest",
1056
1056
  title: "Lump Sum Calculator",
@@ -1074,7 +1074,7 @@ const $a = {
1074
1074
  }
1075
1075
  ],
1076
1076
  compute(e, t) {
1077
- const { D: n, fmt: a } = t, r = D(e.principal, "100000"), s = n(C(e.ratePct, Number(t.settings.defaults.sipReturnPercent))), u = Math.max(1, Math.round(C(e.years, 10))), m = Va[_(e.compounding, "annual")] ?? 1, d = s.div(100).div(m), i = r.times(d.plus(1).pow(m * u)), c = i.minus(r), l = r.isZero() ? n(0) : rt(r, i, u), p = [], h = [];
1077
+ const { D: n, fmt: a } = t, r = D(e.principal, "100000"), s = n(C(e.ratePct, Number(t.settings.defaults.sipReturnPercent))), u = Math.max(1, Math.round(C(e.years, 10))), m = Ya[_(e.compounding, "annual")] ?? 1, d = s.div(100).div(m), i = r.times(d.plus(1).pow(m * u)), c = i.minus(r), l = r.isZero() ? n(0) : rt(r, i, u), p = [], h = [];
1078
1078
  for (let f = 1; f <= u; f++) {
1079
1079
  const y = r.times(d.plus(1).pow(m * f));
1080
1080
  p.push({ label: String(f), cells: [a.money(r), a.money(y.minus(r)), a.money(y)] }), h.push(Number(y.toFixed(2)));
@@ -1094,7 +1094,7 @@ const $a = {
1094
1094
  raw: { maturity: i.toFixed(2), invested: r.toFixed(2), gains: c.toFixed(2), cagr: l.times(100).toFixed(4) }
1095
1095
  };
1096
1096
  }
1097
- }, Ka = 1200, Wa = {
1097
+ }, Wa = 1200, za = {
1098
1098
  id: "invest.swp",
1099
1099
  group: "invest",
1100
1100
  title: "SWP Calculator",
@@ -1107,7 +1107,7 @@ const $a = {
1107
1107
  { key: "tenureMonths", label: "Withdrawal period", kind: "tenure", default: 120, optional: !0 }
1108
1108
  ],
1109
1109
  compute(e, t) {
1110
- const { D: n, fmt: a } = t, r = D(e.corpus, "5000000"), s = D(e.withdrawalPerMonth, "30000"), u = C(e.expectedReturnPct, 8), m = J(u, 12), d = C(e.tenureMonths, 0), i = d > 0 ? Math.round(d) : Ka;
1110
+ const { D: n, fmt: a } = t, r = D(e.corpus, "5000000"), s = D(e.withdrawalPerMonth, "30000"), u = C(e.expectedReturnPct, 8), m = J(u, 12), d = C(e.tenureMonths, 0), i = d > 0 ? Math.round(d) : Wa;
1111
1111
  let c = r, l = n(0), p = 0;
1112
1112
  const h = [], f = [];
1113
1113
  let y = r, w = n(0);
@@ -1146,7 +1146,7 @@ const $a = {
1146
1146
  }
1147
1147
  };
1148
1148
  }
1149
- }, za = {
1149
+ }, Ja = {
1150
1150
  id: "invest.goal",
1151
1151
  group: "invest",
1152
1152
  title: "Goal SIP Planner",
@@ -1156,7 +1156,7 @@ const $a = {
1156
1156
  { key: "targetCorpus", label: "Today's cost of goal", kind: "money", prefix: "currency", default: "10000000" },
1157
1157
  { key: "years", label: "Years to goal", kind: "years", suffix: "years", default: 15 },
1158
1158
  { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: ot },
1159
- { key: "inflationPct", label: "Inflation", kind: "percent", suffix: "% p.a.", default: qa },
1159
+ { key: "inflationPct", label: "Inflation", kind: "percent", suffix: "% p.a.", default: Ga },
1160
1160
  { key: "existingSavings", label: "Existing savings", kind: "money", prefix: "currency", default: "0", optional: !0 }
1161
1161
  ],
1162
1162
  compute(e, t) {
@@ -1184,14 +1184,14 @@ const $a = {
1184
1184
  }
1185
1185
  };
1186
1186
  }
1187
- }, Ja = [Ga, ja, Ya, Wa, za], $n = "10% TDS applies on interest above ₹40,000/yr (₹50,000 for senior citizens). Submit Form 15G/15H to waive if income is below the taxable limit.", Oe = (e, t, n) => ({
1187
+ }, Za = [ja, Va, Ka, za, Ja], $n = "10% TDS applies on interest above ₹40,000/yr (₹50,000 for senior citizens). Submit Form 15G/15H to waive if income is below the taxable limit.", Oe = (e, t, n) => ({
1188
1188
  labels: e,
1189
1189
  series: [{ name: n, tone: "accent", points: t, area: !0 }]
1190
1190
  }), Be = (e, t, n) => ({
1191
1191
  columns: e,
1192
1192
  rows: t,
1193
1193
  toneCols: { [n]: "interest" }
1194
- }), Za = {
1194
+ }), Xa = {
1195
1195
  id: "invest.fd",
1196
1196
  group: "invest",
1197
1197
  title: "Fixed Deposit (FD)",
@@ -1263,7 +1263,7 @@ const $a = {
1263
1263
  }
1264
1264
  };
1265
1265
  }
1266
- }, Xa = {
1266
+ }, Qa = {
1267
1267
  id: "invest.rd",
1268
1268
  group: "invest",
1269
1269
  title: "Recurring Deposit (RD)",
@@ -1309,7 +1309,7 @@ const $a = {
1309
1309
  raw: { maturity: i.toFixed(2), invested: c.toFixed(2), interest: l.toFixed(2) }
1310
1310
  };
1311
1311
  }
1312
- }, Qa = {
1312
+ }, er = {
1313
1313
  id: "invest.ppf",
1314
1314
  group: "invest",
1315
1315
  title: "Public Provident Fund (PPF)",
@@ -1366,7 +1366,7 @@ const $a = {
1366
1366
  raw: { maturity: i.toFixed(2), invested: p.toFixed(2), interest: h.toFixed(2) }
1367
1367
  };
1368
1368
  }
1369
- }, er = {
1369
+ }, tr = {
1370
1370
  id: "invest.nps",
1371
1371
  group: "invest",
1372
1372
  title: "National Pension System (NPS)",
@@ -1410,7 +1410,7 @@ const $a = {
1410
1410
  }
1411
1411
  };
1412
1412
  }
1413
- }, tr = {
1413
+ }, nr = {
1414
1414
  id: "invest.epf",
1415
1415
  group: "invest",
1416
1416
  title: "Employees’ Provident Fund (EPF)",
@@ -1459,7 +1459,7 @@ const $a = {
1459
1459
  raw: { corpus: h.toFixed(2), contributions: f.toFixed(2), interest: k.toFixed(2) }
1460
1460
  };
1461
1461
  }
1462
- }, nr = {
1462
+ }, ar = {
1463
1463
  id: "invest.ssy",
1464
1464
  group: "invest",
1465
1465
  title: "Sukanya Samriddhi Yojana (SSY)",
@@ -1502,7 +1502,7 @@ const $a = {
1502
1502
  raw: { maturity: l.toFixed(2), invested: f.toFixed(2), interest: y.toFixed(2) }
1503
1503
  };
1504
1504
  }
1505
- }, ar = [Za, Xa, Qa, er, tr, nr], rr = {
1505
+ }, rr = [Xa, Qa, er, tr, nr, ar], or = {
1506
1506
  id: "invest.401k",
1507
1507
  group: "invest",
1508
1508
  title: "401(k) with Employer Match",
@@ -1566,7 +1566,7 @@ const $a = {
1566
1566
  }
1567
1567
  };
1568
1568
  }
1569
- }, or = {
1569
+ }, ir = {
1570
1570
  id: "invest.iraCompare",
1571
1571
  group: "invest",
1572
1572
  title: "Roth vs Traditional IRA",
@@ -1620,7 +1620,7 @@ const $a = {
1620
1620
  }
1621
1621
  };
1622
1622
  }
1623
- }, ir = {
1623
+ }, sr = {
1624
1624
  id: "invest.529",
1625
1625
  group: "invest",
1626
1626
  title: "529 College Savings",
@@ -1675,7 +1675,7 @@ const $a = {
1675
1675
  raw: f
1676
1676
  };
1677
1677
  }
1678
- }, sr = [rr, or, ir], lr = (e) => e === "annual" ? 1 : e === "semiannual" ? 2 : e === "quarterly" ? 4 : 12, st = (e) => _(e).split(/[, ]+/).map((t) => t.trim()).filter(Boolean).map(Number).filter((t) => Number.isFinite(t)), cr = {
1678
+ }, lr = [or, ir, sr], cr = (e) => e === "annual" ? 1 : e === "semiannual" ? 2 : e === "quarterly" ? 4 : 12, st = (e) => _(e).split(/[, ]+/).map((t) => t.trim()).filter(Boolean).map(Number).filter((t) => Number.isFinite(t)), ur = {
1679
1679
  id: "returns.tvm",
1680
1680
  group: "returns",
1681
1681
  title: "Time value of money (TVM)",
@@ -1706,7 +1706,7 @@ const $a = {
1706
1706
  ] }
1707
1707
  ],
1708
1708
  compute(e) {
1709
- const t = _(e.solveFor, "FV"), n = lr(_(e.compounding, "monthly")), a = g(C(e.ratePct)).div(100).div(n), r = C(e.n), s = _(e.timing) === "begin", u = g(C(e.pv)), m = g(C(e.pmt)), d = g(C(e.fv)), i = (f, y) => ce(f) ? g(y) : f.plus(1).pow(y).minus(1).div(f).times(s ? f.plus(1) : 1), c = (f, y) => f.plus(1).pow(y);
1709
+ const t = _(e.solveFor, "FV"), n = cr(_(e.compounding, "monthly")), a = g(C(e.ratePct)).div(100).div(n), r = C(e.n), s = _(e.timing) === "begin", u = g(C(e.pv)), m = g(C(e.pmt)), d = g(C(e.fv)), i = (f, y) => ce(f) ? g(y) : f.plus(1).pow(y).minus(1).div(f).times(s ? f.plus(1) : 1), c = (f, y) => f.plus(1).pow(y);
1710
1710
  let l = "Future value", p = g(0), h = "PV·(1+i)^n + PMT·[((1+i)^n − 1)/i]·timing + FV = 0";
1711
1711
  if (t === "FV")
1712
1712
  p = u.times(c(a, r)).plus(m.times(i(a, r))).neg(), l = "Future value";
@@ -1743,7 +1743,7 @@ const $a = {
1743
1743
  }
1744
1744
  return { primary: v(l, p.toDecimalPlaces(2).toString(), "accent"), formula: h, raw: { value: p.toNumber() } };
1745
1745
  }
1746
- }, ur = {
1746
+ }, dr = {
1747
1747
  id: "returns.cagr",
1748
1748
  group: "returns",
1749
1749
  title: "CAGR",
@@ -1766,7 +1766,7 @@ const $a = {
1766
1766
  raw: { cagr: s.toNumber(), absolute: u.toNumber() }
1767
1767
  };
1768
1768
  }
1769
- }, dr = {
1769
+ }, mr = {
1770
1770
  id: "returns.absolute",
1771
1771
  group: "returns",
1772
1772
  title: "Absolute return",
@@ -1786,7 +1786,7 @@ const $a = {
1786
1786
  raw: { absolute: r.toNumber() }
1787
1787
  };
1788
1788
  }
1789
- }, mr = {
1789
+ }, pr = {
1790
1790
  id: "returns.xirr",
1791
1791
  group: "returns",
1792
1792
  title: "XIRR",
@@ -1802,7 +1802,7 @@ const $a = {
1802
1802
  compute(e, t) {
1803
1803
  const a = (e.flows ?? []).filter((u) => u.date && u.amount !== "").map((u) => ({ date: u.date, amount: u.amount }));
1804
1804
  if (a.length < 2) return { primary: v("XIRR", "—"), warnings: ["Enter at least two dated cashflows."] };
1805
- const r = En(a);
1805
+ const r = Rn(a);
1806
1806
  if (!r) return { primary: v("XIRR", "—"), warnings: ["Need at least one negative and one positive cashflow."] };
1807
1807
  const s = r.times(100);
1808
1808
  return {
@@ -1811,7 +1811,7 @@ const $a = {
1811
1811
  raw: { xirr: s.toNumber() }
1812
1812
  };
1813
1813
  }
1814
- }, pr = {
1814
+ }, hr = {
1815
1815
  id: "returns.irr",
1816
1816
  group: "returns",
1817
1817
  title: "IRR",
@@ -1824,7 +1824,7 @@ const $a = {
1824
1824
  const a = Fn(n);
1825
1825
  return a ? { primary: v("IRR", `${t.fmt.num(a.times(100), 2)}%`, "accent"), formula: "IRR: rate where NPV = 0", raw: { irr: a.times(100).toNumber() } } : { primary: v("IRR", "—"), warnings: ["No sign change — IRR is undefined for these flows."] };
1826
1826
  }
1827
- }, hr = {
1827
+ }, fr = {
1828
1828
  id: "returns.npv",
1829
1829
  group: "returns",
1830
1830
  title: "NPV",
@@ -1843,7 +1843,7 @@ const $a = {
1843
1843
  raw: { npv: a.toNumber() }
1844
1844
  };
1845
1845
  }
1846
- }, fr = {
1846
+ }, yr = {
1847
1847
  id: "returns.mirr",
1848
1848
  group: "returns",
1849
1849
  title: "MIRR",
@@ -1865,7 +1865,7 @@ const $a = {
1865
1865
  const d = u.div(m.neg()).pow(g(1).div(a)).minus(1).times(100);
1866
1866
  return { primary: v("MIRR", `${t.fmt.num(d, 2)}%`, "accent"), formula: "MIRR = (FV(inflows@reinvest) / −PV(outflows@finance))^(1/n) − 1", raw: { mirr: d.toNumber() } };
1867
1867
  }
1868
- }, yr = {
1868
+ }, br = {
1869
1869
  id: "returns.payback",
1870
1870
  group: "returns",
1871
1871
  title: "Payback period",
@@ -1894,7 +1894,7 @@ const $a = {
1894
1894
  raw: { payback: d }
1895
1895
  };
1896
1896
  }
1897
- }, br = {
1897
+ }, gr = {
1898
1898
  id: "returns.realReturn",
1899
1899
  group: "returns",
1900
1900
  title: "Real (inflation-adjusted) return",
@@ -1913,7 +1913,7 @@ const $a = {
1913
1913
  raw: { real: r.toNumber() }
1914
1914
  };
1915
1915
  }
1916
- }, gr = {
1916
+ }, vr = {
1917
1917
  id: "returns.rule72",
1918
1918
  group: "returns",
1919
1919
  title: "Rule of 72",
@@ -1934,8 +1934,7 @@ const $a = {
1934
1934
  raw: { approx: a.toNumber(), exact: r.toNumber() }
1935
1935
  };
1936
1936
  }
1937
- }, vr = [
1938
- cr,
1937
+ }, kr = [
1939
1938
  ur,
1940
1939
  dr,
1941
1940
  mr,
@@ -1944,7 +1943,8 @@ const $a = {
1944
1943
  fr,
1945
1944
  yr,
1946
1945
  br,
1947
- gr
1946
+ gr,
1947
+ vr
1948
1948
  ], Ne = "Estimate for planning only — not tax advice. Verify against current law and your own situation.";
1949
1949
  function Ut(e, t, n) {
1950
1950
  let a = g(0), r = 0;
@@ -1962,7 +1962,7 @@ function Ut(e, t, n) {
1962
1962
  }
1963
1963
  return { tax: a, rows: s };
1964
1964
  }
1965
- const kr = (e, t) => Ut(e, t, wr).tax, wr = { money: (e) => String(e) }, jt = (e, t) => e.gt(t) ? g(t) : e, lt = (e, t) => v(e, t, "positive"), Nr = {
1965
+ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e, t) => e.gt(t) ? g(t) : e, lt = (e, t) => v(e, t, "positive"), xr = {
1966
1966
  id: "tax.gst",
1967
1967
  group: "tax",
1968
1968
  title: "GST Calculator",
@@ -2043,7 +2043,7 @@ const kr = (e, t) => Ut(e, t, wr).tax, wr = { money: (e) => String(e) }, jt = (e
2043
2043
  }
2044
2044
  };
2045
2045
  }
2046
- }, xr = {
2046
+ }, Sr = {
2047
2047
  id: "tax.tds",
2048
2048
  group: "tax",
2049
2049
  title: "TDS on Interest",
@@ -2090,7 +2090,7 @@ const kr = (e, t) => Ut(e, t, wr).tax, wr = { money: (e) => String(e) }, jt = (e
2090
2090
  "<60": [{ to: 25e4, rate: 0 }, { to: 5e5, rate: 5 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }],
2091
2091
  "60-80": [{ to: 3e5, rate: 0 }, { to: 5e5, rate: 5 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }],
2092
2092
  "80+": [{ to: 5e5, rate: 0 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }]
2093
- }, Sr = [
2093
+ }, Cr = [
2094
2094
  { to: 3e5, rate: 0 },
2095
2095
  { to: 7e5, rate: 5 },
2096
2096
  { to: 1e6, rate: 10 },
@@ -2098,7 +2098,7 @@ const kr = (e, t) => Ut(e, t, wr).tax, wr = { money: (e) => String(e) }, jt = (e
2098
2098
  { to: 15e5, rate: 20 },
2099
2099
  { to: 1 / 0, rate: 30 }
2100
2100
  ];
2101
- function Cr(e, t, n) {
2101
+ function Pr(e, t, n) {
2102
2102
  const r = [
2103
2103
  { threshold: 5e7, rate: 25, prev: 20 },
2104
2104
  { threshold: 2e7, rate: 20, prev: 15 },
@@ -2110,10 +2110,10 @@ function Cr(e, t, n) {
2110
2110
  return i.gt(0) ? s.minus(i) : s;
2111
2111
  }
2112
2112
  function Yt(e, t, n, a, r) {
2113
- const { tax: s, rows: u } = Ut(e, t, r), m = e.gt(n) ? g(0) : s.lt(a) ? s : g(a), d = s.minus(m), i = Cr(e, d, (p) => kr(g(p), t)), c = d.plus(i).times("0.04"), l = d.plus(i).plus(c);
2113
+ const { tax: s, rows: u } = Ut(e, t, r), m = e.gt(n) ? g(0) : s.lt(a) ? s : g(a), d = s.minus(m), i = Pr(e, d, (p) => wr(g(p), t)), c = d.plus(i).times("0.04"), l = d.plus(i).plus(c);
2114
2114
  return { taxable: e, base: s, rebate: m, surcharge: i, cess: c, total: l, rows: u };
2115
2115
  }
2116
- const Pr = {
2116
+ const Tr = {
2117
2117
  id: "tax.incomeIN",
2118
2118
  group: "tax",
2119
2119
  title: "Income Tax (Old vs New)",
@@ -2139,7 +2139,7 @@ const Pr = {
2139
2139
  { key: "homeLoanInterest", label: "Home loan interest (24b)", kind: "money", prefix: "currency", default: "0", help: "max ₹2L", optional: !0 }
2140
2140
  ],
2141
2141
  compute(e, t) {
2142
- const { fmt: n } = t, a = D(e.grossIncome, "1200000"), r = _(e.age, "<60"), s = jt(D(e.ded80C, "0"), 15e4), u = D(e.ded80D, "0"), m = D(e.hraExemption, "0"), d = jt(D(e.homeLoanInterest, "0"), 2e5), i = g(5e4).plus(s).plus(u).plus(m).plus(d), c = a.minus(i), l = c.gt(0) ? c : g(0), p = Yt(l, Vt[r] ?? Vt["<60"], 5e5, 12500, n), h = a.minus(75e3), f = h.gt(0) ? h : g(0), y = Yt(f, Sr, 7e5, 25e3, n), w = !y.total.gt(p.total), k = w ? y : p, S = p.total.minus(y.total).abs();
2142
+ const { fmt: n } = t, a = D(e.grossIncome, "1200000"), r = _(e.age, "<60"), s = jt(D(e.ded80C, "0"), 15e4), u = D(e.ded80D, "0"), m = D(e.hraExemption, "0"), d = jt(D(e.homeLoanInterest, "0"), 2e5), i = g(5e4).plus(s).plus(u).plus(m).plus(d), c = a.minus(i), l = c.gt(0) ? c : g(0), p = Yt(l, Vt[r] ?? Vt["<60"], 5e5, 12500, n), h = a.minus(75e3), f = h.gt(0) ? h : g(0), y = Yt(f, Cr, 7e5, 25e3, n), w = !y.total.gt(p.total), k = w ? y : p, S = p.total.minus(y.total).abs();
2143
2143
  return {
2144
2144
  primary: v(
2145
2145
  `${w ? "New" : "Old"} regime is cheaper`,
@@ -2175,7 +2175,7 @@ const Pr = {
2175
2175
  }
2176
2176
  };
2177
2177
  }
2178
- }, Tr = {
2178
+ }, Fr = {
2179
2179
  id: "tax.capitalGains",
2180
2180
  group: "tax",
2181
2181
  title: "Capital Gains Tax",
@@ -2224,7 +2224,7 @@ const Pr = {
2224
2224
  raw: { gain: d.toFixed(2), tax: h ? null : l.toFixed(2), type: p, isLong: c ? 1 : 0 }
2225
2225
  };
2226
2226
  }
2227
- }, Fr = {
2227
+ }, Ir = {
2228
2228
  id: "tax.hra",
2229
2229
  group: "tax",
2230
2230
  title: "HRA Exemption",
@@ -2259,7 +2259,7 @@ const Pr = {
2259
2259
  raw: { exempt: h.toFixed(2), taxable: f.toFixed(2), limitRent: l.toFixed(2), limitPct: p.toFixed(2) }
2260
2260
  };
2261
2261
  }
2262
- }, Ir = {
2262
+ }, Rr = {
2263
2263
  id: "tax.advanceTax",
2264
2264
  group: "tax",
2265
2265
  title: "Advance Tax Instalments",
@@ -2358,7 +2358,7 @@ const Pr = {
2358
2358
  { to: 609350, rate: 35 },
2359
2359
  { to: 1 / 0, rate: 37 }
2360
2360
  ]
2361
- }, Rr = { single: 14600, marriedJoint: 29200, headOfHousehold: 21900 }, Mr = {
2361
+ }, Mr = { single: 14600, marriedJoint: 29200, headOfHousehold: 21900 }, $r = {
2362
2362
  id: "tax.incomeUS",
2363
2363
  group: "tax",
2364
2364
  title: "Federal Income Tax",
@@ -2398,7 +2398,7 @@ const Pr = {
2398
2398
  }
2399
2399
  ],
2400
2400
  compute(e, t) {
2401
- const { fmt: n } = t, a = D(e.grossIncome, "60000"), r = _(e.filingStatus, "single"), s = Kt[r] ?? Kt.single, m = _(e.deductionMode, "standard") === "itemized" ? D(e.itemizedAmount, "0") : g(Rr[r] ?? 14600), d = a.minus(m), i = d.gt(0) ? d : g(0), { tax: c, rows: l } = Ut(i, s, n), p = a.gt(0) ? c.div(a).times(100) : g(0), h = s.find((w) => i.lte(w.to)) ?? s[s.length - 1], f = i.gt(0) ? h.rate : 0, y = a.minus(c);
2401
+ const { fmt: n } = t, a = D(e.grossIncome, "60000"), r = _(e.filingStatus, "single"), s = Kt[r] ?? Kt.single, m = _(e.deductionMode, "standard") === "itemized" ? D(e.itemizedAmount, "0") : g(Mr[r] ?? 14600), d = a.minus(m), i = d.gt(0) ? d : g(0), { tax: c, rows: l } = Ut(i, s, n), p = a.gt(0) ? c.div(a).times(100) : g(0), h = s.find((w) => i.lte(w.to)) ?? s[s.length - 1], f = i.gt(0) ? h.rate : 0, y = a.minus(c);
2402
2402
  return {
2403
2403
  primary: v("Federal income tax", n.money(c), "negative"),
2404
2404
  secondary: [
@@ -2427,7 +2427,7 @@ const Pr = {
2427
2427
  }
2428
2428
  };
2429
2429
  }
2430
- }, $r = {
2430
+ }, Ar = {
2431
2431
  id: "tax.mortgageDeductionUS",
2432
2432
  group: "tax",
2433
2433
  title: "Mortgage Interest Deduction",
@@ -2455,16 +2455,16 @@ const Pr = {
2455
2455
  raw: { savings: d.toFixed(2), deductibleInterest: m.toFixed(2) }
2456
2456
  };
2457
2457
  }
2458
- }, Ar = [
2459
- Nr,
2458
+ }, Dr = [
2460
2459
  xr,
2461
- Pr,
2460
+ Sr,
2462
2461
  Tr,
2463
2462
  Fr,
2464
2463
  Ir,
2464
+ Rr,
2465
2465
  Er,
2466
- Mr,
2467
- $r
2466
+ $r,
2467
+ Ar
2468
2468
  ], $e = {
2469
2469
  length: { m: 1, km: 1e3, cm: 0.01, mm: 1e-3, mi: 1609.344, yd: 0.9144, ft: 0.3048, in: 0.0254 },
2470
2470
  area: { sqm: 1, sqft: 0.092903, sqyd: 0.836127, acre: 4046.8564224, hectare: 1e4, bigha: 1337.8, gunta: 101.17, cent: 40.4686 },
@@ -2504,10 +2504,10 @@ const Pr = {
2504
2504
  C: "Celsius (°C)",
2505
2505
  F: "Fahrenheit (°F)",
2506
2506
  K: "Kelvin (K)"
2507
- }, Dr = ["C", "F", "K"], Wt = (e) => e.map((t) => ({ value: t, label: Ct[t] ?? t })), Ae = (e, t, n, a) => [
2507
+ }, Lr = ["C", "F", "K"], Wt = (e) => e.map((t) => ({ value: t, label: Ct[t] ?? t })), Ae = (e, t, n, a) => [
2508
2508
  { key: `${e}From`, label: "From", kind: "select", default: n, options: Wt(t), showIf: (r) => r.category === e },
2509
2509
  { key: `${e}To`, label: "To", kind: "select", default: a, options: Wt(t), showIf: (r) => r.category === e }
2510
- ], Lr = {
2510
+ ], Ur = {
2511
2511
  id: "tools.units",
2512
2512
  group: "tools",
2513
2513
  title: "Unit Converter",
@@ -2532,7 +2532,7 @@ const Pr = {
2532
2532
  ...Ae("area", Object.keys($e.area), "acre", "sqm"),
2533
2533
  ...Ae("weight", Object.keys($e.weight), "kg", "lb"),
2534
2534
  ...Ae("volume", Object.keys($e.volume), "l", "gal_us"),
2535
- ...Ae("temperature", Dr, "C", "F")
2535
+ ...Ae("temperature", Lr, "C", "F")
2536
2536
  ],
2537
2537
  compute(e, t) {
2538
2538
  const { D: n, fmt: a } = t, r = n(C(e.value, 0)), s = _(e.category, "length"), u = _(e[`${s}From`], ""), m = _(e[`${s}To`], ""), d = [];
@@ -2558,7 +2558,7 @@ const Pr = {
2558
2558
  }
2559
2559
  const [t, n, a] = e.split("-").map(Number);
2560
2560
  return new Date(Date.UTC(t, (n || 1) - 1, a || 1));
2561
- }, ht = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Ve = (e) => e.toISOString().slice(0, 10), Ur = {
2561
+ }, ht = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Ve = (e) => e.toISOString().slice(0, 10), Or = {
2562
2562
  id: "tools.dateCalc",
2563
2563
  group: "tools",
2564
2564
  title: "Date Calculator",
@@ -2645,7 +2645,7 @@ const Pr = {
2645
2645
  raw: { years: s, months: u, days: m, totalDays: d, weeks: Number((d / 7).toFixed(2)), businessDays: i }
2646
2646
  };
2647
2647
  }
2648
- }, Pt = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"], Or = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"], et = (e) => e < 20 ? Pt[e] : Or[Math.floor(e / 10)] + (e % 10 ? " " + Pt[e % 10] : ""), Tt = (e) => {
2648
+ }, Pt = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"], Br = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"], et = (e) => e < 20 ? Pt[e] : Br[Math.floor(e / 10)] + (e % 10 ? " " + Pt[e % 10] : ""), Tt = (e) => {
2649
2649
  const t = Math.floor(e / 100), n = e % 100, a = [];
2650
2650
  return t && a.push(Pt[t] + " Hundred"), n && a.push(et(n)), a.join(" ");
2651
2651
  }, An = (e) => {
@@ -2657,11 +2657,11 @@ const Pr = {
2657
2657
  r && n.unshift(Tt(r) + t[a]), e = Math.floor(e / 1e3), a++;
2658
2658
  }
2659
2659
  return n.length ? n.join(" ") : "Zero";
2660
- }, Br = (e) => {
2660
+ }, _r = (e) => {
2661
2661
  if (e === 0) return "Zero";
2662
2662
  const t = Math.floor(e / 1e7), n = Math.floor(e / 1e5) % 100, a = Math.floor(e / 1e3) % 100, r = e % 1e3, s = [];
2663
2663
  return t && s.push((t <= 999 ? Tt(t) : An(t)) + " Crore"), n && s.push(et(n) + " Lakh"), a && s.push(et(a) + " Thousand"), r && s.push(Tt(r)), s.join(" ");
2664
- }, _r = {
2664
+ }, Hr = {
2665
2665
  id: "tools.numToWords",
2666
2666
  group: "tools",
2667
2667
  title: "Number to Words",
@@ -2683,7 +2683,7 @@ const Pr = {
2683
2683
  ],
2684
2684
  compute(e, t) {
2685
2685
  const { D: n, fmt: a } = t, r = _(e.scale, "indian"), s = ye(e.cheque, !1), u = n(_(e.amount, "0").replace(/[, ]/g, "") || "0"), m = u.isNegative(), d = u.abs(), i = d.floor(), c = Number(d.minus(i).times(100).toDecimalPlaces(0).toString()), l = Number(i.toString()), p = t.settings.currency.code, h = p === "INR" ? "Rupees" : p === "USD" ? "Dollars" : p, f = p === "INR" ? "Paise" : "Cents";
2686
- let y = r === "western" ? An(l) : Br(l);
2686
+ let y = r === "western" ? An(l) : _r(l);
2687
2687
  return c > 0 && (y += ` and ${et(c)} ${f}`), s && (y = `${h} ${y} Only`), m && (y = `Minus ${y}`), {
2688
2688
  primary: v("In words", y, "accent"),
2689
2689
  secondary: [v("In figures", a.num(u, c > 0 ? 2 : 0))],
@@ -2691,7 +2691,7 @@ const Pr = {
2691
2691
  raw: { words: y, integer: l, fraction: c }
2692
2692
  };
2693
2693
  }
2694
- }, Hr = [Lr, Ur, _r], qr = [
2694
+ }, qr = [Ur, Or, Hr], Gr = [
2695
2695
  {
2696
2696
  id: "tools.scientific",
2697
2697
  group: "tools",
@@ -2702,7 +2702,7 @@ const Pr = {
2702
2702
  compute: () => ({ primary: { label: "Scientific calculator", value: "" } }),
2703
2703
  custom: "scientific"
2704
2704
  }
2705
- ], Gr = {
2705
+ ], jr = {
2706
2706
  id: "loan.emi",
2707
2707
  group: "loans",
2708
2708
  title: "EMI / Loan",
@@ -2711,7 +2711,7 @@ const Pr = {
2711
2711
  inputs: [],
2712
2712
  compute: () => ({ primary: { label: "", value: "" } }),
2713
2713
  custom: "loan.emi"
2714
- }, jr = {
2714
+ }, Vr = {
2715
2715
  id: "tools.currency",
2716
2716
  group: "tools",
2717
2717
  title: "Currency converter",
@@ -2720,49 +2720,49 @@ const Pr = {
2720
2720
  inputs: [],
2721
2721
  compute: () => ({ primary: { label: "", value: "" } }),
2722
2722
  custom: "currency"
2723
- }, Vr = [
2724
- Gr,
2723
+ }, Yr = [
2725
2724
  jr,
2726
- ...Ha,
2727
- ...Ja,
2728
- ...ar,
2729
- ...sr,
2730
- ...vr,
2731
- ...Ar,
2732
- ...Hr,
2733
- ...qr
2725
+ Vr,
2726
+ ...qa,
2727
+ ...Za,
2728
+ ...rr,
2729
+ ...lr,
2730
+ ...kr,
2731
+ ...Dr,
2732
+ ...qr,
2733
+ ...Gr
2734
2734
  ], Ft = [];
2735
2735
  function hs(e) {
2736
2736
  Ft.some((t) => t.id === e.id) || Ft.push(e);
2737
2737
  }
2738
2738
  function Dn() {
2739
- return [...Vr, ...Ft];
2739
+ return [...Yr, ...Ft];
2740
2740
  }
2741
- function Yr(e) {
2741
+ function Kr(e) {
2742
2742
  return Dn().filter((t) => !t.regions || t.regions.includes(e));
2743
2743
  }
2744
2744
  function It(e) {
2745
2745
  return Dn().find((t) => t.id === e);
2746
2746
  }
2747
- const Kr = [
2747
+ const Wr = [
2748
2748
  { id: "loans", label: "Loans" },
2749
2749
  { id: "invest", label: "Invest" },
2750
2750
  { id: "returns", label: "Returns" },
2751
2751
  { id: "tax", label: "Tax" },
2752
2752
  { id: "tools", label: "Tools" }
2753
2753
  ];
2754
- function Wr(e, t) {
2754
+ function zr(e, t) {
2755
2755
  var n;
2756
2756
  return ((n = e.labelByRegion) == null ? void 0 : n[t]) ?? e.label;
2757
2757
  }
2758
- function zr({
2758
+ function Jr({
2759
2759
  f: e,
2760
2760
  value: t,
2761
2761
  onChange: n,
2762
2762
  values: a
2763
2763
  }) {
2764
2764
  var i, c;
2765
- const { settings: r } = ue(), s = r.region, u = Wr(e, s), m = r.currency.symbol, d = t == null ? "" : String(t);
2765
+ const { settings: r } = ue(), s = r.region, u = zr(e, s), m = r.currency.symbol, d = t == null ? "" : String(t);
2766
2766
  switch (e.kind) {
2767
2767
  case "money":
2768
2768
  case "number":
@@ -2800,7 +2800,7 @@ function zr({
2800
2800
  ] })
2801
2801
  ] });
2802
2802
  case "tenure":
2803
- return /* @__PURE__ */ o(Jr, { f: e, label: u, months: Number(t) || 0, onChange: n });
2803
+ return /* @__PURE__ */ o(Zr, { f: e, label: u, months: Number(t) || 0, onChange: n });
2804
2804
  case "select":
2805
2805
  return /* @__PURE__ */ b("label", { className: "field", children: [
2806
2806
  /* @__PURE__ */ o("span", { className: "lbl", children: u }),
@@ -2838,12 +2838,12 @@ function zr({
2838
2838
  /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("input", { value: d, placeholder: e.help, onChange: (l) => n(l.target.value), "aria-label": u }) })
2839
2839
  ] });
2840
2840
  case "cashflows":
2841
- return /* @__PURE__ */ o(Zr, { f: e, label: u, value: t ?? [], onChange: n });
2841
+ return /* @__PURE__ */ o(Xr, { f: e, label: u, value: t ?? [], onChange: n });
2842
2842
  default:
2843
2843
  return null;
2844
2844
  }
2845
2845
  }
2846
- function Jr({
2846
+ function Zr({
2847
2847
  f: e,
2848
2848
  label: t,
2849
2849
  months: n,
@@ -2883,7 +2883,7 @@ function Jr({
2883
2883
  e.suffix && /* @__PURE__ */ o("div", { className: "solved-note", children: e.suffix })
2884
2884
  ] });
2885
2885
  }
2886
- function Zr({
2886
+ function Xr({
2887
2887
  label: e,
2888
2888
  value: t,
2889
2889
  onChange: n
@@ -2914,7 +2914,7 @@ const Ln = {
2914
2914
  negative: "neg-txt",
2915
2915
  default: ""
2916
2916
  };
2917
- function Xr({ view: e }) {
2917
+ function Qr({ view: e }) {
2918
2918
  const { settings: t } = ue(), n = t.currency.symbol, a = e.primary.value, r = a.startsWith(n), s = r ? a.slice(n.length).trim() : a, u = /[A-Za-z]{3,}/.test(a);
2919
2919
  return /* @__PURE__ */ b("div", { className: "result", "aria-live": "polite", children: [
2920
2920
  /* @__PURE__ */ o("div", { className: "label", children: e.primary.label }),
@@ -2927,18 +2927,18 @@ function Xr({ view: e }) {
2927
2927
  ] })
2928
2928
  ] }),
2929
2929
  e.primary.sub && /* @__PURE__ */ o("div", { className: "per", children: e.primary.sub }),
2930
- e.split && e.split.length > 0 && /* @__PURE__ */ o(eo, { split: e.split }),
2931
- e.secondary && e.secondary.length > 0 && /* @__PURE__ */ o("div", { className: "secondary", children: e.secondary.map((m, d) => /* @__PURE__ */ o(Qr, { m }, d)) })
2930
+ e.split && e.split.length > 0 && /* @__PURE__ */ o(to, { split: e.split }),
2931
+ e.secondary && e.secondary.length > 0 && /* @__PURE__ */ o("div", { className: "secondary", children: e.secondary.map((m, d) => /* @__PURE__ */ o(eo, { m }, d)) })
2932
2932
  ] });
2933
2933
  }
2934
- function Qr({ m: e }) {
2934
+ function eo({ m: e }) {
2935
2935
  return /* @__PURE__ */ b("div", { className: "kv", children: [
2936
2936
  /* @__PURE__ */ o("div", { className: "k", children: e.label }),
2937
2937
  /* @__PURE__ */ o("div", { className: `v num ${Ln[e.tone ?? "default"]}`, children: e.value }),
2938
2938
  e.sub && /* @__PURE__ */ o("div", { className: "k", children: e.sub })
2939
2939
  ] });
2940
2940
  }
2941
- function eo({ split: e }) {
2941
+ function to({ split: e }) {
2942
2942
  const t = e.reduce((a, r) => a + Math.max(0, r.value), 0) || 1, n = e.map((a) => Math.round(Math.max(0, a.value) / t * 100));
2943
2943
  return /* @__PURE__ */ b(re, { children: [
2944
2944
  /* @__PURE__ */ o("div", { className: "splitbar", role: "img", "aria-label": e.map((a, r) => `${a.label} ${n[r]}%`).join(", "), children: e.map((a, r) => /* @__PURE__ */ o("div", { className: a.tone, style: { width: `${n[r]}%` } }, r)) }),
@@ -2951,7 +2951,7 @@ function eo({ split: e }) {
2951
2951
  ] }, r)) })
2952
2952
  ] });
2953
2953
  }
2954
- function to({ schedule: e }) {
2954
+ function no({ schedule: e }) {
2955
2955
  var u;
2956
2956
  const [t, n] = M(/* @__PURE__ */ new Set([0])), a = (m) => {
2957
2957
  var d;
@@ -2993,7 +2993,7 @@ const zt = {
2993
2993
  interest: "var(--fc-interest)",
2994
2994
  accent: "var(--fc-accent)"
2995
2995
  };
2996
- function no({ chart: e }) {
2996
+ function ao({ chart: e }) {
2997
2997
  const m = Math.max(...e.series.map((h) => h.points.length), 1), d = Math.max(...e.series.flatMap((h) => h.points), 1), i = (h) => 8 + h / Math.max(m - 1, 1) * 704, c = (h) => 12 + (1 - h / d) * 226, l = (h) => h.map((f, y) => `${y === 0 ? "M" : "L"}${i(y).toFixed(1)},${c(f).toFixed(1)}`).join(" "), p = (h) => `M${i(0)},${c(0)} ${h.map((f, y) => `L${i(y).toFixed(1)},${c(f).toFixed(1)}`).join(" ")} L${i(h.length - 1)},${c(0)} Z`;
2998
2998
  return /* @__PURE__ */ b("div", { className: "chart", children: [
2999
2999
  /* @__PURE__ */ b("svg", { viewBox: "0 0 720 260", role: "img", "aria-label": "Projection chart", children: [
@@ -3009,7 +3009,7 @@ function no({ chart: e }) {
3009
3009
  ] }, f)) })
3010
3010
  ] });
3011
3011
  }
3012
- const Un = 1, ao = [
3012
+ const Un = 1, ro = [
3013
3013
  { id: "csv", label: "CSV (.csv)" },
3014
3014
  { id: "tsv", label: "TSV (.tsv)" },
3015
3015
  { id: "json", label: "JSON (.json)" },
@@ -3021,7 +3021,7 @@ const Un = 1, ao = [
3021
3021
  { id: "xlsx", label: "Excel (.xlsx)" },
3022
3022
  { id: "qr", label: "QR / share link" }
3023
3023
  ], Ot = () => typeof document < "u";
3024
- function Ee(e) {
3024
+ function Re(e) {
3025
3025
  const t = e.result, n = [[t.primary.label, t.primary.value]];
3026
3026
  t.primary.sub && n.push([`${t.primary.label} (note)`, t.primary.sub]);
3027
3027
  for (const a of t.secondary ?? []) n.push([a.label, a.value]);
@@ -3038,52 +3038,52 @@ function _e(e) {
3038
3038
  for (const n of e.rows) t.push([n.label, ...n.cells]);
3039
3039
  return { header: e.columns, rows: t };
3040
3040
  }
3041
- function ro(e) {
3041
+ function oo(e) {
3042
3042
  var t;
3043
3043
  return e ? e.groups ? e.groups.reduce((n, a) => n + a.rows.length, 0) : ((t = e.rows) == null ? void 0 : t.length) ?? 0 : 0;
3044
3044
  }
3045
- function Et(e) {
3045
+ function Rt(e) {
3046
3046
  return String(e ?? "").replace(/[/\\]/g, "-").replace(/[-<>:"|?*]/g, "").trim().replace(/^\.+/, "") || "export";
3047
3047
  }
3048
3048
  function ve(e, t) {
3049
3049
  var m;
3050
- const n = new Date(((m = e.meta) == null ? void 0 : m.computedAt) || Date.now()), a = n.getFullYear(), r = String(n.getMonth() + 1).padStart(2, "0"), s = String(n.getDate()).padStart(2, "0"), u = Et(e.calculatorId || e.title || "export");
3051
- return Et(`${u}-${a}${r}${s}.${t}`);
3050
+ const n = new Date(((m = e.meta) == null ? void 0 : m.computedAt) || Date.now()), a = n.getFullYear(), r = String(n.getMonth() + 1).padStart(2, "0"), s = String(n.getDate()).padStart(2, "0"), u = Rt(e.calculatorId || e.title || "export");
3051
+ return Rt(`${u}-${a}${r}${s}.${t}`);
3052
3052
  }
3053
3053
  function Se(e, t, n = "application/octet-stream") {
3054
3054
  if (!Ot() || typeof URL > "u" || !URL.createObjectURL)
3055
3055
  throw new Error("Download is only available in the browser.");
3056
3056
  const a = t instanceof Blob ? t : new Blob([t], { type: n }), r = URL.createObjectURL(a), s = document.createElement("a");
3057
- s.href = r, s.download = Et(e), s.style.display = "none", document.body.appendChild(s), s.click(), setTimeout(() => {
3057
+ s.href = r, s.download = Rt(e), s.style.display = "none", document.body.appendChild(s), s.click(), setTimeout(() => {
3058
3058
  URL.revokeObjectURL(r), s.remove();
3059
3059
  }, 0);
3060
3060
  }
3061
- function oo(e, t) {
3061
+ function io(e, t) {
3062
3062
  let n = e == null ? "" : String(e);
3063
3063
  return /^[=+\-@\t\r]/.test(n) && (n = `'${n}`), (n.includes(t) || n.includes('"') || n.includes(`
3064
3064
  `) || n.includes("\r")) && (n = `"${n.replace(/"/g, '""')}"`), n;
3065
3065
  }
3066
- function io(e) {
3066
+ function so(e) {
3067
3067
  var t;
3068
3068
  return ((t = e == null ? void 0 : e.numberFormat) == null ? void 0 : t.grouping) === "european" ? ";" : ",";
3069
3069
  }
3070
3070
  function On(e, t) {
3071
3071
  const n = [["ArthaGanaka export"], ["Calculator", e.title]];
3072
- for (const a of Ee(e)) n.push(a);
3072
+ for (const a of Re(e)) n.push(a);
3073
3073
  if (n.push([]), e.result.schedule) {
3074
3074
  const a = _e(e.result.schedule);
3075
3075
  n.push(a.header, ...a.rows);
3076
3076
  }
3077
- return n.map((a) => a.map((r) => oo(r, t)).join(t)).join(`\r
3077
+ return n.map((a) => a.map((r) => io(r, t)).join(t)).join(`\r
3078
3078
  `);
3079
3079
  }
3080
- function so(e) {
3081
- return On(e, io(e.settingsSnapshot));
3082
- }
3083
3080
  function lo(e) {
3081
+ return On(e, so(e.settingsSnapshot));
3082
+ }
3083
+ function co(e) {
3084
3084
  return On(e, " ");
3085
3085
  }
3086
- function co(e, t = Un) {
3086
+ function uo(e, t = Un) {
3087
3087
  return JSON.stringify(
3088
3088
  {
3089
3089
  schemaVersion: t,
@@ -3103,7 +3103,7 @@ function co(e, t = Un) {
3103
3103
  2
3104
3104
  );
3105
3105
  }
3106
- function uo(e) {
3106
+ function mo(e) {
3107
3107
  const t = new TextEncoder().encode(e);
3108
3108
  if (typeof btoa == "function") {
3109
3109
  let n = "";
@@ -3112,16 +3112,16 @@ function uo(e) {
3112
3112
  }
3113
3113
  return globalThis.Buffer.from(t).toString("base64");
3114
3114
  }
3115
- const mo = (e) => uo(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3115
+ const po = (e) => mo(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3116
3116
  function Bn(e, t) {
3117
- const n = mo(JSON.stringify({ id: e, values: t }));
3117
+ const n = po(JSON.stringify({ id: e, values: t }));
3118
3118
  return `#fincalc=${encodeURIComponent(e)}&s=${n}`;
3119
3119
  }
3120
3120
  const Ye = (e) => String(e ?? "").replace(/\|/g, "\\|").replace(/\n/g, " ");
3121
3121
  function Jt(e) {
3122
3122
  const t = [`# ${e.title}`, ""];
3123
3123
  t.push("| Metric | Value |", "| --- | --- |");
3124
- for (const [n, a] of Ee(e)) t.push(`| ${Ye(n)} | ${Ye(a)} |`);
3124
+ for (const [n, a] of Re(e)) t.push(`| ${Ye(n)} | ${Ye(a)} |`);
3125
3125
  if (e.result.schedule) {
3126
3126
  const n = _e(e.result.schedule);
3127
3127
  t.push("", `## ${e.result.schedule.title ?? "Schedule"}`, ""), t.push(`| ${n.header.map(Ye).join(" | ")} |`), t.push(`| ${n.header.map(() => "---").join(" | ")} |`);
@@ -3131,22 +3131,22 @@ function Jt(e) {
3131
3131
  `);
3132
3132
  }
3133
3133
  const Pe = (e) => String(e ?? "").replace(/[&<>"]/g, (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[t]);
3134
- function po(e) {
3135
- return `<table><tbody>${Ee(e).map(([n, a]) => `<tr><th>${Pe(n)}</th><td>${Pe(a)}</td></tr>`).join("")}</tbody></table>`;
3136
- }
3137
3134
  function ho(e) {
3135
+ return `<table><tbody>${Re(e).map(([n, a]) => `<tr><th>${Pe(n)}</th><td>${Pe(a)}</td></tr>`).join("")}</tbody></table>`;
3136
+ }
3137
+ function fo(e) {
3138
3138
  const t = _e(e), n = `<tr>${t.header.map((r) => `<th>${Pe(r)}</th>`).join("")}</tr>`, a = t.rows.map((r) => `<tr>${r.map((s) => `<td>${Pe(s)}</td>`).join("")}</tr>`).join("");
3139
3139
  return `<table><thead>${n}</thead><tbody>${a}</tbody></table>`;
3140
3140
  }
3141
3141
  function _n(e) {
3142
- const t = e.result.schedule ? `<h2>${Pe(e.result.schedule.title ?? "Schedule")}</h2>${ho(e.result.schedule)}` : "";
3143
- return `<h1>${Pe(e.title)}</h1>${po(e)}${t}<p class="fc-print-foot">Generated by ArthaGanaka · ${Pe(e.meta.computedAt)}</p>`;
3142
+ const t = e.result.schedule ? `<h2>${Pe(e.result.schedule.title ?? "Schedule")}</h2>${fo(e.result.schedule)}` : "";
3143
+ return `<h1>${Pe(e.title)}</h1>${ho(e)}${t}<p class="fc-print-foot">Generated by ArthaGanaka · ${Pe(e.meta.computedAt)}</p>`;
3144
3144
  }
3145
- const Zt = (e) => String(e ?? "").replace(/\\/g, "\\\\").replace(/[;,]/g, (t) => `\\${t}`).replace(/\n/g, "\\n"), Xt = (e) => `${e.getFullYear()}${String(e.getMonth() + 1).padStart(2, "0")}${String(e.getDate()).padStart(2, "0")}`, fo = (e) => new Date(e || Date.now()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z"), yo = (e, t) => {
3145
+ const Zt = (e) => String(e ?? "").replace(/\\/g, "\\\\").replace(/[;,]/g, (t) => `\\${t}`).replace(/\n/g, "\\n"), Xt = (e) => `${e.getFullYear()}${String(e.getMonth() + 1).padStart(2, "0")}${String(e.getDate()).padStart(2, "0")}`, yo = (e) => new Date(e || Date.now()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z"), bo = (e, t) => {
3146
3146
  const n = new Date(e);
3147
3147
  return n.setMonth(n.getMonth() + t), n;
3148
3148
  };
3149
- function bo(e) {
3149
+ function go(e) {
3150
3150
  for (const t of Object.values(e))
3151
3151
  if (typeof t == "string" && /^\d{4}-\d{2}-\d{2}/.test(t)) {
3152
3152
  const n = new Date(t);
@@ -3154,12 +3154,12 @@ function bo(e) {
3154
3154
  }
3155
3155
  return /* @__PURE__ */ new Date();
3156
3156
  }
3157
- function go(e) {
3158
- const t = ro(e.result.schedule);
3157
+ function vo(e) {
3158
+ const t = oo(e.result.schedule);
3159
3159
  if (!t) throw new Error("This calculator has no instalment schedule to put on a calendar.");
3160
- const n = bo(e.values), a = t <= 60, r = a ? t : Math.ceil(t / 12), s = fo(e.meta.computedAt), u = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//ArthaGanaka//Export//EN", "CALSCALE:GREGORIAN"];
3160
+ const n = go(e.values), a = t <= 60, r = a ? t : Math.ceil(t / 12), s = yo(e.meta.computedAt), u = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//ArthaGanaka//Export//EN", "CALSCALE:GREGORIAN"];
3161
3161
  for (let m = 0; m < r; m++) {
3162
- const d = yo(n, a ? m + 1 : (m + 1) * 12), i = a ? `instalment ${m + 1}` : `year ${m + 1}`;
3162
+ const d = bo(n, a ? m + 1 : (m + 1) * 12), i = a ? `instalment ${m + 1}` : `year ${m + 1}`;
3163
3163
  u.push(
3164
3164
  "BEGIN:VEVENT",
3165
3165
  `UID:${Zt(e.calculatorId)}-${m + 1}-${Xt(d)}@arthaganaka`,
@@ -3178,7 +3178,7 @@ async function Hn(e) {
3178
3178
  if ((n = t == null ? void 0 : t.clipboard) != null && n.writeText) return t.clipboard.writeText(e);
3179
3179
  throw new Error("Clipboard is not available in this browser.");
3180
3180
  }
3181
- async function vo(e, t) {
3181
+ async function ko(e, t) {
3182
3182
  var a;
3183
3183
  const n = typeof navigator < "u" ? navigator : void 0;
3184
3184
  if ((a = n == null ? void 0 : n.clipboard) != null && a.write && typeof ClipboardItem < "u" && typeof Blob < "u")
@@ -3194,7 +3194,7 @@ async function vo(e, t) {
3194
3194
  }
3195
3195
  await Hn(t);
3196
3196
  }
3197
- function ko(e) {
3197
+ function wo(e) {
3198
3198
  if (!Ot() || typeof window > "u") throw new Error("Print is only available in the browser.");
3199
3199
  const t = document.createElement("div");
3200
3200
  t.className = "fc-print-root", t.innerHTML = _n(e), document.body.appendChild(t), document.body.classList.add("fc-printing");
@@ -3203,9 +3203,9 @@ function ko(e) {
3203
3203
  };
3204
3204
  window.addEventListener("afterprint", n), window.print(), setTimeout(n, 1500);
3205
3205
  }
3206
- function wo(e, t = 2) {
3206
+ function No(e, t = 2) {
3207
3207
  if (!Ot()) return Promise.reject(new Error("PNG export is only available in the browser."));
3208
- const n = Ee(e), a = 620, r = 120 + n.length * 30 + 30, s = document.createElement("canvas");
3208
+ const n = Re(e), a = 620, r = 120 + n.length * 30 + 30, s = document.createElement("canvas");
3209
3209
  s.width = a * t, s.height = r * t;
3210
3210
  const u = s.getContext("2d");
3211
3211
  if (!u) return Promise.reject(new Error("Canvas is not available."));
@@ -3220,7 +3220,7 @@ function wo(e, t = 2) {
3220
3220
  (i, c) => s.toBlob((l) => l ? i(l) : c(new Error("Could not render PNG.")), "image/png")
3221
3221
  );
3222
3222
  }
3223
- async function No(e) {
3223
+ async function xo(e) {
3224
3224
  let t;
3225
3225
  try {
3226
3226
  t = await import(
@@ -3235,7 +3235,7 @@ async function No(e) {
3235
3235
  const a = new n({ unit: "pt", format: "a4" });
3236
3236
  let r = 48;
3237
3237
  a.setFontSize(18), a.text(e.title, 48, r), r += 26, a.setFontSize(11);
3238
- for (const [u, m] of Ee(e))
3238
+ for (const [u, m] of Re(e))
3239
3239
  a.text(`${u}: ${m}`, 48, r), r += 18;
3240
3240
  if (e.result.schedule) {
3241
3241
  const u = _e(e.result.schedule);
@@ -3246,7 +3246,7 @@ async function No(e) {
3246
3246
  const s = ve(e, "pdf");
3247
3247
  return a.save(s), { ok: !0, filename: s };
3248
3248
  }
3249
- async function xo(e) {
3249
+ async function So(e) {
3250
3250
  var i, c;
3251
3251
  let t;
3252
3252
  try {
@@ -3259,7 +3259,7 @@ async function xo(e) {
3259
3259
  }
3260
3260
  const n = t.utils ?? ((i = t.default) == null ? void 0 : i.utils), a = t.write ?? ((c = t.default) == null ? void 0 : c.write);
3261
3261
  if (!n || !a) throw new Error('Excel export needs the optional "xlsx" package.');
3262
- const r = [["Calculator", e.title], ...Ee(e), []];
3262
+ const r = [["Calculator", e.title], ...Re(e), []];
3263
3263
  if (e.result.schedule) {
3264
3264
  const l = _e(e.result.schedule);
3265
3265
  r.push(l.header, ...l.rows);
@@ -3273,7 +3273,7 @@ function qn(e) {
3273
3273
  const t = Bn(e.calculatorId, e.values);
3274
3274
  return (typeof location < "u" ? location.origin + location.pathname : "") + t;
3275
3275
  }
3276
- async function So(e) {
3276
+ async function Co(e) {
3277
3277
  const t = Bn(e.calculatorId, e.values), n = qn(e);
3278
3278
  if (typeof location < "u")
3279
3279
  try {
@@ -3287,26 +3287,26 @@ async function So(e) {
3287
3287
  return { ok: !0, data: n, note: `${a}Link is in the address bar — copy it from there.` };
3288
3288
  }
3289
3289
  }
3290
- function Co(e) {
3290
+ function Po(e) {
3291
3291
  return {
3292
3292
  ok: !0,
3293
3293
  data: qn(e),
3294
3294
  note: "A QR image needs an optional QR library — share this link instead."
3295
3295
  };
3296
3296
  }
3297
- function Po(e = {}) {
3297
+ function To(e = {}) {
3298
3298
  const t = e.schemaVersion ?? Un, n = {
3299
3299
  csv: (a) => {
3300
3300
  const r = ve(a, "csv");
3301
- return Se(r, so(a), "text/csv;charset=utf-8"), { ok: !0, filename: r };
3301
+ return Se(r, lo(a), "text/csv;charset=utf-8"), { ok: !0, filename: r };
3302
3302
  },
3303
3303
  tsv: (a) => {
3304
3304
  const r = ve(a, "tsv");
3305
- return Se(r, lo(a), "text/tab-separated-values;charset=utf-8"), { ok: !0, filename: r };
3305
+ return Se(r, co(a), "text/tab-separated-values;charset=utf-8"), { ok: !0, filename: r };
3306
3306
  },
3307
3307
  json: (a) => {
3308
3308
  const r = ve(a, "json");
3309
- return Se(r, co(a, t), "application/json"), { ok: !0, filename: r };
3309
+ return Se(r, uo(a, t), "application/json"), { ok: !0, filename: r };
3310
3310
  },
3311
3311
  markdown: (a) => {
3312
3312
  const r = ve(a, "md");
@@ -3314,18 +3314,18 @@ function Po(e = {}) {
3314
3314
  },
3315
3315
  ics: (a) => {
3316
3316
  const r = ve(a, "ics");
3317
- return Se(r, go(a), "text/calendar;charset=utf-8"), { ok: !0, filename: r };
3317
+ return Se(r, vo(a), "text/calendar;charset=utf-8"), { ok: !0, filename: r };
3318
3318
  },
3319
- clipboard: async (a) => (await vo(_n(a), Jt(a)), { ok: !0, note: "Copied table to clipboard." }),
3320
- print: (a) => (ko(a), { ok: !0 }),
3321
- url: (a) => So(a),
3322
- qr: (a) => Co(a),
3319
+ clipboard: async (a) => (await ko(_n(a), Jt(a)), { ok: !0, note: "Copied table to clipboard." }),
3320
+ print: (a) => (wo(a), { ok: !0 }),
3321
+ url: (a) => Co(a),
3322
+ qr: (a) => Po(a),
3323
3323
  png: async (a, r) => {
3324
3324
  const s = ve(a, "png");
3325
- return Se(s, await wo(a, r.scale ?? 2)), { ok: !0, filename: s };
3325
+ return Se(s, await No(a, r.scale ?? 2)), { ok: !0, filename: s };
3326
3326
  },
3327
- pdf: (a) => No(a),
3328
- xlsx: (a) => xo(a)
3327
+ pdf: (a) => xo(a),
3328
+ xlsx: (a) => So(a)
3329
3329
  };
3330
3330
  return {
3331
3331
  formats: Object.keys(n),
@@ -3336,7 +3336,7 @@ function Po(e = {}) {
3336
3336
  };
3337
3337
  }
3338
3338
  function Gn({ payload: e }) {
3339
- const t = ne(() => Po(), []), [n, a] = M(!1), [r, s] = M(null), u = de(null), m = de(null), d = de([]);
3339
+ const t = ne(() => To(), []), [n, a] = M(!1), [r, s] = M(null), u = de(null), m = de(null), d = de([]);
3340
3340
  X(() => {
3341
3341
  if (!r) return;
3342
3342
  const p = setTimeout(() => s(null), 4500);
@@ -3404,7 +3404,7 @@ function Gn({ payload: e }) {
3404
3404
  }
3405
3405
  )
3406
3406
  ] }),
3407
- n && /* @__PURE__ */ o("div", { ref: m, className: "menu-list", role: "menu", "aria-label": "Export as", children: ao.map((p, h) => /* @__PURE__ */ o(
3407
+ n && /* @__PURE__ */ o("div", { ref: m, className: "menu-list", role: "menu", "aria-label": "Export as", children: ro.map((p, h) => /* @__PURE__ */ o(
3408
3408
  "button",
3409
3409
  {
3410
3410
  type: "button",
@@ -3421,7 +3421,7 @@ function Gn({ payload: e }) {
3421
3421
  r && /* @__PURE__ */ o("div", { className: `export-toast ${r.kind}`, role: "status", "aria-live": "polite", children: r.msg })
3422
3422
  ] });
3423
3423
  }
3424
- const Bt = "calcsuite:history", To = 100, Fo = [];
3424
+ const Bt = "calcsuite:history", Fo = 100, Io = [];
3425
3425
  let Ce = null;
3426
3426
  const ze = /* @__PURE__ */ new Set();
3427
3427
  function jn() {
@@ -3442,19 +3442,19 @@ function Vn(e) {
3442
3442
  ze.forEach((t) => t());
3443
3443
  }
3444
3444
  let Qt = !1;
3445
- function Io(e) {
3445
+ function Ro(e) {
3446
3446
  return ze.add(e), !Qt && typeof window < "u" && (Qt = !0, window.addEventListener("storage", (t) => {
3447
3447
  t.key === Bt && (Ce = null, ze.forEach((n) => n()));
3448
3448
  })), () => ze.delete(e);
3449
3449
  }
3450
3450
  function Yn(e) {
3451
- Vn([{ ...e, at: Date.now() }, ...jn()].slice(0, To));
3451
+ Vn([{ ...e, at: Date.now() }, ...jn()].slice(0, Fo));
3452
3452
  }
3453
3453
  function Eo() {
3454
3454
  Vn([]);
3455
3455
  }
3456
- function Ro() {
3457
- const e = fa(Io, jn, () => Fo), t = ke((a) => Yn(a), []), n = ke(() => Eo(), []);
3456
+ function Mo() {
3457
+ const e = ya(Ro, jn, () => Io), t = ke((a) => Yn(a), []), n = ke(() => Eo(), []);
3458
3458
  return { items: e, save: t, clear: n };
3459
3459
  }
3460
3460
  function Kn({ item: e }) {
@@ -3463,9 +3463,9 @@ function Kn({ item: e }) {
3463
3463
  Yn(e), n(!0), clearTimeout(a.current), a.current = setTimeout(() => n(!1), 1500);
3464
3464
  }, "aria-live": "polite", children: t ? "Saved ✓" : "Save" });
3465
3465
  }
3466
- const Mo = { payment: "Payment", principal: "Amount", rate: "Rate", tenure: "Term" };
3466
+ const $o = { payment: "Payment", principal: "Amount", rate: "Rate", tenure: "Term" };
3467
3467
  function Wn() {
3468
- const { settings: e, fmt: t } = ue(), n = e.region, a = me[n], [r, s] = M("payment"), [u, m] = M(a.defaultBasis), [d, i] = M(n === "IN" ? "2500000" : "300000"), [c, l] = M(a.defaultRatePct), [p, h] = M(String(Math.floor(a.defaultTermMonths / 12))), [f, y] = M(String(a.defaultTermMonths % 12)), [w, k] = M(n === "IN" ? "21934" : "1896"), [S, F] = M("schedule"), N = u === "flat" ? ["payment", "principal"] : ["payment", "principal", "rate", "tenure"], P = (parseInt(p || "0", 10) || 0) * 12 + (parseInt(f || "0", 10) || 0), x = (E) => E.replace(/[, ]/g, "").trim(), { result: T, error: $ } = ne(() => {
3468
+ const { settings: e, fmt: t } = ue(), n = e.region, a = me[n], [r, s] = M("payment"), [u, m] = M(a.defaultBasis), [d, i] = M(n === "IN" ? "2500000" : "300000"), [c, l] = M(a.defaultRatePct), [p, h] = M(String(Math.floor(a.defaultTermMonths / 12))), [f, y] = M(String(a.defaultTermMonths % 12)), [w, k] = M(n === "IN" ? "21934" : "1896"), [S, F] = M("schedule"), N = u === "flat" ? ["payment", "principal"] : ["payment", "principal", "rate", "tenure"], P = (parseInt(p || "0", 10) || 0) * 12 + (parseInt(f || "0", 10) || 0), x = (R) => R.replace(/[, ]/g, "").trim(), { result: T, error: $ } = ne(() => {
3469
3469
  try {
3470
3470
  return { result: Ie({
3471
3471
  region: n,
@@ -3475,10 +3475,10 @@ function Wn() {
3475
3475
  tenureMonths: r === "tenure" ? void 0 : P || void 0,
3476
3476
  payment: r === "payment" ? void 0 : x(w) || void 0
3477
3477
  }), error: null };
3478
- } catch (E) {
3479
- return { result: null, error: E instanceof se ? E.message : "Could not calculate." };
3478
+ } catch (R) {
3479
+ return { result: null, error: R instanceof se ? R.message : "Could not calculate." };
3480
3480
  }
3481
- }, [n, u, r, d, c, p, f, w, P]), L = (E) => r === E, B = {
3481
+ }, [n, u, r, d, c, p, f, w, P]), L = (R) => r === R, B = {
3482
3482
  payment: T ? t.money(T.payment) : "—",
3483
3483
  principal: T ? t.money(T.principal) : "—",
3484
3484
  rate: T ? `${t.num(T.annualRatePct, 3)} %` : "—",
@@ -3491,10 +3491,10 @@ function Wn() {
3491
3491
  tenureMonths: String(P),
3492
3492
  payment: x(w),
3493
3493
  solveFor: r
3494
- }, I = (E) => {
3494
+ }, I = (R) => {
3495
3495
  const j = {
3496
3496
  columns: ["Period", "Opening", "Payment", "Principal", "Interest", "Balance"],
3497
- groups: E.byYear.map((Y) => ({
3497
+ groups: R.byYear.map((Y) => ({
3498
3498
  label: `Year ${Y.year}`,
3499
3499
  summary: [
3500
3500
  t.money(Y.months[0].openingBalance),
@@ -3517,22 +3517,22 @@ function Wn() {
3517
3517
  toneCols: { 3: "principal", 4: "interest" }
3518
3518
  };
3519
3519
  return {
3520
- primary: { label: a.paymentLabel, value: t.money(E.payment) },
3520
+ primary: { label: a.paymentLabel, value: t.money(R.payment) },
3521
3521
  primaryPer: "/month",
3522
3522
  secondary: [
3523
- { label: "Principal", value: t.money(E.principal) },
3524
- { label: "Total interest", value: t.money(E.totalInterest), tone: "interest" },
3525
- { label: "Total payment", value: t.money(E.totalPayment) },
3526
- { label: a.tenureWord, value: dt(E.tenureMonths) }
3523
+ { label: "Principal", value: t.money(R.principal) },
3524
+ { label: "Total interest", value: t.money(R.totalInterest), tone: "interest" },
3525
+ { label: "Total payment", value: t.money(R.totalPayment) },
3526
+ { label: a.tenureWord, value: dt(R.tenureMonths) }
3527
3527
  ],
3528
3528
  schedule: j,
3529
- formula: E.formula,
3529
+ formula: R.formula,
3530
3530
  raw: {
3531
- payment: E.payment.toString(),
3532
- principal: E.principal.toString(),
3533
- totalInterest: E.totalInterest.toString(),
3534
- totalPayment: E.totalPayment.toString(),
3535
- tenureMonths: E.tenureMonths
3531
+ payment: R.payment.toString(),
3532
+ principal: R.principal.toString(),
3533
+ totalInterest: R.totalInterest.toString(),
3534
+ totalPayment: R.totalPayment.toString(),
3535
+ tenureMonths: R.tenureMonths
3536
3536
  }
3537
3537
  };
3538
3538
  };
@@ -3540,7 +3540,7 @@ function Wn() {
3540
3540
  /* @__PURE__ */ b("section", { className: "card", children: [
3541
3541
  /* @__PURE__ */ b("div", { className: "solve-row", children: [
3542
3542
  /* @__PURE__ */ o("span", { className: "lbl", children: "Solve for" }),
3543
- /* @__PURE__ */ o("div", { className: "seg", role: "group", "aria-label": "Solve for", children: N.map((E) => /* @__PURE__ */ o("button", { "aria-pressed": r === E, onClick: () => s(E), children: Mo[E] }, E)) })
3543
+ /* @__PURE__ */ o("div", { className: "seg", role: "group", "aria-label": "Solve for", children: N.map((R) => /* @__PURE__ */ o("button", { "aria-pressed": r === R, onClick: () => s(R), children: $o[R] }, R)) })
3544
3544
  ] }),
3545
3545
  /* @__PURE__ */ b("div", { className: "field", style: { marginBottom: "calc(var(--fc-space) * 2)" }, children: [
3546
3546
  /* @__PURE__ */ o("span", { className: "lbl", children: "Interest basis" }),
@@ -3559,8 +3559,8 @@ function Wn() {
3559
3559
  ] })
3560
3560
  ] }),
3561
3561
  /* @__PURE__ */ b("div", { className: "grid two", children: [
3562
- /* @__PURE__ */ o(ft, { label: "Loan amount", solved: L("principal"), solvedText: B.principal, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: d, onChange: (E) => i(E.target.value), "aria-label": "Loan amount" }) }),
3563
- /* @__PURE__ */ o(ft, { label: "Interest rate", solved: L("rate"), solvedText: B.rate, suffix: "% p.a.", children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: c, onChange: (E) => l(E.target.value), "aria-label": "Interest rate" }) }),
3562
+ /* @__PURE__ */ o(ft, { label: "Loan amount", solved: L("principal"), solvedText: B.principal, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: d, onChange: (R) => i(R.target.value), "aria-label": "Loan amount" }) }),
3563
+ /* @__PURE__ */ o(ft, { label: "Interest rate", solved: L("rate"), solvedText: B.rate, suffix: "% p.a.", children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: c, onChange: (R) => l(R.target.value), "aria-label": "Interest rate" }) }),
3564
3564
  /* @__PURE__ */ b("div", { className: "field", children: [
3565
3565
  /* @__PURE__ */ o("span", { className: "lbl", children: a.tenureWord }),
3566
3566
  L("tenure") ? /* @__PURE__ */ b(re, { children: [
@@ -3568,16 +3568,16 @@ function Wn() {
3568
3568
  /* @__PURE__ */ o("div", { className: "solved-note", children: "solved" })
3569
3569
  ] }) : /* @__PURE__ */ b("div", { className: "tenure-pair", children: [
3570
3570
  /* @__PURE__ */ b("div", { className: "input-wrap", children: [
3571
- /* @__PURE__ */ o("input", { className: "num", inputMode: "numeric", value: p, onChange: (E) => h(E.target.value), "aria-label": "Years" }),
3571
+ /* @__PURE__ */ o("input", { className: "num", inputMode: "numeric", value: p, onChange: (R) => h(R.target.value), "aria-label": "Years" }),
3572
3572
  /* @__PURE__ */ o("span", { className: "affix", children: "yr" })
3573
3573
  ] }),
3574
3574
  /* @__PURE__ */ b("div", { className: "input-wrap", children: [
3575
- /* @__PURE__ */ o("input", { className: "num", inputMode: "numeric", value: f, onChange: (E) => y(E.target.value), "aria-label": "Months" }),
3575
+ /* @__PURE__ */ o("input", { className: "num", inputMode: "numeric", value: f, onChange: (R) => y(R.target.value), "aria-label": "Months" }),
3576
3576
  /* @__PURE__ */ o("span", { className: "affix", children: "mo" })
3577
3577
  ] })
3578
3578
  ] })
3579
3579
  ] }),
3580
- /* @__PURE__ */ o(ft, { label: a.paymentLabel, solved: L("payment"), solvedText: B.payment, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: w, onChange: (E) => k(E.target.value), "aria-label": a.paymentLabel }) })
3580
+ /* @__PURE__ */ o(ft, { label: a.paymentLabel, solved: L("payment"), solvedText: B.payment, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: w, onChange: (R) => k(R.target.value), "aria-label": a.paymentLabel }) })
3581
3581
  ] }),
3582
3582
  $ && /* @__PURE__ */ o("div", { className: "error", role: "alert", style: { marginTop: 16 }, children: $ })
3583
3583
  ] }),
@@ -3594,7 +3594,7 @@ function Wn() {
3594
3594
  /* @__PURE__ */ o("span", { className: "per", children: " /month" })
3595
3595
  ] })
3596
3596
  ] }),
3597
- /* @__PURE__ */ o($o, { result: T }),
3597
+ /* @__PURE__ */ o(Ao, { result: T }),
3598
3598
  /* @__PURE__ */ b("div", { className: "secondary", children: [
3599
3599
  /* @__PURE__ */ b("div", { className: "kv", children: [
3600
3600
  /* @__PURE__ */ o("div", { className: "k", children: "Principal" }),
@@ -3653,8 +3653,8 @@ function Wn() {
3653
3653
  e.ui.showFormulas && /* @__PURE__ */ o("button", { role: "tab", "aria-selected": S === "formula", onClick: () => F("formula"), children: "Formula" })
3654
3654
  ] }),
3655
3655
  /* @__PURE__ */ b("div", { className: "tab-anim", children: [
3656
- S === "schedule" && /* @__PURE__ */ o(Ao, { result: T }),
3657
- S === "chart" && /* @__PURE__ */ o(Do, { result: T }),
3656
+ S === "schedule" && /* @__PURE__ */ o(Do, { result: T }),
3657
+ S === "chart" && /* @__PURE__ */ o(Lo, { result: T }),
3658
3658
  S === "formula" && e.ui.showFormulas && /* @__PURE__ */ b("div", { className: "formula", children: [
3659
3659
  /* @__PURE__ */ o("code", { children: T.formula }),
3660
3660
  /* @__PURE__ */ b("div", { className: "assumptions", children: [
@@ -3699,7 +3699,7 @@ function ft({
3699
3699
  ] })
3700
3700
  ] });
3701
3701
  }
3702
- function $o({ result: e }) {
3702
+ function Ao({ result: e }) {
3703
3703
  const { fmt: t } = ue(), n = Number(e.principal.toFixed(2)), a = Number(e.totalInterest.toFixed(2)), r = n + a || 1, s = Math.round(n / r * 100);
3704
3704
  return /* @__PURE__ */ b(re, { children: [
3705
3705
  /* @__PURE__ */ b("div", { className: "splitbar", role: "img", "aria-label": `Principal ${s}%, interest ${100 - s}%`, children: [
@@ -3724,7 +3724,7 @@ function $o({ result: e }) {
3724
3724
  ] })
3725
3725
  ] });
3726
3726
  }
3727
- function Ao({ result: e }) {
3727
+ function Do({ result: e }) {
3728
3728
  const { fmt: t } = ue(), [n, a] = M("yearly"), [r, s] = M(/* @__PURE__ */ new Set([1])), u = (d) => s((i) => {
3729
3729
  const c = new Set(i);
3730
3730
  return c.has(d) ? c.delete(d) : c.add(d), c;
@@ -3786,7 +3786,7 @@ function Ao({ result: e }) {
3786
3786
  ] }) })
3787
3787
  ] });
3788
3788
  }
3789
- function Do({ result: e }) {
3789
+ function Lo({ result: e }) {
3790
3790
  const { fmt: t } = ue(), n = e.chart.balance.map((k) => k.toNumber()), a = e.chart.cumulativeInterest.map((k) => k.toNumber()), r = n.length, s = 720, u = 260, m = 8, d = 8, i = 12, c = 22, l = e.principal.toNumber(), p = Math.max(l, a[a.length - 1] ?? 0) || 1, h = (k) => m + k / Math.max(r - 1, 1) * (s - m - d), f = (k) => i + (1 - k / p) * (u - i - c), y = (k) => k.map((S, F) => `${F === 0 ? "M" : "L"}${h(F).toFixed(1)},${f(S).toFixed(1)}`).join(" "), w = `M${h(0)},${f(l)} ${n.map((k, S) => `L${h(S).toFixed(1)},${f(k).toFixed(1)}`).join(" ")} L${h(r - 1)},${f(0)} L${h(0)},${f(0)} Z`;
3791
3791
  return /* @__PURE__ */ b("div", { className: "chart", children: [
3792
3792
  /* @__PURE__ */ b("svg", { viewBox: `0 0 ${s} ${u}`, role: "img", "aria-label": "Balance and cumulative interest over the term", children: [
@@ -3809,7 +3809,7 @@ function Do({ result: e }) {
3809
3809
  ] })
3810
3810
  ] });
3811
3811
  }
3812
- const Lo = /* @__PURE__ */ new Set([
3812
+ const Uo = /* @__PURE__ */ new Set([
3813
3813
  "sin",
3814
3814
  "cos",
3815
3815
  "tan",
@@ -3846,7 +3846,7 @@ const Lo = /* @__PURE__ */ new Set([
3846
3846
  "sq",
3847
3847
  "cube",
3848
3848
  "recip"
3849
- ]), Uo = {
3849
+ ]), Oo = {
3850
3850
  arcsin: "asin",
3851
3851
  arccos: "acos",
3852
3852
  arctan: "atan",
@@ -3854,14 +3854,14 @@ const Lo = /* @__PURE__ */ new Set([
3854
3854
  log10: "log",
3855
3855
  ncr: "ncr",
3856
3856
  npr: "npr"
3857
- }, Oo = (e) => e === " " || e === " " || e === `
3858
- ` || e === "\r", fe = (e) => e >= "0" && e <= "9", en = (e) => e >= "a" && e <= "z" || e >= "A" && e <= "Z", zn = (e) => fe(e) || e >= "a" && e <= "f" || e >= "A" && e <= "F", tn = /* @__PURE__ */ new Set(["num", "const", "var", "func", "lparen", "uop"]), Bo = /* @__PURE__ */ new Set(["num", "const", "var", "rparen", "postfix"]);
3859
- function _o(e) {
3857
+ }, Bo = (e) => e === " " || e === " " || e === `
3858
+ ` || e === "\r", fe = (e) => e >= "0" && e <= "9", en = (e) => e >= "a" && e <= "z" || e >= "A" && e <= "Z", zn = (e) => fe(e) || e >= "a" && e <= "f" || e >= "A" && e <= "F", tn = /* @__PURE__ */ new Set(["num", "const", "var", "func", "lparen", "uop"]), _o = /* @__PURE__ */ new Set(["num", "const", "var", "rparen", "postfix"]);
3859
+ function Ho(e) {
3860
3860
  return e === "HEX" ? zn : e === "OCT" ? (t) => t >= "0" && t <= "7" : e === "BIN" ? (t) => t === "0" || t === "1" : fe;
3861
3861
  }
3862
- function Ho(e) {
3863
- const t = e.toLowerCase(), n = Uo[t] ?? t;
3864
- if (Lo.has(n)) return { type: "func", value: n };
3862
+ function qo(e) {
3863
+ const t = e.toLowerCase(), n = Oo[t] ?? t;
3864
+ if (Uo.has(n)) return { type: "func", value: n };
3865
3865
  if (t === "mod") return { type: "op", value: "mod" };
3866
3866
  if (t === "and") return { type: "op", value: "and" };
3867
3867
  if (t === "or") return { type: "op", value: "or" };
@@ -3878,12 +3878,12 @@ function Ho(e) {
3878
3878
  }
3879
3879
  throw new Error(`Unknown name: ${e}`);
3880
3880
  }
3881
- function qo(e, t = {}) {
3881
+ function Go(e, t = {}) {
3882
3882
  const n = t.base ?? "DEC", a = e, r = [];
3883
3883
  let s = 0;
3884
3884
  for (; s < a.length; ) {
3885
3885
  const d = a[s];
3886
- if (Oo(d)) {
3886
+ if (Bo(d)) {
3887
3887
  s++;
3888
3888
  continue;
3889
3889
  }
@@ -3898,7 +3898,7 @@ function qo(e, t = {}) {
3898
3898
  continue;
3899
3899
  }
3900
3900
  if (n !== "DEC") {
3901
- const l = _o(n);
3901
+ const l = Ho(n);
3902
3902
  let p = s;
3903
3903
  for (; p < a.length && l(a[p]); ) p++;
3904
3904
  const h = a.slice(s, p), f = n === "HEX" ? "0x" : n === "OCT" ? "0o" : "0b";
@@ -3922,7 +3922,7 @@ function qo(e, t = {}) {
3922
3922
  if (en(d) || d === "_") {
3923
3923
  let c = s;
3924
3924
  for (; c < a.length && (en(a[c]) || fe(a[c]) || a[c] === "_"); ) c++;
3925
- r.push(Ho(a.slice(s, c))), s = c;
3925
+ r.push(qo(a.slice(s, c))), s = c;
3926
3926
  continue;
3927
3927
  }
3928
3928
  const i = a.slice(s, s + 2);
@@ -4002,11 +4002,11 @@ function qo(e, t = {}) {
4002
4002
  }), m = [];
4003
4003
  for (let d = 0; d < u.length; d++) {
4004
4004
  const i = u[d], c = m[m.length - 1];
4005
- c && Bo.has(c.type) && tn.has(i.type) && m.push({ type: "op", value: "*", implicit: !0 }), m.push(i);
4005
+ c && _o.has(c.type) && tn.has(i.type) && m.push({ type: "op", value: "*", implicit: !0 }), m.push(i);
4006
4006
  }
4007
4007
  return m;
4008
4008
  }
4009
- const Go = {
4009
+ const jo = {
4010
4010
  or: { prec: 1 },
4011
4011
  xor: { prec: 2 },
4012
4012
  and: { prec: 3 },
@@ -4020,7 +4020,7 @@ const Go = {
4020
4020
  "%": { prec: 6 },
4021
4021
  "^": { prec: 8, right: !0 }
4022
4022
  }, nn = { neg: 7, bnot: 7, sqrt: 10, cbrt: 10, qdrt: 10 }, De = Symbol("arg");
4023
- function jo(e) {
4023
+ function Vo(e) {
4024
4024
  const t = [], n = [];
4025
4025
  let a = !0;
4026
4026
  const r = () => {
@@ -4071,7 +4071,7 @@ function jo(e) {
4071
4071
  else if (d.value !== "+") throw new Error(`Unexpected operator: ${d.value}`);
4072
4072
  a = !0;
4073
4073
  } else {
4074
- const i = Go[d.value];
4074
+ const i = jo[d.value];
4075
4075
  if (!i) throw new Error(`Unknown operator: ${d.value}`);
4076
4076
  for (; n.length; ) {
4077
4077
  const c = n[n.length - 1];
@@ -4112,7 +4112,7 @@ function jo(e) {
4112
4112
  if (m === De) throw new Error("Malformed expression");
4113
4113
  return m;
4114
4114
  }
4115
- const Vo = new H("3.141592653589793238462643383279502884197"), Yo = new H("2.718281828459045235360287471352662497757"), Ko = new H("1.618033988749894848204586834365638117720");
4115
+ const Yo = new H("3.141592653589793238462643383279502884197"), Ko = new H("2.718281828459045235360287471352662497757"), Wo = new H("1.618033988749894848204586834365638117720");
4116
4116
  function yt(e, t) {
4117
4117
  return t === "deg" ? e * Math.PI / 180 : t === "grad" ? e * Math.PI / 200 : e;
4118
4118
  }
@@ -4126,13 +4126,13 @@ function an(e) {
4126
4126
  for (let n = 2; n <= e.toNumber(); n++) t = t.times(n);
4127
4127
  return t;
4128
4128
  }
4129
- function Wo(e, t) {
4129
+ function zo(e, t) {
4130
4130
  if (!e.isInteger() || !t.isInteger() || t.isNegative() || t.gt(e)) throw new Error("nPr domain");
4131
4131
  let n = g(1);
4132
4132
  for (let a = 0; a < t.toNumber(); a++) n = n.times(e.minus(a));
4133
4133
  return n;
4134
4134
  }
4135
- function zo(e, t) {
4135
+ function Jo(e, t) {
4136
4136
  if (!e.isInteger() || !t.isInteger() || t.isNegative() || t.gt(e)) throw new Error("nCr domain");
4137
4137
  const n = H.min(t, e.minus(t));
4138
4138
  let a = g(1);
@@ -4155,7 +4155,7 @@ function gt(e, t) {
4155
4155
  return e.pow(g(1).div(t));
4156
4156
  }
4157
4157
  const ie = (e) => BigInt(e.trunc().toFixed(0));
4158
- function Jo(e, t = {}) {
4158
+ function Zo(e, t = {}) {
4159
4159
  const n = t.angleMode ?? "deg", a = t.percentMode ?? "of", r = (i) => {
4160
4160
  var l;
4161
4161
  if (i === "ans") return g(t.ans ?? 0);
@@ -4237,9 +4237,9 @@ function Jo(e, t = {}) {
4237
4237
  case "tenpow":
4238
4238
  return p(1), g(10).pow(l);
4239
4239
  case "ncr":
4240
- return p(2), zo(l, c[1]);
4240
+ return p(2), Jo(l, c[1]);
4241
4241
  case "npr":
4242
- return p(2), Wo(l, c[1]);
4242
+ return p(2), zo(l, c[1]);
4243
4243
  case "gcd":
4244
4244
  return p(2), rn(l, c[1]);
4245
4245
  case "lcm":
@@ -4305,7 +4305,7 @@ function Jo(e, t = {}) {
4305
4305
  case "num":
4306
4306
  return g(i.value);
4307
4307
  case "const":
4308
- return i.name === "PI" ? Vo : i.name === "E" ? Yo : Ko;
4308
+ return i.name === "PI" ? Yo : i.name === "E" ? Ko : Wo;
4309
4309
  case "var":
4310
4310
  return r(i.name);
4311
4311
  case "percent":
@@ -4332,13 +4332,13 @@ function Jo(e, t = {}) {
4332
4332
  function on(e, t = {}) {
4333
4333
  if (e == null || e.trim() === "") return { value: new H(0) };
4334
4334
  try {
4335
- const n = qo(e, { base: t.base }), a = jo(n), r = Jo(a, t);
4335
+ const n = Go(e, { base: t.base }), a = Vo(n), r = Zo(a, t);
4336
4336
  return r.isNaN() ? { value: r, error: "Not a number" } : { value: r };
4337
4337
  } catch (n) {
4338
4338
  return { value: new H(NaN), error: n instanceof Error ? n.message : String(n) };
4339
4339
  }
4340
4340
  }
4341
- const R = (e, t, n, a = "fn", r) => ({ t: e, aria: t, ins: n, cls: a, alt: r });
4341
+ const E = (e, t, n, a = "fn", r) => ({ t: e, aria: t, ins: n, cls: a, alt: r });
4342
4342
  function sn(e, t) {
4343
4343
  if (e.isNaN() || !e.isFinite()) return "";
4344
4344
  if (t !== "DEC") {
@@ -4352,24 +4352,24 @@ function Jn({ def: e }) {
4352
4352
  () => on(a, { angleMode: s, percentMode: n, base: m, ans: h, memory: l }),
4353
4353
  [a, s, n, m, h, l]
4354
4354
  ), F = a.trim() ? S.error ? "" : sn(S.value, m) : "", N = (I) => requestAnimationFrame(() => {
4355
- const E = k.current;
4356
- E && (E.focus(), E.setSelectionRange(I, I));
4355
+ const R = k.current;
4356
+ R && (R.focus(), R.setSelectionRange(I, I));
4357
4357
  }), P = (I) => {
4358
- const E = k.current, j = (E == null ? void 0 : E.selectionStart) ?? a.length, Y = (E == null ? void 0 : E.selectionEnd) ?? a.length;
4358
+ const R = k.current, j = (R == null ? void 0 : R.selectionStart) ?? a.length, Y = (R == null ? void 0 : R.selectionEnd) ?? a.length;
4359
4359
  r(a.slice(0, j) + I + a.slice(Y)), N(j + I.length);
4360
4360
  }, x = () => {
4361
- const I = k.current, E = (I == null ? void 0 : I.selectionStart) ?? a.length, j = (I == null ? void 0 : I.selectionEnd) ?? a.length;
4362
- if (E !== j) {
4363
- r(a.slice(0, E) + a.slice(j)), N(E);
4361
+ const I = k.current, R = (I == null ? void 0 : I.selectionStart) ?? a.length, j = (I == null ? void 0 : I.selectionEnd) ?? a.length;
4362
+ if (R !== j) {
4363
+ r(a.slice(0, R) + a.slice(j)), N(R);
4364
4364
  return;
4365
4365
  }
4366
- E !== 0 && (r(a.slice(0, E - 1) + a.slice(E)), N(E - 1));
4366
+ R !== 0 && (r(a.slice(0, R - 1) + a.slice(R)), N(R - 1));
4367
4367
  }, T = () => {
4368
4368
  if (!a.trim()) return;
4369
4369
  const I = on(a, { angleMode: s, percentMode: n, base: m, ans: h, memory: l });
4370
4370
  if (I.error) return;
4371
- const E = sn(I.value, m);
4372
- w((j) => [{ expr: a, result: E }, ...j].slice(0, 50)), f(I.value), r(E), N(E.length);
4371
+ const R = sn(I.value, m);
4372
+ w((j) => [{ expr: a, result: R }, ...j].slice(0, 50)), f(I.value), r(R), N(R.length);
4373
4373
  }, $ = (I) => {
4374
4374
  switch (I) {
4375
4375
  case "eq":
@@ -4388,10 +4388,10 @@ function Jn({ def: e }) {
4388
4388
  P("M");
4389
4389
  break;
4390
4390
  case "mplus":
4391
- S.error || p((E) => E.plus(S.value));
4391
+ S.error || p((R) => R.plus(S.value));
4392
4392
  break;
4393
4393
  case "mminus":
4394
- S.error || p((E) => E.minus(S.value));
4394
+ S.error || p((R) => R.minus(S.value));
4395
4395
  break;
4396
4396
  }
4397
4397
  }, L = (I) => {
@@ -4401,71 +4401,71 @@ function Jn({ def: e }) {
4401
4401
  }, G = [
4402
4402
  [
4403
4403
  { t: "2nd", aria: "second function", cls: i ? "mode on" : "mode", act: void 0, ins: void 0 },
4404
- R("sin", "sine", "sin(", "fn", R("sin⁻¹", "arcsine", "asin(")),
4405
- R("cos", "cosine", "cos(", "fn", R("cos⁻¹", "arccosine", "acos(")),
4406
- R("tan", "tangent", "tan(", "fn", R("tan⁻¹", "arctangent", "atan(")),
4407
- R("ln", "natural log", "ln(", "fn", R("eˣ", "e to the x", "exp(")),
4408
- R("log", "log base 10", "log(", "fn", R("10ˣ", "ten to the x", "10^"))
4404
+ E("sin", "sine", "sin(", "fn", E("sin⁻¹", "arcsine", "asin(")),
4405
+ E("cos", "cosine", "cos(", "fn", E("cos⁻¹", "arccosine", "acos(")),
4406
+ E("tan", "tangent", "tan(", "fn", E("tan⁻¹", "arctangent", "atan(")),
4407
+ E("ln", "natural log", "ln(", "fn", E("eˣ", "e to the x", "exp(")),
4408
+ E("log", "log base 10", "log(", "fn", E("10ˣ", "ten to the x", "10^"))
4409
4409
  ],
4410
4410
  [
4411
- R("x²", "square", "^2", "fn", R("x³", "cube", "^3")),
4412
- R("√", "square root", "√", "fn", R("∛", "cube root", "∛")),
4413
- R("xʸ", "power", "^", "fn", R("ʸ√x", "nth root", "root(")),
4414
- R("π", "pi", "π", "fn", R("φ", "golden ratio", "phi")),
4415
- R("e", "euler number", "e", "fn", R("EE", "exponent", "E")),
4416
- R("1/x", "reciprocal", "recip(", "fn", R("|x|", "absolute value", "abs("))
4411
+ E("x²", "square", "^2", "fn", E("x³", "cube", "^3")),
4412
+ E("√", "square root", "√", "fn", E("∛", "cube root", "∛")),
4413
+ E("xʸ", "power", "^", "fn", E("ʸ√x", "nth root", "root(")),
4414
+ E("π", "pi", "π", "fn", E("φ", "golden ratio", "phi")),
4415
+ E("e", "euler number", "e", "fn", E("EE", "exponent", "E")),
4416
+ E("1/x", "reciprocal", "recip(", "fn", E("|x|", "absolute value", "abs("))
4417
4417
  ],
4418
4418
  [
4419
- R("n!", "factorial", "!", "fn", R("sinh", "hyperbolic sine", "sinh(")),
4420
- R("nCr", "combinations", "nCr(", "fn", R("cosh", "hyperbolic cosine", "cosh(")),
4421
- R("nPr", "permutations", "nPr(", "fn", R("tanh", "hyperbolic tangent", "tanh(")),
4422
- R("gcd", "greatest common divisor", "gcd(", "fn", R("lcm", "least common multiple", "lcm(")),
4423
- R("(", "open paren", "(", "fn"),
4424
- R(")", "close paren", ")", "fn")
4419
+ E("n!", "factorial", "!", "fn", E("sinh", "hyperbolic sine", "sinh(")),
4420
+ E("nCr", "combinations", "nCr(", "fn", E("cosh", "hyperbolic cosine", "cosh(")),
4421
+ E("nPr", "permutations", "nPr(", "fn", E("tanh", "hyperbolic tangent", "tanh(")),
4422
+ E("gcd", "greatest common divisor", "gcd(", "fn", E("lcm", "least common multiple", "lcm(")),
4423
+ E("(", "open paren", "(", "fn"),
4424
+ E(")", "close paren", ")", "fn")
4425
4425
  ],
4426
4426
  [
4427
4427
  { t: "C", aria: "clear", act: "clear", cls: "op" },
4428
4428
  { t: "⌫", aria: "backspace", act: "back", cls: "op" },
4429
- R("mod", "modulo", " mod ", "op", R("round", "round", "round(")),
4430
- R("%", "percent", "%", "op", R("floor", "floor", "floor(")),
4431
- R("÷", "divide", "÷", "op", R("ceil", "ceiling", "ceil("))
4429
+ E("mod", "modulo", " mod ", "op", E("round", "round", "round(")),
4430
+ E("%", "percent", "%", "op", E("floor", "floor", "floor(")),
4431
+ E("÷", "divide", "÷", "op", E("ceil", "ceiling", "ceil("))
4432
4432
  ],
4433
4433
  [
4434
- R("7", "7", "7", "num"),
4435
- R("8", "8", "8", "num"),
4436
- R("9", "9", "9", "num"),
4437
- R("×", "multiply", "×", "op"),
4438
- R("!", "factorial", "!", "op", R("sign", "sign", "sign("))
4434
+ E("7", "7", "7", "num"),
4435
+ E("8", "8", "8", "num"),
4436
+ E("9", "9", "9", "num"),
4437
+ E("×", "multiply", "×", "op"),
4438
+ E("!", "factorial", "!", "op", E("sign", "sign", "sign("))
4439
4439
  ],
4440
4440
  [
4441
- R("4", "4", "4", "num"),
4442
- R("5", "5", "5", "num"),
4443
- R("6", "6", "6", "num"),
4444
- R("−", "minus", "−", "op"),
4445
- R("^", "power", "^", "op")
4441
+ E("4", "4", "4", "num"),
4442
+ E("5", "5", "5", "num"),
4443
+ E("6", "6", "6", "num"),
4444
+ E("−", "minus", "−", "op"),
4445
+ E("^", "power", "^", "op")
4446
4446
  ],
4447
4447
  [
4448
- R("1", "1", "1", "num"),
4449
- R("2", "2", "2", "num"),
4450
- R("3", "3", "3", "num"),
4451
- R("+", "plus", "+", "op"),
4452
- R(".", "decimal point", ".", "num")
4448
+ E("1", "1", "1", "num"),
4449
+ E("2", "2", "2", "num"),
4450
+ E("3", "3", "3", "num"),
4451
+ E("+", "plus", "+", "op"),
4452
+ E(".", "decimal point", ".", "num")
4453
4453
  ],
4454
4454
  [
4455
- R("0", "0", "0", "num"),
4456
- R("±", "negate", "-", "num"),
4455
+ E("0", "0", "0", "num"),
4456
+ E("±", "negate", "-", "num"),
4457
4457
  { t: "M+", aria: "memory add", act: "mplus", cls: "op" },
4458
4458
  { t: "M−", aria: "memory subtract", act: "mminus", cls: "op" },
4459
4459
  { t: "=", aria: "equals", act: "eq", cls: "accent" }
4460
4460
  ]
4461
4461
  ], q = [
4462
- R("AND", "bitwise and", " and ", "op"),
4463
- R("OR", "bitwise or", " or ", "op"),
4464
- R("XOR", "bitwise xor", " xor ", "op"),
4465
- R("NOT", "bitwise not", "not ", "op"),
4466
- R("<<", "shift left", "<<", "op"),
4467
- R(">>", "shift right", ">>", "op")
4468
- ], A = ["A", "B", "C", "D", "E", "F"].map((I) => R(I, `hex ${I}`, I, "num"));
4462
+ E("AND", "bitwise and", " and ", "op"),
4463
+ E("OR", "bitwise or", " or ", "op"),
4464
+ E("XOR", "bitwise xor", " xor ", "op"),
4465
+ E("NOT", "bitwise not", "not ", "op"),
4466
+ E("<<", "shift left", "<<", "op"),
4467
+ E(">>", "shift right", ">>", "op")
4468
+ ], A = ["A", "B", "C", "D", "E", "F"].map((I) => E(I, `hex ${I}`, I, "num"));
4469
4469
  return /* @__PURE__ */ b("section", { className: "card sci", children: [
4470
4470
  /* @__PURE__ */ b("div", { className: "sci-toolbar", children: [
4471
4471
  /* @__PURE__ */ o("div", { className: "seg", role: "group", "aria-label": "angle mode", children: ["deg", "rad", "grad"].map((I) => /* @__PURE__ */ o("button", { type: "button", "aria-pressed": s === I, onClick: () => u(I), children: I }, I)) }),
@@ -4494,7 +4494,7 @@ function Jn({ def: e }) {
4494
4494
  ] }) : /* @__PURE__ */ o("span", { children: " " }) })
4495
4495
  ] }),
4496
4496
  /* @__PURE__ */ b("div", { className: "sci-pad", role: "group", "aria-label": "calculator keypad", children: [
4497
- G.map((I, E) => /* @__PURE__ */ o("div", { className: "sci-row", children: I.map((j, Y) => {
4497
+ G.map((I, R) => /* @__PURE__ */ o("div", { className: "sci-row", children: I.map((j, Y) => {
4498
4498
  const V = i && j.alt ? j.alt : j, Q = j.t === "2nd";
4499
4499
  return /* @__PURE__ */ o(
4500
4500
  "button",
@@ -4503,15 +4503,15 @@ function Jn({ def: e }) {
4503
4503
  className: `sci-key ${V.cls ?? "fn"}`,
4504
4504
  "aria-label": V.aria,
4505
4505
  "aria-pressed": Q ? i : void 0,
4506
- onClick: () => Q ? c((Re) => !Re) : B(V),
4506
+ onClick: () => Q ? c((Ee) => !Ee) : B(V),
4507
4507
  children: V.t
4508
4508
  },
4509
4509
  Y
4510
4510
  );
4511
- }) }, E)),
4511
+ }) }, R)),
4512
4512
  m !== "DEC" && /* @__PURE__ */ b(re, { children: [
4513
- m === "HEX" && /* @__PURE__ */ o("div", { className: "sci-row", children: A.map((I, E) => /* @__PURE__ */ o("button", { type: "button", className: `sci-key ${I.cls}`, "aria-label": I.aria, onClick: () => B(I), children: I.t }, E)) }),
4514
- /* @__PURE__ */ o("div", { className: "sci-row", children: q.map((I, E) => /* @__PURE__ */ o("button", { type: "button", className: `sci-key ${I.cls}`, "aria-label": I.aria, onClick: () => B(I), children: I.t }, E)) })
4513
+ m === "HEX" && /* @__PURE__ */ o("div", { className: "sci-row", children: A.map((I, R) => /* @__PURE__ */ o("button", { type: "button", className: `sci-key ${I.cls}`, "aria-label": I.aria, onClick: () => B(I), children: I.t }, R)) }),
4514
+ /* @__PURE__ */ o("div", { className: "sci-row", children: q.map((I, R) => /* @__PURE__ */ o("button", { type: "button", className: `sci-key ${I.cls}`, "aria-label": I.aria, onClick: () => B(I), children: I.t }, R)) })
4515
4515
  ] })
4516
4516
  ] }),
4517
4517
  /* @__PURE__ */ b("div", { className: "sci-row sci-memrow", children: [
@@ -4524,7 +4524,7 @@ function Jn({ def: e }) {
4524
4524
  /* @__PURE__ */ o("span", { children: "History" }),
4525
4525
  /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: () => w([]), "aria-label": "clear history", children: "Clear" })
4526
4526
  ] }),
4527
- /* @__PURE__ */ o("ul", { children: y.map((I, E) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ b("button", { type: "button", onClick: () => {
4527
+ /* @__PURE__ */ o("ul", { children: y.map((I, R) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ b("button", { type: "button", onClick: () => {
4528
4528
  r(I.expr), N(I.expr.length);
4529
4529
  }, "aria-label": `reuse ${I.expr} equals ${I.result}`, children: [
4530
4530
  /* @__PURE__ */ o("span", { className: "sci-tape-expr num", children: I.expr }),
@@ -4532,7 +4532,7 @@ function Jn({ def: e }) {
4532
4532
  "= ",
4533
4533
  I.result
4534
4534
  ] })
4535
- ] }) }, E)) })
4535
+ ] }) }, R)) })
4536
4536
  ] })
4537
4537
  ] });
4538
4538
  }
@@ -4581,14 +4581,14 @@ const tt = [
4581
4581
  { code: "BDT", name: "Bangladeshi Taka", symbol: "৳" },
4582
4582
  { code: "LKR", name: "Sri Lankan Rupee", symbol: "Rs" },
4583
4583
  { code: "NPR", name: "Nepalese Rupee", symbol: "रू" }
4584
- ], Zo = (e) => tt.find((t) => t.code === e), Xo = (e) => e === "INR" ? "en-IN" : "en-US", Zn = (e, t) => g(e).times(t), Xn = (e) => {
4584
+ ], Xo = (e) => tt.find((t) => t.code === e), Qo = (e) => e === "INR" ? "en-IN" : "en-US", Zn = (e, t) => g(e).times(t), Xn = (e) => {
4585
4585
  const t = g(e);
4586
4586
  return t.gt(0) ? g(1).div(t) : g(0);
4587
4587
  };
4588
- function Rt(e, t) {
4588
+ function Et(e, t) {
4589
4589
  const n = g(e);
4590
4590
  try {
4591
- return new Intl.NumberFormat(Xo(t), { style: "currency", currency: t }).format(
4591
+ return new Intl.NumberFormat(Qo(t), { style: "currency", currency: t }).format(
4592
4592
  Number(n.toFixed(4))
4593
4593
  );
4594
4594
  } catch {
@@ -4618,19 +4618,19 @@ const ea = (e, t) => t - e > 864e5, fs = /* @__PURE__ */ Object.freeze(/* @__PUR
4618
4618
  __proto__: null,
4619
4619
  CURRENCIES: tt,
4620
4620
  convert: Zn,
4621
- currencyByCode: Zo,
4621
+ currencyByCode: Xo,
4622
4622
  currencyDecimals: Qn,
4623
- formatCurrency: Rt,
4623
+ formatCurrency: Et,
4624
4624
  inverseRate: Xn,
4625
4625
  isStale: ea,
4626
4626
  stalenessLabel: Je
4627
- }, Symbol.toStringTag, { value: "Module" })), Qo = (e) => `https://open.er-api.com/v6/latest/${encodeURIComponent(e)}`;
4628
- async function ei(e, t, n = {}) {
4627
+ }, Symbol.toStringTag, { value: "Module" })), ei = (e) => `https://open.er-api.com/v6/latest/${encodeURIComponent(e)}`;
4628
+ async function ti(e, t, n = {}) {
4629
4629
  var m;
4630
4630
  if (e === t) return { rate: "1", asOf: "", provider: "identity" };
4631
4631
  const a = n.fetchImpl ?? (typeof fetch < "u" ? fetch : void 0);
4632
4632
  if (!a) throw new Error("No fetch available in this environment");
4633
- const r = await a(Qo(e), { signal: n.signal });
4633
+ const r = await a(ei(e), { signal: n.signal });
4634
4634
  if (!r.ok) throw new Error(`Rate service returned HTTP ${r.status}`);
4635
4635
  const s = await r.json();
4636
4636
  if (s != null && s.result && s.result !== "success") throw new Error(s["error-type"] || "Rate service error");
@@ -4648,12 +4648,12 @@ const ta = "calcsuite:fxrates", na = "calcsuite:fxmode", vt = () => {
4648
4648
  } catch {
4649
4649
  return {};
4650
4650
  }
4651
- }, ti = (e) => {
4651
+ }, ni = (e) => {
4652
4652
  try {
4653
4653
  localStorage.setItem(ta, JSON.stringify(e));
4654
4654
  } catch {
4655
4655
  }
4656
- }, ni = () => {
4656
+ }, ai = () => {
4657
4657
  try {
4658
4658
  return localStorage.getItem(na) === "offline" ? "offline" : "online";
4659
4659
  } catch {
@@ -4662,7 +4662,7 @@ const ta = "calcsuite:fxrates", na = "calcsuite:fxmode", vt = () => {
4662
4662
  }, Ke = (e, t) => `${e}_${t}`;
4663
4663
  function aa() {
4664
4664
  var _t;
4665
- const [e, t] = M("USD"), [n, a] = M("INR"), [r, s] = M(""), [u, m] = M(""), [d, i] = M("none"), [c, l] = M(""), [p, h] = M("idle"), [f, y] = M(""), [w, k] = M(() => ni()), [S, F] = M(() => vt()), [N, P] = M(() => Date.now()), x = de(null);
4665
+ const [e, t] = M("USD"), [n, a] = M("INR"), [r, s] = M(""), [u, m] = M(""), [d, i] = M("none"), [c, l] = M(""), [p, h] = M("idle"), [f, y] = M(""), [w, k] = M(() => ai()), [S, F] = M(() => vt()), [N, P] = M(() => Date.now()), x = de(null);
4666
4666
  X(() => {
4667
4667
  const O = setInterval(() => P(Date.now()), 3e4);
4668
4668
  return () => clearInterval(O);
@@ -4670,7 +4670,7 @@ function aa() {
4670
4670
  const T = (O, Z) => {
4671
4671
  F((ae) => {
4672
4672
  const oe = { ...ae, [Ke(e, n)]: { rate: O, at: Z } };
4673
- return ti(oe), oe;
4673
+ return ni(oe), oe;
4674
4674
  });
4675
4675
  }, $ = (O, Z) => {
4676
4676
  var oe;
@@ -4680,7 +4680,7 @@ function aa() {
4680
4680
  m("1"), i("live"), l(""), h("idle");
4681
4681
  return;
4682
4682
  }
4683
- h("loading"), y(""), ei(O, Z, { signal: ae.signal }).then((xe) => {
4683
+ h("loading"), y(""), ti(O, Z, { signal: ae.signal }).then((xe) => {
4684
4684
  ae.signal.aborted || (m(xe.rate), i("live"), l(xe.asOf), h("idle"), T(xe.rate, ln(xe.asOf, Date.now())));
4685
4685
  }).catch((xe) => {
4686
4686
  if (ae.signal.aborted) return;
@@ -4706,14 +4706,14 @@ function aa() {
4706
4706
  localStorage.setItem(na, O);
4707
4707
  } catch {
4708
4708
  }
4709
- }, G = (O) => O.replace(/[, ]/g, "").trim(), q = G(r), A = G(u), I = q !== "" && Number(q) >= 0 && Number.isFinite(Number(q)), E = A !== "" && Number(A) > 0 && Number.isFinite(Number(A)), j = ne(
4710
- () => I && E ? Zn(q, A) : null,
4711
- [I, E, q, A]
4712
- ), Y = E ? Xn(A) : null, V = (O) => {
4713
- m(O), i("manual"), h("idle"), y(""), (E || O.trim() !== "") && T(G(O), Date.now());
4709
+ }, G = (O) => O.replace(/[, ]/g, "").trim(), q = G(r), A = G(u), I = q !== "" && Number(q) >= 0 && Number.isFinite(Number(q)), R = A !== "" && Number(A) > 0 && Number.isFinite(Number(A)), j = ne(
4710
+ () => I && R ? Zn(q, A) : null,
4711
+ [I, R, q, A]
4712
+ ), Y = R ? Xn(A) : null, V = (O) => {
4713
+ m(O), i("manual"), h("idle"), y(""), (R || O.trim() !== "") && T(G(O), Date.now());
4714
4714
  }, Q = () => {
4715
4715
  t(n), a(e);
4716
- }, Re = c ? Je(ln(c, N), N) : "just now", K = (_t = S[Ke(e, n)]) == null ? void 0 : _t.at, pe = (O) => /* @__PURE__ */ b("option", { value: O.code, children: [
4716
+ }, Ee = c ? Je(ln(c, N), N) : "just now", K = (_t = S[Ke(e, n)]) == null ? void 0 : _t.at, pe = (O) => /* @__PURE__ */ b("option", { value: O.code, children: [
4717
4717
  O.code,
4718
4718
  " — ",
4719
4719
  O.name
@@ -4723,7 +4723,7 @@ function aa() {
4723
4723
  ] }) : d === "manual" ? /* @__PURE__ */ o("span", { children: "Manual rate (you entered this)" }) : w === "online" ? p === "loading" ? /* @__PURE__ */ o("span", { children: "Fetching live rate…" }) : d === "live" ? /* @__PURE__ */ b("span", { children: [
4724
4724
  /* @__PURE__ */ o("span", { className: "cc-live-dot" }),
4725
4725
  " Live rate · updated ",
4726
- Re,
4726
+ Ee,
4727
4727
  " · open.er-api.com"
4728
4728
  ] }) : null : d === "saved" && K ? /* @__PURE__ */ b("span", { children: [
4729
4729
  "✈ Offline · saved rate ",
@@ -4798,10 +4798,10 @@ function aa() {
4798
4798
  /* @__PURE__ */ b("section", { className: "card", children: [
4799
4799
  j ? /* @__PURE__ */ b("div", { className: "result", "aria-live": "polite", children: [
4800
4800
  /* @__PURE__ */ b("div", { className: "label", children: [
4801
- Rt(q, e),
4801
+ Et(q, e),
4802
4802
  " ="
4803
4803
  ] }),
4804
- /* @__PURE__ */ o("div", { className: "value num accent-txt", children: Rt(j, n) }),
4804
+ /* @__PURE__ */ o("div", { className: "value num accent-txt", children: Et(j, n) }),
4805
4805
  /* @__PURE__ */ b("div", { className: "secondary", children: [
4806
4806
  /* @__PURE__ */ b("div", { className: "kv", children: [
4807
4807
  /* @__PURE__ */ o("div", { className: "k", children: "Rate" }),
@@ -4869,13 +4869,13 @@ function aa() {
4869
4869
  ] })
4870
4870
  ] });
4871
4871
  }
4872
- const ai = {
4872
+ const ri = {
4873
4873
  id: "",
4874
4874
  group: "tools",
4875
4875
  title: "",
4876
4876
  inputs: [],
4877
4877
  compute: () => ({ primary: { label: "", value: "" } })
4878
- }, ri = {
4878
+ }, oi = {
4879
4879
  "loan.emi": Wn,
4880
4880
  scientific: Jn,
4881
4881
  currency: aa
@@ -4885,7 +4885,7 @@ function cn(e, t) {
4885
4885
  for (const a of e.inputs) a.default !== void 0 && (n[a.key] = a.default);
4886
4886
  return t ? { ...n, ...t } : n;
4887
4887
  }
4888
- function oi({
4888
+ function ii({
4889
4889
  def: e,
4890
4890
  id: t,
4891
4891
  seed: n,
@@ -4894,9 +4894,9 @@ function oi({
4894
4894
  actions: s
4895
4895
  }) {
4896
4896
  var L, B, G, q;
4897
- const u = e ?? (t ? It(t) : void 0), m = u ?? ai, d = { ...ri, ...a }, { settings: i, fmt: c } = ue(), [l, p] = M(() => cn(m, n)), [h, f] = M("schedule"), [y, w] = M(!1);
4897
+ const u = e ?? (t ? It(t) : void 0), m = u ?? ri, d = { ...oi, ...a }, { settings: i, fmt: c } = ue(), [l, p] = M(() => cn(m, n)), [h, f] = M("schedule"), [y, w] = M(!1);
4898
4898
  X(() => p(cn(m, n)), [m.id, n]);
4899
- const k = i.region, S = (A, I) => p((E) => ({ ...E, [A]: I })), F = m.inputs.filter((A) => A.showIf ? A.showIf(l, k) : !0), N = F.filter((A) => !A.advanced), P = F.filter((A) => A.advanced), { result: x, error: T } = ne(() => {
4899
+ const k = i.region, S = (A, I) => p((R) => ({ ...R, [A]: I })), F = m.inputs.filter((A) => A.showIf ? A.showIf(l, k) : !0), N = F.filter((A) => !A.advanced), P = F.filter((A) => A.advanced), { result: x, error: T } = ne(() => {
4900
4900
  const A = { settings: i, region: k, fmt: c, D: g };
4901
4901
  try {
4902
4902
  return { result: m.compute(l, A), error: null };
@@ -4932,7 +4932,7 @@ function oi({
4932
4932
  T && /* @__PURE__ */ o("div", { className: "error", role: "alert", style: { marginTop: 16 }, children: T })
4933
4933
  ] }),
4934
4934
  x && !T && /* @__PURE__ */ b("section", { className: "card", children: [
4935
- /* @__PURE__ */ o(Xr, { view: x }),
4935
+ /* @__PURE__ */ o(Qr, { view: x }),
4936
4936
  (B = x.warnings) == null ? void 0 : B.map((A, I) => /* @__PURE__ */ o("div", { className: "notice", children: A }, I)),
4937
4937
  s && /* @__PURE__ */ o("div", { className: "actions-row", children: s(x, l) }),
4938
4938
  $ && /* @__PURE__ */ b(re, { children: [
@@ -4943,8 +4943,8 @@ function oi({
4943
4943
  (((G = x.notes) == null ? void 0 : G.length) ?? 0) > 0 && i.ui.showAssumptions && /* @__PURE__ */ o("button", { role: "tab", "aria-selected": h === "assumptions", onClick: () => f("assumptions"), children: "Assumptions" })
4944
4944
  ] }),
4945
4945
  /* @__PURE__ */ b("div", { className: "tab-anim", children: [
4946
- h === "schedule" && x.schedule && /* @__PURE__ */ o(to, { schedule: x.schedule }),
4947
- h === "chart" && x.chart && /* @__PURE__ */ o(no, { chart: x.chart }),
4946
+ h === "schedule" && x.schedule && /* @__PURE__ */ o(no, { schedule: x.schedule }),
4947
+ h === "chart" && x.chart && /* @__PURE__ */ o(ao, { chart: x.chart }),
4948
4948
  h === "formula" && x.formula && i.ui.showFormulas && /* @__PURE__ */ b("div", { className: "formula", children: [
4949
4949
  /* @__PURE__ */ o("code", { children: x.formula }),
4950
4950
  x.formulaSubstituted && /* @__PURE__ */ o("code", { style: { marginTop: 8 }, children: x.formulaSubstituted })
@@ -4967,366 +4967,83 @@ function un({ def: e, region: t }) {
4967
4967
  }
4968
4968
  function dn({ f: e, values: t, set: n }) {
4969
4969
  const a = e.kind === "cashflows" || e.kind === "segmented" ? "span2" : "";
4970
- return /* @__PURE__ */ o("div", { className: a, children: /* @__PURE__ */ o(zr, { f: e, value: t[e.key], onChange: (r) => n(e.key, r), values: t }) });
4970
+ return /* @__PURE__ */ o("div", { className: a, children: /* @__PURE__ */ o(Jr, { f: e, value: t[e.key], onChange: (r) => n(e.key, r), values: t }) });
4971
4971
  }
4972
- const ii = [
4972
+ const si = [
4973
4973
  { id: "default", label: "Green", main: "#00A76F", light: "#2CCF8E", dark: "#087055", ink: "#06251A" },
4974
4974
  { id: "cyan", label: "Cyan", main: "#078DEE", light: "#68CDF9", dark: "#0351AB", ink: "#FFFFFF" },
4975
4975
  { id: "purple", label: "Purple", main: "#7635DC", light: "#B985F4", dark: "#431A9E", ink: "#FFFFFF" },
4976
4976
  { id: "blue", label: "Blue", main: "#2065D1", light: "#76B0F1", dark: "#103996", ink: "#FFFFFF" },
4977
4977
  { id: "orange", label: "Orange", main: "#FDA92D", light: "#FED680", dark: "#B66816", ink: "#212B36" },
4978
4978
  { id: "gray", label: "Gray", main: "#A4AAB3", light: "#CED1D7", dark: "#63686C", ink: "#FFFFFF" }
4979
- ], kt = "-apple-system, 'Segoe UI', system-ui, sans-serif", si = [
4979
+ ], kt = "-apple-system, 'Segoe UI', system-ui, sans-serif", li = [
4980
4980
  { id: "Inter Tight", label: "Inter Tight", stack: `'Inter Tight', ${kt}` },
4981
4981
  { id: "Public Sans", label: "Public Sans", stack: `'Public Sans', ${kt}` },
4982
4982
  { id: "system-ui", label: "System UI", stack: `system-ui, ${kt}` },
4983
4983
  { id: "Georgia", label: "Georgia (serif)", stack: "Georgia, 'Times New Roman', serif" }
4984
- ], li = "1234567.891";
4985
- function ci() {
4986
- const { settings: e, update: t, setRegion: n, reset: a, replace: r } = ue(), s = de(null), u = Sn(e).money(g(li)), m = () => {
4987
- const i = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), c = URL.createObjectURL(i), l = document.createElement("a");
4988
- l.href = c, l.download = "calcsuite-settings.json", l.click(), URL.revokeObjectURL(c);
4989
- }, d = (i) => {
4990
- const c = new FileReader();
4991
- c.onload = () => {
4992
- try {
4993
- r(JSON.parse(String(c.result)));
4994
- } catch {
4995
- alert("Could not read that settings file.");
4996
- }
4997
- }, c.readAsText(i);
4998
- };
4999
- return /* @__PURE__ */ b("div", { className: "settings", children: [
5000
- /* @__PURE__ */ b("div", { className: "panel-head", children: [
5001
- /* @__PURE__ */ o("h2", { children: "Settings" }),
5002
- /* @__PURE__ */ b("p", { children: [
5003
- "Everything below updates the numbers live. Sample: ",
5004
- /* @__PURE__ */ o("strong", { className: "num", children: u })
5005
- ] })
5006
- ] }),
5007
- /* @__PURE__ */ b(Te, { title: "Region & currency", children: [
5008
- /* @__PURE__ */ o(W, { label: "Region", children: /* @__PURE__ */ b("div", { className: "seg", children: [
5009
- /* @__PURE__ */ o("button", { "aria-pressed": e.region === "IN", onClick: () => n("IN"), children: "🇮🇳 India" }),
5010
- /* @__PURE__ */ o("button", { "aria-pressed": e.region === "US", onClick: () => n("US"), children: "🇺🇸 United States" })
5011
- ] }) }),
5012
- /* @__PURE__ */ o(W, { label: "Currency symbol", children: /* @__PURE__ */ o("input", { className: "mini", value: e.currency.symbol, onChange: (i) => t({ currency: { symbol: i.target.value } }) }) }),
5013
- /* @__PURE__ */ o(W, { label: "Symbol position", children: /* @__PURE__ */ o(
5014
- he,
5015
- {
5016
- value: e.currency.symbolPosition,
5017
- onChange: (i) => t({ currency: { symbolPosition: i } }),
5018
- options: [["prefix", "Prefix ₹100"], ["suffix", "Suffix 100₹"]]
5019
- }
5020
- ) })
5021
- ] }),
5022
- /* @__PURE__ */ b(Te, { title: "Number format", children: [
5023
- /* @__PURE__ */ o(W, { label: "Grouping", children: /* @__PURE__ */ o(
5024
- he,
5025
- {
5026
- value: e.numberFormat.grouping,
5027
- onChange: (i) => t({ numberFormat: { grouping: i } }),
5028
- options: [["indian", "Indian 12,34,567"], ["western", "Western 1,234,567"], ["european", "European 1.234.567"], ["swiss", "Swiss 1'234'567"], ["plain", "Plain 1234567"]]
5029
- }
5030
- ) }),
5031
- /* @__PURE__ */ o(W, { label: "Decimal places", children: /* @__PURE__ */ o("div", { className: "seg", children: [0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ o("button", { "aria-pressed": e.numberFormat.decimalPlaces === i, onClick: () => t({ numberFormat: { decimalPlaces: i } }), children: i }, i)) }) }),
5032
- /* @__PURE__ */ o(W, { label: "Abbreviate (12.5 L / 1.2 Cr)", children: /* @__PURE__ */ o(Le, { on: e.numberFormat.abbreviate, onClick: () => t({ numberFormat: { abbreviate: !e.numberFormat.abbreviate } }) }) }),
5033
- /* @__PURE__ */ o(W, { label: "Abbreviation scale", children: /* @__PURE__ */ o(
5034
- he,
5035
- {
5036
- value: e.numberFormat.abbreviationScale,
5037
- onChange: (i) => t({ numberFormat: { abbreviationScale: i } }),
5038
- options: [["indian", "Lakh / Crore"], ["western", "K / M / B"]]
5039
- }
5040
- ) }),
5041
- /* @__PURE__ */ o(W, { label: "Negatives", children: /* @__PURE__ */ o(
5042
- he,
5043
- {
5044
- value: e.numberFormat.negativeFormat,
5045
- onChange: (i) => t({ numberFormat: { negativeFormat: i } }),
5046
- options: [["minus", "-1,000"], ["parentheses", "(1,000)"]]
5047
- }
5048
- ) })
5049
- ] }),
5050
- /* @__PURE__ */ b(Te, { title: "Calculation", children: [
5051
- /* @__PURE__ */ o(W, { label: "Rounding mode", children: /* @__PURE__ */ o(
5052
- he,
5053
- {
5054
- value: e.rounding.mode,
5055
- onChange: (i) => t({ rounding: { mode: i } }),
5056
- options: [["HALF_UP", "Half up"], ["HALF_EVEN", "Half even (banker’s)"], ["HALF_DOWN", "Half down"], ["UP", "Up"], ["DOWN", "Down"], ["CEIL", "Ceil"], ["FLOOR", "Floor"]]
5057
- }
5058
- ) }),
5059
- /* @__PURE__ */ o(W, { label: "Day-count convention", children: /* @__PURE__ */ o(
5060
- he,
5061
- {
5062
- value: e.dayCount,
5063
- onChange: (i) => t({ dayCount: i }),
5064
- options: [["30/360", "30/360"], ["ACT/365", "ACT/365"], ["ACT/360", "ACT/360"], ["ACT/ACT", "ACT/ACT"], ["30E/360", "30E/360"]]
5065
- }
5066
- ) })
5067
- ] }),
5068
- /* @__PURE__ */ b(Te, { title: "Appearance", children: [
5069
- /* @__PURE__ */ o(W, { label: "Theme", children: /* @__PURE__ */ o(
5070
- he,
5071
- {
5072
- value: e.ui.theme,
5073
- onChange: (i) => t({ ui: { theme: i } }),
5074
- options: [["system", "System"], ["light", "Light"], ["dark", "Dark"], ["highContrast", "High contrast"]]
5075
- }
5076
- ) }),
5077
- /* @__PURE__ */ o(W, { label: "Accent colour", children: /* @__PURE__ */ o("div", { className: "swatches", children: ii.map((i) => {
5078
- const c = e.ui.accent.toLowerCase() === i.main.toLowerCase();
5079
- return /* @__PURE__ */ o(
5080
- "button",
5081
- {
5082
- type: "button",
5083
- className: `swatch ${c ? "active" : ""}`,
5084
- style: { background: i.main },
5085
- "aria-label": i.label,
5086
- "aria-pressed": c,
5087
- title: i.label,
5088
- onClick: () => t({ ui: { accent: i.main } })
5089
- },
5090
- i.id
5091
- );
5092
- }) }) }),
5093
- /* @__PURE__ */ o(W, { label: "Font", children: /* @__PURE__ */ o(
5094
- he,
5095
- {
5096
- value: e.ui.fontFamily,
5097
- onChange: (i) => t({ ui: { fontFamily: i } }),
5098
- options: si.map((i) => [i.id, i.label])
5099
- }
5100
- ) }),
5101
- /* @__PURE__ */ o(W, { label: "Density", children: /* @__PURE__ */ o(
5102
- he,
5103
- {
5104
- value: e.ui.density,
5105
- onChange: (i) => t({ ui: { density: i } }),
5106
- options: [["comfortable", "Comfortable"], ["compact", "Compact"]]
5107
- }
5108
- ) }),
5109
- /* @__PURE__ */ o(W, { label: "Show formulas", children: /* @__PURE__ */ o(Le, { on: e.ui.showFormulas, onClick: () => t({ ui: { showFormulas: !e.ui.showFormulas } }) }) }),
5110
- /* @__PURE__ */ o(W, { label: "Show assumptions", children: /* @__PURE__ */ o(Le, { on: e.ui.showAssumptions, onClick: () => t({ ui: { showAssumptions: !e.ui.showAssumptions } }) }) })
5111
- ] }),
5112
- /* @__PURE__ */ o(Te, { title: "Compliance", children: /* @__PURE__ */ o(W, { label: "Show disclaimer", children: /* @__PURE__ */ o(Le, { on: e.compliance.showDisclaimer, onClick: () => t({ compliance: { showDisclaimer: !e.compliance.showDisclaimer } }) }) }) }),
5113
- /* @__PURE__ */ o(Te, { title: "Integration (advanced)", children: /* @__PURE__ */ o(W, { label: "Enable integration panel", children: /* @__PURE__ */ o(Le, { on: e.features.integrationPanel, onClick: () => t({ features: { integrationPanel: !e.features.integrationPanel } }) }) }) }),
5114
- /* @__PURE__ */ b("div", { className: "actions-row", children: [
5115
- /* @__PURE__ */ o("button", { className: "icon-btn", onClick: m, children: "Export settings" }),
5116
- /* @__PURE__ */ o("button", { className: "icon-btn", onClick: () => {
5117
- var i;
5118
- return (i = s.current) == null ? void 0 : i.click();
5119
- }, children: "Import settings" }),
5120
- /* @__PURE__ */ o("button", { className: "icon-btn", onClick: a, children: "Reset to defaults" }),
5121
- /* @__PURE__ */ o("input", { ref: s, type: "file", accept: "application/json", hidden: !0, onChange: (i) => {
5122
- var c;
5123
- return ((c = i.target.files) == null ? void 0 : c[0]) && d(i.target.files[0]);
5124
- } })
5125
- ] })
5126
- ] });
5127
- }
5128
- function Te({ title: e, children: t }) {
5129
- return /* @__PURE__ */ b("section", { className: "card settings-section", children: [
5130
- /* @__PURE__ */ o("h3", { children: e }),
5131
- t
5132
- ] });
4984
+ ];
4985
+ class z extends Error {
4986
+ constructor(n, a = { code: "transport_error" }) {
4987
+ super(n);
4988
+ ge(this, "code");
4989
+ ge(this, "status");
4990
+ /** The request that failed, auth redacted. */
4991
+ ge(this, "request");
4992
+ this.name = "TransportError", this.code = a.code, this.status = a.status ?? 0, this.request = a.request;
4993
+ }
5133
4994
  }
5134
- function W({ label: e, children: t }) {
5135
- return /* @__PURE__ */ b("div", { className: "settings-row", children: [
5136
- /* @__PURE__ */ o("span", { className: "lbl", children: e }),
5137
- /* @__PURE__ */ o("div", { children: t })
5138
- ] });
4995
+ const ci = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"], ui = {
4996
+ attempts: 3,
4997
+ backoff: "exponential",
4998
+ baseDelayMs: 300,
4999
+ retryOn: [408, 429, 500, 502, 503, 504],
5000
+ respectRetryAfter: !0
5001
+ }, di = {
5002
+ enabled: !0,
5003
+ headerName: "Idempotency-Key",
5004
+ keyFrom: "inputsHash"
5005
+ }, mi = {
5006
+ enabled: !0,
5007
+ storage: "memory",
5008
+ maxItems: 200,
5009
+ flushOn: "manual"
5010
+ }, mn = () => {
5011
+ try {
5012
+ return typeof localStorage < "u" && localStorage != null;
5013
+ } catch {
5014
+ return !1;
5015
+ }
5016
+ };
5017
+ function ra() {
5018
+ const e = globalThis.crypto;
5019
+ return e != null && e.randomUUID ? e.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
5020
+ const n = Math.random() * 16 | 0;
5021
+ return (t === "x" ? n : n & 3 | 8).toString(16);
5022
+ });
5139
5023
  }
5140
- function he({ value: e, onChange: t, options: n }) {
5141
- return /* @__PURE__ */ o("div", { className: "input-wrap mini-wrap", children: /* @__PURE__ */ o("select", { value: e, onChange: (a) => t(a.target.value), children: n.map(([a, r]) => /* @__PURE__ */ o("option", { value: a, children: r }, a)) }) });
5142
- }
5143
- function Le({ on: e, onClick: t }) {
5144
- return /* @__PURE__ */ o("button", { type: "button", role: "switch", "aria-checked": e, className: `toggle ${e ? "on" : ""}`, onClick: t, children: /* @__PURE__ */ o("span", { className: "knob" }) });
5145
- }
5146
- function ui({
5147
- items: e,
5148
- onRestore: t,
5149
- onClear: n
5150
- }) {
5151
- return /* @__PURE__ */ b("div", { className: "history", children: [
5152
- /* @__PURE__ */ b("div", { className: "panel-head", style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end" }, children: [
5153
- /* @__PURE__ */ b("div", { children: [
5154
- /* @__PURE__ */ o("h2", { children: "History" }),
5155
- /* @__PURE__ */ o("p", { children: "Your recent calculations, saved on this device." })
5156
- ] }),
5157
- e.length > 0 && /* @__PURE__ */ o("button", { className: "icon-btn", onClick: n, children: "Clear all" })
5158
- ] }),
5159
- e.length === 0 ? /* @__PURE__ */ o("div", { className: "card empty", children: "No saved calculations yet. Compute something and press Save." }) : /* @__PURE__ */ o("div", { className: "card", style: { padding: 0 }, children: /* @__PURE__ */ o("ul", { className: "history-list", children: e.map((a, r) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ b("button", { className: "history-item", onClick: () => t(a), children: [
5160
- /* @__PURE__ */ b("div", { children: [
5161
- /* @__PURE__ */ o("div", { className: "history-title", children: a.title }),
5162
- /* @__PURE__ */ o("div", { className: "history-when", children: new Date(a.at).toLocaleString() })
5163
- ] }),
5164
- /* @__PURE__ */ o("div", { className: "history-value num", children: a.primary })
5165
- ] }) }, r)) }) })
5166
- ] });
5167
- }
5168
- function mn(e, t) {
5169
- const n = t.toLowerCase(), a = n.indexOf(e);
5170
- if (a >= 0) return 100 - a;
5171
- let r = 0;
5172
- for (let s = 0; s < n.length && r < e.length; s++) n[s] === e[r] && r++;
5173
- return r === e.length ? 10 : -1;
5174
- }
5175
- function di({
5176
- calculators: e,
5177
- actions: t,
5178
- onPick: n,
5179
- onClose: a
5180
- }) {
5181
- const [r, s] = M(""), [u, m] = M(0), d = de(null);
5182
- X(() => {
5183
- var l;
5184
- return (l = d.current) == null ? void 0 : l.focus();
5185
- }, []), X(() => (ka(), () => wa()), []);
5186
- const i = ne(() => {
5187
- const l = e.map((y) => ({
5188
- key: `calc:${y.id}`,
5189
- label: y.title,
5190
- group: y.group,
5191
- hint: y.blurb,
5192
- run: () => n(y.id)
5193
- })), p = t.map((y) => ({ key: `act:${y.id}`, label: y.label, group: "action", hint: y.hint, run: y.run })), h = [...l, ...p], f = r.trim().toLowerCase();
5194
- return f ? h.map((y) => {
5195
- var w, k;
5196
- return { it: y, s: Math.max(mn(f, y.label), mn(f, `${y.group} ${((k = (w = e.find((S) => S.title === y.label)) == null ? void 0 : w.keywords) == null ? void 0 : k.join(" ")) ?? ""}`)) };
5197
- }).filter((y) => y.s > 0).sort((y, w) => w.s - y.s).map((y) => y.it) : h;
5198
- }, [r, e, t, n]);
5199
- return X(() => m(0), [r]), /* @__PURE__ */ o("div", { className: "palette-backdrop", onClick: a, children: /* @__PURE__ */ b("div", { className: "palette", role: "dialog", "aria-label": "Command palette", onClick: (l) => l.stopPropagation(), children: [
5200
- /* @__PURE__ */ o(
5201
- "input",
5202
- {
5203
- ref: d,
5204
- className: "palette-input",
5205
- placeholder: "Search calculators and actions…",
5206
- value: r,
5207
- onChange: (l) => s(l.target.value),
5208
- onKeyDown: (l) => {
5209
- var p;
5210
- l.key === "ArrowDown" ? (l.preventDefault(), m((h) => Math.min(h + 1, i.length - 1))) : l.key === "ArrowUp" ? (l.preventDefault(), m((h) => Math.max(h - 1, 0))) : l.key === "Enter" ? (l.preventDefault(), (p = i[u]) == null || p.run()) : l.key === "Escape" && (l.preventDefault(), l.stopPropagation(), a());
5211
- },
5212
- "aria-label": "Search"
5213
- }
5214
- ),
5215
- /* @__PURE__ */ b("ul", { className: "palette-list", role: "listbox", children: [
5216
- i.length === 0 && /* @__PURE__ */ o("li", { className: "palette-empty", children: "No matches" }),
5217
- i.map((l, p) => /* @__PURE__ */ b(
5218
- "li",
5219
- {
5220
- role: "option",
5221
- "aria-selected": p === u,
5222
- className: `palette-item ${p === u ? "active" : ""}`,
5223
- onMouseEnter: () => m(p),
5224
- onClick: () => l.run(),
5225
- children: [
5226
- /* @__PURE__ */ o("span", { className: "palette-label", children: l.label }),
5227
- /* @__PURE__ */ o("span", { className: "palette-group", children: l.group })
5228
- ]
5229
- },
5230
- l.key
5231
- ))
5232
- ] })
5233
- ] }) });
5234
- }
5235
- const ct = (e) => ({
5236
- width: e,
5237
- height: e,
5238
- viewBox: "0 0 24 24",
5239
- fill: "none",
5240
- stroke: "currentColor",
5241
- strokeWidth: 2,
5242
- strokeLinecap: "round",
5243
- strokeLinejoin: "round",
5244
- "aria-hidden": !0
5245
- });
5246
- function mi({ size: e = 17 }) {
5247
- return /* @__PURE__ */ b("svg", { ...ct(e), children: [
5248
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "3" }),
5249
- /* @__PURE__ */ o("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
5250
- ] });
5251
- }
5252
- function pi({ size: e = 17 }) {
5253
- return /* @__PURE__ */ b("svg", { ...ct(e), children: [
5254
- /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "4" }),
5255
- /* @__PURE__ */ o("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
5256
- ] });
5257
- }
5258
- function hi({ size: e = 17 }) {
5259
- return /* @__PURE__ */ o("svg", { ...ct(e), children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
5260
- }
5261
- function fi({ size: e = 17 }) {
5262
- return /* @__PURE__ */ b("svg", { ...ct(e), children: [
5263
- /* @__PURE__ */ o("path", { d: "M3 3v5h5" }),
5264
- /* @__PURE__ */ o("path", { d: "M3.05 13A9 9 0 1 0 6 5.3L3 8" }),
5265
- /* @__PURE__ */ o("path", { d: "M12 7v5l4 2" })
5266
- ] });
5267
- }
5268
- class z extends Error {
5269
- constructor(n, a = { code: "transport_error" }) {
5270
- super(n);
5271
- ge(this, "code");
5272
- ge(this, "status");
5273
- /** The request that failed, auth redacted. */
5274
- ge(this, "request");
5275
- this.name = "TransportError", this.code = a.code, this.status = a.status ?? 0, this.request = a.request;
5276
- }
5277
- }
5278
- const yi = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"], bi = {
5279
- attempts: 3,
5280
- backoff: "exponential",
5281
- baseDelayMs: 300,
5282
- retryOn: [408, 429, 500, 502, 503, 504],
5283
- respectRetryAfter: !0
5284
- }, gi = {
5285
- enabled: !0,
5286
- headerName: "Idempotency-Key",
5287
- keyFrom: "inputsHash"
5288
- }, vi = {
5289
- enabled: !0,
5290
- storage: "memory",
5291
- maxItems: 200,
5292
- flushOn: "manual"
5293
- }, pn = () => {
5294
- try {
5295
- return typeof localStorage < "u" && localStorage != null;
5296
- } catch {
5297
- return !1;
5298
- }
5299
- };
5300
- function ra() {
5301
- const e = globalThis.crypto;
5302
- return e != null && e.randomUUID ? e.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
5303
- const n = Math.random() * 16 | 0;
5304
- return (t === "x" ? n : n & 3 | 8).toString(16);
5305
- });
5306
- }
5307
- const hn = (e) => new Promise((t) => setTimeout(t, Math.max(0, e)));
5308
- function ki(e) {
5309
- let t = String(e).replace(/[\\/]+/g, "-").replace(/[\x00-\x1f\x7f]+/g, "").replace(/[<>:"|?*]+/g, "").replace(/^\.+/, "");
5310
- return t = t.trim(), t || "file";
5024
+ const pn = (e) => new Promise((t) => setTimeout(t, Math.max(0, e)));
5025
+ function pi(e) {
5026
+ let t = String(e).replace(/[\\/]+/g, "-").replace(/[\x00-\x1f\x7f]+/g, "").replace(/[<>:"|?*]+/g, "").replace(/^\.+/, "");
5027
+ return t = t.trim(), t || "file";
5311
5028
  }
5312
5029
  function oa(e, t) {
5313
5030
  var m;
5314
5031
  const n = /* @__PURE__ */ new Date(), a = (d) => String(d).padStart(2, "0"), r = (((m = t.filename) == null ? void 0 : m.split(".").pop()) || t.kind || "bin").toLowerCase(), s = (t.inputsHash || "").replace(/^sha256:/, "").slice(0, 8) || "00000000", u = e.replace(/\{calculator\}/g, t.calculator || "calc").replace(/\{yyyy\}/g, String(n.getFullYear())).replace(/\{MM\}/g, a(n.getMonth() + 1)).replace(/\{dd\}/g, a(n.getDate())).replace(/\{hash8\}/g, s).replace(/\{ext\}/g, r).replace(/\{kind\}/g, t.kind || "file");
5315
- return ki(u);
5032
+ return pi(u);
5316
5033
  }
5317
5034
  function Mt(e, t = []) {
5318
- const n = /* @__PURE__ */ new Set([...yi, ...t.map((r) => r.toLowerCase())]), a = {};
5035
+ const n = /* @__PURE__ */ new Set([...ci, ...t.map((r) => r.toLowerCase())]), a = {};
5319
5036
  for (const [r, s] of Object.entries(e)) a[r] = n.has(r.toLowerCase()) ? "***" : s;
5320
5037
  return a;
5321
5038
  }
5322
- class wi {
5039
+ class hi {
5323
5040
  constructor(t, n) {
5324
5041
  ge(this, "items", []);
5325
5042
  ge(this, "key");
5326
5043
  this.cfg = t, this.key = `${n}:transport:queue`, this.load();
5327
5044
  }
5328
5045
  load() {
5329
- if (this.cfg.storage === "localStorage" && pn())
5046
+ if (this.cfg.storage === "localStorage" && mn())
5330
5047
  try {
5331
5048
  this.items = JSON.parse(localStorage.getItem(this.key) || "[]");
5332
5049
  } catch {
@@ -5334,7 +5051,7 @@ class wi {
5334
5051
  }
5335
5052
  }
5336
5053
  save() {
5337
- if (this.cfg.storage === "localStorage" && pn())
5054
+ if (this.cfg.storage === "localStorage" && mn())
5338
5055
  try {
5339
5056
  localStorage.setItem(this.key, JSON.stringify(this.items));
5340
5057
  } catch {
@@ -5368,13 +5085,13 @@ class wi {
5368
5085
  return this.save(), { flushed: n, failed: a };
5369
5086
  }
5370
5087
  }
5371
- const fn = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
5372
- function Ni(e) {
5373
- const t = e.fetch ?? globalThis.fetch, n = { ...bi, ...e.retry }, a = { ...gi, ...e.idempotency }, r = { ...vi, ...e.offlineQueue }, s = e.timeoutMs ?? 15e3, u = e.credentials ?? "same-origin", m = new wi(r, "calcsuite");
5088
+ const hn = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
5089
+ function fi(e) {
5090
+ const t = e.fetch ?? globalThis.fetch, n = { ...ui, ...e.retry }, a = { ...di, ...e.idempotency }, r = { ...mi, ...e.offlineQueue }, s = e.timeoutMs ?? 15e3, u = e.credentials ?? "same-origin", m = new hi(r, "calcsuite");
5374
5091
  function d(N, P) {
5375
5092
  const x = e.endpoints[N];
5376
5093
  if (!x) throw new z(`Endpoint "${N}" is not configured`, { code: "no_endpoint" });
5377
- let T = /^https?:\/\//i.test(x) ? x : xi(e.baseUrl, x);
5094
+ let T = /^https?:\/\//i.test(x) ? x : yi(e.baseUrl, x);
5378
5095
  return P != null && (T = T.replace(/:id\b/, encodeURIComponent(P))), T;
5379
5096
  }
5380
5097
  function i() {
@@ -5387,9 +5104,9 @@ function Ni(e) {
5387
5104
  }
5388
5105
  function l(N, P, x) {
5389
5106
  if (!a.enabled || x) return x;
5390
- if (fn.has(yn(N))) {
5107
+ if (hn.has(fn(N))) {
5391
5108
  if (a.keyFrom === "inputsHash") {
5392
- const T = Ci(P);
5109
+ const T = gi(P);
5393
5110
  if (T) return T;
5394
5111
  }
5395
5112
  return ra();
@@ -5419,21 +5136,21 @@ function Ni(e) {
5419
5136
  }
5420
5137
  async function f(N, P = {}) {
5421
5138
  var B, G, q, A;
5422
- const x = yn(N), T = Si(d(N, P.pathParam), P.query), $ = l(N, P.body, P.idempotencyKey);
5139
+ const x = fn(N), T = bi(d(N, P.pathParam), P.query), $ = l(N, P.body, P.idempotencyKey);
5423
5140
  let L;
5424
5141
  for (let I = 1; I <= Math.max(1, n.attempts); I++) {
5425
- const E = await c(), j = {
5142
+ const R = await c(), j = {
5426
5143
  "content-type": "application/json",
5427
5144
  ...i(),
5428
5145
  ...P.headers ?? {},
5429
- ...E.headers
5146
+ ...R.headers
5430
5147
  };
5431
5148
  $ && (j[a.headerName] = $);
5432
- const Y = Mt(j, E.keys);
5149
+ const Y = Mt(j, R.keys);
5433
5150
  let V = P.body;
5434
5151
  const Q = { endpoint: String(N), method: x, url: T, headers: Y, body: V, attempt: I };
5435
5152
  e.transformRequest && V !== void 0 && (V = e.transformRequest(V, Q)), (B = e.onRequest) == null || B.call(e, Q);
5436
- const Re = bn();
5153
+ const Ee = yn();
5437
5154
  try {
5438
5155
  const K = await p(
5439
5156
  T,
@@ -5446,14 +5163,14 @@ function Ni(e) {
5446
5163
  P.signal
5447
5164
  );
5448
5165
  if (!K.ok && n.retryOn.includes(K.status) && I < n.attempts) {
5449
- await hn(h(I, K));
5166
+ await pn(h(I, K));
5450
5167
  continue;
5451
5168
  }
5452
5169
  const pe = await ia(K), Me = {
5453
5170
  ...Q,
5454
5171
  status: K.status,
5455
5172
  ok: K.ok,
5456
- durationMs: bn() - Re,
5173
+ durationMs: yn() - Ee,
5457
5174
  data: pe
5458
5175
  };
5459
5176
  if ((G = e.onResponse) == null || G.call(e, Me), !K.ok) {
@@ -5468,10 +5185,10 @@ function Ni(e) {
5468
5185
  } catch (K) {
5469
5186
  if (L = K, K instanceof z && K.code === "http_error") throw K;
5470
5187
  if (I < n.attempts) {
5471
- await hn(h(I));
5188
+ await pn(h(I));
5472
5189
  continue;
5473
5190
  }
5474
- if (r.enabled && fn.has(x))
5191
+ if (r.enabled && hn.has(x))
5475
5192
  return { queued: !0, id: m.enqueue({
5476
5193
  endpoint: String(N),
5477
5194
  method: x,
@@ -5488,7 +5205,7 @@ function Ni(e) {
5488
5205
  }
5489
5206
  async function y(N, P, x = {}) {
5490
5207
  const T = e.upload;
5491
- Ti(N, P, T.accept, T.maxBytes);
5208
+ ki(N, P, T.accept, T.maxBytes);
5492
5209
  const $ = P.filename ?? oa(T.filenameTemplate, P), L = { ...P, filename: $, bytes: N.size, contentType: P.contentType ?? sa(N) };
5493
5210
  if (T.beforeUpload && !await T.beforeUpload(N, L))
5494
5211
  throw new z("Upload cancelled by host", { code: "upload_cancelled" });
@@ -5520,10 +5237,10 @@ function Ni(e) {
5520
5237
  { method: "POST", credentials: u, headers: B, body: $ },
5521
5238
  x.signal
5522
5239
  );
5523
- return Pi(G);
5240
+ return vi(G);
5524
5241
  }
5525
5242
  async function S(N, P, x) {
5526
- const T = await Fi(N);
5243
+ const T = await wi(N);
5527
5244
  return f("upload", {
5528
5245
  ...x,
5529
5246
  body: {
@@ -5594,7 +5311,7 @@ function Ni(e) {
5594
5311
  }
5595
5312
  };
5596
5313
  }
5597
- function yn(e) {
5314
+ function fn(e) {
5598
5315
  switch (e) {
5599
5316
  case "save":
5600
5317
  case "upload":
@@ -5607,20 +5324,20 @@ function yn(e) {
5607
5324
  return "GET";
5608
5325
  }
5609
5326
  }
5610
- function bn() {
5327
+ function yn() {
5611
5328
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
5612
5329
  }
5613
- function xi(e, t) {
5330
+ function yi(e, t) {
5614
5331
  return e ? `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : t;
5615
5332
  }
5616
- function Si(e, t) {
5333
+ function bi(e, t) {
5617
5334
  if (!t) return e;
5618
5335
  const n = [];
5619
5336
  for (const [a, r] of Object.entries(t))
5620
5337
  r == null || r === "" || n.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(r))}`);
5621
5338
  return n.length ? e + (e.includes("?") ? "&" : "?") + n.join("&") : e;
5622
5339
  }
5623
- function Ci(e) {
5340
+ function gi(e) {
5624
5341
  var a;
5625
5342
  if (!e || typeof e != "object") return;
5626
5343
  const t = e, n = ((a = t == null ? void 0 : t.meta) == null ? void 0 : a.inputsHash) ?? (t == null ? void 0 : t.inputsHash);
@@ -5634,21 +5351,21 @@ async function ia(e) {
5634
5351
  return null;
5635
5352
  }
5636
5353
  }
5637
- async function Pi(e) {
5354
+ async function vi(e) {
5638
5355
  if (!e.ok) throw new z(`Upload failed (${e.status})`, { code: "upload_failed", status: e.status });
5639
5356
  return ia(e);
5640
5357
  }
5641
5358
  function sa(e) {
5642
5359
  return e.type || "application/octet-stream";
5643
5360
  }
5644
- function Ti(e, t, n, a) {
5361
+ function ki(e, t, n, a) {
5645
5362
  if (e.size > a)
5646
5363
  throw new z(`File exceeds ${a} bytes`, { code: "too_large" });
5647
5364
  const r = t.contentType ?? sa(e);
5648
5365
  if (n.length && r && !n.includes(r))
5649
5366
  throw new z(`Content type ${r} not accepted`, { code: "bad_type" });
5650
5367
  }
5651
- async function Fi(e) {
5368
+ async function wi(e) {
5652
5369
  const t = await e.arrayBuffer(), n = new Uint8Array(t);
5653
5370
  if (typeof btoa == "function") {
5654
5371
  let r = "";
@@ -5668,7 +5385,7 @@ function We(e, t) {
5668
5385
  }
5669
5386
  return n;
5670
5387
  }
5671
- function gn(e, t, n) {
5388
+ function bn(e, t, n) {
5672
5389
  const a = t.split(".");
5673
5390
  let r = e;
5674
5391
  for (let s = 0; s < a.length - 1; s++) {
@@ -5677,15 +5394,15 @@ function gn(e, t, n) {
5677
5394
  }
5678
5395
  r[a[a.length - 1]] = n;
5679
5396
  }
5680
- function Ii(e, t) {
5397
+ function Ni(e, t) {
5681
5398
  if (t === "asIs") return e;
5682
5399
  const n = e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-\s]+/g, " ").trim().split(" ").filter(Boolean);
5683
5400
  return n.length === 0 ? e : t === "snake" ? n.map((a) => a.toLowerCase()).join("_") : t === "kebab" ? n.map((a) => a.toLowerCase()).join("-") : n.map((a, r) => r === 0 ? a.toLowerCase() : a[0].toUpperCase() + a.slice(1).toLowerCase()).join("");
5684
5401
  }
5685
- function vn(e, t) {
5686
- return e.split(".").map((n) => Ii(n, t)).join(".");
5402
+ function gn(e, t) {
5403
+ return e.split(".").map((n) => Ni(n, t)).join(".");
5687
5404
  }
5688
- function Ei(e, t) {
5405
+ function xi(e, t) {
5689
5406
  switch (t) {
5690
5407
  case "toFixed2":
5691
5408
  return Number(e).toFixed(2);
@@ -5702,11 +5419,11 @@ function Ei(e, t) {
5702
5419
  return e;
5703
5420
  }
5704
5421
  }
5705
- function Ri(e, t) {
5422
+ function Si(e, t) {
5706
5423
  const n = e instanceof Date ? e : new Date(e);
5707
5424
  return Number.isNaN(n.getTime()) ? String(e) : n.toISOString();
5708
5425
  }
5709
- function Mi(e, t, n) {
5426
+ function Ci(e, t, n) {
5710
5427
  switch (t) {
5711
5428
  case "number": {
5712
5429
  if (n.numberEncoding === "number") {
@@ -5718,7 +5435,7 @@ function Mi(e, t, n) {
5718
5435
  case "boolean":
5719
5436
  return typeof e == "string" ? e.toLowerCase() === "true" : !!e;
5720
5437
  case "date":
5721
- return Ri(e, n.dateFormat);
5438
+ return Si(e, n.dateFormat);
5722
5439
  case "json":
5723
5440
  return e;
5724
5441
  case "string":
@@ -5737,7 +5454,7 @@ function nt(e, t) {
5737
5454
  }
5738
5455
  return e;
5739
5456
  }
5740
- function $i(e, t) {
5457
+ function Pi(e, t) {
5741
5458
  var n;
5742
5459
  switch (e.kind) {
5743
5460
  case "static":
@@ -5758,22 +5475,22 @@ function $i(e, t) {
5758
5475
  return;
5759
5476
  }
5760
5477
  }
5761
- function Ai(e, t, n) {
5478
+ function Ti(e, t, n) {
5762
5479
  const a = {};
5763
5480
  for (const u of e) {
5764
- let m = $i(u.source, n);
5481
+ let m = Pi(u.source, n);
5765
5482
  const d = m === "" || m == null;
5766
5483
  if (u.omitWhenEmpty && d) continue;
5767
- const i = vn(u.key, t.keyCase);
5484
+ const i = gn(u.key, t.keyCase);
5768
5485
  if (d) {
5769
5486
  if (t.nullHandling === "omit") continue;
5770
- gn(a, i, null);
5487
+ bn(a, i, null);
5771
5488
  continue;
5772
5489
  }
5773
- u.transform && u.transform !== "none" && (m = Ei(m, u.transform)), gn(a, i, Mi(m, u.type, t));
5490
+ u.transform && u.transform !== "none" && (m = xi(m, u.transform)), bn(a, i, Ci(m, u.type, t));
5774
5491
  }
5775
5492
  const r = t.include, s = (u, m) => {
5776
- m !== void 0 && (a[vn(u, t.keyCase)] = nt(m, t.numberEncoding));
5493
+ m !== void 0 && (a[gn(u, t.keyCase)] = nt(m, t.numberEncoding));
5777
5494
  };
5778
5495
  return r != null && r.inputs && s("inputs", n.inputs), r != null && r.outputs && s("outputs", n.outputs), r != null && r.schedule && s("schedule", n.schedule), r != null && r.settingsSnapshot && s("settingsSnapshot", n.settings), r != null && r.meta && s("meta", n.context), t.numberEncoding === "number" && console.warn('[fincalc] numberEncoding="number" reintroduces float error; prefer "string".'), t.mode === "wrapped" && t.wrapperKey ? { [t.wrapperKey]: a } : a;
5779
5496
  }
@@ -5785,7 +5502,7 @@ const ys = {
5785
5502
  numberEncoding: "string",
5786
5503
  include: { inputs: !0, outputs: !0, schedule: !1, settingsSnapshot: !0, meta: !0 }
5787
5504
  };
5788
- function kn(e) {
5505
+ function vn(e) {
5789
5506
  return nt(e, "string");
5790
5507
  }
5791
5508
  function bs(e) {
@@ -5800,7 +5517,7 @@ function bs(e) {
5800
5517
  locale: e.locale ?? t.locale,
5801
5518
  ...e.title ? { title: e.title } : {},
5802
5519
  ...e.tags && e.tags.length ? { tags: e.tags } : {},
5803
- inputs: kn(e.inputs),
5520
+ inputs: vn(e.inputs),
5804
5521
  settingsSnapshot: {
5805
5522
  rounding: {
5806
5523
  money: t.rounding.money,
@@ -5813,7 +5530,7 @@ function bs(e) {
5813
5530
  dayCount: t.dayCount,
5814
5531
  numberFormat: { grouping: t.numberFormat.grouping, decimalPlaces: t.numberFormat.decimalPlaces }
5815
5532
  },
5816
- outputs: kn(e.outputs),
5533
+ outputs: vn(e.outputs),
5817
5534
  meta: {
5818
5535
  inputsHash: e.inputsHash,
5819
5536
  computedAt: e.computedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -5822,17 +5539,17 @@ function bs(e) {
5822
5539
  warnings: e.warnings ?? []
5823
5540
  },
5824
5541
  ...e.attachments && e.attachments.length ? { attachments: e.attachments } : {},
5825
- client: { tz: e.clientTz ?? Di(), platform: "web" }
5542
+ client: { tz: e.clientTz ?? Fi(), platform: "web" }
5826
5543
  };
5827
5544
  }
5828
- function Di() {
5545
+ function Fi() {
5829
5546
  try {
5830
5547
  return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
5831
5548
  } catch {
5832
5549
  return "UTC";
5833
5550
  }
5834
5551
  }
5835
- const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "rates", "settings"], Li = {
5552
+ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "rates", "settings"], Ii = {
5836
5553
  save: "POST",
5837
5554
  update: "PUT",
5838
5555
  get: "GET",
@@ -5842,7 +5559,7 @@ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "r
5842
5559
  uploadUrl: "GET",
5843
5560
  rates: "GET",
5844
5561
  settings: "GET"
5845
- }, la = ["bearer", "apiKeyHeader", "basic", "custom"], Ui = {
5562
+ }, la = ["bearer", "apiKeyHeader", "basic", "custom"], Ri = {
5846
5563
  strategy: "multipart",
5847
5564
  fieldName: "file",
5848
5565
  maxBytes: 10 * 1024 * 1024,
@@ -5854,7 +5571,7 @@ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "r
5854
5571
  function ca() {
5855
5572
  const e = {};
5856
5573
  for (const t of He)
5857
- e[t] = { path: `/calculations${t === "save" || t === "list" ? "" : t === "get" || t === "update" || t === "delete" ? "/:id" : "/" + t}`, method: Li[t], enabled: t === "save" || t === "list" };
5574
+ e[t] = { path: `/calculations${t === "save" || t === "list" ? "" : t === "get" || t === "update" || t === "delete" ? "/:id" : "/" + t}`, method: Ii[t], enabled: t === "save" || t === "list" };
5858
5575
  return {
5859
5576
  baseUrl: "https://api.example.com/v1",
5860
5577
  auth: { strategy: "bearer", headerName: "Authorization" },
@@ -5862,17 +5579,17 @@ function ca() {
5862
5579
  credentials: "same-origin",
5863
5580
  retry: { attempts: 3, backoff: "exponential", baseDelayMs: 300, retryOn: [408, 429, 500, 502, 503, 504], respectRetryAfter: !0 },
5864
5581
  endpoints: e,
5865
- upload: Ui
5582
+ upload: Ri
5866
5583
  };
5867
5584
  }
5868
- const Oi = {
5585
+ const Ei = {
5869
5586
  mode: "flat",
5870
5587
  keyCase: "asIs",
5871
5588
  dateFormat: "iso",
5872
5589
  nullHandling: "omit",
5873
5590
  numberEncoding: "string",
5874
5591
  include: { inputs: !0, outputs: !0, schedule: !1, settingsSnapshot: !0, meta: !0 }
5875
- }, Bi = [
5592
+ }, Mi = [
5876
5593
  { key: "calculator", source: { kind: "context", path: "calculator" }, type: "string", required: !0, omitWhenEmpty: !1 },
5877
5594
  { key: "principal", source: { kind: "input", path: "principal" }, type: "number", required: !0, omitWhenEmpty: !1 },
5878
5595
  { key: "payment", source: { kind: "output", path: "payment" }, type: "number", required: !1, omitWhenEmpty: !1 },
@@ -5883,7 +5600,7 @@ const Oi = {
5883
5600
  calculator: "loan.emi",
5884
5601
  inputsHash: "sha256:9f2c1a44e0"
5885
5602
  };
5886
- function wn(e) {
5603
+ function kn(e) {
5887
5604
  if (e < 1024) return `${e} B`;
5888
5605
  const t = ["KB", "MB", "GB"];
5889
5606
  let n = e / 1024, a = 0;
@@ -5909,9 +5626,9 @@ function ua(e, t, n) {
5909
5626
  function qe(e, t) {
5910
5627
  return t ? /^https?:\/\//i.test(t) ? t : `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : e;
5911
5628
  }
5912
- const _i = ["Connection", "Endpoints", "Upload", "Payload", "Test", "cURL", "Queue"];
5913
- function Hi({ hostConfig: e, getToken: t } = {}) {
5914
- const { settings: n } = ue(), [a, r] = M("Connection"), [s, u] = M(ca), [m, d] = M(Oi), [i, c] = M(Bi);
5629
+ const $i = ["Connection", "Endpoints", "Upload", "Payload", "Test", "cURL", "Queue"];
5630
+ function da({ hostConfig: e, getToken: t } = {}) {
5631
+ const { settings: n } = ue(), [a, r] = M("Connection"), [s, u] = M(ca), [m, d] = M(Ei), [i, c] = M(Mi);
5915
5632
  if (!n.features.integrationPanel)
5916
5633
  return /* @__PURE__ */ o("section", { className: "card", "data-part": "integration-panel", children: /* @__PURE__ */ b("div", { className: "panel-head", children: [
5917
5634
  /* @__PURE__ */ o("h2", { children: "Integration" }),
@@ -5933,12 +5650,12 @@ function Hi({ hostConfig: e, getToken: t } = {}) {
5933
5650
  /* @__PURE__ */ o("h2", { children: "Integration" }),
5934
5651
  /* @__PURE__ */ o("p", { children: "Point the library at your backend without a code change. Nothing here stores a secret." })
5935
5652
  ] }),
5936
- /* @__PURE__ */ o("div", { className: "tabs", role: "tablist", "aria-label": "Integration settings", children: _i.map((f) => /* @__PURE__ */ o("button", { role: "tab", "aria-selected": a === f, onClick: () => r(f), children: f }, f)) }),
5653
+ /* @__PURE__ */ o("div", { className: "tabs", role: "tablist", "aria-label": "Integration settings", children: $i.map((f) => /* @__PURE__ */ o("button", { role: "tab", "aria-selected": a === f, onClick: () => r(f), children: f }, f)) }),
5937
5654
  /* @__PURE__ */ b("div", { role: "tabpanel", "aria-label": a, children: [
5938
- a === "Connection" && /* @__PURE__ */ o(qi, { cfg: s, patch: p, hostLocked: l, getToken: t }),
5939
- a === "Endpoints" && /* @__PURE__ */ o(Gi, { cfg: s, setCfg: u, locked: l("endpoints") }),
5655
+ a === "Connection" && /* @__PURE__ */ o(Ai, { cfg: s, patch: p, hostLocked: l, getToken: t }),
5656
+ a === "Endpoints" && /* @__PURE__ */ o(Di, { cfg: s, setCfg: u, locked: l("endpoints") }),
5940
5657
  a === "Upload" && /* @__PURE__ */ o(
5941
- ji,
5658
+ Li,
5942
5659
  {
5943
5660
  upload: s.upload,
5944
5661
  baseUrl: s.baseUrl,
@@ -5948,7 +5665,7 @@ function Hi({ hostConfig: e, getToken: t } = {}) {
5948
5665
  }
5949
5666
  ),
5950
5667
  a === "Payload" && /* @__PURE__ */ o(
5951
- zi,
5668
+ Hi,
5952
5669
  {
5953
5670
  fields: i,
5954
5671
  setFields: c,
@@ -5957,11 +5674,11 @@ function Hi({ hostConfig: e, getToken: t } = {}) {
5957
5674
  ctx: h
5958
5675
  }
5959
5676
  ),
5960
- a === "Test" && /* @__PURE__ */ o(Zi, { cfg: s, getToken: t }),
5961
- a === "cURL" && /* @__PURE__ */ o(Xi, { cfg: s }),
5962
- a === "Queue" && /* @__PURE__ */ o(Qi, { cfg: s, getToken: t })
5677
+ a === "Test" && /* @__PURE__ */ o(Gi, { cfg: s, getToken: t }),
5678
+ a === "cURL" && /* @__PURE__ */ o(ji, { cfg: s }),
5679
+ a === "Queue" && /* @__PURE__ */ o(Vi, { cfg: s, getToken: t })
5963
5680
  ] }),
5964
- /* @__PURE__ */ o(es, { cfg: s, setCfg: u })
5681
+ /* @__PURE__ */ o(Yi, { cfg: s, setCfg: u })
5965
5682
  ] });
5966
5683
  }
5967
5684
  function Fe({ on: e, children: t }) {
@@ -6012,7 +5729,7 @@ function le({
6012
5729
  /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: t, onChange: (s) => a(s.target.value), "aria-label": e, children: r.map((s) => /* @__PURE__ */ o("option", { value: s.value, children: s.label }, s.value)) }) })
6013
5730
  ] });
6014
5731
  }
6015
- function qi({
5732
+ function Ai({
6016
5733
  cfg: e,
6017
5734
  patch: t,
6018
5735
  hostLocked: n,
@@ -6071,7 +5788,7 @@ function qi({
6071
5788
  )
6072
5789
  ] });
6073
5790
  }
6074
- function Gi({ cfg: e, setCfg: t, locked: n }) {
5791
+ function Di({ cfg: e, setCfg: t, locked: n }) {
6075
5792
  const a = (r, s) => t((u) => ({ ...u, endpoints: { ...u.endpoints, [r]: { ...u.endpoints[r], ...s } } }));
6076
5793
  return /* @__PURE__ */ o(Fe, { on: n, children: /* @__PURE__ */ o("div", { className: "int-table-wrap", children: /* @__PURE__ */ b("table", { className: "int-table", children: [
6077
5794
  /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ b("tr", { children: [
@@ -6094,7 +5811,7 @@ function Gi({ cfg: e, setCfg: t, locked: n }) {
6094
5811
  }) })
6095
5812
  ] }) }) });
6096
5813
  }
6097
- function ji({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5814
+ function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
6098
5815
  var m, d, i;
6099
5816
  const s = (c) => a({ ...e, ...c }), u = ne(
6100
5817
  () => oa(e.filenameTemplate, { calculator: "loan.emi", kind: "pdf", inputsHash: Ue.inputsHash, filename: "x.pdf" }),
@@ -6104,7 +5821,7 @@ function ji({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
6104
5821
  /* @__PURE__ */ o(te, { label: "Upload URI", value: n, readOnly: !0, help: "Resolved from baseUrl + the 'upload' endpoint path (edit it under Endpoints)" }),
6105
5822
  /* @__PURE__ */ o(le, { label: "Strategy", value: e.strategy, options: ["multipart", "presigned", "base64Json"], onChange: (c) => s({ strategy: c }) }),
6106
5823
  /* @__PURE__ */ o(te, { label: "Field name", value: e.fieldName, onChange: (c) => s({ fieldName: c }) }),
6107
- /* @__PURE__ */ o(te, { label: "Max bytes", type: "number", value: String(e.maxBytes), onChange: (c) => s({ maxBytes: Number(c) || 0 }), affix: wn(e.maxBytes) }),
5824
+ /* @__PURE__ */ o(te, { label: "Max bytes", type: "number", value: String(e.maxBytes), onChange: (c) => s({ maxBytes: Number(c) || 0 }), affix: kn(e.maxBytes) }),
6108
5825
  /* @__PURE__ */ b("div", { className: "field span2", children: [
6109
5826
  /* @__PURE__ */ o(te, { label: "Filename template", value: e.filenameTemplate, onChange: (c) => s({ filenameTemplate: c }), help: "{calculator} {yyyy} {MM} {dd} {hash8} {ext}" }),
6110
5827
  /* @__PURE__ */ b("div", { className: "int-note mono", children: [
@@ -6132,7 +5849,7 @@ function ji({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
6132
5849
  }
6133
5850
  )
6134
5851
  ] }),
6135
- ((i = e.chunked) == null ? void 0 : i.enabled) && /* @__PURE__ */ o(te, { label: "Chunk size", type: "number", value: String(e.chunked.chunkBytes), onChange: (c) => s({ chunked: { enabled: !0, chunkBytes: Number(c) || 1 } }), affix: wn(e.chunked.chunkBytes) }),
5852
+ ((i = e.chunked) == null ? void 0 : i.enabled) && /* @__PURE__ */ o(te, { label: "Chunk size", type: "number", value: String(e.chunked.chunkBytes), onChange: (c) => s({ chunked: { enabled: !0, chunkBytes: Number(c) || 1 } }), affix: kn(e.chunked.chunkBytes) }),
6136
5853
  e.strategy === "presigned" && /* @__PURE__ */ b("div", { className: "span2 int-subform", children: [
6137
5854
  /* @__PURE__ */ b("div", { className: "int-note", children: [
6138
5855
  /* @__PURE__ */ o("strong", { children: "Presigned sub-form" }),
@@ -6149,14 +5866,14 @@ function ji({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
6149
5866
  ] })
6150
5867
  ] }) });
6151
5868
  }
6152
- const Vi = ["static", "input", "output", "setting", "context", "token", "callback"];
6153
- function Yi(e) {
5869
+ const Ui = ["static", "input", "output", "setting", "context", "token", "callback"];
5870
+ function Oi(e) {
6154
5871
  return e.kind === "static" ? String(e.value) : e.kind === "token" ? e.name : e.kind === "callback" ? "fn()" : e.path;
6155
5872
  }
6156
- function Ki(e, t) {
5873
+ function Bi(e, t) {
6157
5874
  return e.kind === "static" ? { kind: "static", value: t } : e.kind === "token" ? { kind: "token", name: t } : e.kind === "callback" ? e : { kind: e.kind, path: t };
6158
5875
  }
6159
- function Wi(e) {
5876
+ function _i(e) {
6160
5877
  switch (e) {
6161
5878
  case "static":
6162
5879
  return { kind: "static", value: "" };
@@ -6168,7 +5885,7 @@ function Wi(e) {
6168
5885
  return { kind: e, path: "" };
6169
5886
  }
6170
5887
  }
6171
- function zi({
5888
+ function Hi({
6172
5889
  fields: e,
6173
5890
  setFields: t,
6174
5891
  envelope: n,
@@ -6177,7 +5894,7 @@ function zi({
6177
5894
  }) {
6178
5895
  const s = ne(() => {
6179
5896
  try {
6180
- return JSON.stringify(Ai(e, n, r), null, 2);
5897
+ return JSON.stringify(Ti(e, n, r), null, 2);
6181
5898
  } catch (i) {
6182
5899
  return `// ${i instanceof Error ? i.message : "preview failed"}`;
6183
5900
  }
@@ -6218,13 +5935,13 @@ function zi({
6218
5935
  ] }) }),
6219
5936
  /* @__PURE__ */ o("tbody", { children: e.map((i, c) => /* @__PURE__ */ b("tr", { children: [
6220
5937
  /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("input", { value: i.key, onChange: (l) => u(c, { key: l.target.value }), "aria-label": "key", className: "int-cell-input" }) }),
6221
- /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("select", { value: i.source.kind, onChange: (l) => u(c, { source: Wi(l.target.value) }), "aria-label": "source kind", children: Vi.map((l) => /* @__PURE__ */ o("option", { children: l }, l)) }) }),
5938
+ /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("select", { value: i.source.kind, onChange: (l) => u(c, { source: _i(l.target.value) }), "aria-label": "source kind", children: Ui.map((l) => /* @__PURE__ */ o("option", { children: l }, l)) }) }),
6222
5939
  /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(
6223
5940
  "input",
6224
5941
  {
6225
- value: Yi(i.source),
5942
+ value: Oi(i.source),
6226
5943
  disabled: i.source.kind === "callback",
6227
- onChange: (l) => u(c, { source: Ki(i.source, l.target.value) }),
5944
+ onChange: (l) => u(c, { source: Bi(i.source, l.target.value) }),
6228
5945
  "aria-label": "source value",
6229
5946
  className: "int-cell-input"
6230
5947
  }
@@ -6255,7 +5972,7 @@ function zi({
6255
5972
  ] })
6256
5973
  ] });
6257
5974
  }
6258
- function Ji(e, t) {
5975
+ function qi(e, t) {
6259
5976
  const n = {};
6260
5977
  for (const a of He) {
6261
5978
  const r = e.endpoints[a];
@@ -6272,7 +5989,7 @@ function Ji(e, t) {
6272
5989
  getAuth: t ? async () => ua(e.auth.strategy, e.auth.headerName, await t()) : void 0
6273
5990
  };
6274
5991
  }
6275
- function Zi({ cfg: e, getToken: t }) {
5992
+ function Gi({ cfg: e, getToken: t }) {
6276
5993
  const [n, a] = M({ loading: !1 }), [r, s] = M("save");
6277
5994
  return /* @__PURE__ */ b("div", { children: [
6278
5995
  /* @__PURE__ */ b("div", { className: "grid two", children: [
@@ -6284,7 +6001,7 @@ function Zi({ cfg: e, getToken: t }) {
6284
6001
  const c = performance.now();
6285
6002
  try {
6286
6003
  const l = await fetch(d, { method: m.method, headers: i, credentials: e.credentials }), p = await l.text(), h = {};
6287
- l.headers.forEach((f, y) => h[y] = f), a({ loading: !1, ok: l.ok, status: l.status, ms: Math.round(performance.now() - c), headers: h, body: ts(p), sent: { url: d, method: m.method, headers: Mt(i) } });
6004
+ l.headers.forEach((f, y) => h[y] = f), a({ loading: !1, ok: l.ok, status: l.status, ms: Math.round(performance.now() - c), headers: h, body: Ki(p), sent: { url: d, method: m.method, headers: Mt(i) } });
6288
6005
  } catch (l) {
6289
6006
  a({ loading: !1, ok: !1, ms: Math.round(performance.now() - c), error: l instanceof Error ? l.message : "request failed", sent: { url: d, method: m.method, headers: Mt(i) } });
6290
6007
  }
@@ -6314,7 +6031,7 @@ ${JSON.stringify(n.sent.headers, null, 2)}` })
6314
6031
  ] })
6315
6032
  ] });
6316
6033
  }
6317
- function Xi({ cfg: e }) {
6034
+ function ji({ cfg: e }) {
6318
6035
  const [t, n] = M(!1), [a, r] = M("save"), s = e.endpoints[a], u = qe(e.baseUrl, s.path).replace(/:id\b/, "sample-id"), m = { "content-type": "application/json" };
6319
6036
  la.includes(e.auth.strategy) && (m[e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom" ? e.auth.headerName || "X-API-Key" : "Authorization"] = t ? "<token>" : "***");
6320
6037
  const d = [`curl -X ${s.method} '${u}'`];
@@ -6337,8 +6054,8 @@ function Xi({ cfg: e }) {
6337
6054
  }, children: "Copy" })
6338
6055
  ] });
6339
6056
  }
6340
- function Qi({ cfg: e, getToken: t }) {
6341
- const n = ne(() => Ni(Ji(e, t)), [e, t]), [a, r] = M(() => n.queue.list()), [s, u] = M(""), m = () => r(n.queue.list());
6057
+ function Vi({ cfg: e, getToken: t }) {
6058
+ const n = ne(() => fi(qi(e, t)), [e, t]), [a, r] = M(() => n.queue.list()), [s, u] = M(""), m = () => r(n.queue.list());
6342
6059
  return /* @__PURE__ */ b("div", { children: [
6343
6060
  /* @__PURE__ */ b("div", { className: "actions-row", style: { marginTop: 0 }, children: [
6344
6061
  /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: m, children: "Refresh" }),
@@ -6367,7 +6084,7 @@ function Qi({ cfg: e, getToken: t }) {
6367
6084
  ] }) })
6368
6085
  ] });
6369
6086
  }
6370
- function es({ cfg: e, setCfg: t }) {
6087
+ function Yi({ cfg: e, setCfg: t }) {
6371
6088
  const [n, a] = M(""), [r, s] = M("");
6372
6089
  return /* @__PURE__ */ b("div", { className: "accordion", style: { marginTop: 20 }, children: [
6373
6090
  /* @__PURE__ */ o("span", { className: "lbl", children: "Import / export config (JSON)" }),
@@ -6390,16 +6107,308 @@ function es({ cfg: e, setCfg: t }) {
6390
6107
  r && /* @__PURE__ */ o("div", { className: "int-note", children: r })
6391
6108
  ] });
6392
6109
  }
6393
- function ts(e) {
6110
+ function Ki(e) {
6394
6111
  try {
6395
6112
  return JSON.stringify(JSON.parse(e), null, 2);
6396
6113
  } catch {
6397
6114
  return e;
6398
6115
  }
6399
6116
  }
6117
+ const Wi = "1234567.891";
6118
+ function zi() {
6119
+ const { settings: e, update: t, setRegion: n, reset: a, replace: r } = ue(), s = de(null), u = Sn(e).money(g(Wi)), m = () => {
6120
+ const i = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), c = URL.createObjectURL(i), l = document.createElement("a");
6121
+ l.href = c, l.download = "calcsuite-settings.json", l.click(), URL.revokeObjectURL(c);
6122
+ }, d = (i) => {
6123
+ const c = new FileReader();
6124
+ c.onload = () => {
6125
+ try {
6126
+ r(JSON.parse(String(c.result)));
6127
+ } catch {
6128
+ alert("Could not read that settings file.");
6129
+ }
6130
+ }, c.readAsText(i);
6131
+ };
6132
+ return /* @__PURE__ */ b("div", { className: "settings", children: [
6133
+ /* @__PURE__ */ b("div", { className: "panel-head", children: [
6134
+ /* @__PURE__ */ o("h2", { children: "Settings" }),
6135
+ /* @__PURE__ */ b("p", { children: [
6136
+ "Everything below updates the numbers live. Sample: ",
6137
+ /* @__PURE__ */ o("strong", { className: "num", children: u })
6138
+ ] })
6139
+ ] }),
6140
+ /* @__PURE__ */ b(Te, { title: "Region & currency", children: [
6141
+ /* @__PURE__ */ o(W, { label: "Region", children: /* @__PURE__ */ b("div", { className: "seg", children: [
6142
+ /* @__PURE__ */ o("button", { "aria-pressed": e.region === "IN", onClick: () => n("IN"), children: "🇮🇳 India" }),
6143
+ /* @__PURE__ */ o("button", { "aria-pressed": e.region === "US", onClick: () => n("US"), children: "🇺🇸 United States" })
6144
+ ] }) }),
6145
+ /* @__PURE__ */ o(W, { label: "Currency symbol", children: /* @__PURE__ */ o("input", { className: "mini", value: e.currency.symbol, onChange: (i) => t({ currency: { symbol: i.target.value } }) }) }),
6146
+ /* @__PURE__ */ o(W, { label: "Symbol position", children: /* @__PURE__ */ o(
6147
+ he,
6148
+ {
6149
+ value: e.currency.symbolPosition,
6150
+ onChange: (i) => t({ currency: { symbolPosition: i } }),
6151
+ options: [["prefix", "Prefix ₹100"], ["suffix", "Suffix 100₹"]]
6152
+ }
6153
+ ) })
6154
+ ] }),
6155
+ /* @__PURE__ */ b(Te, { title: "Number format", children: [
6156
+ /* @__PURE__ */ o(W, { label: "Grouping", children: /* @__PURE__ */ o(
6157
+ he,
6158
+ {
6159
+ value: e.numberFormat.grouping,
6160
+ onChange: (i) => t({ numberFormat: { grouping: i } }),
6161
+ options: [["indian", "Indian 12,34,567"], ["western", "Western 1,234,567"], ["european", "European 1.234.567"], ["swiss", "Swiss 1'234'567"], ["plain", "Plain 1234567"]]
6162
+ }
6163
+ ) }),
6164
+ /* @__PURE__ */ o(W, { label: "Decimal places", children: /* @__PURE__ */ o("div", { className: "seg", children: [0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ o("button", { "aria-pressed": e.numberFormat.decimalPlaces === i, onClick: () => t({ numberFormat: { decimalPlaces: i } }), children: i }, i)) }) }),
6165
+ /* @__PURE__ */ o(W, { label: "Abbreviate (12.5 L / 1.2 Cr)", children: /* @__PURE__ */ o(Le, { on: e.numberFormat.abbreviate, onClick: () => t({ numberFormat: { abbreviate: !e.numberFormat.abbreviate } }) }) }),
6166
+ /* @__PURE__ */ o(W, { label: "Abbreviation scale", children: /* @__PURE__ */ o(
6167
+ he,
6168
+ {
6169
+ value: e.numberFormat.abbreviationScale,
6170
+ onChange: (i) => t({ numberFormat: { abbreviationScale: i } }),
6171
+ options: [["indian", "Lakh / Crore"], ["western", "K / M / B"]]
6172
+ }
6173
+ ) }),
6174
+ /* @__PURE__ */ o(W, { label: "Negatives", children: /* @__PURE__ */ o(
6175
+ he,
6176
+ {
6177
+ value: e.numberFormat.negativeFormat,
6178
+ onChange: (i) => t({ numberFormat: { negativeFormat: i } }),
6179
+ options: [["minus", "-1,000"], ["parentheses", "(1,000)"]]
6180
+ }
6181
+ ) })
6182
+ ] }),
6183
+ /* @__PURE__ */ b(Te, { title: "Calculation", children: [
6184
+ /* @__PURE__ */ o(W, { label: "Rounding mode", children: /* @__PURE__ */ o(
6185
+ he,
6186
+ {
6187
+ value: e.rounding.mode,
6188
+ onChange: (i) => t({ rounding: { mode: i } }),
6189
+ options: [["HALF_UP", "Half up"], ["HALF_EVEN", "Half even (banker’s)"], ["HALF_DOWN", "Half down"], ["UP", "Up"], ["DOWN", "Down"], ["CEIL", "Ceil"], ["FLOOR", "Floor"]]
6190
+ }
6191
+ ) }),
6192
+ /* @__PURE__ */ o(W, { label: "Day-count convention", children: /* @__PURE__ */ o(
6193
+ he,
6194
+ {
6195
+ value: e.dayCount,
6196
+ onChange: (i) => t({ dayCount: i }),
6197
+ options: [["30/360", "30/360"], ["ACT/365", "ACT/365"], ["ACT/360", "ACT/360"], ["ACT/ACT", "ACT/ACT"], ["30E/360", "30E/360"]]
6198
+ }
6199
+ ) })
6200
+ ] }),
6201
+ /* @__PURE__ */ b(Te, { title: "Appearance", children: [
6202
+ /* @__PURE__ */ o(W, { label: "Theme", children: /* @__PURE__ */ o(
6203
+ he,
6204
+ {
6205
+ value: e.ui.theme,
6206
+ onChange: (i) => t({ ui: { theme: i } }),
6207
+ options: [["system", "System"], ["light", "Light"], ["dark", "Dark"], ["highContrast", "High contrast"]]
6208
+ }
6209
+ ) }),
6210
+ /* @__PURE__ */ o(W, { label: "Accent colour", children: /* @__PURE__ */ o("div", { className: "swatches", children: si.map((i) => {
6211
+ const c = e.ui.accent.toLowerCase() === i.main.toLowerCase();
6212
+ return /* @__PURE__ */ o(
6213
+ "button",
6214
+ {
6215
+ type: "button",
6216
+ className: `swatch ${c ? "active" : ""}`,
6217
+ style: { background: i.main },
6218
+ "aria-label": i.label,
6219
+ "aria-pressed": c,
6220
+ title: i.label,
6221
+ onClick: () => t({ ui: { accent: i.main } })
6222
+ },
6223
+ i.id
6224
+ );
6225
+ }) }) }),
6226
+ /* @__PURE__ */ o(W, { label: "Font", children: /* @__PURE__ */ o(
6227
+ he,
6228
+ {
6229
+ value: e.ui.fontFamily,
6230
+ onChange: (i) => t({ ui: { fontFamily: i } }),
6231
+ options: li.map((i) => [i.id, i.label])
6232
+ }
6233
+ ) }),
6234
+ /* @__PURE__ */ o(W, { label: "Density", children: /* @__PURE__ */ o(
6235
+ he,
6236
+ {
6237
+ value: e.ui.density,
6238
+ onChange: (i) => t({ ui: { density: i } }),
6239
+ options: [["comfortable", "Comfortable"], ["compact", "Compact"]]
6240
+ }
6241
+ ) }),
6242
+ /* @__PURE__ */ o(W, { label: "Show formulas", children: /* @__PURE__ */ o(Le, { on: e.ui.showFormulas, onClick: () => t({ ui: { showFormulas: !e.ui.showFormulas } }) }) }),
6243
+ /* @__PURE__ */ o(W, { label: "Show assumptions", children: /* @__PURE__ */ o(Le, { on: e.ui.showAssumptions, onClick: () => t({ ui: { showAssumptions: !e.ui.showAssumptions } }) }) })
6244
+ ] }),
6245
+ /* @__PURE__ */ o(Te, { title: "Compliance", children: /* @__PURE__ */ o(W, { label: "Show disclaimer", children: /* @__PURE__ */ o(Le, { on: e.compliance.showDisclaimer, onClick: () => t({ compliance: { showDisclaimer: !e.compliance.showDisclaimer } }) }) }) }),
6246
+ /* @__PURE__ */ b(Te, { title: "File upload & server API", children: [
6247
+ /* @__PURE__ */ o(W, { label: "Save & upload to your server", children: /* @__PURE__ */ o(Le, { on: e.features.integrationPanel, onClick: () => t({ features: { integrationPanel: !e.features.integrationPanel } }) }) }),
6248
+ !e.features.integrationPanel && /* @__PURE__ */ b("p", { style: { fontSize: 12, color: "var(--fc-slate)", margin: "8px 0 0" }, children: [
6249
+ "Turn this on to configure your ",
6250
+ /* @__PURE__ */ o("strong", { children: "upload URL, authentication, and payload" }),
6251
+ " — so exports (PDF/CSV/…) and saved calculations post directly to your own server. No secret is ever stored by the app."
6252
+ ] })
6253
+ ] }),
6254
+ e.features.integrationPanel && /* @__PURE__ */ o(da, {}),
6255
+ /* @__PURE__ */ b("div", { className: "actions-row", children: [
6256
+ /* @__PURE__ */ o("button", { className: "icon-btn", onClick: m, children: "Export settings" }),
6257
+ /* @__PURE__ */ o("button", { className: "icon-btn", onClick: () => {
6258
+ var i;
6259
+ return (i = s.current) == null ? void 0 : i.click();
6260
+ }, children: "Import settings" }),
6261
+ /* @__PURE__ */ o("button", { className: "icon-btn", onClick: a, children: "Reset to defaults" }),
6262
+ /* @__PURE__ */ o("input", { ref: s, type: "file", accept: "application/json", hidden: !0, onChange: (i) => {
6263
+ var c;
6264
+ return ((c = i.target.files) == null ? void 0 : c[0]) && d(i.target.files[0]);
6265
+ } })
6266
+ ] })
6267
+ ] });
6268
+ }
6269
+ function Te({ title: e, children: t }) {
6270
+ return /* @__PURE__ */ b("section", { className: "card settings-section", children: [
6271
+ /* @__PURE__ */ o("h3", { children: e }),
6272
+ t
6273
+ ] });
6274
+ }
6275
+ function W({ label: e, children: t }) {
6276
+ return /* @__PURE__ */ b("div", { className: "settings-row", children: [
6277
+ /* @__PURE__ */ o("span", { className: "lbl", children: e }),
6278
+ /* @__PURE__ */ o("div", { children: t })
6279
+ ] });
6280
+ }
6281
+ function he({ value: e, onChange: t, options: n }) {
6282
+ return /* @__PURE__ */ o("div", { className: "input-wrap mini-wrap", children: /* @__PURE__ */ o("select", { value: e, onChange: (a) => t(a.target.value), children: n.map(([a, r]) => /* @__PURE__ */ o("option", { value: a, children: r }, a)) }) });
6283
+ }
6284
+ function Le({ on: e, onClick: t }) {
6285
+ return /* @__PURE__ */ o("button", { type: "button", role: "switch", "aria-checked": e, className: `toggle ${e ? "on" : ""}`, onClick: t, children: /* @__PURE__ */ o("span", { className: "knob" }) });
6286
+ }
6287
+ function Ji({
6288
+ items: e,
6289
+ onRestore: t,
6290
+ onClear: n
6291
+ }) {
6292
+ return /* @__PURE__ */ b("div", { className: "history", children: [
6293
+ /* @__PURE__ */ b("div", { className: "panel-head", style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end" }, children: [
6294
+ /* @__PURE__ */ b("div", { children: [
6295
+ /* @__PURE__ */ o("h2", { children: "History" }),
6296
+ /* @__PURE__ */ o("p", { children: "Your recent calculations, saved on this device." })
6297
+ ] }),
6298
+ e.length > 0 && /* @__PURE__ */ o("button", { className: "icon-btn", onClick: n, children: "Clear all" })
6299
+ ] }),
6300
+ e.length === 0 ? /* @__PURE__ */ o("div", { className: "card empty", children: "No saved calculations yet. Compute something and press Save." }) : /* @__PURE__ */ o("div", { className: "card", style: { padding: 0 }, children: /* @__PURE__ */ o("ul", { className: "history-list", children: e.map((a, r) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ b("button", { className: "history-item", onClick: () => t(a), children: [
6301
+ /* @__PURE__ */ b("div", { children: [
6302
+ /* @__PURE__ */ o("div", { className: "history-title", children: a.title }),
6303
+ /* @__PURE__ */ o("div", { className: "history-when", children: new Date(a.at).toLocaleString() })
6304
+ ] }),
6305
+ /* @__PURE__ */ o("div", { className: "history-value num", children: a.primary })
6306
+ ] }) }, r)) }) })
6307
+ ] });
6308
+ }
6309
+ function wn(e, t) {
6310
+ const n = t.toLowerCase(), a = n.indexOf(e);
6311
+ if (a >= 0) return 100 - a;
6312
+ let r = 0;
6313
+ for (let s = 0; s < n.length && r < e.length; s++) n[s] === e[r] && r++;
6314
+ return r === e.length ? 10 : -1;
6315
+ }
6316
+ function Zi({
6317
+ calculators: e,
6318
+ actions: t,
6319
+ onPick: n,
6320
+ onClose: a
6321
+ }) {
6322
+ const [r, s] = M(""), [u, m] = M(0), d = de(null);
6323
+ X(() => {
6324
+ var l;
6325
+ return (l = d.current) == null ? void 0 : l.focus();
6326
+ }, []), X(() => (wa(), () => Na()), []);
6327
+ const i = ne(() => {
6328
+ const l = e.map((y) => ({
6329
+ key: `calc:${y.id}`,
6330
+ label: y.title,
6331
+ group: y.group,
6332
+ hint: y.blurb,
6333
+ run: () => n(y.id)
6334
+ })), p = t.map((y) => ({ key: `act:${y.id}`, label: y.label, group: "action", hint: y.hint, run: y.run })), h = [...l, ...p], f = r.trim().toLowerCase();
6335
+ return f ? h.map((y) => {
6336
+ var w, k;
6337
+ return { it: y, s: Math.max(wn(f, y.label), wn(f, `${y.group} ${((k = (w = e.find((S) => S.title === y.label)) == null ? void 0 : w.keywords) == null ? void 0 : k.join(" ")) ?? ""}`)) };
6338
+ }).filter((y) => y.s > 0).sort((y, w) => w.s - y.s).map((y) => y.it) : h;
6339
+ }, [r, e, t, n]);
6340
+ return X(() => m(0), [r]), /* @__PURE__ */ o("div", { className: "palette-backdrop", onClick: a, children: /* @__PURE__ */ b("div", { className: "palette", role: "dialog", "aria-label": "Command palette", onClick: (l) => l.stopPropagation(), children: [
6341
+ /* @__PURE__ */ o(
6342
+ "input",
6343
+ {
6344
+ ref: d,
6345
+ className: "palette-input",
6346
+ placeholder: "Search calculators and actions…",
6347
+ value: r,
6348
+ onChange: (l) => s(l.target.value),
6349
+ onKeyDown: (l) => {
6350
+ var p;
6351
+ l.key === "ArrowDown" ? (l.preventDefault(), m((h) => Math.min(h + 1, i.length - 1))) : l.key === "ArrowUp" ? (l.preventDefault(), m((h) => Math.max(h - 1, 0))) : l.key === "Enter" ? (l.preventDefault(), (p = i[u]) == null || p.run()) : l.key === "Escape" && (l.preventDefault(), l.stopPropagation(), a());
6352
+ },
6353
+ "aria-label": "Search"
6354
+ }
6355
+ ),
6356
+ /* @__PURE__ */ b("ul", { className: "palette-list", role: "listbox", children: [
6357
+ i.length === 0 && /* @__PURE__ */ o("li", { className: "palette-empty", children: "No matches" }),
6358
+ i.map((l, p) => /* @__PURE__ */ b(
6359
+ "li",
6360
+ {
6361
+ role: "option",
6362
+ "aria-selected": p === u,
6363
+ className: `palette-item ${p === u ? "active" : ""}`,
6364
+ onMouseEnter: () => m(p),
6365
+ onClick: () => l.run(),
6366
+ children: [
6367
+ /* @__PURE__ */ o("span", { className: "palette-label", children: l.label }),
6368
+ /* @__PURE__ */ o("span", { className: "palette-group", children: l.group })
6369
+ ]
6370
+ },
6371
+ l.key
6372
+ ))
6373
+ ] })
6374
+ ] }) });
6375
+ }
6376
+ const ct = (e) => ({
6377
+ width: e,
6378
+ height: e,
6379
+ viewBox: "0 0 24 24",
6380
+ fill: "none",
6381
+ stroke: "currentColor",
6382
+ strokeWidth: 2,
6383
+ strokeLinecap: "round",
6384
+ strokeLinejoin: "round",
6385
+ "aria-hidden": !0
6386
+ });
6387
+ function Xi({ size: e = 17 }) {
6388
+ return /* @__PURE__ */ b("svg", { ...ct(e), children: [
6389
+ /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "3" }),
6390
+ /* @__PURE__ */ o("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
6391
+ ] });
6392
+ }
6393
+ function Qi({ size: e = 17 }) {
6394
+ return /* @__PURE__ */ b("svg", { ...ct(e), children: [
6395
+ /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "4" }),
6396
+ /* @__PURE__ */ o("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
6397
+ ] });
6398
+ }
6399
+ function es({ size: e = 17 }) {
6400
+ return /* @__PURE__ */ o("svg", { ...ct(e), children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
6401
+ }
6402
+ function ts({ size: e = 17 }) {
6403
+ return /* @__PURE__ */ b("svg", { ...ct(e), children: [
6404
+ /* @__PURE__ */ o("path", { d: "M3 3v5h5" }),
6405
+ /* @__PURE__ */ o("path", { d: "M3.05 13A9 9 0 1 0 6 5.3L3 8" }),
6406
+ /* @__PURE__ */ o("path", { d: "M12 7v5l4 2" })
6407
+ ] });
6408
+ }
6400
6409
  const ns = { "loan.emi": Wn, scientific: Jn, currency: aa };
6401
6410
  function as({ onClose: e }) {
6402
- const { settings: t, setRegion: n, update: a, resolvedTheme: r } = ue(), s = t.region, u = ne(() => Yr(s), [s]), [m, d] = M("loan.emi"), [i, c] = M("calc"), [l, p] = M(void 0), [h, f] = M(!1), { items: y, clear: w } = Ro();
6411
+ const { settings: t, setRegion: n, update: a, resolvedTheme: r } = ue(), s = t.region, u = ne(() => Kr(s), [s]), [m, d] = M("loan.emi"), [i, c] = M("calc"), [l, p] = M(void 0), [h, f] = M(!1), { items: y, clear: w } = Mo();
6403
6412
  X(() => {
6404
6413
  const x = () => {
6405
6414
  const T = new URLSearchParams(location.hash.replace(/^#/, "") || location.search), $ = T.get("fincalc");
@@ -6451,17 +6460,17 @@ function as({ onClose: e }) {
6451
6460
  /* @__PURE__ */ o("button", { "aria-pressed": s === "IN", onClick: () => n("IN"), children: "🇮🇳" }),
6452
6461
  /* @__PURE__ */ o("button", { "aria-pressed": s === "US", onClick: () => n("US"), children: "🇺🇸" })
6453
6462
  ] }),
6454
- /* @__PURE__ */ o("button", { className: "icon-btn icon-only", onClick: () => a({ ui: { theme: r === "dark" ? "light" : "dark" } }), "aria-label": r === "dark" ? "Switch to light mode" : "Switch to dark mode", children: r === "dark" ? /* @__PURE__ */ o(pi, {}) : /* @__PURE__ */ o(hi, {}) }),
6463
+ /* @__PURE__ */ o("button", { className: "icon-btn icon-only", onClick: () => a({ ui: { theme: r === "dark" ? "light" : "dark" } }), "aria-label": r === "dark" ? "Switch to light mode" : "Switch to dark mode", children: r === "dark" ? /* @__PURE__ */ o(Qi, {}) : /* @__PURE__ */ o(es, {}) }),
6455
6464
  /* @__PURE__ */ b("button", { className: "icon-btn", "aria-label": "History", onClick: () => c("history"), children: [
6456
- /* @__PURE__ */ o(fi, {}),
6465
+ /* @__PURE__ */ o(ts, {}),
6457
6466
  " History"
6458
6467
  ] }),
6459
- /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Settings", onClick: () => c("settings"), children: /* @__PURE__ */ o(mi, {}) }),
6468
+ /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Settings", onClick: () => c("settings"), children: /* @__PURE__ */ o(Xi, {}) }),
6460
6469
  e && /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Close", onClick: e, children: "✕" })
6461
6470
  ] })
6462
6471
  ] }),
6463
6472
  /* @__PURE__ */ b("div", { className: "fc-body", children: [
6464
- /* @__PURE__ */ o("nav", { className: "fc-rail", "aria-label": "Calculators", children: Kr.map((x) => {
6473
+ /* @__PURE__ */ o("nav", { className: "fc-rail", "aria-label": "Calculators", children: Wr.map((x) => {
6465
6474
  const T = u.filter(($) => $.group === x.id);
6466
6475
  return T.length === 0 ? null : /* @__PURE__ */ b("div", { className: "rail-group", children: [
6467
6476
  /* @__PURE__ */ o("div", { className: "rail-group-label", children: x.label }),
@@ -6477,11 +6486,11 @@ function as({ onClose: e }) {
6477
6486
  ] }, x.id);
6478
6487
  }) }),
6479
6488
  /* @__PURE__ */ o("main", { className: "fc-main", children: /* @__PURE__ */ b("div", { className: "fc-anim-in", children: [
6480
- i === "settings" && /* @__PURE__ */ o(ci, {}),
6481
- i === "history" && /* @__PURE__ */ o(ui, { items: y, onRestore: P, onClear: w }),
6482
- i === "integration" && /* @__PURE__ */ o(Hi, {}),
6489
+ i === "settings" && /* @__PURE__ */ o(zi, {}),
6490
+ i === "history" && /* @__PURE__ */ o(Ji, { items: y, onRestore: P, onClear: w }),
6491
+ i === "integration" && /* @__PURE__ */ o(da, {}),
6483
6492
  i === "calc" && /* @__PURE__ */ o(
6484
- oi,
6493
+ ii,
6485
6494
  {
6486
6495
  def: F,
6487
6496
  seed: l,
@@ -6511,7 +6520,7 @@ function as({ onClose: e }) {
6511
6520
  )
6512
6521
  ] }, i === "calc" ? `calc:${F.id}` : i) })
6513
6522
  ] }),
6514
- h && /* @__PURE__ */ o(di, { calculators: u, actions: N, onPick: S, onClose: () => f(!1) })
6523
+ h && /* @__PURE__ */ o(Zi, { calculators: u, actions: N, onPick: S, onClose: () => f(!1) })
6515
6524
  ] });
6516
6525
  }
6517
6526
  function Nn({ size: e = 22 }) {
@@ -6578,7 +6587,7 @@ function gs({
6578
6587
  /* @__PURE__ */ o("span", { "aria-hidden": !0, style: { marginRight: 6, display: "inline-flex", alignItems: "center" }, children: m ?? /* @__PURE__ */ o(Nn, { size: 16 }) }),
6579
6588
  u
6580
6589
  ] }),
6581
- /* @__PURE__ */ o(Sa, { open: k, onClose: F.close, title: h, size: p, children: /* @__PURE__ */ o(as, { onClose: F.close }) })
6590
+ /* @__PURE__ */ o(Ca, { open: k, onClose: F.close, title: h, size: p, children: /* @__PURE__ */ o(as, { onClose: F.close }) })
6582
6591
  ] });
6583
6592
  }
6584
6593
  const rs = 60 * 60 * 1e3, wt = (e, t) => `${e}|${[...t].sort().join(",")}`;
@@ -6631,53 +6640,53 @@ function vs(e, t = {}) {
6631
6640
  }
6632
6641
  const ks = { solve: Ie, REGIONS: me };
6633
6642
  export {
6634
- oi as CalculatorPanel,
6635
- no as Chart,
6636
- di as CommandPalette,
6643
+ ii as CalculatorPanel,
6644
+ ao as Chart,
6645
+ Zi as CommandPalette,
6637
6646
  aa as CurrencyConverter,
6638
6647
  g as D,
6639
6648
  ys as DEFAULT_ENVELOPE,
6640
6649
  Ze as DEFAULT_SETTINGS,
6641
6650
  H as Decimal,
6642
- Sa as Dialog,
6643
- ao as EXPORT_FORMATS,
6651
+ Ca as Dialog,
6652
+ ro as EXPORT_FORMATS,
6644
6653
  Gn as ExportMenu,
6645
- zr as Field,
6646
- Sa as FinCalcDialog,
6654
+ Jr as Field,
6655
+ Ca as FinCalcDialog,
6647
6656
  se as FinCalcError,
6648
6657
  gs as FinCalcLauncher,
6649
6658
  ms as FinCalcProvider,
6650
6659
  as as FinCalcRoot,
6651
- Kr as GROUPS,
6652
- ui as HistoryPanel,
6653
- Hi as IntegrationPanel,
6660
+ Wr as GROUPS,
6661
+ Ji as HistoryPanel,
6662
+ da as IntegrationPanel,
6654
6663
  gs as Launcher,
6655
6664
  Wn as LoanEmiPanel,
6656
- ya as POLICY_DEFAULT,
6657
- Xr as ResultCard,
6665
+ ba as POLICY_DEFAULT,
6666
+ Qr as ResultCard,
6658
6667
  Kn as SaveButton,
6659
- to as ScheduleTable,
6668
+ no as ScheduleTable,
6660
6669
  Jn as SciCalculator,
6661
- ci as SettingsPanel,
6670
+ zi as SettingsPanel,
6662
6671
  ms as SettingsProvider,
6663
6672
  as as Shell,
6664
6673
  Dn as allCalculators,
6665
6674
  ye as boolval,
6666
6675
  oa as buildFilename,
6667
- Ai as buildPayload,
6676
+ Ti as buildPayload,
6668
6677
  bs as buildSavePayload,
6669
6678
  It as calculatorById,
6670
- Yr as calculatorsForRegion,
6679
+ Kr as calculatorsForRegion,
6671
6680
  Eo as clearHistory,
6672
- Po as createExporter,
6681
+ To as createExporter,
6673
6682
  vs as createFxCache,
6674
- Ni as createTransport,
6683
+ fi as createTransport,
6675
6684
  fs as currency,
6676
6685
  D as dmoney,
6677
6686
  cs as eq,
6678
6687
  on as evalExpression,
6679
- Jo as evaluateExpression,
6680
- ei as fetchLiveRate,
6688
+ Zo as evaluateExpression,
6689
+ ti as fetchLiveRate,
6681
6690
  ps as finance,
6682
6691
  us as gt,
6683
6692
  ce as isZeroish,
@@ -6686,14 +6695,14 @@ export {
6686
6695
  Sn as makeFormatter,
6687
6696
  v as metric,
6688
6697
  C as numval,
6689
- jo as parseExpression,
6698
+ Vo as parseExpression,
6690
6699
  Nt as regionDefaults,
6691
6700
  hs as registerCalculator,
6692
- ki as sanitizeFilename,
6701
+ pi as sanitizeFilename,
6693
6702
  Yn as saveHistory,
6694
6703
  Ie as solveLoan,
6695
6704
  _ as strval,
6696
6705
  ue as useFinCalc,
6697
- Ro as useHistory,
6706
+ Mo as useHistory,
6698
6707
  ue as useSettings
6699
6708
  };