@bahmni/clinical-app 0.0.1-dev.181 → 0.0.1-dev.182

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,5 +1,5 @@
1
1
  import { jsxs as N, jsx as w, Fragment as St } from "react/jsx-runtime";
2
- import { f as kt, u as jt, o as Wt, a as Pt, b as Ut, A as $t, G as Kt, p as Ft, K as h, c as Yt } from "./index-DKNhn2HV.js";
2
+ import { p as kt, u as jt, o as Wt, a as Pt, b as Ut, A as $t, $ as Kt, m as Ft, K as h, g as Yt } from "./index-BUMJizPo.js";
3
3
  import e, { useState as A, useCallback as g, useEffect as qt, useMemo as z } from "react";
4
4
  function Gt(t, r, n) {
5
5
  return (r = Xt(r)) in t ? Object.defineProperty(t, r, {
@@ -1,28 +1,28 @@
1
- import { jsx as s, jsxs as p, Fragment as P } from "react/jsx-runtime";
2
- import { u as ee, f as re, E as ae, d as te, a as A, H as oe, b as ne, D as se, A as U, e as de, Y as me, G as ie, y as le, Z as q, P as ce, p as ue, T as F, g as be, h as pe, i as _e, j as fe, U as $e, q as ge, W as ve, F as he } from "./index-DKNhn2HV.js";
3
- import { useState as H, useMemo as h, useCallback as R } from "react";
4
- const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Fe = "_observation_1pd36_30", Le = "_groupContainer_1pd36_39", Ce = "_rowContainer_1pd36_43", Oe = "_groupLabel_1pd36_48", Ie = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Me = "_groupMembers_1pd36_75", Ve = "_memberRow_1pd36_81", Se = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Ee = "_abnormalValue_1pd36_102", we = "_commentSection_1pd36_110", xe = "_commentText_1pd36_116", Be = "_nestedGroup_1pd36_125", Ge = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
5
- formsTableBody: ye,
6
- customAccordianItem: Ne,
7
- formContent: Ae,
1
+ import { jsx as s, jsxs as p, Fragment as k } from "react/jsx-runtime";
2
+ import { u as ee, p as re, y as ae, c as te, a as A, d as oe, b as ne, e as se, A as q, Y as de, G as me, $ as ie, P as le, Z as U, f as ce, m as ue, T as R, h as be, F as pe, q as fe, W as _e, i as $e, w as ve, j as he, k as ge, l as ye } from "./index-BUMJizPo.js";
3
+ import { useState as P, useMemo as g, useCallback as F } from "react";
4
+ const Ne = "_formsTableBody_1pd36_1", Ae = "_customAccordianItem_1pd36_6", Fe = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Le = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", Oe = "_rowContainer_1pd36_43", Ie = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", Me = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Se = "_memberRow_1pd36_81", we = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", xe = "_abnormalValue_1pd36_102", Ee = "_commentSection_1pd36_110", Be = "_commentText_1pd36_116", Ge = "_nestedGroup_1pd36_125", qe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
5
+ formsTableBody: Ne,
6
+ customAccordianItem: Ae,
7
+ formContent: Fe,
8
8
  formDetailsContainer: Re,
9
- observation: Fe,
10
- groupContainer: Le,
11
- rowContainer: Ce,
12
- groupLabel: Oe,
13
- rowLabel: Ie,
14
- rowValue: Te,
15
- groupMembers: Me,
16
- memberRow: Ve,
17
- memberLabel: Se,
9
+ observation: Le,
10
+ groupContainer: Ce,
11
+ rowContainer: Oe,
12
+ groupLabel: Ie,
13
+ rowLabel: Te,
14
+ rowValue: Me,
15
+ groupMembers: Ve,
16
+ memberRow: Se,
17
+ memberLabel: we,
18
18
  memberValue: De,
19
- abnormalValue: Ee,
20
- commentSection: we,
21
- commentText: xe,
22
- nestedGroup: Be,
23
- nestedGroupLabel: Ge,
19
+ abnormalValue: xe,
20
+ commentSection: Ee,
21
+ commentText: Be,
22
+ nestedGroup: Ge,
23
+ nestedGroupLabel: qe,
24
24
  nestedGroupMembers: Ue
25
- }, K = (e) => {
25
+ }, H = (e) => {
26
26
  const r = be(e);
27
27
  return r === "Image" ? /* @__PURE__ */ s(
28
28
  pe,
@@ -31,11 +31,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
31
31
  alt: e,
32
32
  id: `${e}-img`
33
33
  }
34
- ) : r === "Video" ? /* @__PURE__ */ s(_e, { id: `${e}-video`, videoSrc: e }) : e;
35
- }, k = (e) => {
34
+ ) : r === "Video" ? /* @__PURE__ */ s(fe, { id: `${e}-video`, videoSrc: e }) : r === "PDF" ? /* @__PURE__ */ s(_e, { id: `${e}-pdf`, src: e }) : e;
35
+ }, j = (e) => {
36
36
  const r = e.observationValue?.unit, n = e.observationValue?.referenceRange?.low?.value, a = e.observationValue?.referenceRange?.high?.value, d = n != null, c = a != null, m = d && c ? ` (${n} - ${a})` : d ? ` (>${n})` : c ? ` (<${a})` : "", t = e.observationValue?.isAbnormal === !0;
37
37
  return { units: r, rangeString: m, isAbnormal: t };
38
- }, j = ({
38
+ }, K = ({
39
39
  member: e,
40
40
  depth: r = 0,
41
41
  memberIndex: n = 0,
@@ -65,7 +65,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
65
65
  className: o.nestedGroupMembers,
66
66
  "data-testid": `${t}obs-nested-group-members-${m}-${n}`,
67
67
  children: e.members?.map((y, N) => /* @__PURE__ */ s(
68
- j,
68
+ K,
69
69
  {
70
70
  member: y,
71
71
  depth: r + 1,
@@ -79,8 +79,8 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
79
79
  ]
80
80
  }
81
81
  );
82
- const { units: b, rangeString: g, isAbnormal: _ } = k(e), f = e.observationValue?.value?.toString(), $ = f ? K(f) : null;
83
- return /* @__PURE__ */ p(P, { children: [
82
+ const { units: b, rangeString: v, isAbnormal: f } = j(e), _ = e.observationValue?.value?.toString(), $ = _ ? H(_) : null;
83
+ return /* @__PURE__ */ p(k, { children: [
84
84
  /* @__PURE__ */ p(
85
85
  "div",
86
86
  {
@@ -91,23 +91,23 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
91
91
  /* @__PURE__ */ p(
92
92
  "p",
93
93
  {
94
- className: F(
94
+ className: R(
95
95
  o.memberLabel,
96
- _ ? o.abnormalValue : ""
96
+ f ? o.abnormalValue : ""
97
97
  ),
98
98
  "data-testid": `${t}obs-member-label-${m}-${n}`,
99
99
  children: [
100
100
  m,
101
- g
101
+ v
102
102
  ]
103
103
  }
104
104
  ),
105
105
  /* @__PURE__ */ p(
106
106
  "div",
107
107
  {
108
- className: F(
108
+ className: R(
109
109
  o.memberValue,
110
- _ ? o.abnormalValue : ""
110
+ f ? o.abnormalValue : ""
111
111
  ),
112
112
  "data-testid": `${t}obs-member-value-${m}-${n}`,
113
113
  children: [
@@ -132,13 +132,13 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
132
132
  }
133
133
  )
134
134
  ] });
135
- }, qe = ({
135
+ }, Pe = ({
136
136
  observation: e,
137
137
  index: r,
138
138
  formName: n = "",
139
139
  comment: a
140
140
  }) => {
141
- const d = e.members && e.members.length > 0, { units: c, rangeString: m, isAbnormal: t } = k(e), b = n ? `${n}-` : "", g = e.observationValue?.value?.toString(), _ = g ? K(g) : null;
141
+ const d = e.members && e.members.length > 0, { units: c, rangeString: m, isAbnormal: t } = j(e), b = n ? `${n}-` : "", v = e.observationValue?.value?.toString(), f = v ? H(v) : null;
142
142
  return /* @__PURE__ */ p(
143
143
  "div",
144
144
  {
@@ -154,7 +154,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
154
154
  /* @__PURE__ */ p(
155
155
  "p",
156
156
  {
157
- className: F(
157
+ className: R(
158
158
  d ? o.groupLabel : o.rowLabel,
159
159
  !d && t ? o.abnormalValue : ""
160
160
  ),
@@ -170,27 +170,27 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
170
170
  {
171
171
  className: o.groupMembers,
172
172
  "data-testid": `${b}observation-group-members-${e.display}-${r}`,
173
- children: e.members?.map((f, $) => /* @__PURE__ */ s(
174
- j,
173
+ children: e.members?.map((_, $) => /* @__PURE__ */ s(
174
+ K,
175
175
  {
176
- member: f,
176
+ member: _,
177
177
  depth: 0,
178
178
  memberIndex: $,
179
179
  formName: n
180
180
  },
181
- `${f.id}`
181
+ `${_.id}`
182
182
  ))
183
183
  }
184
184
  ) : /* @__PURE__ */ p(
185
185
  "div",
186
186
  {
187
- className: F(
187
+ className: R(
188
188
  o.rowValue,
189
189
  t ? o.abnormalValue : ""
190
190
  ),
191
191
  "data-testid": `${b}observation-value-${e.display}-${r}`,
192
192
  children: [
193
- _,
193
+ f,
194
194
  c && ` ${c}`
195
195
  ]
196
196
  }
@@ -213,18 +213,18 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
213
213
  },
214
214
  `${e.id}-${r}`
215
215
  );
216
- }, He = (e) => e ? e.extension?.find(
217
- (r) => r.url === fe
218
- )?.valueString : void 0, Pe = (e) => {
216
+ }, ke = (e) => e ? e.extension?.find(
217
+ (r) => r.url === $e
218
+ )?.valueString : void 0, He = (e) => {
219
219
  if (e)
220
220
  return e.note?.[0]?.text;
221
- }, Ke = (e, r) => e.entry?.find((n) => n.resource?.id === r)?.resource, I = (e, r) => {
222
- const n = Ke(e, r);
221
+ }, je = (e, r) => e.entry?.find((n) => n.resource?.id === r)?.resource, I = (e, r) => {
222
+ const n = je(e, r);
223
223
  return n ? {
224
- formFieldPath: He(n),
225
- comment: Pe(n)
224
+ formFieldPath: ke(n),
225
+ comment: He(n)
226
226
  } : {};
227
- }, ke = (e, r) => {
227
+ }, Ke = (e, r) => {
228
228
  if (!e?.entry || !r)
229
229
  return [];
230
230
  const n = ce(e);
@@ -246,15 +246,15 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
246
246
  ].filter(
247
247
  ({ formFieldPath: a }) => !a || a.includes(r)
248
248
  );
249
- }, Ze = ({
249
+ }, ze = ({
250
250
  episodeOfCareUuids: e,
251
251
  encounterUuids: r,
252
252
  config: n
253
253
  }) => {
254
- const { t: a } = ee(), d = re(), [c, m] = H(!1), [t, b] = H(null), g = n?.numberOfVisits, _ = ae(
254
+ const { t: a } = ee(), d = re(), [c, m] = P(!1), [t, b] = P(null), v = n?.numberOfVisits, f = ae(
255
255
  e,
256
256
  r
257
- ), f = te(), {
257
+ ), _ = te(), {
258
258
  data: $ = [],
259
259
  isLoading: y,
260
260
  isError: N,
@@ -262,60 +262,60 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
262
262
  refetch: Y
263
263
  } = A({
264
264
  queryKey: ["forms", d, e],
265
- queryFn: () => $e(d, void 0, g),
266
- enabled: !!d && !_
267
- }), T = h(() => !r || r.length === 0 ? $ : $.filter(
265
+ queryFn: () => ve(d, void 0, v),
266
+ enabled: !!d && !f
267
+ }), T = g(() => !r || r.length === 0 ? $ : $.filter(
268
268
  (i) => r.includes(i.encounterUuid)
269
269
  ), [$, r]), { data: M = [] } = A({
270
270
  queryKey: ["observationForms"],
271
- queryFn: () => ge()
272
- }), V = R(
271
+ queryFn: () => he()
272
+ }), V = F(
273
273
  (i) => M.find((u) => u.name === i)?.uuid,
274
274
  [M]
275
- ), L = h(() => {
275
+ ), L = g(() => {
276
276
  if (t)
277
277
  return V(t.formName);
278
278
  }, [t, V]), { isLoading: Z, error: S } = A({
279
279
  queryKey: ["formMetadata", L],
280
- queryFn: () => ve(L),
280
+ queryFn: () => ge(L),
281
281
  enabled: !!L && c
282
282
  }), {
283
283
  data: C,
284
284
  isLoading: z,
285
- error: D
285
+ error: w
286
286
  } = A({
287
287
  queryKey: ["formsEncounterFHIR", t?.encounterUuid],
288
- queryFn: () => he(t.encounterUuid),
288
+ queryFn: () => ye(t.encounterUuid),
289
289
  enabled: !!t?.encounterUuid && c
290
290
  });
291
291
  oe(
292
292
  (i) => {
293
- i.patientUUID === d && i.updatedConcepts.size > 0 && (Y(), f.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
293
+ i.patientUUID === d && i.updatedConcepts.size > 0 && (Y(), _.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
294
294
  },
295
295
  [d]
296
296
  );
297
- const E = h(() => !C || !t?.formName ? [] : ke(
297
+ const D = g(() => !C || !t?.formName ? [] : Ke(
298
298
  C,
299
299
  t.formName
300
- ), [C, t?.formName]), w = h(
300
+ ), [C, t?.formName]), x = g(
301
301
  () => [
302
302
  { key: "recordedOn", header: a("FORM_RECORDED_ON") },
303
303
  { key: "recordedBy", header: a("FORM_RECORDED_BY") }
304
304
  ],
305
305
  [a]
306
- ), W = h(
306
+ ), W = g(
307
307
  () => [
308
308
  { key: "recordedOn", sortable: !0 },
309
309
  { key: "recordedBy", sortable: !0 }
310
310
  ],
311
311
  []
312
- ), x = h(() => {
312
+ ), E = g(() => {
313
313
  const i = T.reduce(
314
314
  (u, l) => {
315
- const v = l.formName;
316
- u[v] ??= [];
317
- const O = l.providers.map((J) => J.providerName).filter(Boolean).join(", ");
318
- return u[v].push({
315
+ const h = l.formName;
316
+ u[h] ??= [];
317
+ const O = l.providers.map((X) => X.providerName).filter(Boolean).join(", ");
318
+ return u[h].push({
319
319
  id: l.encounterUuid,
320
320
  formName: l.formName,
321
321
  recordedOn: ne(l.encounterDateTime, a, ue).formattedResult,
@@ -330,15 +330,15 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
330
330
  ([u, l]) => ({
331
331
  formName: u,
332
332
  records: l.sort(
333
- (v, O) => O.encounterDateTime - v.encounterDateTime
333
+ (h, O) => O.encounterDateTime - h.encounterDateTime
334
334
  )
335
335
  })
336
336
  ).sort((u, l) => u.formName.localeCompare(l.formName));
337
- }, [T, a]), B = R((i) => {
337
+ }, [T, a]), B = F((i) => {
338
338
  b(i), m(!0);
339
- }, []), X = R(() => {
339
+ }, []), J = F(() => {
340
340
  m(!1), b(null);
341
- }, []), G = R(
341
+ }, []), G = F(
342
342
  (i, u) => {
343
343
  switch (u) {
344
344
  case "recordedOn":
@@ -351,11 +351,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
351
351
  },
352
352
  [B]
353
353
  );
354
- return /* @__PURE__ */ p(P, { children: [
355
- /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: y || N || x.length === 0 || _ ? /* @__PURE__ */ s(
356
- U,
354
+ return /* @__PURE__ */ p(k, { children: [
355
+ /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: y || N || E.length === 0 || f ? /* @__PURE__ */ s(
356
+ q,
357
357
  {
358
- headers: w,
358
+ headers: x,
359
359
  ariaLabel: a("FORMS_HEADING"),
360
360
  rows: [],
361
361
  loading: y,
@@ -365,8 +365,8 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
365
365
  className: o.formsTableBody,
366
366
  dataTestId: "forms-table"
367
367
  }
368
- ) : /* @__PURE__ */ s(de, { align: "start", children: x.map((i, u) => {
369
- const { formName: l, records: v } = i;
368
+ ) : /* @__PURE__ */ s(de, { align: "start", children: E.map((i, u) => {
369
+ const { formName: l, records: h } = i;
370
370
  return /* @__PURE__ */ s(
371
371
  me,
372
372
  {
@@ -375,11 +375,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
375
375
  testId: `accordian-title-${l}`,
376
376
  open: u === 0,
377
377
  children: /* @__PURE__ */ s(
378
- U,
378
+ q,
379
379
  {
380
- headers: w,
380
+ headers: x,
381
381
  ariaLabel: a("FORMS_HEADING"),
382
- rows: v,
382
+ rows: h,
383
383
  loading: !1,
384
384
  errorStateMessage: "",
385
385
  sortable: W,
@@ -399,14 +399,14 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
399
399
  id: "modalIdForActionAreaLayout",
400
400
  portalId: "main-display-area",
401
401
  open: c,
402
- onRequestClose: X,
402
+ onRequestClose: J,
403
403
  modalHeading: t.formName,
404
404
  modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
405
405
  passiveModal: !0,
406
406
  size: "md",
407
407
  testId: "form-details-modal",
408
- children: /* @__PURE__ */ s("div", { className: o.formContent, children: Z || z ? /* @__PURE__ */ s(le, { width: "100%", lineCount: 3 }) : S ? /* @__PURE__ */ s("div", { children: q(S).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : D ? /* @__PURE__ */ s("div", { children: q(D).message ?? a("ERROR_FETCHING_FORM_DATA") }) : E.length > 0 ? /* @__PURE__ */ s("div", { className: o.formDetailsContainer, children: E.map(({ obs: i, comment: u }, l) => /* @__PURE__ */ s(
409
- qe,
408
+ children: /* @__PURE__ */ s("div", { className: o.formContent, children: Z || z ? /* @__PURE__ */ s(le, { width: "100%", lineCount: 3 }) : S ? /* @__PURE__ */ s("div", { children: U(S).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ s("div", { children: U(w).message ?? a("ERROR_FETCHING_FORM_DATA") }) : D.length > 0 ? /* @__PURE__ */ s("div", { className: o.formDetailsContainer, children: D.map(({ obs: i, comment: u }, l) => /* @__PURE__ */ s(
409
+ Pe,
410
410
  {
411
411
  observation: i,
412
412
  index: l,
@@ -420,5 +420,5 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
420
420
  ] });
421
421
  };
422
422
  export {
423
- Ze as default
423
+ ze as default
424
424
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BDvIvmrT.js";
2
- import { r as d, s as f, t as e } from "./index-DKNhn2HV.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BppHdRI8.js";
2
+ import { z as d, B as f, C as e } from "./index-BUMJizPo.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -27,7 +27,7 @@ var p = (a) => {
27
27
  });
28
28
  }
29
29
  });
30
- }, C = p;
30
+ }, P = p;
31
31
  export {
32
- C as default
32
+ P as default
33
33
  };
@@ -1,9 +1,9 @@
1
- import { c as l, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-BDvIvmrT.js";
2
- import { r as v, s as C, t as e } from "./index-DKNhn2HV.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-BppHdRI8.js";
2
+ import { z as C, B as v, C as e } from "./index-BUMJizPo.js";
3
3
  var h = (t) => {
4
- const [r, o] = l({
4
+ const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = v(), s = C(() => {
6
+ }), a = C(), l = v(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });
@@ -16,7 +16,7 @@ var h = (t) => {
16
16
  setLocalStore: o,
17
17
  get children() {
18
18
  return e(i.Provider, {
19
- value: s,
19
+ value: l,
20
20
  get children() {
21
21
  return e(m, {
22
22
  get children() {
@@ -0,0 +1,170 @@
1
+ import { jsxs as I, jsx as l } from "react/jsx-runtime";
2
+ import { p as B, o as k, u as N, n as K, r as Q, a as H, d as x, f as j, H as w, s as G, L as M, A as W, t as P, v as S, V as z, h as Y, Q as J, F as X, q as Z, W as ee, x as te } from "./index-BUMJizPo.js";
3
+ import { useRef as ae, useEffect as $, useMemo as E } from "react";
4
+ const F = (t, d, n, u, o) => {
5
+ const a = z(t, d), s = a.value, r = Y(s);
6
+ let i = s;
7
+ r === "Image" && (i = /* @__PURE__ */ l(X, { imageSrc: s, alt: s, id: `${s}-img` })), r === "Video" && (i = /* @__PURE__ */ l(Z, { id: `${s}-video`, videoSrc: s })), r === "PDF" && (i = /* @__PURE__ */ l(ee, { id: `${s}-pdf`, src: s }));
8
+ const b = o("OBSERVATIONS_RECORDED_BY", {
9
+ provider: a.provider
10
+ }), p = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${v}-${p}-${n}-${d}` : `${v}-${p}-${n}-${d}`;
11
+ return /* @__PURE__ */ l(
12
+ J,
13
+ {
14
+ header: a.header,
15
+ value: i,
16
+ info: b,
17
+ id: c,
18
+ testId: c,
19
+ ariaLabel: c
20
+ },
21
+ `obs-${t.id}`
22
+ );
23
+ }, se = (t, d, n, u, o, a) => /* @__PURE__ */ l(
24
+ S,
25
+ {
26
+ title: t.display,
27
+ id: `grouped-obs-${t.display}-${u}`,
28
+ open: n,
29
+ children: t.members?.map(
30
+ (s, r) => F(s, r, o, a, d)
31
+ )
32
+ },
33
+ `grouped-obs-${t.id}`
34
+ ), re = ({
35
+ groupedData: t,
36
+ title: d = ""
37
+ }) => {
38
+ const { t: n } = N(), u = (o, a, s) => {
39
+ const r = P(o.encounterDetails, n);
40
+ return /* @__PURE__ */ I(
41
+ S,
42
+ {
43
+ title: r,
44
+ id: `encounter-${o.encounterId}`,
45
+ open: a,
46
+ children: [
47
+ o.observations.map(
48
+ (i, b) => F(i, b, s, d, n)
49
+ ),
50
+ o.groupedObservations.map(
51
+ (i, b) => se(
52
+ i,
53
+ n,
54
+ a,
55
+ b,
56
+ s,
57
+ d
58
+ )
59
+ )
60
+ ]
61
+ },
62
+ `encounter-${o.encounterId}`
63
+ );
64
+ };
65
+ return /* @__PURE__ */ l(
66
+ "div",
67
+ {
68
+ id: "obs-by-encounter",
69
+ "data-testid": "obs-by-encounter-test-id",
70
+ "aria-label": "obs-by-encounter-aria-label",
71
+ children: t.map(
72
+ (o, a) => u(o, a === 0, a)
73
+ )
74
+ }
75
+ );
76
+ }, oe = "_observations_kfbhq_1", ie = "_title_kfbhq_12", T = {
77
+ observations: oe,
78
+ title: ie
79
+ }, ne = (t) => ["conceptUuid", t], de = (t, d) => ["observations", t, ...d], be = ({ config: t }) => {
80
+ const d = t, { conceptNames: n = [], conceptUuid: u = [] } = d, o = ae(/* @__PURE__ */ new Set()), a = B(), { addNotification: s } = k(), { t: r } = N(), i = K({
81
+ queries: n.map((e) => ({
82
+ queryKey: ne(e),
83
+ queryFn: () => Q(e),
84
+ enabled: !!e
85
+ }))
86
+ });
87
+ $(() => {
88
+ i.forEach((e, m) => {
89
+ if (e.isError && !o.current.has(m)) {
90
+ const C = n[m];
91
+ s({
92
+ title: r("ERROR_DEFAULT_TITLE"),
93
+ message: r("ERROR_FETCHING_CONCEPT", { conceptName: C }),
94
+ type: "error"
95
+ }), o.current.add(m);
96
+ } else e.isError || o.current.delete(m);
97
+ });
98
+ }, [i, n]);
99
+ const b = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), v = E(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
100
+ data: c,
101
+ isLoading: A,
102
+ isError: R,
103
+ refetch: g
104
+ } = H({
105
+ queryKey: de(a, p),
106
+ queryFn: () => te(a, p),
107
+ enabled: !!a && p.length > 0 && v
108
+ });
109
+ x(
110
+ (e) => {
111
+ e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
112
+ (m) => p.includes(m)
113
+ ) && g();
114
+ },
115
+ [a, g]
116
+ ), $(() => {
117
+ R && s({
118
+ title: r("ERROR_DEFAULT_TITLE"),
119
+ message: r("ERROR_FETCHING_OBSERVATIONS"),
120
+ type: "error"
121
+ });
122
+ }, [R]);
123
+ const f = E(() => {
124
+ if (!c) return [];
125
+ const e = j(c), m = w(e);
126
+ return G(m);
127
+ }, [c]), L = [
128
+ { key: "name", header: "name" },
129
+ { key: "value", header: "value" },
130
+ { key: "form", header: "form" }
131
+ ], O = A || !v, _ = R && v, D = (!c || c.entry?.length === 0 || p.length === 0) && v, q = _ ? r("ERROR_FETCHING_OBSERVATIONS") : null, U = D ? r("NO_OBSERVATIONS_FOUND") : void 0, V = f.length > 0 && !O && !_, h = d.titleTranslationKey, y = h ? r(h) : "";
132
+ return /* @__PURE__ */ I(
133
+ "div",
134
+ {
135
+ id: "observations",
136
+ "data-testid": h ? `observations-${y}` : "observations",
137
+ "aria-label": "observations-aria-label",
138
+ className: T.observations,
139
+ children: [
140
+ /* @__PURE__ */ l(
141
+ M,
142
+ {
143
+ id: "observations-title",
144
+ testId: h ? `observations-title-${y}` : "observations-title",
145
+ title: y,
146
+ className: T.title,
147
+ children: /* @__PURE__ */ l("p", { children: y })
148
+ }
149
+ ),
150
+ V ? /* @__PURE__ */ l(re, { groupedData: f, title: y }) : /* @__PURE__ */ l(
151
+ W,
152
+ {
153
+ headers: L,
154
+ rows: [],
155
+ ariaLabel: r("OBSERVATIONS"),
156
+ loading: O,
157
+ errorStateMessage: q,
158
+ emptyStateMessage: U,
159
+ dataTestId: "observations-table"
160
+ }
161
+ )
162
+ ]
163
+ }
164
+ );
165
+ };
166
+ export {
167
+ ne as conceptUuidQueryKeys,
168
+ be as default,
169
+ de as observationsQueryKeys
170
+ };