@alfadocs/ui-kit-debug 1.4.15 → 1.4.16

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.
@@ -11,7 +11,7 @@ import { M as oi } from "./multi-select-DqL4o0qV.js";
11
11
  import { N as gn } from "./number-input-Cgu2TtA8.js";
12
12
  import { R as we } from "./radio-TWf9Q-mp.js";
13
13
  import { R as pn } from "./radio-group-rXDJADzW.js";
14
- import { S as ze } from "./select-BW5ecXlX.js";
14
+ import { S as $e } from "./select-BW5ecXlX.js";
15
15
  import { T as Q } from "./tabs-CBb2AidH.js";
16
16
  import { T as sn } from "./text-area-Bt3p7Pt0.js";
17
17
  import { T as ne } from "./text-input-CUvCb6ST.js";
@@ -243,7 +243,7 @@ const Fi = [
243
243
  betterDirection: "toRange",
244
244
  precision: 2
245
245
  }
246
- ], Oi = [
246
+ ], zi = [
247
247
  // No reference range, deliberately: 1,600 kcal/d is a success for one
248
248
  // patient and starvation for another, so the only honest reference is the
249
249
  // patient's own target and `toRange` reads every change as neutral.
@@ -268,7 +268,7 @@ const Fi = [
268
268
  }
269
269
  ], at = [
270
270
  ...Pi,
271
- ...Oi,
271
+ ...zi,
272
272
  ...Mi
273
273
  ];
274
274
  Object.fromEntries(at.map((e) => [e.key, e]));
@@ -287,7 +287,7 @@ const En = [
287
287
  { code: "E55" }
288
288
  ];
289
289
  Object.fromEntries(En.map((e) => [e.code, e]));
290
- const zi = (e) => `anamnesis.pathology.${e.replace(/\./g, "_")}`;
290
+ const Oi = (e) => `anamnesis.pathology.${e.replace(/\./g, "_")}`;
291
291
  En.filter(
292
292
  (e) => !En.some((n) => n.parentCode === e.code)
293
293
  ).map((e) => e.code);
