calcsuite-react 1.1.1 → 1.1.2

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 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);
1
+ var pa = Object.defineProperty;
2
+ var ha = (e, t, n) => t in e ? pa(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var ge = (e, t, n) => ha(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 ha, createContext as fa, useRef as de, useEffect as X, Fragment as xn, useSyncExternalStore as ya } from "react";
6
- import dt from "decimal.js";
7
- const ba = {
5
+ import { useState as M, useCallback as ke, useMemo as X, useContext as fa, createContext as ya, useRef as de, useEffect as Q, Fragment as xn, useSyncExternalStore as ba } from "react";
6
+ import mt from "decimal.js";
7
+ const ga = {
8
8
  money: 2,
9
9
  rate: 6,
10
10
  period: 4,
@@ -13,7 +13,7 @@ const ba = {
13
13
  instalment: "none",
14
14
  residualAbsorption: "last"
15
15
  }, qt = {
16
- rounding: ba,
16
+ rounding: ga,
17
17
  ui: {
18
18
  theme: "system",
19
19
  accent: "#078DEE",
@@ -68,13 +68,13 @@ function xt(e) {
68
68
  defaults: { tenureUnit: "both", rateType: "floating", maxRatePercent: 50, sipReturnPercent: "12", inflationPercent: "6" }
69
69
  };
70
70
  }
71
- const Ze = xt("IN"), H = dt.clone({
71
+ const Xe = xt("IN"), H = mt.clone({
72
72
  precision: 40,
73
- rounding: dt.ROUND_HALF_UP,
73
+ rounding: mt.ROUND_HALF_UP,
74
74
  toExpPos: 60,
75
75
  toExpNeg: -60,
76
- modulo: dt.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), ga = {
76
+ modulo: mt.ROUND_DOWN
77
+ }), g = (e) => new H(e), us = (e, t) => g(e).eq(t), ds = (e, t) => g(e).gt(t), ms = (e, t) => g(e).lt(t), ce = (e, t = "1e-9") => e.abs().lt(t), va = {
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 = xt("IN"), H = dt.clone({
83
83
  CEIL: H.ROUND_CEIL,
84
84
  FLOOR: H.ROUND_FLOOR
85
85
  };
86
- function va(e) {
86
+ function ka(e) {
87
87
  switch (e.numberFormat.grouping) {
88
88
  case "indian":
89
89
  return "en-IN";
@@ -98,7 +98,7 @@ function va(e) {
98
98
  }
99
99
  }
100
100
  function Sn(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), {
101
+ const t = va[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(ka(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) => {
@@ -122,71 +122,98 @@ function Sn(e) {
122
122
  };
123
123
  return { settings: e, money: m, moneyParts: d, num: i, pct: (l, p = e.numberFormat.percentPlaces) => `${i(l, p)}%`, compact: u, round: n };
124
124
  }
125
- function mt(e) {
125
+ function pt(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 = fa(null), Pn = "calcsuite:settings";
130
- function Xe(e, t) {
129
+ const wa = [
130
+ { id: "default", label: "Green", main: "#00A76F", light: "#2CCF8E", dark: "#087055", ink: "#06251A" },
131
+ { id: "cyan", label: "Cyan", main: "#078DEE", light: "#68CDF9", dark: "#0351AB", ink: "#FFFFFF" },
132
+ { id: "purple", label: "Purple", main: "#7635DC", light: "#B985F4", dark: "#431A9E", ink: "#FFFFFF" },
133
+ { id: "blue", label: "Blue", main: "#2065D1", light: "#76B0F1", dark: "#103996", ink: "#FFFFFF" },
134
+ { id: "orange", label: "Orange", main: "#FDA92D", light: "#FED680", dark: "#B66816", ink: "#212B36" },
135
+ { id: "gray", label: "Gray", main: "#A4AAB3", light: "#CED1D7", dark: "#63686C", ink: "#FFFFFF" }
136
+ ], ze = "-apple-system, 'Segoe UI', system-ui, sans-serif", Cn = [
137
+ { id: "Inter Tight", label: "Inter Tight", stack: `'Inter Tight', ${ze}` },
138
+ { id: "Public Sans", label: "Public Sans", stack: `'Public Sans', ${ze}` },
139
+ { id: "system-ui", label: "System UI", stack: `system-ui, ${ze}` },
140
+ { id: "Georgia", label: "Georgia (serif)", stack: "Georgia, 'Times New Roman', serif" }
141
+ ], Na = (e) => {
142
+ var t;
143
+ return ((t = Cn.find((n) => n.id === e)) == null ? void 0 : t.stack) ?? `'${e}', ${ze}`;
144
+ }, Pn = ya(null), Tn = "calcsuite:settings";
145
+ function Qe(e, t) {
131
146
  if (t == null) return e;
132
147
  const n = Array.isArray(e) ? [...e] : { ...e };
133
148
  for (const a of Object.keys(t)) {
134
149
  const r = t[a], s = e[a];
135
- n[a] = r && typeof r == "object" && !Array.isArray(r) && s && typeof s == "object" ? Xe(s, r) : r;
150
+ n[a] = r && typeof r == "object" && !Array.isArray(r) && s && typeof s == "object" ? Qe(s, r) : r;
136
151
  }
137
152
  return n;
138
153
  }
139
- function ka(e) {
140
- const t = e ? Xe(Ze, e) : Ze;
154
+ function xa(e) {
155
+ const t = e ? Qe(Xe, e) : Xe;
141
156
  try {
142
- const n = localStorage.getItem(Pn);
143
- if (n) return Xe(t, JSON.parse(n));
157
+ const n = localStorage.getItem(Tn);
158
+ if (n) return Qe(t, JSON.parse(n));
144
159
  } catch {
145
160
  }
146
161
  return t;
147
162
  }
148
- function pt(e) {
163
+ function ht(e) {
149
164
  try {
150
- e.persistence.driver === "localStorage" && localStorage.setItem(Pn, JSON.stringify(e));
165
+ e.persistence.driver === "localStorage" && localStorage.setItem(Tn, JSON.stringify(e));
151
166
  } catch {
152
167
  }
153
168
  }
154
- function ms({
169
+ function ps({
155
170
  children: e,
156
171
  settings: t
157
172
  }) {
158
- const [n, a] = M(() => ka(t)), r = ke((p) => {
159
- a(p), pt(p);
160
- }, []), s = ke((p) => a((h) => {
161
- const f = Xe(h, p);
162
- return pt(f), f;
163
- }), []), u = ke((p) => {
164
- a((h) => {
165
- const y = { ...xt(p), ui: h.ui, compliance: h.compliance, persistence: h.persistence, features: h.features };
166
- return pt(y), y;
173
+ const [n, a] = M(() => xa(t)), r = ke((h) => {
174
+ a(h), ht(h);
175
+ }, []), s = ke((h) => a((f) => {
176
+ const y = Qe(f, h);
177
+ return ht(y), y;
178
+ }), []), u = ke((h) => {
179
+ a((f) => {
180
+ const w = { ...xt(h), ui: f.ui, compliance: f.compliance, persistence: f.persistence, features: f.features };
181
+ return ht(w), w;
167
182
  });
168
- }, []), m = ke(() => r(xt(n.region)), [r, n.region]), d = ke((p) => r(p), [r]), i = ne(() => Sn(n), [n]), c = ne(() => {
169
- var h;
170
- const p = n.ui.theme;
171
- return p === "system" ? (h = window.matchMedia) != null && h.call(window, "(prefers-color-scheme: dark)").matches ? "dark" : "light" : p;
172
- }, [n.ui.theme]), l = ne(
183
+ }, []), m = ke(() => r(xt(n.region)), [r, n.region]), d = ke((h) => r(h), [r]), i = X(() => Sn(n), [n]), c = X(() => {
184
+ var f;
185
+ const h = n.ui.theme;
186
+ return h === "system" ? (f = window.matchMedia) != null && f.call(window, "(prefers-color-scheme: dark)").matches ? "dark" : "light" : h;
187
+ }, [n.ui.theme]), l = X(
173
188
  () => ({ settings: n, fmt: i, update: s, setRegion: u, reset: m, replace: d, resolvedTheme: c }),
174
189
  [n, i, s, u, m, d, c]
190
+ ), p = X(
191
+ () => ({ display: "contents", "--fc-accent": n.ui.accent, "--fc-font-ui": Na(n.ui.fontFamily) }),
192
+ [n.ui.accent, n.ui.fontFamily]
175
193
  );
176
- return /* @__PURE__ */ o(Cn.Provider, { value: l, children: e });
194
+ return /* @__PURE__ */ o(Pn.Provider, { value: l, children: /* @__PURE__ */ o(
195
+ "div",
196
+ {
197
+ "data-fincalc-root": "",
198
+ "data-theme": c === "highContrast" ? "dark" : c,
199
+ "data-density": n.ui.density,
200
+ style: p,
201
+ children: e
202
+ }
203
+ ) });
177
204
  }
178
205
  function ue() {
179
- const e = ha(Cn);
206
+ const e = fa(Pn);
180
207
  if (!e) throw new Error("useSettings must be used within SettingsProvider");
181
208
  return e;
182
209
  }
183
- let Qe = 0;
184
- const wa = () => {
185
- Qe += 1;
186
- }, Na = () => {
187
- Qe = Math.max(0, Qe - 1);
188
- }, xa = () => Qe > 0, Sa = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
189
- function Ca({
210
+ let et = 0;
211
+ const Sa = () => {
212
+ et += 1;
213
+ }, Ca = () => {
214
+ et = Math.max(0, et - 1);
215
+ }, Pa = () => et > 0, Ta = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
216
+ function Fa({
190
217
  open: e,
191
218
  onClose: t,
192
219
  children: n,
@@ -195,11 +222,11 @@ function Ca({
195
222
  }) {
196
223
  const s = de(null), u = de(null), m = ke(() => {
197
224
  const h = s.current;
198
- return h ? Array.from(h.querySelectorAll(Sa)).filter(
225
+ return h ? Array.from(h.querySelectorAll(Ta)).filter(
199
226
  (f) => !f.hasAttribute("disabled") && f.getAttribute("aria-hidden") !== "true"
200
227
  ) : [];
201
228
  }, []), [d, i] = M(e), [c, l] = M(!1);
202
- X(() => {
229
+ Q(() => {
203
230
  if (e)
204
231
  i(!0), l(!1);
205
232
  else if (d) {
@@ -209,7 +236,7 @@ function Ca({
209
236
  }, 210);
210
237
  return () => clearTimeout(h);
211
238
  }
212
- }, [e]), X(() => {
239
+ }, [e]), Q(() => {
213
240
  if (!e) return;
214
241
  const h = s.current;
215
242
  u.current = document.activeElement;
@@ -219,7 +246,7 @@ function Ca({
219
246
  document.body.style.overflow = "hidden";
220
247
  const w = (k) => {
221
248
  if (k.key === "Escape") {
222
- if (xa()) return;
249
+ if (Pa()) return;
223
250
  k.preventDefault(), k.stopImmediatePropagation(), t();
224
251
  return;
225
252
  }
@@ -265,17 +292,17 @@ function be(e, t, n, a = !1) {
265
292
  let m = s.times(u.minus(1)).div(r);
266
293
  return a && (m = m.times(r.plus(1))), m;
267
294
  }
268
- function et(e, t, n) {
295
+ function tt(e, t, n) {
269
296
  return g(e).times(g(t).plus(1).pow(n));
270
297
  }
271
- function Tn(e, t, n, a = !1) {
298
+ function Fn(e, t, n, a = !1) {
272
299
  const r = g(t), s = g(e);
273
300
  if (ce(r)) return s.times(n);
274
301
  const u = r.plus(1).pow(n);
275
302
  let m = s.times(g(1).minus(u.pow(-1))).div(r);
276
303
  return a && (m = m.times(r.plus(1))), m;
277
304
  }
278
- function Pa(e, t, n) {
305
+ function Ia(e, t, n) {
279
306
  return g(e).div(g(t).plus(1).pow(n));
280
307
  }
281
308
  function we(e, t, n, a = 0, r = !1) {
@@ -285,11 +312,11 @@ function we(e, t, n, a = 0, r = !1) {
285
312
  let m = g(e).times(u).plus(a).times(s).div(u.minus(1));
286
313
  return r && (m = m.div(s.plus(1))), m;
287
314
  }
288
- function Ta(e, t, n) {
315
+ function Ra(e, t, n) {
289
316
  const a = g(n), r = g(e), s = g(t);
290
317
  return ce(a) ? r.div(s) : H.ln(s.div(s.minus(r.times(a)))).div(H.ln(a.plus(1)));
291
318
  }
292
- function rt(e, t = -0.9999, n = 100, a = 200) {
319
+ function ot(e, t = -0.9999, n = 100, a = 200) {
293
320
  let r = g(t), s = g(n), u = e(r), m = e(s);
294
321
  if (u.times(m).gt(0)) return null;
295
322
  for (let d = 0; d < a; d++) {
@@ -306,42 +333,42 @@ function At(e, t) {
306
333
  a = a.plus(g(t[r]).div(n.plus(1).pow(r)));
307
334
  return a;
308
335
  }
309
- function Fn(e) {
310
- return rt((t) => At(t, e));
336
+ function In(e) {
337
+ return ot((t) => At(t, e));
311
338
  }
312
- const Fa = (e, t) => (Date.parse(t) - Date.parse(e)) / 864e5;
313
- function In(e, t) {
339
+ const Ea = (e, t) => (Date.parse(t) - Date.parse(e)) / 864e5;
340
+ function Rn(e, t) {
314
341
  const n = g(e), a = t[0].date;
315
342
  let r = g(0);
316
343
  for (const s of t) {
317
- const u = g(Fa(a, s.date)).div(365);
344
+ const u = g(Ea(a, s.date)).div(365);
318
345
  r = r.plus(g(s.amount).div(n.plus(1).pow(u)));
319
346
  }
320
347
  return r;
321
348
  }
322
- function Rn(e) {
349
+ function En(e) {
323
350
  if (e.length < 2) return null;
324
351
  const t = [...e].sort((n, a) => Date.parse(n.date) - Date.parse(a.date));
325
- return rt((n) => In(n, t), -0.9999, 100);
352
+ return ot((n) => Rn(n, t), -0.9999, 100);
326
353
  }
327
- function ot(e, t, n) {
354
+ function it(e, t, n) {
328
355
  return g(t).div(e).pow(g(1).div(n)).minus(1);
329
356
  }
330
- const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
357
+ const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
331
358
  __proto__: null,
332
- bisectRate: rt,
333
- cagr: ot,
359
+ bisectRate: ot,
360
+ cagr: it,
334
361
  fvAnnuity: be,
335
- fvLump: et,
336
- irr: Fn,
337
- nper: Ta,
362
+ fvLump: tt,
363
+ irr: In,
364
+ nper: Ra,
338
365
  npv: At,
339
366
  periodic: J,
340
367
  pmt: we,
341
- pvAnnuity: Tn,
342
- pvLump: Pa,
343
- xirr: Rn,
344
- xnpv: In
368
+ pvAnnuity: Fn,
369
+ pvLump: Ia,
370
+ xirr: En,
371
+ xnpv: Rn
345
372
  }, Symbol.toStringTag, { value: "Module" })), me = {
346
373
  IN: {
347
374
  region: "IN",
@@ -378,18 +405,18 @@ class se extends Error {
378
405
  this.name = "FinCalcError", this.code = n, this.field = r;
379
406
  }
380
407
  }
381
- const Ia = 2, ee = (e) => e.toDecimalPlaces(Ia, H.ROUND_HALF_UP), St = (e) => e.div(100).div(12);
408
+ const Ma = 2, te = (e) => e.toDecimalPlaces(Ma, H.ROUND_HALF_UP), St = (e) => e.div(100).div(12);
382
409
  function Ct(e, t, n) {
383
410
  if (ce(t)) return e.div(n);
384
411
  const a = t.plus(1).pow(n);
385
412
  return e.times(t).times(a).div(a.minus(1));
386
413
  }
387
- function Ra(e, t, n) {
414
+ function $a(e, t, n) {
388
415
  if (ce(t)) return e.times(n);
389
416
  const a = t.plus(1).pow(n);
390
417
  return e.times(a.minus(1)).div(t.times(a));
391
418
  }
392
- function Ea(e, t, n) {
419
+ function Aa(e, t, n) {
393
420
  if (ce(t)) return Math.ceil(e.div(n).toNumber());
394
421
  const a = e.times(t);
395
422
  if (n.lte(a))
@@ -415,25 +442,25 @@ function Gt(e, t, n, a) {
415
442
  throw new se("SOLVER_DID_NOT_CONVERGE", "Could not find a rate within the allowed range.", "rate");
416
443
  return u;
417
444
  }
418
- function Ma(e, t, n, a) {
445
+ function Da(e, t, n, a) {
419
446
  const r = [];
420
447
  let s = e, u = g(0);
421
448
  for (let m = 1; m <= n; m++) {
422
- const d = s, i = ee(d.times(t));
449
+ const d = s, i = te(d.times(t));
423
450
  let c, l;
424
- if (m === n ? (c = d, l = ee(d.plus(i))) : (l = a, c = l.minus(i), c.gt(d) && (c = d, l = ee(d.plus(i)))), s = d.minus(c), u = u.plus(i), r.push({
451
+ if (m === n ? (c = d, l = te(d.plus(i))) : (l = a, c = l.minus(i), c.gt(d) && (c = d, l = te(d.plus(i)))), s = d.minus(c), u = u.plus(i), r.push({
425
452
  month: m,
426
- openingBalance: ee(d),
453
+ openingBalance: te(d),
427
454
  payment: l,
428
- principal: ee(c),
455
+ principal: te(c),
429
456
  interest: i,
430
- closingBalance: ee(s),
431
- cumulativeInterest: ee(u)
457
+ closingBalance: te(s),
458
+ cumulativeInterest: te(u)
432
459
  }), s.lte(0)) break;
433
460
  }
434
461
  return r;
435
462
  }
436
- function $a(e) {
463
+ function La(e) {
437
464
  const t = [];
438
465
  for (const n of e) {
439
466
  const a = Math.ceil(n.month / 12);
@@ -464,7 +491,7 @@ function Ie(e) {
464
491
  const k = g(d).div(12);
465
492
  if (s === "payment") {
466
493
  const S = u.times(m).div(100).times(k);
467
- i = ee(u.plus(S).div(d));
494
+ i = te(u.plus(S).div(d));
468
495
  } else if (s === "principal")
469
496
  u = i.times(d).div(g(1).plus(m.div(100).times(k)));
470
497
  else throw s === "tenure" ? new se("MISSING_SOLVE_TARGET", "Flat-rate loans need an explicit tenure.", "tenureMonths") : new se("MISSING_SOLVE_TARGET", "Flat-rate loans need an explicit rate.", "annualRatePct");
@@ -473,34 +500,34 @@ function Ie(e) {
473
500
  const k = () => St(m);
474
501
  switch (s) {
475
502
  case "payment":
476
- i = ee(Ct(u, k(), d)), l = "PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
503
+ i = te(Ct(u, k(), d)), l = "PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
477
504
  break;
478
505
  case "principal":
479
- u = Ra(i, k(), d), l = "P = PMT·((1+r)^n − 1) / (r·(1+r)^n)";
506
+ u = $a(i, k(), d), l = "P = PMT·((1+r)^n − 1) / (r·(1+r)^n)";
480
507
  break;
481
508
  case "tenure":
482
- d = Ea(u, k(), i), l = "n = ln(PMT / (PMT − P·r)) / ln(1 + r)";
509
+ d = Aa(u, k(), i), l = "n = ln(PMT / (PMT − P·r)) / ln(1 + r)";
483
510
  break;
484
511
  case "rate":
485
512
  m = Gt(u, d, i, t.maxRatePct), l = "solve r: PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
486
513
  break;
487
514
  }
488
515
  }
489
- const p = St(m), h = n === "flat" ? i : ee(Ct(u, p, d)), f = Ma(u, p, d, h);
516
+ const p = St(m), h = n === "flat" ? i : te(Ct(u, p, d)), f = Da(u, p, d, h);
490
517
  d = f.length;
491
518
  const y = f.reduce((k, S) => k.plus(S.interest), g(0)), w = f.reduce((k, S) => k.plus(S.payment), g(0));
492
519
  return {
493
520
  solvedFor: s,
494
521
  basis: n,
495
522
  region: e.region,
496
- principal: ee(u),
523
+ principal: te(u),
497
524
  annualRatePct: m.toDecimalPlaces(6, H.ROUND_HALF_UP),
498
525
  tenureMonths: d,
499
526
  payment: h,
500
- totalInterest: ee(y),
501
- totalPayment: ee(w),
527
+ totalInterest: te(y),
528
+ totalPayment: te(w),
502
529
  schedule: f,
503
- byYear: $a(f),
530
+ byYear: La(f),
504
531
  chart: {
505
532
  balance: f.map((k) => k.closingBalance),
506
533
  cumulativeInterest: f.map((k) => k.cumulativeInterest)
@@ -522,7 +549,7 @@ const C = (e, t = 0) => {
522
549
  tone: n,
523
550
  sub: a
524
551
  }), U = (e) => e.toDecimalPlaces(2, H.ROUND_HALF_UP);
525
- function En(e, t) {
552
+ function Mn(e, t) {
526
553
  const n = /* @__PURE__ */ new Map();
527
554
  for (const r of e) {
528
555
  const s = Math.ceil(r.month / 12), u = n.get(s);
@@ -540,7 +567,7 @@ function En(e, t) {
540
567
  }
541
568
  return a;
542
569
  }
543
- const Mn = [
570
+ const $n = [
544
571
  {
545
572
  key: "count",
546
573
  label: "How many loans",
@@ -551,19 +578,19 @@ const Mn = [
551
578
  ];
552
579
  for (let e = 1; e <= 5; e++) {
553
580
  const t = e <= 2, n = t ? void 0 : (a) => C(a.count, 2) >= e;
554
- Mn.push(
581
+ $n.push(
555
582
  { key: `p${e}`, label: `Loan ${e} amount`, kind: "money", prefix: "currency", default: e <= 2 ? "2500000" : "", optional: !t, showIf: n },
556
583
  { key: `r${e}`, label: `Loan ${e} rate`, kind: "percent", suffix: "%", default: e === 1 ? 9 : e === 2 ? 8.65 : "", optional: !t, showIf: n, labelByRegion: {} },
557
584
  { key: `t${e}`, label: `Loan ${e} tenure`, kind: "tenure", default: 240, optional: !t, showIf: n, labelByRegion: { US: `Loan ${e} term` } }
558
585
  );
559
586
  }
560
- const Aa = {
587
+ const Ua = {
561
588
  id: "loan.compare",
562
589
  group: "loans",
563
590
  title: "Compare loans",
564
591
  blurb: "Line up 2–5 loans and see which costs least over its full life.",
565
592
  keywords: ["compare", "loan", "cheapest", "emi", "best offer"],
566
- inputs: Mn,
593
+ inputs: $n,
567
594
  compute(e, t) {
568
595
  const n = me[t.region], a = Math.max(2, Math.min(5, C(e.count, 2))), r = [];
569
596
  for (let l = 1; l <= a; l++) {
@@ -601,7 +628,7 @@ const Aa = {
601
628
  raw: i
602
629
  };
603
630
  }
604
- }, Da = {
631
+ }, Oa = {
605
632
  id: "loan.prepay",
606
633
  group: "loans",
607
634
  title: "Prepayment impact",
@@ -670,7 +697,7 @@ const Aa = {
670
697
  schedule: {
671
698
  title: "New amortisation",
672
699
  columns: ["Month", "Principal", "Interest", "Prepay", "Balance"],
673
- groups: En(w, t),
700
+ groups: Mn(w, t),
674
701
  toneCols: { 1: "principal", 2: "interest" }
675
702
  },
676
703
  notes: B,
@@ -685,7 +712,7 @@ const Aa = {
685
712
  }
686
713
  };
687
714
  }
688
- }, La = {
715
+ }, Ba = {
689
716
  id: "loan.transfer",
690
717
  group: "loans",
691
718
  title: "Balance transfer",
@@ -729,7 +756,7 @@ const Aa = {
729
756
  }
730
757
  };
731
758
  }
732
- }, Ua = {
759
+ }, _a = {
733
760
  id: "loan.eligibility",
734
761
  group: "loans",
735
762
  title: "Loan eligibility",
@@ -770,7 +797,7 @@ const Aa = {
770
797
  }
771
798
  const d = [];
772
799
  let i = g(0);
773
- return u.gt(0) ? i = U(Tn(u, s, r)) : d.push("Existing obligations already use up the allowed share of income — no additional loan capacity."), {
800
+ return u.gt(0) ? i = U(Fn(u, s, r)) : d.push("Existing obligations already use up the allowed share of income — no additional loan capacity."), {
774
801
  primary: v("Eligible loan amount", t.fmt.money(i), "positive"),
775
802
  secondary: m,
776
803
  formula: t.region === "US" ? "EMI = min(income·frontDTI, income·backDTI − debts); P = PV of that annuity" : "EMI = income·FOIR − existingEMI; P = PV of that annuity",
@@ -781,7 +808,7 @@ const Aa = {
781
808
  }
782
809
  };
783
810
  }
784
- }, Oa = {
811
+ }, Ha = {
785
812
  id: "loan.stepEmi",
786
813
  group: "loans",
787
814
  title: "Step-up / step-down EMI",
@@ -798,7 +825,7 @@ const Aa = {
798
825
  let S = a;
799
826
  for (let F = 1; F <= s; F++) S = S.plus(S.times(m)).minus(k.times(d(F)));
800
827
  return S;
801
- }, c = U(rt((k) => i(k), 0, a.toNumber(), 200) ?? we(a, m, s)), l = [];
828
+ }, c = U(ot((k) => i(k), 0, a.toNumber(), 200) ?? we(a, m, s)), l = [];
802
829
  let p = a, h = g(0), f = c;
803
830
  for (let k = 1; k <= s && p.gt("0.005"); k++) {
804
831
  const S = U(p.times(m));
@@ -818,7 +845,7 @@ const Aa = {
818
845
  schedule: {
819
846
  title: "Amortisation",
820
847
  columns: ["Month", "Principal", "Interest", n.paymentLabel, "Balance"],
821
- groups: En(l, t),
848
+ groups: Mn(l, t),
822
849
  toneCols: { 1: "principal", 2: "interest" }
823
850
  },
824
851
  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.`],
@@ -832,7 +859,7 @@ const Aa = {
832
859
  }
833
860
  };
834
861
  }
835
- }, Ba = {
862
+ }, qa = {
836
863
  id: "loan.moratorium",
837
864
  group: "loans",
838
865
  title: "Moratorium / EMI holiday",
@@ -887,7 +914,7 @@ const Aa = {
887
914
  }
888
915
  };
889
916
  }
890
- }, _a = {
917
+ }, Ga = {
891
918
  id: "loan.overdraft",
892
919
  group: "loans",
893
920
  title: "Overdraft / flexi loan",
@@ -917,7 +944,7 @@ const Aa = {
917
944
  }
918
945
  };
919
946
  }
920
- }, Ha = {
947
+ }, ja = {
921
948
  id: "loan.refinance",
922
949
  group: "loans",
923
950
  title: "Refinance",
@@ -964,16 +991,16 @@ const Aa = {
964
991
  }
965
992
  };
966
993
  }
967
- }, qa = [
968
- Aa,
969
- Da,
970
- La,
994
+ }, Va = [
971
995
  Ua,
972
996
  Oa,
973
997
  Ba,
974
998
  _a,
975
- Ha
976
- ], it = Ze.defaults.sipReturnPercent, Ga = Ze.defaults.inflationPercent, st = (e, t) => ({
999
+ Ha,
1000
+ qa,
1001
+ Ga,
1002
+ ja
1003
+ ], st = Xe.defaults.sipReturnPercent, Ya = Xe.defaults.inflationPercent, lt = (e, t) => ({
977
1004
  labels: e,
978
1005
  series: [{ name: "Value", tone: "accent", points: t, area: !0 }]
979
1006
  }), Dt = (e) => ({
@@ -983,7 +1010,7 @@ const Aa = {
983
1010
  }), Lt = (e, t) => [
984
1011
  { label: "Invested", value: Number(e), tone: "principal" },
985
1012
  { label: "Gains", value: Number(t), tone: "interest" }
986
- ], ja = {
1013
+ ], Ka = {
987
1014
  id: "invest.sip",
988
1015
  group: "invest",
989
1016
  title: "SIP Calculator",
@@ -991,7 +1018,7 @@ const Aa = {
991
1018
  keywords: ["sip", "systematic investment plan", "mutual fund", "monthly investment", "future value"],
992
1019
  inputs: [
993
1020
  { key: "monthlyAmount", label: "Monthly investment", kind: "money", prefix: "currency", default: "10000" },
994
- { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1021
+ { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: st },
995
1022
  { key: "tenure", label: "Investment period", kind: "tenure", default: 120 }
996
1023
  ],
997
1024
  compute(e, t) {
@@ -1009,7 +1036,7 @@ const Aa = {
1009
1036
  ],
1010
1037
  split: Lt(i.toFixed(2), c.toFixed(2)),
1011
1038
  schedule: Dt(p),
1012
- chart: st(p.map((f) => f.label), h),
1039
+ chart: lt(p.map((f) => f.label), h),
1013
1040
  formula: "FV = P·[((1+i)^n − 1) / i]·(1+i), i = r/12 (invested at the start of each month)",
1014
1041
  notes: ["Returns are assumed constant; actual market returns vary year to year."],
1015
1042
  raw: {
@@ -1020,7 +1047,7 @@ const Aa = {
1020
1047
  }
1021
1048
  };
1022
1049
  }
1023
- }, Va = {
1050
+ }, Wa = {
1024
1051
  id: "invest.stepupSip",
1025
1052
  group: "invest",
1026
1053
  title: "Step-up SIP Calculator",
@@ -1029,7 +1056,7 @@ const Aa = {
1029
1056
  inputs: [
1030
1057
  { key: "monthlyAmount", label: "Initial monthly investment", kind: "money", prefix: "currency", default: "10000" },
1031
1058
  { key: "annualStepPct", label: "Annual step-up", kind: "percent", suffix: "%", default: "10" },
1032
- { key: "returnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1059
+ { key: "returnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: st },
1033
1060
  { key: "tenure", label: "Investment period", kind: "tenure", default: 120 }
1034
1061
  ],
1035
1062
  compute(e, t) {
@@ -1048,13 +1075,13 @@ const Aa = {
1048
1075
  ],
1049
1076
  split: Lt(c.toFixed(2), f.toFixed(2)),
1050
1077
  schedule: Dt(p),
1051
- chart: st(p.map((y) => y.label), h),
1078
+ chart: lt(p.map((y) => y.label), h),
1052
1079
  formula: "Monthly simulation; the SIP amount is increased by the step-up % every 12 months",
1053
1080
  notes: ["The monthly amount steps up on each yearly anniversary; returns are assumed constant."],
1054
1081
  raw: { maturity: i.toFixed(2), invested: c.toFixed(2), gains: f.toFixed(2), finalMonthly: l.toFixed(2) }
1055
1082
  };
1056
1083
  }
1057
- }, Ya = { annual: 1, semiannual: 2, quarterly: 4, monthly: 12 }, Ka = {
1084
+ }, za = { annual: 1, semiannual: 2, quarterly: 4, monthly: 12 }, Ja = {
1058
1085
  id: "invest.lumpsum",
1059
1086
  group: "invest",
1060
1087
  title: "Lump Sum Calculator",
@@ -1062,7 +1089,7 @@ const Aa = {
1062
1089
  keywords: ["lump sum", "lumpsum", "one time investment", "compound interest", "maturity"],
1063
1090
  inputs: [
1064
1091
  { key: "principal", label: "Investment amount", kind: "money", prefix: "currency", default: "100000" },
1065
- { key: "ratePct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1092
+ { key: "ratePct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: st },
1066
1093
  { key: "years", label: "Investment period", kind: "years", suffix: "years", default: 10 },
1067
1094
  {
1068
1095
  key: "compounding",
@@ -1078,7 +1105,7 @@ const Aa = {
1078
1105
  }
1079
1106
  ],
1080
1107
  compute(e, t) {
1081
- 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) : ot(r, i, u), p = [], h = [];
1108
+ 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 = za[_(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) : it(r, i, u), p = [], h = [];
1082
1109
  for (let f = 1; f <= u; f++) {
1083
1110
  const y = r.times(d.plus(1).pow(m * f));
1084
1111
  p.push({ label: String(f), cells: [a.money(r), a.money(y.minus(r)), a.money(y)] }), h.push(Number(y.toFixed(2)));
@@ -1092,13 +1119,13 @@ const Aa = {
1092
1119
  ],
1093
1120
  split: Lt(r.toFixed(2), c.toFixed(2)),
1094
1121
  schedule: Dt(p),
1095
- chart: st(p.map((f) => f.label), h),
1122
+ chart: lt(p.map((f) => f.label), h),
1096
1123
  formula: "A = P·(1 + r/f)^(f·t)",
1097
1124
  notes: ["Returns are assumed constant across the whole period."],
1098
1125
  raw: { maturity: i.toFixed(2), invested: r.toFixed(2), gains: c.toFixed(2), cagr: l.times(100).toFixed(4) }
1099
1126
  };
1100
1127
  }
1101
- }, Wa = 1200, za = {
1128
+ }, Za = 1200, Xa = {
1102
1129
  id: "invest.swp",
1103
1130
  group: "invest",
1104
1131
  title: "SWP Calculator",
@@ -1111,7 +1138,7 @@ const Aa = {
1111
1138
  { key: "tenureMonths", label: "Withdrawal period", kind: "tenure", default: 120, optional: !0 }
1112
1139
  ],
1113
1140
  compute(e, t) {
1114
- 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;
1141
+ 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) : Za;
1115
1142
  let c = r, l = n(0), p = 0;
1116
1143
  const h = [], f = [];
1117
1144
  let y = r, w = n(0);
@@ -1137,7 +1164,7 @@ const Aa = {
1137
1164
  rows: h,
1138
1165
  toneCols: { 2: "interest", 3: "principal" }
1139
1166
  },
1140
- chart: st(h.map((N) => N.label), f),
1167
+ chart: lt(h.map((N) => N.label), f),
1141
1168
  formula: "Each month: balance = balance·(1 + r/12) − withdrawal",
1142
1169
  notes: [
1143
1170
  S ? `The corpus is exhausted in month ${p}; the final withdrawal may be partial.` : "The corpus survives the whole withdrawal period; the remaining balance is shown.",
@@ -1150,7 +1177,7 @@ const Aa = {
1150
1177
  }
1151
1178
  };
1152
1179
  }
1153
- }, Ja = {
1180
+ }, Qa = {
1154
1181
  id: "invest.goal",
1155
1182
  group: "invest",
1156
1183
  title: "Goal SIP Planner",
@@ -1159,12 +1186,12 @@ const Aa = {
1159
1186
  inputs: [
1160
1187
  { key: "targetCorpus", label: "Today's cost of goal", kind: "money", prefix: "currency", default: "10000000" },
1161
1188
  { key: "years", label: "Years to goal", kind: "years", suffix: "years", default: 15 },
1162
- { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1163
- { key: "inflationPct", label: "Inflation", kind: "percent", suffix: "% p.a.", default: Ga },
1189
+ { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: st },
1190
+ { key: "inflationPct", label: "Inflation", kind: "percent", suffix: "% p.a.", default: Ya },
1164
1191
  { key: "existingSavings", label: "Existing savings", kind: "money", prefix: "currency", default: "0", optional: !0 }
1165
1192
  ],
1166
1193
  compute(e, t) {
1167
- const { D: n, fmt: a } = t, r = D(e.targetCorpus, "10000000"), s = Math.max(1, Math.round(C(e.years, 15))), u = C(e.expectedReturnPct, Number(t.settings.defaults.sipReturnPercent)), m = n(C(e.inflationPct, Number(t.settings.defaults.inflationPercent))).div(100), d = D(e.existingSavings, "0"), i = s * 12, c = J(u, 12), l = r.times(m.plus(1).pow(s)), p = et(d, c, i), h = l.minus(p), f = be(1, c, i, !0), y = h.gt(0) ? h.div(f) : n(0), w = y.times(i), k = h.gt(0) ? h.minus(w) : n(0), S = [
1194
+ const { D: n, fmt: a } = t, r = D(e.targetCorpus, "10000000"), s = Math.max(1, Math.round(C(e.years, 15))), u = C(e.expectedReturnPct, Number(t.settings.defaults.sipReturnPercent)), m = n(C(e.inflationPct, Number(t.settings.defaults.inflationPercent))).div(100), d = D(e.existingSavings, "0"), i = s * 12, c = J(u, 12), l = r.times(m.plus(1).pow(s)), p = tt(d, c, i), h = l.minus(p), f = be(1, c, i, !0), y = h.gt(0) ? h.div(f) : n(0), w = y.times(i), k = h.gt(0) ? h.minus(w) : n(0), S = [
1168
1195
  `Target grows with ${a.pct(m.times(100))} inflation to ${a.money(l)} in ${s} years.`
1169
1196
  ];
1170
1197
  d.gt(0) && S.push(`Existing savings grow to ${a.money(p)}, reducing what the SIP must fund.`);
@@ -1188,14 +1215,14 @@ const Aa = {
1188
1215
  }
1189
1216
  };
1190
1217
  }
1191
- }, 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) => ({
1218
+ }, er = [Ka, Wa, Ja, Xa, Qa], An = "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) => ({
1192
1219
  labels: e,
1193
1220
  series: [{ name: n, tone: "accent", points: t, area: !0 }]
1194
1221
  }), Be = (e, t, n) => ({
1195
1222
  columns: e,
1196
1223
  rows: t,
1197
1224
  toneCols: { [n]: "interest" }
1198
- }), Xa = {
1225
+ }), tr = {
1199
1226
  id: "invest.fd",
1200
1227
  group: "invest",
1201
1228
  title: "Fixed Deposit (FD)",
@@ -1256,7 +1283,7 @@ const Aa = {
1256
1283
  formula: i ? "Interest/period = P·(r/f); principal returned at maturity" : "A = P·(1 + r/f)^(f·t)",
1257
1284
  notes: [
1258
1285
  i ? "Interest is paid out each period; the principal is returned at maturity." : "Interest is reinvested (compounded) and paid with the principal at maturity.",
1259
- $n
1286
+ An
1260
1287
  ],
1261
1288
  raw: {
1262
1289
  maturity: k.toFixed(2),
@@ -1267,7 +1294,7 @@ const Aa = {
1267
1294
  }
1268
1295
  };
1269
1296
  }
1270
- }, Qa = {
1297
+ }, nr = {
1271
1298
  id: "invest.rd",
1272
1299
  group: "invest",
1273
1300
  title: "Recurring Deposit (RD)",
@@ -1308,12 +1335,12 @@ const Aa = {
1308
1335
  schedule: Be(["Year", "Invested", "Interest", "Value"], p, 2),
1309
1336
  chart: Oe(p.map((f) => f.label), h, "Value"),
1310
1337
  formula: "M = Σ deposit·(1 + r/4)^(quarters remaining)",
1311
- notes: ["Interest is compounded quarterly, the standard for bank recurring deposits.", $n],
1338
+ notes: ["Interest is compounded quarterly, the standard for bank recurring deposits.", An],
1312
1339
  warnings: d,
1313
1340
  raw: { maturity: i.toFixed(2), invested: c.toFixed(2), interest: l.toFixed(2) }
1314
1341
  };
1315
1342
  }
1316
- }, er = {
1343
+ }, ar = {
1317
1344
  id: "invest.ppf",
1318
1345
  group: "invest",
1319
1346
  title: "Public Provident Fund (PPF)",
@@ -1370,7 +1397,7 @@ const Aa = {
1370
1397
  raw: { maturity: i.toFixed(2), invested: p.toFixed(2), interest: h.toFixed(2) }
1371
1398
  };
1372
1399
  }
1373
- }, tr = {
1400
+ }, rr = {
1374
1401
  id: "invest.nps",
1375
1402
  group: "invest",
1376
1403
  title: "National Pension System (NPS)",
@@ -1414,7 +1441,7 @@ const Aa = {
1414
1441
  }
1415
1442
  };
1416
1443
  }
1417
- }, nr = {
1444
+ }, or = {
1418
1445
  id: "invest.epf",
1419
1446
  group: "invest",
1420
1447
  title: "Employees’ Provident Fund (EPF)",
@@ -1463,7 +1490,7 @@ const Aa = {
1463
1490
  raw: { corpus: h.toFixed(2), contributions: f.toFixed(2), interest: k.toFixed(2) }
1464
1491
  };
1465
1492
  }
1466
- }, ar = {
1493
+ }, ir = {
1467
1494
  id: "invest.ssy",
1468
1495
  group: "invest",
1469
1496
  title: "Sukanya Samriddhi Yojana (SSY)",
@@ -1506,7 +1533,7 @@ const Aa = {
1506
1533
  raw: { maturity: l.toFixed(2), invested: f.toFixed(2), interest: y.toFixed(2) }
1507
1534
  };
1508
1535
  }
1509
- }, rr = [Xa, Qa, er, tr, nr, ar], or = {
1536
+ }, sr = [tr, nr, ar, rr, or, ir], lr = {
1510
1537
  id: "invest.401k",
1511
1538
  group: "invest",
1512
1539
  title: "401(k) with Employer Match",
@@ -1570,7 +1597,7 @@ const Aa = {
1570
1597
  }
1571
1598
  };
1572
1599
  }
1573
- }, ir = {
1600
+ }, cr = {
1574
1601
  id: "invest.iraCompare",
1575
1602
  group: "invest",
1576
1603
  title: "Roth vs Traditional IRA",
@@ -1624,7 +1651,7 @@ const Aa = {
1624
1651
  }
1625
1652
  };
1626
1653
  }
1627
- }, sr = {
1654
+ }, ur = {
1628
1655
  id: "invest.529",
1629
1656
  group: "invest",
1630
1657
  title: "529 College Savings",
@@ -1640,7 +1667,7 @@ const Aa = {
1640
1667
  { key: "collegeCostInflationPct", label: "College cost inflation", kind: "percent", suffix: "%", default: 5, advanced: !0 }
1641
1668
  ],
1642
1669
  compute(e, t) {
1643
- const { fmt: n } = t, a = g(C(e.currentSavings)), r = g(C(e.monthlyContribution)), s = Math.max(0, Math.round(C(e.yearsUntilCollege))), u = s * 12, m = J(C(e.expectedReturnPct), 12), d = et(a, m, u), i = be(r, m, u), c = d.plus(i), l = a.plus(r.times(u)), p = c.minus(l), h = [
1670
+ const { fmt: n } = t, a = g(C(e.currentSavings)), r = g(C(e.monthlyContribution)), s = Math.max(0, Math.round(C(e.yearsUntilCollege))), u = s * 12, m = J(C(e.expectedReturnPct), 12), d = tt(a, m, u), i = be(r, m, u), c = d.plus(i), l = a.plus(r.times(u)), p = c.minus(l), h = [
1644
1671
  v("Total invested", n.money(l), "principal"),
1645
1672
  v("Investment growth", n.money(p), "interest")
1646
1673
  ], f = {
@@ -1654,7 +1681,7 @@ const Aa = {
1654
1681
  const k = g(C(e.currentAnnualCost)), S = g(C(e.collegeCostInflationPct)).div(100);
1655
1682
  let F = g(0);
1656
1683
  for (let x = 0; x < 4; x++)
1657
- F = F.plus(et(k, S, s + x));
1684
+ F = F.plus(tt(k, S, s + x));
1658
1685
  const N = c.minus(F), P = N.gte(0);
1659
1686
  h.push(v("4-year college cost", n.money(F), "default", "inflation-adjusted")), h.push(
1660
1687
  v(
@@ -1679,7 +1706,7 @@ const Aa = {
1679
1706
  raw: f
1680
1707
  };
1681
1708
  }
1682
- }, lr = [or, ir, sr], cr = (e) => e === "annual" ? 1 : e === "semiannual" ? 2 : e === "quarterly" ? 4 : 12, lt = (e) => _(e).split(/[, ]+/).map((t) => t.trim()).filter(Boolean).map(Number).filter((t) => Number.isFinite(t)), ur = {
1709
+ }, dr = [lr, cr, ur], mr = (e) => e === "annual" ? 1 : e === "semiannual" ? 2 : e === "quarterly" ? 4 : 12, ct = (e) => _(e).split(/[, ]+/).map((t) => t.trim()).filter(Boolean).map(Number).filter((t) => Number.isFinite(t)), pr = {
1683
1710
  id: "returns.tvm",
1684
1711
  group: "returns",
1685
1712
  title: "Time value of money (TVM)",
@@ -1710,7 +1737,7 @@ const Aa = {
1710
1737
  ] }
1711
1738
  ],
1712
1739
  compute(e) {
1713
- 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);
1740
+ const t = _(e.solveFor, "FV"), n = mr(_(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);
1714
1741
  let l = "Future value", p = g(0), h = "PV·(1+i)^n + PMT·[((1+i)^n − 1)/i]·timing + FV = 0";
1715
1742
  if (t === "FV")
1716
1743
  p = u.times(c(a, r)).plus(m.times(i(a, r))).neg(), l = "Future value";
@@ -1747,7 +1774,7 @@ const Aa = {
1747
1774
  }
1748
1775
  return { primary: v(l, p.toDecimalPlaces(2).toString(), "accent"), formula: h, raw: { value: p.toNumber() } };
1749
1776
  }
1750
- }, dr = {
1777
+ }, hr = {
1751
1778
  id: "returns.cagr",
1752
1779
  group: "returns",
1753
1780
  title: "CAGR",
@@ -1759,7 +1786,7 @@ const Aa = {
1759
1786
  { key: "years", label: "Period", kind: "years", default: "10" }
1760
1787
  ],
1761
1788
  compute(e, t) {
1762
- const n = t.D(C(e.begin)), a = t.D(C(e.end)), r = C(e.years) || 1, s = ot(n, a, r).times(100), u = a.minus(n).div(n).times(100);
1789
+ const n = t.D(C(e.begin)), a = t.D(C(e.end)), r = C(e.years) || 1, s = it(n, a, r).times(100), u = a.minus(n).div(n).times(100);
1763
1790
  return {
1764
1791
  primary: v("CAGR", `${t.fmt.num(s, 2)}%`, "accent"),
1765
1792
  secondary: [
@@ -1770,7 +1797,7 @@ const Aa = {
1770
1797
  raw: { cagr: s.toNumber(), absolute: u.toNumber() }
1771
1798
  };
1772
1799
  }
1773
- }, mr = {
1800
+ }, fr = {
1774
1801
  id: "returns.absolute",
1775
1802
  group: "returns",
1776
1803
  title: "Absolute return",
@@ -1783,14 +1810,14 @@ const Aa = {
1783
1810
  ],
1784
1811
  compute(e, t) {
1785
1812
  const n = t.D(C(e.invested)), a = t.D(C(e.current)), r = a.minus(n).div(n).times(100), s = C(e.years), u = [v("Total gain", t.fmt.money(a.minus(n)), a.gte(n) ? "positive" : "negative")];
1786
- return s > 0 && u.push(v("Annualised (CAGR)", `${t.fmt.num(ot(n, a, s).times(100), 2)}%`)), {
1813
+ return s > 0 && u.push(v("Annualised (CAGR)", `${t.fmt.num(it(n, a, s).times(100), 2)}%`)), {
1787
1814
  primary: v("Absolute return", `${t.fmt.num(r, 2)}%`, "accent"),
1788
1815
  secondary: u,
1789
1816
  formula: "Absolute return = (Current − Invested) / Invested",
1790
1817
  raw: { absolute: r.toNumber() }
1791
1818
  };
1792
1819
  }
1793
- }, pr = {
1820
+ }, yr = {
1794
1821
  id: "returns.xirr",
1795
1822
  group: "returns",
1796
1823
  title: "XIRR",
@@ -1806,7 +1833,7 @@ const Aa = {
1806
1833
  compute(e, t) {
1807
1834
  const a = (e.flows ?? []).filter((u) => u.date && u.amount !== "").map((u) => ({ date: u.date, amount: u.amount }));
1808
1835
  if (a.length < 2) return { primary: v("XIRR", "—"), warnings: ["Enter at least two dated cashflows."] };
1809
- const r = Rn(a);
1836
+ const r = En(a);
1810
1837
  if (!r) return { primary: v("XIRR", "—"), warnings: ["Need at least one negative and one positive cashflow."] };
1811
1838
  const s = r.times(100);
1812
1839
  return {
@@ -1815,7 +1842,7 @@ const Aa = {
1815
1842
  raw: { xirr: s.toNumber() }
1816
1843
  };
1817
1844
  }
1818
- }, hr = {
1845
+ }, br = {
1819
1846
  id: "returns.irr",
1820
1847
  group: "returns",
1821
1848
  title: "IRR",
@@ -1823,12 +1850,12 @@ const Aa = {
1823
1850
  keywords: ["irr", "internal rate of return"],
1824
1851
  inputs: [{ key: "series", label: "Cashflows (comma-separated, period 0 first)", kind: "text", default: "-100000, 30000, 40000, 50000, 40000", help: "-100000, 30000, ..." }],
1825
1852
  compute(e, t) {
1826
- const n = lt(_(e.series));
1853
+ const n = ct(_(e.series));
1827
1854
  if (n.length < 2) return { primary: v("IRR", "—"), warnings: ["Enter at least two cashflows."] };
1828
- const a = Fn(n);
1855
+ const a = In(n);
1829
1856
  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."] };
1830
1857
  }
1831
- }, fr = {
1858
+ }, gr = {
1832
1859
  id: "returns.npv",
1833
1860
  group: "returns",
1834
1861
  title: "NPV",
@@ -1839,7 +1866,7 @@ const Aa = {
1839
1866
  { key: "series", label: "Cashflows (comma-separated, period 0 first)", kind: "text", default: "-100000, 30000, 40000, 50000, 40000" }
1840
1867
  ],
1841
1868
  compute(e, t) {
1842
- const n = lt(_(e.series)), a = At(g(C(e.ratePct)).div(100), n);
1869
+ const n = ct(_(e.series)), a = At(g(C(e.ratePct)).div(100), n);
1843
1870
  return {
1844
1871
  primary: v("NPV", t.fmt.money(a), a.gte(0) ? "positive" : "negative"),
1845
1872
  secondary: [v(a.gte(0) ? "Value-creating" : "Value-destroying", a.gte(0) ? "NPV ≥ 0" : "NPV < 0")],
@@ -1847,7 +1874,7 @@ const Aa = {
1847
1874
  raw: { npv: a.toNumber() }
1848
1875
  };
1849
1876
  }
1850
- }, yr = {
1877
+ }, vr = {
1851
1878
  id: "returns.mirr",
1852
1879
  group: "returns",
1853
1880
  title: "MIRR",
@@ -1859,7 +1886,7 @@ const Aa = {
1859
1886
  { key: "reinvestPct", label: "Reinvestment rate", kind: "percent", default: "12" }
1860
1887
  ],
1861
1888
  compute(e, t) {
1862
- const n = lt(_(e.series)), a = n.length - 1;
1889
+ const n = ct(_(e.series)), a = n.length - 1;
1863
1890
  if (a < 1) return { primary: v("MIRR", "—"), warnings: ["Enter at least two cashflows."] };
1864
1891
  const r = g(C(e.financePct)).div(100), s = g(C(e.reinvestPct)).div(100);
1865
1892
  let u = g(0), m = g(0);
@@ -1869,7 +1896,7 @@ const Aa = {
1869
1896
  const d = u.div(m.neg()).pow(g(1).div(a)).minus(1).times(100);
1870
1897
  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() } };
1871
1898
  }
1872
- }, br = {
1899
+ }, kr = {
1873
1900
  id: "returns.payback",
1874
1901
  group: "returns",
1875
1902
  title: "Payback period",
@@ -1881,7 +1908,7 @@ const Aa = {
1881
1908
  { key: "discountPct", label: "Discount rate (for discounted payback)", kind: "percent", default: "0", optional: !0, advanced: !0 }
1882
1909
  ],
1883
1910
  compute(e, t) {
1884
- const n = t.D(C(e.investment)), a = lt(_(e.series)), r = g(C(e.discountPct)).div(100), s = r.gt(0);
1911
+ const n = t.D(C(e.investment)), a = ct(_(e.series)), r = g(C(e.discountPct)).div(100), s = r.gt(0);
1885
1912
  let u = g(0), m = 0, d = null;
1886
1913
  for (let i = 0; i < a.length; i++) {
1887
1914
  const c = s ? g(a[i]).div(r.plus(1).pow(i + 1)) : g(a[i]), l = u;
@@ -1898,7 +1925,7 @@ const Aa = {
1898
1925
  raw: { payback: d }
1899
1926
  };
1900
1927
  }
1901
- }, gr = {
1928
+ }, wr = {
1902
1929
  id: "returns.realReturn",
1903
1930
  group: "returns",
1904
1931
  title: "Real (inflation-adjusted) return",
@@ -1917,7 +1944,7 @@ const Aa = {
1917
1944
  raw: { real: r.toNumber() }
1918
1945
  };
1919
1946
  }
1920
- }, vr = {
1947
+ }, Nr = {
1921
1948
  id: "returns.rule72",
1922
1949
  group: "returns",
1923
1950
  title: "Rule of 72",
@@ -1938,17 +1965,17 @@ const Aa = {
1938
1965
  raw: { approx: a.toNumber(), exact: r.toNumber() }
1939
1966
  };
1940
1967
  }
1941
- }, kr = [
1942
- ur,
1943
- dr,
1944
- mr,
1968
+ }, xr = [
1945
1969
  pr,
1946
1970
  hr,
1947
1971
  fr,
1948
1972
  yr,
1949
1973
  br,
1950
1974
  gr,
1951
- vr
1975
+ vr,
1976
+ kr,
1977
+ wr,
1978
+ Nr
1952
1979
  ], Ne = "Estimate for planning only — not tax advice. Verify against current law and your own situation.";
1953
1980
  function Ut(e, t, n) {
1954
1981
  let a = g(0), r = 0;
@@ -1966,7 +1993,7 @@ function Ut(e, t, n) {
1966
1993
  }
1967
1994
  return { tax: a, rows: s };
1968
1995
  }
1969
- const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e, t) => e.gt(t) ? g(t) : e, ct = (e, t) => v(e, t, "positive"), xr = {
1996
+ const Sr = (e, t) => Ut(e, t, Cr).tax, Cr = { money: (e) => String(e) }, jt = (e, t) => e.gt(t) ? g(t) : e, ut = (e, t) => v(e, t, "positive"), Pr = {
1970
1997
  id: "tax.gst",
1971
1998
  group: "tax",
1972
1999
  title: "GST Calculator",
@@ -2047,7 +2074,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2047
2074
  }
2048
2075
  };
2049
2076
  }
2050
- }, Sr = {
2077
+ }, Tr = {
2051
2078
  id: "tax.tds",
2052
2079
  group: "tax",
2053
2080
  title: "TDS on Interest",
@@ -2081,7 +2108,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2081
2108
  ), {
2082
2109
  primary: v("TDS deducted", n.money(p), p.gt(0) ? "negative" : "positive"),
2083
2110
  secondary: [
2084
- ct("Net interest received", n.money(h)),
2111
+ ut("Net interest received", n.money(h)),
2085
2112
  v("Effective TDS rate", n.pct(f), "accent"),
2086
2113
  v("Applicable threshold", n.money(d), "default")
2087
2114
  ],
@@ -2094,7 +2121,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2094
2121
  "<60": [{ to: 25e4, rate: 0 }, { to: 5e5, rate: 5 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }],
2095
2122
  "60-80": [{ to: 3e5, rate: 0 }, { to: 5e5, rate: 5 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }],
2096
2123
  "80+": [{ to: 5e5, rate: 0 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }]
2097
- }, Cr = [
2124
+ }, Fr = [
2098
2125
  { to: 3e5, rate: 0 },
2099
2126
  { to: 7e5, rate: 5 },
2100
2127
  { to: 1e6, rate: 10 },
@@ -2102,7 +2129,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2102
2129
  { to: 15e5, rate: 20 },
2103
2130
  { to: 1 / 0, rate: 30 }
2104
2131
  ];
2105
- function Pr(e, t, n) {
2132
+ function Ir(e, t, n) {
2106
2133
  const r = [
2107
2134
  { threshold: 5e7, rate: 25, prev: 20 },
2108
2135
  { threshold: 2e7, rate: 20, prev: 15 },
@@ -2114,10 +2141,10 @@ function Pr(e, t, n) {
2114
2141
  return i.gt(0) ? s.minus(i) : s;
2115
2142
  }
2116
2143
  function Yt(e, t, n, a, r) {
2117
- 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);
2144
+ 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 = Ir(e, d, (p) => Sr(g(p), t)), c = d.plus(i).times("0.04"), l = d.plus(i).plus(c);
2118
2145
  return { taxable: e, base: s, rebate: m, surcharge: i, cess: c, total: l, rows: u };
2119
2146
  }
2120
- const Tr = {
2147
+ const Rr = {
2121
2148
  id: "tax.incomeIN",
2122
2149
  group: "tax",
2123
2150
  title: "Income Tax (Old vs New)",
@@ -2143,7 +2170,7 @@ const Tr = {
2143
2170
  { key: "homeLoanInterest", label: "Home loan interest (24b)", kind: "money", prefix: "currency", default: "0", help: "max ₹2L", optional: !0 }
2144
2171
  ],
2145
2172
  compute(e, t) {
2146
- 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();
2173
+ 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, Fr, 7e5, 25e3, n), w = !y.total.gt(p.total), k = w ? y : p, S = p.total.minus(y.total).abs();
2147
2174
  return {
2148
2175
  primary: v(
2149
2176
  `${w ? "New" : "Old"} regime is cheaper`,
@@ -2179,7 +2206,7 @@ const Tr = {
2179
2206
  }
2180
2207
  };
2181
2208
  }
2182
- }, Fr = {
2209
+ }, Er = {
2183
2210
  id: "tax.capitalGains",
2184
2211
  group: "tax",
2185
2212
  title: "Capital Gains Tax",
@@ -2228,7 +2255,7 @@ const Tr = {
2228
2255
  raw: { gain: d.toFixed(2), tax: h ? null : l.toFixed(2), type: p, isLong: c ? 1 : 0 }
2229
2256
  };
2230
2257
  }
2231
- }, Ir = {
2258
+ }, Mr = {
2232
2259
  id: "tax.hra",
2233
2260
  group: "tax",
2234
2261
  title: "HRA Exemption",
@@ -2248,7 +2275,7 @@ const Tr = {
2248
2275
  l.lt(h) && (h = l), p.lt(h) && (h = p);
2249
2276
  const f = s.minus(h);
2250
2277
  return {
2251
- primary: ct("HRA exempt", n.money(h)),
2278
+ primary: ut("HRA exempt", n.money(h)),
2252
2279
  secondary: [
2253
2280
  v("Taxable HRA", n.money(f), "negative"),
2254
2281
  v("HRA received", n.money(s), "principal"),
@@ -2263,7 +2290,7 @@ const Tr = {
2263
2290
  raw: { exempt: h.toFixed(2), taxable: f.toFixed(2), limitRent: l.toFixed(2), limitPct: p.toFixed(2) }
2264
2291
  };
2265
2292
  }
2266
- }, Rr = {
2293
+ }, $r = {
2267
2294
  id: "tax.advanceTax",
2268
2295
  group: "tax",
2269
2296
  title: "Advance Tax Instalments",
@@ -2304,7 +2331,7 @@ const Tr = {
2304
2331
  raw: { advanceTaxDue: u.toFixed(2), liability: a.toFixed(2), tdsPaid: r.toFixed(2) }
2305
2332
  };
2306
2333
  }
2307
- }, Er = {
2334
+ }, Ar = {
2308
2335
  id: "tax.salesTaxUS",
2309
2336
  group: "tax",
2310
2337
  title: "Sales Tax",
@@ -2362,7 +2389,7 @@ const Tr = {
2362
2389
  { to: 609350, rate: 35 },
2363
2390
  { to: 1 / 0, rate: 37 }
2364
2391
  ]
2365
- }, Mr = { single: 14600, marriedJoint: 29200, headOfHousehold: 21900 }, $r = {
2392
+ }, Dr = { single: 14600, marriedJoint: 29200, headOfHousehold: 21900 }, Lr = {
2366
2393
  id: "tax.incomeUS",
2367
2394
  group: "tax",
2368
2395
  title: "Federal Income Tax",
@@ -2402,14 +2429,14 @@ const Tr = {
2402
2429
  }
2403
2430
  ],
2404
2431
  compute(e, t) {
2405
- 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);
2432
+ 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(Dr[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);
2406
2433
  return {
2407
2434
  primary: v("Federal income tax", n.money(c), "negative"),
2408
2435
  secondary: [
2409
2436
  v("Taxable income", n.money(i), "principal", `after ${n.money(m)} deduction`),
2410
2437
  v("Effective rate", n.pct(p), "accent"),
2411
2438
  v("Marginal rate", `${f}%`, "default"),
2412
- ct("After-tax income", n.money(y))
2439
+ ut("After-tax income", n.money(y))
2413
2440
  ],
2414
2441
  schedule: {
2415
2442
  title: "Bracket breakdown",
@@ -2431,7 +2458,7 @@ const Tr = {
2431
2458
  }
2432
2459
  };
2433
2460
  }
2434
- }, Ar = {
2461
+ }, Ur = {
2435
2462
  id: "tax.mortgageDeductionUS",
2436
2463
  group: "tax",
2437
2464
  title: "Mortgage Interest Deduction",
@@ -2449,7 +2476,7 @@ const Tr = {
2449
2476
  "Acquisition-debt limit is $750,000 ($375,000 if married filing separately) for loans after 15 Dec 2017. " + Ne
2450
2477
  ];
2451
2478
  return s.gt(u) && i.unshift(`Loan balance exceeds $750k: only ${n.pct(g(u).div(s).times(100))} of the interest is deductible.`), {
2452
- primary: ct("Estimated tax savings", n.money(d)),
2479
+ primary: ut("Estimated tax savings", n.money(d)),
2453
2480
  secondary: [
2454
2481
  v("Deductible interest", n.money(m), "principal"),
2455
2482
  v("Marginal tax rate", n.pct(g(C(e.marginalTaxRatePct, 24))), "accent")
@@ -2459,16 +2486,16 @@ const Tr = {
2459
2486
  raw: { savings: d.toFixed(2), deductibleInterest: m.toFixed(2) }
2460
2487
  };
2461
2488
  }
2462
- }, Dr = [
2463
- xr,
2464
- Sr,
2489
+ }, Or = [
2490
+ Pr,
2465
2491
  Tr,
2466
- Fr,
2467
- Ir,
2468
2492
  Rr,
2469
2493
  Er,
2494
+ Mr,
2470
2495
  $r,
2471
- Ar
2496
+ Ar,
2497
+ Lr,
2498
+ Ur
2472
2499
  ], $e = {
2473
2500
  length: { m: 1, km: 1e3, cm: 0.01, mm: 1e-3, mi: 1609.344, yd: 0.9144, ft: 0.3048, in: 0.0254 },
2474
2501
  area: { sqm: 1, sqft: 0.092903, sqyd: 0.836127, acre: 4046.8564224, hectare: 1e4, bigha: 1337.8, gunta: 101.17, cent: 40.4686 },
@@ -2508,10 +2535,10 @@ const Tr = {
2508
2535
  C: "Celsius (°C)",
2509
2536
  F: "Fahrenheit (°F)",
2510
2537
  K: "Kelvin (K)"
2511
- }, Lr = ["C", "F", "K"], Wt = (e) => e.map((t) => ({ value: t, label: Pt[t] ?? t })), Ae = (e, t, n, a) => [
2538
+ }, Br = ["C", "F", "K"], Wt = (e) => e.map((t) => ({ value: t, label: Pt[t] ?? t })), Ae = (e, t, n, a) => [
2512
2539
  { key: `${e}From`, label: "From", kind: "select", default: n, options: Wt(t), showIf: (r) => r.category === e },
2513
2540
  { key: `${e}To`, label: "To", kind: "select", default: a, options: Wt(t), showIf: (r) => r.category === e }
2514
- ], Ur = {
2541
+ ], _r = {
2515
2542
  id: "tools.units",
2516
2543
  group: "tools",
2517
2544
  title: "Unit Converter",
@@ -2536,7 +2563,7 @@ const Tr = {
2536
2563
  ...Ae("area", Object.keys($e.area), "acre", "sqm"),
2537
2564
  ...Ae("weight", Object.keys($e.weight), "kg", "lb"),
2538
2565
  ...Ae("volume", Object.keys($e.volume), "l", "gal_us"),
2539
- ...Ae("temperature", Lr, "C", "F")
2566
+ ...Ae("temperature", Br, "C", "F")
2540
2567
  ],
2541
2568
  compute(e, t) {
2542
2569
  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 = [];
@@ -2555,14 +2582,14 @@ const Tr = {
2555
2582
  raw: { result: i.toFixed(6), from: u, to: m, category: s }
2556
2583
  };
2557
2584
  }
2558
- }, je = 864e5, ht = (e) => {
2585
+ }, je = 864e5, ft = (e) => {
2559
2586
  if (!e) {
2560
2587
  const r = /* @__PURE__ */ new Date();
2561
2588
  return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate()));
2562
2589
  }
2563
2590
  const [t, n, a] = e.split("-").map(Number);
2564
2591
  return new Date(Date.UTC(t, (n || 1) - 1, a || 1));
2565
- }, ft = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Ve = (e) => e.toISOString().slice(0, 10), Or = {
2592
+ }, yt = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Ve = (e) => e.toISOString().slice(0, 10), Hr = {
2566
2593
  id: "tools.dateCalc",
2567
2594
  group: "tools",
2568
2595
  title: "Date Calculator",
@@ -2609,15 +2636,15 @@ const Tr = {
2609
2636
  ],
2610
2637
  compute(e) {
2611
2638
  if (_(e.mode, "difference") === "addSubtract") {
2612
- const l = ht(_(e.startDate, "")), p = Math.round(C(e.count, 0)), h = _(e.unit, "days"), f = _(e.direction, "add") === "subtract" ? -1 : 1, y = f * p;
2639
+ const l = ft(_(e.startDate, "")), p = Math.round(C(e.count, 0)), h = _(e.unit, "days"), f = _(e.direction, "add") === "subtract" ? -1 : 1, y = f * p;
2613
2640
  let w;
2614
2641
  if (h === "days" || h === "weeks")
2615
2642
  w = new Date(l.getTime() + y * (h === "weeks" ? 7 : 1) * je);
2616
2643
  else if (h === "months") {
2617
- const S = l.getUTCMonth() + y, F = l.getUTCFullYear() + Math.floor(S / 12), N = (S % 12 + 12) % 12, P = Math.min(l.getUTCDate(), ft(F, N + 1));
2644
+ const S = l.getUTCMonth() + y, F = l.getUTCFullYear() + Math.floor(S / 12), N = (S % 12 + 12) % 12, P = Math.min(l.getUTCDate(), yt(F, N + 1));
2618
2645
  w = new Date(Date.UTC(F, N, P));
2619
2646
  } else {
2620
- const S = l.getUTCFullYear() + y, F = Math.min(l.getUTCDate(), ft(S, l.getUTCMonth() + 1));
2647
+ const S = l.getUTCFullYear() + y, F = Math.min(l.getUTCDate(), yt(S, l.getUTCMonth() + 1));
2621
2648
  w = new Date(Date.UTC(S, l.getUTCMonth(), F));
2622
2649
  }
2623
2650
  const k = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][w.getUTCDay()];
@@ -2627,10 +2654,10 @@ const Tr = {
2627
2654
  raw: { resultDate: Ve(w), weekday: k, from: Ve(l) }
2628
2655
  };
2629
2656
  }
2630
- let n = ht(_(e.startDate, "")), a = ht(_(e.endDate, "")), r = !1;
2657
+ let n = ft(_(e.startDate, "")), a = ft(_(e.endDate, "")), r = !1;
2631
2658
  a.getTime() < n.getTime() && ([n, a] = [a, n], r = !0);
2632
2659
  let s = a.getUTCFullYear() - n.getUTCFullYear(), u = a.getUTCMonth() - n.getUTCMonth(), m = a.getUTCDate() - n.getUTCDate();
2633
- m < 0 && (u -= 1, m += ft(a.getUTCFullYear(), a.getUTCMonth())), u < 0 && (s -= 1, u += 12);
2660
+ m < 0 && (u -= 1, m += yt(a.getUTCFullYear(), a.getUTCMonth())), u < 0 && (s -= 1, u += 12);
2634
2661
  const d = Math.round((a.getTime() - n.getTime()) / je);
2635
2662
  let i = 0;
2636
2663
  for (let l = n.getTime() + je; l <= a.getTime(); l += je) {
@@ -2649,10 +2676,10 @@ const Tr = {
2649
2676
  raw: { years: s, months: u, days: m, totalDays: d, weeks: Number((d / 7).toFixed(2)), businessDays: i }
2650
2677
  };
2651
2678
  }
2652
- }, Tt = ["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"], tt = (e) => e < 20 ? Tt[e] : Br[Math.floor(e / 10)] + (e % 10 ? " " + Tt[e % 10] : ""), Ft = (e) => {
2679
+ }, Tt = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"], qr = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"], nt = (e) => e < 20 ? Tt[e] : qr[Math.floor(e / 10)] + (e % 10 ? " " + Tt[e % 10] : ""), Ft = (e) => {
2653
2680
  const t = Math.floor(e / 100), n = e % 100, a = [];
2654
- return t && a.push(Tt[t] + " Hundred"), n && a.push(tt(n)), a.join(" ");
2655
- }, An = (e) => {
2681
+ return t && a.push(Tt[t] + " Hundred"), n && a.push(nt(n)), a.join(" ");
2682
+ }, Dn = (e) => {
2656
2683
  if (e === 0) return "Zero";
2657
2684
  const t = ["", " Thousand", " Million", " Billion", " Trillion"], n = [];
2658
2685
  let a = 0;
@@ -2661,11 +2688,11 @@ const Tr = {
2661
2688
  r && n.unshift(Ft(r) + t[a]), e = Math.floor(e / 1e3), a++;
2662
2689
  }
2663
2690
  return n.length ? n.join(" ") : "Zero";
2664
- }, _r = (e) => {
2691
+ }, Gr = (e) => {
2665
2692
  if (e === 0) return "Zero";
2666
2693
  const t = Math.floor(e / 1e7), n = Math.floor(e / 1e5) % 100, a = Math.floor(e / 1e3) % 100, r = e % 1e3, s = [];
2667
- return t && s.push((t <= 999 ? Ft(t) : An(t)) + " Crore"), n && s.push(tt(n) + " Lakh"), a && s.push(tt(a) + " Thousand"), r && s.push(Ft(r)), s.join(" ");
2668
- }, Hr = {
2694
+ return t && s.push((t <= 999 ? Ft(t) : Dn(t)) + " Crore"), n && s.push(nt(n) + " Lakh"), a && s.push(nt(a) + " Thousand"), r && s.push(Ft(r)), s.join(" ");
2695
+ }, jr = {
2669
2696
  id: "tools.numToWords",
2670
2697
  group: "tools",
2671
2698
  title: "Number to Words",
@@ -2687,15 +2714,15 @@ const Tr = {
2687
2714
  ],
2688
2715
  compute(e, t) {
2689
2716
  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";
2690
- let y = r === "western" ? An(l) : _r(l);
2691
- return c > 0 && (y += ` and ${tt(c)} ${f}`), s && (y = `${h} ${y} Only`), m && (y = `Minus ${y}`), {
2717
+ let y = r === "western" ? Dn(l) : Gr(l);
2718
+ return c > 0 && (y += ` and ${nt(c)} ${f}`), s && (y = `${h} ${y} Only`), m && (y = `Minus ${y}`), {
2692
2719
  primary: v("In words", y, "accent"),
2693
2720
  secondary: [v("In figures", a.num(u, c > 0 ? 2 : 0))],
2694
2721
  notes: ['Words are Title Case with the chosen number scale; the cheque format adds the currency name and "Only".'],
2695
2722
  raw: { words: y, integer: l, fraction: c }
2696
2723
  };
2697
2724
  }
2698
- }, qr = [Ur, Or, Hr], Gr = [
2725
+ }, Vr = [_r, Hr, jr], Yr = [
2699
2726
  {
2700
2727
  id: "tools.scientific",
2701
2728
  group: "tools",
@@ -2706,7 +2733,7 @@ const Tr = {
2706
2733
  compute: () => ({ primary: { label: "Scientific calculator", value: "" } }),
2707
2734
  custom: "scientific"
2708
2735
  }
2709
- ], jr = {
2736
+ ], Kr = {
2710
2737
  id: "loan.emi",
2711
2738
  group: "loans",
2712
2739
  title: "EMI / Loan",
@@ -2715,7 +2742,7 @@ const Tr = {
2715
2742
  inputs: [],
2716
2743
  compute: () => ({ primary: { label: "", value: "" } }),
2717
2744
  custom: "loan.emi"
2718
- }, Vr = {
2745
+ }, Wr = {
2719
2746
  id: "tools.currency",
2720
2747
  group: "tools",
2721
2748
  title: "Currency converter",
@@ -2724,49 +2751,49 @@ const Tr = {
2724
2751
  inputs: [],
2725
2752
  compute: () => ({ primary: { label: "", value: "" } }),
2726
2753
  custom: "currency"
2727
- }, Yr = [
2728
- jr,
2729
- Vr,
2730
- ...qa,
2731
- ...Za,
2732
- ...rr,
2733
- ...lr,
2734
- ...kr,
2735
- ...Dr,
2736
- ...qr,
2737
- ...Gr
2754
+ }, zr = [
2755
+ Kr,
2756
+ Wr,
2757
+ ...Va,
2758
+ ...er,
2759
+ ...sr,
2760
+ ...dr,
2761
+ ...xr,
2762
+ ...Or,
2763
+ ...Vr,
2764
+ ...Yr
2738
2765
  ], It = [];
2739
- function hs(e) {
2766
+ function fs(e) {
2740
2767
  It.some((t) => t.id === e.id) || It.push(e);
2741
2768
  }
2742
- function Dn() {
2743
- return [...Yr, ...It];
2769
+ function Ln() {
2770
+ return [...zr, ...It];
2744
2771
  }
2745
- function Kr(e) {
2746
- return Dn().filter((t) => !t.regions || t.regions.includes(e));
2772
+ function Jr(e) {
2773
+ return Ln().filter((t) => !t.regions || t.regions.includes(e));
2747
2774
  }
2748
2775
  function Rt(e) {
2749
- return Dn().find((t) => t.id === e);
2776
+ return Ln().find((t) => t.id === e);
2750
2777
  }
2751
- const Wr = [
2778
+ const Zr = [
2752
2779
  { id: "loans", label: "Loans" },
2753
2780
  { id: "invest", label: "Invest" },
2754
2781
  { id: "returns", label: "Returns" },
2755
2782
  { id: "tax", label: "Tax" },
2756
2783
  { id: "tools", label: "Tools" }
2757
2784
  ];
2758
- function zr(e, t) {
2785
+ function Xr(e, t) {
2759
2786
  var n;
2760
2787
  return ((n = e.labelByRegion) == null ? void 0 : n[t]) ?? e.label;
2761
2788
  }
2762
- function Jr({
2789
+ function Qr({
2763
2790
  f: e,
2764
2791
  value: t,
2765
2792
  onChange: n,
2766
2793
  values: a
2767
2794
  }) {
2768
2795
  var i, c;
2769
- const { settings: r } = ue(), s = r.region, u = zr(e, s), m = r.currency.symbol, d = t == null ? "" : String(t);
2796
+ const { settings: r } = ue(), s = r.region, u = Xr(e, s), m = r.currency.symbol, d = t == null ? "" : String(t);
2770
2797
  switch (e.kind) {
2771
2798
  case "money":
2772
2799
  case "number":
@@ -2804,7 +2831,7 @@ function Jr({
2804
2831
  ] })
2805
2832
  ] });
2806
2833
  case "tenure":
2807
- return /* @__PURE__ */ o(Zr, { f: e, label: u, months: Number(t) || 0, onChange: n });
2834
+ return /* @__PURE__ */ o(eo, { f: e, label: u, months: Number(t) || 0, onChange: n });
2808
2835
  case "select":
2809
2836
  return /* @__PURE__ */ b("label", { className: "field", children: [
2810
2837
  /* @__PURE__ */ o("span", { className: "lbl", children: u }),
@@ -2842,12 +2869,12 @@ function Jr({
2842
2869
  /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("input", { value: d, placeholder: e.help, onChange: (l) => n(l.target.value), "aria-label": u }) })
2843
2870
  ] });
2844
2871
  case "cashflows":
2845
- return /* @__PURE__ */ o(Xr, { f: e, label: u, value: t ?? [], onChange: n });
2872
+ return /* @__PURE__ */ o(to, { f: e, label: u, value: t ?? [], onChange: n });
2846
2873
  default:
2847
2874
  return null;
2848
2875
  }
2849
2876
  }
2850
- function Zr({
2877
+ function eo({
2851
2878
  f: e,
2852
2879
  label: t,
2853
2880
  months: n,
@@ -2887,7 +2914,7 @@ function Zr({
2887
2914
  e.suffix && /* @__PURE__ */ o("div", { className: "solved-note", children: e.suffix })
2888
2915
  ] });
2889
2916
  }
2890
- function Xr({
2917
+ function to({
2891
2918
  label: e,
2892
2919
  value: t,
2893
2920
  onChange: n
@@ -2910,7 +2937,7 @@ function Xr({
2910
2937
  /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: () => s([...a, { date: "", amount: "" }]), children: "+ Add cashflow" })
2911
2938
  ] });
2912
2939
  }
2913
- const Ln = {
2940
+ const Un = {
2914
2941
  principal: "pr-txt",
2915
2942
  interest: "in-txt",
2916
2943
  accent: "accent-txt",
@@ -2918,11 +2945,11 @@ const Ln = {
2918
2945
  negative: "neg-txt",
2919
2946
  default: ""
2920
2947
  };
2921
- function Qr({ view: e }) {
2948
+ function no({ view: e }) {
2922
2949
  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);
2923
2950
  return /* @__PURE__ */ b("div", { className: "result", "aria-live": "polite", children: [
2924
2951
  /* @__PURE__ */ o("div", { className: "label", children: e.primary.label }),
2925
- /* @__PURE__ */ b("div", { className: `value num ${u ? "value-text" : ""} ${Ln[e.primary.tone ?? "default"]}`, children: [
2952
+ /* @__PURE__ */ b("div", { className: `value num ${u ? "value-text" : ""} ${Un[e.primary.tone ?? "default"]}`, children: [
2926
2953
  r && /* @__PURE__ */ o("span", { className: "cur", children: n }),
2927
2954
  s,
2928
2955
  e.primaryPer && /* @__PURE__ */ b("span", { className: "per", children: [
@@ -2931,18 +2958,18 @@ function Qr({ view: e }) {
2931
2958
  ] })
2932
2959
  ] }),
2933
2960
  e.primary.sub && /* @__PURE__ */ o("div", { className: "per", children: e.primary.sub }),
2934
- e.split && e.split.length > 0 && /* @__PURE__ */ o(to, { split: e.split }),
2935
- e.secondary && e.secondary.length > 0 && /* @__PURE__ */ o("div", { className: "secondary", children: e.secondary.map((m, d) => /* @__PURE__ */ o(eo, { m }, d)) })
2961
+ e.split && e.split.length > 0 && /* @__PURE__ */ o(ro, { split: e.split }),
2962
+ e.secondary && e.secondary.length > 0 && /* @__PURE__ */ o("div", { className: "secondary", children: e.secondary.map((m, d) => /* @__PURE__ */ o(ao, { m }, d)) })
2936
2963
  ] });
2937
2964
  }
2938
- function eo({ m: e }) {
2965
+ function ao({ m: e }) {
2939
2966
  return /* @__PURE__ */ b("div", { className: "kv", children: [
2940
2967
  /* @__PURE__ */ o("div", { className: "k", children: e.label }),
2941
- /* @__PURE__ */ o("div", { className: `v num ${Ln[e.tone ?? "default"]}`, children: e.value }),
2968
+ /* @__PURE__ */ o("div", { className: `v num ${Un[e.tone ?? "default"]}`, children: e.value }),
2942
2969
  e.sub && /* @__PURE__ */ o("div", { className: "k", children: e.sub })
2943
2970
  ] });
2944
2971
  }
2945
- function to({ split: e }) {
2972
+ function ro({ split: e }) {
2946
2973
  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));
2947
2974
  return /* @__PURE__ */ b(re, { children: [
2948
2975
  /* @__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)) }),
@@ -2955,7 +2982,7 @@ function to({ split: e }) {
2955
2982
  ] }, r)) })
2956
2983
  ] });
2957
2984
  }
2958
- function no({ schedule: e }) {
2985
+ function oo({ schedule: e }) {
2959
2986
  var u;
2960
2987
  const [t, n] = M(/* @__PURE__ */ new Set([0])), a = (m) => {
2961
2988
  var d;
@@ -2997,7 +3024,7 @@ const zt = {
2997
3024
  interest: "var(--fc-interest)",
2998
3025
  accent: "var(--fc-accent)"
2999
3026
  };
3000
- function ao({ chart: e }) {
3027
+ function io({ chart: e }) {
3001
3028
  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`;
3002
3029
  return /* @__PURE__ */ b("div", { className: "chart", children: [
3003
3030
  /* @__PURE__ */ b("svg", { viewBox: "0 0 720 260", role: "img", "aria-label": "Projection chart", children: [
@@ -3013,7 +3040,7 @@ function ao({ chart: e }) {
3013
3040
  ] }, f)) })
3014
3041
  ] });
3015
3042
  }
3016
- const Un = 1, ro = [
3043
+ const On = 1, so = [
3017
3044
  { id: "csv", label: "CSV (.csv)" },
3018
3045
  { id: "tsv", label: "TSV (.tsv)" },
3019
3046
  { id: "json", label: "JSON (.json)" },
@@ -3042,7 +3069,7 @@ function _e(e) {
3042
3069
  for (const n of e.rows) t.push([n.label, ...n.cells]);
3043
3070
  return { header: e.columns, rows: t };
3044
3071
  }
3045
- function oo(e) {
3072
+ function lo(e) {
3046
3073
  var t;
3047
3074
  return e ? e.groups ? e.groups.reduce((n, a) => n + a.rows.length, 0) : ((t = e.rows) == null ? void 0 : t.length) ?? 0 : 0;
3048
3075
  }
@@ -3062,32 +3089,32 @@ function Se(e, t, n = "application/octet-stream") {
3062
3089
  URL.revokeObjectURL(r), s.remove();
3063
3090
  }, 0);
3064
3091
  }
3065
- function io(e, t) {
3092
+ function co(e, t) {
3066
3093
  let n = e == null ? "" : String(e);
3067
3094
  return /^[=+\-@\t\r]/.test(n) && (n = `'${n}`), (n.includes(t) || n.includes('"') || n.includes(`
3068
3095
  `) || n.includes("\r")) && (n = `"${n.replace(/"/g, '""')}"`), n;
3069
3096
  }
3070
- function so(e) {
3097
+ function uo(e) {
3071
3098
  var t;
3072
3099
  return ((t = e == null ? void 0 : e.numberFormat) == null ? void 0 : t.grouping) === "european" ? ";" : ",";
3073
3100
  }
3074
- function On(e, t) {
3101
+ function Bn(e, t) {
3075
3102
  const n = [["ArthaGanaka export"], ["Calculator", e.title]];
3076
3103
  for (const a of Re(e)) n.push(a);
3077
3104
  if (n.push([]), e.result.schedule) {
3078
3105
  const a = _e(e.result.schedule);
3079
3106
  n.push(a.header, ...a.rows);
3080
3107
  }
3081
- return n.map((a) => a.map((r) => io(r, t)).join(t)).join(`\r
3108
+ return n.map((a) => a.map((r) => co(r, t)).join(t)).join(`\r
3082
3109
  `);
3083
3110
  }
3084
- function lo(e) {
3085
- return On(e, so(e.settingsSnapshot));
3111
+ function mo(e) {
3112
+ return Bn(e, uo(e.settingsSnapshot));
3086
3113
  }
3087
- function co(e) {
3088
- return On(e, " ");
3114
+ function po(e) {
3115
+ return Bn(e, " ");
3089
3116
  }
3090
- function uo(e, t = Un) {
3117
+ function ho(e, t = On) {
3091
3118
  return JSON.stringify(
3092
3119
  {
3093
3120
  schemaVersion: t,
@@ -3107,7 +3134,7 @@ function uo(e, t = Un) {
3107
3134
  2
3108
3135
  );
3109
3136
  }
3110
- function mo(e) {
3137
+ function fo(e) {
3111
3138
  const t = new TextEncoder().encode(e);
3112
3139
  if (typeof btoa == "function") {
3113
3140
  let n = "";
@@ -3116,9 +3143,9 @@ function mo(e) {
3116
3143
  }
3117
3144
  return globalThis.Buffer.from(t).toString("base64");
3118
3145
  }
3119
- const po = (e) => mo(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3120
- function Bn(e, t) {
3121
- const n = po(JSON.stringify({ id: e, values: t }));
3146
+ const yo = (e) => fo(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3147
+ function _n(e, t) {
3148
+ const n = yo(JSON.stringify({ id: e, values: t }));
3122
3149
  return `#fincalc=${encodeURIComponent(e)}&s=${n}`;
3123
3150
  }
3124
3151
  const Ye = (e) => String(e ?? "").replace(/\|/g, "\\|").replace(/\n/g, " ");
@@ -3135,22 +3162,22 @@ function Jt(e) {
3135
3162
  `);
3136
3163
  }
3137
3164
  const Pe = (e) => String(e ?? "").replace(/[&<>"]/g, (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[t]);
3138
- function ho(e) {
3165
+ function bo(e) {
3139
3166
  return `<table><tbody>${Re(e).map(([n, a]) => `<tr><th>${Pe(n)}</th><td>${Pe(a)}</td></tr>`).join("")}</tbody></table>`;
3140
3167
  }
3141
- function fo(e) {
3168
+ function go(e) {
3142
3169
  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("");
3143
3170
  return `<table><thead>${n}</thead><tbody>${a}</tbody></table>`;
3144
3171
  }
3145
- function _n(e) {
3146
- const t = e.result.schedule ? `<h2>${Pe(e.result.schedule.title ?? "Schedule")}</h2>${fo(e.result.schedule)}` : "";
3147
- return `<h1>${Pe(e.title)}</h1>${ho(e)}${t}<p class="fc-print-foot">Generated by ArthaGanaka · ${Pe(e.meta.computedAt)}</p>`;
3172
+ function Hn(e) {
3173
+ const t = e.result.schedule ? `<h2>${Pe(e.result.schedule.title ?? "Schedule")}</h2>${go(e.result.schedule)}` : "";
3174
+ return `<h1>${Pe(e.title)}</h1>${bo(e)}${t}<p class="fc-print-foot">Generated by ArthaGanaka · ${Pe(e.meta.computedAt)}</p>`;
3148
3175
  }
3149
- 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) => {
3176
+ 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")}`, vo = (e) => new Date(e || Date.now()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z"), ko = (e, t) => {
3150
3177
  const n = new Date(e);
3151
3178
  return n.setMonth(n.getMonth() + t), n;
3152
3179
  };
3153
- function go(e) {
3180
+ function wo(e) {
3154
3181
  for (const t of Object.values(e))
3155
3182
  if (typeof t == "string" && /^\d{4}-\d{2}-\d{2}/.test(t)) {
3156
3183
  const n = new Date(t);
@@ -3158,12 +3185,12 @@ function go(e) {
3158
3185
  }
3159
3186
  return /* @__PURE__ */ new Date();
3160
3187
  }
3161
- function vo(e) {
3162
- const t = oo(e.result.schedule);
3188
+ function No(e) {
3189
+ const t = lo(e.result.schedule);
3163
3190
  if (!t) throw new Error("This calculator has no instalment schedule to put on a calendar.");
3164
- 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"];
3191
+ const n = wo(e.values), a = t <= 60, r = a ? t : Math.ceil(t / 12), s = vo(e.meta.computedAt), u = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//ArthaGanaka//Export//EN", "CALSCALE:GREGORIAN"];
3165
3192
  for (let m = 0; m < r; m++) {
3166
- const d = bo(n, a ? m + 1 : (m + 1) * 12), i = a ? `instalment ${m + 1}` : `year ${m + 1}`;
3193
+ const d = ko(n, a ? m + 1 : (m + 1) * 12), i = a ? `instalment ${m + 1}` : `year ${m + 1}`;
3167
3194
  u.push(
3168
3195
  "BEGIN:VEVENT",
3169
3196
  `UID:${Zt(e.calculatorId)}-${m + 1}-${Xt(d)}@arthaganaka`,
@@ -3176,13 +3203,13 @@ function vo(e) {
3176
3203
  return u.push("END:VCALENDAR"), u.join(`\r
3177
3204
  `);
3178
3205
  }
3179
- async function Hn(e) {
3206
+ async function qn(e) {
3180
3207
  var n;
3181
3208
  const t = typeof navigator < "u" ? navigator : void 0;
3182
3209
  if ((n = t == null ? void 0 : t.clipboard) != null && n.writeText) return t.clipboard.writeText(e);
3183
3210
  throw new Error("Clipboard is not available in this browser.");
3184
3211
  }
3185
- async function ko(e, t) {
3212
+ async function xo(e, t) {
3186
3213
  var a;
3187
3214
  const n = typeof navigator < "u" ? navigator : void 0;
3188
3215
  if ((a = n == null ? void 0 : n.clipboard) != null && a.write && typeof ClipboardItem < "u" && typeof Blob < "u")
@@ -3196,18 +3223,18 @@ async function ko(e, t) {
3196
3223
  return;
3197
3224
  } catch {
3198
3225
  }
3199
- await Hn(t);
3226
+ await qn(t);
3200
3227
  }
3201
- function wo(e) {
3228
+ function So(e) {
3202
3229
  if (!Ot() || typeof window > "u") throw new Error("Print is only available in the browser.");
3203
3230
  const t = document.createElement("div");
3204
- t.className = "fc-print-root", t.innerHTML = _n(e), document.body.appendChild(t), document.body.classList.add("fc-printing");
3231
+ t.className = "fc-print-root", t.innerHTML = Hn(e), document.body.appendChild(t), document.body.classList.add("fc-printing");
3205
3232
  const n = () => {
3206
3233
  document.body.classList.remove("fc-printing"), t.remove(), window.removeEventListener("afterprint", n);
3207
3234
  };
3208
3235
  window.addEventListener("afterprint", n), window.print(), setTimeout(n, 1500);
3209
3236
  }
3210
- function No(e, t = 2) {
3237
+ function Co(e, t = 2) {
3211
3238
  if (!Ot()) return Promise.reject(new Error("PNG export is only available in the browser."));
3212
3239
  const n = Re(e), a = 620, r = 120 + n.length * 30 + 30, s = document.createElement("canvas");
3213
3240
  s.width = a * t, s.height = r * t;
@@ -3224,7 +3251,7 @@ function No(e, t = 2) {
3224
3251
  (i, c) => s.toBlob((l) => l ? i(l) : c(new Error("Could not render PNG.")), "image/png")
3225
3252
  );
3226
3253
  }
3227
- async function xo(e) {
3254
+ async function Po(e) {
3228
3255
  let t;
3229
3256
  try {
3230
3257
  t = await import(
@@ -3250,7 +3277,7 @@ async function xo(e) {
3250
3277
  const s = ve(e, "pdf");
3251
3278
  return a.save(s), { ok: !0, filename: s };
3252
3279
  }
3253
- async function So(e) {
3280
+ async function To(e) {
3254
3281
  var i, c;
3255
3282
  let t;
3256
3283
  try {
@@ -3273,12 +3300,12 @@ async function So(e) {
3273
3300
  const m = a(u, { type: "array", bookType: "xlsx" }), d = ve(e, "xlsx");
3274
3301
  return Se(d, new Blob([m], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" })), { ok: !0, filename: d };
3275
3302
  }
3276
- function qn(e) {
3277
- const t = Bn(e.calculatorId, e.values);
3303
+ function Gn(e) {
3304
+ const t = _n(e.calculatorId, e.values);
3278
3305
  return (typeof location < "u" ? location.origin + location.pathname : "") + t;
3279
3306
  }
3280
- async function Co(e) {
3281
- const t = Bn(e.calculatorId, e.values), n = qn(e);
3307
+ async function Fo(e) {
3308
+ const t = _n(e.calculatorId, e.values), n = Gn(e);
3282
3309
  if (typeof location < "u")
3283
3310
  try {
3284
3311
  location.hash = t;
@@ -3286,31 +3313,31 @@ async function Co(e) {
3286
3313
  }
3287
3314
  const a = n.length > 2e3 ? `Link is long (${n.length} chars) — some apps may trim it. ` : "";
3288
3315
  try {
3289
- return await Hn(n), { ok: !0, data: n, note: `${a}Link copied to clipboard.` };
3316
+ return await qn(n), { ok: !0, data: n, note: `${a}Link copied to clipboard.` };
3290
3317
  } catch {
3291
3318
  return { ok: !0, data: n, note: `${a}Link is in the address bar — copy it from there.` };
3292
3319
  }
3293
3320
  }
3294
- function Po(e) {
3321
+ function Io(e) {
3295
3322
  return {
3296
3323
  ok: !0,
3297
- data: qn(e),
3324
+ data: Gn(e),
3298
3325
  note: "A QR image needs an optional QR library — share this link instead."
3299
3326
  };
3300
3327
  }
3301
- function To(e = {}) {
3302
- const t = e.schemaVersion ?? Un, n = {
3328
+ function Ro(e = {}) {
3329
+ const t = e.schemaVersion ?? On, n = {
3303
3330
  csv: (a) => {
3304
3331
  const r = ve(a, "csv");
3305
- return Se(r, lo(a), "text/csv;charset=utf-8"), { ok: !0, filename: r };
3332
+ return Se(r, mo(a), "text/csv;charset=utf-8"), { ok: !0, filename: r };
3306
3333
  },
3307
3334
  tsv: (a) => {
3308
3335
  const r = ve(a, "tsv");
3309
- return Se(r, co(a), "text/tab-separated-values;charset=utf-8"), { ok: !0, filename: r };
3336
+ return Se(r, po(a), "text/tab-separated-values;charset=utf-8"), { ok: !0, filename: r };
3310
3337
  },
3311
3338
  json: (a) => {
3312
3339
  const r = ve(a, "json");
3313
- return Se(r, uo(a, t), "application/json"), { ok: !0, filename: r };
3340
+ return Se(r, ho(a, t), "application/json"), { ok: !0, filename: r };
3314
3341
  },
3315
3342
  markdown: (a) => {
3316
3343
  const r = ve(a, "md");
@@ -3318,18 +3345,18 @@ function To(e = {}) {
3318
3345
  },
3319
3346
  ics: (a) => {
3320
3347
  const r = ve(a, "ics");
3321
- return Se(r, vo(a), "text/calendar;charset=utf-8"), { ok: !0, filename: r };
3348
+ return Se(r, No(a), "text/calendar;charset=utf-8"), { ok: !0, filename: r };
3322
3349
  },
3323
- clipboard: async (a) => (await ko(_n(a), Jt(a)), { ok: !0, note: "Copied table to clipboard." }),
3324
- print: (a) => (wo(a), { ok: !0 }),
3325
- url: (a) => Co(a),
3326
- qr: (a) => Po(a),
3350
+ clipboard: async (a) => (await xo(Hn(a), Jt(a)), { ok: !0, note: "Copied table to clipboard." }),
3351
+ print: (a) => (So(a), { ok: !0 }),
3352
+ url: (a) => Fo(a),
3353
+ qr: (a) => Io(a),
3327
3354
  png: async (a, r) => {
3328
3355
  const s = ve(a, "png");
3329
- return Se(s, await No(a, r.scale ?? 2)), { ok: !0, filename: s };
3356
+ return Se(s, await Co(a, r.scale ?? 2)), { ok: !0, filename: s };
3330
3357
  },
3331
- pdf: (a) => xo(a),
3332
- xlsx: (a) => So(a)
3358
+ pdf: (a) => Po(a),
3359
+ xlsx: (a) => To(a)
3333
3360
  };
3334
3361
  return {
3335
3362
  formats: Object.keys(n),
@@ -3339,13 +3366,13 @@ function To(e = {}) {
3339
3366
  }
3340
3367
  };
3341
3368
  }
3342
- function Gn({ payload: e }) {
3343
- const t = ne(() => To(), []), [n, a] = M(!1), [r, s] = M(null), u = de(null), m = de(null), d = de([]);
3344
- X(() => {
3369
+ function jn({ payload: e }) {
3370
+ const t = X(() => Ro(), []), [n, a] = M(!1), [r, s] = M(null), u = de(null), m = de(null), d = de([]);
3371
+ Q(() => {
3345
3372
  if (!r) return;
3346
3373
  const p = setTimeout(() => s(null), 4500);
3347
3374
  return () => clearTimeout(p);
3348
- }, [r]), X(() => {
3375
+ }, [r]), Q(() => {
3349
3376
  var h;
3350
3377
  if (!n) return;
3351
3378
  (h = d.current[0]) == null || h.focus();
@@ -3408,7 +3435,7 @@ function Gn({ payload: e }) {
3408
3435
  }
3409
3436
  )
3410
3437
  ] }),
3411
- n && /* @__PURE__ */ o("div", { ref: m, className: "menu-list", role: "menu", "aria-label": "Export as", children: ro.map((p, h) => /* @__PURE__ */ o(
3438
+ n && /* @__PURE__ */ o("div", { ref: m, className: "menu-list", role: "menu", "aria-label": "Export as", children: so.map((p, h) => /* @__PURE__ */ o(
3412
3439
  "button",
3413
3440
  {
3414
3441
  type: "button",
@@ -3425,10 +3452,10 @@ function Gn({ payload: e }) {
3425
3452
  r && /* @__PURE__ */ o("div", { className: `export-toast ${r.kind}`, role: "status", "aria-live": "polite", children: r.msg })
3426
3453
  ] });
3427
3454
  }
3428
- const Bt = "calcsuite:history", Fo = 100, Io = [];
3455
+ const Bt = "calcsuite:history", Eo = 100, Mo = [];
3429
3456
  let Ce = null;
3430
- const ze = /* @__PURE__ */ new Set();
3431
- function jn() {
3457
+ const Je = /* @__PURE__ */ new Set();
3458
+ function Vn() {
3432
3459
  if (Ce) return Ce;
3433
3460
  try {
3434
3461
  Ce = JSON.parse(localStorage.getItem(Bt) || "[]");
@@ -3437,39 +3464,39 @@ function jn() {
3437
3464
  }
3438
3465
  return Ce;
3439
3466
  }
3440
- function Vn(e) {
3467
+ function Yn(e) {
3441
3468
  Ce = e;
3442
3469
  try {
3443
3470
  localStorage.setItem(Bt, JSON.stringify(e));
3444
3471
  } catch {
3445
3472
  }
3446
- ze.forEach((t) => t());
3473
+ Je.forEach((t) => t());
3447
3474
  }
3448
3475
  let Qt = !1;
3449
- function Ro(e) {
3450
- return ze.add(e), !Qt && typeof window < "u" && (Qt = !0, window.addEventListener("storage", (t) => {
3451
- t.key === Bt && (Ce = null, ze.forEach((n) => n()));
3452
- })), () => ze.delete(e);
3476
+ function $o(e) {
3477
+ return Je.add(e), !Qt && typeof window < "u" && (Qt = !0, window.addEventListener("storage", (t) => {
3478
+ t.key === Bt && (Ce = null, Je.forEach((n) => n()));
3479
+ })), () => Je.delete(e);
3453
3480
  }
3454
- function Yn(e) {
3455
- Vn([{ ...e, at: Date.now() }, ...jn()].slice(0, Fo));
3481
+ function Kn(e) {
3482
+ Yn([{ ...e, at: Date.now() }, ...Vn()].slice(0, Eo));
3456
3483
  }
3457
- function Eo() {
3458
- Vn([]);
3484
+ function Ao() {
3485
+ Yn([]);
3459
3486
  }
3460
- function Mo() {
3461
- const e = ya(Ro, jn, () => Io), t = ke((a) => Yn(a), []), n = ke(() => Eo(), []);
3487
+ function Do() {
3488
+ const e = ba($o, Vn, () => Mo), t = ke((a) => Kn(a), []), n = ke(() => Ao(), []);
3462
3489
  return { items: e, save: t, clear: n };
3463
3490
  }
3464
- function Kn({ item: e }) {
3491
+ function Wn({ item: e }) {
3465
3492
  const [t, n] = M(!1), a = de();
3466
- return X(() => () => clearTimeout(a.current), []), /* @__PURE__ */ o("button", { className: `icon-btn ${t ? "saved" : ""}`, onClick: () => {
3467
- Yn(e), n(!0), clearTimeout(a.current), a.current = setTimeout(() => n(!1), 1500);
3493
+ return Q(() => () => clearTimeout(a.current), []), /* @__PURE__ */ o("button", { className: `icon-btn ${t ? "saved" : ""}`, onClick: () => {
3494
+ Kn(e), n(!0), clearTimeout(a.current), a.current = setTimeout(() => n(!1), 1500);
3468
3495
  }, "aria-live": "polite", children: t ? "Saved ✓" : "Save" });
3469
3496
  }
3470
- const $o = { payment: "Payment", principal: "Amount", rate: "Rate", tenure: "Term" };
3471
- function Wn() {
3472
- 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(() => {
3497
+ const Lo = { payment: "Payment", principal: "Amount", rate: "Rate", tenure: "Term" };
3498
+ function zn() {
3499
+ 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: $ } = X(() => {
3473
3500
  try {
3474
3501
  return { result: Ie({
3475
3502
  region: n,
@@ -3486,7 +3513,7 @@ function Wn() {
3486
3513
  payment: T ? t.money(T.payment) : "—",
3487
3514
  principal: T ? t.money(T.principal) : "—",
3488
3515
  rate: T ? `${t.num(T.annualRatePct, 3)} %` : "—",
3489
- tenure: T ? mt(T.tenureMonths) : "—"
3516
+ tenure: T ? pt(T.tenureMonths) : "—"
3490
3517
  }, G = T ? t.moneyParts(T.payment) : { symbol: "", digits: "—" }, q = e.currency.symbol, A = {
3491
3518
  region: n,
3492
3519
  basis: u,
@@ -3527,7 +3554,7 @@ function Wn() {
3527
3554
  { label: "Principal", value: t.money(R.principal) },
3528
3555
  { label: "Total interest", value: t.money(R.totalInterest), tone: "interest" },
3529
3556
  { label: "Total payment", value: t.money(R.totalPayment) },
3530
- { label: a.tenureWord, value: mt(R.tenureMonths) }
3557
+ { label: a.tenureWord, value: pt(R.tenureMonths) }
3531
3558
  ],
3532
3559
  schedule: j,
3533
3560
  formula: R.formula,
@@ -3544,7 +3571,7 @@ function Wn() {
3544
3571
  /* @__PURE__ */ b("section", { className: "card", children: [
3545
3572
  /* @__PURE__ */ b("div", { className: "solve-row", children: [
3546
3573
  /* @__PURE__ */ o("span", { className: "lbl", children: "Solve for" }),
3547
- /* @__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)) })
3574
+ /* @__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: Lo[R] }, R)) })
3548
3575
  ] }),
3549
3576
  /* @__PURE__ */ b("div", { className: "field", style: { marginBottom: "calc(var(--fc-space) * 2)" }, children: [
3550
3577
  /* @__PURE__ */ o("span", { className: "lbl", children: "Interest basis" }),
@@ -3563,8 +3590,8 @@ function Wn() {
3563
3590
  ] })
3564
3591
  ] }),
3565
3592
  /* @__PURE__ */ b("div", { className: "grid two", children: [
3566
- /* @__PURE__ */ o(yt, { 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" }) }),
3567
- /* @__PURE__ */ o(yt, { 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" }) }),
3593
+ /* @__PURE__ */ o(bt, { 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" }) }),
3594
+ /* @__PURE__ */ o(bt, { 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" }) }),
3568
3595
  /* @__PURE__ */ b("div", { className: "field", children: [
3569
3596
  /* @__PURE__ */ o("span", { className: "lbl", children: a.tenureWord }),
3570
3597
  L("tenure") ? /* @__PURE__ */ b(re, { children: [
@@ -3581,7 +3608,7 @@ function Wn() {
3581
3608
  ] })
3582
3609
  ] })
3583
3610
  ] }),
3584
- /* @__PURE__ */ o(yt, { 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 }) })
3611
+ /* @__PURE__ */ o(bt, { 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 }) })
3585
3612
  ] }),
3586
3613
  $ && /* @__PURE__ */ o("div", { className: "error", role: "alert", style: { marginTop: 16 }, children: $ })
3587
3614
  ] }),
@@ -3598,7 +3625,7 @@ function Wn() {
3598
3625
  /* @__PURE__ */ o("span", { className: "per", children: " /month" })
3599
3626
  ] })
3600
3627
  ] }),
3601
- /* @__PURE__ */ o(Ao, { result: T }),
3628
+ /* @__PURE__ */ o(Uo, { result: T }),
3602
3629
  /* @__PURE__ */ b("div", { className: "secondary", children: [
3603
3630
  /* @__PURE__ */ b("div", { className: "kv", children: [
3604
3631
  /* @__PURE__ */ o("div", { className: "k", children: "Principal" }),
@@ -3614,18 +3641,18 @@ function Wn() {
3614
3641
  ] }),
3615
3642
  /* @__PURE__ */ b("div", { className: "kv", children: [
3616
3643
  /* @__PURE__ */ o("div", { className: "k", children: a.tenureWord }),
3617
- /* @__PURE__ */ o("div", { className: "v num", children: mt(T.tenureMonths) })
3644
+ /* @__PURE__ */ o("div", { className: "v num", children: pt(T.tenureMonths) })
3618
3645
  ] })
3619
3646
  ] }),
3620
3647
  /* @__PURE__ */ b("div", { className: "actions-row", children: [
3621
3648
  /* @__PURE__ */ o(
3622
- Kn,
3649
+ Wn,
3623
3650
  {
3624
3651
  item: { id: "loan.emi", title: `Loan — ${t.money(T.payment)}/mo`, primary: t.money(T.payment), values: A }
3625
3652
  }
3626
3653
  ),
3627
3654
  /* @__PURE__ */ o(
3628
- Gn,
3655
+ jn,
3629
3656
  {
3630
3657
  payload: {
3631
3658
  calculatorId: "loan.emi",
@@ -3657,8 +3684,8 @@ function Wn() {
3657
3684
  e.ui.showFormulas && /* @__PURE__ */ o("button", { role: "tab", "aria-selected": S === "formula", onClick: () => F("formula"), children: "Formula" })
3658
3685
  ] }),
3659
3686
  /* @__PURE__ */ b("div", { className: "tab-anim", children: [
3660
- S === "schedule" && /* @__PURE__ */ o(Do, { result: T }),
3661
- S === "chart" && /* @__PURE__ */ o(Lo, { result: T }),
3687
+ S === "schedule" && /* @__PURE__ */ o(Oo, { result: T }),
3688
+ S === "chart" && /* @__PURE__ */ o(Bo, { result: T }),
3662
3689
  S === "formula" && e.ui.showFormulas && /* @__PURE__ */ b("div", { className: "formula", children: [
3663
3690
  /* @__PURE__ */ o("code", { children: T.formula }),
3664
3691
  /* @__PURE__ */ b("div", { className: "assumptions", children: [
@@ -3683,7 +3710,7 @@ function Wn() {
3683
3710
  ] })
3684
3711
  ] });
3685
3712
  }
3686
- function yt({
3713
+ function bt({
3687
3714
  label: e,
3688
3715
  solved: t,
3689
3716
  solvedText: n,
@@ -3703,7 +3730,7 @@ function yt({
3703
3730
  ] })
3704
3731
  ] });
3705
3732
  }
3706
- function Ao({ result: e }) {
3733
+ function Uo({ result: e }) {
3707
3734
  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);
3708
3735
  return /* @__PURE__ */ b(re, { children: [
3709
3736
  /* @__PURE__ */ b("div", { className: "splitbar", role: "img", "aria-label": `Principal ${s}%, interest ${100 - s}%`, children: [
@@ -3728,7 +3755,7 @@ function Ao({ result: e }) {
3728
3755
  ] })
3729
3756
  ] });
3730
3757
  }
3731
- function Do({ result: e }) {
3758
+ function Oo({ result: e }) {
3732
3759
  const { fmt: t } = ue(), [n, a] = M("yearly"), [r, s] = M(/* @__PURE__ */ new Set([1])), u = (d) => s((i) => {
3733
3760
  const c = new Set(i);
3734
3761
  return c.has(d) ? c.delete(d) : c.add(d), c;
@@ -3790,7 +3817,7 @@ function Do({ result: e }) {
3790
3817
  ] }) })
3791
3818
  ] });
3792
3819
  }
3793
- function Lo({ result: e }) {
3820
+ function Bo({ result: e }) {
3794
3821
  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`;
3795
3822
  return /* @__PURE__ */ b("div", { className: "chart", children: [
3796
3823
  /* @__PURE__ */ b("svg", { viewBox: `0 0 ${s} ${u}`, role: "img", "aria-label": "Balance and cumulative interest over the term", children: [
@@ -3813,7 +3840,7 @@ function Lo({ result: e }) {
3813
3840
  ] })
3814
3841
  ] });
3815
3842
  }
3816
- const Uo = /* @__PURE__ */ new Set([
3843
+ const _o = /* @__PURE__ */ new Set([
3817
3844
  "sin",
3818
3845
  "cos",
3819
3846
  "tan",
@@ -3850,7 +3877,7 @@ const Uo = /* @__PURE__ */ new Set([
3850
3877
  "sq",
3851
3878
  "cube",
3852
3879
  "recip"
3853
- ]), Oo = {
3880
+ ]), Ho = {
3854
3881
  arcsin: "asin",
3855
3882
  arccos: "acos",
3856
3883
  arctan: "atan",
@@ -3858,14 +3885,14 @@ const Uo = /* @__PURE__ */ new Set([
3858
3885
  log10: "log",
3859
3886
  ncr: "ncr",
3860
3887
  npr: "npr"
3861
- }, Bo = (e) => e === " " || e === " " || e === `
3862
- ` || 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"]);
3863
- function Ho(e) {
3864
- return e === "HEX" ? zn : e === "OCT" ? (t) => t >= "0" && t <= "7" : e === "BIN" ? (t) => t === "0" || t === "1" : fe;
3865
- }
3866
- function qo(e) {
3867
- const t = e.toLowerCase(), n = Oo[t] ?? t;
3868
- if (Uo.has(n)) return { type: "func", value: n };
3888
+ }, qo = (e) => e === " " || e === " " || e === `
3889
+ ` || e === "\r", fe = (e) => e >= "0" && e <= "9", en = (e) => e >= "a" && e <= "z" || e >= "A" && e <= "Z", Jn = (e) => fe(e) || e >= "a" && e <= "f" || e >= "A" && e <= "F", tn = /* @__PURE__ */ new Set(["num", "const", "var", "func", "lparen", "uop"]), Go = /* @__PURE__ */ new Set(["num", "const", "var", "rparen", "postfix"]);
3890
+ function jo(e) {
3891
+ return e === "HEX" ? Jn : e === "OCT" ? (t) => t >= "0" && t <= "7" : e === "BIN" ? (t) => t === "0" || t === "1" : fe;
3892
+ }
3893
+ function Vo(e) {
3894
+ const t = e.toLowerCase(), n = Ho[t] ?? t;
3895
+ if (_o.has(n)) return { type: "func", value: n };
3869
3896
  if (t === "mod") return { type: "op", value: "mod" };
3870
3897
  if (t === "and") return { type: "op", value: "and" };
3871
3898
  if (t === "or") return { type: "op", value: "or" };
@@ -3882,12 +3909,12 @@ function qo(e) {
3882
3909
  }
3883
3910
  throw new Error(`Unknown name: ${e}`);
3884
3911
  }
3885
- function Go(e, t = {}) {
3912
+ function Yo(e, t = {}) {
3886
3913
  const n = t.base ?? "DEC", a = e, r = [];
3887
3914
  let s = 0;
3888
3915
  for (; s < a.length; ) {
3889
3916
  const d = a[s];
3890
- if (Bo(d)) {
3917
+ if (qo(d)) {
3891
3918
  s++;
3892
3919
  continue;
3893
3920
  }
@@ -3895,14 +3922,14 @@ function Go(e, t = {}) {
3895
3922
  if (d === "0" && (a[s + 1] === "x" || a[s + 1] === "X" || a[s + 1] === "o" || a[s + 1] === "O" || a[s + 1] === "b" || a[s + 1] === "B")) {
3896
3923
  const l = a[s + 1].toLowerCase();
3897
3924
  let p = s + 2;
3898
- const h = l === "x" ? zn : l === "o" ? (y) => y >= "0" && y <= "7" : (y) => y === "0" || y === "1", f = p;
3925
+ const h = l === "x" ? Jn : l === "o" ? (y) => y >= "0" && y <= "7" : (y) => y === "0" || y === "1", f = p;
3899
3926
  for (; p < a.length && h(a[p]); ) p++;
3900
3927
  if (p === f) throw new Error(`Malformed 0${l} literal`);
3901
3928
  r.push({ type: "num", value: BigInt(`0${l}${a.slice(f, p)}`).toString() }), s = p;
3902
3929
  continue;
3903
3930
  }
3904
3931
  if (n !== "DEC") {
3905
- const l = Ho(n);
3932
+ const l = jo(n);
3906
3933
  let p = s;
3907
3934
  for (; p < a.length && l(a[p]); ) p++;
3908
3935
  const h = a.slice(s, p), f = n === "HEX" ? "0x" : n === "OCT" ? "0o" : "0b";
@@ -3926,7 +3953,7 @@ function Go(e, t = {}) {
3926
3953
  if (en(d) || d === "_") {
3927
3954
  let c = s;
3928
3955
  for (; c < a.length && (en(a[c]) || fe(a[c]) || a[c] === "_"); ) c++;
3929
- r.push(qo(a.slice(s, c))), s = c;
3956
+ r.push(Vo(a.slice(s, c))), s = c;
3930
3957
  continue;
3931
3958
  }
3932
3959
  const i = a.slice(s, s + 2);
@@ -4006,11 +4033,11 @@ function Go(e, t = {}) {
4006
4033
  }), m = [];
4007
4034
  for (let d = 0; d < u.length; d++) {
4008
4035
  const i = u[d], c = m[m.length - 1];
4009
- c && _o.has(c.type) && tn.has(i.type) && m.push({ type: "op", value: "*", implicit: !0 }), m.push(i);
4036
+ c && Go.has(c.type) && tn.has(i.type) && m.push({ type: "op", value: "*", implicit: !0 }), m.push(i);
4010
4037
  }
4011
4038
  return m;
4012
4039
  }
4013
- const jo = {
4040
+ const Ko = {
4014
4041
  or: { prec: 1 },
4015
4042
  xor: { prec: 2 },
4016
4043
  and: { prec: 3 },
@@ -4024,7 +4051,7 @@ const jo = {
4024
4051
  "%": { prec: 6 },
4025
4052
  "^": { prec: 8, right: !0 }
4026
4053
  }, nn = { neg: 7, bnot: 7, sqrt: 10, cbrt: 10, qdrt: 10 }, De = Symbol("arg");
4027
- function Vo(e) {
4054
+ function Wo(e) {
4028
4055
  const t = [], n = [];
4029
4056
  let a = !0;
4030
4057
  const r = () => {
@@ -4075,7 +4102,7 @@ function Vo(e) {
4075
4102
  else if (d.value !== "+") throw new Error(`Unexpected operator: ${d.value}`);
4076
4103
  a = !0;
4077
4104
  } else {
4078
- const i = jo[d.value];
4105
+ const i = Ko[d.value];
4079
4106
  if (!i) throw new Error(`Unknown operator: ${d.value}`);
4080
4107
  for (; n.length; ) {
4081
4108
  const c = n[n.length - 1];
@@ -4116,11 +4143,11 @@ function Vo(e) {
4116
4143
  if (m === De) throw new Error("Malformed expression");
4117
4144
  return m;
4118
4145
  }
4119
- const Yo = new H("3.141592653589793238462643383279502884197"), Ko = new H("2.718281828459045235360287471352662497757"), Wo = new H("1.618033988749894848204586834365638117720");
4120
- function bt(e, t) {
4146
+ const zo = new H("3.141592653589793238462643383279502884197"), Jo = new H("2.718281828459045235360287471352662497757"), Zo = new H("1.618033988749894848204586834365638117720");
4147
+ function gt(e, t) {
4121
4148
  return t === "deg" ? e * Math.PI / 180 : t === "grad" ? e * Math.PI / 200 : e;
4122
4149
  }
4123
- function gt(e, t) {
4150
+ function vt(e, t) {
4124
4151
  return t === "deg" ? e * 180 / Math.PI : t === "grad" ? e * 200 / Math.PI : e;
4125
4152
  }
4126
4153
  function an(e) {
@@ -4130,13 +4157,13 @@ function an(e) {
4130
4157
  for (let n = 2; n <= e.toNumber(); n++) t = t.times(n);
4131
4158
  return t;
4132
4159
  }
4133
- function zo(e, t) {
4160
+ function Xo(e, t) {
4134
4161
  if (!e.isInteger() || !t.isInteger() || t.isNegative() || t.gt(e)) throw new Error("nPr domain");
4135
4162
  let n = g(1);
4136
4163
  for (let a = 0; a < t.toNumber(); a++) n = n.times(e.minus(a));
4137
4164
  return n;
4138
4165
  }
4139
- function Jo(e, t) {
4166
+ function Qo(e, t) {
4140
4167
  if (!e.isInteger() || !t.isInteger() || t.isNegative() || t.gt(e)) throw new Error("nCr domain");
4141
4168
  const n = H.min(t, e.minus(t));
4142
4169
  let a = g(1);
@@ -4151,7 +4178,7 @@ function rn(e, t) {
4151
4178
  }
4152
4179
  return n;
4153
4180
  }
4154
- function vt(e, t) {
4181
+ function kt(e, t) {
4155
4182
  if (e.isNegative()) {
4156
4183
  if (t.isInteger() && !t.mod(2).isZero()) return e.abs().pow(g(1).div(t)).neg();
4157
4184
  throw new Error("root of negative");
@@ -4159,7 +4186,7 @@ function vt(e, t) {
4159
4186
  return e.pow(g(1).div(t));
4160
4187
  }
4161
4188
  const ie = (e) => BigInt(e.trunc().toFixed(0));
4162
- function Zo(e, t = {}) {
4189
+ function ei(e, t = {}) {
4163
4190
  const n = t.angleMode ?? "deg", a = t.percentMode ?? "of", r = (i) => {
4164
4191
  var l;
4165
4192
  if (i === "ans") return g(t.ans ?? 0);
@@ -4171,22 +4198,22 @@ function Zo(e, t = {}) {
4171
4198
  let p;
4172
4199
  switch (i) {
4173
4200
  case "sin":
4174
- p = Math.sin(bt(l, n));
4201
+ p = Math.sin(gt(l, n));
4175
4202
  break;
4176
4203
  case "cos":
4177
- p = Math.cos(bt(l, n));
4204
+ p = Math.cos(gt(l, n));
4178
4205
  break;
4179
4206
  case "tan":
4180
- p = Math.tan(bt(l, n));
4207
+ p = Math.tan(gt(l, n));
4181
4208
  break;
4182
4209
  case "asin":
4183
- p = gt(Math.asin(l), n);
4210
+ p = vt(Math.asin(l), n);
4184
4211
  break;
4185
4212
  case "acos":
4186
- p = gt(Math.acos(l), n);
4213
+ p = vt(Math.acos(l), n);
4187
4214
  break;
4188
4215
  case "atan":
4189
- p = gt(Math.atan(l), n);
4216
+ p = vt(Math.atan(l), n);
4190
4217
  break;
4191
4218
  case "sinh":
4192
4219
  p = Math.sinh(l);
@@ -4220,11 +4247,11 @@ function Zo(e, t = {}) {
4220
4247
  case "sqrt":
4221
4248
  return p(1), l.sqrt();
4222
4249
  case "cbrt":
4223
- return p(1), vt(l, g(3));
4250
+ return p(1), kt(l, g(3));
4224
4251
  case "qdrt":
4225
- return p(1), vt(l, g(4));
4252
+ return p(1), kt(l, g(4));
4226
4253
  case "root":
4227
- return p(2), vt(l, c[1]);
4254
+ return p(2), kt(l, c[1]);
4228
4255
  case "pow":
4229
4256
  return p(2), l.pow(c[1]);
4230
4257
  case "ln":
@@ -4241,9 +4268,9 @@ function Zo(e, t = {}) {
4241
4268
  case "tenpow":
4242
4269
  return p(1), g(10).pow(l);
4243
4270
  case "ncr":
4244
- return p(2), Jo(l, c[1]);
4271
+ return p(2), Qo(l, c[1]);
4245
4272
  case "npr":
4246
- return p(2), zo(l, c[1]);
4273
+ return p(2), Xo(l, c[1]);
4247
4274
  case "gcd":
4248
4275
  return p(2), rn(l, c[1]);
4249
4276
  case "lcm":
@@ -4309,7 +4336,7 @@ function Zo(e, t = {}) {
4309
4336
  case "num":
4310
4337
  return g(i.value);
4311
4338
  case "const":
4312
- return i.name === "PI" ? Yo : i.name === "E" ? Ko : Wo;
4339
+ return i.name === "PI" ? zo : i.name === "E" ? Jo : Zo;
4313
4340
  case "var":
4314
4341
  return r(i.name);
4315
4342
  case "percent":
@@ -4336,7 +4363,7 @@ function Zo(e, t = {}) {
4336
4363
  function on(e, t = {}) {
4337
4364
  if (e == null || e.trim() === "") return { value: new H(0) };
4338
4365
  try {
4339
- const n = Go(e, { base: t.base }), a = Vo(n), r = Zo(a, t);
4366
+ const n = Yo(e, { base: t.base }), a = Wo(n), r = ei(a, t);
4340
4367
  return r.isNaN() ? { value: r, error: "Not a number" } : { value: r };
4341
4368
  } catch (n) {
4342
4369
  return { value: new H(NaN), error: n instanceof Error ? n.message : String(n) };
@@ -4351,8 +4378,8 @@ function sn(e, t) {
4351
4378
  }
4352
4379
  return e.toSignificantDigits(12).toString();
4353
4380
  }
4354
- function Jn({ def: e }) {
4355
- const { settings: t } = ue(), n = t.percentMode ?? "of", [a, r] = M(""), [s, u] = M("deg"), [m, d] = M("DEC"), [i, c] = M(!1), [l, p] = M(() => new H(0)), [h, f] = M(() => new H(0)), [y, w] = M([]), k = de(null), S = ne(
4381
+ function Zn({ def: e }) {
4382
+ const { settings: t } = ue(), n = t.percentMode ?? "of", [a, r] = M(""), [s, u] = M("deg"), [m, d] = M("DEC"), [i, c] = M(!1), [l, p] = M(() => new H(0)), [h, f] = M(() => new H(0)), [y, w] = M([]), k = de(null), S = X(
4356
4383
  () => on(a, { angleMode: s, percentMode: n, base: m, ans: h, memory: l }),
4357
4384
  [a, s, n, m, h, l]
4358
4385
  ), F = a.trim() ? S.error ? "" : sn(S.value, m) : "", N = (I) => requestAnimationFrame(() => {
@@ -4499,15 +4526,15 @@ function Jn({ def: e }) {
4499
4526
  ] }),
4500
4527
  /* @__PURE__ */ b("div", { className: "sci-pad", role: "group", "aria-label": "calculator keypad", children: [
4501
4528
  G.map((I, R) => /* @__PURE__ */ o("div", { className: "sci-row", children: I.map((j, Y) => {
4502
- const V = i && j.alt ? j.alt : j, Q = j.t === "2nd";
4529
+ const V = i && j.alt ? j.alt : j, ee = j.t === "2nd";
4503
4530
  return /* @__PURE__ */ o(
4504
4531
  "button",
4505
4532
  {
4506
4533
  type: "button",
4507
4534
  className: `sci-key ${V.cls ?? "fn"}`,
4508
4535
  "aria-label": V.aria,
4509
- "aria-pressed": Q ? i : void 0,
4510
- onClick: () => Q ? c((Ee) => !Ee) : B(V),
4536
+ "aria-pressed": ee ? i : void 0,
4537
+ onClick: () => ee ? c((Ee) => !Ee) : B(V),
4511
4538
  children: V.t
4512
4539
  },
4513
4540
  Y
@@ -4540,7 +4567,7 @@ function Jn({ def: e }) {
4540
4567
  ] })
4541
4568
  ] });
4542
4569
  }
4543
- const nt = [
4570
+ const at = [
4544
4571
  { code: "USD", name: "US Dollar", symbol: "$" },
4545
4572
  { code: "EUR", name: "Euro", symbol: "€" },
4546
4573
  { code: "GBP", name: "British Pound", symbol: "£" },
@@ -4585,28 +4612,28 @@ const nt = [
4585
4612
  { code: "BDT", name: "Bangladeshi Taka", symbol: "৳" },
4586
4613
  { code: "LKR", name: "Sri Lankan Rupee", symbol: "Rs" },
4587
4614
  { code: "NPR", name: "Nepalese Rupee", symbol: "रू" }
4588
- ], Xo = (e) => nt.find((t) => t.code === e), Qo = (e) => e === "INR" ? "en-IN" : "en-US", Zn = (e, t) => g(e).times(t), Xn = (e) => {
4615
+ ], ti = (e) => at.find((t) => t.code === e), ni = (e) => e === "INR" ? "en-IN" : "en-US", Xn = (e, t) => g(e).times(t), Qn = (e) => {
4589
4616
  const t = g(e);
4590
4617
  return t.gt(0) ? g(1).div(t) : g(0);
4591
4618
  };
4592
4619
  function Mt(e, t) {
4593
4620
  const n = g(e);
4594
4621
  try {
4595
- return new Intl.NumberFormat(Qo(t), { style: "currency", currency: t }).format(
4622
+ return new Intl.NumberFormat(ni(t), { style: "currency", currency: t }).format(
4596
4623
  Number(n.toFixed(4))
4597
4624
  );
4598
4625
  } catch {
4599
4626
  return `${new Intl.NumberFormat("en-US", { maximumFractionDigits: 4 }).format(Number(n.toFixed(4)))} ${t}`;
4600
4627
  }
4601
4628
  }
4602
- function Qn(e) {
4629
+ function ea(e) {
4603
4630
  try {
4604
4631
  return new Intl.NumberFormat("en-US", { style: "currency", currency: e }).resolvedOptions().maximumFractionDigits ?? 2;
4605
4632
  } catch {
4606
4633
  return 2;
4607
4634
  }
4608
4635
  }
4609
- function Je(e, t) {
4636
+ function Ze(e, t) {
4610
4637
  const n = Math.max(0, Math.floor((t - e) / 1e3));
4611
4638
  if (n < 60) return "just now";
4612
4639
  const a = Math.floor(n / 60);
@@ -4618,23 +4645,23 @@ function Je(e, t) {
4618
4645
  const u = Math.floor(s / 30);
4619
4646
  return `${u} month${u === 1 ? "" : "s"} ago`;
4620
4647
  }
4621
- const ea = (e, t) => t - e > 864e5, fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4648
+ const ta = (e, t) => t - e > 864e5, ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4622
4649
  __proto__: null,
4623
- CURRENCIES: nt,
4624
- convert: Zn,
4625
- currencyByCode: Xo,
4626
- currencyDecimals: Qn,
4650
+ CURRENCIES: at,
4651
+ convert: Xn,
4652
+ currencyByCode: ti,
4653
+ currencyDecimals: ea,
4627
4654
  formatCurrency: Mt,
4628
- inverseRate: Xn,
4629
- isStale: ea,
4630
- stalenessLabel: Je
4631
- }, Symbol.toStringTag, { value: "Module" })), ei = (e) => `https://open.er-api.com/v6/latest/${encodeURIComponent(e)}`;
4632
- async function ti(e, t, n = {}) {
4655
+ inverseRate: Qn,
4656
+ isStale: ta,
4657
+ stalenessLabel: Ze
4658
+ }, Symbol.toStringTag, { value: "Module" })), ai = (e) => `https://open.er-api.com/v6/latest/${encodeURIComponent(e)}`;
4659
+ async function ri(e, t, n = {}) {
4633
4660
  var m;
4634
4661
  if (e === t) return { rate: "1", asOf: "", provider: "identity" };
4635
4662
  const a = n.fetchImpl ?? (typeof fetch < "u" ? fetch : void 0);
4636
4663
  if (!a) throw new Error("No fetch available in this environment");
4637
- const r = await a(ei(e), { signal: n.signal });
4664
+ const r = await a(ai(e), { signal: n.signal });
4638
4665
  if (!r.ok) throw new Error(`Rate service returned HTTP ${r.status}`);
4639
4666
  const s = await r.json();
4640
4667
  if (s != null && s.result && s.result !== "success") throw new Error(s["error-type"] || "Rate service error");
@@ -4646,35 +4673,35 @@ function ln(e, t) {
4646
4673
  const n = Date.parse(e);
4647
4674
  return Number.isFinite(n) ? n : t;
4648
4675
  }
4649
- const ta = "calcsuite:fxrates", na = "calcsuite:fxmode", kt = () => {
4676
+ const na = "calcsuite:fxrates", aa = "calcsuite:fxmode", wt = () => {
4650
4677
  try {
4651
- return JSON.parse(localStorage.getItem(ta) || "{}");
4678
+ return JSON.parse(localStorage.getItem(na) || "{}");
4652
4679
  } catch {
4653
4680
  return {};
4654
4681
  }
4655
- }, ni = (e) => {
4682
+ }, oi = (e) => {
4656
4683
  try {
4657
- localStorage.setItem(ta, JSON.stringify(e));
4684
+ localStorage.setItem(na, JSON.stringify(e));
4658
4685
  } catch {
4659
4686
  }
4660
- }, ai = () => {
4687
+ }, ii = () => {
4661
4688
  try {
4662
- return localStorage.getItem(na) === "offline" ? "offline" : "online";
4689
+ return localStorage.getItem(aa) === "offline" ? "offline" : "online";
4663
4690
  } catch {
4664
4691
  return "online";
4665
4692
  }
4666
4693
  }, Ke = (e, t) => `${e}_${t}`;
4667
- function aa() {
4694
+ function ra() {
4668
4695
  var _t;
4669
- 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(() => kt()), [N, P] = M(() => Date.now()), x = de(null);
4670
- X(() => {
4696
+ 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(() => ii()), [S, F] = M(() => wt()), [N, P] = M(() => Date.now()), x = de(null);
4697
+ Q(() => {
4671
4698
  const O = setInterval(() => P(Date.now()), 3e4);
4672
4699
  return () => clearInterval(O);
4673
4700
  }, []);
4674
4701
  const T = (O, Z) => {
4675
4702
  F((ae) => {
4676
4703
  const oe = { ...ae, [Ke(e, n)]: { rate: O, at: Z } };
4677
- return ni(oe), oe;
4704
+ return oi(oe), oe;
4678
4705
  });
4679
4706
  }, $ = (O, Z) => {
4680
4707
  var oe;
@@ -4684,11 +4711,11 @@ function aa() {
4684
4711
  m("1"), i("live"), l(""), h("idle");
4685
4712
  return;
4686
4713
  }
4687
- h("loading"), y(""), ti(O, Z, { signal: ae.signal }).then((xe) => {
4714
+ h("loading"), y(""), ri(O, Z, { signal: ae.signal }).then((xe) => {
4688
4715
  ae.signal.aborted || (m(xe.rate), i("live"), l(xe.asOf), h("idle"), T(xe.rate, ln(xe.asOf, Date.now())));
4689
4716
  }).catch((xe) => {
4690
4717
  if (ae.signal.aborted) return;
4691
- const Ht = kt()[Ke(O, Z)];
4718
+ const Ht = wt()[Ke(O, Z)];
4692
4719
  Ht ? (m(Ht.rate), i("saved"), h("error"), y("Offline — showing your last saved rate. Refresh when back online.")) : (i("none"), h("error"), y(`Couldn’t fetch a live rate (${xe instanceof Error ? xe.message : "offline"}). Enter one manually.`));
4693
4720
  });
4694
4721
  }, L = (O, Z) => {
@@ -4697,27 +4724,27 @@ function aa() {
4697
4724
  m("1"), i("saved");
4698
4725
  return;
4699
4726
  }
4700
- const ae = kt()[Ke(O, Z)];
4727
+ const ae = wt()[Ke(O, Z)];
4701
4728
  ae ? (m(ae.rate), i("saved")) : (m(""), i("none"));
4702
4729
  };
4703
- X(() => (w === "online" ? $(e, n) : L(e, n), () => {
4730
+ Q(() => (w === "online" ? $(e, n) : L(e, n), () => {
4704
4731
  var O;
4705
4732
  return (O = x.current) == null ? void 0 : O.abort();
4706
4733
  }), [e, n, w]);
4707
4734
  const B = (O) => {
4708
4735
  k(O);
4709
4736
  try {
4710
- localStorage.setItem(na, O);
4737
+ localStorage.setItem(aa, O);
4711
4738
  } catch {
4712
4739
  }
4713
- }, 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(
4714
- () => I && R ? Zn(q, A) : null,
4740
+ }, 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 = X(
4741
+ () => I && R ? Xn(q, A) : null,
4715
4742
  [I, R, q, A]
4716
- ), Y = R ? Xn(A) : null, V = (O) => {
4743
+ ), Y = R ? Qn(A) : null, V = (O) => {
4717
4744
  m(O), i("manual"), h("idle"), y(""), (R || O.trim() !== "") && T(G(O), Date.now());
4718
- }, Q = () => {
4745
+ }, ee = () => {
4719
4746
  t(n), a(e);
4720
- }, 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: [
4747
+ }, Ee = c ? Ze(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: [
4721
4748
  O.code,
4722
4749
  " — ",
4723
4750
  O.name
@@ -4731,7 +4758,7 @@ function aa() {
4731
4758
  " · open.er-api.com"
4732
4759
  ] }) : null : d === "saved" && K ? /* @__PURE__ */ b("span", { children: [
4733
4760
  "✈ Offline · saved rate ",
4734
- Je(K, N)
4761
+ Ze(K, N)
4735
4762
  ] }) : /* @__PURE__ */ o("span", { children: "✈ Offline · enter a rate manually" });
4736
4763
  return /* @__PURE__ */ b("div", { "data-part": "calculator", "data-calculator": "tools.currency", children: [
4737
4764
  /* @__PURE__ */ b("section", { className: "card", children: [
@@ -4756,12 +4783,12 @@ function aa() {
4756
4783
  ] }),
4757
4784
  /* @__PURE__ */ b("label", { className: "field cc-cur", children: [
4758
4785
  /* @__PURE__ */ o("span", { className: "lbl", children: "From" }),
4759
- /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: e, onChange: (O) => t(O.target.value), "aria-label": "From currency", children: nt.map(pe) }) })
4786
+ /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: e, onChange: (O) => t(O.target.value), "aria-label": "From currency", children: at.map(pe) }) })
4760
4787
  ] }),
4761
- /* @__PURE__ */ o("button", { type: "button", className: "cc-swap", onClick: Q, "aria-label": "Swap currencies", title: "Swap", children: "⇄" }),
4788
+ /* @__PURE__ */ o("button", { type: "button", className: "cc-swap", onClick: ee, "aria-label": "Swap currencies", title: "Swap", children: "⇄" }),
4762
4789
  /* @__PURE__ */ b("label", { className: "field cc-cur", children: [
4763
4790
  /* @__PURE__ */ o("span", { className: "lbl", children: "To" }),
4764
- /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: n, onChange: (O) => a(O.target.value), "aria-label": "To currency", children: nt.map(pe) }) })
4791
+ /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: n, onChange: (O) => a(O.target.value), "aria-label": "To currency", children: at.map(pe) }) })
4765
4792
  ] })
4766
4793
  ] }),
4767
4794
  /* @__PURE__ */ b("label", { className: "field", style: { marginTop: 16 }, children: [
@@ -4832,7 +4859,7 @@ function aa() {
4832
4859
  /* @__PURE__ */ b("div", { className: "kv", children: [
4833
4860
  /* @__PURE__ */ o("div", { className: "k", children: "Precision" }),
4834
4861
  /* @__PURE__ */ b("div", { className: "v num", children: [
4835
- Qn(n),
4862
+ ea(n),
4836
4863
  " dp · ",
4837
4864
  n
4838
4865
  ] })
@@ -4865,7 +4892,7 @@ function aa() {
4865
4892
  oe
4866
4893
  ] }),
4867
4894
  /* @__PURE__ */ o("span", { className: "num", children: Z.rate }),
4868
- /* @__PURE__ */ o("span", { className: `cc-book-when ${ea(Z.at, N) ? "cc-stale" : ""}`, children: Je(Z.at, N) })
4895
+ /* @__PURE__ */ o("span", { className: `cc-book-when ${ta(Z.at, N) ? "cc-stale" : ""}`, children: Ze(Z.at, N) })
4869
4896
  ]
4870
4897
  }
4871
4898
  ) }, O);
@@ -4873,23 +4900,23 @@ function aa() {
4873
4900
  ] })
4874
4901
  ] });
4875
4902
  }
4876
- const ri = {
4903
+ const si = {
4877
4904
  id: "",
4878
4905
  group: "tools",
4879
4906
  title: "",
4880
4907
  inputs: [],
4881
4908
  compute: () => ({ primary: { label: "", value: "" } })
4882
- }, oi = {
4883
- "loan.emi": Wn,
4884
- scientific: Jn,
4885
- currency: aa
4909
+ }, li = {
4910
+ "loan.emi": zn,
4911
+ scientific: Zn,
4912
+ currency: ra
4886
4913
  };
4887
4914
  function cn(e, t) {
4888
4915
  const n = {};
4889
4916
  for (const a of e.inputs) a.default !== void 0 && (n[a.key] = a.default);
4890
4917
  return t ? { ...n, ...t } : n;
4891
4918
  }
4892
- function ii({
4919
+ function ci({
4893
4920
  def: e,
4894
4921
  id: t,
4895
4922
  seed: n,
@@ -4898,9 +4925,9 @@ function ii({
4898
4925
  actions: s
4899
4926
  }) {
4900
4927
  var L, B, G, q;
4901
- const u = e ?? (t ? Rt(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);
4902
- X(() => p(cn(m, n)), [m.id, n]);
4903
- 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(() => {
4928
+ const u = e ?? (t ? Rt(t) : void 0), m = u ?? si, d = { ...li, ...a }, { settings: i, fmt: c } = ue(), [l, p] = M(() => cn(m, n)), [h, f] = M("schedule"), [y, w] = M(!1);
4929
+ Q(() => p(cn(m, n)), [m.id, n]);
4930
+ 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 } = X(() => {
4904
4931
  const A = { settings: i, region: k, fmt: c, D: g };
4905
4932
  try {
4906
4933
  return { result: m.compute(l, A), error: null };
@@ -4908,7 +4935,7 @@ function ii({
4908
4935
  return { result: null, error: I instanceof Error ? I.message : "Could not calculate." };
4909
4936
  }
4910
4937
  }, [m, l, i, k, c]);
4911
- if (X(() => r == null ? void 0 : r(x, l), [x]), !u)
4938
+ if (Q(() => r == null ? void 0 : r(x, l), [x]), !u)
4912
4939
  return /* @__PURE__ */ b("div", { className: "error", role: "alert", children: [
4913
4940
  "Unknown calculator",
4914
4941
  t ? `: ${t}` : "",
@@ -4936,7 +4963,7 @@ function ii({
4936
4963
  T && /* @__PURE__ */ o("div", { className: "error", role: "alert", style: { marginTop: 16 }, children: T })
4937
4964
  ] }),
4938
4965
  x && !T && /* @__PURE__ */ b("section", { className: "card", children: [
4939
- /* @__PURE__ */ o(Qr, { view: x }),
4966
+ /* @__PURE__ */ o(no, { view: x }),
4940
4967
  (B = x.warnings) == null ? void 0 : B.map((A, I) => /* @__PURE__ */ o("div", { className: "notice", children: A }, I)),
4941
4968
  s && /* @__PURE__ */ o("div", { className: "actions-row", children: s(x, l) }),
4942
4969
  $ && /* @__PURE__ */ b(re, { children: [
@@ -4947,8 +4974,8 @@ function ii({
4947
4974
  (((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" })
4948
4975
  ] }),
4949
4976
  /* @__PURE__ */ b("div", { className: "tab-anim", children: [
4950
- h === "schedule" && x.schedule && /* @__PURE__ */ o(no, { schedule: x.schedule }),
4951
- h === "chart" && x.chart && /* @__PURE__ */ o(ao, { chart: x.chart }),
4977
+ h === "schedule" && x.schedule && /* @__PURE__ */ o(oo, { schedule: x.schedule }),
4978
+ h === "chart" && x.chart && /* @__PURE__ */ o(io, { chart: x.chart }),
4952
4979
  h === "formula" && x.formula && i.ui.showFormulas && /* @__PURE__ */ b("div", { className: "formula", children: [
4953
4980
  /* @__PURE__ */ o("code", { children: x.formula }),
4954
4981
  x.formulaSubstituted && /* @__PURE__ */ o("code", { style: { marginTop: 8 }, children: x.formulaSubstituted })
@@ -4971,21 +4998,8 @@ function un({ def: e, region: t }) {
4971
4998
  }
4972
4999
  function dn({ f: e, values: t, set: n }) {
4973
5000
  const a = e.kind === "cashflows" || e.kind === "segmented" ? "span2" : "";
4974
- return /* @__PURE__ */ o("div", { className: a, children: /* @__PURE__ */ o(Jr, { f: e, value: t[e.key], onChange: (r) => n(e.key, r), values: t }) });
5001
+ return /* @__PURE__ */ o("div", { className: a, children: /* @__PURE__ */ o(Qr, { f: e, value: t[e.key], onChange: (r) => n(e.key, r), values: t }) });
4975
5002
  }
4976
- const si = [
4977
- { id: "default", label: "Green", main: "#00A76F", light: "#2CCF8E", dark: "#087055", ink: "#06251A" },
4978
- { id: "cyan", label: "Cyan", main: "#078DEE", light: "#68CDF9", dark: "#0351AB", ink: "#FFFFFF" },
4979
- { id: "purple", label: "Purple", main: "#7635DC", light: "#B985F4", dark: "#431A9E", ink: "#FFFFFF" },
4980
- { id: "blue", label: "Blue", main: "#2065D1", light: "#76B0F1", dark: "#103996", ink: "#FFFFFF" },
4981
- { id: "orange", label: "Orange", main: "#FDA92D", light: "#FED680", dark: "#B66816", ink: "#212B36" },
4982
- { id: "gray", label: "Gray", main: "#A4AAB3", light: "#CED1D7", dark: "#63686C", ink: "#FFFFFF" }
4983
- ], wt = "-apple-system, 'Segoe UI', system-ui, sans-serif", li = [
4984
- { id: "Inter Tight", label: "Inter Tight", stack: `'Inter Tight', ${wt}` },
4985
- { id: "Public Sans", label: "Public Sans", stack: `'Public Sans', ${wt}` },
4986
- { id: "system-ui", label: "System UI", stack: `system-ui, ${wt}` },
4987
- { id: "Georgia", label: "Georgia (serif)", stack: "Georgia, 'Times New Roman', serif" }
4988
- ];
4989
5003
  class z extends Error {
4990
5004
  constructor(n, a = { code: "transport_error" }) {
4991
5005
  super(n);
@@ -4996,17 +5010,17 @@ class z extends Error {
4996
5010
  this.name = "TransportError", this.code = a.code, this.status = a.status ?? 0, this.request = a.request;
4997
5011
  }
4998
5012
  }
4999
- const ci = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"], ui = {
5013
+ const ui = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"], di = {
5000
5014
  attempts: 3,
5001
5015
  backoff: "exponential",
5002
5016
  baseDelayMs: 300,
5003
5017
  retryOn: [408, 429, 500, 502, 503, 504],
5004
5018
  respectRetryAfter: !0
5005
- }, di = {
5019
+ }, mi = {
5006
5020
  enabled: !0,
5007
5021
  headerName: "Idempotency-Key",
5008
5022
  keyFrom: "inputsHash"
5009
- }, mi = {
5023
+ }, pi = {
5010
5024
  enabled: !0,
5011
5025
  storage: "memory",
5012
5026
  maxItems: 200,
@@ -5018,7 +5032,7 @@ const ci = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"],
5018
5032
  return !1;
5019
5033
  }
5020
5034
  };
5021
- function ra() {
5035
+ function oa() {
5022
5036
  const e = globalThis.crypto;
5023
5037
  return e != null && e.randomUUID ? e.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
5024
5038
  const n = Math.random() * 16 | 0;
@@ -5026,21 +5040,21 @@ function ra() {
5026
5040
  });
5027
5041
  }
5028
5042
  const pn = (e) => new Promise((t) => setTimeout(t, Math.max(0, e)));
5029
- function pi(e) {
5043
+ function hi(e) {
5030
5044
  let t = String(e).replace(/[\\/]+/g, "-").replace(/[\x00-\x1f\x7f]+/g, "").replace(/[<>:"|?*]+/g, "").replace(/^\.+/, "");
5031
5045
  return t = t.trim(), t || "file";
5032
5046
  }
5033
- function oa(e, t) {
5047
+ function ia(e, t) {
5034
5048
  var m;
5035
5049
  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");
5036
- return pi(u);
5050
+ return hi(u);
5037
5051
  }
5038
5052
  function $t(e, t = []) {
5039
- const n = /* @__PURE__ */ new Set([...ci, ...t.map((r) => r.toLowerCase())]), a = {};
5053
+ const n = /* @__PURE__ */ new Set([...ui, ...t.map((r) => r.toLowerCase())]), a = {};
5040
5054
  for (const [r, s] of Object.entries(e)) a[r] = n.has(r.toLowerCase()) ? "***" : s;
5041
5055
  return a;
5042
5056
  }
5043
- class hi {
5057
+ class fi {
5044
5058
  constructor(t, n) {
5045
5059
  ge(this, "items", []);
5046
5060
  ge(this, "key");
@@ -5068,7 +5082,7 @@ class hi {
5068
5082
  return this.items.length;
5069
5083
  }
5070
5084
  enqueue(t) {
5071
- const n = { ...t, id: ra(), createdAt: (/* @__PURE__ */ new Date()).toISOString(), retryCount: 0 };
5085
+ const n = { ...t, id: oa(), createdAt: (/* @__PURE__ */ new Date()).toISOString(), retryCount: 0 };
5072
5086
  for (this.items.push(n); this.items.length > this.cfg.maxItems; ) this.items.shift();
5073
5087
  return this.save(), n;
5074
5088
  }
@@ -5090,12 +5104,12 @@ class hi {
5090
5104
  }
5091
5105
  }
5092
5106
  const hn = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
5093
- function fi(e) {
5094
- 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");
5107
+ function yi(e) {
5108
+ const t = e.fetch ?? globalThis.fetch, n = { ...di, ...e.retry }, a = { ...mi, ...e.idempotency }, r = { ...pi, ...e.offlineQueue }, s = e.timeoutMs ?? 15e3, u = e.credentials ?? "same-origin", m = new fi(r, "calcsuite");
5095
5109
  function d(N, P) {
5096
5110
  const x = e.endpoints[N];
5097
5111
  if (!x) throw new z(`Endpoint "${N}" is not configured`, { code: "no_endpoint" });
5098
- let T = /^https?:\/\//i.test(x) ? x : yi(e.baseUrl, x);
5112
+ let T = /^https?:\/\//i.test(x) ? x : bi(e.baseUrl, x);
5099
5113
  return P != null && (T = T.replace(/:id\b/, encodeURIComponent(P))), T;
5100
5114
  }
5101
5115
  function i() {
@@ -5110,10 +5124,10 @@ function fi(e) {
5110
5124
  if (!a.enabled || x) return x;
5111
5125
  if (hn.has(fn(N))) {
5112
5126
  if (a.keyFrom === "inputsHash") {
5113
- const T = gi(P);
5127
+ const T = vi(P);
5114
5128
  if (T) return T;
5115
5129
  }
5116
- return ra();
5130
+ return oa();
5117
5131
  }
5118
5132
  }
5119
5133
  async function p(N, P, x) {
@@ -5140,7 +5154,7 @@ function fi(e) {
5140
5154
  }
5141
5155
  async function f(N, P = {}) {
5142
5156
  var B, G, q, A;
5143
- const x = fn(N), T = bi(d(N, P.pathParam), P.query), $ = l(N, P.body, P.idempotencyKey);
5157
+ const x = fn(N), T = gi(d(N, P.pathParam), P.query), $ = l(N, P.body, P.idempotencyKey);
5144
5158
  let L;
5145
5159
  for (let I = 1; I <= Math.max(1, n.attempts); I++) {
5146
5160
  const R = await c(), j = {
@@ -5152,8 +5166,8 @@ function fi(e) {
5152
5166
  $ && (j[a.headerName] = $);
5153
5167
  const Y = $t(j, R.keys);
5154
5168
  let V = P.body;
5155
- const Q = { endpoint: String(N), method: x, url: T, headers: Y, body: V, attempt: I };
5156
- e.transformRequest && V !== void 0 && (V = e.transformRequest(V, Q)), (B = e.onRequest) == null || B.call(e, Q);
5169
+ const ee = { endpoint: String(N), method: x, url: T, headers: Y, body: V, attempt: I };
5170
+ e.transformRequest && V !== void 0 && (V = e.transformRequest(V, ee)), (B = e.onRequest) == null || B.call(e, ee);
5157
5171
  const Ee = yn();
5158
5172
  try {
5159
5173
  const K = await p(
@@ -5170,8 +5184,8 @@ function fi(e) {
5170
5184
  await pn(h(I, K));
5171
5185
  continue;
5172
5186
  }
5173
- const pe = await ia(K), Me = {
5174
- ...Q,
5187
+ const pe = await sa(K), Me = {
5188
+ ...ee,
5175
5189
  status: K.status,
5176
5190
  ok: K.ok,
5177
5191
  durationMs: yn() - Ee,
@@ -5181,11 +5195,11 @@ function fi(e) {
5181
5195
  const Ge = new z(`Request failed with ${K.status}`, {
5182
5196
  code: "http_error",
5183
5197
  status: K.status,
5184
- request: Q
5198
+ request: ee
5185
5199
  });
5186
- throw (q = e.onError) == null || q.call(e, Ge, Q), Ge;
5200
+ throw (q = e.onError) == null || q.call(e, Ge, ee), Ge;
5187
5201
  }
5188
- return e.transformResponse ? e.transformResponse(pe, Q) : pe;
5202
+ return e.transformResponse ? e.transformResponse(pe, ee) : pe;
5189
5203
  } catch (K) {
5190
5204
  if (L = K, K instanceof z && K.code === "http_error") throw K;
5191
5205
  if (I < n.attempts) {
@@ -5201,16 +5215,16 @@ function fi(e) {
5201
5215
  headers: { ...P.headers ?? {} }
5202
5216
  // never the auth headers
5203
5217
  }).id };
5204
- const pe = K instanceof z ? K : new z("Network request failed", { code: "network_error", request: Q });
5205
- throw (A = e.onError) == null || A.call(e, pe, Q), pe;
5218
+ const pe = K instanceof z ? K : new z("Network request failed", { code: "network_error", request: ee });
5219
+ throw (A = e.onError) == null || A.call(e, pe, ee), pe;
5206
5220
  }
5207
5221
  }
5208
5222
  throw L instanceof Error ? L : new z("Request failed", { code: "transport_error" });
5209
5223
  }
5210
5224
  async function y(N, P, x = {}) {
5211
5225
  const T = e.upload;
5212
- ki(N, P, T.accept, T.maxBytes);
5213
- const $ = P.filename ?? oa(T.filenameTemplate, P), L = { ...P, filename: $, bytes: N.size, contentType: P.contentType ?? sa(N) };
5226
+ wi(N, P, T.accept, T.maxBytes);
5227
+ const $ = P.filename ?? ia(T.filenameTemplate, P), L = { ...P, filename: $, bytes: N.size, contentType: P.contentType ?? la(N) };
5214
5228
  if (T.beforeUpload && !await T.beforeUpload(N, L))
5215
5229
  throw new z("Upload cancelled by host", { code: "upload_cancelled" });
5216
5230
  return T.strategy === "presigned" ? F(N, L, x) : T.strategy === "base64Json" ? S(N, L, x) : k(N, L, x);
@@ -5241,10 +5255,10 @@ function fi(e) {
5241
5255
  { method: "POST", credentials: u, headers: B, body: $ },
5242
5256
  x.signal
5243
5257
  );
5244
- return vi(G);
5258
+ return ki(G);
5245
5259
  }
5246
5260
  async function S(N, P, x) {
5247
- const T = await wi(N);
5261
+ const T = await Ni(N);
5248
5262
  return f("upload", {
5249
5263
  ...x,
5250
5264
  body: {
@@ -5331,23 +5345,23 @@ function fn(e) {
5331
5345
  function yn() {
5332
5346
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
5333
5347
  }
5334
- function yi(e, t) {
5348
+ function bi(e, t) {
5335
5349
  return e ? `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : t;
5336
5350
  }
5337
- function bi(e, t) {
5351
+ function gi(e, t) {
5338
5352
  if (!t) return e;
5339
5353
  const n = [];
5340
5354
  for (const [a, r] of Object.entries(t))
5341
5355
  r == null || r === "" || n.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(r))}`);
5342
5356
  return n.length ? e + (e.includes("?") ? "&" : "?") + n.join("&") : e;
5343
5357
  }
5344
- function gi(e) {
5358
+ function vi(e) {
5345
5359
  var a;
5346
5360
  if (!e || typeof e != "object") return;
5347
5361
  const t = e, n = ((a = t == null ? void 0 : t.meta) == null ? void 0 : a.inputsHash) ?? (t == null ? void 0 : t.inputsHash);
5348
5362
  return typeof n == "string" && n ? n : void 0;
5349
5363
  }
5350
- async function ia(e) {
5364
+ async function sa(e) {
5351
5365
  const t = e.headers.get("content-type") || "";
5352
5366
  try {
5353
5367
  return t.includes("application/json") ? await e.json() : await e.text() || null;
@@ -5355,21 +5369,21 @@ async function ia(e) {
5355
5369
  return null;
5356
5370
  }
5357
5371
  }
5358
- async function vi(e) {
5372
+ async function ki(e) {
5359
5373
  if (!e.ok) throw new z(`Upload failed (${e.status})`, { code: "upload_failed", status: e.status });
5360
- return ia(e);
5374
+ return sa(e);
5361
5375
  }
5362
- function sa(e) {
5376
+ function la(e) {
5363
5377
  return e.type || "application/octet-stream";
5364
5378
  }
5365
- function ki(e, t, n, a) {
5379
+ function wi(e, t, n, a) {
5366
5380
  if (e.size > a)
5367
5381
  throw new z(`File exceeds ${a} bytes`, { code: "too_large" });
5368
- const r = t.contentType ?? sa(e);
5382
+ const r = t.contentType ?? la(e);
5369
5383
  if (n.length && r && !n.includes(r))
5370
5384
  throw new z(`Content type ${r} not accepted`, { code: "bad_type" });
5371
5385
  }
5372
- async function wi(e) {
5386
+ async function Ni(e) {
5373
5387
  const t = await e.arrayBuffer(), n = new Uint8Array(t);
5374
5388
  if (typeof btoa == "function") {
5375
5389
  let r = "";
@@ -5398,15 +5412,15 @@ function bn(e, t, n) {
5398
5412
  }
5399
5413
  r[a[a.length - 1]] = n;
5400
5414
  }
5401
- function Ni(e, t) {
5415
+ function xi(e, t) {
5402
5416
  if (t === "asIs") return e;
5403
5417
  const n = e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-\s]+/g, " ").trim().split(" ").filter(Boolean);
5404
5418
  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("");
5405
5419
  }
5406
5420
  function gn(e, t) {
5407
- return e.split(".").map((n) => Ni(n, t)).join(".");
5421
+ return e.split(".").map((n) => xi(n, t)).join(".");
5408
5422
  }
5409
- function xi(e, t) {
5423
+ function Si(e, t) {
5410
5424
  switch (t) {
5411
5425
  case "toFixed2":
5412
5426
  return Number(e).toFixed(2);
@@ -5423,11 +5437,11 @@ function xi(e, t) {
5423
5437
  return e;
5424
5438
  }
5425
5439
  }
5426
- function Si(e, t) {
5440
+ function Ci(e, t) {
5427
5441
  const n = e instanceof Date ? e : new Date(e);
5428
5442
  return Number.isNaN(n.getTime()) ? String(e) : n.toISOString();
5429
5443
  }
5430
- function Ci(e, t, n) {
5444
+ function Pi(e, t, n) {
5431
5445
  switch (t) {
5432
5446
  case "number": {
5433
5447
  if (n.numberEncoding === "number") {
@@ -5439,7 +5453,7 @@ function Ci(e, t, n) {
5439
5453
  case "boolean":
5440
5454
  return typeof e == "string" ? e.toLowerCase() === "true" : !!e;
5441
5455
  case "date":
5442
- return Si(e, n.dateFormat);
5456
+ return Ci(e, n.dateFormat);
5443
5457
  case "json":
5444
5458
  return e;
5445
5459
  case "string":
@@ -5447,18 +5461,18 @@ function Ci(e, t, n) {
5447
5461
  return String(e);
5448
5462
  }
5449
5463
  }
5450
- function at(e, t) {
5464
+ function rt(e, t) {
5451
5465
  if (t === "number") return e;
5452
5466
  if (typeof e == "number") return String(e);
5453
- if (Array.isArray(e)) return e.map((n) => at(n, t));
5467
+ if (Array.isArray(e)) return e.map((n) => rt(n, t));
5454
5468
  if (e && typeof e == "object") {
5455
5469
  const n = {};
5456
- for (const [a, r] of Object.entries(e)) n[a] = at(r, t);
5470
+ for (const [a, r] of Object.entries(e)) n[a] = rt(r, t);
5457
5471
  return n;
5458
5472
  }
5459
5473
  return e;
5460
5474
  }
5461
- function Pi(e, t) {
5475
+ function Ti(e, t) {
5462
5476
  var n;
5463
5477
  switch (e.kind) {
5464
5478
  case "static":
@@ -5479,10 +5493,10 @@ function Pi(e, t) {
5479
5493
  return;
5480
5494
  }
5481
5495
  }
5482
- function Ti(e, t, n) {
5496
+ function Fi(e, t, n) {
5483
5497
  const a = {};
5484
5498
  for (const u of e) {
5485
- let m = Pi(u.source, n);
5499
+ let m = Ti(u.source, n);
5486
5500
  const d = m === "" || m == null;
5487
5501
  if (u.omitWhenEmpty && d) continue;
5488
5502
  const i = gn(u.key, t.keyCase);
@@ -5491,14 +5505,14 @@ function Ti(e, t, n) {
5491
5505
  bn(a, i, null);
5492
5506
  continue;
5493
5507
  }
5494
- u.transform && u.transform !== "none" && (m = xi(m, u.transform)), bn(a, i, Ci(m, u.type, t));
5508
+ u.transform && u.transform !== "none" && (m = Si(m, u.transform)), bn(a, i, Pi(m, u.type, t));
5495
5509
  }
5496
5510
  const r = t.include, s = (u, m) => {
5497
- m !== void 0 && (a[gn(u, t.keyCase)] = at(m, t.numberEncoding));
5511
+ m !== void 0 && (a[gn(u, t.keyCase)] = rt(m, t.numberEncoding));
5498
5512
  };
5499
5513
  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;
5500
5514
  }
5501
- const ys = {
5515
+ const bs = {
5502
5516
  mode: "flat",
5503
5517
  keyCase: "asIs",
5504
5518
  dateFormat: "iso",
@@ -5507,9 +5521,9 @@ const ys = {
5507
5521
  include: { inputs: !0, outputs: !0, schedule: !1, settingsSnapshot: !0, meta: !0 }
5508
5522
  };
5509
5523
  function vn(e) {
5510
- return at(e, "string");
5524
+ return rt(e, "string");
5511
5525
  }
5512
- function bs(e) {
5526
+ function gs(e) {
5513
5527
  const t = e.settings;
5514
5528
  return {
5515
5529
  schemaVersion: 1,
@@ -5543,17 +5557,17 @@ function bs(e) {
5543
5557
  warnings: e.warnings ?? []
5544
5558
  },
5545
5559
  ...e.attachments && e.attachments.length ? { attachments: e.attachments } : {},
5546
- client: { tz: e.clientTz ?? Fi(), platform: "web" }
5560
+ client: { tz: e.clientTz ?? Ii(), platform: "web" }
5547
5561
  };
5548
5562
  }
5549
- function Fi() {
5563
+ function Ii() {
5550
5564
  try {
5551
5565
  return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
5552
5566
  } catch {
5553
5567
  return "UTC";
5554
5568
  }
5555
5569
  }
5556
- const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "rates", "settings"], Ii = {
5570
+ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "rates", "settings"], Ri = {
5557
5571
  save: "POST",
5558
5572
  update: "PUT",
5559
5573
  get: "GET",
@@ -5563,7 +5577,7 @@ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "r
5563
5577
  uploadUrl: "GET",
5564
5578
  rates: "GET",
5565
5579
  settings: "GET"
5566
- }, la = ["bearer", "apiKeyHeader", "basic", "custom"], Ri = {
5580
+ }, ca = ["bearer", "apiKeyHeader", "basic", "custom"], Ei = {
5567
5581
  strategy: "multipart",
5568
5582
  fieldName: "file",
5569
5583
  maxBytes: 10 * 1024 * 1024,
@@ -5572,10 +5586,10 @@ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "r
5572
5586
  checksum: "none",
5573
5587
  chunked: { enabled: !1, chunkBytes: 1024 * 1024 }
5574
5588
  };
5575
- function ca() {
5589
+ function ua() {
5576
5590
  const e = {};
5577
5591
  for (const t of He)
5578
- e[t] = { path: `/calculations${t === "save" || t === "list" ? "" : t === "get" || t === "update" || t === "delete" ? "/:id" : "/" + t}`, method: Ii[t], enabled: t === "save" || t === "list" };
5592
+ e[t] = { path: `/calculations${t === "save" || t === "list" ? "" : t === "get" || t === "update" || t === "delete" ? "/:id" : "/" + t}`, method: Ri[t], enabled: t === "save" || t === "list" };
5579
5593
  return {
5580
5594
  baseUrl: "https://api.example.com/v1",
5581
5595
  auth: { strategy: "bearer", headerName: "Authorization" },
@@ -5583,17 +5597,17 @@ function ca() {
5583
5597
  credentials: "same-origin",
5584
5598
  retry: { attempts: 3, backoff: "exponential", baseDelayMs: 300, retryOn: [408, 429, 500, 502, 503, 504], respectRetryAfter: !0 },
5585
5599
  endpoints: e,
5586
- upload: Ri
5600
+ upload: Ei
5587
5601
  };
5588
5602
  }
5589
- const Ei = {
5603
+ const Mi = {
5590
5604
  mode: "flat",
5591
5605
  keyCase: "asIs",
5592
5606
  dateFormat: "iso",
5593
5607
  nullHandling: "omit",
5594
5608
  numberEncoding: "string",
5595
5609
  include: { inputs: !0, outputs: !0, schedule: !1, settingsSnapshot: !0, meta: !0 }
5596
- }, Mi = [
5610
+ }, $i = [
5597
5611
  { key: "calculator", source: { kind: "context", path: "calculator" }, type: "string", required: !0, omitWhenEmpty: !1 },
5598
5612
  { key: "principal", source: { kind: "input", path: "principal" }, type: "number", required: !0, omitWhenEmpty: !1 },
5599
5613
  { key: "payment", source: { kind: "output", path: "payment" }, type: "number", required: !1, omitWhenEmpty: !1 },
@@ -5612,7 +5626,7 @@ function kn(e) {
5612
5626
  n /= 1024, a++;
5613
5627
  return `${n.toFixed(n < 10 ? 1 : 0)} ${t[a]}`;
5614
5628
  }
5615
- function ua(e, t, n) {
5629
+ function da(e, t, n) {
5616
5630
  switch (e) {
5617
5631
  case "bearer":
5618
5632
  return { Authorization: `Bearer ${n}` };
@@ -5630,9 +5644,9 @@ function ua(e, t, n) {
5630
5644
  function qe(e, t) {
5631
5645
  return t ? /^https?:\/\//i.test(t) ? t : `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : e;
5632
5646
  }
5633
- const $i = ["Connection", "Endpoints", "Upload", "Payload", "Test", "cURL", "Queue"];
5634
- function da({ hostConfig: e, getToken: t } = {}) {
5635
- const { settings: n } = ue(), [a, r] = M("Connection"), [s, u] = M(ca), [m, d] = M(Ei), [i, c] = M(Mi);
5647
+ const Ai = ["Connection", "Endpoints", "Upload", "Payload", "Test", "cURL", "Queue"];
5648
+ function ma({ hostConfig: e, getToken: t } = {}) {
5649
+ const { settings: n } = ue(), [a, r] = M("Connection"), [s, u] = M(ua), [m, d] = M(Mi), [i, c] = M($i);
5636
5650
  if (!n.features.integrationPanel)
5637
5651
  return /* @__PURE__ */ o("section", { className: "card", "data-part": "integration-panel", children: /* @__PURE__ */ b("div", { className: "panel-head", children: [
5638
5652
  /* @__PURE__ */ o("h2", { children: "Integration" }),
@@ -5654,12 +5668,12 @@ function da({ hostConfig: e, getToken: t } = {}) {
5654
5668
  /* @__PURE__ */ o("h2", { children: "Integration" }),
5655
5669
  /* @__PURE__ */ o("p", { children: "Point the library at your backend without a code change. Nothing here stores a secret." })
5656
5670
  ] }),
5657
- /* @__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)) }),
5671
+ /* @__PURE__ */ o("div", { className: "tabs", role: "tablist", "aria-label": "Integration settings", children: Ai.map((f) => /* @__PURE__ */ o("button", { role: "tab", "aria-selected": a === f, onClick: () => r(f), children: f }, f)) }),
5658
5672
  /* @__PURE__ */ b("div", { role: "tabpanel", "aria-label": a, children: [
5659
- a === "Connection" && /* @__PURE__ */ o(Ai, { cfg: s, patch: p, hostLocked: l, getToken: t }),
5660
- a === "Endpoints" && /* @__PURE__ */ o(Di, { cfg: s, setCfg: u, locked: l("endpoints") }),
5673
+ a === "Connection" && /* @__PURE__ */ o(Di, { cfg: s, patch: p, hostLocked: l, getToken: t }),
5674
+ a === "Endpoints" && /* @__PURE__ */ o(Li, { cfg: s, setCfg: u, locked: l("endpoints") }),
5661
5675
  a === "Upload" && /* @__PURE__ */ o(
5662
- Li,
5676
+ Ui,
5663
5677
  {
5664
5678
  upload: s.upload,
5665
5679
  baseUrl: s.baseUrl,
@@ -5669,7 +5683,7 @@ function da({ hostConfig: e, getToken: t } = {}) {
5669
5683
  }
5670
5684
  ),
5671
5685
  a === "Payload" && /* @__PURE__ */ o(
5672
- Hi,
5686
+ qi,
5673
5687
  {
5674
5688
  fields: i,
5675
5689
  setFields: c,
@@ -5678,11 +5692,11 @@ function da({ hostConfig: e, getToken: t } = {}) {
5678
5692
  ctx: h
5679
5693
  }
5680
5694
  ),
5681
- a === "Test" && /* @__PURE__ */ o(Gi, { cfg: s, getToken: t }),
5682
- a === "cURL" && /* @__PURE__ */ o(ji, { cfg: s }),
5683
- a === "Queue" && /* @__PURE__ */ o(Vi, { cfg: s, getToken: t })
5695
+ a === "Test" && /* @__PURE__ */ o(ji, { cfg: s, getToken: t }),
5696
+ a === "cURL" && /* @__PURE__ */ o(Vi, { cfg: s }),
5697
+ a === "Queue" && /* @__PURE__ */ o(Yi, { cfg: s, getToken: t })
5684
5698
  ] }),
5685
- /* @__PURE__ */ o(Yi, { cfg: s, setCfg: u })
5699
+ /* @__PURE__ */ o(Ki, { cfg: s, setCfg: u })
5686
5700
  ] });
5687
5701
  }
5688
5702
  function Fe({ on: e, children: t }) {
@@ -5691,7 +5705,7 @@ function Fe({ on: e, children: t }) {
5691
5705
  e && /* @__PURE__ */ o("div", { className: "int-note", children: "Set by your organisation — read-only." })
5692
5706
  ] });
5693
5707
  }
5694
- function te({
5708
+ function ne({
5695
5709
  label: e,
5696
5710
  value: t,
5697
5711
  onChange: n,
@@ -5733,15 +5747,15 @@ function le({
5733
5747
  /* @__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)) }) })
5734
5748
  ] });
5735
5749
  }
5736
- function Ai({
5750
+ function Di({
5737
5751
  cfg: e,
5738
5752
  patch: t,
5739
5753
  hostLocked: n,
5740
5754
  getToken: a
5741
5755
  }) {
5742
- const r = la.includes(e.auth.strategy);
5756
+ const r = ca.includes(e.auth.strategy);
5743
5757
  return /* @__PURE__ */ b("div", { className: "grid two", children: [
5744
- /* @__PURE__ */ o(Fe, { on: n("baseUrl"), children: /* @__PURE__ */ o(te, { label: "Base URL", value: e.baseUrl, onChange: (s) => t({ baseUrl: s }), help: "Absolute origin + base path" }) }),
5758
+ /* @__PURE__ */ o(Fe, { on: n("baseUrl"), children: /* @__PURE__ */ o(ne, { label: "Base URL", value: e.baseUrl, onChange: (s) => t({ baseUrl: s }), help: "Absolute origin + base path" }) }),
5745
5759
  /* @__PURE__ */ o(
5746
5760
  le,
5747
5761
  {
@@ -5751,7 +5765,7 @@ function Ai({
5751
5765
  onChange: (s) => t({ auth: { ...e.auth, strategy: s } })
5752
5766
  }
5753
5767
  ),
5754
- (e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom") && /* @__PURE__ */ o(te, { label: "Header name", value: e.auth.headerName, onChange: (s) => t({ auth: { ...e.auth, headerName: s } }) }),
5768
+ (e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom") && /* @__PURE__ */ o(ne, { label: "Header name", value: e.auth.headerName, onChange: (s) => t({ auth: { ...e.auth, headerName: s } }) }),
5755
5769
  r && /* @__PURE__ */ b("div", { className: "field span2", children: [
5756
5770
  /* @__PURE__ */ o("span", { className: "lbl", children: "Token" }),
5757
5771
  a ? /* @__PURE__ */ o("div", { className: "input-wrap", style: { background: "var(--fc-accent-weak)" }, children: /* @__PURE__ */ o("input", { value: "•••••••••• supplied by host application", readOnly: !0, "aria-label": "token supplied by host", style: { textAlign: "left" } }) }) : /* @__PURE__ */ b("div", { className: "notice", children: [
@@ -5760,7 +5774,7 @@ function Ai({
5760
5774
  " supplied by the host — endpoints that require auth are disabled. The panel never accepts a token as input."
5761
5775
  ] })
5762
5776
  ] }),
5763
- /* @__PURE__ */ o(Fe, { on: n("timeoutMs"), children: /* @__PURE__ */ o(te, { label: "Timeout", type: "number", value: String(e.timeoutMs), onChange: (s) => t({ timeoutMs: Number(s) || 0 }), affix: "ms" }) }),
5777
+ /* @__PURE__ */ o(Fe, { on: n("timeoutMs"), children: /* @__PURE__ */ o(ne, { label: "Timeout", type: "number", value: String(e.timeoutMs), onChange: (s) => t({ timeoutMs: Number(s) || 0 }), affix: "ms" }) }),
5764
5778
  /* @__PURE__ */ o(Fe, { on: n("credentials"), children: /* @__PURE__ */ o(
5765
5779
  le,
5766
5780
  {
@@ -5770,7 +5784,7 @@ function Ai({
5770
5784
  onChange: (s) => t({ credentials: s })
5771
5785
  }
5772
5786
  ) }),
5773
- /* @__PURE__ */ o(Fe, { on: n("retry"), children: /* @__PURE__ */ o(te, { label: "Retry attempts", type: "number", value: String(e.retry.attempts), onChange: (s) => t({ retry: { ...e.retry, attempts: Number(s) || 1 } }) }) }),
5787
+ /* @__PURE__ */ o(Fe, { on: n("retry"), children: /* @__PURE__ */ o(ne, { label: "Retry attempts", type: "number", value: String(e.retry.attempts), onChange: (s) => t({ retry: { ...e.retry, attempts: Number(s) || 1 } }) }) }),
5774
5788
  /* @__PURE__ */ o(
5775
5789
  le,
5776
5790
  {
@@ -5780,9 +5794,9 @@ function Ai({
5780
5794
  onChange: (s) => t({ retry: { ...e.retry, backoff: s } })
5781
5795
  }
5782
5796
  ),
5783
- /* @__PURE__ */ o(te, { label: "Base delay", type: "number", value: String(e.retry.baseDelayMs), onChange: (s) => t({ retry: { ...e.retry, baseDelayMs: Number(s) || 0 } }), affix: "ms" }),
5797
+ /* @__PURE__ */ o(ne, { label: "Base delay", type: "number", value: String(e.retry.baseDelayMs), onChange: (s) => t({ retry: { ...e.retry, baseDelayMs: Number(s) || 0 } }), affix: "ms" }),
5784
5798
  /* @__PURE__ */ o(
5785
- te,
5799
+ ne,
5786
5800
  {
5787
5801
  label: "Retry on (status codes)",
5788
5802
  value: e.retry.retryOn.join(", "),
@@ -5792,7 +5806,7 @@ function Ai({
5792
5806
  )
5793
5807
  ] });
5794
5808
  }
5795
- function Di({ cfg: e, setCfg: t, locked: n }) {
5809
+ function Li({ cfg: e, setCfg: t, locked: n }) {
5796
5810
  const a = (r, s) => t((u) => ({ ...u, endpoints: { ...u.endpoints, [r]: { ...u.endpoints[r], ...s } } }));
5797
5811
  return /* @__PURE__ */ o(Fe, { on: n, children: /* @__PURE__ */ o("div", { className: "int-table-wrap", children: /* @__PURE__ */ b("table", { className: "int-table", children: [
5798
5812
  /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ b("tr", { children: [
@@ -5815,25 +5829,25 @@ function Di({ cfg: e, setCfg: t, locked: n }) {
5815
5829
  }) })
5816
5830
  ] }) }) });
5817
5831
  }
5818
- function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5832
+ function Ui({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5819
5833
  var m, d, i;
5820
- const s = (c) => a({ ...e, ...c }), u = ne(
5821
- () => oa(e.filenameTemplate, { calculator: "loan.emi", kind: "pdf", inputsHash: Ue.inputsHash, filename: "x.pdf" }),
5834
+ const s = (c) => a({ ...e, ...c }), u = X(
5835
+ () => ia(e.filenameTemplate, { calculator: "loan.emi", kind: "pdf", inputsHash: Ue.inputsHash, filename: "x.pdf" }),
5822
5836
  [e.filenameTemplate]
5823
5837
  );
5824
5838
  return /* @__PURE__ */ o(Fe, { on: r, children: /* @__PURE__ */ b("div", { className: "grid two", children: [
5825
- /* @__PURE__ */ o(te, { label: "Upload URI", value: n, readOnly: !0, help: "Resolved from baseUrl + the 'upload' endpoint path (edit it under Endpoints)" }),
5839
+ /* @__PURE__ */ o(ne, { label: "Upload URI", value: n, readOnly: !0, help: "Resolved from baseUrl + the 'upload' endpoint path (edit it under Endpoints)" }),
5826
5840
  /* @__PURE__ */ o(le, { label: "Strategy", value: e.strategy, options: ["multipart", "presigned", "base64Json"], onChange: (c) => s({ strategy: c }) }),
5827
- /* @__PURE__ */ o(te, { label: "Field name", value: e.fieldName, onChange: (c) => s({ fieldName: c }) }),
5828
- /* @__PURE__ */ o(te, { label: "Max bytes", type: "number", value: String(e.maxBytes), onChange: (c) => s({ maxBytes: Number(c) || 0 }), affix: kn(e.maxBytes) }),
5841
+ /* @__PURE__ */ o(ne, { label: "Field name", value: e.fieldName, onChange: (c) => s({ fieldName: c }) }),
5842
+ /* @__PURE__ */ o(ne, { label: "Max bytes", type: "number", value: String(e.maxBytes), onChange: (c) => s({ maxBytes: Number(c) || 0 }), affix: kn(e.maxBytes) }),
5829
5843
  /* @__PURE__ */ b("div", { className: "field span2", children: [
5830
- /* @__PURE__ */ o(te, { label: "Filename template", value: e.filenameTemplate, onChange: (c) => s({ filenameTemplate: c }), help: "{calculator} {yyyy} {MM} {dd} {hash8} {ext}" }),
5844
+ /* @__PURE__ */ o(ne, { label: "Filename template", value: e.filenameTemplate, onChange: (c) => s({ filenameTemplate: c }), help: "{calculator} {yyyy} {MM} {dd} {hash8} {ext}" }),
5831
5845
  /* @__PURE__ */ b("div", { className: "int-note mono", children: [
5832
5846
  "→ ",
5833
5847
  u
5834
5848
  ] })
5835
5849
  ] }),
5836
- /* @__PURE__ */ o(te, { label: "Accepted MIME types", value: e.accept.join(", "), onChange: (c) => s({ accept: c.split(",").map((l) => l.trim()).filter(Boolean) }) }),
5850
+ /* @__PURE__ */ o(ne, { label: "Accepted MIME types", value: e.accept.join(", "), onChange: (c) => s({ accept: c.split(",").map((l) => l.trim()).filter(Boolean) }) }),
5837
5851
  /* @__PURE__ */ o(le, { label: "Checksum", value: e.checksum ?? "none", options: ["none", "sha256"], onChange: (c) => s({ checksum: c }) }),
5838
5852
  /* @__PURE__ */ b("label", { className: "field toggle-field span2", children: [
5839
5853
  /* @__PURE__ */ o("span", { className: "lbl", children: "Chunked upload (large PDFs)" }),
@@ -5853,7 +5867,7 @@ function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5853
5867
  }
5854
5868
  )
5855
5869
  ] }),
5856
- ((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) }),
5870
+ ((i = e.chunked) == null ? void 0 : i.enabled) && /* @__PURE__ */ o(ne, { 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) }),
5857
5871
  e.strategy === "presigned" && /* @__PURE__ */ b("div", { className: "span2 int-subform", children: [
5858
5872
  /* @__PURE__ */ b("div", { className: "int-note", children: [
5859
5873
  /* @__PURE__ */ o("strong", { children: "Presigned sub-form" }),
@@ -5870,14 +5884,14 @@ function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5870
5884
  ] })
5871
5885
  ] }) });
5872
5886
  }
5873
- const Ui = ["static", "input", "output", "setting", "context", "token", "callback"];
5874
- function Oi(e) {
5887
+ const Oi = ["static", "input", "output", "setting", "context", "token", "callback"];
5888
+ function Bi(e) {
5875
5889
  return e.kind === "static" ? String(e.value) : e.kind === "token" ? e.name : e.kind === "callback" ? "fn()" : e.path;
5876
5890
  }
5877
- function Bi(e, t) {
5891
+ function _i(e, t) {
5878
5892
  return e.kind === "static" ? { kind: "static", value: t } : e.kind === "token" ? { kind: "token", name: t } : e.kind === "callback" ? e : { kind: e.kind, path: t };
5879
5893
  }
5880
- function _i(e) {
5894
+ function Hi(e) {
5881
5895
  switch (e) {
5882
5896
  case "static":
5883
5897
  return { kind: "static", value: "" };
@@ -5889,16 +5903,16 @@ function _i(e) {
5889
5903
  return { kind: e, path: "" };
5890
5904
  }
5891
5905
  }
5892
- function Hi({
5906
+ function qi({
5893
5907
  fields: e,
5894
5908
  setFields: t,
5895
5909
  envelope: n,
5896
5910
  setEnvelope: a,
5897
5911
  ctx: r
5898
5912
  }) {
5899
- const s = ne(() => {
5913
+ const s = X(() => {
5900
5914
  try {
5901
- return JSON.stringify(Ti(e, n, r), null, 2);
5915
+ return JSON.stringify(Fi(e, n, r), null, 2);
5902
5916
  } catch (i) {
5903
5917
  return `// ${i instanceof Error ? i.message : "preview failed"}`;
5904
5918
  }
@@ -5912,7 +5926,7 @@ function Hi({
5912
5926
  /* @__PURE__ */ b("div", { children: [
5913
5927
  /* @__PURE__ */ b("div", { className: "grid two", children: [
5914
5928
  /* @__PURE__ */ o(le, { label: "Envelope", value: n.mode, options: ["flat", "wrapped"], onChange: (i) => a({ ...n, mode: i }) }),
5915
- n.mode === "wrapped" && /* @__PURE__ */ o(te, { label: "Wrapper key", value: n.wrapperKey ?? "data", onChange: (i) => a({ ...n, wrapperKey: i }) }),
5929
+ n.mode === "wrapped" && /* @__PURE__ */ o(ne, { label: "Wrapper key", value: n.wrapperKey ?? "data", onChange: (i) => a({ ...n, wrapperKey: i }) }),
5916
5930
  /* @__PURE__ */ o(le, { label: "Key case", value: n.keyCase, options: ["asIs", "camel", "snake", "kebab"], onChange: (i) => a({ ...n, keyCase: i }) }),
5917
5931
  /* @__PURE__ */ o(le, { label: "Null handling", value: n.nullHandling, options: ["omit", "null"], onChange: (i) => a({ ...n, nullHandling: i }) }),
5918
5932
  /* @__PURE__ */ o(le, { label: "Number encoding", value: n.numberEncoding, options: ["string", "number"], onChange: (i) => a({ ...n, numberEncoding: i }) })
@@ -5939,13 +5953,13 @@ function Hi({
5939
5953
  ] }) }),
5940
5954
  /* @__PURE__ */ o("tbody", { children: e.map((i, c) => /* @__PURE__ */ b("tr", { children: [
5941
5955
  /* @__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" }) }),
5942
- /* @__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)) }) }),
5956
+ /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("select", { value: i.source.kind, onChange: (l) => u(c, { source: Hi(l.target.value) }), "aria-label": "source kind", children: Oi.map((l) => /* @__PURE__ */ o("option", { children: l }, l)) }) }),
5943
5957
  /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(
5944
5958
  "input",
5945
5959
  {
5946
- value: Oi(i.source),
5960
+ value: Bi(i.source),
5947
5961
  disabled: i.source.kind === "callback",
5948
- onChange: (l) => u(c, { source: Bi(i.source, l.target.value) }),
5962
+ onChange: (l) => u(c, { source: _i(i.source, l.target.value) }),
5949
5963
  "aria-label": "source value",
5950
5964
  className: "int-cell-input"
5951
5965
  }
@@ -5976,7 +5990,7 @@ function Hi({
5976
5990
  ] })
5977
5991
  ] });
5978
5992
  }
5979
- function qi(e, t) {
5993
+ function Gi(e, t) {
5980
5994
  const n = {};
5981
5995
  for (const a of He) {
5982
5996
  const r = e.endpoints[a];
@@ -5990,10 +6004,10 @@ function qi(e, t) {
5990
6004
  retry: e.retry,
5991
6005
  upload: e.upload,
5992
6006
  offlineQueue: { enabled: !0, storage: "memory", maxItems: 200, flushOn: "manual" },
5993
- getAuth: t ? async () => ua(e.auth.strategy, e.auth.headerName, await t()) : void 0
6007
+ getAuth: t ? async () => da(e.auth.strategy, e.auth.headerName, await t()) : void 0
5994
6008
  };
5995
6009
  }
5996
- function Gi({ cfg: e, getToken: t }) {
6010
+ function ji({ cfg: e, getToken: t }) {
5997
6011
  const [n, a] = M({ loading: !1 }), [r, s] = M("save");
5998
6012
  return /* @__PURE__ */ b("div", { children: [
5999
6013
  /* @__PURE__ */ b("div", { className: "grid two", children: [
@@ -6001,11 +6015,11 @@ function Gi({ cfg: e, getToken: t }) {
6001
6015
  /* @__PURE__ */ o("div", { className: "field", style: { display: "flex", alignItems: "flex-end" }, children: /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: async () => {
6002
6016
  a({ loading: !0 });
6003
6017
  const m = e.endpoints[r], d = qe(e.baseUrl, m.path).replace(/:id\b/, "sample-id"), i = { "content-type": "application/json", "X-FinCalc-Test": "1" };
6004
- t && Object.assign(i, ua(e.auth.strategy, e.auth.headerName, await t()));
6018
+ t && Object.assign(i, da(e.auth.strategy, e.auth.headerName, await t()));
6005
6019
  const c = performance.now();
6006
6020
  try {
6007
6021
  const l = await fetch(d, { method: m.method, headers: i, credentials: e.credentials }), p = await l.text(), h = {};
6008
- 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: $t(i) } });
6022
+ 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: Wi(p), sent: { url: d, method: m.method, headers: $t(i) } });
6009
6023
  } catch (l) {
6010
6024
  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: $t(i) } });
6011
6025
  }
@@ -6035,9 +6049,9 @@ ${JSON.stringify(n.sent.headers, null, 2)}` })
6035
6049
  ] })
6036
6050
  ] });
6037
6051
  }
6038
- function ji({ cfg: e }) {
6052
+ function Vi({ cfg: e }) {
6039
6053
  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" };
6040
- la.includes(e.auth.strategy) && (m[e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom" ? e.auth.headerName || "X-API-Key" : "Authorization"] = t ? "<token>" : "***");
6054
+ ca.includes(e.auth.strategy) && (m[e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom" ? e.auth.headerName || "X-API-Key" : "Authorization"] = t ? "<token>" : "***");
6041
6055
  const d = [`curl -X ${s.method} '${u}'`];
6042
6056
  for (const [c, l] of Object.entries(m)) d.push(` -H '${c}: ${l}'`);
6043
6057
  ["POST", "PUT", "PATCH"].includes(s.method) && d.push(` -d '{"example":"body"}'`);
@@ -6058,8 +6072,8 @@ function ji({ cfg: e }) {
6058
6072
  }, children: "Copy" })
6059
6073
  ] });
6060
6074
  }
6061
- function Vi({ cfg: e, getToken: t }) {
6062
- const n = ne(() => fi(qi(e, t)), [e, t]), [a, r] = M(() => n.queue.list()), [s, u] = M(""), m = () => r(n.queue.list());
6075
+ function Yi({ cfg: e, getToken: t }) {
6076
+ const n = X(() => yi(Gi(e, t)), [e, t]), [a, r] = M(() => n.queue.list()), [s, u] = M(""), m = () => r(n.queue.list());
6063
6077
  return /* @__PURE__ */ b("div", { children: [
6064
6078
  /* @__PURE__ */ b("div", { className: "actions-row", style: { marginTop: 0 }, children: [
6065
6079
  /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: m, children: "Refresh" }),
@@ -6088,7 +6102,7 @@ function Vi({ cfg: e, getToken: t }) {
6088
6102
  ] }) })
6089
6103
  ] });
6090
6104
  }
6091
- function Yi({ cfg: e, setCfg: t }) {
6105
+ function Ki({ cfg: e, setCfg: t }) {
6092
6106
  const [n, a] = M(""), [r, s] = M("");
6093
6107
  return /* @__PURE__ */ b("div", { className: "accordion", style: { marginTop: 20 }, children: [
6094
6108
  /* @__PURE__ */ o("span", { className: "lbl", children: "Import / export config (JSON)" }),
@@ -6102,7 +6116,7 @@ function Yi({ cfg: e, setCfg: t }) {
6102
6116
  const d = JSON.parse(n);
6103
6117
  for (const i of ["token", "apiKey", "getAuth", "authorization"])
6104
6118
  i in d && (delete d[i], s(`Refused to import "${i}" — the panel never persists a secret.`));
6105
- t(() => ({ ...ca(), ...d })), r || s("Imported.");
6119
+ t(() => ({ ...ua(), ...d })), r || s("Imported.");
6106
6120
  } catch {
6107
6121
  s("Invalid JSON.");
6108
6122
  }
@@ -6111,16 +6125,16 @@ function Yi({ cfg: e, setCfg: t }) {
6111
6125
  r && /* @__PURE__ */ o("div", { className: "int-note", children: r })
6112
6126
  ] });
6113
6127
  }
6114
- function Ki(e) {
6128
+ function Wi(e) {
6115
6129
  try {
6116
6130
  return JSON.stringify(JSON.parse(e), null, 2);
6117
6131
  } catch {
6118
6132
  return e;
6119
6133
  }
6120
6134
  }
6121
- const Wi = "1234567.891";
6122
- function zi() {
6123
- const { settings: e, update: t, setRegion: n, reset: a, replace: r } = ue(), s = de(null), u = Sn(e).money(g(Wi)), m = () => {
6135
+ const zi = "1234567.891";
6136
+ function Ji() {
6137
+ const { settings: e, update: t, setRegion: n, reset: a, replace: r } = ue(), s = de(null), u = Sn(e).money(g(zi)), m = () => {
6124
6138
  const i = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), c = URL.createObjectURL(i), l = document.createElement("a");
6125
6139
  l.href = c, l.download = "calcsuite-settings.json", l.click(), URL.revokeObjectURL(c);
6126
6140
  }, d = (i) => {
@@ -6211,7 +6225,7 @@ function zi() {
6211
6225
  options: [["system", "System"], ["light", "Light"], ["dark", "Dark"], ["highContrast", "High contrast"]]
6212
6226
  }
6213
6227
  ) }),
6214
- /* @__PURE__ */ o(W, { label: "Accent colour", children: /* @__PURE__ */ o("div", { className: "swatches", children: si.map((i) => {
6228
+ /* @__PURE__ */ o(W, { label: "Accent colour", children: /* @__PURE__ */ o("div", { className: "swatches", children: wa.map((i) => {
6215
6229
  const c = e.ui.accent.toLowerCase() === i.main.toLowerCase();
6216
6230
  return /* @__PURE__ */ o(
6217
6231
  "button",
@@ -6232,7 +6246,7 @@ function zi() {
6232
6246
  {
6233
6247
  value: e.ui.fontFamily,
6234
6248
  onChange: (i) => t({ ui: { fontFamily: i } }),
6235
- options: li.map((i) => [i.id, i.label])
6249
+ options: Cn.map((i) => [i.id, i.label])
6236
6250
  }
6237
6251
  ) }),
6238
6252
  /* @__PURE__ */ o(W, { label: "Density", children: /* @__PURE__ */ o(
@@ -6255,7 +6269,7 @@ function zi() {
6255
6269
  " — so exports (PDF/CSV/…) and saved calculations post directly to your own server. No secret is ever stored by the app."
6256
6270
  ] })
6257
6271
  ] }),
6258
- e.features.integrationPanel && /* @__PURE__ */ o(da, {}),
6272
+ e.features.integrationPanel && /* @__PURE__ */ o(ma, {}),
6259
6273
  /* @__PURE__ */ b("div", { className: "actions-row", children: [
6260
6274
  /* @__PURE__ */ o("button", { className: "icon-btn", onClick: m, children: "Export settings" }),
6261
6275
  /* @__PURE__ */ o("button", { className: "icon-btn", onClick: () => {
@@ -6288,7 +6302,7 @@ function he({ value: e, onChange: t, options: n }) {
6288
6302
  function Le({ on: e, onClick: t }) {
6289
6303
  return /* @__PURE__ */ o("button", { type: "button", role: "switch", "aria-checked": e, className: `toggle ${e ? "on" : ""}`, onClick: t, children: /* @__PURE__ */ o("span", { className: "knob" }) });
6290
6304
  }
6291
- function Ji({
6305
+ function Zi({
6292
6306
  items: e,
6293
6307
  onRestore: t,
6294
6308
  onClear: n
@@ -6317,18 +6331,18 @@ function wn(e, t) {
6317
6331
  for (let s = 0; s < n.length && r < e.length; s++) n[s] === e[r] && r++;
6318
6332
  return r === e.length ? 10 : -1;
6319
6333
  }
6320
- function Zi({
6334
+ function Xi({
6321
6335
  calculators: e,
6322
6336
  actions: t,
6323
6337
  onPick: n,
6324
6338
  onClose: a
6325
6339
  }) {
6326
6340
  const [r, s] = M(""), [u, m] = M(0), d = de(null);
6327
- X(() => {
6341
+ Q(() => {
6328
6342
  var l;
6329
6343
  return (l = d.current) == null ? void 0 : l.focus();
6330
- }, []), X(() => (wa(), () => Na()), []);
6331
- const i = ne(() => {
6344
+ }, []), Q(() => (Sa(), () => Ca()), []);
6345
+ const i = X(() => {
6332
6346
  const l = e.map((y) => ({
6333
6347
  key: `calc:${y.id}`,
6334
6348
  label: y.title,
@@ -6341,7 +6355,7 @@ function Zi({
6341
6355
  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(" ")) ?? ""}`)) };
6342
6356
  }).filter((y) => y.s > 0).sort((y, w) => w.s - y.s).map((y) => y.it) : h;
6343
6357
  }, [r, e, t, n]);
6344
- 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: [
6358
+ return Q(() => 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: [
6345
6359
  /* @__PURE__ */ o(
6346
6360
  "input",
6347
6361
  {
@@ -6377,7 +6391,7 @@ function Zi({
6377
6391
  ] })
6378
6392
  ] }) });
6379
6393
  }
6380
- const ut = (e) => ({
6394
+ const dt = (e) => ({
6381
6395
  width: e,
6382
6396
  height: e,
6383
6397
  viewBox: "0 0 24 24",
@@ -6388,32 +6402,32 @@ const ut = (e) => ({
6388
6402
  strokeLinejoin: "round",
6389
6403
  "aria-hidden": !0
6390
6404
  });
6391
- function Xi({ size: e = 17 }) {
6392
- return /* @__PURE__ */ b("svg", { ...ut(e), children: [
6405
+ function Qi({ size: e = 17 }) {
6406
+ return /* @__PURE__ */ b("svg", { ...dt(e), children: [
6393
6407
  /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "3" }),
6394
6408
  /* @__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" })
6395
6409
  ] });
6396
6410
  }
6397
- function Qi({ size: e = 17 }) {
6398
- return /* @__PURE__ */ b("svg", { ...ut(e), children: [
6411
+ function es({ size: e = 17 }) {
6412
+ return /* @__PURE__ */ b("svg", { ...dt(e), children: [
6399
6413
  /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "4" }),
6400
6414
  /* @__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" })
6401
6415
  ] });
6402
6416
  }
6403
- function es({ size: e = 17 }) {
6404
- return /* @__PURE__ */ o("svg", { ...ut(e), children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
6405
- }
6406
6417
  function ts({ size: e = 17 }) {
6407
- return /* @__PURE__ */ b("svg", { ...ut(e), children: [
6418
+ return /* @__PURE__ */ o("svg", { ...dt(e), children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
6419
+ }
6420
+ function ns({ size: e = 17 }) {
6421
+ return /* @__PURE__ */ b("svg", { ...dt(e), children: [
6408
6422
  /* @__PURE__ */ o("path", { d: "M3 3v5h5" }),
6409
6423
  /* @__PURE__ */ o("path", { d: "M3.05 13A9 9 0 1 0 6 5.3L3 8" }),
6410
6424
  /* @__PURE__ */ o("path", { d: "M12 7v5l4 2" })
6411
6425
  ] });
6412
6426
  }
6413
- const ns = { "loan.emi": Wn, scientific: Jn, currency: aa };
6414
- function as({ onClose: e }) {
6415
- 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();
6416
- X(() => {
6427
+ const as = { "loan.emi": zn, scientific: Zn, currency: ra };
6428
+ function rs({ onClose: e }) {
6429
+ const { settings: t, setRegion: n, update: a, resolvedTheme: r } = ue(), s = t.region, u = X(() => Jr(s), [s]), [m, d] = M("loan.emi"), [i, c] = M("calc"), [l, p] = M(void 0), [h, f] = M(!1), { items: y, clear: w } = Do();
6430
+ Q(() => {
6417
6431
  const x = () => {
6418
6432
  const T = new URLSearchParams(location.hash.replace(/^#/, "") || location.search), $ = T.get("fincalc");
6419
6433
  if ($ && Rt($)) {
@@ -6464,17 +6478,17 @@ function as({ onClose: e }) {
6464
6478
  /* @__PURE__ */ o("button", { "aria-pressed": s === "IN", onClick: () => n("IN"), children: "🇮🇳" }),
6465
6479
  /* @__PURE__ */ o("button", { "aria-pressed": s === "US", onClick: () => n("US"), children: "🇺🇸" })
6466
6480
  ] }),
6467
- /* @__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, {}) }),
6481
+ /* @__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(es, {}) : /* @__PURE__ */ o(ts, {}) }),
6468
6482
  /* @__PURE__ */ b("button", { className: "icon-btn", "aria-label": "History", onClick: () => c("history"), children: [
6469
- /* @__PURE__ */ o(ts, {}),
6483
+ /* @__PURE__ */ o(ns, {}),
6470
6484
  " History"
6471
6485
  ] }),
6472
- /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Settings", onClick: () => c("settings"), children: /* @__PURE__ */ o(Xi, {}) }),
6486
+ /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Settings", onClick: () => c("settings"), children: /* @__PURE__ */ o(Qi, {}) }),
6473
6487
  e && /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Close", onClick: e, children: "✕" })
6474
6488
  ] })
6475
6489
  ] }),
6476
6490
  /* @__PURE__ */ b("div", { className: "fc-body", children: [
6477
- /* @__PURE__ */ o("nav", { className: "fc-rail", "aria-label": "Calculators", children: Wr.map((x) => {
6491
+ /* @__PURE__ */ o("nav", { className: "fc-rail", "aria-label": "Calculators", children: Zr.map((x) => {
6478
6492
  const T = u.filter(($) => $.group === x.id);
6479
6493
  return T.length === 0 ? null : /* @__PURE__ */ b("div", { className: "rail-group", children: [
6480
6494
  /* @__PURE__ */ o("div", { className: "rail-group-label", children: x.label }),
@@ -6490,24 +6504,24 @@ function as({ onClose: e }) {
6490
6504
  ] }, x.id);
6491
6505
  }) }),
6492
6506
  /* @__PURE__ */ o("main", { className: "fc-main", children: /* @__PURE__ */ b("div", { className: "fc-anim-in", children: [
6493
- i === "settings" && /* @__PURE__ */ o(zi, {}),
6494
- i === "history" && /* @__PURE__ */ o(Ji, { items: y, onRestore: P, onClear: w }),
6495
- i === "integration" && /* @__PURE__ */ o(da, {}),
6507
+ i === "settings" && /* @__PURE__ */ o(Ji, {}),
6508
+ i === "history" && /* @__PURE__ */ o(Zi, { items: y, onRestore: P, onClear: w }),
6509
+ i === "integration" && /* @__PURE__ */ o(ma, {}),
6496
6510
  i === "calc" && /* @__PURE__ */ o(
6497
- ii,
6511
+ ci,
6498
6512
  {
6499
6513
  def: F,
6500
6514
  seed: l,
6501
- customRegistry: ns,
6515
+ customRegistry: as,
6502
6516
  actions: (x, T) => x ? /* @__PURE__ */ b(re, { children: [
6503
6517
  /* @__PURE__ */ o(
6504
- Kn,
6518
+ Wn,
6505
6519
  {
6506
6520
  item: { id: F.id, title: `${F.title} — ${x.primary.value}`, primary: x.primary.value, values: T }
6507
6521
  }
6508
6522
  ),
6509
6523
  /* @__PURE__ */ o(
6510
- Gn,
6524
+ jn,
6511
6525
  {
6512
6526
  payload: {
6513
6527
  calculatorId: F.id,
@@ -6524,7 +6538,7 @@ function as({ onClose: e }) {
6524
6538
  )
6525
6539
  ] }, i === "calc" ? `calc:${F.id}` : i) })
6526
6540
  ] }),
6527
- h && /* @__PURE__ */ o(Zi, { calculators: u, actions: N, onPick: S, onClose: () => f(!1) })
6541
+ h && /* @__PURE__ */ o(Xi, { calculators: u, actions: N, onPick: S, onClose: () => f(!1) })
6528
6542
  ] });
6529
6543
  }
6530
6544
  function Nn({ size: e = 22 }) {
@@ -6554,7 +6568,7 @@ function Nn({ size: e = 22 }) {
6554
6568
  }
6555
6569
  );
6556
6570
  }
6557
- function gs({
6571
+ function vs({
6558
6572
  variant: e = "fab",
6559
6573
  position: t = "bottom-right",
6560
6574
  hotkey: n = "mod+shift+k",
@@ -6578,7 +6592,7 @@ function gs({
6578
6592
  close: () => S(!1),
6579
6593
  toggle: () => S(!k)
6580
6594
  };
6581
- X(() => {
6595
+ Q(() => {
6582
6596
  if (!n) return;
6583
6597
  const x = n.includes("mod"), T = n.includes("shift"), $ = n.split("+").pop(), L = (B) => {
6584
6598
  (!x || B.metaKey || B.ctrlKey) && (!T || B.shiftKey) && B.key.toLowerCase() === $ && (B.preventDefault(), S(!k));
@@ -6591,12 +6605,12 @@ function gs({
6591
6605
  /* @__PURE__ */ o("span", { "aria-hidden": !0, style: { marginRight: 6, display: "inline-flex", alignItems: "center" }, children: m ?? /* @__PURE__ */ o(Nn, { size: 16 }) }),
6592
6606
  u
6593
6607
  ] }),
6594
- /* @__PURE__ */ o(Ca, { open: k, onClose: F.close, title: h, size: p, children: /* @__PURE__ */ o(as, { onClose: F.close }) })
6608
+ /* @__PURE__ */ o(Fa, { open: k, onClose: F.close, title: h, size: p, children: /* @__PURE__ */ o(rs, { onClose: F.close }) })
6595
6609
  ] });
6596
6610
  }
6597
- const rs = 60 * 60 * 1e3, Nt = (e, t) => `${e}|${[...t].sort().join(",")}`;
6598
- function vs(e, t = {}) {
6599
- const n = t.ttlMs ?? rs, a = t.now ?? Date.now, r = /* @__PURE__ */ new Map();
6611
+ const os = 60 * 60 * 1e3, Nt = (e, t) => `${e}|${[...t].sort().join(",")}`;
6612
+ function ks(e, t = {}) {
6613
+ const n = t.ttlMs ?? os, a = t.now ?? Date.now, r = /* @__PURE__ */ new Map();
6600
6614
  let s = null;
6601
6615
  function u(i) {
6602
6616
  var l;
@@ -6642,71 +6656,71 @@ function vs(e, t = {}) {
6642
6656
  clear: () => r.clear()
6643
6657
  };
6644
6658
  }
6645
- const ks = { solve: Ie, REGIONS: me };
6659
+ const ws = { solve: Ie, REGIONS: me };
6646
6660
  export {
6647
- ii as CalculatorPanel,
6648
- ao as Chart,
6649
- Zi as CommandPalette,
6650
- aa as CurrencyConverter,
6661
+ ci as CalculatorPanel,
6662
+ io as Chart,
6663
+ Xi as CommandPalette,
6664
+ ra as CurrencyConverter,
6651
6665
  g as D,
6652
- ys as DEFAULT_ENVELOPE,
6653
- Ze as DEFAULT_SETTINGS,
6666
+ bs as DEFAULT_ENVELOPE,
6667
+ Xe as DEFAULT_SETTINGS,
6654
6668
  H as Decimal,
6655
- Ca as Dialog,
6656
- ro as EXPORT_FORMATS,
6657
- Gn as ExportMenu,
6658
- Jr as Field,
6659
- Ca as FinCalcDialog,
6669
+ Fa as Dialog,
6670
+ so as EXPORT_FORMATS,
6671
+ jn as ExportMenu,
6672
+ Qr as Field,
6673
+ Fa as FinCalcDialog,
6660
6674
  se as FinCalcError,
6661
- gs as FinCalcLauncher,
6662
- ms as FinCalcProvider,
6663
- as as FinCalcRoot,
6664
- Wr as GROUPS,
6665
- Ji as HistoryPanel,
6666
- da as IntegrationPanel,
6667
- gs as Launcher,
6668
- Wn as LoanEmiPanel,
6669
- ba as POLICY_DEFAULT,
6670
- Qr as ResultCard,
6671
- Kn as SaveButton,
6672
- no as ScheduleTable,
6673
- Jn as SciCalculator,
6674
- zi as SettingsPanel,
6675
- ms as SettingsProvider,
6676
- as as Shell,
6677
- Dn as allCalculators,
6675
+ vs as FinCalcLauncher,
6676
+ ps as FinCalcProvider,
6677
+ rs as FinCalcRoot,
6678
+ Zr as GROUPS,
6679
+ Zi as HistoryPanel,
6680
+ ma as IntegrationPanel,
6681
+ vs as Launcher,
6682
+ zn as LoanEmiPanel,
6683
+ ga as POLICY_DEFAULT,
6684
+ no as ResultCard,
6685
+ Wn as SaveButton,
6686
+ oo as ScheduleTable,
6687
+ Zn as SciCalculator,
6688
+ Ji as SettingsPanel,
6689
+ ps as SettingsProvider,
6690
+ rs as Shell,
6691
+ Ln as allCalculators,
6678
6692
  ye as boolval,
6679
- oa as buildFilename,
6680
- Ti as buildPayload,
6681
- bs as buildSavePayload,
6693
+ ia as buildFilename,
6694
+ Fi as buildPayload,
6695
+ gs as buildSavePayload,
6682
6696
  Rt as calculatorById,
6683
- Kr as calculatorsForRegion,
6684
- Eo as clearHistory,
6685
- To as createExporter,
6686
- vs as createFxCache,
6687
- fi as createTransport,
6688
- fs as currency,
6697
+ Jr as calculatorsForRegion,
6698
+ Ao as clearHistory,
6699
+ Ro as createExporter,
6700
+ ks as createFxCache,
6701
+ yi as createTransport,
6702
+ ys as currency,
6689
6703
  D as dmoney,
6690
- cs as eq,
6704
+ us as eq,
6691
6705
  on as evalExpression,
6692
- Zo as evaluateExpression,
6693
- ti as fetchLiveRate,
6694
- ps as finance,
6695
- us as gt,
6706
+ ei as evaluateExpression,
6707
+ ri as fetchLiveRate,
6708
+ hs as finance,
6709
+ ds as gt,
6696
6710
  ce as isZeroish,
6697
- ks as loan,
6698
- ds as lt,
6711
+ ws as loan,
6712
+ ms as lt,
6699
6713
  Sn as makeFormatter,
6700
6714
  v as metric,
6701
6715
  C as numval,
6702
- Vo as parseExpression,
6716
+ Wo as parseExpression,
6703
6717
  xt as regionDefaults,
6704
- hs as registerCalculator,
6705
- pi as sanitizeFilename,
6706
- Yn as saveHistory,
6718
+ fs as registerCalculator,
6719
+ hi as sanitizeFilename,
6720
+ Kn as saveHistory,
6707
6721
  Ie as solveLoan,
6708
6722
  _ as strval,
6709
6723
  ue as useFinCalc,
6710
- Mo as useHistory,
6724
+ Do as useHistory,
6711
6725
  ue as useSettings
6712
6726
  };