@bahmni/home-app 0.0.1-dev.466 → 0.0.1-dev.472

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,10 +1,10 @@
1
1
  import { jsx as n, jsxs as H, Fragment as ne } from "react/jsx-runtime";
2
- import { a as ie, u as de, s as le, Z as me, f as ue, G as ce, y as fe, v as ye, w as Ne, k as be, M as pe, g as ge, h as he, N as Ae, q as K, C as $, b as Oe, $ as V, i as Te, j as Ie, c as _e, A as Ee, l as Ce } from "./index-BXrO9hti.js";
3
- import { useQueryClient as ve, useQuery as I } from "@tanstack/react-query";
4
- import { useState as G, useMemo as i, useCallback as d } from "react";
5
- const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_modalHeading__wnTmA", Be = "FormsTable-module_customAccordianItem__isszs", p = {
6
- formsTableBody: Le,
7
- modalHeading: Re,
2
+ import { u as ie, Q as de, f as le, p as me, g as ue, h as ce, E as fe, q as ye, $ as pe, i as Ne, X as ge, j as he, H as be, z as Oe, C as $, l as z, t as Te, M as V, O as Ie, S as Ae, R as _e, m as Ee, n as Re } from "./index-Cee5-kEn.js";
3
+ import { useQueryClient as ve, useQuery as A } from "@tanstack/react-query";
4
+ import { useState as Q, useMemo as i, useCallback as d } from "react";
5
+ const Ce = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", Be = "FormsTable-module_customAccordianItem__isszs", g = {
6
+ formsTableBody: Ce,
7
+ modalHeading: Le,
8
8
  customAccordianItem: Be
9
9
  }, De = ({
10
10
  episodeOfCareUuids: _,
@@ -13,71 +13,71 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
13
13
  disableActions: x = !1,
14
14
  activeEncounterUuid: y = null
15
15
  }) => {
16
- const { t: o } = ie(), m = de(), [g, E] = G(!1), [t, C] = G(null), {
17
- numberOfVisits: z,
18
- hideThumbnail: Q = !1,
19
- forms: N
20
- } = j ?? {}, Z = le(
21
- Ce.EDIT_OBSERVATIONS
22
- ), { userPrivileges: b } = me(), h = Z && !x && !!y, v = ue(
16
+ const { t: o } = ie(), m = de(), [h, E] = Q(!1), [s, R] = Q(null), {
17
+ numberOfVisits: K,
18
+ hideThumbnail: G = !1,
19
+ forms: p
20
+ } = j ?? {}, P = le(
21
+ Re.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: N } = me(), b = P && !x && !!y, v = ue(
23
23
  _,
24
24
  l
25
- ), P = ve(), {
26
- data: L = [],
27
- isLoading: R,
25
+ ), X = ve(), {
26
+ data: C = [],
27
+ isLoading: L,
28
28
  isError: B,
29
- error: Y,
30
- refetch: J
31
- } = I({
29
+ error: W,
30
+ refetch: Y
31
+ } = A({
32
32
  queryKey: ["forms", m, _],
33
- queryFn: () => ce(m, void 0, z),
33
+ queryFn: () => ce(m, void 0, K),
34
34
  enabled: !!m && !v
35
35
  }), F = i(() => {
36
- let e = L;
36
+ let e = C;
37
37
  return l && l.length > 0 && (e = e.filter(
38
38
  (r) => l.includes(r.encounterUuid)
39
- )), Array.isArray(N) && N.length > 0 && (e = e.filter(
40
- (r) => N.some((a) => a.toLowerCase() === r.formName.toLowerCase())
39
+ )), Array.isArray(p) && p.length > 0 && (e = e.filter(
40
+ (r) => p.some((a) => a.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [L, l, N]), { data: M = [] } = I({
42
+ }, [C, l, p]), { data: S = [] } = A({
43
43
  queryKey: ["observationForms"],
44
44
  queryFn: () => fe()
45
- }), S = d(
45
+ }), M = d(
46
46
  (e) => {
47
- const r = M.find(
48
- (s) => s.name.toLowerCase() === e.toLowerCase()
47
+ const r = S.find(
48
+ (t) => t.name.toLowerCase() === e.toLowerCase()
49
49
  );
50
50
  if (!r?.privileges || r.privileges.length === 0) return !0;
51
- if (!b || b.length === 0) return !1;
52
- const a = new Set(b.map((s) => s.name));
51
+ if (!N || N.length === 0) return !1;
52
+ const a = new Set(N.map((t) => t.name));
53
53
  return r.privileges.some(
54
- (s) => a.has(s.privilegeName) && s.editable
54
+ (t) => a.has(t.privilegeName) && t.editable
55
55
  );
56
56
  },
57
- [M, b]
57
+ [S, N]
58
58
  ), u = d(
59
- (e) => !y || e.encounterUuid !== y ? !1 : S(e.formName),
60
- [y, S]
59
+ (e) => !y || e.encounterUuid !== y ? !1 : M(e.formName),
60
+ [y, M]
61
61
  ), {
62
- data: A,
63
- isLoading: W,
64
- isError: X,
65
- error: O
66
- } = I({
67
- queryKey: ["formsEncounterFHIR", t?.encounterUuid],
68
- queryFn: () => ye(t.encounterUuid),
69
- enabled: !!t?.encounterUuid && g
62
+ data: O,
63
+ isLoading: J,
64
+ isError: Z,
65
+ error: T
66
+ } = A({
67
+ queryKey: ["formsEncounterFHIR", s?.encounterUuid],
68
+ queryFn: () => ye(s.encounterUuid),
69
+ enabled: !!s?.encounterUuid && h
70
70
  });
71
- Ne(
71
+ pe(
72
72
  (e) => {
73
- e.patientUUID === m && (J(), P.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
73
+ e.patientUUID === m && (Y(), X.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
74
74
  },
75
75
  [m]
76
76
  );
77
- const ee = i(() => !A?.entry || !t?.formName ? [] : A.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => be(e) ? pe(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [A, t?.formName]), re = i(() => {
78
- if (O)
79
- return ge(O).message;
80
- }, [O]), c = i(
77
+ const ee = i(() => !O?.entry || !s?.formName ? [] : O.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Ne(e) ? ge(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [O, s?.formName]), re = i(() => {
78
+ if (T)
79
+ return he(T).message;
80
+ }, [T]), c = i(
81
81
  () => [
82
82
  { key: "recordedOn", header: o("RECORDED_ON") },
83
83
  { key: "recordedBy", header: o("RECORDED_BY") }
@@ -87,9 +87,9 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
87
87
  () => [...c, { key: "actions", header: o("ACTIONS") }],
88
88
  [c, o]
89
89
  ), ae = d(
90
- (e) => h && e.some((r) => u(r)) ? U : c,
91
- [h, u, U, c]
92
- ), oe = c, te = i(
90
+ (e) => b && e.some((r) => u(r)) ? U : c,
91
+ [b, u, U, c]
92
+ ), oe = c, se = i(
93
93
  () => [
94
94
  { key: "recordedOn", sortable: !0 },
95
95
  { key: "recordedBy", sortable: !0 }
@@ -98,13 +98,13 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
98
98
  ), D = i(() => {
99
99
  const e = F.reduce(
100
100
  (r, a) => {
101
- const s = a.formName;
102
- r[s] ??= [];
103
- const f = a.providers.map((se) => se.providerName).filter(Boolean).join(", ");
104
- return r[s].push({
101
+ const t = a.formName;
102
+ r[t] ??= [];
103
+ const f = a.providers.map((te) => te.providerName).filter(Boolean).join(", ");
104
+ return r[t].push({
105
105
  id: a.encounterUuid,
106
106
  formName: a.formName,
107
- recordedOn: he(a.encounterDateTime, o, !0).formattedResult,
107
+ recordedOn: be(a.encounterDateTime, o, !0).formattedResult,
108
108
  recordedBy: f ?? "--",
109
109
  encounterDateTime: a.encounterDateTime,
110
110
  encounterUuid: a.encounterUuid
@@ -116,16 +116,16 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
116
116
  ([r, a]) => ({
117
117
  formName: r,
118
118
  records: a.sort(
119
- (s, f) => f.encounterDateTime - s.encounterDateTime
119
+ (t, f) => f.encounterDateTime - t.encounterDateTime
120
120
  )
121
121
  })
122
122
  ).sort((r, a) => r.formName.localeCompare(a.formName));
123
123
  }, [F, o]), k = d((e) => {
124
- C(e), E(!0);
124
+ R(e), E(!0);
125
125
  }, []), w = d(() => {
126
- E(!1), C(null);
127
- }, []), T = d((e) => {
128
- Ae({
126
+ E(!1), R(null);
127
+ }, []), I = d((e) => {
128
+ Oe({
129
129
  context: {
130
130
  encounter: { resourceType: "Encounter", id: e.encounterUuid },
131
131
  formName: e.formName,
@@ -137,48 +137,48 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
137
137
  (e, r) => {
138
138
  switch (r) {
139
139
  case "recordedOn":
140
- return /* @__PURE__ */ n(Oe, { onClick: () => k(e), children: e.recordedOn });
140
+ return /* @__PURE__ */ n(Te, { onClick: () => k(e), children: e.recordedOn });
141
141
  case "recordedBy":
142
142
  return e.recordedBy;
143
143
  case "actions":
144
144
  return u(e) ? /* @__PURE__ */ n(
145
- K,
145
+ $,
146
146
  {
147
147
  label: o("EDIT_OBSERVATION_FORM"),
148
148
  kind: "ghost",
149
149
  size: "sm",
150
150
  testId: `edit-form-${e.encounterUuid}`,
151
- onClick: () => T(e),
152
- children: /* @__PURE__ */ n($, {})
151
+ onClick: () => I(e),
152
+ children: /* @__PURE__ */ n(z, {})
153
153
  }
154
154
  ) : null;
155
155
  default:
156
156
  return null;
157
157
  }
158
158
  },
159
- [k, T, u, o]
159
+ [k, I, u, o]
160
160
  );
161
161
  return /* @__PURE__ */ H(ne, { children: [
162
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: R || B || D.length === 0 || v ? /* @__PURE__ */ n(
162
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || B || D.length === 0 || v ? /* @__PURE__ */ n(
163
163
  V,
164
164
  {
165
165
  headers: oe,
166
166
  ariaLabel: o("FORMS_HEADING"),
167
167
  rows: [],
168
- loading: R,
169
- errorStateMessage: B ? Y?.message : void 0,
168
+ loading: L,
169
+ errorStateMessage: B ? W?.message : void 0,
170
170
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
171
171
  renderCell: q,
172
- className: p.formsTableBody,
172
+ className: g.formsTableBody,
173
173
  dataTestId: "forms-table"
174
174
  }
175
- ) : /* @__PURE__ */ n(Te, { align: "start", children: D.map((e, r) => {
176
- const { formName: a, records: s } = e, f = ae(s);
175
+ ) : /* @__PURE__ */ n(Ie, { align: "start", children: D.map((e, r) => {
176
+ const { formName: a, records: t } = e, f = ae(t);
177
177
  return /* @__PURE__ */ n(
178
- Ie,
178
+ Ae,
179
179
  {
180
180
  title: a,
181
- className: p.customAccordianItem,
181
+ className: g.customAccordianItem,
182
182
  testId: `accordian-title-${a}`,
183
183
  open: r === 0,
184
184
  children: /* @__PURE__ */ n(
@@ -186,13 +186,13 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
186
186
  {
187
187
  headers: f,
188
188
  ariaLabel: o("FORMS_HEADING"),
189
- rows: s,
189
+ rows: t,
190
190
  loading: !1,
191
191
  errorStateMessage: "",
192
- sortable: te,
192
+ sortable: se,
193
193
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
194
194
  renderCell: q,
195
- className: p.formsTableBody,
195
+ className: g.formsTableBody,
196
196
  dataTestId: `forms-table-${a}`
197
197
  }
198
198
  )
@@ -200,30 +200,30 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
200
200
  a
201
201
  );
202
202
  }) }) }),
203
- g && t && /* @__PURE__ */ n(
203
+ h && s && /* @__PURE__ */ n(
204
204
  _e,
205
205
  {
206
206
  id: "modalIdForActionAreaLayout",
207
207
  portalId: "main-display-area",
208
- open: g,
208
+ open: h,
209
209
  onRequestClose: w,
210
- modalHeading: /* @__PURE__ */ H("div", { className: p.modalHeading, children: [
211
- /* @__PURE__ */ n("span", { children: t.formName }),
212
- h && u(t) && /* @__PURE__ */ n(
213
- K,
210
+ modalHeading: /* @__PURE__ */ H("div", { className: g.modalHeading, children: [
211
+ /* @__PURE__ */ n("span", { children: s.formName }),
212
+ b && u(s) && /* @__PURE__ */ n(
213
+ $,
214
214
  {
215
215
  label: o("EDIT_OBSERVATION_FORM"),
216
216
  kind: "ghost",
217
217
  size: "sm",
218
- testId: `edit-form-modal-${t.encounterUuid}`,
218
+ testId: `edit-form-modal-${s.encounterUuid}`,
219
219
  onClick: () => {
220
- w(), T(t);
220
+ w(), I(s);
221
221
  },
222
- children: /* @__PURE__ */ n($, {})
222
+ children: /* @__PURE__ */ n(z, {})
223
223
  }
224
224
  )
225
225
  ] }),
226
- modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
226
+ modalLabel: `${s.recordedOn} | ${s.recordedBy}`,
227
227
  passiveModal: !0,
228
228
  size: "md",
229
229
  testId: "form-details-modal",
@@ -231,13 +231,13 @@ const Le = "FormsTable-module_formsTableBody__SvGha", Re = "FormsTable-module_mo
231
231
  Ee,
232
232
  {
233
233
  observations: ee,
234
- isLoading: W,
235
- isError: X,
234
+ isLoading: J,
235
+ isError: Z,
236
236
  errorMessage: re,
237
237
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
238
- testIdPrefix: t.formName,
239
- hideThumbnail: Q,
240
- formName: t.formName
238
+ testIdPrefix: s.formName,
239
+ hideThumbnail: G,
240
+ formName: s.formName
241
241
  }
242
242
  )
243
243
  }
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CTijv4oG.js";
2
- import { a2 as d, a3 as f, a4 as e } from "./index-BXrO9hti.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-C8dmMwSG.js";
2
+ import { aa as d, ab as f, ac as e } from "./index-Cee5-kEn.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,11 +1,11 @@
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-CTijv4oG.js";
2
- import { a2 as v, a3 as C, a4 as e } from "./index-BXrO9hti.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-C8dmMwSG.js";
2
+ import { aa as v, ab as C, ac as e } from "./index-Cee5-kEn.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = v(), l = C(() => {
7
- const n = r.theme_preference || c;
8
- return n !== "system" ? n : a();
6
+ }), n = v(), l = C(() => {
7
+ const a = r.theme_preference || c;
8
+ return a !== "system" ? a : n();
9
9
  });
10
10
  return e(d.Provider, {
11
11
  value: t,
@@ -0,0 +1,246 @@
1
+ import { jsxs as S, jsx as n } from "react/jsx-runtime";
2
+ import { Q as z, a as G, u as U, y as H, g as x, r as J, s as Y, $ as j, G as W, J as P, K as X, Y as Z, c as ee, M as ae, v as se, w as V, W as re, A as te, H as ie, F as oe, I as ne, L as de, N as le } from "./index-Cee5-kEn.js";
3
+ import { useQueries as ce, useQuery as ue } from "@tanstack/react-query";
4
+ import { useRef as pe, useEffect as L, useMemo as E } from "react";
5
+ const me = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", he = "Observations-module_wrapper__muk2L", ve = "Observations-module_secondary__14nuS", R = {
6
+ observations: me,
7
+ title: be,
8
+ wrapper: he,
9
+ secondary: ve
10
+ }, B = (s, l, o, d, u, r) => {
11
+ const t = re(s, l, u), e = t.value, p = te(e);
12
+ let i = e;
13
+ p === "Image" && (i = /* @__PURE__ */ n(
14
+ ne,
15
+ {
16
+ imageSrc: e,
17
+ alt: e,
18
+ id: `${e}-img`,
19
+ hideThumbnail: r
20
+ }
21
+ )), p === "Video" && (i = /* @__PURE__ */ n(
22
+ de,
23
+ {
24
+ id: `${e}-video`,
25
+ videoSrc: e,
26
+ hideThumbnail: r
27
+ }
28
+ )), p === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
29
+ const m = /* @__PURE__ */ S("div", { className: R.wrapper, children: [
30
+ /* @__PURE__ */ n("span", { children: t.header.display }),
31
+ t.header.referenceRange && /* @__PURE__ */ n("span", { className: R.secondary, children: t.header.referenceRange })
32
+ ] }), c = u("OBSERVATIONS_RECORDED_BY", {
33
+ provider: t.provider
34
+ }), b = s.effectiveDateTime ? ie(s.effectiveDateTime, u, !0).formattedResult : void 0, T = /* @__PURE__ */ S("div", { className: R.wrapper, children: [
35
+ /* @__PURE__ */ n("span", { children: c }),
36
+ b && /* @__PURE__ */ n("span", { className: R.secondary, children: b })
37
+ ] }), h = s.display, v = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = d ? `${d}-${v}-${h}-${o}-${l}` : `${v}-${h}-${o}-${l}`;
38
+ return /* @__PURE__ */ n(
39
+ oe,
40
+ {
41
+ header: m,
42
+ value: i,
43
+ info: T,
44
+ id: O,
45
+ testId: O,
46
+ ariaLabel: O
47
+ },
48
+ `obs-${s.id}`
49
+ );
50
+ }, ye = (s, l, o, d, u, r, t) => /* @__PURE__ */ n(
51
+ V,
52
+ {
53
+ title: s.display,
54
+ id: `grouped-obs-${s.display}-${d}`,
55
+ open: o,
56
+ children: s.members?.map(
57
+ (e, p) => B(
58
+ e,
59
+ p,
60
+ u,
61
+ r,
62
+ l,
63
+ t
64
+ )
65
+ )
66
+ },
67
+ `grouped-obs-${s.id}`
68
+ ), Re = ({
69
+ groupedData: s,
70
+ title: l = "",
71
+ hideThumbnail: o
72
+ }) => {
73
+ const { t: d } = U(), u = (r, t, e) => {
74
+ const p = se(r.encounterDetails, d);
75
+ return /* @__PURE__ */ S(
76
+ V,
77
+ {
78
+ title: p,
79
+ id: `encounter-${r.encounterId}`,
80
+ open: t,
81
+ children: [
82
+ r.observations.map(
83
+ (i, m) => B(
84
+ i,
85
+ m,
86
+ e,
87
+ l,
88
+ d,
89
+ o
90
+ )
91
+ ),
92
+ r.groupedObservations.map(
93
+ (i, m) => ye(
94
+ i,
95
+ d,
96
+ t,
97
+ m,
98
+ e,
99
+ l,
100
+ o
101
+ )
102
+ )
103
+ ]
104
+ },
105
+ `encounter-${r.encounterId}`
106
+ );
107
+ };
108
+ return /* @__PURE__ */ n(
109
+ "div",
110
+ {
111
+ id: "obs-by-encounter",
112
+ "data-testid": "obs-by-encounter-test-id",
113
+ "aria-label": "obs-by-encounter-aria-label",
114
+ children: s.map(
115
+ (r, t) => u(r, t === 0, t)
116
+ )
117
+ }
118
+ );
119
+ }, Oe = (s) => ["conceptUuid", s], _e = (s, l, o, d) => [
120
+ "observations",
121
+ s,
122
+ ...l,
123
+ o,
124
+ d
125
+ ], Se = ({
126
+ config: s,
127
+ episodeOfCareUuids: l,
128
+ encounterUuids: o
129
+ }) => {
130
+ const d = s, {
131
+ conceptNames: u = [],
132
+ conceptUuid: r = [],
133
+ hideThumbnail: t = !1,
134
+ scope: e = "all"
135
+ } = d, p = pe(/* @__PURE__ */ new Set()), i = z(), { addNotification: m } = G(), { t: c } = U(), b = ce({
136
+ queries: u.map((a) => ({
137
+ queryKey: Oe(a),
138
+ queryFn: () => H(a),
139
+ enabled: !!a
140
+ }))
141
+ });
142
+ L(() => {
143
+ const a = b.some((k) => k.isError), y = p.current.size > 0;
144
+ a && !y ? (m({
145
+ title: c("ERROR_DEFAULT_TITLE"),
146
+ message: c("ERROR_FETCHING_OBSERVATIONS"),
147
+ type: "error"
148
+ }), p.current.add(0)) : !a && y && p.current.clear();
149
+ }, [b, m, c]);
150
+ const T = E(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), h = E(() => [.../* @__PURE__ */ new Set([...T, ...r])], [T, r]), v = E(() => u.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, u.length]), O = e === "latest" || e === "latest-encounter", F = x(
151
+ l,
152
+ o
153
+ ), {
154
+ data: _,
155
+ isLoading: w,
156
+ isError: N,
157
+ refetch: $
158
+ } = ue({
159
+ queryKey: _e(
160
+ i,
161
+ h,
162
+ o,
163
+ e
164
+ ),
165
+ queryFn: () => O ? J(
166
+ i,
167
+ h,
168
+ o
169
+ ) : Y(
170
+ i,
171
+ h,
172
+ o
173
+ ),
174
+ enabled: !!i && h.length > 0 && v && !F
175
+ });
176
+ j(
177
+ (a) => {
178
+ a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
179
+ (y) => h.includes(y)
180
+ ) && $();
181
+ },
182
+ [i, $]
183
+ ), L(() => {
184
+ N && m({
185
+ title: c("ERROR_DEFAULT_TITLE"),
186
+ message: c("ERROR_FETCHING_OBSERVATIONS"),
187
+ type: "error"
188
+ });
189
+ }, [N]);
190
+ const I = E(() => {
191
+ if (!_) return [];
192
+ let a = W(_);
193
+ e === "latest-encounter" && (a = P(a));
194
+ const y = X(a);
195
+ return Z(y);
196
+ }, [_, e]), K = [
197
+ { key: "name", header: "name" },
198
+ { key: "value", header: "value" },
199
+ { key: "form", header: "form" }
200
+ ], A = w || !v, D = N && v, Q = (!_ || _.entry?.length === 0 || h.length === 0) && v, q = D ? c("ERROR_FETCHING_OBSERVATIONS") : null, C = Q ? c("NO_OBSERVATIONS_FOUND") : void 0, M = I.length > 0 && !A && !D, g = d.titleTranslationKey, f = g ? c(g) : "";
201
+ return /* @__PURE__ */ S(
202
+ "div",
203
+ {
204
+ id: "observations",
205
+ "data-testid": g ? `observations-${f}` : "observations",
206
+ "aria-label": "observations-aria-label",
207
+ className: R.observations,
208
+ children: [
209
+ /* @__PURE__ */ n(
210
+ ee,
211
+ {
212
+ id: "observations-title",
213
+ testId: g ? `observations-title-${f}` : "observations-title",
214
+ title: f,
215
+ className: R.title,
216
+ children: /* @__PURE__ */ n("p", { children: f })
217
+ }
218
+ ),
219
+ M ? /* @__PURE__ */ n(
220
+ Re,
221
+ {
222
+ groupedData: I,
223
+ title: f,
224
+ hideThumbnail: t
225
+ }
226
+ ) : /* @__PURE__ */ n(
227
+ ae,
228
+ {
229
+ headers: K,
230
+ rows: [],
231
+ ariaLabel: c("OBSERVATIONS"),
232
+ loading: A,
233
+ errorStateMessage: q,
234
+ emptyStateMessage: C ?? c("NO_OBSERVATIONS_AVAILABLE"),
235
+ dataTestId: "observations-table"
236
+ }
237
+ )
238
+ ]
239
+ }
240
+ );
241
+ };
242
+ export {
243
+ Oe as conceptUuidQueryKeys,
244
+ Se as default,
245
+ _e as observationsQueryKeys
246
+ };