@@ -538,11 +538,11 @@ function fn(e) {
538
538
  function ji(e, n) {
539
539
  return ki(e ?? null, n ?? null);
540
540
  }
541
- function qe(e) {
541
+ function Be(e) {
542
542
  return e != null && !Number.isNaN(new Date(e).getTime());
543
543
  }
544
544
  function Wi(e, n) {
545
- if (!qe(e) || !qe(n)) return null;
545
+ if (!Be(e) || !Be(n)) return null;
546
546
  const a = new Date(Da(e)), i = new Date(Da(n));
547
547
  let s = i.getUTCFullYear() - a.getUTCFullYear();
548
548
  const o = i.getUTCMonth() - a.getUTCMonth();
@@ -691,12 +691,12 @@ function Re(e, n = 1, a) {
691
691
  return e == null || !Number.isFinite(e) ? ln : Ji(a, n).format(e);
692
692
  }
693
693
  function Zi(e, n) {
694
- return qe(e) ? new Intl.DateTimeFormat(n, Fn).format(
694
+ return Be(e) ? new Intl.DateTimeFormat(n, Fn).format(
695
695
  new Date(e)
696
696
  ) : ln;
697
697
  }
698
698
  function es(e, n) {
699
- return qe(e) ? new Intl.DateTimeFormat(n, rt).format(
699
+ return Be(e) ? new Intl.DateTimeFormat(n, rt).format(
700
700
  new Date(e)
701
701
  ) : ln;
702
702
  }
@@ -752,11 +752,11 @@ function bn(e) {
752
752
  const n = e == null ? void 0 : e.trim();
753
753
  return n || null;
754
754
  }
755
- function Be(e, n) {
755
+ function Ke(e, n) {
756
756
  return bn(e.label) ?? n(`anamnesis.param.${e.key}`, { defaultValue: e.key });
757
757
  }
758
758
  function Se(e, n) {
759
- const a = Be(e, n);
759
+ const a = Ke(e, n);
760
760
  return e.unit ? `${a} (${e.unit})` : a;
761
761
  }
762
762
  function he(e, n) {
@@ -774,13 +774,13 @@ function ye(e, n) {
774
774
  return bn(e.label) ?? n(`anamnesis.section.${e.key}`, { defaultValue: e.key });
775
775
  }
776
776
  function ma(e, n, a) {
777
- return bn(a == null ? void 0 : a.label) ?? n(zi(e), { defaultValue: e });
777
+ return bn(a == null ? void 0 : a.label) ?? n(Oi(e), { defaultValue: e });
778
778
  }
779
779
  function Ae(e, n, a) {
780
780
  const i = ma(e, n, a);
781
781
  return i === e ? e : `${e} — ${i}`;
782
782
  }
783
- function $e(e) {
783
+ function Ve(e) {
784
784
  if (!e) return !1;
785
785
  switch (e.kind) {
786
786
  case "text":
@@ -799,7 +799,7 @@ function $e(e) {
799
799
  return e.description.trim() !== "";
800
800
  }
801
801
  }
802
- function On(e, n, a) {
802
+ function zn(e, n, a) {
803
803
  switch (e.kind) {
804
804
  case "text":
805
805
  return e.text.trim() || "—";
@@ -865,10 +865,10 @@ function ls(e, n) {
865
865
  }
866
866
  function cs(e, n, a) {
867
867
  const i = n(e.key);
868
- return !i || !$e(i) ? null : {
868
+ return !i || !Ve(i) ? null : {
869
869
  key: e.key,
870
870
  label: he(e, a),
871
- value: On(i, e, a)
871
+ value: zn(i, e, a)
872
872
  };
873
873
  }
874
874
  function ds(e, n, a) {
@@ -896,7 +896,7 @@ function us(e, n, a, i) {
896
896
  let l = 0;
897
897
  for (const c of s) {
898
898
  const u = n(c.key);
899
- u && $e(u) && (l += 1);
899
+ u && Ve(u) && (l += 1);
900
900
  }
901
901
  return { groups: r, answered: l, total: s.length };
902
902
  }
@@ -906,7 +906,7 @@ function pt(e, n, a, i) {
906
906
  for (const r of o.fields) {
907
907
  if (r.required !== !0 || !cn(r, a)) continue;
908
908
  const l = n(r.key);
909
- l && $e(l) || s.push({
909
+ l && Ve(l) || s.push({
910
910
  key: r.key,
911
911
  sectionKey: o.key,
912
912
  label: he(r, i)
@@ -1101,7 +1101,7 @@ function bs({
1101
1101
  annotations: i,
1102
1102
  onAnnotationSelect: s,
1103
1103
  label: a("anamnesis.grid.trendLabel", {
1104
- parameter: Be(n, a)
1104
+ parameter: Ke(n, a)
1105
1105
  })
1106
1106
  }
1107
1107
  );
@@ -1128,7 +1128,7 @@ function yt({
1128
1128
  return c ? /* @__PURE__ */ d(_.Row, { children: [
1129
1129
  /* @__PURE__ */ t(_.Term, { children: he(l, i) }),
1130
1130
  /* @__PURE__ */ t(_.Detail, { children: /* @__PURE__ */ d("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1131
- /* @__PURE__ */ t("span", { children: On(c.value, l, i) }),
1131
+ /* @__PURE__ */ t("span", { children: zn(c.value, l, i) }),
1132
1132
  c.origin === "patient" ? /* @__PURE__ */ t(ft, { t: i }) : null
1133
1133
  ] }) })
1134
1134
  ] }, l.key) : null;
@@ -1265,10 +1265,10 @@ function _a(e, n = []) {
1265
1265
  const hn = "baseline";
1266
1266
  function xt(e) {
1267
1267
  const n = e.some(
1268
- (a) => qe(a.dateIso) && !Je(a.dateIso)
1268
+ (a) => Be(a.dateIso) && !Je(a.dateIso)
1269
1269
  );
1270
1270
  return (a) => {
1271
- if (!qe(a)) return Number.POSITIVE_INFINITY;
1271
+ if (!Be(a)) return Number.POSITIVE_INFINITY;
1272
1272
  if (!n) return new Date(a).getTime();
1273
1273
  const [i, s, o] = a.slice(0, 10).split("-").map(Number);
1274
1274
  return i && s && o ? Date.UTC(i, s - 1, o) : Number.POSITIVE_INFINITY;
@@ -1306,7 +1306,7 @@ function Ma(e) {
1306
1306
 
1307
1307
  `) : void 0;
1308
1308
  }
1309
- function Oa(e) {
1309
+ function za(e) {
1310
1310
  return e.find((n) => n !== void 0);
1311
1311
  }
1312
1312
  function Kn(e) {
@@ -1342,14 +1342,14 @@ function Ss(e, { keepId: n } = {}) {
1342
1342
  // Absent stays absent: "not measured" must not become "zero".
1343
1343
  dietaryIntake: l.length > 0 ? Pa(l) : void 0,
1344
1344
  pathologyCodes: c,
1345
- oncological: Oa(o.map((m) => m.oncological)),
1345
+ oncological: za(o.map((m) => m.oncological)),
1346
1346
  therapy: u,
1347
1347
  fmdCycles: o.flatMap((m) => m.fmdCycles),
1348
1348
  nutritionalProposal: Ma(
1349
1349
  o.map((m) => m.nutritionalProposal)
1350
1350
  ),
1351
1351
  clinicalNotes: Ma(o.map((m) => m.clinicalNotes)),
1352
- annualProgramme: Oa(
1352
+ annualProgramme: za(
1353
1353
  o.map((m) => m.annualProgramme)
1354
1354
  )
1355
1355
  }, f = e.filter((m) => !a(m));
@@ -1364,7 +1364,7 @@ const kt = {
1364
1364
  }, wt = "neutral";
1365
1365
  function Es(e, n) {
1366
1366
  const a = n.length - 1;
1367
- if (a < 1 || !qe(e.dateIso)) return null;
1367
+ if (a < 1 || !Be(e.dateIso)) return null;
1368
1368
  const i = !Je(e.dateIso) || n.some((l) => !Je(l.dateIso)), s = (l) => {
1369
1369
  if (!i) return new Date(l).getTime();
1370
1370
  const [c, u, h] = l.slice(0, 10).split("-").map(Number);
@@ -1468,7 +1468,7 @@ const Ls = [
1468
1468
  "clinicalNotes",
1469
1469
  "nutritionalProposal"
1470
1470
  ];
1471
- function zn(e) {
1471
+ function On(e) {
1472
1472
  return Ls.flatMap((n) => {
1473
1473
  var i;
1474
1474
  const a = (i = e[n]) == null ? void 0 : i.trim();
@@ -1476,13 +1476,13 @@ function zn(e) {
1476
1476
  });
1477
1477
  }
1478
1478
  function Tt(e) {
1479
- return zn(e).length > 0;
1479
+ return On(e).length > 0;
1480
1480
  }
1481
1481
  function Rs({
1482
1482
  visit: e,
1483
1483
  t: n
1484
1484
  }) {
1485
- return /* @__PURE__ */ t(_, { layout: "stacked", divider: "between", children: zn(e).map((a) => /* @__PURE__ */ d(_.Row, { children: [
1485
+ return /* @__PURE__ */ t(_, { layout: "stacked", divider: "between", children: On(e).map((a) => /* @__PURE__ */ d(_.Row, { children: [
1486
1486
  /* @__PURE__ */ t(_.Term, { children: n(`anamnesis.field.${a.field}.label`) }),
1487
1487
  /* @__PURE__ */ t(_.Detail, { children: /* @__PURE__ */ t("span", { className: "ds:block ds:break-words ds:whitespace-pre-line", children: a.text }) })
1488
1488
  ] }, a.field)) });
@@ -1494,7 +1494,7 @@ function _s({
1494
1494
  defaultOpen: a = !1,
1495
1495
  onOpenNote: i
1496
1496
  }) {
1497
- if (zn(e).length === 0) return null;
1497
+ if (On(e).length === 0) return null;
1498
1498
  const o = n(`anamnesis.visitType.${e.visitType}`), r = fe(e.dateIso, n), l = n(
1499
1499
  i ? "anamnesis.visitNote.openInPanel" : "anamnesis.visitNote.trigger",
1500
1500
  { visitType: o, date: r }
@@ -1563,7 +1563,7 @@ function _s({
1563
1563
  ] });
1564
1564
  }
1565
1565
  const Ct = "ds:min-w-[11rem]", ga = "ds:min-w-[8rem]", St = "ds:w-[40%] ds:min-w-[14rem]", Ps = "type-label ds:sticky ds:start-0 ds:top-0 ds:z-[3] ds:bg-[color:var(--card)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)] ds:text-start ds:shadow-[var(--shadow-chrome-end)]", Et = "ds:sticky ds:top-0 ds:z-[2] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)] ds:text-start ds:shadow-[var(--shadow-chrome-down)]", Ms = "type-label ds:sticky ds:end-0 ds:top-0 ds:z-[3] ds:bg-[color:var(--card)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)] ds:text-start ds:shadow-[var(--shadow-chrome-start)]", Un = "ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:align-top";
1566
- function Os({
1566
+ function zs({
1567
1567
  column: e,
1568
1568
  t: n,
1569
1569
  emphasised: a = !1,
@@ -1657,7 +1657,7 @@ function Os({
1657
1657
  ] })
1658
1658
  ] }) });
1659
1659
  }
1660
- function zs({
1660
+ function Os({
1661
1661
  captionId: e,
1662
1662
  caption: n,
1663
1663
  identityLabel: a,
@@ -1807,14 +1807,14 @@ function Ks({
1807
1807
  caption: v
1808
1808
  }) {
1809
1809
  var k;
1810
- const T = on(), g = Fe(a), y = dt(e, n), C = e.visits, L = s ?? ((k = C[C.length - 1]) == null ? void 0 : k.id), S = u ?? Dt(C), O = [];
1810
+ const T = on(), g = Fe(a), y = dt(e, n), C = e.visits, L = s ?? ((k = C[C.length - 1]) == null ? void 0 : k.id), S = u ?? Dt(C), z = [];
1811
1811
  let p = null;
1812
1812
  if (y.forEach((E) => {
1813
- x && E.def.group !== p && (p = E.def.group, O.push({
1813
+ x && E.def.group !== p && (p = E.def.group, z.push({
1814
1814
  key: `group-${E.def.group}`,
1815
1815
  banner: a(`anamnesis.group.${E.def.group}`)
1816
1816
  }));
1817
- const P = Bs(E.def.referenceRange, a, g), z = S.map((I, K) => {
1817
+ const P = Bs(E.def.referenceRange, a, g), O = S.map((I, K) => {
1818
1818
  const { visit: W, index: V } = I, R = E.cells[V] ?? Vs, H = W.id === L && !Kn(W), Y = h == null || h.has(E.def.key), J = i && H && Y && !E.def.computed, me = !qs(S, K);
1819
1819
  return /* @__PURE__ */ t(
1820
1820
  "td",
@@ -1832,7 +1832,7 @@ function Ks({
1832
1832
  value: R.value,
1833
1833
  mode: (E.def.precision ?? 0) > 0 ? "decimal" : "integer",
1834
1834
  "aria-label": a("anamnesis.grid.editCell", {
1835
- parameter: Be(E.def, a)
1835
+ parameter: Ke(E.def, a)
1836
1836
  }),
1837
1837
  onChange: (ge) => o == null ? void 0 : o(W, E.def, ge)
1838
1838
  }
@@ -1846,7 +1846,7 @@ function Ks({
1846
1846
  I.key
1847
1847
  );
1848
1848
  });
1849
- O.push({
1849
+ z.push({
1850
1850
  key: E.def.key,
1851
1851
  // Sticky parameter column (inline-start). The shell splices the trend
1852
1852
  // in after the first value cell — the order is not decided here.
@@ -1856,7 +1856,7 @@ function Ks({
1856
1856
  scope: "row",
1857
1857
  className: `${Ct} ds:sticky ds:start-0 ds:z-[1] ds:bg-[color:var(--card)] ds:text-start ds:shadow-[var(--shadow-chrome-end)] ${Un}`,
1858
1858
  children: /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
1859
- /* @__PURE__ */ t("span", { className: "type-label ds:text-[color:var(--foreground)]", children: Be(E.def, a) }),
1859
+ /* @__PURE__ */ t("span", { className: "type-label ds:text-[color:var(--foreground)]", children: Ke(E.def, a) }),
1860
1860
  /* @__PURE__ */ d("span", { className: "type-meta ds:text-[color:var(--muted-foreground)]", children: [
1861
1861
  E.def.unit,
1862
1862
  P ? /* @__PURE__ */ d(Ee, { children: [
@@ -1871,7 +1871,7 @@ function Ks({
1871
1871
  ] })
1872
1872
  }
1873
1873
  ),
1874
- cells: z,
1874
+ cells: O,
1875
1875
  trend: /* @__PURE__ */ t("td", { className: `${St} ${Un}`, children: /* @__PURE__ */ t(
1876
1876
  bs,
1877
1877
  {
@@ -1901,7 +1901,7 @@ function Ks({
1901
1901
  }
1902
1902
  );
1903
1903
  const A = S.map((E) => /* @__PURE__ */ t(
1904
- Os,
1904
+ zs,
1905
1905
  {
1906
1906
  column: E,
1907
1907
  t: a,
@@ -1913,7 +1913,7 @@ function Ks({
1913
1913
  E.key
1914
1914
  ));
1915
1915
  return /* @__PURE__ */ t(
1916
- zs,
1916
+ Os,
1917
1917
  {
1918
1918
  captionId: T,
1919
1919
  caption: v ?? a("anamnesis.grid.caption"),
@@ -1921,7 +1921,7 @@ function Ks({
1921
1921
  trendLabel: a("anamnesis.grid.trend"),
1922
1922
  trendTestId: "anamnesis-grid-trend",
1923
1923
  visitHeaders: A,
1924
- rows: O,
1924
+ rows: z,
1925
1925
  framed: r
1926
1926
  }
1927
1927
  );
@@ -2090,11 +2090,11 @@ function Ys({
2090
2090
  ), S = q(
2091
2091
  () => C ? [hn] : [],
2092
2092
  [C]
2093
- ), O = on(), p = on(), [A, k] = M(""), [E, P] = M(
2093
+ ), z = on(), p = on(), [A, k] = M(""), [E, P] = M(
2094
2094
  () => (f ? [...f] : y.map((B) => B.id)).filter(
2095
2095
  (B) => B !== hn
2096
2096
  )
2097
- ), z = $s(y), I = q(() => {
2097
+ ), O = $s(y), I = q(() => {
2098
2098
  const B = E.filter(
2099
2099
  (G) => y.some((ve) => ve.id === G)
2100
2100
  );
@@ -2150,7 +2150,7 @@ function Ys({
2150
2150
  }, [U, D]), ue = q(
2151
2151
  () => Ds(D, de, n),
2152
2152
  [D, de, n]
2153
- ), Ke = (B) => le(
2153
+ ), Ue = (B) => le(
2154
2154
  (G) => G.includes(B) ? G.filter((ve) => ve !== B) : [...G, B]
2155
2155
  ), _e = q(
2156
2156
  () => x ? (B) => x({ kind: "event", eventId: B }) : void 0,
@@ -2160,7 +2160,7 @@ function Ys({
2160
2160
  {
2161
2161
  "data-testid": "anamnesis-evolution-block",
2162
2162
  role: c ? "region" : void 0,
2163
- "aria-labelledby": c ? O : void 0,
2163
+ "aria-labelledby": c ? z : void 0,
2164
2164
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
2165
2165
  children: [
2166
2166
  c ? /* @__PURE__ */ d(
@@ -2172,7 +2172,7 @@ function Ys({
2172
2172
  /* @__PURE__ */ t(
2173
2173
  "h3",
2174
2174
  {
2175
- id: O,
2175
+ id: z,
2176
2176
  className: "type-title-item ds:m-0 ds:text-[color:var(--foreground)]",
2177
2177
  children: c.label
2178
2178
  }
@@ -2181,13 +2181,13 @@ function Ys({
2181
2181
  ]
2182
2182
  }
2183
2183
  ) : null,
2184
- z || v != null ? /* @__PURE__ */ d(
2184
+ O || v != null ? /* @__PURE__ */ d(
2185
2185
  "div",
2186
2186
  {
2187
2187
  "data-testid": "anamnesis-evolution-toolbar",
2188
2188
  className: "ds:flex ds:flex-wrap ds:items-start ds:gap-[var(--spacing-md)]",
2189
2189
  children: [
2190
- z ? /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
2190
+ O ? /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
2191
2191
  /* @__PURE__ */ d(Z.Root, { modal: !1, children: [
2192
2192
  /* @__PURE__ */ t(Z.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
2193
2193
  te,
@@ -2256,7 +2256,7 @@ function Ys({
2256
2256
  {
2257
2257
  marks: D,
2258
2258
  activeIds: de,
2259
- onToggle: Ke,
2259
+ onToggle: Ue,
2260
2260
  t: n
2261
2261
  }
2262
2262
  ),
@@ -2503,10 +2503,10 @@ function Ft(e, n) {
2503
2503
  function eo(e) {
2504
2504
  return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
2505
2505
  }
2506
- function Ve(e) {
2506
+ function qe(e) {
2507
2507
  if (!e) return null;
2508
2508
  const n = e.slice(0, 10);
2509
- return qe(n) ? n : null;
2509
+ return Be(n) ? n : null;
2510
2510
  }
2511
2511
  function Dn(e, n, a, i, s) {
2512
2512
  const o = i ? eo(`${n.patient.lastName} ${n.patient.firstName}`) : "";
@@ -2591,7 +2591,7 @@ function ao(e) {
2591
2591
  y && x.push({
2592
2592
  cells: [
2593
2593
  he(g, i),
2594
- oe(On(y.value, g, i)),
2594
+ oe(zn(y.value, g, i)),
2595
2595
  i(`anamnesis.export.source.${y.origin}`)
2596
2596
  ]
2597
2597
  });
@@ -2610,7 +2610,7 @@ function ao(e) {
2610
2610
  emptyText: i("anamnesis.summary.noAnswers")
2611
2611
  });
2612
2612
  } else f || h.push(i("anamnesis.compile.noIntake"));
2613
- const m = Ve(f == null ? void 0 : f.submittedAtIso) ?? Ve((b = Pn(n)) == null ? void 0 : b.dateIso) ?? Ve(o);
2613
+ const m = qe(f == null ? void 0 : f.submittedAtIso) ?? qe((b = Pn(n)) == null ? void 0 : b.dateIso) ?? qe(o);
2614
2614
  return Ln(
2615
2615
  {
2616
2616
  tab: "summary",
@@ -2639,7 +2639,7 @@ function Hn(e, n, a, i, s, o, r) {
2639
2639
  if (!ae(s, It(h))) continue;
2640
2640
  c = !0;
2641
2641
  const f = Le(i, h), m = [
2642
- Be(h, o),
2642
+ Ke(h, o),
2643
2643
  f,
2644
2644
  h.unit ?? null
2645
2645
  ];
@@ -2681,7 +2681,7 @@ function to(e) {
2681
2681
  fileStem: Dn(
2682
2682
  "compile",
2683
2683
  n,
2684
- Ve(o),
2684
+ qe(o),
2685
2685
  !!c,
2686
2686
  a
2687
2687
  ),
@@ -2885,7 +2885,7 @@ function to(e) {
2885
2885
  fileStem: Dn(
2886
2886
  "compile",
2887
2887
  n,
2888
- Ve(u.dateIso) ?? Ve(o),
2888
+ qe(u.dateIso) ?? qe(o),
2889
2889
  !!c,
2890
2890
  a
2891
2891
  ),
@@ -2955,13 +2955,13 @@ function oo(e) {
2955
2955
  numeric: !0
2956
2956
  },
2957
2957
  { key: "outOfRange", header: i("anamnesis.export.column.outOfRange") }
2958
- ], O = [];
2958
+ ], z = [];
2959
2959
  let p = null;
2960
2960
  for (const A of y)
2961
- ae(l, It(A.def)) && (A.def.group !== p && (p = A.def.group, O.push(Lt(i(`anamnesis.group.${A.def.group}`)))), O.push({
2961
+ ae(l, It(A.def)) && (A.def.group !== p && (p = A.def.group, z.push(Lt(i(`anamnesis.group.${A.def.group}`)))), z.push({
2962
2962
  precision: A.def.precision,
2963
2963
  cells: [
2964
- Be(A.def, i),
2964
+ Ke(A.def, i),
2965
2965
  A.def.unit ?? null,
2966
2966
  Rt(A.def, i),
2967
2967
  ...x.map((k) => {
@@ -2977,11 +2977,11 @@ function oo(e) {
2977
2977
  id: "matrix",
2978
2978
  title: i("anamnesis.section.evolution"),
2979
2979
  columns: S,
2980
- rows: O,
2980
+ rows: z,
2981
2981
  emptyText: i("anamnesis.export.none")
2982
2982
  });
2983
2983
  } else x.length === 0 && f.push(i("anamnesis.export.none"));
2984
- const v = Ve((T = x[x.length - 1]) == null ? void 0 : T.visit.dateIso) ?? Ve(o);
2984
+ const v = qe((T = x[x.length - 1]) == null ? void 0 : T.visit.dateIso) ?? qe(o);
2985
2985
  return Ln(
2986
2986
  {
2987
2987
  tab: "evolution",
@@ -3018,7 +3018,7 @@ function lo(e, n) {
3018
3018
  defaultValue: e
3019
3019
  });
3020
3020
  }
3021
- function za(e, n) {
3021
+ function Oa(e, n) {
3022
3022
  return {
3023
3023
  included: e.tables.map((a) => a.title),
3024
3024
  excluded: e.withheld.map((a) => lo(a, n)).sort((a, i) => a.localeCompare(i, e.locale))
@@ -3045,28 +3045,28 @@ function ho(e, n, a) {
3045
3045
  const i = n == null ? String(e) : e.toFixed(n);
3046
3046
  return a.decimal === "," ? i.replace(".", ",") : i;
3047
3047
  }
3048
- function Me(e, n) {
3048
+ function ze(e, n) {
3049
3049
  const a = mo.test(e) ? `'${e}` : e;
3050
3050
  return a.includes(n.delimiter) || a.includes('"') || a.includes(`
3051
3051
  `) || a.includes("\r") || a !== a.trim() ? `"${a.replace(/"/g, '""')}"` : a;
3052
3052
  }
3053
3053
  function Va(e, n, a) {
3054
- return e == null ? "" : typeof e == "number" ? ho(e, a, n) : Me(e, n);
3054
+ return e == null ? "" : typeof e == "number" ? ho(e, a, n) : ze(e, n);
3055
3055
  }
3056
3056
  function Pt(e, n) {
3057
3057
  return e.precision ?? (n == null ? void 0 : n.precision);
3058
3058
  }
3059
3059
  function go(e, n = wa(e.locale)) {
3060
3060
  const a = [], i = (s) => a.push(s.join(n.delimiter));
3061
- i([Me(e.title, n)]);
3061
+ i([ze(e.title, n)]);
3062
3062
  for (const s of e.meta)
3063
3063
  i([
3064
- Me(s.label, n),
3065
- Me(s.value, n)
3064
+ ze(s.label, n),
3065
+ ze(s.value, n)
3066
3066
  ]);
3067
3067
  for (const s of e.tables) {
3068
- if (a.push(""), i([Me(s.title, n)]), i(s.columns.map((o) => Me(o.header, n))), s.rows.length === 0 && s.emptyText) {
3069
- i([Me(s.emptyText, n)]);
3068
+ if (a.push(""), i([ze(s.title, n)]), i(s.columns.map((o) => ze(o.header, n))), s.rows.length === 0 && s.emptyText) {
3069
+ i([ze(s.emptyText, n)]);
3070
3070
  continue;
3071
3071
  }
3072
3072
  for (const o of s.rows) {
@@ -3087,7 +3087,7 @@ function go(e, n = wa(e.locale)) {
3087
3087
  }
3088
3088
  if (e.footnotes.length > 0) {
3089
3089
  a.push("");
3090
- for (const s of e.footnotes) i([Me(s, n)]);
3090
+ for (const s of e.footnotes) i([ze(s, n)]);
3091
3091
  }
3092
3092
  return a.join(n.eol) + n.eol;
3093
3093
  }
@@ -3320,7 +3320,7 @@ function Fo(e, n, a) {
3320
3320
  )
3321
3321
  );
3322
3322
  }
3323
- async function Ot(e, n = {}) {
3323
+ async function zt(e, n = {}) {
3324
3324
  var x;
3325
3325
  const [{ jsPDF: a }, { default: i }] = await Promise.all([
3326
3326
  import("./jspdf.es.min-DaapWjR1.js").then((v) => v.j),
@@ -3406,14 +3406,14 @@ async function Ot(e, n = {}) {
3406
3406
  }
3407
3407
  async function _o(e, n = {}) {
3408
3408
  return Ta(
3409
- await Ot(e, n),
3409
+ await zt(e, n),
3410
3410
  Na(e, "pdf")
3411
3411
  );
3412
3412
  }
3413
3413
  async function Po(e, n, a = {}) {
3414
3414
  if (!n || typeof URL > "u" || typeof URL.createObjectURL != "function")
3415
3415
  return null;
3416
- const i = await Ot(e, { ...a, autoPrint: !0 }), s = URL.createObjectURL(i);
3416
+ const i = await zt(e, { ...a, autoPrint: !0 }), s = URL.createObjectURL(i);
3417
3417
  return n.setAttribute("src", s), s;
3418
3418
  }
3419
3419
  const sa = ["clinician", "patient"];
@@ -3427,10 +3427,10 @@ function Ca({
3427
3427
  defaultShareOpen: r = !1,
3428
3428
  defaultAudience: l = "clinician"
3429
3429
  }) {
3430
- const [c, u] = M(l), [h, f] = M(!1), [m, b] = M(o), [x, v] = M(r), [T, g] = M(l), [y, C] = M({ text: "", seq: 0 }), L = De(null), S = De(null), O = De(null), p = De(!1), A = on();
3430
+ const [c, u] = M(l), [h, f] = M(!1), [m, b] = M(o), [x, v] = M(r), [T, g] = M(l), [y, C] = M({ text: "", seq: 0 }), L = De(null), S = De(null), z = De(null), p = De(!1), A = on();
3431
3431
  vn(
3432
3432
  () => () => {
3433
- O.current && URL.revokeObjectURL(O.current);
3433
+ z.current && URL.revokeObjectURL(z.current);
3434
3434
  },
3435
3435
  []
3436
3436
  );
@@ -3444,18 +3444,18 @@ function Ca({
3444
3444
  scope: h ? "all" : "selected"
3445
3445
  }),
3446
3446
  [e, n, a, i, s, h]
3447
- ), E = a(`anamnesis.export.tab.${e}`), P = a("anamnesis.export.control.audienceBadge"), z = q(
3448
- () => m ? za(k("patient"), a).excluded : [],
3447
+ ), E = a(`anamnesis.export.tab.${e}`), P = a("anamnesis.export.control.audienceBadge"), O = q(
3448
+ () => m ? Oa(k("patient"), a).excluded : [],
3449
3449
  [m, k, a]
3450
3450
  ), I = {
3451
- clinician: z.length > 0 ? a("anamnesis.export.control.holds", {
3452
- list: z.join(a("anamnesis.export.listSeparator"))
3451
+ clinician: O.length > 0 ? a("anamnesis.export.control.holds", {
3452
+ list: O.join(a("anamnesis.export.listSeparator"))
3453
3453
  }) : a("anamnesis.export.control.holdsNone"),
3454
- patient: z.length > 0 ? a("anamnesis.export.control.excludes", {
3455
- list: z.join(a("anamnesis.export.listSeparator"))
3454
+ patient: O.length > 0 ? a("anamnesis.export.control.excludes", {
3455
+ list: O.join(a("anamnesis.export.listSeparator"))
3456
3456
  }) : a("anamnesis.export.control.excludesNone")
3457
3457
  }, K = q(
3458
- () => x ? za(k(T), a) : { included: [], excluded: [] },
3458
+ () => x ? Oa(k(T), a) : { included: [], excluded: [] },
3459
3459
  [x, k, T, a]
3460
3460
  ), W = (U) => C((le) => ({ text: U, seq: le.seq + 1 })), V = (U, le) => {
3461
3461
  if (p.current) return;
@@ -3476,7 +3476,7 @@ function Ca({
3476
3476
  W(a("anamnesis.export.control.failed"));
3477
3477
  return;
3478
3478
  }
3479
- O.current && URL.revokeObjectURL(O.current), O.current = U, W(a("anamnesis.export.control.printing"));
3479
+ z.current && URL.revokeObjectURL(z.current), z.current = U, W(a("anamnesis.export.control.printing"));
3480
3480
  }).catch(() => W(a("anamnesis.export.control.failed"))).finally(() => {
3481
3481
  p.current = !1;
3482
3482
  }));
@@ -3748,11 +3748,11 @@ function Ua({
3748
3748
  }
3749
3749
  );
3750
3750
  }
3751
- function zt(e, n) {
3751
+ function Ot(e, n) {
3752
3752
  if (!e.highlight || !n) return !1;
3753
3753
  switch (e.highlight) {
3754
3754
  case "always":
3755
- return $e(n);
3755
+ return Ve(n);
3756
3756
  case "whenYes":
3757
3757
  return n.kind === "yesNo" && n.present === "yes";
3758
3758
  case "whenNo":
@@ -3761,13 +3761,13 @@ function zt(e, n) {
3761
3761
  return !1;
3762
3762
  }
3763
3763
  }
3764
- function Oo(e) {
3764
+ function zo(e) {
3765
3765
  if (!e) return;
3766
3766
  const [n, a] = e.split(":").map((i) => Number.parseInt(i, 10));
3767
3767
  if (!(Number.isNaN(n) || Number.isNaN(a)))
3768
3768
  return { hours: n, minutes: a };
3769
3769
  }
3770
- function zo(e) {
3770
+ function Oo(e) {
3771
3771
  const n = (a) => String(a).padStart(2, "0");
3772
3772
  return `${n(e.hours)}:${n(e.minutes)}`;
3773
3773
  }
@@ -3784,8 +3784,8 @@ function $o(e, n) {
3784
3784
  return !1;
3785
3785
  }
3786
3786
  }
3787
- const Vo = "ds:sr-only", qo = "ds:aspect-square ds:justify-center ds:px-0", Bo = "ds:mt-[var(--spacing-2xs)]", Ko = /* @__PURE__ */ new Set(["weightSelf", "waterPerDay"]), Ue = "ds:w-full ds:max-w-[32rem]", Uo = "ds:w-full ds:max-w-[60rem]";
3788
- function Ho(e) {
3787
+ const Vo = "ds:sr-only", qo = "ds:aspect-square ds:justify-center ds:px-0", Bo = "ds:mt-[var(--spacing-2xs)]", Ko = /* @__PURE__ */ new Set(["weightSelf", "waterPerDay"]), Me = "ds:w-full ds:max-w-[44rem]";
3788
+ function Uo(e) {
3789
3789
  return e.max !== void 0 && e.max >= 1e4 ? "md" : "sm";
3790
3790
  }
3791
3791
  function $t({
@@ -3798,7 +3798,7 @@ function $t({
3798
3798
  className: r,
3799
3799
  t: l
3800
3800
  }) {
3801
- const c = e.type === "number" ? he(e, l) : os(e, l), u = mt(e, l), h = i && s === "patient", f = zt(e, n), m = l("anamnesis.field.highlighted"), b = f ? /* @__PURE__ */ t("span", { "data-testid": `anamnesis-field-${e.key}-highlight`, children: /* @__PURE__ */ t(
3801
+ const c = e.type === "number" ? he(e, l) : os(e, l), u = mt(e, l), h = i && s === "patient", f = Ot(e, n), m = l("anamnesis.field.highlighted"), b = f ? /* @__PURE__ */ t("span", { "data-testid": `anamnesis-field-${e.key}-highlight`, children: /* @__PURE__ */ t(
3802
3802
  X,
3803
3803
  {
3804
3804
  variant: "accentSoft",
@@ -3822,7 +3822,7 @@ function $t({
3822
3822
  children: /* @__PURE__ */ t(
3823
3823
  ne,
3824
3824
  {
3825
- className: Ue,
3825
+ className: Me,
3826
3826
  disabled: o,
3827
3827
  value: T,
3828
3828
  onChange: (g) => a({ kind: "text", text: g.target.value })
@@ -3848,7 +3848,7 @@ function $t({
3848
3848
  value: T,
3849
3849
  autoResize: !0,
3850
3850
  minRows: 2,
3851
- className: Uo,
3851
+ className: Me,
3852
3852
  onChange: (g) => a({ kind: "text", text: g.target.value })
3853
3853
  }
3854
3854
  )
@@ -3873,7 +3873,7 @@ function $t({
3873
3873
  min: 0,
3874
3874
  variant: "plain",
3875
3875
  unit: e.unit,
3876
- inline: Ho(e),
3876
+ inline: Uo(e),
3877
3877
  mode: e.decimal || Ko.has(e.key) ? "decimal" : "integer",
3878
3878
  onChange: (g) => a({ kind: "number", value: g })
3879
3879
  }
@@ -3914,7 +3914,7 @@ function $t({
3914
3914
  e.detail ? /* @__PURE__ */ t($, { label: l(`anamnesis.field.${e.key}.detailLabel`), children: /* @__PURE__ */ t(
3915
3915
  ne,
3916
3916
  {
3917
- className: Ue,
3917
+ className: Me,
3918
3918
  disabled: o,
3919
3919
  value: g,
3920
3920
  onChange: (y) => a({
@@ -3976,7 +3976,7 @@ function $t({
3976
3976
  $o(e, n) ? /* @__PURE__ */ t($, { label: l("anamnesis.common.details"), children: /* @__PURE__ */ t(
3977
3977
  ne,
3978
3978
  {
3979
- className: Ue,
3979
+ className: Me,
3980
3980
  disabled: o,
3981
3981
  value: g,
3982
3982
  onChange: (y) => a({
@@ -3992,7 +3992,7 @@ function $t({
3992
3992
  /* @__PURE__ */ t("div", { "aria-hidden": "true", className: "ds:opacity-50", children: /* @__PURE__ */ t($, { label: l("anamnesis.common.details"), children: /* @__PURE__ */ t(
3993
3993
  ne,
3994
3994
  {
3995
- className: Ue,
3995
+ className: Me,
3996
3996
  disabled: !0,
3997
3997
  value: "",
3998
3998
  placeholder: l("anamnesis.common.detailsPending")
@@ -4020,9 +4020,9 @@ function $t({
4020
4020
  labelEnd: x,
4021
4021
  description: u,
4022
4022
  children: /* @__PURE__ */ t(
4023
- ze,
4023
+ $e,
4024
4024
  {
4025
- className: Ue,
4025
+ className: Me,
4026
4026
  disabled: o,
4027
4027
  options: y,
4028
4028
  value: T,
@@ -4039,7 +4039,7 @@ function $t({
4039
4039
  e.detail && T ? /* @__PURE__ */ t($, { label: l("anamnesis.common.details"), children: /* @__PURE__ */ t(
4040
4040
  ne,
4041
4041
  {
4042
- className: Ue,
4042
+ className: Me,
4043
4043
  disabled: o,
4044
4044
  value: g,
4045
4045
  onChange: (C) => a({
@@ -4096,10 +4096,10 @@ function $t({
4096
4096
  yi,
4097
4097
  {
4098
4098
  disabled: o,
4099
- value: Oo(T),
4099
+ value: zo(T),
4100
4100
  onChange: (y) => a({
4101
4101
  kind: "meal",
4102
- time: zo(y),
4102
+ time: Oo(y),
4103
4103
  description: g
4104
4104
  })
4105
4105
  }
@@ -4107,7 +4107,7 @@ function $t({
4107
4107
  /* @__PURE__ */ t("div", { className: "ds:grow", children: /* @__PURE__ */ t($, { label: l("anamnesis.common.whatEaten"), children: /* @__PURE__ */ t(
4108
4108
  ne,
4109
4109
  {
4110
- className: Ue,
4110
+ className: Me,
4111
4111
  disabled: o,
4112
4112
  value: g,
4113
4113
  onChange: (y) => a({
@@ -4135,7 +4135,7 @@ function $t({
4135
4135
  function Vt(e) {
4136
4136
  return Ne(e).filter((n) => n.goal === !0);
4137
4137
  }
4138
- const Go = {
4138
+ const Ho = {
4139
4139
  // ±2% of goal weight (≈1.2 kg at 62 kg) is the day-to-day hydration and
4140
4140
  // gut-content swing — indistinguishable from being at target. 10% is the
4141
4141
  // clinically meaningful unit of weight change (the 5–10% loss guidelines are
@@ -4168,43 +4168,43 @@ const Go = {
4168
4168
  approaching: 0.1,
4169
4169
  sided: "atLeast"
4170
4170
  }
4171
- }, jo = {
4171
+ }, Go = {
4172
4172
  kind: "relative",
4173
4173
  onTarget: 0.05,
4174
4174
  approaching: 0.15,
4175
4175
  sided: "both"
4176
4176
  };
4177
- function Wo(e) {
4178
- return Go[e] ?? jo;
4177
+ function jo(e) {
4178
+ return Ho[e] ?? Go;
4179
4179
  }
4180
4180
  function Ha(e, n, a) {
4181
4181
  return e.kind === "absolute" ? n : Math.abs(a) * n;
4182
4182
  }
4183
- function Qo(e, n, a) {
4183
+ function Wo(e, n, a) {
4184
4184
  if (e == null || !Number.isFinite(e) || n == null || !Number.isFinite(n)) return null;
4185
- const i = Wo(a), s = e - n;
4185
+ const i = jo(a), s = e - n;
4186
4186
  if (i.sided === "atLeast" && s >= 0 || i.sided === "atMost" && s <= 0) return "onTarget";
4187
4187
  const o = Math.abs(s);
4188
4188
  return o <= Ha(i, i.onTarget, n) ? "onTarget" : o <= Ha(i, i.approaching, n) ? "approaching" : "offTarget";
4189
4189
  }
4190
- const Yo = {
4190
+ const Qo = {
4191
4191
  weight: { min: 20, max: 400, step: 0.1 },
4192
4192
  bmi: { min: 10, max: 60, step: 0.1 },
4193
4193
  waist: { min: 30, max: 250, step: 1 },
4194
4194
  energy: { min: 500, max: 6e3, step: 50 },
4195
4195
  protein: { min: 10, max: 400, step: 5 }
4196
4196
  };
4197
- function Xo(e) {
4198
- const n = Yo[e.key];
4197
+ function Yo(e) {
4198
+ const n = Qo[e.key];
4199
4199
  return n || { min: 0, max: 1e4, step: 10 ** -(e.precision ?? 0) };
4200
4200
  }
4201
- function Jo(e, n) {
4201
+ function Xo(e, n) {
4202
4202
  return e == null ? !0 : Number.isFinite(e) ? e >= n.min && e <= n.max : !1;
4203
4203
  }
4204
- function Zo(e, n) {
4204
+ function Jo(e, n) {
4205
4205
  return e == null || n == null, e === n;
4206
4206
  }
4207
- function er(e, n) {
4207
+ function Zo(e, n) {
4208
4208
  return n.unit ? `${e.min}–${e.max} ${n.unit}` : `${e.min}–${e.max}`;
4209
4209
  }
4210
4210
  function qt({
@@ -4215,7 +4215,7 @@ function qt({
4215
4215
  t: s,
4216
4216
  onCommit: o
4217
4217
  }) {
4218
- const [r, l] = M(!1), [c, u] = M(a), h = Xo(e), f = Jo(c, h), m = !Zo(c, a), b = Se(e, s), x = er(h, e), v = (g) => {
4218
+ const [r, l] = M(!1), [c, u] = M(a), h = Yo(e), f = Xo(c, h), m = !Jo(c, a), b = Se(e, s), x = Zo(h, e), v = (g) => {
4219
4219
  g && u(a), l(g);
4220
4220
  }, T = (g) => {
4221
4221
  o(g), l(!1);
@@ -4293,12 +4293,12 @@ function qt({
4293
4293
  )
4294
4294
  ] });
4295
4295
  }
4296
- const nr = {
4296
+ const er = {
4297
4297
  onTarget: "success",
4298
4298
  approaching: "warning",
4299
4299
  offTarget: "error"
4300
4300
  };
4301
- function ar({
4301
+ function nr({
4302
4302
  variant: e = "outlined",
4303
4303
  label: n,
4304
4304
  target: a,
@@ -4327,7 +4327,7 @@ function ar({
4327
4327
  // `mt-auto` pins it to the tile's foot, so a row of tiles stretched to
4328
4328
  // the tallest one lines its chips up instead of leaving a hole.
4329
4329
  /* @__PURE__ */ d("div", { className: "ds:mt-auto ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
4330
- s ? /* @__PURE__ */ t(X, { variant: nr[s], size: "sm", withDot: !0, children: o }) : null,
4330
+ s ? /* @__PURE__ */ t(X, { variant: er[s], size: "sm", withDot: !0, children: o }) : null,
4331
4331
  r
4332
4332
  ] })
4333
4333
  ) : null
@@ -4339,16 +4339,16 @@ function jn(e, n, a) {
4339
4339
  const i = Re(e, n.precision, a);
4340
4340
  return n.unit ? `${i} ${n.unit}` : i;
4341
4341
  }
4342
- function tr({ def: e, visits: n, target: a, t: i, onTargetChange: s }) {
4342
+ function ar({ def: e, visits: n, target: a, t: i, onTargetChange: s }) {
4343
4343
  var m;
4344
- const { t: o } = xi(), r = Fe(i), l = ((m = Yi(n, e)) == null ? void 0 : m.value) ?? null, c = Qo(l, a, e.key), u = i("anamnesis.targets.tileLabel", {
4345
- name: Be(e, i)
4344
+ const { t: o } = xi(), r = Fe(i), l = ((m = Yi(n, e)) == null ? void 0 : m.value) ?? null, c = Wo(l, a, e.key), u = i("anamnesis.targets.tileLabel", {
4345
+ name: Ke(e, i)
4346
4346
  }), h = e.computed && l != null, f = l == null ? i("anamnesis.targets.nowUnset") : h ? i("anamnesis.targets.nowBanded", {
4347
4347
  value: jn(l, e, r),
4348
4348
  band: o(`bmiCalculator.category.${wi(l)}`)
4349
4349
  }) : i("anamnesis.targets.now", { value: jn(l, e, r) });
4350
4350
  return /* @__PURE__ */ t(
4351
- ar,
4351
+ nr,
4352
4352
  {
4353
4353
  variant: "elevated",
4354
4354
  label: u,
@@ -4370,7 +4370,7 @@ function tr({ def: e, visits: n, target: a, t: i, onTargetChange: s }) {
4370
4370
  }
4371
4371
  );
4372
4372
  }
4373
- function ir(e) {
4373
+ function tr(e) {
4374
4374
  return e <= 1 ? "ds:grid-cols-1" : e === 2 ? "ds:grid-cols-2" : e === 3 ? "ds:grid-cols-2 ds:sm:grid-cols-3" : "ds:grid-cols-2 ds:sm:grid-cols-4";
4375
4375
  }
4376
4376
  function Bt({
@@ -4396,9 +4396,9 @@ function Bt({
4396
4396
  /* @__PURE__ */ t(
4397
4397
  "div",
4398
4398
  {
4399
- className: `ds:grid ds:gap-[var(--spacing-md)] ${ir(n.length)}`,
4399
+ className: `ds:grid ds:gap-[var(--spacing-md)] ${tr(n.length)}`,
4400
4400
  children: n.map((o) => /* @__PURE__ */ t(
4401
- tr,
4401
+ ar,
4402
4402
  {
4403
4403
  def: o,
4404
4404
  visits: e,
@@ -4529,7 +4529,7 @@ function be({
4529
4529
  }
4530
4530
  );
4531
4531
  }
4532
- function sr({
4532
+ function ir({
4533
4533
  record: e,
4534
4534
  t: n,
4535
4535
  embedded: a = !1,
@@ -4559,7 +4559,7 @@ function sr({
4559
4559
  }
4560
4560
  h == null || h(g);
4561
4561
  }, [g]);
4562
- const L = De(0), { patient: S, visits: O } = g, p = O[O.length - 1], A = O.length > 1 ? O[O.length - 2] : void 0, k = q(
4562
+ const L = De(0), { patient: S, visits: z } = g, p = z[z.length - 1], A = z.length > 1 ? z[z.length - 2] : void 0, k = q(
4563
4563
  () => new Map(g.targets.map((w) => [w.parameterKey, w.target])),
4564
4564
  [g.targets]
4565
4565
  ), E = q(
@@ -4568,14 +4568,14 @@ function sr({
4568
4568
  ), P = q(
4569
4569
  () => Ne(i, "dietary"),
4570
4570
  [i]
4571
- ), z = q(() => Ne(i, "lab"), [i]), I = q(() => Vt(i), [i]), K = q(
4571
+ ), O = q(() => Ne(i, "lab"), [i]), I = q(() => Vt(i), [i]), K = q(
4572
4572
  () => new Set(I.map((w) => w.key)),
4573
4573
  [I]
4574
4574
  ), W = q(
4575
- () => _a(p, z),
4576
- [p, z]
4575
+ () => _a(p, O),
4576
+ [p, O]
4577
4577
  ), [V, R] = M(() => {
4578
- const w = _a(p, z), N = {};
4578
+ const w = _a(p, O), N = {};
4579
4579
  for (const F of bt) N[F] = w[F].open;
4580
4580
  return N;
4581
4581
  }), H = Qe(
@@ -4584,7 +4584,7 @@ function sr({
4584
4584
  ), Y = q(
4585
4585
  () => je(i),
4586
4586
  [i]
4587
- ), J = q(() => ca(i), [i]), me = q(() => da(i), [i]), [ge, D] = M(b), [U, le] = M(!0), [de, ue] = ya(), { containerRef: Ke, requestJump: _e } = ht(), Te = Qe(
4587
+ ), J = q(() => ca(i), [i]), me = q(() => da(i), [i]), [ge, D] = M(b), [U, le] = M(!0), [de, ue] = ya(), { containerRef: Ue, requestJump: _e } = ht(), Te = Qe(
4588
4588
  (w) => {
4589
4589
  var N, F;
4590
4590
  return (F = (N = g.intake) == null ? void 0 : N.answers[w]) == null ? void 0 : F.value;
@@ -4701,7 +4701,7 @@ function sr({
4701
4701
  /* @__PURE__ */ d("p", { className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]", children: [
4702
4702
  Mn(g, n),
4703
4703
  " · ",
4704
- n("anamnesis.compile.visitCount", { visits: O.length })
4704
+ n("anamnesis.compile.visitCount", { visits: z.length })
4705
4705
  ] })
4706
4706
  ] }),
4707
4707
  l ? /* @__PURE__ */ t(
@@ -4716,7 +4716,7 @@ function sr({
4716
4716
  o ? null : /* @__PURE__ */ t(
4717
4717
  Bt,
4718
4718
  {
4719
- visits: O,
4719
+ visits: z,
4720
4720
  defs: I,
4721
4721
  targets: k,
4722
4722
  t: n,
@@ -4765,7 +4765,7 @@ function sr({
4765
4765
  /* @__PURE__ */ d(be, { titleKey: "anamnesis.section.visitMeta", t: n, children: [
4766
4766
  /* @__PURE__ */ d("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
4767
4767
  /* @__PURE__ */ t($, { label: n("anamnesis.field.visitType.label"), children: /* @__PURE__ */ t(
4768
- ze,
4768
+ $e,
4769
4769
  {
4770
4770
  options: [
4771
4771
  {
@@ -4785,7 +4785,7 @@ function sr({
4785
4785
  }
4786
4786
  ) }),
4787
4787
  /* @__PURE__ */ t($, { label: n("anamnesis.field.practitioner.label"), children: f && f.length > 0 ? /* @__PURE__ */ t(
4788
- ze,
4788
+ $e,
4789
4789
  {
4790
4790
  options: f,
4791
4791
  value: p.practitioner ?? "",
@@ -4841,7 +4841,7 @@ function sr({
4841
4841
  /* @__PURE__ */ t(
4842
4842
  "div",
4843
4843
  {
4844
- ref: Ke,
4844
+ ref: Ue,
4845
4845
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]",
4846
4846
  children: J.map((w) => {
4847
4847
  const N = w.fields.filter((F) => cn(F, S.sex)).filter((F) => ve.has(F.key));
@@ -5091,7 +5091,7 @@ function sr({
5091
5091
  Wn,
5092
5092
  {
5093
5093
  stripKeys: K,
5094
- defs: z,
5094
+ defs: O,
5095
5095
  visit: p,
5096
5096
  previous: A,
5097
5097
  targets: k,
@@ -5283,29 +5283,29 @@ function Ga({
5283
5283
  }) {
5284
5284
  return e ? /* @__PURE__ */ t("div", { className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-lg)]", children: n }) : /* @__PURE__ */ t("div", { className: "ds:min-h-[100dvh] ds:w-full ds:bg-[color:var(--app-shell-background)] ds:py-[var(--spacing-lg)]", children: /* @__PURE__ */ t("div", { className: "ds:mx-auto ds:flex ds:w-full ds:max-w-[76rem] ds:flex-col ds:gap-[var(--spacing-lg)] ds:px-[var(--spacing-md)]", children: n }) });
5285
5285
  }
5286
- const or = /* @__PURE__ */ new Set([
5286
+ const sr = /* @__PURE__ */ new Set([
5287
5287
  "number",
5288
5288
  "choice",
5289
5289
  "frequency",
5290
5290
  "yesNoDetail"
5291
5291
  ]);
5292
+ function or(e) {
5293
+ return sr.has(e.type);
5294
+ }
5292
5295
  function rr(e) {
5293
- return or.has(e.type);
5296
+ return e.fields.length > 0 && e.fields.every(or);
5294
5297
  }
5295
5298
  function lr(e) {
5296
- return e.fields.length > 0 && e.fields.every(rr);
5297
- }
5298
- function cr(e) {
5299
5299
  return e.type === "text" && e.longForm === !0;
5300
5300
  }
5301
- function dr(e) {
5302
- return e.type === "textarea" || cr(e) ? !0 : e.detail === !0 && ur.has(e.type);
5301
+ function cr(e) {
5302
+ return e.type === "textarea" || lr(e) ? !0 : e.detail === !0 && dr.has(e.type);
5303
5303
  }
5304
- const ur = /* @__PURE__ */ new Set([
5304
+ const dr = /* @__PURE__ */ new Set([
5305
5305
  "yesNoDetail",
5306
5306
  "frequency",
5307
5307
  "choice"
5308
- ]), mr = "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-lg)] ds:@[640px]/intake:grid-cols-2 ds:@[960px]/intake:grid-cols-3 ds:@[1280px]/intake:grid-cols-4", pr = "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-lg)] ds:@[640px]/intake:grid-cols-2", hr = "ds:col-span-full";
5308
+ ]), ur = "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-lg)] ds:@[640px]/intake:grid-cols-2 ds:@[960px]/intake:grid-cols-3 ds:@[1280px]/intake:grid-cols-4", mr = "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-lg)] ds:@[640px]/intake:grid-cols-2", pr = "ds:col-span-full";
5309
5309
  function ja(e) {
5310
5310
  var i;
5311
5311
  const n = {}, a = ((i = e.intake) == null ? void 0 : i.answers) ?? {};
@@ -5340,13 +5340,13 @@ function Kt({
5340
5340
  var me;
5341
5341
  const Y = H.relatedTarget;
5342
5342
  !(Y instanceof Node) || H.currentTarget.contains(Y) || !((me = p.current) != null && me.contains(Y)) || R.key === s || !R.fields.every(
5343
- (ge) => $e(h[ge.key])
5343
+ (ge) => Ve(h[ge.key])
5344
5344
  ) || C((ge) => ge.filter((D) => D !== R.key));
5345
5345
  }, [y, C] = M(
5346
5346
  () => T()
5347
- ), L = (R) => C((H) => H.includes(R) ? H : [...H, R]), [S, O] = M(e.intake);
5347
+ ), L = (R) => C((H) => H.includes(R) ? H : [...H, R]), [S, z] = M(e.intake);
5348
5348
  if (e.intake !== S) {
5349
- O(e.intake);
5349
+ z(e.intake);
5350
5350
  const R = ja(e);
5351
5351
  f(R), C(T());
5352
5352
  }
@@ -5368,15 +5368,15 @@ function Kt({
5368
5368
  );
5369
5369
  R && (L(R.key), A(r));
5370
5370
  }, [r]);
5371
- const { answeredCount: P, totalCount: z } = q(() => {
5371
+ const { answeredCount: P, totalCount: O } = q(() => {
5372
5372
  let R = 0, H = 0;
5373
5373
  for (const Y of v)
5374
5374
  for (const J of Y.fields)
5375
- H += 1, $e(h[J.key]) && (R += 1);
5375
+ H += 1, Ve(h[J.key]) && (R += 1);
5376
5376
  return { answeredCount: R, totalCount: H };
5377
- }, [v, h]), I = z === 0 ? 0 : Math.round(P / z * 100), K = n("anamnesis.intake.answered", {
5377
+ }, [v, h]), I = O === 0 ? 0 : Math.round(P / O * 100), K = n("anamnesis.intake.answered", {
5378
5378
  answered: P,
5379
- total: z
5379
+ total: O
5380
5380
  }), W = k.length > 0 && (P > 0 || m), V = /* @__PURE__ */ d(Ee, { children: [
5381
5381
  a ? null : /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
5382
5382
  /* @__PURE__ */ t("h1", { className: "type-title-page ds:m-0 ds:text-[color:var(--foreground)]", children: n("anamnesis.intake.title") }),
@@ -5464,8 +5464,8 @@ function Kt({
5464
5464
  onValueChange: C,
5465
5465
  children: v.map((R) => {
5466
5466
  const H = R.fields.filter(
5467
- (J) => $e(h[J.key])
5468
- ).length, Y = lr(R);
5467
+ (J) => Ve(h[J.key])
5468
+ ).length, Y = rr(R);
5469
5469
  return /* @__PURE__ */ d(
5470
5470
  Ci,
5471
5471
  {
@@ -5484,14 +5484,14 @@ function Kt({
5484
5484
  {
5485
5485
  "data-testid": `anamnesis-intake-section-${R.key}-fields`,
5486
5486
  "data-layout": Y ? "short" : "mixed",
5487
- className: Y ? mr : pr,
5487
+ className: Y ? ur : mr,
5488
5488
  children: R.fields.map((J) => /* @__PURE__ */ t(
5489
5489
  $t,
5490
5490
  {
5491
5491
  readOnly: l,
5492
5492
  def: J,
5493
5493
  answer: h[J.key],
5494
- className: dr(J) ? hr : void 0,
5494
+ className: cr(J) ? pr : void 0,
5495
5495
  onChange: (me) => x(J.key, me),
5496
5496
  t: n
5497
5497
  },
@@ -5556,7 +5556,7 @@ function Qn({
5556
5556
  const l = Le(n, r), c = a ? Le(a, r) : null, u = a ? _n(l, c, r) : null, h = yn(l, r.referenceRange), f = i.get(r.key) ?? null;
5557
5557
  return /* @__PURE__ */ d(_.Row, { children: [
5558
5558
  /* @__PURE__ */ d(_.Term, { children: [
5559
- Be(r, s),
5559
+ Ke(r, s),
5560
5560
  r.unit ? ` (${r.unit})` : ""
5561
5561
  ] }),
5562
5562
  /* @__PURE__ */ t(_.Detail, { children: /* @__PURE__ */ d("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)] ds:tabular-nums", children: [
@@ -5571,7 +5571,7 @@ function Qn({
5571
5571
  ] }, r.key);
5572
5572
  }) });
5573
5573
  }
5574
- function gr({
5574
+ function hr({
5575
5575
  record: e,
5576
5576
  t: n,
5577
5577
  embedded: a = !1,
@@ -5793,7 +5793,7 @@ function Wa({
5793
5793
  }) {
5794
5794
  return e ? /* @__PURE__ */ t("div", { className: "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-lg)]", children: n }) : /* @__PURE__ */ t("div", { className: "ds:min-h-[100dvh] ds:w-full ds:bg-[color:var(--app-shell-background)] ds:py-[var(--spacing-lg)]", children: /* @__PURE__ */ t("div", { className: "ds:mx-auto ds:flex ds:w-full ds:max-w-[76rem] ds:flex-col ds:gap-[var(--spacing-lg)] ds:px-[var(--spacing-md)]", children: n }) });
5795
5795
  }
5796
- const fr = [];
5796
+ const gr = [];
5797
5797
  function un({
5798
5798
  variant: e = "first-use",
5799
5799
  testId: n = "anamnesis-empty-card",
@@ -5823,7 +5823,7 @@ function Ut({
5823
5823
  statusSlot: o,
5824
5824
  onTargetChange: r,
5825
5825
  hideTargetStrip: l = !1,
5826
- leadingTabs: c = fr,
5826
+ leadingTabs: c = gr,
5827
5827
  readOnly: u = !1,
5828
5828
  questionnaireSlot: h,
5829
5829
  questionnaireHeaderSlot: f,
@@ -5840,16 +5840,16 @@ function Ut({
5840
5840
  }
5841
5841
  ), C = x ?? g, L = (V) => {
5842
5842
  x === void 0 && y(V), v == null || v(V);
5843
- }, [S, O] = M(e), [p, A] = M(e);
5844
- e !== p && (A(e), O(e));
5843
+ }, [S, z] = M(e), [p, A] = M(e);
5844
+ e !== p && (A(e), z(e));
5845
5845
  const k = q(
5846
5846
  () => new Map(S.targets.map((V) => [V.parameterKey, V.target])),
5847
5847
  [S.targets]
5848
5848
  ), E = q(() => Vt(a), [a]), P = q(
5849
5849
  () => Ie(a),
5850
5850
  [a]
5851
- ), z = (V, R) => {
5852
- O((H) => ct(H, V.key, R)), r == null || r(V.key, R);
5851
+ ), O = (V, R) => {
5852
+ z((H) => ct(H, V.key, R)), r == null || r(V.key, R);
5853
5853
  }, [I, K] = ya(), W = /* @__PURE__ */ t(
5854
5854
  va,
5855
5855
  {
@@ -5884,7 +5884,7 @@ function Ut({
5884
5884
  defs: E,
5885
5885
  targets: k,
5886
5886
  t: n,
5887
- onTargetChange: z
5887
+ onTargetChange: O
5888
5888
  }
5889
5889
  ),
5890
5890
  /* @__PURE__ */ d(Q, { value: C, onValueChange: L, children: [
@@ -5971,7 +5971,7 @@ function Ut({
5971
5971
  );
5972
5972
  }
5973
5973
  Ut.displayName = "AnamnesisQuestionnaire";
5974
- function Ol({
5974
+ function Ml({
5975
5975
  mode: e,
5976
5976
  record: n,
5977
5977
  t: a,
@@ -5994,13 +5994,13 @@ function Ol({
5994
5994
  questionnaireHeaderSlot: C,
5995
5995
  emptyState: L,
5996
5996
  partitionBySource: S,
5997
- defaultQuestionnaireTab: O,
5997
+ defaultQuestionnaireTab: z,
5998
5998
  practitioners: p,
5999
5999
  newVisitDateIso: A,
6000
6000
  defaultView: k,
6001
6001
  defaultExportMenuOpen: E,
6002
6002
  defaultShareOpen: P,
6003
- defaultExportAudience: z
6003
+ defaultExportAudience: O
6004
6004
  }) {
6005
6005
  const I = e === "intake" ? /* @__PURE__ */ t(
6006
6006
  Kt,
@@ -6027,7 +6027,7 @@ function Ol({
6027
6027
  leadingTabs: v,
6028
6028
  tab: T,
6029
6029
  onTabChange: g,
6030
- defaultTab: O,
6030
+ defaultTab: z,
6031
6031
  readOnly: m,
6032
6032
  questionnaireSlot: y,
6033
6033
  questionnaireHeaderSlot: C,
@@ -6035,7 +6035,7 @@ function Ol({
6035
6035
  partitionBySource: S
6036
6036
  }
6037
6037
  ) : e === "compile" ? /* @__PURE__ */ t(
6038
- sr,
6038
+ ir,
6039
6039
  {
6040
6040
  record: n,
6041
6041
  t: a,
@@ -6052,11 +6052,11 @@ function Ol({
6052
6052
  defaultView: k,
6053
6053
  defaultExportMenuOpen: E,
6054
6054
  defaultShareOpen: P,
6055
- defaultExportAudience: z,
6055
+ defaultExportAudience: O,
6056
6056
  partitionBySource: S
6057
6057
  }
6058
6058
  ) : /* @__PURE__ */ t(
6059
- gr,
6059
+ hr,
6060
6060
  {
6061
6061
  record: n,
6062
6062
  t: a,
@@ -6087,7 +6087,7 @@ function Ol({
6087
6087
  }
6088
6088
  );
6089
6089
  }
6090
- const vr = Za("", {
6090
+ const fr = Za("", {
6091
6091
  variants: {
6092
6092
  dragging: {
6093
6093
  true: "ds:opacity-60",
@@ -6155,7 +6155,7 @@ function Xn({
6155
6155
  const b = i.dragSource;
6156
6156
  o(!1), i.setDragSource(null), !(b === null || b === e) && l(b, e);
6157
6157
  },
6158
- className: vr({
6158
+ className: fr({
6159
6159
  dragging: u,
6160
6160
  dropTarget: s && !u
6161
6161
  })
@@ -6201,7 +6201,7 @@ function Zn(e, n, a) {
6201
6201
  const i = [...e], [s] = i.splice(n, 1);
6202
6202
  return i.splice(a, 0, s), i;
6203
6203
  }
6204
- const yr = [
6204
+ const vr = [
6205
6205
  "text",
6206
6206
  "textarea",
6207
6207
  "numberInteger",
@@ -6212,7 +6212,7 @@ const yr = [
6212
6212
  "multiChoice",
6213
6213
  "frequency",
6214
6214
  "meal"
6215
- ], br = new Set(
6215
+ ], yr = new Set(
6216
6216
  We.intakeSections.flatMap(
6217
6217
  (e) => e.fields.map((n) => n.key)
6218
6218
  )
@@ -6221,8 +6221,8 @@ function Gt(e, n) {
6221
6221
  const a = e.type === "number" ? e.decimal ? "numberDecimal" : "numberInteger" : e.type === "choice" && e.detail ? "choiceWithText" : e.type;
6222
6222
  return n(`anamnesis.configEditor.type.${a}`);
6223
6223
  }
6224
- const xr = ["down", "up", "toRange"], oa = ["anthropometric", "dietary", "lab"];
6225
- function $l({
6224
+ const br = ["down", "up", "toRange"], oa = ["anthropometric", "dietary", "lab"];
6225
+ function Ol({
6226
6226
  config: e,
6227
6227
  onConfigChange: n,
6228
6228
  t: a,
@@ -6241,15 +6241,15 @@ function $l({
6241
6241
  ), f = (p) => n({ ...e, pathologies: e.pathologies.map(p) }), m = (p, A, k) => {
6242
6242
  const E = Ie(e, p), P = Zn(E, A, k);
6243
6243
  if (!P) return;
6244
- const z = new Map(P.map((I, K) => [I.key, K]));
6244
+ const O = new Map(P.map((I, K) => [I.key, K]));
6245
6245
  c(
6246
- (I) => z.has(I.key) ? { ...I, order: z.get(I.key) } : I
6246
+ (I) => O.has(I.key) ? { ...I, order: O.get(I.key) } : I
6247
6247
  );
6248
6248
  }, b = (p, A) => {
6249
6249
  const k = Zn(je(e), p, A);
6250
6250
  if (!k) return;
6251
6251
  const E = new Map(
6252
- k.map((P, z) => [P.key, z])
6252
+ k.map((P, O) => [P.key, O])
6253
6253
  );
6254
6254
  u(
6255
6255
  (P) => E.has(P.key) ? { ...P, order: E.get(P.key) } : P
@@ -6258,15 +6258,15 @@ function $l({
6258
6258
  const E = Zn(p.fields, A, k);
6259
6259
  if (!E) return;
6260
6260
  const P = new Map(
6261
- E.map((z, I) => [z.key, I])
6261
+ E.map((O, I) => [O.key, I])
6262
6262
  );
6263
6263
  u(
6264
- (z) => z.key === p.key ? {
6265
- ...z,
6266
- fields: z.fields.map(
6264
+ (O) => O.key === p.key ? {
6265
+ ...O,
6266
+ fields: O.fields.map(
6267
6267
  (I) => P.has(I.key) ? { ...I, order: P.get(I.key) } : I
6268
6268
  )
6269
- } : z
6269
+ } : O
6270
6270
  );
6271
6271
  }, v = (p, A) => {
6272
6272
  p.kind === "parameter" ? c(
@@ -6285,7 +6285,7 @@ function $l({
6285
6285
  ), C = je(e).reduce(
6286
6286
  (p, A) => p + A.fields.length,
6287
6287
  0
6288
- ), L = ot(e).length, S = aa(e).length, O = Ne(e).filter(
6288
+ ), L = ot(e).length, S = aa(e).length, z = Ne(e).filter(
6289
6289
  (p) => p.goal === !0
6290
6290
  ).length;
6291
6291
  return /* @__PURE__ */ d(
@@ -6332,7 +6332,7 @@ function $l({
6332
6332
  label: ye(p, a),
6333
6333
  children: ({
6334
6334
  rowProps: P,
6335
- handle: z
6335
+ handle: O
6336
6336
  }) => /* @__PURE__ */ d("section", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
6337
6337
  /* @__PURE__ */ d(
6338
6338
  "div",
@@ -6357,7 +6357,7 @@ function $l({
6357
6357
  }
6358
6358
  ),
6359
6359
  children: [
6360
- z,
6360
+ O,
6361
6361
  /* @__PURE__ */ t(
6362
6362
  ce,
6363
6363
  {
@@ -6610,7 +6610,7 @@ function $l({
6610
6610
  t: a,
6611
6611
  children: /* @__PURE__ */ t(nn, { divider: "divided", children: A.map((k, E) => {
6612
6612
  const P = [
6613
- kr(k, a),
6613
+ xr(k, a),
6614
6614
  a(
6615
6615
  `anamnesis.configEditor.direction.${k.betterDirection}`
6616
6616
  ),
@@ -6621,10 +6621,10 @@ function $l({
6621
6621
  {
6622
6622
  index: E,
6623
6623
  label: Se(k, a),
6624
- children: ({ rowProps: z, handle: I }) => /* @__PURE__ */ t(
6624
+ children: ({ rowProps: O, handle: I }) => /* @__PURE__ */ t(
6625
6625
  nn.Item,
6626
6626
  {
6627
- ...z,
6627
+ ...O,
6628
6628
  title: /* @__PURE__ */ d("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
6629
6629
  Se(k, a),
6630
6630
  k.locked ? /* @__PURE__ */ t(
@@ -6859,7 +6859,7 @@ function $l({
6859
6859
  ] }) }),
6860
6860
  /* @__PURE__ */ t(Q.Content, { value: "targets", children: /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)] ds:pt-[var(--spacing-md)]", children: [
6861
6861
  /* @__PURE__ */ t("p", { className: "type-meta ds:m-0 ds:text-[color:var(--muted-foreground)]", children: a("anamnesis.configEditor.panelTracked", {
6862
- count: O
6862
+ count: z
6863
6863
  }) }),
6864
6864
  /* @__PURE__ */ t("p", { className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]", children: a("anamnesis.configEditor.targetsIntro") }),
6865
6865
  oa.map((p) => {
@@ -6889,7 +6889,7 @@ function $l({
6889
6889
  ] }) })
6890
6890
  ] }) }) }),
6891
6891
  /* @__PURE__ */ t(
6892
- wr,
6892
+ kr,
6893
6893
  {
6894
6894
  editing: s,
6895
6895
  onClose: () => o(null),
@@ -6899,7 +6899,7 @@ function $l({
6899
6899
  }
6900
6900
  ),
6901
6901
  /* @__PURE__ */ t(
6902
- Sr,
6902
+ Cr,
6903
6903
  {
6904
6904
  adding: r,
6905
6905
  onClose: () => l(null),
@@ -6912,11 +6912,11 @@ function $l({
6912
6912
  }
6913
6913
  );
6914
6914
  }
6915
- function kr(e, n) {
6915
+ function xr(e, n) {
6916
6916
  const a = e.referenceRange;
6917
6917
  return a ? a.min != null && a.max != null ? `${a.min}–${a.max}` : a.max != null ? n("anamnesis.range.atMost", { value: a.max }) : a.min != null ? n("anamnesis.range.atLeast", { value: a.min }) : null : null;
6918
6918
  }
6919
- function wr({
6919
+ function kr({
6920
6920
  editing: e,
6921
6921
  onClose: n,
6922
6922
  config: a,
@@ -6931,7 +6931,7 @@ function wr({
6931
6931
  o || n();
6932
6932
  },
6933
6933
  children: e ? /* @__PURE__ */ t(
6934
- Tr,
6934
+ Nr,
6935
6935
  {
6936
6936
  editing: e,
6937
6937
  onClose: n,
@@ -6939,29 +6939,29 @@ function wr({
6939
6939
  onConfigChange: i,
6940
6940
  t: s
6941
6941
  },
6942
- Nr(e)
6942
+ wr(e)
6943
6943
  ) : null
6944
6944
  }
6945
6945
  );
6946
6946
  }
6947
- function Nr(e) {
6947
+ function wr(e) {
6948
6948
  return e.kind === "pathology" ? `pathology:${e.entry.code}` : e.kind === "field" ? `field:${e.sectionKey}:${e.entry.key}` : `${e.kind}:${e.entry.key}`;
6949
6949
  }
6950
- function Tr({
6950
+ function Nr({
6951
6951
  editing: e,
6952
6952
  onClose: n,
6953
6953
  config: a,
6954
6954
  onConfigChange: i,
6955
6955
  t: s
6956
6956
  }) {
6957
- const o = e.entry, r = Cr(e, s), [l, c] = M(o.label ?? ""), [u, h] = M(
6957
+ const o = e.entry, r = Tr(e, s), [l, c] = M(o.label ?? ""), [u, h] = M(
6958
6958
  e.kind === "field" ? o.helpText ?? "" : ""
6959
6959
  ), [f, m] = M(
6960
6960
  e.kind === "field" && e.entry.required === !0
6961
- ), b = e.kind === "field" ? e.entry : null, x = b !== null && (b.type === "choice" || b.type === "multiChoice"), v = x && !br.has(b.key), [T, g] = M(
6961
+ ), b = e.kind === "field" ? e.entry : null, x = b !== null && (b.type === "choice" || b.type === "multiChoice"), v = x && !yr.has(b.key), [T, g] = M(
6962
6962
  v ? (b.options ?? []).join(", ") : ""
6963
6963
  ), y = T.split(",").map((S) => S.trim()).filter(Boolean), C = !v || y.length > 0, L = () => {
6964
- const S = l.trim(), O = (p) => {
6964
+ const S = l.trim(), z = (p) => {
6965
6965
  const A = { ...p };
6966
6966
  return S ? A.label = S : delete A.label, A;
6967
6967
  };
@@ -6969,14 +6969,14 @@ function Tr({
6969
6969
  i({
6970
6970
  ...a,
6971
6971
  parameters: a.parameters.map(
6972
- (p) => p.key === e.entry.key ? O(p) : p
6972
+ (p) => p.key === e.entry.key ? z(p) : p
6973
6973
  )
6974
6974
  });
6975
6975
  else if (e.kind === "section")
6976
6976
  i({
6977
6977
  ...a,
6978
6978
  intakeSections: a.intakeSections.map(
6979
- (p) => p.key === e.entry.key ? O(p) : p
6979
+ (p) => p.key === e.entry.key ? z(p) : p
6980
6980
  )
6981
6981
  });
6982
6982
  else if (e.kind === "field") {
@@ -6988,7 +6988,7 @@ function Tr({
6988
6988
  ...A,
6989
6989
  fields: A.fields.map((k) => {
6990
6990
  if (k.key !== e.entry.key) return k;
6991
- const E = O(k);
6991
+ const E = z(k);
6992
6992
  return p ? E.helpText = p : delete E.helpText, v && (E.options = y), f ? E.required = !0 : delete E.required, E;
6993
6993
  })
6994
6994
  } : A
@@ -6998,7 +6998,7 @@ function Tr({
6998
6998
  i({
6999
6999
  ...a,
7000
7000
  pathologies: a.pathologies.map(
7001
- (p) => p.code === o.code ? O(p) : p
7001
+ (p) => p.code === o.code ? z(p) : p
7002
7002
  )
7003
7003
  });
7004
7004
  n();
@@ -7076,7 +7076,7 @@ function Tr({
7076
7076
  ] })
7077
7077
  ] });
7078
7078
  }
7079
- function Cr(e, n) {
7079
+ function Tr(e, n) {
7080
7080
  return e.kind === "parameter" ? Se({ ...e.entry, label: void 0 }, n) : e.kind === "section" ? ye({ ...e.entry, label: void 0 }, n) : e.kind === "field" ? he({ ...e.entry, label: void 0 }, n) : Ae(e.entry.code, n, {
7081
7081
  ...e.entry,
7082
7082
  label: void 0
@@ -7085,7 +7085,7 @@ function Cr(e, n) {
7085
7085
  function ea(e) {
7086
7086
  return e === "choice" || e === "choiceWithText" || e === "multiChoice";
7087
7087
  }
7088
- function Sr({
7088
+ function Cr({
7089
7089
  adding: e,
7090
7090
  onClose: n,
7091
7091
  config: a,
@@ -7100,7 +7100,7 @@ function Sr({
7100
7100
  o || n();
7101
7101
  },
7102
7102
  children: e ? /* @__PURE__ */ t(
7103
- Er,
7103
+ Sr,
7104
7104
  {
7105
7105
  adding: e,
7106
7106
  onClose: n,
@@ -7113,20 +7113,20 @@ function Sr({
7113
7113
  }
7114
7114
  );
7115
7115
  }
7116
- function Er({
7116
+ function Sr({
7117
7117
  adding: e,
7118
7118
  onClose: n,
7119
7119
  config: a,
7120
7120
  onConfigChange: i,
7121
7121
  t: s
7122
7122
  }) {
7123
- const [o, r] = M(""), [l, c] = M(""), [u, h] = M(""), [f, m] = M(""), [b, x] = M(""), [v, T] = M(""), [g, y] = M("0"), [C, L] = M(""), [S, O] = M(""), [p, A] = M(""), [k, E] = M(""), [P, z] = M(!1), [I, K] = M(""), W = oa.map((D) => ({
7123
+ const [o, r] = M(""), [l, c] = M(""), [u, h] = M(""), [f, m] = M(""), [b, x] = M(""), [v, T] = M(""), [g, y] = M("0"), [C, L] = M(""), [S, z] = M(""), [p, A] = M(""), [k, E] = M(""), [P, O] = M(!1), [I, K] = M(""), W = oa.map((D) => ({
7124
7124
  value: D,
7125
7125
  label: s(`anamnesis.group.${D}`)
7126
- })), V = xr.map((D) => ({
7126
+ })), V = br.map((D) => ({
7127
7127
  value: D,
7128
7128
  label: s(`anamnesis.configEditor.direction.${D}`)
7129
- })), R = yr.map((D) => ({
7129
+ })), R = vr.map((D) => ({
7130
7130
  value: D,
7131
7131
  label: s(`anamnesis.configEditor.type.${D}`)
7132
7132
  })), H = a.pathologies.filter((D) => !D.parentCode && D.enabled !== !1).map((D) => ({
@@ -7145,7 +7145,7 @@ function Er({
7145
7145
  if (_e.trim() === "") return;
7146
7146
  const Te = Number(_e);
7147
7147
  return Number.isFinite(Te) ? Te : void 0;
7148
- }, de = le(b), ue = le(v), Ke = {
7148
+ }, de = le(b), ue = le(v), Ue = {
7149
7149
  key: Jn(D, U),
7150
7150
  label: D,
7151
7151
  group: l,
@@ -7159,11 +7159,11 @@ function Er({
7159
7159
  }
7160
7160
  } : {}
7161
7161
  };
7162
- i({ ...a, parameters: [...a.parameters, Ke] });
7162
+ i({ ...a, parameters: [...a.parameters, Ue] });
7163
7163
  } else if (e.kind === "field") {
7164
7164
  const U = new Set(
7165
7165
  a.intakeSections.flatMap(
7166
- (ue) => ue.fields.map((Ke) => Ke.key)
7166
+ (ue) => ue.fields.map((Ue) => Ue.key)
7167
7167
  )
7168
7168
  ), le = C === "numberInteger" || C === "numberDecimal" ? "number" : C === "choiceWithText" ? "choice" : C, de = {
7169
7169
  key: Jn(D, U),
@@ -7206,7 +7206,7 @@ function Er({
7206
7206
  }
7207
7207
  n();
7208
7208
  }, ge = e.kind === "parameter" ? s("anamnesis.configEditor.addParameterTitle") : e.kind === "field" ? s("anamnesis.configEditor.addQuestionTitle", {
7209
- section: Ar(a, e.sectionKey, s)
7209
+ section: Er(a, e.sectionKey, s)
7210
7210
  }) : e.kind === "section" ? s("anamnesis.configEditor.addSectionTitle") : s("anamnesis.configEditor.addCodeTitle");
7211
7211
  return /* @__PURE__ */ d(ee.Content, { size: "sm", children: [
7212
7212
  /* @__PURE__ */ d(ee.Header, { children: [
@@ -7230,7 +7230,7 @@ function Er({
7230
7230
  ) }),
7231
7231
  e.kind === "parameter" ? /* @__PURE__ */ d(Ee, { children: [
7232
7232
  /* @__PURE__ */ t($, { label: s("anamnesis.configEditor.groupField"), required: !0, children: /* @__PURE__ */ t(
7233
- ze,
7233
+ $e,
7234
7234
  {
7235
7235
  options: W,
7236
7236
  value: l,
@@ -7245,7 +7245,7 @@ function Er({
7245
7245
  label: s("anamnesis.configEditor.directionField"),
7246
7246
  required: !0,
7247
7247
  children: /* @__PURE__ */ t(
7248
- ze,
7248
+ $e,
7249
7249
  {
7250
7250
  options: V,
7251
7251
  value: u,
@@ -7270,7 +7270,7 @@ function Er({
7270
7270
  label: s("anamnesis.configEditor.precisionField"),
7271
7271
  optional: !0,
7272
7272
  children: /* @__PURE__ */ t(
7273
- ze,
7273
+ $e,
7274
7274
  {
7275
7275
  options: [
7276
7276
  { value: "0", label: "0" },
@@ -7320,7 +7320,7 @@ function Er({
7320
7320
  ] }) : null,
7321
7321
  e.kind === "field" ? /* @__PURE__ */ d(Ee, { children: [
7322
7322
  /* @__PURE__ */ t($, { label: s("anamnesis.configEditor.typeField"), required: !0, children: /* @__PURE__ */ t(
7323
- ze,
7323
+ $e,
7324
7324
  {
7325
7325
  options: R,
7326
7326
  value: C,
@@ -7339,7 +7339,7 @@ function Er({
7339
7339
  ne,
7340
7340
  {
7341
7341
  value: S,
7342
- onChange: (D) => O(D.target.value)
7342
+ onChange: (D) => z(D.target.value)
7343
7343
  }
7344
7344
  )
7345
7345
  }
@@ -7357,7 +7357,7 @@ function Er({
7357
7357
  {
7358
7358
  label: s("anamnesis.configEditor.requiredField"),
7359
7359
  checked: P,
7360
- onCheckedChange: (D) => z(D === !0)
7360
+ onCheckedChange: (D) => O(D === !0)
7361
7361
  }
7362
7362
  )
7363
7363
  ] }) : null,
@@ -7368,7 +7368,7 @@ function Er({
7368
7368
  description: s("anamnesis.configEditor.parentFieldHelp"),
7369
7369
  optional: !0,
7370
7370
  children: /* @__PURE__ */ t(
7371
- ze,
7371
+ $e,
7372
7372
  {
7373
7373
  options: H,
7374
7374
  value: I,
@@ -7388,7 +7388,7 @@ function Er({
7388
7388
  ] })
7389
7389
  ] });
7390
7390
  }
7391
- function Ar(e, n, a) {
7391
+ function Er(e, n, a) {
7392
7392
  const i = e.intakeSections.find(
7393
7393
  (s) => s.key === n
7394
7394
  );
@@ -7397,7 +7397,7 @@ function Ar(e, n, a) {
7397
7397
  function Qa(e) {
7398
7398
  return e.kind === "visit" ? `anamnesis-visit-${e.visitId}` : `anamnesis-event-${e.eventId}`;
7399
7399
  }
7400
- function Vl(e, n) {
7400
+ function $l(e, n) {
7401
7401
  const a = e.visits.filter(Tt).map((s) => ({
7402
7402
  id: Qa({ kind: "visit", visitId: s.id }),
7403
7403
  dateIso: s.dateIso,
@@ -7411,7 +7411,7 @@ function Vl(e, n) {
7411
7411
  // one of them saying nothing the text below it does not.
7412
7412
  content: [
7413
7413
  `**${n(`anamnesis.visitType.${s.visitType}`)}**`,
7414
- ...zn(s).map(
7414
+ ...On(s).map(
7415
7415
  (o) => `**${n(`anamnesis.field.${o.field}.label`)}** — ${o.text}`
7416
7416
  )
7417
7417
  ].join(`
@@ -7437,7 +7437,7 @@ function Vl(e, n) {
7437
7437
  (s, o) => o.dateIso.localeCompare(s.dateIso)
7438
7438
  );
7439
7439
  }
7440
- const na = "patterns", Dr = {
7440
+ const na = "patterns", Ar = {
7441
7441
  anamnesis: {
7442
7442
  mainLabel: "Anamnesis record — {{mode}}",
7443
7443
  mode: { intake: "Intake", compile: "Compile", readOnly: "Read-only" },
@@ -8085,7 +8085,7 @@ const na = "patterns", Dr = {
8085
8085
  }
8086
8086
  }
8087
8087
  }
8088
- }, Ir = {
8088
+ }, Dr = {
8089
8089
  anamnesis: {
8090
8090
  mainLabel: "Cartella anamnestica — {{mode}}",
8091
8091
  mode: {
@@ -8721,7 +8721,7 @@ const na = "patterns", Dr = {
8721
8721
  }
8722
8722
  }
8723
8723
  }
8724
- }, Lr = {
8724
+ }, Ir = {
8725
8725
  anamnesis: {
8726
8726
  mainLabel: "السجل الطبي — {{mode}}",
8727
8727
  mode: { intake: "الاستجواب", compile: "التجميع", readOnly: "للقراءة فقط" },
@@ -9015,7 +9015,7 @@ const na = "patterns", Dr = {
9015
9015
  groupGeneral: "عام"
9016
9016
  }
9017
9017
  }
9018
- }, Rr = {
9018
+ }, Lr = {
9019
9019
  anamnesis: {
9020
9020
  mainLabel: "問診記録 — {{mode}}",
9021
9021
  mode: { intake: "問診", compile: "記入", readOnly: "閲覧のみ" },
@@ -9299,17 +9299,17 @@ const na = "patterns", Dr = {
9299
9299
  groupGeneral: "一般"
9300
9300
  }
9301
9301
  }
9302
- }, Fr = {
9303
- en: Dr,
9304
- it: Ir,
9305
- ar: Lr,
9306
- ja: Rr
9302
+ }, Rr = {
9303
+ en: Ar,
9304
+ it: Dr,
9305
+ ar: Ir,
9306
+ ja: Lr
9307
9307
  };
9308
- function ql(e) {
9309
- for (const [n, a] of Object.entries(Fr))
9308
+ function Vl(e) {
9309
+ for (const [n, a] of Object.entries(Rr))
9310
9310
  e.hasResourceBundle(n, na) ? e.addResourceBundle(n, na, a, !0, !1) : e.addResourceBundle(n, na, a);
9311
9311
  }
9312
- function _r(e) {
9312
+ function Fr(e) {
9313
9313
  var a;
9314
9314
  if (!e) return;
9315
9315
  const n = Je(e) ? new Date(e).getTime() : (a = ut(e)) == null ? void 0 : a.getTime();
@@ -9318,45 +9318,45 @@ function _r(e) {
9318
9318
  function jt(e) {
9319
9319
  return e.reportedAtIso ?? e.response.submittedAtIso;
9320
9320
  }
9321
- function Pr(e, n) {
9321
+ function _r(e, n) {
9322
9322
  var s;
9323
9323
  let a, i = Number.NEGATIVE_INFINITY;
9324
9324
  for (const o of n) {
9325
9325
  const r = (s = o.response.answers[e]) == null ? void 0 : s.value;
9326
- if (!r || !$e(r)) continue;
9327
- const l = _r(jt(o)) ?? Number.NEGATIVE_INFINITY;
9326
+ if (!r || !Ve(r)) continue;
9327
+ const l = Fr(jt(o)) ?? Number.NEGATIVE_INFINITY;
9328
9328
  l >= i && (a = { answer: r, source: o }, i = l);
9329
9329
  }
9330
9330
  return a;
9331
9331
  }
9332
- function Mr(e, n) {
9332
+ function Pr(e, n) {
9333
9333
  const a = e.relevance ?? "any";
9334
9334
  return n === void 0 || a === "any" || a === n;
9335
9335
  }
9336
- function Or(e, n, a) {
9336
+ function Mr(e, n, a) {
9337
9337
  const i = {
9338
9338
  id: e.key,
9339
9339
  label: he(e, a),
9340
- value: On(n.answer, e, a),
9341
- highlighted: zt(e, n.answer)
9340
+ value: zn(n.answer, e, a),
9341
+ highlighted: Ot(e, n.answer)
9342
9342
  };
9343
9343
  e.unit && (i.unit = e.unit);
9344
9344
  const s = jt(n.source);
9345
9345
  return s && (i.reportedAtIso = s), n.source.sourceLabel && (i.sourceLabel = n.source.sourceLabel), i;
9346
9346
  }
9347
- function Bl(e, n, a, i) {
9347
+ function ql(e, n, a, i) {
9348
9348
  const s = [];
9349
9349
  let o = 0;
9350
9350
  for (const r of e) {
9351
9351
  const l = [];
9352
9352
  for (const c of r.fields) {
9353
- if (!Mr(c, i == null ? void 0 : i.sex)) continue;
9354
- const u = Pr(c.key, n);
9353
+ if (!Pr(c, i == null ? void 0 : i.sex)) continue;
9354
+ const u = _r(c.key, n);
9355
9355
  if (!u) {
9356
9356
  o += 1;
9357
9357
  continue;
9358
9358
  }
9359
- l.push(Or(c, u, a));
9359
+ l.push(Mr(c, u, a));
9360
9360
  }
9361
9361
  l.length !== 0 && s.push({
9362
9362
  id: r.key,
@@ -9367,31 +9367,31 @@ function Bl(e, n, a, i) {
9367
9367
  return { sections: s, unansweredCount: o };
9368
9368
  }
9369
9369
  export {
9370
- Ol as A,
9370
+ Ml as A,
9371
9371
  $i as L,
9372
9372
  na as P,
9373
9373
  We as S,
9374
9374
  qi as T,
9375
- $l as a,
9375
+ Ol as a,
9376
9376
  Ie as b,
9377
9377
  aa as c,
9378
9378
  je as d,
9379
9379
  Qa as e,
9380
- Vl as f,
9380
+ $l as f,
9381
9381
  Ui as g,
9382
9382
  Ne as h,
9383
9383
  ot as i,
9384
9384
  ca as j,
9385
- On as k,
9385
+ zn as k,
9386
9386
  he as l,
9387
- zt as m,
9387
+ Ot as m,
9388
9388
  Vi as n,
9389
9389
  Bi as o,
9390
9390
  Jn as p,
9391
9391
  rn as q,
9392
- ql as r,
9392
+ Vl as r,
9393
9393
  zl as s,
9394
9394
  Vt as t,
9395
- Bl as u
9395
+ ql as u
9396
9396
  };
9397
- //# sourceMappingURL=anamnesis-summary-rows-ESkjwenu.js.map
9397
+ //# sourceMappingURL=anamnesis-summary-rows-CVzxC2X3.js.map