@alfadocs/ui-kit 1.146.0 → 1.147.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/_chunks/{prescription-history-CYCg6nxp.js → prescription-history-CFs3JMIE.js} +718 -717
  2. package/dist/agent-catalog.json +1 -1
  3. package/dist/browser-support.js +1 -1
  4. package/dist/i18n/locales/ar.d.ts +1 -0
  5. package/dist/i18n/locales/ar.js +1 -0
  6. package/dist/i18n/locales/de.d.ts +1 -0
  7. package/dist/i18n/locales/de.js +1 -0
  8. package/dist/i18n/locales/el.d.ts +1 -0
  9. package/dist/i18n/locales/el.js +1 -0
  10. package/dist/i18n/locales/en.d.ts +1 -0
  11. package/dist/i18n/locales/en.js +1 -0
  12. package/dist/i18n/locales/es.d.ts +1 -0
  13. package/dist/i18n/locales/es.js +1 -0
  14. package/dist/i18n/locales/fr.d.ts +1 -0
  15. package/dist/i18n/locales/fr.js +1 -0
  16. package/dist/i18n/locales/hi.d.ts +1 -0
  17. package/dist/i18n/locales/hi.js +1 -0
  18. package/dist/i18n/locales/it.d.ts +1 -0
  19. package/dist/i18n/locales/it.js +1 -0
  20. package/dist/i18n/locales/ja.d.ts +1 -0
  21. package/dist/i18n/locales/ja.js +1 -0
  22. package/dist/i18n/locales/nl.d.ts +1 -0
  23. package/dist/i18n/locales/nl.js +1 -0
  24. package/dist/i18n/locales/pl.d.ts +1 -0
  25. package/dist/i18n/locales/pl.js +1 -0
  26. package/dist/i18n/locales/pt.d.ts +1 -0
  27. package/dist/i18n/locales/pt.js +1 -0
  28. package/dist/i18n/locales/ro.d.ts +1 -0
  29. package/dist/i18n/locales/ro.js +1 -0
  30. package/dist/i18n/locales/ru.d.ts +1 -0
  31. package/dist/i18n/locales/ru.js +1 -0
  32. package/dist/i18n/locales/sq.d.ts +1 -0
  33. package/dist/i18n/locales/sq.js +1 -0
  34. package/dist/i18n/locales/sv.d.ts +1 -0
  35. package/dist/i18n/locales/sv.js +1 -0
  36. package/dist/i18n/locales/tr.d.ts +1 -0
  37. package/dist/i18n/locales/tr.js +1 -0
  38. package/dist/i18n/locales/zh.d.ts +1 -0
  39. package/dist/i18n/locales/zh.js +1 -0
  40. package/dist/index.js +1 -1
  41. package/dist/locales/ar.json +1 -0
  42. package/dist/locales/de.json +1 -0
  43. package/dist/locales/el.json +1 -0
  44. package/dist/locales/en.json +1 -0
  45. package/dist/locales/es.json +1 -0
  46. package/dist/locales/fr.json +1 -0
  47. package/dist/locales/hi.json +1 -0
  48. package/dist/locales/it.json +1 -0
  49. package/dist/locales/ja.json +1 -0
  50. package/dist/locales/nl.json +1 -0
  51. package/dist/locales/pl.json +1 -0
  52. package/dist/locales/pt.json +1 -0
  53. package/dist/locales/ro.json +1 -0
  54. package/dist/locales/ru.json +1 -0
  55. package/dist/locales/sq.json +1 -0
  56. package/dist/locales/sv.json +1 -0
  57. package/dist/locales/tr.json +1 -0
  58. package/dist/locales/zh.json +1 -0
  59. package/dist/patterns/prescription/index.js +1 -1
  60. package/dist/patterns/prescription/prescription-composer.d.ts +2 -0
  61. package/package.json +1 -1
@@ -1,68 +1,68 @@
1
- import { jsxs as y, jsx as r, Fragment as Be } from "react/jsx-runtime";
2
- import { forwardRef as Ge, useId as ve, useState as U, useRef as w, useEffect as qe, useCallback as A, useMemo as _e, useImperativeHandle as Et } from "react";
3
- import { c as _ } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Ie } from "react-i18next";
5
- import { A as he } from "./alert-C4WKViaS.js";
6
- import { B as Re } from "./button-Dp4j9ygh.js";
7
- import { E as Wt } from "./empty-state-5REM7oDM.js";
8
- import { E as Qt } from "./error-summary-DxNhwf_G.js";
9
- import { F as Yt } from "./field-array-kwUgFOIr.js";
1
+ import { jsxs as v, jsx as r, Fragment as _e } from "react/jsx-runtime";
2
+ import { forwardRef as Oe, useId as ye, useState as Y, useRef as x, useEffect as $e, useCallback as P, useMemo as je, useImperativeHandle as Et } from "react";
3
+ import { c as j } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as ve } from "react-i18next";
5
+ import { A as be } from "./alert-C4WKViaS.js";
6
+ import { B as ze } from "./button-Dp4j9ygh.js";
7
+ import { E as Qt } from "./empty-state-5REM7oDM.js";
8
+ import { E as Yt } from "./error-summary-DxNhwf_G.js";
9
+ import { F as Ut } from "./field-array-kwUgFOIr.js";
10
10
  import { F as pe } from "./form-field-CyHfOVKF.js";
11
11
  import { S as Nt } from "./select-Bw5FvGJ7.js";
12
- import { S as Ve } from "./skeleton-tTWJpvAq.js";
13
- import { P as Ut } from "./patient-picker-Dm74jHIk.js";
12
+ import { S as De } from "./skeleton-tTWJpvAq.js";
13
+ import { P as Xt } from "./patient-picker-Dm74jHIk.js";
14
14
  import { p as ct } from "./privacy-mask-text-B8YfzB7L.js";
15
- import { u as Xt } from "./use-controllable-state-BiY4xTzM.js";
16
- import { u as Ee } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
17
- import { u as Jt, a as Zt } from "./use-error-summary-CecJZo6w.js";
18
- import { C as er } from "./checkbox-DV4sNDeB.js";
19
- import { N as tr } from "./number-input-Bi5Yk6PX.js";
15
+ import { u as Jt } from "./use-controllable-state-BiY4xTzM.js";
16
+ import { u as we } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
17
+ import { u as Zt, a as er } from "./use-error-summary-CecJZo6w.js";
18
+ import { C as tr } from "./checkbox-DV4sNDeB.js";
19
+ import { N as rr } from "./number-input-Bi5Yk6PX.js";
20
20
  import { T as nt } from "./text-input-B6iAgCr3.js";
21
- import { M as rr } from "./medication-search-CTUtXuPT.js";
22
- import { a as ir, S as sr } from "./suggestion-chip-BNRWZL51.js";
21
+ import { M as ir } from "./medication-search-CTUtXuPT.js";
22
+ import { a as sr, S as nr } from "./suggestion-chip-BNRWZL51.js";
23
23
  import { V as lt } from "./visually-hidden-BHxEUGyT.js";
24
- import { T as nr } from "./timestamp-UMF1llBs.js";
25
- import { I as ar } from "./icon-button-u9VMQn3x.js";
26
- import { B as or } from "./button-group-N60L3HMa.js";
27
- import { D as De } from "./dropdown-menu-Bm1KALnk.js";
28
- import { K as cr, a as ie, S as St } from "./key-value-pair-BykhMTcP.js";
29
- import { a as lr, M as dr } from "./medication-line-DFa5oFhf.js";
30
- import { P as pr } from "./print-sheet-gaxObGcm.js";
31
- import { a as ur } from "./whatsapp-button-XbozeDl_.js";
32
- import { f as Oe } from "./intl-locale-FWh-Y5_3.js";
24
+ import { T as ar } from "./timestamp-UMF1llBs.js";
25
+ import { I as or } from "./icon-button-u9VMQn3x.js";
26
+ import { B as cr } from "./button-group-N60L3HMa.js";
27
+ import { D as Fe } from "./dropdown-menu-Bm1KALnk.js";
28
+ import { K as lr, a as ne, S as St } from "./key-value-pair-BykhMTcP.js";
29
+ import { a as dr, M as pr } from "./medication-line-DFa5oFhf.js";
30
+ import { P as ur } from "./print-sheet-gaxObGcm.js";
31
+ import { a as mr } from "./whatsapp-button-XbozeDl_.js";
32
+ import { f as He } from "./intl-locale-FWh-Y5_3.js";
33
33
  import { A as qt } from "./avatar-Dp5apm1d.js";
34
34
  import { P as Ct } from "./printer-rkK0T1gi.js";
35
- import { D as mr } from "./download-CfYKJO_j.js";
36
- import { M as fr } from "./mail-BqXVF2zH.js";
37
- import { M as hr } from "./message-square-Bye4ATvx.js";
38
- import { C as br } from "./chevron-down-DWE7GSq9.js";
39
- import { I as gr } from "./icon-button-group-DEAx9M5v.js";
40
- import { T as yr } from "./tag-BNlcEJfE.js";
41
- import { R as vr } from "./row-actions-CA938TAd.js";
42
- import { e as Ir } from "./data-grid-CujX-2tF.js";
35
+ import { D as fr } from "./download-CfYKJO_j.js";
36
+ import { M as hr } from "./mail-BqXVF2zH.js";
37
+ import { M as br } from "./message-square-Bye4ATvx.js";
38
+ import { C as gr } from "./chevron-down-DWE7GSq9.js";
39
+ import { I as yr } from "./icon-button-group-DEAx9M5v.js";
40
+ import { T as vr } from "./tag-BNlcEJfE.js";
41
+ import { R as Ir } from "./row-actions-CA938TAd.js";
42
+ import { e as Nr } from "./data-grid-CujX-2tF.js";
43
43
  import { D as de } from "./toolbar-z_6tE7zG.js";
