@bahmni/home-app 0.0.1-dev.358 → 0.0.1-dev.361

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { jsx as r, jsxs as h, Fragment as Q } from "react/jsx-runtime";
2
- import { m as x, u as W, a as Y, b as J, t as X, g as Z, e as ee, d as te } from "./index-iIc37ze0.js";
1
+ import { jsx as r, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
+ import { g as G, u as Y, K as W, h as J, n as X, a as Z, U as ee, p as te } from "./index-2XTy38Wl.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
4
+ import { useState as l, useCallback as p, useEffect as I, useMemo as _ } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", de = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -34,15 +34,15 @@ const Te = [
34
34
  "uploadedOn",
35
35
  "uploadedBy"
36
36
  ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ne = ({ config: a, encounterUuids: g }) => {
37
- const [s, w] = l(!1), [o, U] = l(
37
+ const [s, U] = l(!1), [o, w] = l(
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = x(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
- U(e), w(!0);
43
- }, []), H = _(() => {
44
- w(!1), U(null), O(/* @__PURE__ */ new Set());
45
- }, []), v = _((e) => {
41
+ ), E = G(), { t: n } = Y(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = p((e) => {
42
+ w(e), U(!0);
43
+ }, []), H = p(() => {
44
+ U(!1), w(null), O(/* @__PURE__ */ new Set());
45
+ }, []), v = p((e) => {
46
46
  O((t) => new Set(t).add(e));
47
47
  }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
48
48
  queryKey: [
@@ -89,24 +89,24 @@ const Te = [
89
89
  e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const j = _(
92
+ const K = p(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), N = p(
97
+ ), N = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), P = p(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), z = p(() => ie(N, n), [N, n]), G = p(
100
+ ), j = _(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = _(() => ie(N, n), [N, n]), z = _(
101
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
105
  [N]
106
- ), T = p(
106
+ ), T = _(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), K = _(
109
+ ), Q = p(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,24 +137,24 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ h(Q, { children: [
140
+ return /* @__PURE__ */ h(x, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: z,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: P,
146
+ rows: j,
147
147
  loading: q,
148
148
  errorStateMessage: b ? y?.message : null,
149
- sortable: G,
149
+ sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
- renderCell: K,
151
+ renderCell: Q,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
155
  totalItems: F,
156
156
  page: f,
157
- onPageChange: j
157
+ onPageChange: K
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ r(
@@ -0,0 +1,293 @@
1
+ import { jsx as i, jsxs as G, Fragment as ge } from "react/jsx-runtime";
2
+ import { u as he, g as pe, E as be, J as Ne, b as Oe, d as Te, c as Ee, e as Ie, f as Ae, i as ve, R as _e, v as Fe, s as K, a as Re, j as Y, k as x, n as Se, U as P, l as Ue, m as Ce, p as Be, G as Le, N as De } from "./index-2XTy38Wl.js";
3
+ import { useQueryClient as Me, useQuery as O } from "@tanstack/react-query";
4
+ import { useState as Q, useMemo as d, useCallback as l } from "react";
5
+ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", we = "FormsTable-module_customAccordianItem__isszs", T = {
6
+ formsTableBody: ke,
7
+ modalHeading: qe,
8
+ customAccordianItem: we
9
+ }, He = "startConsultation", Ge = ({
10
+ episodeOfCareUuids: S,
11
+ encounterUuids: u,
12
+ config: J,
13
+ disableActions: X = !1,
14
+ activeEncounterUuid: g = null
15
+ }) => {
16
+ const { t: n } = he(), c = pe(), [h, U] = Q(!1), [t, C] = Q(null), {
17
+ numberOfVisits: Z,
18
+ hideThumbnail: W = !1,
19
+ forms: p
20
+ } = J ?? {}, ee = be(
21
+ De.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: b } = Ne(), E = ee && !X && !!g, B = Oe(
23
+ S,
24
+ u
25
+ ), re = Me(), {
26
+ data: L = [],
27
+ isLoading: D,
28
+ isError: M,
29
+ error: oe,
30
+ refetch: ae
31
+ } = O({
32
+ queryKey: ["forms", c, S],
33
+ queryFn: () => Te(c, void 0, Z),
34
+ enabled: !!c && !B
35
+ }), k = d(() => {
36
+ let e = L;
37
+ return u && u.length > 0 && (e = e.filter(
38
+ (r) => u.includes(r.encounterUuid)
39
+ )), Array.isArray(p) && p.length > 0 && (e = e.filter(
40
+ (r) => p.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
+ )), e;
42
+ }, [L, u, p]), { data: N = [] } = O({
43
+ queryKey: ["observationForms"],
44
+ queryFn: () => Ee()
45
+ }), q = l(
46
+ (e) => {
47
+ const r = N.find((a) => a.name === e);
48
+ if (!r?.privileges || r.privileges.length === 0) return !0;
49
+ if (!b || b.length === 0) return !1;
50
+ const o = new Set(b.map((a) => a.name));
51
+ return r.privileges.some(
52
+ (a) => o.has(a.privilegeName) && a.editable
53
+ );
54
+ },
55
+ [N, b]
56
+ ), f = l(
57
+ (e) => !g || e.encounterUuid !== g ? !1 : q(e.formName),
58
+ [g, q]
59
+ ), w = l(
60
+ (e) => N.find((r) => r.name === e)?.uuid,
61
+ [N]
62
+ ), I = d(() => {
63
+ if (t)
64
+ return w(t.formName);
65
+ }, [t, w]), {
66
+ data: m,
67
+ isLoading: se,
68
+ isError: te,
69
+ error: A
70
+ } = O({
71
+ queryKey: ["formMetadata", I],
72
+ queryFn: () => Ie(I),
73
+ enabled: !!I && h
74
+ }), {
75
+ data: v,
76
+ isLoading: ne,
77
+ isError: ie,
78
+ error: _
79
+ } = O({
80
+ queryKey: ["formsEncounterFHIR", t?.encounterUuid],
81
+ queryFn: () => Ae(t.encounterUuid),
82
+ enabled: !!t?.encounterUuid && h
83
+ });
84
+ ve(
85
+ (e) => {
86
+ e.patientUUID === c && e.updatedConcepts.size > 0 && (ae(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
87
+ },
88
+ [c]
89
+ );
90
+ const de = d(() => !v?.entry || !t?.formName ? [] : v.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => _e(e) ? Fe(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [v, t?.formName]), le = d(() => {
91
+ if (!m?.schema) return;
92
+ const e = [], r = (o) => {
93
+ (o ?? []).forEach((a) => {
94
+ const s = a;
95
+ s.id != null && e.push(String(s.id)), s.controls && r(s.controls);
96
+ });
97
+ };
98
+ return r(
99
+ m.schema.controls ?? []
100
+ ), e.length > 0 ? e : void 0;
101
+ }, [m]), me = d(() => {
102
+ if (!m?.schema) return;
103
+ const e = {}, r = (o, a) => {
104
+ for (const s of o)
105
+ if (s.type === "section") {
106
+ const R = s.label?.value ?? "Section";
107
+ r(s.controls ?? [], R);
108
+ } else
109
+ s.id != null && a && (e[String(s.id)] = a), s.controls && r(s.controls, a);
110
+ };
111
+ return r(
112
+ m.schema.controls ?? [],
113
+ null
114
+ ), Object.keys(e).length > 0 ? e : void 0;
115
+ }, [m]), ue = d(() => {
116
+ if (A)
117
+ return K(A).message;
118
+ if (_)
119
+ return K(_).message;
120
+ }, [A, _]), y = d(
121
+ () => [
122
+ { key: "recordedOn", header: n("RECORDED_ON") },
123
+ { key: "recordedBy", header: n("RECORDED_BY") }
124
+ ],
125
+ [n]
126
+ ), H = d(
127
+ () => [...y, { key: "actions", header: n("ACTIONS") }],
128
+ [y, n]
129
+ ), ce = l(
130
+ (e) => E && e.some((r) => f(r)) ? H : y,
131
+ [E, f, H, y]
132
+ ), fe = y, ye = d(
133
+ () => [
134
+ { key: "recordedOn", sortable: !0 },
135
+ { key: "recordedBy", sortable: !0 }
136
+ ],
137
+ []
138
+ ), V = d(() => {
139
+ const e = k.reduce(
140
+ (r, o) => {
141
+ const a = o.formName;
142
+ r[a] ??= [];
143
+ const s = o.providers.map((R) => R.providerName).filter(Boolean).join(", ");
144
+ return r[a].push({
145
+ id: o.encounterUuid,
146
+ formName: o.formName,
147
+ recordedOn: Re(o.encounterDateTime, n, !0).formattedResult,
148
+ recordedBy: s ?? "--",
149
+ encounterDateTime: o.encounterDateTime,
150
+ encounterUuid: o.encounterUuid
151
+ }), r;
152
+ },
153
+ {}
154
+ );
155
+ return Object.entries(e).map(
156
+ ([r, o]) => ({
157
+ formName: r,
158
+ records: o.sort(
159
+ (a, s) => s.encounterDateTime - a.encounterDateTime
160
+ )
161
+ })
162
+ ).sort((r, o) => r.formName.localeCompare(o.formName));
163
+ }, [k, n]), j = l((e) => {
164
+ C(e), U(!0);
165
+ }, []), $ = l(() => {
166
+ U(!1), C(null);
167
+ }, []), F = l((e) => {
168
+ globalThis.dispatchEvent(
169
+ new CustomEvent(He, {
170
+ detail: {
171
+ editOnly: "observationForms",
172
+ editTitle: "EDIT_OBSERVATION_FORM_TITLE",
173
+ editEncounterUuid: e.encounterUuid,
174
+ editFormName: e.formName,
175
+ directFormMode: !0
176
+ }
177
+ })
178
+ );
179
+ }, []), z = l(
180
+ (e, r) => {
181
+ switch (r) {
182
+ case "recordedOn":
183
+ return /* @__PURE__ */ i(Se, { onClick: () => j(e), children: e.recordedOn });
184
+ case "recordedBy":
185
+ return e.recordedBy;
186
+ case "actions":
187
+ return f(e) ? /* @__PURE__ */ i(
188
+ Y,
189
+ {
190
+ label: n("EDIT_OBSERVATION_FORM"),
191
+ kind: "ghost",
192
+ size: "sm",
193
+ testId: `edit-form-${e.encounterUuid}`,
194
+ onClick: () => F(e),
195
+ children: /* @__PURE__ */ i(x, {})
196
+ }
197
+ ) : null;
198
+ default:
199
+ return null;
200
+ }
201
+ },
202
+ [j, F, f, n]
203
+ );
204
+ return /* @__PURE__ */ G(ge, { children: [
205
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: D || M || V.length === 0 || B ? /* @__PURE__ */ i(
206
+ P,
207
+ {
208
+ headers: fe,
209
+ ariaLabel: n("FORMS_HEADING"),
210
+ rows: [],
211
+ loading: D,
212
+ errorStateMessage: M ? oe?.message : void 0,
213
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
214
+ renderCell: z,
215
+ className: T.formsTableBody,
216
+ dataTestId: "forms-table"
217
+ }
218
+ ) : /* @__PURE__ */ i(Ue, { align: "start", children: V.map((e, r) => {
219
+ const { formName: o, records: a } = e, s = ce(a);
220
+ return /* @__PURE__ */ i(
221
+ Ce,
222
+ {
223
+ title: o,
224
+ className: T.customAccordianItem,
225
+ testId: `accordian-title-${o}`,
226
+ open: r === 0,
227
+ children: /* @__PURE__ */ i(
228
+ P,
229
+ {
230
+ headers: s,
231
+ ariaLabel: n("FORMS_HEADING"),
232
+ rows: a,
233
+ loading: !1,
234
+ errorStateMessage: "",
235
+ sortable: ye,
236
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
237
+ renderCell: z,
238
+ className: T.formsTableBody,
239
+ dataTestId: `forms-table-${o}`
240
+ }
241
+ )
242
+ },
243
+ o
244
+ );
245
+ }) }) }),
246
+ h && t && /* @__PURE__ */ i(
247
+ Be,
248
+ {
249
+ id: "modalIdForActionAreaLayout",
250
+ portalId: "main-display-area",
251
+ open: h,
252
+ onRequestClose: $,
253
+ modalHeading: /* @__PURE__ */ G("div", { className: T.modalHeading, children: [
254
+ /* @__PURE__ */ i("span", { children: t.formName }),
255
+ E && f(t) && /* @__PURE__ */ i(
256
+ Y,
257
+ {
258
+ label: n("EDIT_OBSERVATION_FORM"),
259
+ kind: "ghost",
260
+ size: "sm",
261
+ testId: `edit-form-modal-${t.encounterUuid}`,
262
+ onClick: () => {
263
+ $(), F(t);
264
+ },
265
+ children: /* @__PURE__ */ i(x, {})
266
+ }
267
+ )
268
+ ] }),
269
+ modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
270
+ passiveModal: !0,
271
+ size: "md",
272
+ testId: "form-details-modal",
273
+ children: /* @__PURE__ */ i(
274
+ Le,
275
+ {
276
+ observations: de,
277
+ isLoading: se || ne,
278
+ isError: te || ie,
279
+ errorMessage: ue,
280
+ emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
281
+ testIdPrefix: t.formName,
282
+ hideThumbnail: W,
283
+ controlOrder: le,
284
+ sectionMap: me
285
+ }
286
+ )
287
+ }
288
+ )
289
+ ] });
290
+ };
291
+ export {
292
+ Ge as default
293
+ };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-Cta6UioJ.js";
2
- import { a0 as d, a1 as f, a2 as e } from "./index-iIc37ze0.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BAEoD1Iy.js";
2
+ import { a0 as d, a1 as f, a2 as e } from "./index-2XTy38Wl.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-Cta6UioJ.js";
2
- import { a0 as v, a1 as C, a2 as e } from "./index-iIc37ze0.js";
1
+ import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-BAEoD1Iy.js";
2
+ import { a0 as v, a1 as C, a2 as e } from "./index-2XTy38Wl.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,9 +1,9 @@
1
1
  import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
- import { m as q, a as K, u as N, y as Q, V as k, c as M, L as w, D as x, R as H, F as j, e as z, T as P, p as D, O as J, q as Y, r as W, s as X, v as Z, A as ee } from "./index-iIc37ze0.js";
3
- import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as $, useMemo as R } from "react";
5
- const F = (a, n, d, l, b, r) => {
6
- const t = J(a, n, b), s = t.value, o = Y(s);
2
+ import { g as B, K as q, u as N, o as M, q as H, i as Q, V as k, H as w, M as x, r as G, U as z, t as j, F, y as P, w as J, I as W, x as X, z as Z, A as ee } from "./index-2XTy38Wl.js";
3
+ import { useQueries as te, useQuery as ae } from "@tanstack/react-query";
4
+ import { useRef as se, useEffect as $, useMemo as E } from "react";
5
+ const A = (t, n, d, l, b, r) => {
6
+ const a = P(t, n, b), s = a.value, o = J(s);
7
7
  let i = s;
8
8
  o === "Image" && (i = /* @__PURE__ */ u(
9
9
  X,
@@ -22,54 +22,54 @@ const F = (a, n, d, l, b, r) => {
22
22
  }
23
23
  )), o === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
24
  const m = b("OBSERVATIONS_RECORDED_BY", {
25
- provider: t.provider
26
- }), p = a.display, y = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${y}-${p}-${d}-${n}` : `${y}-${p}-${d}-${n}`;
25
+ provider: a.provider
26
+ }), p = t.display, y = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${y}-${p}-${d}-${n}` : `${y}-${p}-${d}-${n}`;
27
27
  return /* @__PURE__ */ u(
28
28
  W,
29
29
  {
30
- header: t.header,
30
+ header: a.header,
31
31
  value: i,
32
32
  info: m,
33
33
  id: c,
34
34
  testId: c,
35
35
  ariaLabel: c
36
36
  },
37
- `obs-${a.id}`
37
+ `obs-${t.id}`
38
38
  );
39
- }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
- D,
39
+ }, re = (t, n, d, l, b, r, a) => /* @__PURE__ */ u(
40
+ F,
41
41
  {
42
- title: a.display,
43
- id: `grouped-obs-${a.display}-${l}`,
42
+ title: t.display,
43
+ id: `grouped-obs-${t.display}-${l}`,
44
44
  open: d,
45
- children: a.members?.map(
46
- (s, o) => F(
45
+ children: t.members?.map(
46
+ (s, o) => A(
47
47
  s,
48
48
  o,
49
49
  b,
50
50
  r,
51
51
  n,
52
- t
52
+ a
53
53
  )
54
54
  )
55
55
  },
56
- `grouped-obs-${a.id}`
56
+ `grouped-obs-${t.id}`
57
57
  ), oe = ({
58
- groupedData: a,
58
+ groupedData: t,
59
59
  title: n = "",
60
60
  hideThumbnail: d
61
61
  }) => {
62
- const { t: l } = N(), b = (r, t, s) => {
63
- const o = P(r.encounterDetails, l);
62
+ const { t: l } = N(), b = (r, a, s) => {
63
+ const o = j(r.encounterDetails, l);
64
64
  return /* @__PURE__ */ S(
65
- D,
65
+ F,
66
66
  {
67
67
  title: o,
68
68
  id: `encounter-${r.encounterId}`,
69
- open: t,
69
+ open: a,
70
70
  children: [
71
71
  r.observations.map(
72
- (i, m) => F(
72
+ (i, m) => A(
73
73
  i,
74
74
  m,
75
75
  s,
@@ -82,7 +82,7 @@ const F = (a, n, d, l, b, r) => {
82
82
  (i, m) => re(
83
83
  i,
84
84
  l,
85
- t,
85
+ a,
86
86
  m,
87
87
  s,
88
88
  n,
@@ -100,103 +100,103 @@ const F = (a, n, d, l, b, r) => {
100
100
  id: "obs-by-encounter",
101
101
  "data-testid": "obs-by-encounter-test-id",
102
102
  "aria-label": "obs-by-encounter-aria-label",
103
- children: a.map(
104
- (r, t) => b(r, t === 0, t)
103
+ children: t.map(
104
+ (r, a) => b(r, a === 0, a)
105
105
  )
106
106
  }
107
107
  );
108
108
  }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
109
  observations: ie,
110
110
  title: ne
111
- }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], pe = ({ config: a }) => {
112
- const n = a, {
111
+ }, de = (t) => ["conceptUuid", t], le = (t, n) => ["observations", t, ...n], pe = ({ config: t }) => {
112
+ const n = t, {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), t = q(), { addNotification: s } = K(), { t: o } = N(), i = ae({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), a = B(), { addNotification: s } = q(), { t: o } = N(), i = te({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
- queryFn: () => Q(e),
119
+ queryFn: () => M(e),
120
120
  enabled: !!e
121
121
  }))
122
122
  });
123
123
  $(() => {
124
124
  i.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const B = d[h];
126
+ const Y = d[h];
127
127
  s({
128
128
  title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: B }),
129
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: Y }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
134
  }, [i, d]);
135
- const m = R(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = R(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = R(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
135
+ const m = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = E(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
136
  data: c,
137
- isLoading: L,
138
- isError: E,
139
- refetch: O
140
- } = te({
141
- queryKey: le(t, p),
142
- queryFn: () => k(t, p),
143
- enabled: !!t && p.length > 0 && y
137
+ isLoading: D,
138
+ isError: g,
139
+ refetch: T
140
+ } = ae({
141
+ queryKey: le(a, p),
142
+ queryFn: () => H(a, p),
143
+ enabled: !!a && p.length > 0 && y
144
144
  });
145
- M(
145
+ Q(
146
146
  (e) => {
147
- e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
147
+ e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => p.includes(h)
149
- ) && O();
149
+ ) && T();
150
150
  },
151
- [t, O]
151
+ [a, T]
152
152
  ), $(() => {
153
- E && s({
153
+ g && s({
154
154
  title: o("ERROR_DEFAULT_TITLE"),
155
155
  message: o("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
- }, [E]);
159
- const f = R(() => {
158
+ }, [g]);
159
+ const O = E(() => {
160
160
  if (!c) return [];
161
- const e = w(c), h = x(e);
162
- return H(h);
163
- }, [c]), G = [
161
+ const e = k(c), h = w(e);
162
+ return x(h);
163
+ }, [c]), L = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], g = L || !y, _ = E && y, A = (!c || c.entry?.length === 0 || p.length === 0) && y, V = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, C = A ? o("NO_OBSERVATIONS_FOUND") : void 0, U = f.length > 0 && !g && !_, T = n.titleTranslationKey, v = T ? o(T) : "";
167
+ ], f = D || !y, _ = g && y, U = (!c || c.entry?.length === 0 || p.length === 0) && y, V = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, C = U ? o("NO_OBSERVATIONS_FOUND") : void 0, K = O.length > 0 && !f && !_, R = n.titleTranslationKey, v = R ? o(R) : "";
168
168
  return /* @__PURE__ */ S(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
- "data-testid": T ? `observations-${v}` : "observations",
172
+ "data-testid": R ? `observations-${v}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
174
  className: I.observations,
175
175
  children: [
176
176
  /* @__PURE__ */ u(
177
- j,
177
+ G,
178
178
  {
179
179
  id: "observations-title",
180
- testId: T ? `observations-title-${v}` : "observations-title",
180
+ testId: R ? `observations-title-${v}` : "observations-title",
181
181
  title: v,
182
182
  className: I.title,
183
183
  children: /* @__PURE__ */ u("p", { children: v })
184
184
  }
185
185
  ),
186
- U ? /* @__PURE__ */ u(
186
+ K ? /* @__PURE__ */ u(
187
187
  oe,
188
188
  {
189
- groupedData: f,
189
+ groupedData: O,
190
190
  title: v,
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
194
194
  z,
195
195
  {
196
- headers: G,
196
+ headers: L,
197
197
  rows: [],
198
198
  ariaLabel: o("OBSERVATIONS"),
199
- loading: g,
199
+ loading: f,
200
200
  errorStateMessage: V,
201
201
  emptyStateMessage: C,
202
202
  dataTestId: "observations-table"
@@ -1,4 +1,4 @@
1
- import { a3 as we, a4 as z, a5 as xt, a6 as B, a1 as q, a2 as y, a7 as Ro, a8 as ye, a9 as R, aa as _, ab as k, ac as N, ad as A, ae as bs, af as ir, ag as $e, ah as G, ai as Hn, aj as Vn, ak as dt, al as D, am as xs, an as cn, ao as Be, ap as ws, aq as qt, ar as zt, as as $s, at as Cs, au as $n, av as Ss, aw as Nr, ax as Bt, ay as zo, az as ks, aA as Es, aB as j, aC as Gr, aD as Ms, aE as Ds, aF as sr, aG as As, aH as Ts, aI as zn, aJ as Fs, aK as Is, aL as Z, aM as Ps, aN as Ls } from "./index-iIc37ze0.js";
1
+ import { a3 as we, a4 as z, a5 as xt, a6 as B, a1 as q, a2 as y, a7 as Ro, a8 as ye, a9 as R, aa as _, ab as k, ac as N, ad as A, ae as bs, af as ir, ag as $e, ah as G, ai as Hn, aj as Vn, ak as dt, al as D, am as xs, an as cn, ao as Be, ap as ws, aq as qt, ar as zt, as as $s, at as Cs, au as $n, av as Ss, aw as Nr, ax as Bt, ay as zo, az as ks, aA as Es, aB as j, aC as Gr, aD as Ms, aE as Ds, aF as sr, aG as As, aH as Ts, aI as zn, aJ as Fs, aK as Is, aL as Z, aM as Ps, aN as Ls } from "./index-2XTy38Wl.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {