@bahmni/widgets 0.0.1-dev.117 → 0.0.1-dev.119

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,8 +1,8 @@
1
- import { jsxs as _, jsx as t, Fragment as Y } from "react/jsx-runtime";
2
- import { c as h, u as W, C as X, F as Z, q as ee, U as re, I as oe, l as te, i as ae, J as $, e as ne, t as se, K as ce, a as de, b as U, d as me } from "./index-D-YpLeDp.js";
1
+ import { jsxs as _, jsx as t, Fragment as J } from "react/jsx-runtime";
2
+ import { c as h, u as W, C as X, F as Z, q as ee, U as re, I as oe, l as te, e as ae, P as $, i as ne, f as se, p as ce, a as de, b as U, d as le } from "./index-BSGBBl-w.js";
3
3
  import { useQuery as g } from "@tanstack/react-query";
4
4
  import { useState as q, useMemo as b, useCallback as N } from "react";
5
- import { createPortal as le } from "react-dom";
5
+ import { createPortal as me } from "react-dom";
6
6
  import { useTranslation as ie } from "react-i18next";
7
7
  const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e = "_formContent_1pd36_18", be = "_formDetailsContainer_1pd36_25", fe = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", Ne = "_rowContainer_1pd36_43", he = "_groupLabel_1pd36_48", ye = "_rowLabel_1pd36_58", Me = "_rowValue_1pd36_67", Le = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Oe = "_memberLabel_1pd36_86", Re = "_memberValue_1pd36_94", Ce = "_abnormalValue_1pd36_102", De = "_commentSection_1pd36_110", Fe = "_commentText_1pd36_116", Te = "_nestedGroup_1pd36_125", ve = "_nestedGroupLabel_1pd36_132", Ee = "_nestedGroupMembers_1pd36_141", r = {
8
8
  formsTableBody: ue,
@@ -26,9 +26,9 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
26
26
  nestedGroupLabel: ve,
27
27
  nestedGroupMembers: Ee
28
28
  }, we = "ABNORMAL", x = (e) => {
29
- const s = e.concept?.units, c = e.concept?.lowNormal, o = e.concept?.hiNormal, l = c != null, i = o != null, p = l && i ? ` (${c} - ${o})` : l ? ` (>${c})` : i ? ` (<${o})` : "", a = e.interpretation && e.interpretation.toUpperCase() === we;
29
+ const s = e.concept?.units, c = e.concept?.lowNormal, o = e.concept?.hiNormal, m = c != null, i = o != null, p = m && i ? ` (${c} - ${o})` : m ? ` (>${c})` : i ? ` (<${o})` : "", a = e.interpretation && e.interpretation.toUpperCase() === we;
30
30
  return { units: s, rangeString: p, isAbnormal: a };
31
- }, k = ({
31
+ }, P = ({
32
32
  member: e,
33
33
  depth: s = 0
34
34
  }) => {
@@ -44,7 +44,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
44
44
  }
45
45
  ),
46
46
  /* @__PURE__ */ t("div", { className: r.nestedGroupMembers, children: e.groupMembers?.map((a) => /* @__PURE__ */ t(
47
- k,
47
+ P,
48
48
  {
49
49
  member: a,
50
50
  depth: s + 1
@@ -52,7 +52,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
52
52
  `${a.concept.uuid}`
53
53
  )) })
54
54
  ] });
55
- const { units: l, rangeString: i, isAbnormal: p } = x(e);
55
+ const { units: m, rangeString: i, isAbnormal: p } = x(e);
56
56
  return /* @__PURE__ */ _(
57
57
  "div",
58
58
  {
@@ -81,7 +81,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
81
81
  ),
82
82
  children: [
83
83
  e.valueAsString,
84
- l && ` ${l}`
84
+ m && ` ${m}`
85
85
  ]
86
86
  }
87
87
  )
@@ -92,7 +92,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
92
92
  observation: e,
93
93
  index: s
94
94
  }) => {
95
- const c = e.groupMembers && e.groupMembers.length > 0, { units: o, rangeString: l, isAbnormal: i } = x(e);
95
+ const c = e.groupMembers && e.groupMembers.length > 0, { units: o, rangeString: m, isAbnormal: i } = x(e);
96
96
  return /* @__PURE__ */ _(
97
97
  "div",
98
98
  {
@@ -112,12 +112,12 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
112
112
  ),
113
113
  children: [
114
114
  e.conceptNameToDisplay,
115
- !c && l && /* @__PURE__ */ t("span", { className: r.rangeInfo, children: l })
115
+ !c && m && /* @__PURE__ */ t("span", { className: r.rangeInfo, children: m })
116
116
  ]
117
117
  }
118
118
  ),
119
119
  c ? /* @__PURE__ */ t("div", { className: r.groupMembers, children: e.groupMembers?.map((p) => /* @__PURE__ */ t(
120
- k,
120
+ P,
121
121
  {
122
122
  member: p,
123
123
  depth: 0
@@ -152,18 +152,18 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
152
152
  encounterUuids: s,
153
153
  config: c
154
154
  }) => {
155
- const { t: o } = ie(), l = W(), [i, p] = q(!1), [a, O] = q(null), H = c?.numberOfVisits, R = X(
155
+ const { t: o } = ie(), m = W(), [i, p] = q(!1), [a, O] = q(null), k = c?.numberOfVisits, R = X(
156
156
  e,
157
157
  s
158
158
  ), {
159
159
  data: y = [],
160
160
  isLoading: C,
161
161
  isError: D,
162
- error: K
162
+ error: H
163
163
  } = g({
164
- queryKey: ["forms", l, e],
165
- queryFn: () => Z(l, void 0, H),
166
- enabled: !!l && !R
164
+ queryKey: ["forms", m, e],
165
+ queryFn: () => Z(m, void 0, k),
166
+ enabled: !!m && !R
167
167
  }), F = b(() => !s || s.length === 0 ? y : y.filter(
168
168
  (n) => s.includes(n.encounterUuid)
169
169
  ), [y, s]), { data: T = [] } = g({
@@ -177,7 +177,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
177
177
  return v(a.formName);
178
178
  }, [a, v]), {
179
179
  data: Be,
180
- isLoading: P,
180
+ isLoading: j,
181
181
  error: E
182
182
  } = g({
183
183
  queryKey: ["formMetadata", M],
@@ -185,7 +185,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
185
185
  enabled: !!M && i
186
186
  }), {
187
187
  data: L,
188
- isLoading: j,
188
+ isLoading: K,
189
189
  error: w
190
190
  } = g({
191
191
  queryKey: ["formsEncounter", a?.encounterUuid],
@@ -199,7 +199,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
199
199
  { key: "recordedBy", header: o("FORM_RECORDED_BY") }
200
200
  ],
201
201
  [o]
202
- ), J = b(
202
+ ), z = b(
203
203
  () => [
204
204
  { key: "recordedOn", sortable: !0 },
205
205
  { key: "recordedBy", sortable: !0 }
@@ -207,32 +207,32 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
207
207
  []
208
208
  ), V = b(() => {
209
209
  const n = F.reduce(
210
- (d, m) => {
211
- const f = m.formName;
210
+ (d, l) => {
211
+ const f = l.formName;
212
212
  d[f] ??= [];
213
- const A = m.providers.map((Q) => Q.providerName).filter(Boolean).join(", ");
213
+ const A = l.providers.map((Y) => Y.providerName).filter(Boolean).join(", ");
214
214
  return d[f].push({
215
- id: m.encounterUuid,
216
- formName: m.formName,
217
- recordedOn: te(m.encounterDateTime, o, me).formattedResult,
215
+ id: l.encounterUuid,
216
+ formName: l.formName,
217
+ recordedOn: te(l.encounterDateTime, o, le).formattedResult,
218
218
  recordedBy: A ?? "--",
219
- encounterDateTime: m.encounterDateTime,
220
- encounterUuid: m.encounterUuid
219
+ encounterDateTime: l.encounterDateTime,
220
+ encounterUuid: l.encounterUuid
221
221
  }), d;
222
222
  },
223
223
  {}
224
224
  );
225
225
  return Object.entries(n).map(
226
- ([d, m]) => ({
226
+ ([d, l]) => ({
227
227
  formName: d,
228
- records: m.sort(
228
+ records: l.sort(
229
229
  (f, A) => A.encounterDateTime - f.encounterDateTime
230
230
  )
231
231
  })
232
- ).sort((d, m) => d.formName.localeCompare(m.formName));
232
+ ).sort((d, l) => d.formName.localeCompare(l.formName));
233
233
  }, [F, o]), S = N((n) => {
234
234
  O(n), p(!0);
235
- }, []), z = N(() => {
235
+ }, []), Q = N(() => {
236
236
  p(!1), O(null);
237
237
  }, []), G = N(
238
238
  (n, u) => {
@@ -247,7 +247,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
247
247
  },
248
248
  [S]
249
249
  );
250
- return /* @__PURE__ */ _(Y, { children: [
250
+ return /* @__PURE__ */ _(J, { children: [
251
251
  /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || D || V.length === 0 || R ? /* @__PURE__ */ t(
252
252
  $,
253
253
  {
@@ -255,14 +255,14 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
255
255
  ariaLabel: o("FORMS_HEADING"),
256
256
  rows: [],
257
257
  loading: C,
258
- errorStateMessage: D ? K?.message : void 0,
258
+ errorStateMessage: D ? H?.message : void 0,
259
259
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
260
260
  renderCell: G,
261
261
  className: r.formsTableBody,
262
262
  "data-testid": "sortable-data-table"
263
263
  }
264
264
  ) : /* @__PURE__ */ t(ne, { align: "start", children: V.map((n, u) => {
265
- const { formName: d, records: m } = n;
265
+ const { formName: d, records: l } = n;
266
266
  return /* @__PURE__ */ t(
267
267
  se,
268
268
  {
@@ -275,10 +275,10 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
275
275
  {
276
276
  headers: B,
277
277
  ariaLabel: o("FORMS_HEADING"),
278
- rows: m,
278
+ rows: l,
279
279
  loading: !1,
280
280
  errorStateMessage: "",
281
- sortable: J,
281
+ sortable: z,
282
282
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
283
283
  renderCell: G,
284
284
  className: r.formsTableBody,
@@ -289,19 +289,19 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
289
289
  d
290
290
  );
291
291
  }) }) }),
292
- i && a && le(
292
+ i && a && me(
293
293
  /* @__PURE__ */ t(
294
294
  ce,
295
295
  {
296
296
  id: "formDetailsModal",
297
297
  open: i,
298
- onRequestClose: z,
298
+ onRequestClose: Q,
299
299
  modalHeading: a.formName,
300
300
  modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
301
301
  passiveModal: !0,
302
302
  size: "md",
303
303
  testId: "form-details-modal",
304
- children: /* @__PURE__ */ t("div", { className: r.formContent, children: P || j ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ t("div", { children: U(E).message ?? o("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? o("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: r.formDetailsContainer, children: I.map((n, u) => /* @__PURE__ */ t(
304
+ children: /* @__PURE__ */ t("div", { className: r.formContent, children: j || K ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ t("div", { children: U(E).message ?? o("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? o("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: r.formDetailsContainer, children: I.map((n, u) => /* @__PURE__ */ t(
305
305
  Ie,
306
306
  {
307
307
  observation: n,
@@ -0,0 +1,330 @@
1
+ import { jsx as d, jsxs as T } from "react/jsx-runtime";
2
+ import { g as U, h as $, j as F, v as L, m as x, k as G, u as k, n as q, G as P, O as Q, y as K, P as H } from "./index-BSGBBl-w.js";
3
+ import { useQueries as j, useQuery as Y } from "@tanstack/react-query";
4
+ import { useRef as z, useEffect as R, useMemo as m } from "react";
5
+ import { useTranslation as _ } from "react-i18next";
6
+ const J = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", X = "A", Z = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ee = (e, n) => e?.date ? U(e.date, n).formattedResult : n("DATE_ERROR_PARSE"), te = (e) => {
7
+ if (!e.observationValue?.value)
8
+ return "";
9
+ const { value: n, unit: t } = e.observationValue;
10
+ return t ? `${n} ${t}` : String(n);
11
+ }, ne = (e) => {
12
+ const n = e.display;
13
+ if (!e.observationValue)
14
+ return String(n);
15
+ const { unit: t, referenceRange: r } = e.observationValue;
16
+ if (!r)
17
+ return String(n);
18
+ const { low: o, high: i } = r;
19
+ if (o && i) {
20
+ const s = o.unit ? `${o.value} ${o.unit}` : t ? `${o.value} ${t}` : String(o.value), a = i.unit ? `${i.value} ${i.unit}` : t ? `${i.value} ${t}` : String(i.value);
21
+ return `${n} (${s} - ${a})`;
22
+ }
23
+ if (o) {
24
+ const s = o.unit ? `${o.value} ${o.unit}` : t ? `${o.value} ${t}` : String(o.value);
25
+ return `${n} (>${s})`;
26
+ }
27
+ if (i) {
28
+ const s = i.unit ? `${i.value} ${i.unit}` : t ? `${i.value} ${t}` : String(i.value);
29
+ return `${n} (<${s})`;
30
+ }
31
+ return n;
32
+ }, re = (e, n) => ({
33
+ index: n,
34
+ header: ne(e),
35
+ value: te(e),
36
+ provider: e.encounter?.provider
37
+ }), b = (e) => (typeof e == "string" ? e : e?.reference)?.split("/")?.pop();
38
+ function oe(e) {
39
+ return !e.interpretation || e.interpretation.length === 0 ? !1 : e.interpretation.some(
40
+ (n) => n.coding?.some(
41
+ (t) => t.system === Z && t.code === X
42
+ )
43
+ );
44
+ }
45
+ function ie(e) {
46
+ const {
47
+ valueQuantity: n,
48
+ valueCodeableConcept: t,
49
+ valueString: r,
50
+ valueBoolean: o,
51
+ valueInteger: i,
52
+ referenceRange: s
53
+ } = e, a = oe(e);
54
+ if (n) {
55
+ const u = {
56
+ value: n.value ?? "",
57
+ unit: n.unit,
58
+ type: "quantity",
59
+ isAbnormal: a
60
+ };
61
+ if (s && s.length > 0) {
62
+ const l = s.find(
63
+ (p) => p.type?.coding?.some(
64
+ (v) => v.system === W && v.code === J
65
+ )
66
+ );
67
+ l && (l.low || l.high) && (u.referenceRange = {
68
+ low: l.low ? {
69
+ value: l.low.value,
70
+ unit: l.low.unit
71
+ } : void 0,
72
+ high: l.high ? {
73
+ value: l.high.value,
74
+ unit: l.high.unit
75
+ } : void 0
76
+ });
77
+ }
78
+ return u;
79
+ }
80
+ if (t)
81
+ return {
82
+ value: t.text ?? t.coding[0].display,
83
+ type: "codeable",
84
+ isAbnormal: a
85
+ };
86
+ if (r)
87
+ return {
88
+ value: r,
89
+ type: "string",
90
+ isAbnormal: a
91
+ };
92
+ if (o !== void 0)
93
+ return {
94
+ value: o,
95
+ type: "boolean",
96
+ isAbnormal: a
97
+ };
98
+ if (i !== void 0)
99
+ return {
100
+ value: i,
101
+ type: "integer",
102
+ isAbnormal: a
103
+ };
104
+ }
105
+ function se(e, n) {
106
+ const t = n.get(e);
107
+ if (t)
108
+ return {
109
+ id: t.id ?? e,
110
+ type: t.type?.[0]?.coding?.[0]?.display ?? "Unknown",
111
+ date: t.period?.start ?? "",
112
+ provider: t.participant?.[0]?.individual?.display,
113
+ location: t.location?.[0]?.location?.display
114
+ };
115
+ }
116
+ function I(e, n, t) {
117
+ const r = b(e.encounter), o = (e.hasMember ?? []).map((i) => b(i)).map((i) => i ? t.get(i) : void 0).filter((i) => !!i).map(
118
+ (i) => I(i, n, t)
119
+ );
120
+ return {
121
+ id: e.id,
122
+ display: e.code?.text ?? e.code?.coding?.[0]?.display ?? "",
123
+ observationValue: ie(e),
124
+ effectiveDateTime: e.effectiveDateTime,
125
+ issued: e.issued,
126
+ encounter: r ? se(r, n) : void 0,
127
+ members: o.length > 0 ? o : void 0
128
+ };
129
+ }
130
+ function ae(e) {
131
+ const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
132
+ e.entry?.forEach(({ resource: s }) => {
133
+ s?.id && (s.resourceType === "Encounter" ? n.set(s.id, s) : s.resourceType === "Observation" && (t.set(s.id, s), s.hasMember?.forEach((a) => {
134
+ const u = b(a);
135
+ u && r.add(u);
136
+ })));
137
+ });
138
+ const o = [], i = [];
139
+ return t.forEach((s, a) => {
140
+ if (r.has(a)) return;
141
+ const u = I(
142
+ s,
143
+ n,
144
+ t
145
+ );
146
+ u.members?.length ? i.push({ ...u, children: u.members }) : o.push(u);
147
+ }), { observations: o, groupedObservations: i };
148
+ }
149
+ function ue(e) {
150
+ const n = /* @__PURE__ */ new Map();
151
+ return e.observations.forEach((t) => {
152
+ if (!t.encounter?.id) return;
153
+ const r = t.encounter.id;
154
+ n.has(r) || n.set(r, {
155
+ observations: [],
156
+ groupedObservations: []
157
+ }), n.get(r).observations.push(t);
158
+ }), e.groupedObservations.forEach((t) => {
159
+ if (!t.encounter?.id) return;
160
+ const r = t.encounter.id;
161
+ n.has(r) || n.set(r, {
162
+ observations: [],
163
+ groupedObservations: []
164
+ }), n.get(r).groupedObservations.push(t);
165
+ }), Array.from(n.entries()).map(([t, r]) => {
166
+ const o = r.observations[0]?.encounter ?? r.groupedObservations[0]?.encounter;
167
+ return {
168
+ encounterId: t,
169
+ encounterDetails: o,
170
+ observations: r.observations,
171
+ groupedObservations: r.groupedObservations
172
+ };
173
+ });
174
+ }
175
+ function ce(e) {
176
+ return [...e].sort((n, t) => {
177
+ const r = n.encounterDetails?.date, o = t.encounterDetails?.date;
178
+ return !r && !o ? 0 : r ? o ? new Date(o).getTime() - new Date(r).getTime() : -1 : 1;
179
+ });
180
+ }
181
+ const N = (e, n, t) => {
182
+ const r = re(e, n), o = r.value, i = F(o);
183
+ let s = o;
184
+ i === "Image" && (s = /* @__PURE__ */ d(x, { imageSrc: o, alt: o, id: `${o}-img` })), i === "Video" && (s = /* @__PURE__ */ d(G, { id: `${o}-video`, videoSrc: o }));
185
+ const a = t("OBSERVATIONS_RECORDED_BY", {
186
+ provider: r.provider
187
+ }), u = e.observationValue?.isAbnormal ? `abnormal-obs-${e.id}` : `obs-${e.id}`;
188
+ return /* @__PURE__ */ d(
189
+ L,
190
+ {
191
+ header: r.header,
192
+ value: s,
193
+ info: a,
194
+ id: u,
195
+ testId: `${u}-test-id`,
196
+ ariaLabel: `${u}-aria-label`
197
+ },
198
+ `obs-${e.id}`
199
+ );
200
+ }, le = (e, n, t) => /* @__PURE__ */ d(
201
+ $,
202
+ {
203
+ title: e.display,
204
+ id: `grouped-obs-${e.id}`,
205
+ open: t,
206
+ children: e.children.map(
207
+ (r, o) => N(r, o, n)
208
+ )
209
+ },
210
+ `grouped-obs-${e.id}`
211
+ ), de = ({
212
+ groupedData: e
213
+ }) => {
214
+ const { t: n } = _(), t = (r, o) => {
215
+ const i = ee(r.encounterDetails, n);
216
+ return /* @__PURE__ */ T(
217
+ $,
218
+ {
219
+ title: i,
220
+ id: `encounter-${r.encounterId}`,
221
+ open: o,
222
+ children: [
223
+ r.observations.map(
224
+ (s, a) => N(s, a, n)
225
+ ),
226
+ r.groupedObservations.map(
227
+ (s) => le(s, n, o)
228
+ )
229
+ ]
230
+ },
231
+ `encounter-${r.encounterId}`
232
+ );
233
+ };
234
+ return /* @__PURE__ */ d(
235
+ "div",
236
+ {
237
+ id: "obs-by-encounter",
238
+ "data-testid": "obs-by-encounter-test-id",
239
+ "aria-label": "obs-by-encounter-aria-label",
240
+ children: e.map(
241
+ (r, o) => t(r, o === 0)
242
+ )
243
+ }
244
+ );
245
+ }, ve = "_observations_kfbhq_1", pe = "_title_kfbhq_12", S = {
246
+ observations: ve,
247
+ title: pe
248
+ }, fe = (e) => ["conceptUuid", e], ge = (e, n) => ["observations", e, ...n], Oe = ({ config: e }) => {
249
+ const n = e, { conceptNames: t = [], conceptUuid: r = [] } = n, o = z(/* @__PURE__ */ new Set()), i = k(), { addNotification: s } = q(), { t: a } = _(), u = j({
250
+ queries: t.map((c) => ({
251
+ queryKey: fe(c),
252
+ queryFn: () => P(c),
253
+ enabled: !!c
254
+ }))
255
+ });
256
+ R(() => {
257
+ u.forEach((c, f) => {
258
+ if (c.isError && !o.current.has(f)) {
259
+ const B = t[f];
260
+ s({
261
+ title: a("ERROR_DEFAULT_TITLE"),
262
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: B }),
263
+ type: "error"
264
+ }), o.current.add(f);
265
+ } else c.isError || o.current.delete(f);
266
+ });
267
+ }, [u, t]);
268
+ const l = m(() => u.map((c) => c.data?.uuid).filter((c) => !!c), [u]), p = m(() => [.../* @__PURE__ */ new Set([...l, ...r])], [l, r]), v = m(() => t.length === 0 ? !0 : u.every((c) => !c.isLoading), [u, t.length]), {
269
+ data: g,
270
+ isLoading: D,
271
+ isError: h
272
+ } = Y({
273
+ queryKey: ge(i, p),
274
+ queryFn: () => Q(i, p),
275
+ enabled: !!i && p.length > 0 && v
276
+ });
277
+ R(() => {
278
+ h && s({
279
+ title: a("ERROR_DEFAULT_TITLE"),
280
+ message: a("ERROR_FETCHING_OBSERVATIONS"),
281
+ type: "error"
282
+ });
283
+ }, [h]);
284
+ const y = m(() => {
285
+ if (!g) return [];
286
+ const c = ae(g), f = ue(c);
287
+ return ce(f);
288
+ }, [g]), A = [
289
+ { key: "name", header: "name" },
290
+ { key: "value", header: "value" },
291
+ { key: "form", header: "form" }
292
+ ], E = D || !v, O = h && v, w = (!g || g.entry?.length === 0 || p.length === 0) && v, C = O ? a("ERROR_FETCHING_OBSERVATIONS") : null, V = w ? a("NO_OBSERVATIONS_FOUND") : void 0, M = y.length > 0 && !E && !O;
293
+ return /* @__PURE__ */ T(
294
+ "div",
295
+ {
296
+ id: "observations",
297
+ "data-testid": "observations-test-id",
298
+ "aria-label": "observations-aria-label",
299
+ className: S.observations,
300
+ children: [
301
+ /* @__PURE__ */ d(
302
+ K,
303
+ {
304
+ id: "observations-title",
305
+ testId: "observations-title-test-id",
306
+ title: a(n.titleTranslationKey),
307
+ className: S.title,
308
+ children: /* @__PURE__ */ d("p", { children: a(n.titleTranslationKey) })
309
+ }
310
+ ),
311
+ M ? /* @__PURE__ */ d(de, { groupedData: y }) : /* @__PURE__ */ d(
312
+ H,
313
+ {
314
+ headers: A,
315
+ rows: [],
316
+ ariaLabel: a("OBSERVATIONS"),
317
+ loading: E,
318
+ errorStateMessage: C,
319
+ emptyStateMessage: V
320
+ }
321
+ )
322
+ ]
323
+ }
324
+ );
325
+ };
326
+ export {
327
+ fe as conceptUuidQueryKeys,
328
+ Oe as default,
329
+ ge as observationsQueryKeys
330
+ };