44
- import { B as Nr } from "./badge-BUk4RjTS.js";
45
- import { C as Sr } from "./check-DrFSN__t.js";
46
- import { L as kr } from "./loader-circle-BECIU_8N.js";
47
- import { C as xr } from "./circle-alert-rGDZ73Wh.js";
48
- import { E as Tr } from "./eye-BjhN2nYf.js";
49
- function wr(e, n) {
44
+ import { B as Sr } from "./badge-BUk4RjTS.js";
45
+ import { C as kr } from "./check-DrFSN__t.js";
46
+ import { L as xr } from "./loader-circle-BECIU_8N.js";
47
+ import { C as Tr } from "./circle-alert-rGDZ73Wh.js";
48
+ import { E as wr } from "./eye-BjhN2nYf.js";
49
+ function $r(e, n) {
50
50
  const a = {};
51
51
  if (e.patientId && n.patientId && (a.patientId = e.patientId), e.prescriberId && n.prescriberId && (a.prescriberId = e.prescriberId), e.treatmentId && n.treatmentId === e.treatmentId && (a.treatmentId = e.treatmentId), e.items && n.items && (a.items = e.items), e.itemErrors) {
52
52
  const h = e.itemErrors.map(
53
- (u, k) => {
53
+ (u, S) => {
54
54
  var N;
55
- const b = (N = n.itemErrors) == null ? void 0 : N[k];
56
- if (!u || !b) return;
57
- const c = {};
58
- return u.medicationId && b.medicationId && (c.medicationId = u.medicationId), u.dosage && b.dosage && (c.dosage = u.dosage), u.quantity && b.quantity && (c.quantity = u.quantity), Object.keys(c).length > 0 ? c : void 0;
55
+ const g = (N = n.itemErrors) == null ? void 0 : N[S];
56
+ if (!u || !g) return;
57
+ const o = {};
58
+ return u.medicationId && g.medicationId && (o.medicationId = u.medicationId), u.dosage && g.dosage && (o.dosage = u.dosage), u.quantity && g.quantity && (o.quantity = u.quantity), Object.keys(o).length > 0 ? o : void 0;
59
59
  }
60
60
  );
61
61
  h.some((u) => u !== void 0) && (a.itemErrors = h);
62
62
  }
63
63
  return a;
64
64
  }
65
- const $r = 5, Er = _(
65
+ const Er = 5, qr = j(
66
66
  "ds:@container/rxline ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
67
67
  {
68
68
  variants: {
@@ -74,65 +74,65 @@ const $r = 5, Er = _(
74
74
  defaultVariants: { separated: !1 }
75
75
  }
76
76
  );
77
- function qr({
77
+ function Cr({
78
78
  index: e,
79
79
  item: n,
80
80
  medication: a,
81
81
  medicationFieldId: h,
82
82
  dosageFieldId: u,
83
- quantityFieldId: k,
84
- medicationError: b,
85
- dosageError: c,
83
+ quantityFieldId: S,
84
+ medicationError: g,
85
+ dosageError: o,
86
86
  quantityError: N,
87
- announceMedicationError: C,
88
- announceDosageError: x,
89
- announceQuantityError: j,
87
+ announceMedicationError: q,
88
+ announceDosageError: k,
89
+ announceQuantityError: G,
90
90
  searchMedications: L,
91
- codeLabel: se,
91
+ codeLabel: ae,
92
92
  catalogueStatus: d,
93
- onCatalogueRetry: J,
94
- suggestions: D,
95
- onMedicationChange: E,
96
- onDosageChange: G,
97
- onNotesChange: ne,
98
- onQuantityChange: O,
99
- onDurationChange: m,
100
- onNotSubstitutableChange: $,
101
- medicationSearchId: F,
102
- medicationRef: V,
103
- dosageInputRef: Z,
104
- onSuggestionChosen: ee
93
+ onCatalogueRetry: X,
94
+ suggestions: F,
95
+ onMedicationChange: $,
96
+ onDosageChange: O,
97
+ onNotesChange: oe,
98
+ onQuantityChange: H,
99
+ onDurationChange: f,
100
+ onNotSubstitutableChange: T,
101
+ medicationSearchId: z,
102
+ medicationRef: A,
103
+ dosageInputRef: J,
104
+ onSuggestionChosen: Z
105
105
  }) {
106
- const { t: o } = Ie("ui"), H = e + 1, v = `${h}-legend`, S = D.slice(0, $r), s = `${h}-hint`;
107
- return /* @__PURE__ */ y(
106
+ const { t: w } = ve("ui"), c = e + 1, ee = `${h}-legend`, m = F.slice(0, Er), s = `${h}-hint`;
107
+ return /* @__PURE__ */ v(
108
108
  "div",
109
109
  {
110
110
  role: "group",
111
- "aria-labelledby": v,
111
+ "aria-labelledby": ee,
112
112
  "data-slot": "prescription-item",
113
113
  "data-index": e,
114
- className: Er({ separated: e > 0 }),
114
+ className: qr({ separated: e > 0 }),
115
115
  children: [
116
- /* @__PURE__ */ r("p", { id: v, className: "type-label ds:text-foreground", children: o("prescription.composer.medicationLegend", { number: H }) }),
116
+ /* @__PURE__ */ r("p", { id: ee, className: "type-label ds:text-foreground", children: w("prescription.composer.medicationLegend", { number: c }) }),
117
117
  /* @__PURE__ */ r(
118
118
  pe,
119
119
  {
120
120
  id: h,
121
- label: o("prescription.composer.medication"),
121
+ label: w("prescription.composer.medication"),
122
122
  required: !0,
123
- error: b,
124
- announceError: C,
123
+ error: g,
124
+ announceError: q,
125
125
  children: /* @__PURE__ */ r(
126
- rr,
126
+ ir,
127
127
  {
128
- ref: V,
129
- id: F,
128
+ ref: A,
129
+ id: z,
130
130
  loadOptions: L,
131
131
  value: a,
132
- onValueChange: E,
133
- codeLabel: se,
132
+ onValueChange: $,
133
+ codeLabel: ae,
134
134
  status: d,
135
- onRetry: J
135
+ onRetry: X
136
136
  }
137
137
  )
138
138
  }
@@ -141,115 +141,115 @@ function qr({
141
141
  pe,
142
142
  {
143
143
  id: u,
144
- label: o("prescription.composer.dosage"),
144
+ label: w("prescription.composer.dosage"),
145
145
  required: !0,
146
- error: c,
147
- announceError: x,
146
+ error: o,
147
+ announceError: k,
148
148
  children: /* @__PURE__ */ r(
149
149
  nt,
150
150
  {
151
- ref: Z,
151
+ ref: J,
152
152
  dir: "auto",
153
153
  value: n.dosage,
154
- onChange: (f) => G(f.target.value)
154
+ onChange: (b) => O(b.target.value)
155
155
  }
156
156
  )
157
157
  }
158
158
  ),
159
- a && S.length > 0 ? /* @__PURE__ */ y(
159
+ a && m.length > 0 ? /* @__PURE__ */ v(
160
160
  "div",
161
161
  {
162
162
  "data-slot": "dosage-suggestions",
163
163
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
164
164
  children: [
165
- /* @__PURE__ */ r("p", { id: s, className: "type-body-sm ds:text-muted-foreground", children: o("prescription.composer.dosageSuggestionsHint") }),
165
+ /* @__PURE__ */ r("p", { id: s, className: "type-body-sm ds:text-muted-foreground", children: w("prescription.composer.dosageSuggestionsHint") }),
166
166
  /* @__PURE__ */ r(
167
- ir,
167
+ sr,
168
168
  {
169
- label: o("prescription.composer.dosageSuggestions"),
169
+ label: w("prescription.composer.dosageSuggestions"),
170
170
  "aria-describedby": s,
171
- children: S.map((f) => /* @__PURE__ */ r(
172
- sr,
171
+ children: m.map((b) => /* @__PURE__ */ r(
172
+ nr,
173
173
  {
174
- value: f,
174
+ value: b,
175
175
  dir: "auto",
176
176
  keepOnSelect: !0,
177
- onSelect: ee,
178
- children: f
177
+ onSelect: Z,
178
+ children: b
179
179
  },
180
- f
180
+ b
181
181
  ))
182
182
  }
183
183
  )
184
184
  ]
185
185
  }
186
186
  ) : null,
187
- /* @__PURE__ */ y("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:@[576px]/rxline:grid-cols-[minmax(8rem,10rem)_minmax(0,1fr)_minmax(0,1fr)]", children: [
187
+ /* @__PURE__ */ v("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:@[576px]/rxline:grid-cols-[minmax(8rem,10rem)_minmax(0,1fr)_minmax(0,1fr)]", children: [
188
188
  /* @__PURE__ */ r(
189
189
  pe,
190
190
  {
191
- id: k,
192
- label: o("prescription.composer.quantity"),
191
+ id: S,
192
+ label: w("prescription.composer.quantity"),
193
193
  required: !0,
194
194
  description: a == null ? void 0 : a.packsHint,
195
195
  error: N,
196
- announceError: j,
196
+ announceError: G,
197
197
  children: /* @__PURE__ */ r(
198
- tr,
198
+ rr,
199
199
  {
200
200
  min: 1,
201
201
  max: a == null ? void 0 : a.maxPacks,
202
202
  step: 1,
203
203
  value: Number.isFinite(n.quantity) ? n.quantity : null,
204
- onChange: (f) => O(f ?? Number.NaN)
204
+ onChange: (b) => H(b ?? Number.NaN)
205
205
  }
206
206
  )
207
207
  }
208
208
  ),
209
- /* @__PURE__ */ r(pe, { label: o("prescription.composer.notes"), optional: !0, children: /* @__PURE__ */ r(
209
+ /* @__PURE__ */ r(pe, { label: w("prescription.composer.notes"), optional: !0, children: /* @__PURE__ */ r(
210
210
  nt,
211
211
  {
212
212
  dir: "auto",
213
213
  value: n.notes,
214
- onChange: (f) => ne(f.target.value)
214
+ onChange: (b) => oe(b.target.value)
215
215
  }
216
216
  ) }),
217
- /* @__PURE__ */ r(pe, { label: o("prescription.composer.duration"), optional: !0, children: /* @__PURE__ */ r(
217
+ /* @__PURE__ */ r(pe, { label: w("prescription.composer.duration"), optional: !0, children: /* @__PURE__ */ r(
218
218
  nt,
219
219
  {
220
220
  dir: "auto",
221
221
  value: n.duration,
222
- onChange: (f) => m(f.target.value)
222
+ onChange: (b) => f(b.target.value)
223
223
  }
224
224
  ) })
225
225
  ] }),
226
226
  /* @__PURE__ */ r(
227
- er,
227
+ tr,
228
228
  {
229
- label: o("prescription.composer.notSubstitutable"),
229
+ label: w("prescription.composer.notSubstitutable"),
230
230
  checked: n.notSubstitutable,
231
231
  disabled: !(a != null && a.code) && !n.notSubstitutable,
232
- disabledReason: o("prescription.composer.notSubstitutableNeedsCode"),
233
- onCheckedChange: (f) => $(f === !0)
232
+ disabledReason: w("prescription.composer.notSubstitutableNeedsCode"),
233
+ onCheckedChange: (b) => T(b === !0)
234
234
  }
235
235
  )
236
236
  ]
237
237
  }
238
238
  );
239
239
  }
240
- const Cr = /^(\d{4})-(\d{2})-(\d{2})$/;
241
- function Pr(e, n) {
242
- const a = Cr.exec(e);
240
+ const Pr = /^(\d{4})-(\d{2})-(\d{2})$/;
241
+ function Ar(e, n) {
242
+ const a = Pr.exec(e);
243
243
  if (!a) return e;
244
- const h = Number(a[1]), u = Number(a[2]), k = Number(a[3]), b = new Date(2e3, u - 1, k);
245
- return b.setFullYear(h), Number.isNaN(b.getTime()) || b.getMonth() !== u - 1 || b.getDate() !== k ? e : new Intl.DateTimeFormat(Oe(n), {
244
+ const h = Number(a[1]), u = Number(a[2]), S = Number(a[3]), g = new Date(2e3, u - 1, S);
245
+ return g.setFullYear(h), Number.isNaN(g.getTime()) || g.getMonth() !== u - 1 || g.getDate() !== S ? e : new Intl.DateTimeFormat(He(n), {
246
246
  dateStyle: "long"
247
- }).format(b);
247
+ }).format(g);
248
248
  }
249
- function Fe(e) {
249
+ function Re(e) {
250
250
  return e !== void 0 && e.trim() !== "";
251
251
  }
252
- const Ar = _("ds:@container/pblock ds:flex ds:items-start", {
252
+ const Mr = j("ds:@container/pblock ds:flex ds:items-start", {
253
253
  variants: {
254
254
  density: {
255
255
  default: "ds:gap-[var(--spacing-md)]",
@@ -257,46 +257,46 @@ const Ar = _("ds:@container/pblock ds:flex ds:items-start", {
257
257
  }
258
258
  },
259
259
  defaultVariants: { density: "default" }
260
- }), dt = Ge(
260
+ }), dt = Oe(
261
261
  ({
262
262
  patient: e,
263
263
  privacyMode: n = !1,
264
264
  density: a = "default",
265
265
  showAvatar: h = !1,
266
266
  className: u,
267
- ...k
268
- }, b) => {
269
- const { t: c, i18n: N } = Ie("ui"), C = () => /* @__PURE__ */ y(Be, { children: [
270
- /* @__PURE__ */ r(lt, { children: c("calendarWorkspace.privacy.hidden") }),
267
+ ...S
268
+ }, g) => {
269
+ const { t: o, i18n: N } = ve("ui"), q = () => /* @__PURE__ */ v(_e, { children: [
270
+ /* @__PURE__ */ r(lt, { children: o("calendarWorkspace.privacy.hidden") }),
271
271
  /* @__PURE__ */ r("span", { "aria-hidden": "true", children: ct() })
272
- ] }), x = [];
273
- Fe(e.firstName) && x.push({
272
+ ] }), k = [];
273
+ Re(e.firstName) && k.push({
274
274
  key: "firstName",
275
- label: c("prescription.patient.firstName"),
276
- value: n ? C() : /* @__PURE__ */ r("span", { dir: "auto", children: e.firstName })
277
- }), Fe(e.lastName) && x.push({
275
+ label: o("prescription.patient.firstName"),
276
+ value: n ? q() : /* @__PURE__ */ r("span", { dir: "auto", children: e.firstName })
277
+ }), Re(e.lastName) && k.push({
278
278
  key: "lastName",
279
- label: c("prescription.patient.lastName"),
280
- value: n ? C() : /* @__PURE__ */ r("span", { dir: "auto", children: e.lastName })
281
- }), Fe(e.dateOfBirth) && x.push({
279
+ label: o("prescription.patient.lastName"),
280
+ value: n ? q() : /* @__PURE__ */ r("span", { dir: "auto", children: e.lastName })
281
+ }), Re(e.dateOfBirth) && k.push({
282
282
  key: "dateOfBirth",
283
- label: c("prescription.patient.dateOfBirth"),
284
- value: n ? C() : Pr(e.dateOfBirth, N.language)
285
- }), Fe(e.fiscalCode) && x.push({
283
+ label: o("prescription.patient.dateOfBirth"),
284
+ value: n ? q() : Ar(e.dateOfBirth, N.language)
285
+ }), Re(e.fiscalCode) && k.push({
286
286
  key: "fiscalCode",
287
- label: c("prescription.patient.fiscalCode"),
288
- value: n ? C() : e.fiscalCode,
287
+ label: o("prescription.patient.fiscalCode"),
288
+ value: n ? q() : e.fiscalCode,
289
289
  mono: !0
290
290
  });
291
- const j = `${e.firstName} ${e.lastName}`.trim();
292
- return /* @__PURE__ */ y(
291
+ const G = `${e.firstName} ${e.lastName}`.trim();
292
+ return /* @__PURE__ */ v(
293
293
  "div",
294
294
  {
295
- ...k,
296
- ref: b,
295
+ ...S,
296
+ ref: g,
297
297
  role: "group",
298
- "aria-label": c("prescription.patient.details"),
299
- className: Ar({ density: a, className: u }),
298
+ "aria-label": o("prescription.patient.details"),
299
+ className: Mr({ density: a, className: u }),
300
300
  "data-component": "prescription-patient-block",
301
301
  "data-density": a,
302
302
  "data-privacy": n ? "masked" : void 0,
@@ -307,7 +307,7 @@ const Ar = _("ds:@container/pblock ds:flex ds:items-start", {
307
307
  /* @__PURE__ */ r(
308
308
  qt,
309
309
  {
310
- name: n ? "" : j,
310
+ name: n ? "" : G,
311
311
  size: "md",
312
312
  className: "ds:shrink-0",
313
313
  "aria-hidden": "true",
@@ -317,13 +317,13 @@ const Ar = _("ds:@container/pblock ds:flex ds:items-start", {
317
317
  )
318
318
  ) : null,
319
319
  /* @__PURE__ */ r(
320
- cr,
320
+ lr,
321
321
  {
322
322
  semantic: !0,
323
323
  rowGap: a === "compact" ? "sm" : "md",
324
324
  className: "ds:min-w-0 ds:flex-1 ds:@[448px]/pblock:grid-cols-[repeat(2,auto_fit-content(40%)_minmax(0,1fr))]",
325
- children: x.map((L) => /* @__PURE__ */ r(
326
- ie,
325
+ children: k.map((L) => /* @__PURE__ */ r(
326
+ ne,
327
327
  {
328
328
  label: L.label,
329
329
  value: L.value,
@@ -340,7 +340,7 @@ const Ar = _("ds:@container/pblock ds:flex ds:items-start", {
340
340
  }
341
341
  );
342
342
  dt.displayName = "PrescriptionPatientBlock";
343
- const je = Object.freeze({
343
+ const Ge = Object.freeze({
344
344
  medicationId: "",
345
345
  dosage: "",
346
346
  notes: "",
@@ -348,60 +348,60 @@ const je = Object.freeze({
348
348
  notSubstitutable: !1,
349
349
  duration: ""
350
350
  });
351
- function Mr(e = "") {
351
+ function Lr(e = "") {
352
352
  return {
353
353
  patientId: "",
354
354
  prescriberId: e,
355
355
  treatmentId: "",
356
- items: [{ ...je }]
356
+ items: [{ ...Ge }]
357
357
  };
358
358
  }
359
- function X(e) {
359
+ function U(e) {
360
360
  return e == null || e.trim() === "";
361
361
  }
362
362
  function ot(e) {
363
- return X(e.medicationId) && X(e.dosage) && X(e.notes) && X(e.duration) && !e.notSubstitutable;
363
+ return U(e.medicationId) && U(e.dosage) && U(e.notes) && U(e.duration) && !e.notSubstitutable;
364
364
  }
365
- function Lr(e, n) {
365
+ function Vr(e, n) {
366
366
  if (typeof e != "number" || Number.isNaN(e)) return "required";
367
367
  if (!Number.isInteger(e) || e < 1) return "invalid";
368
368
  if (n !== void 0 && e > n) return "tooMany";
369
369
  }
370
- function Vr(e, {
370
+ function Dr(e, {
371
371
  treatmentOptions: n,
372
372
  treatmentOptionsPatientId: a
373
373
  }) {
374
- if (X(e.treatmentId)) return "required";
374
+ if (U(e.treatmentId)) return "required";
375
375
  if (a !== void 0 && a !== e.patientId || n && !n.some((h) => h.id === e.treatmentId))
376
376
  return "invalid";
377
377
  }
378
378
  function kt(e, n = {}) {
379
379
  const a = {};
380
- X(e.patientId) && (a.patientId = "required"), X(e.prescriberId) && (a.prescriberId = "required");
381
- const h = Vr(e, n);
380
+ U(e.patientId) && (a.patientId = "required"), U(e.prescriberId) && (a.prescriberId = "required");
381
+ const h = Dr(e, n);
382
382
  h && (a.treatmentId = h);
383
383
  const u = e.items ?? [];
384
- if (u.filter((c) => !ot(c)).length === 0)
384
+ if (u.filter((o) => !ot(o)).length === 0)
385
385
  return a.items = "required", u.length > 0 && (a.itemErrors = u.map(
386
- (c, N) => N === 0 ? { medicationId: "required" } : void 0
386
+ (o, N) => N === 0 ? { medicationId: "required" } : void 0
387
387
  )), a;
388
- const b = u.map((c) => {
389
- var x;
390
- if (ot(c)) return;
388
+ const g = u.map((o) => {
389
+ var k;
390
+ if (ot(o)) return;
391
391
  const N = {};
392
- X(c.medicationId) && (N.medicationId = "required"), X(c.dosage) && (N.dosage = "required");
393
- const C = Lr(
394
- c.quantity,
395
- X(c.medicationId) || (x = n.maxPacksFor) == null ? void 0 : x.call(n, c.medicationId.trim())
392
+ U(o.medicationId) && (N.medicationId = "required"), U(o.dosage) && (N.dosage = "required");
393
+ const q = Vr(
394
+ o.quantity,
395
+ U(o.medicationId) || (k = n.maxPacksFor) == null ? void 0 : k.call(n, o.medicationId.trim())
396
396
  );
397
- return C && (N.quantity = C), Object.keys(N).length > 0 ? N : void 0;
397
+ return q && (N.quantity = q), Object.keys(N).length > 0 ? N : void 0;
398
398
  });
399
- return b.some((c) => c !== void 0) && (a.itemErrors = b), a;
399
+ return g.some((o) => o !== void 0) && (a.itemErrors = g), a;
400
400
  }
401
401
  function xt(e) {
402
402
  return Object.keys(e).length === 0;
403
403
  }
404
- function Dr(e) {
404
+ function Fr(e) {
405
405
  return {
406
406
  patientId: e.patientId.trim(),
407
407
  prescriberId: e.prescriberId.trim(),
@@ -416,72 +416,73 @@ function Dr(e) {
416
416
  }))
417
417
  };
418
418
  }
419
- const Fr = _(
419
+ const Rr = j(
420
420
  "ds:flex ds:w-full ds:flex-col ds:gap-[var(--spacing-lg)]"
421
421
  );
422
422
  function at(e) {
423
423
  return `${e.firstName} ${e.lastName}`.trim();
424
424
  }
425
425
  function Tt(e) {
426
- return e.items.length > 0 ? e : { ...e, items: [{ ...je }] };
426
+ return e.items.length > 0 ? e : { ...e, items: [{ ...Ge }] };
427
427
  }
428
- const Rr = Ge(function({
428
+ const zr = Oe(function({
429
429
  patients: n,
430
430
  searchPatients: a,
431
431
  treatmentOptions: h,
432
432
  treatmentOptionsPatientId: u,
433
- prescribers: k,
434
- defaultPrescriberId: b,
435
- searchMedications: c,
433
+ prescribers: S,
434
+ defaultPrescriberId: g,
435
+ searchMedications: o,
436
436
  resolveMedication: N,
437
- suggestDosages: C,
438
- codeLabel: x,
439
- catalogueStatus: j = "ready",
437
+ suggestDosages: q,
438
+ codeLabel: k,
439
+ catalogueStatus: G = "ready",
440
440
  onCatalogueRetry: L,
441
- value: se,
441
+ value: ae,
442
442
  defaultValue: d,
443
- onChange: J,
444
- onSubmit: D,
445
- onPatientChange: E,
446
- loading: G = !1,
447
- error: ne,
448
- privacyMode: O = !1,
449
- lockPatient: m = !1,
450
- submitLabel: $,
451
- id: F,
452
- className: V,
443
+ onChange: X,
444
+ onSubmit: F,
445
+ onPatientChange: $,
446
+ loading: O = !1,
447
+ error: oe,
448
+ privacyMode: H = !1,
449
+ lockPatient: f = !1,
450
+ editing: T = !1,
451
+ submitLabel: z,
452
+ id: A,
453
+ className: J,
453
454
  ...Z
454
- }, ee) {
455
- const { t: o } = Ie("ui"), H = ve(), v = F ?? H, [S] = U(
456
- () => d ?? Mr(
457
- b && k.some((t) => t.id === b) ? b : ""
455
+ }, w) {
456
+ const { t: c } = ve("ui"), ee = ye(), m = A ?? ee, [s] = Y(
457
+ () => d ?? Lr(
458
+ g && S.some((t) => t.id === g) ? g : ""
458
459
  )
459
- ), [s, f] = Xt({
460
- value: se,
461
- defaultValue: S,
462
- onChange: J
463
- }), T = Tt(s ?? S), q = w(T);
464
- Ee(() => {
465
- q.current = T;
460
+ ), [b, V] = Jt({
461
+ value: ae,
462
+ defaultValue: s,
463
+ onChange: X
464
+ }), B = Tt(b ?? s), E = x(B);
465
+ we(() => {
466
+ E.current = B;
466
467
  });
467
- const [R, K] = U({}), [Ne, ue] = U(!1), [me, Se] = U(!1), W = w(!1), ae = w(!0);
468
- qe(() => (ae.current = !0, () => {
469
- ae.current = !1;
468
+ const [R, K] = Y({}), [Ee, te] = Y(!1), [Ie, re] = Y(!1), ue = x(!1), D = x(!0);
469
+ $e(() => (D.current = !0, () => {
470
+ D.current = !1;
470
471
  }), []);
471
- const [z, He] = U(() => /* @__PURE__ */ new Map()), [Ke, Q] = U(() => /* @__PURE__ */ new Map()), ke = w(/* @__PURE__ */ new Map()), fe = w(N);
472
- Ee(() => {
473
- fe.current = N;
472
+ const [Ke, We] = Y(() => /* @__PURE__ */ new Map()), [W, qe] = Y(() => /* @__PURE__ */ new Map()), Ne = x(/* @__PURE__ */ new Map()), me = x(N);
473
+ we(() => {
474
+ me.current = N;
474
475
  });
475
- const oe = A(
476
+ const fe = P(
476
477
  (t) => {
477
478
  var i, l;
478
- return (l = ke.current.get(t) ?? ((i = fe.current) == null ? void 0 : i.call(fe, t))) == null ? void 0 : l.maxPacks;
479
+ return (l = Ne.current.get(t) ?? ((i = me.current) == null ? void 0 : i.call(me, t))) == null ? void 0 : l.maxPacks;
479
480
  },
480
481
  []
481
- ), xe = A(
482
+ ), y = P(
482
483
  (t) => {
483
- for (const i of t) ke.current.set(i.id, i);
484
- Q((i) => {
484
+ for (const i of t) Ne.current.set(i.id, i);
485
+ qe((i) => {
485
486
  if (t.every((p) => i.get(p.id) === p)) return i;
486
487
  const l = new Map(i);
487
488
  for (const p of t) l.set(p.id, p);
@@ -489,211 +490,211 @@ const Rr = Ge(function({
489
490
  });
490
491
  },
491
492
  []
492
- ), g = w(c);
493
- Ee(() => {
494
- g.current = c;
493
+ ), he = x(o);
494
+ we(() => {
495
+ he.current = o;
495
496
  });
496
- const be = A(
497
+ const Se = P(
497
498
  async (t, i) => {
498
- const l = await g.current(t, i);
499
- return i.signal.aborted || xe(l), l;
499
+ const l = await he.current(t, i);
500
+ return i.signal.aborted || y(l), l;
500
501
  },
501
- [xe]
502
- ), ge = w(a);
503
- Ee(() => {
504
- ge.current = a;
502
+ [y]
503
+ ), ke = x(a);
504
+ we(() => {
505
+ ke.current = a;
505
506
  });
506
- const Te = a !== void 0, We = _e(() => {
507
- if (Te)
507
+ const Ce = a !== void 0, At = je(() => {
508
+ if (Ce)
508
509
  return async (t, i) => {
509
- const l = ge.current, p = l ? await l(t, i) : [];
510
- return i.signal.aborted || He((M) => {
511
- const Y = new Map(M);
512
- for (const le of p) Y.set(le.id, le);
513
- return Y;
510
+ const l = ke.current, p = l ? await l(t, i) : [];
511
+ return i.signal.aborted || We((M) => {
512
+ const Q = new Map(M);
513
+ for (const le of p) Q.set(le.id, le);
514
+ return Q;
514
515
  }), p.map((M) => ({ id: M.id, name: at(M) }));
515
516
  };
516
- }, [Te]), ce = T.patientId, we = ce ? (n == null ? void 0 : n.find((t) => t.id === ce)) ?? z.get(ce) : void 0, P = A(
517
+ }, [Ce]), ce = B.patientId, xe = ce ? (n == null ? void 0 : n.find((t) => t.id === ce)) ?? Ke.get(ce) : void 0, C = P(
517
518
  (t) => {
518
- q.current = t, f(t), K(
519
- (i) => Object.keys(i).length === 0 ? i : wr(
519
+ E.current = t, V(t), K(
520
+ (i) => Object.keys(i).length === 0 ? i : $r(
520
521
  i,
521
522
  kt(t, {
522
523
  treatmentOptions: h,
523
524
  treatmentOptionsPatientId: u,
524
- maxPacksFor: oe
525
+ maxPacksFor: fe
525
526
  })
526
527
  )
527
528
  );
528
529
  },
529
- [f, h, u, oe]
530
- ), Qe = A(
530
+ [V, h, u, fe]
531
+ ), Qe = P(
531
532
  (t) => {
532
- const i = q.current;
533
- t !== i.patientId && (K({}), ue(!1), P({
533
+ const i = E.current;
534
+ t !== i.patientId && (K({}), te(!1), C({
534
535
  patientId: t,
535
536
  prescriberId: i.prescriberId,
536
537
  treatmentId: "",
537
- items: [{ ...je }]
538
- }), E == null || E(t));
538
+ items: [{ ...Ge }]
539
+ }), $ == null || $(t));
539
540
  },
540
- [P, E]
541
- ), pt = w(!1), Ye = A(
541
+ [C, $]
542
+ ), pt = x(!1), Ye = P(
542
543
  (t) => {
543
- pt.current = !0, P({ ...q.current, prescriberId: t });
544
+ pt.current = !0, C({ ...E.current, prescriberId: t });
544
545
  },
545
- [P]
546
- ), ut = w(!1);
547
- qe(() => {
548
- if (ut.current || pt.current || !b || !k.some((i) => i.id === b))
546
+ [C]
547
+ ), ut = x(!1);
548
+ $e(() => {
549
+ if (ut.current || pt.current || !g || !S.some((i) => i.id === g))
549
550
  return;
550
551
  ut.current = !0;
551
- const t = q.current;
552
- t.prescriberId === "" && P({ ...t, prescriberId: b });
553
- }, [b, k, P]);
554
- const Ue = A(
555
- (t) => P({ ...q.current, treatmentId: t }),
556
- [P]
557
- ), te = A(
552
+ const t = E.current;
553
+ t.prescriberId === "" && C({ ...t, prescriberId: g });
554
+ }, [g, S, C]);
555
+ const Ue = P(
556
+ (t) => C({ ...E.current, treatmentId: t }),
557
+ [C]
558
+ ), ie = P(
558
559
  (t, i) => {
559
- const l = q.current;
560
- t < 0 || t >= l.items.length || P({
560
+ const l = E.current;
561
+ t < 0 || t >= l.items.length || C({
561
562
  ...l,
562
563
  items: l.items.map((p, M) => {
563
564
  if (M !== t) return p;
564
- const Y = i.medicationId !== void 0 && i.medicationId !== p.medicationId;
565
+ const Q = i.medicationId !== void 0 && i.medicationId !== p.medicationId;
565
566
  return {
566
567
  ...p,
567
- ...Y ? { notSubstitutable: !1 } : {},
568
+ ...Q ? { notSubstitutable: !1 } : {},
568
569
  ...i
569
570
  };
570
571
  })
571
572
  });
572
573
  },
573
- [P]
574
- ), Xe = A(
574
+ [C]
575
+ ), Xe = P(
575
576
  (t) => {
576
- const i = q.current;
577
- return P({
577
+ const i = E.current;
578
+ return C({
578
579
  ...i,
579
- items: [...i.items, { ...je, ...t }]
580
+ items: [...i.items, { ...Ge, ...t }]
580
581
  }), i.items.length;
581
582
  },
582
- [P]
583
- ), Je = A(
583
+ [C]
584
+ ), Je = P(
584
585
  (t) => {
585
- const i = q.current;
586
- i.items.length <= 1 || t < 0 || t >= i.items.length || P({
586
+ const i = E.current;
587
+ i.items.length <= 1 || t < 0 || t >= i.items.length || C({
587
588
  ...i,
588
589
  items: i.items.filter((l, p) => p !== t)
589
590
  });
590
591
  },
591
- [P]
592
- ), mt = w(null), Ze = w(/* @__PURE__ */ new Map()), et = w(/* @__PURE__ */ new Map()), [ye, Ce] = U(null);
593
- qe(() => {
592
+ [C]
593
+ ), mt = x(null), Ze = x(/* @__PURE__ */ new Map()), et = x(/* @__PURE__ */ new Map()), [ge, Pe] = Y(null);
594
+ $e(() => {
594
595
  var t, i, l, p;
595
- ye && (ye.kind === "medication" ? (t = Ze.current.get(ye.index)) == null || t.focus() : ye.kind === "dosage" ? (i = et.current.get(ye.index)) == null || i.focus() : (p = (l = document.getElementById(`${v}-items`)) == null ? void 0 : l.querySelector(":scope > button")) == null || p.focus(), Ce(null));
596
- }, [ye, v]);
597
- const At = (t) => {
598
- const i = q.current.items.length;
599
- Je(t), !(i <= 1) && Ce(
596
+ ge && (ge.kind === "medication" ? (t = Ze.current.get(ge.index)) == null || t.focus() : ge.kind === "dosage" ? (i = et.current.get(ge.index)) == null || i.focus() : (p = (l = document.getElementById(`${m}-items`)) == null ? void 0 : l.querySelector(":scope > button")) == null || p.focus(), Pe(null));
597
+ }, [ge, m]);
598
+ const Mt = (t) => {
599
+ const i = E.current.items.length;
600
+ Je(t), !(i <= 1) && Pe(
600
601
  i - 1 === 1 ? { kind: "add" } : { kind: "medication", index: Math.min(t, i - 2) }
601
602
  );
602
603
  }, ft = (t) => {
603
604
  var i;
604
- return o("prescription.composer.errors.quantityMax", {
605
- max: oe(((i = T.items[t]) == null ? void 0 : i.medicationId) ?? "")
605
+ return c("prescription.composer.errors.quantityMax", {
606
+ max: fe(((i = B.items[t]) == null ? void 0 : i.medicationId) ?? "")
606
607
  });
607
- }, re = (t) => {
608
+ }, se = (t) => {
608
609
  var M;
609
610
  if (t === "patient")
610
- return R.patientId ? o("prescription.composer.errors.patient") : void 0;
611
+ return R.patientId ? c("prescription.composer.errors.patient") : void 0;
611
612
  if (t === "prescriber")
612
- return R.prescriberId ? o("prescription.composer.errors.prescriber") : void 0;
613
+ return R.prescriberId ? c("prescription.composer.errors.prescriber") : void 0;
613
614
  if (t === "treatment")
614
- return R.treatmentId ? R.treatmentId === "invalid" ? o("prescription.composer.errors.treatmentInvalid") : o("prescription.composer.errors.treatment") : void 0;
615
+ return R.treatmentId ? R.treatmentId === "invalid" ? c("prescription.composer.errors.treatmentInvalid") : c("prescription.composer.errors.treatment") : void 0;
615
616
  if (t === "items")
616
- return R.items ? o("prescription.composer.errors.items") : void 0;
617
+ return R.items ? c("prescription.composer.errors.items") : void 0;
617
618
  const [i, l] = t.split(":"), p = (M = R.itemErrors) == null ? void 0 : M[Number(l)];
618
- return i === "medication" ? p != null && p.medicationId && !R.items ? o("prescription.composer.errors.medication") : void 0 : i === "quantity" ? p != null && p.quantity ? p.quantity === "tooMany" ? ft(Number(l)) : p.quantity === "invalid" ? o("prescription.composer.errors.quantityInvalid") : o("prescription.composer.errors.quantity") : void 0 : p != null && p.dosage ? o("prescription.composer.errors.dosage") : void 0;
619
- }, Mt = [
619
+ return i === "medication" ? p != null && p.medicationId && !R.items ? c("prescription.composer.errors.medication") : void 0 : i === "quantity" ? p != null && p.quantity ? p.quantity === "tooMany" ? ft(Number(l)) : p.quantity === "invalid" ? c("prescription.composer.errors.quantityInvalid") : c("prescription.composer.errors.quantity") : void 0 : p != null && p.dosage ? c("prescription.composer.errors.dosage") : void 0;
620
+ }, Lt = [
620
621
  "patient",
621
622
  "treatment",
622
623
  "prescriber",
623
624
  "items",
624
- ...T.items.flatMap((t, i) => [
625
+ ...B.items.flatMap((t, i) => [
625
626
  `medication:${i}`,
626
627
  `dosage:${i}`,
627
628
  `quantity:${i}`
628
629
  ])
629
- ], B = Jt(Mt, re), ht = B.listed.length > 0, Lt = (t) => {
630
- if (t === "items") return `${v}-medication-0`;
630
+ ], _ = Zt(Lt, se), ht = _.listed.length > 0, Vt = (t) => {
631
+ if (t === "items") return `${m}-medication-0`;
631
632
  const [i, l] = t.split(":");
632
- return l === void 0 ? `${v}-${t}` : `${v}-${i}-${l}`;
633
- }, Vt = (t) => {
634
- var p, M, Y, le;
633
+ return l === void 0 ? `${m}-${t}` : `${m}-${i}-${l}`;
634
+ }, Dt = (t) => {
635
+ var p, M, Q, le;
635
636
  const [i, l] = t.split(":");
636
- return i === "medication" ? o("prescription.composer.errors.medicationLine", {
637
+ return i === "medication" ? c("prescription.composer.errors.medicationLine", {
637
638
  number: Number(l) + 1
638
- }) : i === "dosage" ? o("prescription.composer.errors.dosageLine", {
639
+ }) : i === "dosage" ? c("prescription.composer.errors.dosageLine", {
639
640
  number: Number(l) + 1
640
- }) : i === "quantity" ? ((M = (p = R.itemErrors) == null ? void 0 : p[Number(l)]) == null ? void 0 : M.quantity) === "tooMany" ? ft(Number(l)) : ((le = (Y = R.itemErrors) == null ? void 0 : Y[Number(l)]) == null ? void 0 : le.quantity) === "invalid" ? o("prescription.composer.errors.quantityInvalidLine", {
641
+ }) : i === "quantity" ? ((M = (p = R.itemErrors) == null ? void 0 : p[Number(l)]) == null ? void 0 : M.quantity) === "tooMany" ? ft(Number(l)) : ((le = (Q = R.itemErrors) == null ? void 0 : Q[Number(l)]) == null ? void 0 : le.quantity) === "invalid" ? c("prescription.composer.errors.quantityInvalidLine", {
641
642
  number: Number(l) + 1
642
- }) : o("prescription.composer.errors.quantityLine", {
643
+ }) : c("prescription.composer.errors.quantityLine", {
643
644
  number: Number(l) + 1
644
- }) : re(t) ?? "";
645
- }, Pe = A(
645
+ }) : se(t) ?? "";
646
+ }, Ae = P(
646
647
  (t) => {
647
- K(t), B.open();
648
+ K(t), _.open();
648
649
  },
649
650
  // eslint-disable-next-line react-hooks/exhaustive-deps
650
- [B.open]
651
- ), Ae = A(
652
- () => kt(q.current, {
651
+ [_.open]
652
+ ), Me = P(
653
+ () => kt(E.current, {
653
654
  treatmentOptions: h,
654
655
  treatmentOptionsPatientId: u,
655
- maxPacksFor: oe
656
+ maxPacksFor: fe
656
657
  }),
657
- [h, u, oe]
658
- ), bt = w(D);
659
- Ee(() => {
660
- bt.current = D;
658
+ [h, u, fe]
659
+ ), bt = x(F);
660
+ we(() => {
661
+ bt.current = F;
661
662
  });
662
- const tt = A(async () => {
663
- if (W.current) return;
664
- const t = Ae();
663
+ const tt = P(async () => {
664
+ if (ue.current) return;
665
+ const t = Me();
665
666
  if (!xt(t)) {
666
- Pe(t);
667
+ Ae(t);
667
668
  return;
668
669
  }
669
- K({}), ue(!1), W.current = !0, Se(!0);
670
+ K({}), te(!1), ue.current = !0, re(!0);
670
671
  try {
671
672
  return await bt.current(
672
- Dr(q.current)
673
+ Fr(E.current)
673
674
  ) ?? void 0;
674
675
  } catch {
675
- ae.current && ue(!0);
676
+ D.current && te(!0);
676
677
  return;
677
678
  } finally {
678
- W.current = !1, ae.current && Se(!1);
679
+ ue.current = !1, D.current && re(!1);
679
680
  }
680
- }, [Ae, Pe]), gt = A(() => {
681
- const t = q.current;
682
- K({}), ue(!1), P(Tt(S)), t.patientId !== S.patientId && (E == null || E(S.patientId));
683
- }, [P, S, E]);
681
+ }, [Me, Ae]), gt = P(() => {
682
+ const t = E.current;
683
+ K({}), te(!1), C(Tt(s)), t.patientId !== s.patientId && ($ == null || $(s.patientId));
684
+ }, [C, s, $]);
684
685
  Et(
685
- ee,
686
+ w,
686
687
  () => ({
687
- getDraft: () => q.current,
688
+ getDraft: () => E.current,
688
689
  setPatient: Qe,
689
690
  setPrescriber: Ye,
690
691
  setTreatment: Ue,
691
692
  addItem: Xe,
692
- updateItem: te,
693
+ updateItem: ie,
693
694
  removeItem: Je,
694
695
  validate: () => {
695
- const t = Ae();
696
- return xt(t) ? K({}) : Pe(t), t;
696
+ const t = Me();
697
+ return xt(t) ? K({}) : Ae(t), t;
697
698
  },
698
699
  submit: tt,
699
700
  reset: gt,
@@ -707,36 +708,36 @@ const Rr = Ge(function({
707
708
  Ye,
708
709
  Ue,
709
710
  Xe,
710
- te,
711
+ ie,
711
712
  Je,
713
+ Me,
712
714
  Ae,
713
- Pe,
714
715
  tt,
715
716
  gt
716
717
  ]
717
718
  );
718
- const Me = ne ?? (Ne ? o("prescription.composer.errors.submit") : void 0), Dt = Zt(Me, ht), Ft = m && we !== void 0, yt = `${v}-message`, [Rt, zt] = U("");
719
- qe(() => {
720
- zt(G ? o("prescription.composer.loading") : "");
721
- }, [G, o]);
722
- const Bt = {
719
+ const Le = oe ?? (Ee ? c("prescription.composer.errors.submit") : void 0), Ft = er(Le, ht), Rt = f && xe !== void 0, yt = `${m}-message`, [zt, Bt] = Y("");
720
+ $e(() => {
721
+ Bt(O ? c("prescription.composer.loading") : "");
722
+ }, [O, c]);
723
+ const _t = {
723
724
  ...Z,
724
725
  "data-component": "prescription-composer",
725
- "data-component-id": F,
726
+ "data-component-id": A,
726
727
  "data-has-patient": ce !== "" ? !0 : void 0,
727
- "data-submitting": me ? !0 : void 0
728
- }, _t = Fr({ className: V }), jt = (n ?? []).map((t) => ({
728
+ "data-submitting": Ie ? !0 : void 0
729
+ }, jt = Rr({ className: J }), Gt = (n ?? []).map((t) => ({
729
730
  id: t.id,
730
731
  name: at(t)
731
- })), Gt = !O && we ? at(we) : void 0, rt = u !== void 0 && u !== ce, Le = rt ? [] : h ?? [], $e = [];
732
- for (const t of Le)
733
- t.carePlan && !$e.some((i) => {
732
+ })), Ot = !H && xe ? at(xe) : void 0, rt = u !== void 0 && u !== ce, Ve = rt ? [] : h ?? [], Te = [];
733
+ for (const t of Ve)
734
+ t.carePlan && !Te.some((i) => {
734
735
  var l;
735
736
  return i.id === ((l = t.carePlan) == null ? void 0 : l.id);
736
- }) && $e.push(t.carePlan);
737
- const Ot = (t) => {
738
- const i = $e.filter((p) => p.label === t.label), l = i.length > 1 ? `${t.label} (${i.findIndex((p) => p.id === t.id) + 1})` : t.label;
739
- return o("prescription.composer.carePlanGroup", {
737
+ }) && Te.push(t.carePlan);
738
+ const Ht = (t) => {
739
+ const i = Te.filter((p) => p.label === t.label), l = i.length > 1 ? `${t.label} (${i.findIndex((p) => p.id === t.id) + 1})` : t.label;
740
+ return c("prescription.composer.carePlanGroup", {
740
741
  label: `⁨${l}⁩`
741
742
  });
742
743
  }, it = (t, i) => ({
@@ -744,134 +745,134 @@ const Rr = Ge(function({
744
745
  label: t.label,
745
746
  group: i,
746
747
  dir: "auto"
747
- }), vt = $e.length === 0 ? Le.map((t) => it(t, void 0)) : [
748
- ...$e.flatMap(
749
- (t) => Le.filter((i) => {
748
+ }), vt = Te.length === 0 ? Ve.map((t) => it(t, void 0)) : [
749
+ ...Te.flatMap(
750
+ (t) => Ve.filter((i) => {
750
751
  var l;
751
752
  return ((l = i.carePlan) == null ? void 0 : l.id) === t.id;
752
- }).map((i) => it(i, Ot(t)))
753
+ }).map((i) => it(i, Ht(t)))
753
754
  ),
754
- ...Le.filter((t) => !t.carePlan).map(
755
+ ...Ve.filter((t) => !t.carePlan).map(
755
756
  (t) => it(
756
757
  t,
757
- o("prescription.composer.treatmentsStandalone")
758
+ c("prescription.composer.treatmentsStandalone")
758
759
  )
759
760
  )
760
- ], Ht = k.map((t) => ({
761
+ ], Kt = S.map((t) => ({
761
762
  value: t.id,
762
763
  label: t.name,
763
764
  description: t.specialty,
764
765
  dir: "auto"
765
- })), Kt = (t) => {
766
+ })), Wt = (t) => {
766
767
  t.preventDefault(), tt();
767
- }, It = Me ? /* @__PURE__ */ r(he, { id: yt, variant: "error", announce: Dt, children: /* @__PURE__ */ r(he.Description, { children: Me }) }) : null;
768
- return /* @__PURE__ */ y("div", { ...Bt, className: _t, children: [
769
- /* @__PURE__ */ r("div", { role: "status", className: "ds:sr-only", children: Rt }),
770
- G ? /* @__PURE__ */ y(
768
+ }, It = Le ? /* @__PURE__ */ r(be, { id: yt, variant: "error", announce: Ft, children: /* @__PURE__ */ r(be.Description, { children: Le }) }) : null;
769
+ return /* @__PURE__ */ v("div", { ..._t, className: jt, children: [
770
+ /* @__PURE__ */ r("div", { role: "status", className: "ds:sr-only", children: zt }),
771
+ O ? /* @__PURE__ */ v(
771
772
  "div",
772
773
  {
773
774
  "aria-hidden": "true",
774
775
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]",
775
776
  children: [
776
- /* @__PURE__ */ r(Ve, { variant: "rounded", size: "sm" }),
777
- /* @__PURE__ */ r(Ve, { variant: "text", lines: 3 }),
778
- /* @__PURE__ */ r(Ve, { variant: "rounded", size: "sm" }),
779
- /* @__PURE__ */ r(Ve, { variant: "rounded", size: "lg" })
777
+ /* @__PURE__ */ r(De, { variant: "rounded", size: "sm" }),
778
+ /* @__PURE__ */ r(De, { variant: "text", lines: 3 }),
779
+ /* @__PURE__ */ r(De, { variant: "rounded", size: "sm" }),
780
+ /* @__PURE__ */ r(De, { variant: "rounded", size: "lg" })
780
781
  ]
781
782
  }
782
- ) : /* @__PURE__ */ y(
783
+ ) : /* @__PURE__ */ v(
783
784
  "form",
784
785
  {
785
786
  noValidate: !0,
786
- onSubmit: Kt,
787
- "aria-labelledby": `${v}-title`,
787
+ onSubmit: Wt,
788
+ "aria-labelledby": `${m}-title`,
788
789
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]",
789
790
  children: [
790
791
  /* @__PURE__ */ r(
791
792
  "h2",
792
793
  {
793
794
  ref: mt,
794
- id: `${v}-title`,
795
+ id: `${m}-title`,
795
796
  tabIndex: -1,
796
797
  className: "type-title-section ds:m-0 ds:focus:outline-none",
797
- children: o("prescription.composer.title")
798
+ children: c(T ? "prescription.composer.editTitle" : "prescription.composer.title")
798
799
  }
799
800
  ),
800
801
  ht ? /* @__PURE__ */ r(
801
- Qt,
802
+ Yt,
802
803
  {
803
- ref: B.ref,
804
- title: o("prescription.composer.errorTitle"),
804
+ ref: _.ref,
805
+ title: c("prescription.composer.errorTitle"),
805
806
  headingLevel: 3,
806
- "aria-describedby": Me ? yt : void 0,
807
- errors: B.listed.map((t) => ({
807
+ "aria-describedby": Le ? yt : void 0,
808
+ errors: _.listed.map((t) => ({
808
809
  field: t,
809
- message: Vt(t),
810
- targetId: Lt(t)
810
+ message: Dt(t),
811
+ targetId: Vt(t)
811
812
  }))
812
813
  }
813
814
  ) : null,
814
- Ft ? null : /* @__PURE__ */ r(
815
+ Rt ? null : /* @__PURE__ */ r(
815
816
  pe,
816
817
  {
817
- id: `${v}-patient`,
818
- label: o("prescription.composer.patient"),
818
+ id: `${m}-patient`,
819
+ label: c("prescription.composer.patient"),
819
820
  required: !0,
820
- description: O && ce !== "" ? o("calendarWorkspace.privacy.hidden") : void 0,
821
- error: re("patient"),
822
- announceError: !B.lists("patient"),
821
+ description: H && ce !== "" ? c("calendarWorkspace.privacy.hidden") : void 0,
822
+ error: se("patient"),
823
+ announceError: !_.lists("patient"),
823
824
  children: /* @__PURE__ */ r(
824
- Ut,
825
+ Xt,
825
826
  {
826
827
  value: ce,
827
828
  onValueChange: Qe,
828
- patients: jt,
829
- searchPatients: We,
830
- selectedLabel: Gt,
831
- privacyMask: O ? ct() : void 0,
832
- placeholder: o("prescription.composer.patientPlaceholder")
829
+ patients: Gt,
830
+ searchPatients: At,
831
+ selectedLabel: Ot,
832
+ privacyMask: H ? ct() : void 0,
833
+ placeholder: c("prescription.composer.patientPlaceholder")
833
834
  }
834
835
  )
835
836
  }
836
837
  ),
837
- ce === "" ? /* @__PURE__ */ y(Be, { children: [
838
+ ce === "" ? /* @__PURE__ */ v(_e, { children: [
838
839
  /* @__PURE__ */ r(
839
- Wt,
840
+ Qt,
840
841
  {
841
842
  variant: "first-use",
842
843
  size: "sm",
843
- title: o("prescription.composer.choosePatientTitle"),
844
- description: o("prescription.composer.choosePatientBody")
844
+ title: c("prescription.composer.choosePatientTitle"),
845
+ description: c("prescription.composer.choosePatientBody")
845
846
  }
846
847
  ),
847
848
  It
848
- ] }) : /* @__PURE__ */ y(Be, { children: [
849
- we ? /* @__PURE__ */ r(
849
+ ] }) : /* @__PURE__ */ v(_e, { children: [
850
+ xe ? /* @__PURE__ */ r(
850
851
  dt,
851
852
  {
852
- patient: we,
853
- privacyMode: O,
853
+ patient: xe,
854
+ privacyMode: H,
854
855
  showAvatar: !0
855
856
  }
856
857
  ) : null,
857
858
  /* @__PURE__ */ r(
858
859
  pe,
859
860
  {
860
- id: `${v}-treatment`,
861
- label: o("prescription.composer.treatment"),
861
+ id: `${m}-treatment`,
862
+ label: c("prescription.composer.treatment"),
862
863
  required: !0,
863
- description: vt.length === 0 && !rt ? o("prescription.composer.treatmentEmpty") : void 0,
864
- error: re("treatment"),
865
- announceError: !B.lists("treatment"),
864
+ description: vt.length === 0 && !rt ? c("prescription.composer.treatmentEmpty") : void 0,
865
+ error: se("treatment"),
866
+ announceError: !_.lists("treatment"),
866
867
  children: /* @__PURE__ */ r(
867
868
  Nt,
868
869
  {
869
870
  options: vt,
870
- value: T.treatmentId,
871
+ value: B.treatmentId,
871
872
  onValueChange: Ue,
872
- id: `${v}-treatment-select`,
873
+ id: `${m}-treatment-select`,
873
874
  disabled: rt,
874
- placeholder: o("prescription.composer.treatmentPlaceholder")
875
+ placeholder: c("prescription.composer.treatmentPlaceholder")
875
876
  }
876
877
  )
877
878
  }
@@ -879,77 +880,77 @@ const Rr = Ge(function({
879
880
  /* @__PURE__ */ r(
880
881
  pe,
881
882
  {
882
- id: `${v}-prescriber`,
883
- label: o("prescription.composer.prescriber"),
883
+ id: `${m}-prescriber`,
884
+ label: c("prescription.composer.prescriber"),
884
885
  required: !0,
885
- error: re("prescriber"),
886
- announceError: !B.lists("prescriber"),
886
+ error: se("prescriber"),
887
+ announceError: !_.lists("prescriber"),
887
888
  children: /* @__PURE__ */ r(
888
889
  Nt,
889
890
  {
890
- options: Ht,
891
- value: T.prescriberId,
891
+ options: Kt,
892
+ value: B.prescriberId,
892
893
  onValueChange: Ye,
893
- id: `${v}-prescriber-select`,
894
- placeholder: o("prescription.composer.prescriberPlaceholder"),
894
+ id: `${m}-prescriber-select`,
895
+ placeholder: c("prescription.composer.prescriberPlaceholder"),
895
896
  showDescriptions: !0
896
897
  }
897
898
  )
898
899
  }
899
900
  ),
900
901
  /* @__PURE__ */ r(
901
- Yt,
902
+ Ut,
902
903
  {
903
- id: `${v}-items`,
904
+ id: `${m}-items`,
904
905
  className: "ds:gap-[var(--spacing-lg)] ds:[&>legend]:[--type-label-size:var(--type-title-item-size)] ds:[&>legend]:[--type-label-weight:var(--type-title-item-weight)] ds:[&>legend]:[--type-label-line-height:var(--type-title-item-line-height)]",
905
- legend: o("prescription.composer.medications"),
906
- items: T.items,
906
+ legend: c("prescription.composer.medications"),
907
+ items: B.items,
907
908
  min: 1,
908
- addLabel: o("prescription.composer.addMedication"),
909
- removeItemLabel: (t) => o("prescription.composer.removeMedication", {
909
+ addLabel: c("prescription.composer.addMedication"),
910
+ removeItemLabel: (t) => c("prescription.composer.removeMedication", {
910
911
  number: t + 1
911
912
  }),
912
913
  onAdd: () => {
913
914
  const t = Xe();
914
- Ce({ kind: "medication", index: t });
915
+ Pe({ kind: "medication", index: t });
915
916
  },
916
- onRemove: At,
917
+ onRemove: Mt,
917
918
  renderItem: (t, i) => {
918
- const l = t.medicationId ? Ke.get(t.medicationId) ?? (N == null ? void 0 : N(t.medicationId)) ?? null : null, p = `medication:${i}`, M = `dosage:${i}`, Y = `quantity:${i}`, le = i === 0 ? re("items") : void 0;
919
+ const l = t.medicationId ? W.get(t.medicationId) ?? (N == null ? void 0 : N(t.medicationId)) ?? null : null, p = `medication:${i}`, M = `dosage:${i}`, Q = `quantity:${i}`, le = i === 0 ? se("items") : void 0;
919
920
  return /* @__PURE__ */ r(
920
- qr,
921
+ Cr,
921
922
  {
922
923
  index: i,
923
924
  item: t,
924
925
  medication: l,
925
- medicationFieldId: `${v}-medication-${i}`,
926
- dosageFieldId: `${v}-dosage-${i}`,
927
- quantityFieldId: `${v}-quantity-${i}`,
928
- medicationError: le ?? re(p),
929
- dosageError: re(M),
930
- quantityError: re(Y),
931
- announceMedicationError: !B.lists(le ? "items" : p),
932
- announceDosageError: !B.lists(M),
933
- announceQuantityError: !B.lists(Y),
934
- searchMedications: be,
935
- codeLabel: x,
936
- catalogueStatus: j,
926
+ medicationFieldId: `${m}-medication-${i}`,
927
+ dosageFieldId: `${m}-dosage-${i}`,
928
+ quantityFieldId: `${m}-quantity-${i}`,
929
+ medicationError: le ?? se(p),
930
+ dosageError: se(M),
931
+ quantityError: se(Q),
932
+ announceMedicationError: !_.lists(le ? "items" : p),
933
+ announceDosageError: !_.lists(M),
934
+ announceQuantityError: !_.lists(Q),
935
+ searchMedications: Se,
936
+ codeLabel: k,
937
+ catalogueStatus: G,
937
938
  onCatalogueRetry: L,
938
- suggestions: l && C ? C(l) : [],
939
+ suggestions: l && q ? q(l) : [],
939
940
  onMedicationChange: (I) => {
940
- I && xe([I]);
941
+ I && y([I]);
941
942
  const st = I == null ? void 0 : I.maxPacks;
942
- te(i, {
943
+ ie(i, {
943
944
  medicationId: (I == null ? void 0 : I.id) ?? "",
944
945
  ...st !== void 0 && t.quantity > st ? { quantity: st } : {}
945
946
  });
946
947
  },
947
- onDosageChange: (I) => te(i, { dosage: I }),
948
- onNotesChange: (I) => te(i, { notes: I }),
949
- onQuantityChange: (I) => te(i, { quantity: I }),
950
- onDurationChange: (I) => te(i, { duration: I }),
951
- onNotSubstitutableChange: (I) => te(i, { notSubstitutable: I }),
952
- medicationSearchId: `${v}-medication-${i}-search`,
948
+ onDosageChange: (I) => ie(i, { dosage: I }),
949
+ onNotesChange: (I) => ie(i, { notes: I }),
950
+ onQuantityChange: (I) => ie(i, { quantity: I }),
951
+ onDurationChange: (I) => ie(i, { duration: I }),
952
+ onNotSubstitutableChange: (I) => ie(i, { notSubstitutable: I }),
953
+ medicationSearchId: `${m}-medication-${i}-search`,
953
954
  medicationRef: (I) => {
954
955
  I ? Ze.current.set(i, I) : Ze.current.delete(i);
955
956
  },
@@ -957,7 +958,7 @@ const Rr = Ge(function({
957
958
  I ? et.current.set(i, I) : et.current.delete(i);
958
959
  },
959
960
  onSuggestionChosen: (I) => {
960
- te(i, { dosage: I }), Ce({ kind: "dosage", index: i });
961
+ ie(i, { dosage: I }), Pe({ kind: "dosage", index: i });
961
962
  }
962
963
  }
963
964
  );
@@ -966,12 +967,12 @@ const Rr = Ge(function({
966
967
  ),
967
968
  It,
968
969
  /* @__PURE__ */ r(
969
- Re,
970
+ ze,
970
971
  {
971
972
  type: "submit",
972
- loading: me,
973
+ loading: Ie,
973
974
  className: "ds:self-start ds:min-h-[var(--min-target-size)]",
974
- children: $ ?? o("prescription.composer.save")
975
+ children: z ?? c("prescription.composer.save")
975
976
  }
976
977
  )
977
978
  ] })
@@ -980,8 +981,8 @@ const Rr = Ge(function({
980
981
  )
981
982
  ] });
982
983
  });
983
- Rr.displayName = "PrescriptionComposer";
984
- const zr = {
984
+ zr.displayName = "PrescriptionComposer";
985
+ const Br = {
985
986
  sent: "success",
986
987
  sending: "info",
987
988
  failed: "error"
@@ -989,16 +990,16 @@ const zr = {
989
990
  function Pt({
990
991
  status: e
991
992
  }) {
992
- const { t: n } = Ie("ui"), a = e === "sent" ? /* @__PURE__ */ r(Sr, { "aria-hidden": "true" }) : e === "sending" ? /* @__PURE__ */ r(
993
- kr,
993
+ const { t: n } = ve("ui"), a = e === "sent" ? /* @__PURE__ */ r(kr, { "aria-hidden": "true" }) : e === "sending" ? /* @__PURE__ */ r(
994
+ xr,
994
995
  {
995
996
  "aria-hidden": "true",
996
997
  className: "ds:animate-spin ds:motion-reduce:animate-none"
997
998
  }
998
- ) : /* @__PURE__ */ r(xr, { "aria-hidden": "true" });
999
- return /* @__PURE__ */ r(Nr, { size: "sm", variant: zr[e], leading: a, children: n(e === "sent" ? "prescription.status.sent" : e === "sending" ? "prescription.status.sending" : "prescription.status.failed") });
999
+ ) : /* @__PURE__ */ r(Tr, { "aria-hidden": "true" });
1000
+ return /* @__PURE__ */ r(Sr, { size: "sm", variant: Br[e], leading: a, children: n(e === "sent" ? "prescription.status.sent" : e === "sending" ? "prescription.status.sending" : "prescription.status.failed") });
1000
1001
  }
1001
- const Br = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]"), _r = _("ds:flex ds:flex-col", {
1002
+ const _r = j("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]"), jr = j("ds:flex ds:flex-col", {
1002
1003
  variants: {
1003
1004
  density: {
1004
1005
  default: "ds:gap-[var(--spacing-lg)]",
@@ -1007,7 +1008,7 @@ const Br = _("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]"), _r = _("ds:flex
1007
1008
  },
1008
1009
  defaultVariants: { density: "default" }
1009
1010
  });
1010
- function jr(e) {
1011
+ function Gr(e) {
1011
1012
  if (typeof globalThis.reportError == "function") {
1012
1013
  globalThis.reportError(e);
1013
1014
  return;
@@ -1016,25 +1017,25 @@ function jr(e) {
1016
1017
  throw e;
1017
1018
  }, 0);
1018
1019
  }
1019
- function Gr({
1020
+ function Or({
1020
1021
  label: e,
1021
1022
  items: n,
1022
1023
  blocked: a,
1023
1024
  describedBy: h,
1024
1025
  ...u
1025
1026
  }) {
1026
- const [k, b] = U(!1);
1027
- return /* @__PURE__ */ y(
1028
- De.Root,
1027
+ const [S, g] = Y(!1);
1028
+ return /* @__PURE__ */ v(
1029
+ Fe.Root,
1029
1030
  {
1030
- open: k && !a,
1031
- onOpenChange: (c) => b(c && !a),
1031
+ open: S && !a,
1032
+ onOpenChange: (o) => g(o && !a),
1032
1033
  children: [
1033
- /* @__PURE__ */ r(De.Trigger, { asChild: !0, children: /* @__PURE__ */ r(
1034
- ar,
1034
+ /* @__PURE__ */ r(Fe.Trigger, { asChild: !0, children: /* @__PURE__ */ r(
1035
+ or,
1035
1036
  {
1036
1037
  ...u,
1037
- icon: /* @__PURE__ */ r(br, { "aria-hidden": "true" }),
1038
+ icon: /* @__PURE__ */ r(gr, { "aria-hidden": "true" }),
1038
1039
  "aria-label": e,
1039
1040
  "aria-haspopup": "menu",
1040
1041
  "aria-disabled": a || void 0,
@@ -1043,188 +1044,188 @@ function Gr({
1043
1044
  className: "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]"
1044
1045
  }
1045
1046
  ) }),
1046
- /* @__PURE__ */ r(De.Content, { align: "end", children: n.map((c) => /* @__PURE__ */ r(
1047
- De.Item,
1047
+ /* @__PURE__ */ r(Fe.Content, { align: "end", children: n.map((o) => /* @__PURE__ */ r(
1048
+ Fe.Item,
1048
1049
  {
1049
- startIcon: c.icon,
1050
- "data-action": c.action,
1051
- "aria-busy": c.busy || void 0,
1050
+ startIcon: o.icon,
1051
+ "data-action": o.action,
1052
+ "aria-busy": o.busy || void 0,
1052
1053
  onSelect: () => {
1053
- c.busy || c.run();
1054
+ o.busy || o.run();
1054
1055
  },
1055
- children: c.label
1056
+ children: o.label
1056
1057
  },
1057
- c.action
1058
+ o.action
1058
1059
  )) })
1059
1060
  ]
1060
1061
  }
1061
1062
  );
1062
1063
  }
1063
- function Or(e) {
1064
+ function Hr(e) {
1064
1065
  return typeof e == "object" && e !== null && typeof e.then == "function";
1065
1066
  }
1066
- const Hr = Ge(
1067
+ const Kr = Oe(
1067
1068
  ({
1068
1069
  record: e,
1069
1070
  practiceHeader: n,
1070
1071
  size: a = "a4",
1071
1072
  density: h = "default",
1072
1073
  codeLabel: u,
1073
- privacyMode: k = !1,
1074
- isolateBrowserPrint: b = !1,
1075
- numberLabel: c,
1074
+ privacyMode: S = !1,
1075
+ isolateBrowserPrint: g = !1,
1076
+ numberLabel: o,
1076
1077
  pinLabel: N,
1077
- printMode: C,
1078
- onPrint: x,
1079
- onDownloadPdf: j,
1078
+ printMode: q,
1079
+ onPrint: k,
1080
+ onDownloadPdf: G,
1080
1081
  onSendEmail: L,
1081
- onSendSms: se,
1082
+ onSendSms: ae,
1082
1083
  onSendWhatsApp: d,
1083
- onResend: J,
1084
- onEdit: D,
1085
- id: E,
1086
- className: G,
1087
- ...ne
1088
- }, O) => {
1089
- const { t: m, i18n: $ } = Ie("ui"), F = Oe($.language), V = w(null), Z = ve(), ee = ve(), o = ve(), H = ve(), v = ve(), S = e.sendStatus, s = S === "sending" || S === "failed", T = (C ?? (S ? "host" : "sheet")) === "host", q = w(() => {
1090
- }), R = w(T);
1091
- R.current = T;
1092
- const K = w(s);
1093
- K.current = s;
1094
- const Ne = w(e);
1095
- Ne.current = e;
1096
- const ue = _e(
1084
+ onResend: X,
1085
+ onEdit: F,
1086
+ id: $,
1087
+ className: O,
1088
+ ...oe
1089
+ }, H) => {
1090
+ const { t: f, i18n: T } = ve("ui"), z = He(T.language), A = x(null), J = ye(), Z = ye(), w = ye(), c = ye(), ee = ye(), m = e.sendStatus, s = m === "sending" || m === "failed", V = (q ?? (m ? "host" : "sheet")) === "host", B = x(() => {
1091
+ }), E = x(V);
1092
+ E.current = V;
1093
+ const R = x(s);
1094
+ R.current = s;
1095
+ const K = x(e);
1096
+ K.current = e;
1097
+ const Ee = je(
1097
1098
  () => ({
1098
1099
  print: () => {
1099
- var g;
1100
- K.current || (R.current ? q.current() : (g = V.current) == null || g.print());
1100
+ var y;
1101
+ R.current || (E.current ? B.current() : (y = A.current) == null || y.print());
1101
1102
  },
1102
- getRecordId: () => Ne.current.id,
1103
+ getRecordId: () => K.current.id,
1103
1104
  focusTitle: () => {
1104
- var g;
1105
- return (g = V.current) == null ? void 0 : g.focusTitle();
1105
+ var y;
1106
+ return (y = A.current) == null ? void 0 : y.focusTitle();
1106
1107
  }
1107
1108
  }),
1108
1109
  []
1109
1110
  );
1110
- Et(O, () => ue, [ue]);
1111
- const [me, Se] = U(() => /* @__PURE__ */ new Set()), W = w(/* @__PURE__ */ new Set()), ae = w(!0);
1112
- qe(() => (ae.current = !0, () => {
1113
- ae.current = !1;
1111
+ Et(H, () => Ee, [Ee]);
1112
+ const [te, Ie] = Y(() => /* @__PURE__ */ new Set()), re = x(/* @__PURE__ */ new Set()), ue = x(!0);
1113
+ $e(() => (ue.current = !0, () => {
1114
+ ue.current = !1;
1114
1115
  }), []);
1115
- const z = A(
1116
- (g, be) => {
1117
- if (!be || W.current.has(g) || K.current && g !== "resend" && g !== "edit")
1116
+ const D = P(
1117
+ (y, he) => {
1118
+ if (!he || re.current.has(y) || R.current && y !== "resend" && y !== "edit")
1118
1119
  return;
1119
- let ge;
1120
+ let Se;
1120
1121
  try {
1121
- ge = be(Ne.current);
1122
- } catch (We) {
1123
- jr(We);
1122
+ Se = he(K.current);
1123
+ } catch (Ce) {
1124
+ Gr(Ce);
1124
1125
  return;
1125
1126
  }
1126
- if (!Or(ge)) return;
1127
- W.current.add(g), Se(new Set(W.current));
1128
- const Te = () => {
1129
- W.current.delete(g), ae.current && Se(new Set(W.current));
1127
+ if (!Hr(Se)) return;
1128
+ re.current.add(y), Ie(new Set(re.current));
1129
+ const ke = () => {
1130
+ re.current.delete(y), ue.current && Ie(new Set(re.current));
1130
1131
  };
1131
- ge.then(Te, Te);
1132
+ Se.then(ke, ke);
1132
1133
  },
1133
1134
  []
1134
- ), He = A(() => {
1135
- var g;
1136
- W.current.has("print") || (T || (g = V.current) == null || g.print(), z("print", x));
1137
- }, [z, x, T]);
1138
- q.current = () => z("print", x);
1139
- const Ke = [
1140
- x && {
1135
+ ), Ke = P(() => {
1136
+ var y;
1137
+ re.current.has("print") || (V || (y = A.current) == null || y.print(), D("print", k));
1138
+ }, [D, k, V]);
1139
+ B.current = () => D("print", k);
1140
+ const We = [
1141
+ k && {
1141
1142
  action: "print",
1142
- label: m("prescription.sheet.print"),
1143
+ label: f("prescription.sheet.print"),
1143
1144
  icon: /* @__PURE__ */ r(Ct, { "aria-hidden": "true" }),
1144
- run: He
1145
+ run: Ke
1145
1146
  },
1146
- j && {
1147
+ G && {
1147
1148
  action: "downloadPdf",
1148
- label: m("prescription.sheet.downloadPdf"),
1149
- icon: /* @__PURE__ */ r(mr, { "aria-hidden": "true" }),
1150
- run: () => z("downloadPdf", j)
1149
+ label: f("prescription.sheet.downloadPdf"),
1150
+ icon: /* @__PURE__ */ r(fr, { "aria-hidden": "true" }),
1151
+ run: () => D("downloadPdf", G)
1151
1152
  },
1152
1153
  L && {
1153
1154
  action: "sendEmail",
1154
- label: m("prescription.sheet.sendEmail"),
1155
- icon: /* @__PURE__ */ r(fr, { "aria-hidden": "true" }),
1156
- run: () => z("sendEmail", L)
1155
+ label: f("prescription.sheet.sendEmail"),
1156
+ icon: /* @__PURE__ */ r(hr, { "aria-hidden": "true" }),
1157
+ run: () => D("sendEmail", L)
1157
1158
  },
1158
- se && {
1159
+ ae && {
1159
1160
  action: "sendSms",
1160
- label: m("prescription.sheet.sendSms"),
1161
- icon: /* @__PURE__ */ r(hr, { "aria-hidden": "true" }),
1162
- run: () => z("sendSms", se)
1161
+ label: f("prescription.sheet.sendSms"),
1162
+ icon: /* @__PURE__ */ r(br, { "aria-hidden": "true" }),
1163
+ run: () => D("sendSms", ae)
1163
1164
  },
1164
1165
  d && {
1165
1166
  action: "sendWhatsApp",
1166
- label: m("prescription.sheet.sendWhatsApp"),
1167
- icon: /* @__PURE__ */ r(ur, {}),
1168
- run: () => z("sendWhatsApp", d)
1167
+ label: f("prescription.sheet.sendWhatsApp"),
1168
+ icon: /* @__PURE__ */ r(mr, {}),
1169
+ run: () => D("sendWhatsApp", d)
1169
1170
  }
1170
- ].filter((g) => !!g), [Q, ...ke] = Ke, fe = Q ? /* @__PURE__ */ r(
1171
- Re,
1171
+ ].filter((y) => !!y), [W, ...qe] = We, Ne = W ? /* @__PURE__ */ r(
1172
+ ze,
1172
1173
  {
1173
1174
  type: "button",
1174
1175
  intent: "outline",
1175
- startIcon: Q.icon,
1176
- loading: me.has(Q.action),
1176
+ startIcon: W.icon,
1177
+ loading: te.has(W.action),
1177
1178
  "aria-disabled": s || void 0,
1178
1179
  "aria-describedby": [
1179
- s ? H : void 0,
1180
- T && Q.action === "print" ? v : void 0
1180
+ s ? c : void 0,
1181
+ V && W.action === "print" ? ee : void 0
1181
1182
  ].filter(Boolean).join(" ") || void 0,
1182
- onClick: s ? void 0 : Q.run,
1183
- "data-action": Q.action,
1183
+ onClick: s ? void 0 : W.run,
1184
+ "data-action": W.action,
1184
1185
  className: "ds:min-h-[var(--min-target-size)]",
1185
- children: Q.label
1186
+ children: W.label
1186
1187
  }
1187
- ) : null, oe = Q && ke.length > 0 ? /* @__PURE__ */ y(or, { label: m("prescription.sheet.shareActions"), children: [
1188
- fe,
1188
+ ) : null, me = W && qe.length > 0 ? /* @__PURE__ */ v(cr, { label: f("prescription.sheet.shareActions"), children: [
1189
+ Ne,
1189
1190
  /* @__PURE__ */ r(
1190
- Gr,
1191
+ Or,
1191
1192
  {
1192
1193
  blocked: s,
1193
- describedBy: s ? H : void 0,
1194
- label: m("prescription.sheet.moreActions"),
1195
- items: ke.map((g) => ({
1196
- ...g,
1197
- busy: me.has(g.action)
1194
+ describedBy: s ? c : void 0,
1195
+ label: f("prescription.sheet.moreActions"),
1196
+ items: qe.map((y) => ({
1197
+ ...y,
1198
+ busy: te.has(y.action)
1198
1199
  }))
1199
1200
  }
1200
1201
  )
1201
- ] }) : fe, xe = oe !== null;
1202
- return /* @__PURE__ */ y(
1202
+ ] }) : Ne, fe = me !== null;
1203
+ return /* @__PURE__ */ v(
1203
1204
  "div",
1204
1205
  {
1205
- ...ne,
1206
- id: E,
1207
- className: Br({ className: G }),
1206
+ ...oe,
1207
+ id: $,
1208
+ className: _r({ className: O }),
1208
1209
  "data-component": "prescription-sheet",
1209
- "data-component-id": E,
1210
+ "data-component-id": $,
1210
1211
  "data-prescription-id": e.id,
1211
1212
  children: [
1212
- S ? /* @__PURE__ */ r(
1213
+ m ? /* @__PURE__ */ r(
1213
1214
  "div",
1214
1215
  {
1215
- id: H,
1216
+ id: c,
1216
1217
  "data-slot": "send-status",
1217
- "data-send-status": S,
1218
+ "data-send-status": m,
1218
1219
  className: "ds:mx-auto ds:flex ds:w-full ds:max-w-3xl ds:justify-center ds:print:hidden",
1219
- children: S === "sent" ? /* @__PURE__ */ y("p", { className: "ds:m-0 ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-[var(--spacing-sm)] type-body-sm", children: [
1220
+ children: m === "sent" ? /* @__PURE__ */ v("p", { className: "ds:m-0 ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-[var(--spacing-sm)] type-body-sm", children: [
1220
1221
  /* @__PURE__ */ r(Pt, { status: "sent" }),
1221
- e.sentAt ? /* @__PURE__ */ y("span", { children: [
1222
- m("prescription.sheet.sentAt"),
1222
+ e.sentAt ? /* @__PURE__ */ v("span", { children: [
1223
+ f("prescription.sheet.sentAt"),
1223
1224
  " ",
1224
1225
  /* @__PURE__ */ r(
1225
- nr,
1226
+ ar,
1226
1227
  {
1227
- locale: F,
1228
+ locale: z,
1228
1229
  value: e.sentAt,
1229
1230
  format: "absolute",
1230
1231
  shape: "bare",
@@ -1235,37 +1236,37 @@ const Hr = Ge(
1235
1236
  }
1236
1237
  )
1237
1238
  ] }) : null
1238
- ] }) : S === "sending" ? /* @__PURE__ */ r(he, { variant: "info", announce: "polite", className: "ds:w-full", children: /* @__PURE__ */ r(he.Title, { as: "p", children: m("prescription.sheet.sendingTitle") }) }) : /* @__PURE__ */ y(he, { variant: "error", className: "ds:w-full", children: [
1239
- /* @__PURE__ */ r(he.Title, { as: "p", children: m("prescription.sheet.sendFailedTitle") }),
1240
- /* @__PURE__ */ r(he.Description, { children: e.sendError ?? m("prescription.sheet.sendFailedBody") }),
1241
- J || D ? /* @__PURE__ */ y(
1239
+ ] }) : m === "sending" ? /* @__PURE__ */ r(be, { variant: "info", announce: "polite", className: "ds:w-full", children: /* @__PURE__ */ r(be.Title, { as: "p", children: f("prescription.sheet.sendingTitle") }) }) : /* @__PURE__ */ v(be, { variant: "error", className: "ds:w-full", children: [
1240
+ /* @__PURE__ */ r(be.Title, { as: "p", children: f("prescription.sheet.sendFailedTitle") }),
1241
+ /* @__PURE__ */ r(be.Description, { children: e.sendError ?? f("prescription.sheet.sendFailedBody") }),
1242
+ X || F ? /* @__PURE__ */ v(
1242
1243
  "div",
1243
1244
  {
1244
1245
  "data-slot": "failed-actions",
1245
1246
  className: "ds:mt-[var(--spacing-sm)] ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]",
1246
1247
  children: [
1247
- J ? /* @__PURE__ */ r(
1248
- Re,
1248
+ X ? /* @__PURE__ */ r(
1249
+ ze,
1249
1250
  {
1250
1251
  type: "button",
1251
1252
  intent: "primary",
1252
- loading: me.has("resend"),
1253
- onClick: () => z("resend", J),
1253
+ loading: te.has("resend"),
1254
+ onClick: () => D("resend", X),
1254
1255
  "data-action": "resend",
1255
1256
  className: "ds:min-h-[var(--min-target-size)]",
1256
- children: m("prescription.sheet.resend")
1257
+ children: f("prescription.sheet.resend")
1257
1258
  }
1258
1259
  ) : null,
1259
- D ? /* @__PURE__ */ r(
1260
- Re,
1260
+ F ? /* @__PURE__ */ r(
1261
+ ze,
1261
1262
  {
1262
1263
  type: "button",
1263
1264
  intent: "secondary",
1264
- loading: me.has("edit"),
1265
- onClick: () => z("edit", D),
1265
+ loading: te.has("edit"),
1266
+ onClick: () => D("edit", F),
1266
1267
  "data-action": "edit",
1267
1268
  className: "ds:min-h-[var(--min-target-size)]",
1268
- children: m("prescription.sheet.edit")
1269
+ children: f("prescription.sheet.edit")
1269
1270
  }
1270
1271
  ) : null
1271
1272
  ]
@@ -1274,62 +1275,62 @@ const Hr = Ge(
1274
1275
  ] })
1275
1276
  }
1276
1277
  ) : null,
1277
- xe ? /* @__PURE__ */ r(
1278
+ fe ? /* @__PURE__ */ r(
1278
1279
  "div",
1279
1280
  {
1280
1281
  role: "group",
1281
- "aria-label": m("prescription.sheet.actions"),
1282
+ "aria-label": f("prescription.sheet.actions"),
1282
1283
  "data-slot": "actions",
1283
1284
  className: "ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-[var(--spacing-sm)] ds:print:hidden",
1284
- children: oe
1285
+ children: me
1285
1286
  }
1286
1287
  ) : null,
1287
- T ? (
1288
+ V ? (
1288
1289
  /* Not print:hidden: when the page itself is printed (Ctrl or Cmd+P),
1289
1290
  the summary prints with its note, right above the sheet. */
1290
1291
  /* @__PURE__ */ r(
1291
1292
  "p",
1292
1293
  {
1293
- id: v,
1294
+ id: ee,
1294
1295
  "data-slot": "summary-note",
1295
1296
  className: "ds:m-0 ds:text-center type-body-sm ds:text-[color:var(--muted-foreground)]",
1296
- children: m("prescription.sheet.summaryNote")
1297
+ children: f("prescription.sheet.summaryNote")
1297
1298
  }
1298
1299
  )
1299
1300
  ) : null,
1300
1301
  /* @__PURE__ */ r(
1301
- pr,
1302
+ ur,
1302
1303
  {
1303
- ref: V,
1304
+ ref: A,
1304
1305
  registerAgent: !1,
1305
- id: E ? `${E}-sheet` : void 0,
1306
+ id: $ ? `${$}-sheet` : void 0,
1306
1307
  size: a,
1307
1308
  density: h,
1308
- isolateBrowserPrint: T ? !1 : b,
1309
+ isolateBrowserPrint: V ? !1 : g,
1309
1310
  header: n,
1310
- title: m("prescription.sheet.title"),
1311
+ title: f("prescription.sheet.title"),
1311
1312
  date: e.createdAt,
1312
1313
  signature: {
1313
1314
  name: e.prescriber.name,
1314
1315
  detail: e.prescriber.specialty
1315
1316
  },
1316
- children: /* @__PURE__ */ y("div", { className: _r({ density: h }), children: [
1317
- /* @__PURE__ */ y(St, { children: [
1317
+ children: /* @__PURE__ */ v("div", { className: jr({ density: h }), children: [
1318
+ /* @__PURE__ */ v(St, { children: [
1318
1319
  e.number ? /* @__PURE__ */ r(
1319
- ie,
1320
+ ne,
1320
1321
  {
1321
- label: c ?? m("prescription.sheet.number"),
1322
+ label: o ?? f("prescription.sheet.number"),
1322
1323
  value: /* @__PURE__ */ r("span", { dir: "ltr", children: e.number }),
1323
1324
  mono: !0,
1324
1325
  "data-field": "number"
1325
1326
  }
1326
1327
  ) : null,
1327
1328
  e.pin ? /* @__PURE__ */ r(
1328
- ie,
1329
+ ne,
1329
1330
  {
1330
- label: N ?? m("prescription.sheet.pin"),
1331
- value: k ? /* @__PURE__ */ y(Be, { children: [
1332
- /* @__PURE__ */ r(lt, { children: m("calendarWorkspace.privacy.hidden") }),
1331
+ label: N ?? f("prescription.sheet.pin"),
1332
+ value: S ? /* @__PURE__ */ v(_e, { children: [
1333
+ /* @__PURE__ */ r(lt, { children: f("calendarWorkspace.privacy.hidden") }),
1333
1334
  /* @__PURE__ */ r("span", { "aria-hidden": "true", children: ct() })
1334
1335
  ] }) : /* @__PURE__ */ r("span", { dir: "ltr", children: e.pin }),
1335
1336
  mono: !0,
@@ -1337,129 +1338,129 @@ const Hr = Ge(
1337
1338
  }
1338
1339
  ) : null,
1339
1340
  /* @__PURE__ */ r(
1340
- ie,
1341
+ ne,
1341
1342
  {
1342
- label: m("prescription.sheet.treatment"),
1343
+ label: f("prescription.sheet.treatment"),
1343
1344
  value: /* @__PURE__ */ r("span", { dir: "auto", children: e.treatment.label }),
1344
1345
  "data-field": "treatment"
1345
1346
  }
1346
1347
  ),
1347
1348
  e.treatment.carePlan ? /* @__PURE__ */ r(
1348
- ie,
1349
+ ne,
1349
1350
  {
1350
- label: m("prescription.sheet.carePlan"),
1351
+ label: f("prescription.sheet.carePlan"),
1351
1352
  value: /* @__PURE__ */ r("span", { dir: "auto", children: e.treatment.carePlan.label }),
1352
1353
  "data-field": "carePlan"
1353
1354
  }
1354
1355
  ) : null
1355
1356
  ] }),
1356
- /* @__PURE__ */ y(
1357
+ /* @__PURE__ */ v(
1357
1358
  "section",
1358
1359
  {
1359
- "aria-labelledby": Z,
1360
+ "aria-labelledby": J,
1360
1361
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1361
1362
  children: [
1362
1363
  /* @__PURE__ */ r(
1363
1364
  "h3",
1364
1365
  {
1365
- id: Z,
1366
+ id: J,
1366
1367
  className: "ds:m-0 type-title-item ds:break-after-avoid",
1367
- children: m("prescription.sheet.patient")
1368
+ children: f("prescription.sheet.patient")
1368
1369
  }
1369
1370
  ),
1370
1371
  /* @__PURE__ */ r(
1371
1372
  dt,
1372
1373
  {
1373
1374
  patient: e.patient,
1374
- privacyMode: k,
1375
+ privacyMode: S,
1375
1376
  density: h
1376
1377
  }
1377
1378
  )
1378
1379
  ]
1379
1380
  }
1380
1381
  ),
1381
- /* @__PURE__ */ y(
1382
+ /* @__PURE__ */ v(
1382
1383
  "section",
1383
1384
  {
1384
- "aria-labelledby": ee,
1385
+ "aria-labelledby": Z,
1385
1386
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1386
1387
  children: [
1387
1388
  /* @__PURE__ */ r(
1388
1389
  "h3",
1389
1390
  {
1390
- id: ee,
1391
+ id: Z,
1391
1392
  className: "ds:m-0 type-title-item ds:break-after-avoid",
1392
- children: m("prescription.sheet.medications")
1393
+ children: f("prescription.sheet.medications")
1393
1394
  }
1394
1395
  ),
1395
1396
  /* @__PURE__ */ r(
1396
- lr,
1397
+ dr,
1397
1398
  {
1398
1399
  density: h,
1399
- "aria-labelledby": ee,
1400
- children: e.items.map((g, be) => /* @__PURE__ */ r(
1401
- dr,
1400
+ "aria-labelledby": Z,
1401
+ children: e.items.map((y, he) => /* @__PURE__ */ r(
1402
+ pr,
1402
1403
  {
1403
1404
  as: "li",
1404
- medication: g.medication,
1405
- dosage: g.dosage,
1406
- notes: g.notes,
1407
- quantity: g.quantity,
1408
- duration: g.duration,
1409
- notSubstitutable: g.notSubstitutable,
1405
+ medication: y.medication,
1406
+ dosage: y.dosage,
1407
+ notes: y.notes,
1408
+ quantity: y.quantity,
1409
+ duration: y.duration,
1410
+ notSubstitutable: y.notSubstitutable,
1410
1411
  codeLabel: u
1411
1412
  },
1412
- `${g.medication.id}-${be}`
1413
+ `${y.medication.id}-${he}`
1413
1414
  ))
1414
1415
  }
1415
1416
  )
1416
1417
  ]
1417
1418
  }
1418
1419
  ),
1419
- /* @__PURE__ */ y(
1420
+ /* @__PURE__ */ v(
1420
1421
  "section",
1421
1422
  {
1422
- "aria-labelledby": o,
1423
+ "aria-labelledby": w,
1423
1424
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1424
1425
  children: [
1425
1426
  /* @__PURE__ */ r(
1426
1427
  "h3",
1427
1428
  {
1428
- id: o,
1429
+ id: w,
1429
1430
  className: "ds:m-0 type-title-item ds:break-after-avoid",
1430
- children: m("prescription.sheet.prescriber")
1431
+ children: f("prescription.sheet.prescriber")
1431
1432
  }
1432
1433
  ),
1433
- /* @__PURE__ */ y(St, { children: [
1434
+ /* @__PURE__ */ v(St, { children: [
1434
1435
  /* @__PURE__ */ r(
1435
- ie,
1436
+ ne,
1436
1437
  {
1437
- label: m("prescription.sheet.prescriberName"),
1438
+ label: f("prescription.sheet.prescriberName"),
1438
1439
  value: /* @__PURE__ */ r("span", { dir: "auto", children: e.prescriber.name }),
1439
1440
  "data-field": "prescriber"
1440
1441
  }
1441
1442
  ),
1442
1443
  e.prescriber.specialty ? /* @__PURE__ */ r(
1443
- ie,
1444
+ ne,
1444
1445
  {
1445
- label: m("prescription.history.specialty"),
1446
+ label: f("prescription.history.specialty"),
1446
1447
  value: /* @__PURE__ */ r("span", { dir: "auto", children: e.prescriber.specialty }),
1447
1448
  "data-field": "specialty"
1448
1449
  }
1449
1450
  ) : null,
1450
1451
  e.prescriber.fiscalCode ? /* @__PURE__ */ r(
1451
- ie,
1452
+ ne,
1452
1453
  {
1453
- label: m("prescription.sheet.prescriberFiscalCode"),
1454
+ label: f("prescription.sheet.prescriberFiscalCode"),
1454
1455
  value: /* @__PURE__ */ r("span", { dir: "ltr", children: e.prescriber.fiscalCode }),
1455
1456
  mono: !0,
1456
1457
  "data-field": "prescriberFiscalCode"
1457
1458
  }
1458
1459
  ) : null,
1459
1460
  e.prescriber.registrationNumber ? /* @__PURE__ */ r(
1460
- ie,
1461
+ ne,
1461
1462
  {
1462
- label: m("prescription.sheet.registrationNumber"),
1463
+ label: f("prescription.sheet.registrationNumber"),
1463
1464
  value: /* @__PURE__ */ r("span", { dir: "ltr", children: e.prescriber.registrationNumber }),
1464
1465
  mono: !0,
1465
1466
  "data-field": "registrationNumber"
@@ -1477,25 +1478,25 @@ const Hr = Ge(
1477
1478
  );
1478
1479
  }
1479
1480
  );
1480
- Hr.displayName = "PrescriptionSheet";
1481
- const Kr = _("ds:block ds:min-w-0 ds:w-full"), Wr = _(
1481
+ Kr.displayName = "PrescriptionSheet";
1482
+ const Wr = j("ds:block ds:min-w-0 ds:w-full"), Qr = j(
1482
1483
  "ds:inline-flex ds:min-w-0 ds:items-center ds:gap-[var(--spacing-xs)]"
1483
- ), ze = _("ds:min-w-0 ds:break-words"), Qr = _("ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]"), Yr = "11rem", Ur = _(
1484
+ ), Be = j("ds:min-w-0 ds:break-words"), Yr = j("ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]"), Ur = "11rem", Xr = j(
1484
1485
  "ds:min-w-0 ds:break-words ds:text-[color:var(--muted-foreground)]"
1485
- ), Xr = _("ds:font-mono ds:tabular-nums"), Jr = [
1486
+ ), Jr = j("ds:font-mono ds:tabular-nums"), Zr = [
1486
1487
  { colId: "date", sort: "desc" }
1487
- ], Zr = {
1488
+ ], ei = {
1488
1489
  dateStyle: "medium",
1489
1490
  timeStyle: "short"
1490
1491
  };
1491
1492
  function wt(e, n) {
1492
1493
  const a = new Date(e.createdAt);
1493
- return Number.isNaN(a.getTime()) ? e.createdAt : new Intl.DateTimeFormat(Oe(n), Zr).format(
1494
+ return Number.isNaN(a.getTime()) ? e.createdAt : new Intl.DateTimeFormat(He(n), ei).format(
1494
1495
  a
1495
1496
  );
1496
1497
  }
1497
1498
  function $t({ name: e }) {
1498
- return /* @__PURE__ */ y("span", { className: Wr(), children: [
1499
+ return /* @__PURE__ */ v("span", { className: Qr(), children: [
1499
1500
  /* @__PURE__ */ r(
1500
1501
  qt,
1501
1502
  {
@@ -1507,38 +1508,38 @@ function $t({ name: e }) {
1507
1508
  "aria-label": void 0
1508
1509
  }
1509
1510
  ),
1510
- /* @__PURE__ */ r("span", { dir: "auto", className: ze(), children: e })
1511
+ /* @__PURE__ */ r("span", { dir: "auto", className: Be(), children: e })
1511
1512
  ] });
1512
1513
  }
1513
- const Qi = Ge(function({
1514
+ const Yi = Oe(function({
1514
1515
  records: n,
1515
1516
  status: a = "ready",
1516
1517
  onOpen: h,
1517
1518
  onReprint: u,
1518
- onRetry: k,
1519
- caption: b,
1520
- showPatient: c = !1,
1519
+ onRetry: S,
1520
+ caption: g,
1521
+ showPatient: o = !1,
1521
1522
  privacyMode: N = !1,
1522
- showSendStatus: C,
1523
- id: x,
1524
- className: j,
1523
+ showSendStatus: q,
1524
+ id: k,
1525
+ className: G,
1525
1526
  ...L
1526
- }, se) {
1527
- const { t: d, i18n: J } = Ie("ui"), D = J.language || "en", E = h !== void 0 || u !== void 0, G = C ?? n.some(($) => $.sendStatus !== void 0), ne = _e(() => {
1528
- const $ = [];
1529
- return h && $.push({
1527
+ }, ae) {
1528
+ const { t: d, i18n: X } = ve("ui"), F = X.language || "en", $ = h !== void 0 || u !== void 0, O = q ?? n.some((T) => T.sendStatus !== void 0), oe = je(() => {
1529
+ const T = [];
1530
+ return h && T.push({
1530
1531
  id: "open",
1531
- icon: /* @__PURE__ */ r(Tr, {}),
1532
+ icon: /* @__PURE__ */ r(wr, {}),
1532
1533
  label: d("prescription.history.open"),
1533
1534
  onClick: h
1534
- }), u && $.push({
1535
+ }), u && T.push({
1535
1536
  id: "reprint",
1536
1537
  icon: /* @__PURE__ */ r(Ct, {}),
1537
1538
  label: d("prescription.history.reprint"),
1538
1539
  onClick: u
1539
- }), $;
1540
- }, [d, h, u]), O = _e(() => {
1541
- const $ = new Intl.Collator(Oe(D)), F = (s) => wt(s, D), V = (s) => `${s.patient.lastName} ${s.patient.firstName}`.trim(), Z = (s) => d(s === "sent" ? "prescription.status.sent" : s === "sending" ? "prescription.status.sending" : "prescription.status.failed"), ee = /* @__PURE__ */ r("span", { className: Ur(), children: d("prescription.history.noCarePlan") }), o = 3, H = 2, v = c ? 2 : 1, S = [
1540
+ }), T;
1541
+ }, [d, h, u]), H = je(() => {
1542
+ const T = new Intl.Collator(He(F)), z = (s) => wt(s, F), A = (s) => `${s.patient.lastName} ${s.patient.firstName}`.trim(), J = (s) => d(s === "sent" ? "prescription.status.sent" : s === "sending" ? "prescription.status.sending" : "prescription.status.failed"), Z = /* @__PURE__ */ r("span", { className: Xr(), children: d("prescription.history.noCarePlan") }), w = 3, c = 2, ee = o ? 2 : 1, m = [
1542
1543
  {
1543
1544
  id: "date",
1544
1545
  header: d("prescription.history.date"),
@@ -1547,116 +1548,116 @@ const Qi = Ge(function({
1547
1548
  sort: "date",
1548
1549
  sortDescFirst: !0,
1549
1550
  value: (s) => new Date(s.createdAt),
1550
- exportValue: F,
1551
+ exportValue: z,
1551
1552
  filter: { kind: "dateRange" },
1552
1553
  search: !1,
1553
1554
  size: 124,
1554
1555
  wrap: !0,
1555
- cell: (s) => /* @__PURE__ */ r("time", { dateTime: s.createdAt, children: F(s) })
1556
+ cell: (s) => /* @__PURE__ */ r("time", { dateTime: s.createdAt, children: z(s) })
1556
1557
  }
1557
1558
  ];
1558
- if (G && (S.push({
1559
+ if (O && (m.push({
1559
1560
  id: "number",
1560
1561
  header: d("prescription.history.number"),
1561
1562
  headerLabel: d("prescription.history.number"),
1562
- responsiveTier: H,
1563
+ responsiveTier: c,
1563
1564
  sort: "text",
1564
1565
  value: (s) => s.number ?? null,
1565
1566
  exportValue: (s) => s.number ?? "",
1566
1567
  filter: { kind: "text" },
1567
1568
  size: 124,
1568
- cell: (s) => s.number ? /* @__PURE__ */ r("span", { dir: "ltr", className: Xr(), children: s.number }) : null
1569
- }), S.push({
1569
+ cell: (s) => s.number ? /* @__PURE__ */ r("span", { dir: "ltr", className: Jr(), children: s.number }) : null
1570
+ }), m.push({
1570
1571
  id: "status",
1571
1572
  header: d("prescription.history.status"),
1572
1573
  headerLabel: d("prescription.history.status"),
1573
- responsiveTier: v,
1574
+ responsiveTier: ee,
1574
1575
  sort: "text",
1575
1576
  value: (s) => s.sendStatus ?? null,
1576
- exportValue: (s) => s.sendStatus ? Z(s.sendStatus) : "",
1577
+ exportValue: (s) => s.sendStatus ? J(s.sendStatus) : "",
1577
1578
  filter: {
1578
1579
  kind: "select",
1579
1580
  options: ["sent", "sending", "failed"].map((s) => ({
1580
1581
  value: s,
1581
- label: Z(s)
1582
+ label: J(s)
1582
1583
  }))
1583
1584
  },
1584
1585
  search: !1,
1585
1586
  size: 108,
1586
1587
  cell: (s) => s.sendStatus ? /* @__PURE__ */ r(Pt, { status: s.sendStatus }) : null
1587
- })), c && S.push({
1588
+ })), o && m.push({
1588
1589
  id: "patient",
1589
1590
  header: d("prescription.history.patient"),
1590
1591
  headerLabel: d("prescription.history.patient"),
1591
1592
  responsiveTier: 1,
1592
1593
  wrap: !0,
1593
1594
  privacy: "mask",
1594
- sort: (s, f) => $.compare(V(s), V(f)),
1595
- value: V,
1596
- exportValue: V,
1595
+ sort: (s, b) => T.compare(A(s), A(b)),
1596
+ value: A,
1597
+ exportValue: A,
1597
1598
  filter: { kind: "text" },
1598
1599
  size: 144,
1599
- cell: (s) => /* @__PURE__ */ r($t, { name: V(s) })
1600
- }), S.push(
1600
+ cell: (s) => /* @__PURE__ */ r($t, { name: A(s) })
1601
+ }), m.push(
1601
1602
  {
1602
1603
  id: "treatment",
1603
1604
  header: d("prescription.history.treatment"),
1604
1605
  headerLabel: d("prescription.history.treatment"),
1605
- responsiveTier: o,
1606
+ responsiveTier: w,
1606
1607
  wrap: !0,
1607
1608
  sort: "text",
1608
1609
  value: (s) => s.treatment.label,
1609
1610
  exportValue: (s) => s.treatment.label,
1610
1611
  filter: { kind: "text" },
1611
1612
  size: 136,
1612
- cell: (s) => /* @__PURE__ */ r("span", { dir: "auto", className: ze(), children: s.treatment.label })
1613
+ cell: (s) => /* @__PURE__ */ r("span", { dir: "auto", className: Be(), children: s.treatment.label })
1613
1614
  },
1614
1615
  {
1615
1616
  id: "carePlan",
1616
1617
  header: d("prescription.history.carePlan"),
1617
1618
  headerLabel: d("prescription.history.carePlan"),
1618
- responsiveTier: o,
1619
+ responsiveTier: w,
1619
1620
  wrap: !0,
1620
1621
  sort: "text",
1621
1622
  value: (s) => {
1622
- var f;
1623
- return ((f = s.treatment.carePlan) == null ? void 0 : f.label) ?? null;
1623
+ var b;
1624
+ return ((b = s.treatment.carePlan) == null ? void 0 : b.label) ?? null;
1624
1625
  },
1625
1626
  exportValue: (s) => {
1626
- var f;
1627
- return ((f = s.treatment.carePlan) == null ? void 0 : f.label) ?? "";
1627
+ var b;
1628
+ return ((b = s.treatment.carePlan) == null ? void 0 : b.label) ?? "";
1628
1629
  },
1629
1630
  filter: { kind: "select" },
1630
1631
  size: 128,
1631
- cell: (s) => s.treatment.carePlan ? /* @__PURE__ */ r("span", { dir: "auto", className: ze(), children: s.treatment.carePlan.label }) : ee
1632
+ cell: (s) => s.treatment.carePlan ? /* @__PURE__ */ r("span", { dir: "auto", className: Be(), children: s.treatment.carePlan.label }) : Z
1632
1633
  },
1633
1634
  {
1634
1635
  id: "medications",
1635
1636
  header: d("prescription.history.medications"),
1636
1637
  headerLabel: d("prescription.history.medications"),
1637
1638
  wrap: !0,
1638
- value: (s) => s.items.map((f) => f.medication.name).join("; "),
1639
- exportValue: (s) => s.items.map((f) => f.medication.name).join("; "),
1639
+ value: (s) => s.items.map((b) => b.medication.name).join("; "),
1640
+ exportValue: (s) => s.items.map((b) => b.medication.name).join("; "),
1640
1641
  /* The grid's filters read one scalar per row, so the drug filter is
1641
1642
  a text "contains" on the names, not a list of drugs. */
1642
1643
  filter: { kind: "text" },
1643
1644
  size: 216,
1644
- cell: (s) => /* @__PURE__ */ r("span", { className: Qr(), children: s.items.map((f, T) => /* @__PURE__ */ r(
1645
- yr,
1645
+ cell: (s) => /* @__PURE__ */ r("span", { className: Yr(), children: s.items.map((b, V) => /* @__PURE__ */ r(
1646
+ vr,
1646
1647
  {
1647
- label: f.medication.name,
1648
+ label: b.medication.name,
1648
1649
  size: "sm",
1649
1650
  variant: "neutral",
1650
- maxInlineSize: Yr
1651
+ maxInlineSize: Ur
1651
1652
  },
1652
- `${f.medication.id}-${T}`
1653
+ `${b.medication.id}-${V}`
1653
1654
  )) })
1654
1655
  },
1655
1656
  {
1656
1657
  id: "prescriber",
1657
1658
  header: d("prescription.history.prescriber"),
1658
1659
  headerLabel: d("prescription.history.prescriber"),
1659
- responsiveTier: c ? o : H,
1660
+ responsiveTier: o ? w : c,
1660
1661
  wrap: !0,
1661
1662
  sort: "text",
1662
1663
  value: (s) => s.prescriber.name,
@@ -1677,11 +1678,11 @@ const Qi = Ge(function({
1677
1678
  exportValue: (s) => s.prescriber.specialty ?? "",
1678
1679
  filter: { kind: "select" },
1679
1680
  size: 140,
1680
- cell: (s) => s.prescriber.specialty ? /* @__PURE__ */ r("span", { dir: "auto", className: ze(), children: s.prescriber.specialty }) : null
1681
+ cell: (s) => s.prescriber.specialty ? /* @__PURE__ */ r("span", { dir: "auto", className: Be(), children: s.prescriber.specialty }) : null
1681
1682
  }
1682
- ), E) {
1683
+ ), $) {
1683
1684
  const s = d("prescription.history.actions");
1684
- S.push({
1685
+ m.push({
1685
1686
  id: "actions",
1686
1687
  header: /* @__PURE__ */ r(lt, { children: s }),
1687
1688
  headerLabel: s,
@@ -1696,24 +1697,24 @@ const Qi = Ge(function({
1696
1697
  search: !1,
1697
1698
  /* The kit RowActions leaf, menu only: one "Actions" button per row,
1698
1699
  named by reference with the row's own name. */
1699
- cell: (f, T) => /* @__PURE__ */ r(
1700
- vr,
1700
+ cell: (b, V) => /* @__PURE__ */ r(
1701
+ Ir,
1701
1702
  {
1702
- row: f,
1703
- actions: ne,
1703
+ row: b,
1704
+ actions: oe,
1704
1705
  maxInline: 0,
1705
- "aria-labelledby": T.inputLabelledBy
1706
+ "aria-labelledby": V.inputLabelledBy
1706
1707
  }
1707
1708
  )
1708
1709
  });
1709
1710
  }
1710
- return S;
1711
- }, [d, D, E, c, G, ne]), m = /* @__PURE__ */ y(de, { children: [
1712
- /* @__PURE__ */ y(de.FilterBar, { children: [
1711
+ return m;
1712
+ }, [d, F, $, o, O, oe]), f = /* @__PURE__ */ v(de, { children: [
1713
+ /* @__PURE__ */ v(de.FilterBar, { children: [
1713
1714
  /* @__PURE__ */ r(de.QuickSearch, {}),
1714
1715
  /* @__PURE__ */ r(de.FilterChips, {})
1715
1716
  ] }),
1716
- /* @__PURE__ */ r(de.Actions, { children: /* @__PURE__ */ y(gr, { "aria-label": d("dataTable.tableActions"), children: [
1717
+ /* @__PURE__ */ r(de.Actions, { children: /* @__PURE__ */ v(yr, { "aria-label": d("dataTable.tableActions"), children: [
1717
1718
  /* @__PURE__ */ r(de.ExportMenu, {}),
1718
1719
  /* @__PURE__ */ r(de.Print, {}),
1719
1720
  /* @__PURE__ */ r(de.ColumnToggle, {})
@@ -1723,35 +1724,35 @@ const Qi = Ge(function({
1723
1724
  "div",
1724
1725
  {
1725
1726
  ...L,
1726
- ref: se,
1727
+ ref: ae,
1727
1728
  "data-component": "prescription-history",
1728
- "data-component-id": x,
1729
- className: Kr({ className: j }),
1729
+ "data-component-id": k,
1730
+ className: Wr({ className: G }),
1730
1731
  children: /* @__PURE__ */ r(
1731
- Ir,
1732
+ Nr,
1732
1733
  {
1733
- columns: O,
1734
+ columns: H,
1734
1735
  rows: n,
1735
- getRowId: ($) => $.id,
1736
- getRowLabel: ($) => {
1737
- const F = d("prescription.history.rowLabel", {
1738
- date: wt($, D)
1736
+ getRowId: (T) => T.id,
1737
+ getRowLabel: (T) => {
1738
+ const z = d("prescription.history.rowLabel", {
1739
+ date: wt(T, F)
1739
1740
  });
1740
- return c ? `${F}, ${$.patient.lastName} ${$.patient.firstName}` : F;
1741
+ return o ? `${z}, ${T.patient.lastName} ${T.patient.firstName}` : z;
1741
1742
  },
1742
1743
  privacyMode: N,
1743
- toolbar: m,
1744
- caption: b ?? d("prescription.history.caption"),
1745
- defaultSorting: Jr,
1744
+ toolbar: f,
1745
+ caption: g ?? d("prescription.history.caption"),
1746
+ defaultSorting: Zr,
1746
1747
  status: a,
1747
- gridId: x ? `${x}-grid` : void 0,
1748
+ gridId: k ? `${k}-grid` : void 0,
1748
1749
  empty: {
1749
1750
  title: d("prescription.history.emptyTitle"),
1750
1751
  description: d("prescription.history.emptyBody")
1751
1752
  },
1752
1753
  error: {
1753
1754
  title: d("prescription.history.errorTitle"),
1754
- onRetry: k
1755
+ onRetry: S
1755
1756
  }
1756
1757
  }
1757
1758
  )
@@ -1759,14 +1760,14 @@ const Qi = Ge(function({
1759
1760
  );
1760
1761
  });
1761
1762
  export {
1762
- je as E,
1763
- Rr as P,
1764
- Qi as a,
1765
- Hr as b,
1766
- Mr as c,
1763
+ Ge as E,
1764
+ zr as P,
1765
+ Yi as a,
1766
+ Kr as b,
1767
+ Lr as c,
1767
1768
  xt as d,
1768
1769
  ot as i,
1769
- Dr as n,
1770
+ Fr as n,
1770
1771
  kt as v
1771
1772
  };
1772
- //# sourceMappingURL=prescription-history-CYCg6nxp.js.map
1773
+ //# sourceMappingURL=prescription-history-CFs3JMIE.js.map