@bahmni/services 0.0.1-dev.220 → 0.0.1-dev.222

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { initReactI18next as vi } from "react-i18next";
2
- import { useTranslation as Zv } from "react-i18next";
2
+ import { useTranslation as tw } from "react-i18next";
3
3
  import { useRef as bn, useCallback as Wr, useEffect as _n } from "react";
4
4
  function aa(e, t) {
5
5
  return function() {
@@ -3975,7 +3975,14 @@ const nl = (e) => new Promise((t, r) => {
3975
3975
  function $g(e) {
3976
3976
  return e.replace(/[\s-]+/g, "_").replace(/([a-z])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toUpperCase();
3977
3977
  }
3978
- function Pg(e) {
3978
+ function Pg(e, t, r, n, s) {
3979
+ const o = (a) => ({
3980
+ ...n(a),
3981
+ disabled: !0
3982
+ });
3983
+ return e ? [o(s.loading)] : t ? [o(s.error)] : r.length ? r : [o(s.empty)];
3984
+ }
3985
+ function Ig(e) {
3979
3986
  return e ? e.replaceAll(/[_-]/g, " ").replaceAll(/([a-z])([A-Z])/g, "$1 $2").replaceAll(/([A-Z])([A-Z][a-z])/g, "$1 $2").replaceAll(/([a-z])(\d)/gi, "$1 $2").replaceAll(/(\d)([a-z])/gi, "$1 $2").replaceAll(/\s+/g, " ").trim().toLowerCase().replace(/^./, (t) => t.toUpperCase()) : "";
3980
3987
  }
3981
3988
  const sl = (e) => W + `/user?username=${e}&v=custom:(display,username,uuid)`, ja = "bahmni.user.location", ol = `${W}/location?tags=Login Location&v=default`, al = (e) => W + `/user/${e}?v=full`, il = (e) => W + `/bahmni/app/setting?module=${e}`, cl = "default_dateFormat", ul = xa, ll = [
@@ -3984,7 +3991,7 @@ const sl = (e) => W + `/user?username=${e}&v=custom:(display,username,uuid)`, ja
3984
3991
  ], dl = {
3985
3992
  LOGOUT_FAILED: "USER_LOGOUT_FAILED"
3986
3993
  };
3987
- async function Ig() {
3994
+ async function Cg() {
3988
3995
  const e = Fa(Ua);
3989
3996
  if (!e)
3990
3997
  return null;
@@ -4008,15 +4015,15 @@ const qn = () => {
4008
4015
  if (!t.uuid)
4009
4016
  throw new Error(ie.t("ERROR_FETCHING_USER_LOCATION_DETAILS"));
4010
4017
  return t;
4011
- }, Cg = async () => (await F(il("commons"))).find(
4018
+ }, Dg = async () => (await F(il("commons"))).find(
4012
4019
  (r) => r.property === cl
4013
- )?.value ?? null, Dg = async () => {
4020
+ )?.value ?? null, Lg = async () => {
4014
4021
  try {
4015
4022
  return (await F(ol)).results ?? [];
4016
4023
  } catch (e) {
4017
4024
  return console.error("Failed to fetch available locations:", e), [];
4018
4025
  }
4019
- }, Lg = async () => {
4026
+ }, kg = async () => {
4020
4027
  try {
4021
4028
  await Pa(ul), ll.forEach((e) => {
4022
4029
  tl(e);
@@ -4024,7 +4031,7 @@ const qn = () => {
4024
4031
  } catch (e) {
4025
4032
  throw console.error("Logout failed:", e), new Error(ie.t(dl.LOGOUT_FAILED));
4026
4033
  }
4027
- }, kg = async (e, t) => {
4034
+ }, Ug = async (e, t) => {
4028
4035
  await Ce(al(e), {
4029
4036
  userProperties: { loginLocation: t.uuid }
4030
4037
  });
@@ -4074,7 +4081,7 @@ const qn = () => {
4074
4081
  }, Va = W + "/idgen/identifiertype", gl = (e) => W + `/bahmni/app/setting?module=${e}`, yl = "bahmni.primaryIdentifierType", vl = W + "/bahmnicore/patientprofile", wl = (e) => W + `/bahmnicore/patientprofile/${e}`, El = (e) => W + `/patientprofile/${e}?v=full`, bl = (e, t, r = 20, n) => {
4075
4082
  let s = `/openmrs/module/addresshierarchy/ajax/getPossibleAddressHierarchyEntriesWithParents.form?addressField=${e}&limit=${r}&searchString=${encodeURIComponent(t)}`;
4076
4083
  return n && (s += `&parent=${n}`), s;
4077
- }, _l = "/openmrs/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form", Sl = W + "/relationshiptype?v=custom:(aIsToB,bIsToA,uuid)&limit=150", Rl = 20, Tl = 2, Ug = 120, xg = 50, qg = 15, Ol = /^[a-f0-9-]{36}$/i, Al = (e) => Yu + `/patientImage?patientUuid=${e}`, Nl = W + "/personattributetype?v=custom:(uuid,name,sortWeight,description,format,concept:(uuid,display,answers:(uuid,name)))", $l = async (e) => {
4084
+ }, _l = "/openmrs/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form", Sl = W + "/relationshiptype?v=custom:(aIsToB,bIsToA,uuid)&limit=150", Rl = 20, Tl = 2, xg = 120, qg = 50, Mg = 15, Ol = /^[a-f0-9-]{36}$/i, Al = (e) => Yu + `/patientImage?patientUuid=${e}`, Nl = W + "/personattributetype?v=custom:(uuid,name,sortWeight,description,format,concept:(uuid,display,answers:(uuid,name)))", $l = async (e) => {
4078
4085
  if (!e || e.trim() === "")
4079
4086
  throw new Error("Invalid patient UUID: UUID cannot be empty");
4080
4087
  if (!Ol.test(e))
@@ -4107,20 +4114,20 @@ const qn = () => {
4107
4114
  formattedContact: r,
4108
4115
  identifiers: s
4109
4116
  };
4110
- }, Mg = async (e) => {
4117
+ }, Fg = async (e) => {
4111
4118
  const t = await $l(e);
4112
4119
  return Ll(t);
4113
- }, Fg = async (e) => {
4120
+ }, jg = async (e) => {
4114
4121
  const t = await fetch(Al(e));
4115
4122
  if (!t.ok) return null;
4116
4123
  const r = await t.blob();
4117
4124
  return await nl(r);
4118
- }, jg = async (e, t) => {
4125
+ }, Vg = async (e, t) => {
4119
4126
  const r = qn();
4120
4127
  return await F(
4121
4128
  hl(e, r.uuid, t)
4122
4129
  );
4123
- }, Vg = async (e, t, r, n, s) => {
4130
+ }, Bg = async (e, t, r, n, s) => {
4124
4131
  const o = qn();
4125
4132
  return await F(
4126
4133
  ml(
@@ -4131,9 +4138,9 @@ const qn = () => {
4131
4138
  o.uuid
4132
4139
  )
4133
4140
  );
4134
- }, Bg = async () => F(Va), kl = async () => (await F(gl("core"))).find(
4141
+ }, Hg = async () => F(Va), kl = async () => (await F(gl("core"))).find(
4135
4142
  (r) => r.property === yl
4136
- )?.value ?? null, Hg = async () => {
4143
+ )?.value ?? null, zg = async () => {
4137
4144
  const [e, t] = await Promise.all([
4138
4145
  F(Va),
4139
4146
  kl()
@@ -4150,10 +4157,10 @@ const qn = () => {
4150
4157
  sourcesByPrefix: n,
4151
4158
  primaryIdentifierTypeUuid: t
4152
4159
  }) : { prefixes: r, sourcesByPrefix: n, primaryIdentifierTypeUuid: t };
4153
- }, zg = async (e) => Ce(vl, e), Gg = async (e, t) => Ce(
4160
+ }, Gg = async (e) => Ce(vl, e), Kg = async (e, t) => Ce(
4154
4161
  wl(e),
4155
4162
  t
4156
- ), Kg = async () => F(Ma("mrs.genders")), Yg = async (e, t, r = Rl, n) => {
4163
+ ), Yg = async () => F(Ma("mrs.genders")), Wg = async (e, t, r = Rl, n) => {
4157
4164
  if (!t || t.length < Tl)
4158
4165
  return [];
4159
4166
  try {
@@ -4165,7 +4172,7 @@ const qn = () => {
4165
4172
  `Failed to fetch address hierarchy for field "${e}": ${s instanceof Error ? s.message : "Unknown error"}`
4166
4173
  );
4167
4174
  }
4168
- }, Wg = async () => F(_l), Jg = async (e) => F(El(e)), Qg = async () => {
4175
+ }, Jg = async () => F(_l), Qg = async (e) => F(El(e)), Xg = async () => {
4169
4176
  try {
4170
4177
  return (await F(
4171
4178
  Sl
@@ -4179,9 +4186,9 @@ const qn = () => {
4179
4186
  `Failed to fetch relationship types: ${e instanceof Error ? e.message : "Unknown error"}`
4180
4187
  );
4181
4188
  }
4182
- }, Xg = async () => F(Nl);
4189
+ }, Zg = async () => F(Nl);
4183
4190
  var Ul = /* @__PURE__ */ ((e) => (e.BOOLEAN = "java.lang.Boolean", e.BOOLEAN_DATATYPE = "org.openmrs.customdatatype.datatype.BooleanDatatype", e.CONCEPT = "org.openmrs.Concept", e.CODED_CONCEPT = "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype", e.CONCEPT_DATATYPE = "org.openmrs.customdatatype.datatype.ConceptDatatype", e.STRING = "java.lang.String", e.FREE_TEXT = "org.openmrs.customdatatype.datatype.FreeTextDatatype", e.REGEX_VALIDATED_TEXT = "org.openmrs.customdatatype.datatype.RegexValidatedTextDatatype", e.INTEGER = "java.lang.Integer", e.FLOAT = "java.lang.Float", e.ATTRIBUTABLE_DATE = "org.openmrs.util.AttributableDate", e.DATE_DATATYPE = "org.openmrs.customdatatype.datatype.DateDatatype", e))(Ul || {}), xl = /* @__PURE__ */ ((e) => (e.CHECKBOX = "checkbox", e.DROPDOWN = "dropdown", e.TEXT = "text", e.NUMBER = "number", e.DATE = "date", e))(xl || {});
4184
- const Zg = (e) => e === "java.lang.Boolean" || e === "org.openmrs.customdatatype.datatype.BooleanDatatype" ? "checkbox" : e === "org.openmrs.Concept" || e === "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype" || e === "org.openmrs.customdatatype.datatype.ConceptDatatype" ? "dropdown" : e === "java.lang.Integer" || e === "java.lang.Float" ? "number" : e === "org.openmrs.util.AttributableDate" || e === "org.openmrs.customdatatype.datatype.DateDatatype" ? "date" : "text", ey = (e) => e === "java.lang.Boolean" || e === "org.openmrs.customdatatype.datatype.BooleanDatatype", ty = (e) => e === "org.openmrs.Concept" || e === "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype" || e === "org.openmrs.customdatatype.datatype.ConceptDatatype", ry = (e) => e === "java.lang.Integer" || e === "java.lang.Float", ny = (e) => e === "org.openmrs.util.AttributableDate" || e === "org.openmrs.customdatatype.datatype.DateDatatype", sy = (e) => e === "java.lang.String" || e === "org.openmrs.customdatatype.datatype.FreeTextDatatype" || e === "org.openmrs.customdatatype.datatype.RegexValidatedTextDatatype", ql = (e) => {
4191
+ const ey = (e) => e === "java.lang.Boolean" || e === "org.openmrs.customdatatype.datatype.BooleanDatatype" ? "checkbox" : e === "org.openmrs.Concept" || e === "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype" || e === "org.openmrs.customdatatype.datatype.ConceptDatatype" ? "dropdown" : e === "java.lang.Integer" || e === "java.lang.Float" ? "number" : e === "org.openmrs.util.AttributableDate" || e === "org.openmrs.customdatatype.datatype.DateDatatype" ? "date" : "text", ty = (e) => e === "java.lang.Boolean" || e === "org.openmrs.customdatatype.datatype.BooleanDatatype", ry = (e) => e === "org.openmrs.Concept" || e === "org.bahmni.module.bahmnicore.customdatatype.datatype.CodedConceptDatatype" || e === "org.openmrs.customdatatype.datatype.ConceptDatatype", ny = (e) => e === "java.lang.Integer" || e === "java.lang.Float", sy = (e) => e === "org.openmrs.util.AttributableDate" || e === "org.openmrs.customdatatype.datatype.DateDatatype", oy = (e) => e === "java.lang.String" || e === "org.openmrs.customdatatype.datatype.FreeTextDatatype" || e === "org.openmrs.customdatatype.datatype.RegexValidatedTextDatatype", ql = (e) => {
4185
4192
  const t = new CustomEvent("bahmni-audit-log", { detail: e });
4186
4193
  window.dispatchEvent(t);
4187
4194
  }, Ml = (e) => {
@@ -4234,10 +4241,10 @@ const Zg = (e) => e === "java.lang.Boolean" || e === "org.openmrs.customdatatype
4234
4241
  }
4235
4242
  }, Fl = W + "/auditlog", jl = {
4236
4243
  UNKNOWN_EVENT_TYPE: "AUDIT_LOG_ERROR_UNKNOWN_EVENT_TYPE"
4237
- }, Vl = () => W + "/bahmnicore/config/bahmniencounter?callerContext=REGISTRATION_CONCEPTS", Bl = W + "/visit", Hl = (e) => W + `/visit?patient=${e}&includeInactive=false&v=custom:(uuid,visitType,startDatetime,stopDatetime)`, zl = (e) => W + `/bahmnicore/visitLocation/${e}`, oy = async () => F(Vl()), Gl = async (e) => F(Hl(e)), Kl = async (e) => F(zl(e)), Yl = async (e) => Ce(Bl, e), ay = async (e) => {
4244
+ }, Vl = () => W + "/bahmnicore/config/bahmniencounter?callerContext=REGISTRATION_CONCEPTS", Bl = W + "/visit", Hl = (e) => W + `/visit?patient=${e}&includeInactive=false&v=custom:(uuid,visitType,startDatetime,stopDatetime)`, zl = (e) => W + `/bahmnicore/visitLocation/${e}`, ay = async () => F(Vl()), Gl = async (e) => F(Hl(e)), Kl = async (e) => F(zl(e)), Yl = async (e) => Ce(Bl, e), iy = async (e) => {
4238
4245
  const t = await Gl(e);
4239
4246
  return t?.results && t.results.length > 0;
4240
- }, iy = async (e, t) => {
4247
+ }, cy = async (e, t) => {
4241
4248
  const r = await Kl(
4242
4249
  qn().uuid
4243
4250
  ), n = {
@@ -5704,7 +5711,7 @@ function Sf(e, t, r) {
5704
5711
  function Rf(e, t, r) {
5705
5712
  return jn(e, -t, r);
5706
5713
  }
5707
- const cy = {
5714
+ const uy = {
5708
5715
  PROPOSED: "proposed",
5709
5716
  PENDING: "pending",
5710
5717
  BOOKED: "booked",
@@ -5715,36 +5722,36 @@ const cy = {
5715
5722
  CHECKED_IN: "checked-in",
5716
5723
  WAITLIST: "waitlist",
5717
5724
  ENTERED_IN_ERROR: "entered-in-error"
5718
- }, Tf = W + "/appointments/search", Qa = W + "/appointments", uy = "http://fhir.bahmni.org/code-system/appointments", Of = (e) => `${Qa}/${e}`, jr = (e, t, r, n) => {
5725
+ }, Tf = W + "/appointments/search", Qa = W + "/appointments", ly = "http://fhir.bahmni.org/code-system/appointments", Of = (e) => `${Qa}/${e}`, jr = (e, t, r, n) => {
5719
5726
  const s = t === "upcoming", o = s ? "ge" : "le", a = s ? "date" : "-date", i = s ? (/* @__PURE__ */ new Date()).toISOString() : Sf(/* @__PURE__ */ new Date()).toISOString();
5720
5727
  let c = `${ce}/Appointment?patient=${e}&date=${o}${i}&_sort=${a}`;
5721
5728
  return r !== void 0 && r > 0 && (c += `&_count=${r}`), n !== void 0 && n > 0 && (c += `&_getpagesoffset=${n}`), c;
5722
- }, Af = (e) => jr(e, "upcoming"), Nf = (e, t) => jr(e, "past", t), $f = (e) => `${Qa}/${e}/status-change`, Pf = W + "/appointmentService/all/full", If = (e) => `${W}/appointmentService?uuid=${e}`, Cf = (e, t = 10, r = 0) => jr(e, "upcoming", t, r), Df = (e, t = 10, r = 0) => jr(e, "past", t, r), ly = async (e) => await Ce(Tf, e);
5723
- async function dy(e) {
5729
+ }, Af = (e) => jr(e, "upcoming"), Nf = (e, t) => jr(e, "past", t), $f = (e) => `${Qa}/${e}/status-change`, Pf = W + "/appointmentService/all/full", If = (e) => `${W}/appointmentService?uuid=${e}`, Cf = (e, t = 10, r = 0) => jr(e, "upcoming", t, r), Df = (e, t = 10, r = 0) => jr(e, "past", t, r), dy = async (e) => await Ce(Tf, e);
5730
+ async function fy(e) {
5724
5731
  return await F(Af(e));
5725
5732
  }
5726
- async function fy(e, t) {
5733
+ async function py(e, t) {
5727
5734
  return await F(
5728
5735
  Nf(e, t)
5729
5736
  );
5730
5737
  }
5731
- const py = async (e, t, r) => await Ce($f(e), {
5738
+ const hy = async (e, t, r) => await Ce($f(e), {
5732
5739
  toStatus: t,
5733
5740
  onDate: r
5734
5741
  });
5735
- async function hy(e) {
5742
+ async function my(e) {
5736
5743
  return await F(Of(e));
5737
5744
  }
5738
- const my = async () => await F(Pf), gy = async (e) => {
5745
+ const gy = async () => await F(Pf), yy = async (e) => {
5739
5746
  await Pa(If(e));
5740
5747
  };
5741
- async function yy(e, t = 10, r = 1) {
5748
+ async function vy(e, t = 10, r = 1) {
5742
5749
  const n = (r - 1) * t, s = await F(
5743
5750
  Cf(e, t, n)
5744
5751
  );
5745
5752
  return { bundle: s, total: s.total ?? s.entry?.length ?? 0 };
5746
5753
  }
5747
- async function vy(e, t = 10, r = 1) {
5754
+ async function wy(e, t = 10, r = 1) {
5748
5755
  const n = (r - 1) * t, s = await F(
5749
5756
  Df(e, t, n)
5750
5757
  );
@@ -5757,7 +5764,7 @@ const Xa = "dd/MM/yyyy", Lf = "default_dateFormat", kf = "h:mm a", Te = {
5757
5764
  INVALID_FORMAT: "DATE_ERROR_INVALID_FORMAT",
5758
5765
  NULL_OR_UNDEFINED: "DATE_ERROR_NULL_OR_UNDEFINED"
5759
5766
  };
5760
- function wy(e) {
5767
+ function Ey(e) {
5761
5768
  if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(e))
5762
5769
  return null;
5763
5770
  const t = Hn(e);
@@ -5825,7 +5832,7 @@ function xf() {
5825
5832
  return Xa;
5826
5833
  }
5827
5834
  }
5828
- function Ey(e, t, r = !1, n) {
5835
+ function by(e, t, r = !1, n) {
5829
5836
  const s = t ?? ((a) => a);
5830
5837
  let o;
5831
5838
  try {
@@ -5835,7 +5842,7 @@ function Ey(e, t, r = !1, n) {
5835
5842
  }
5836
5843
  return r && !n && (o = `${o} ${kf}`), Uf(e, o, s);
5837
5844
  }
5838
- function by(e, t, r) {
5845
+ function _y(e, t, r) {
5839
5846
  if (!e || !$t(e) || t === null || t === void 0 || !r || typeof t != "number")
5840
5847
  return;
5841
5848
  const n = new Date(e);
@@ -5850,7 +5857,7 @@ function by(e, t, r) {
5850
5857
  return;
5851
5858
  }
5852
5859
  }
5853
- function _y(e, t) {
5860
+ function Sy(e, t) {
5854
5861
  if (e == null)
5855
5862
  return {
5856
5863
  formattedResult: "",
@@ -5902,11 +5909,11 @@ function _y(e, t) {
5902
5909
  }
5903
5910
  return { formattedResult: c };
5904
5911
  }
5905
- const Sy = () => {
5912
+ const Ry = () => {
5906
5913
  const e = /* @__PURE__ */ new Date();
5907
5914
  return e.setHours(0, 0, 0, 0), e;
5908
5915
  };
5909
- function Ry(e, t) {
5916
+ function Ty(e, t) {
5910
5917
  const r = typeof e == "string" ? Hn(e) : new Date(e), n = /* @__PURE__ */ new Date(), s = Bn(n, r), o = jn(r, s), a = Vn(n, o), i = Mr(o, a), c = Pn(n, i), d = {
5911
5918
  years: "YEARS",
5912
5919
  months: "MONTHS",
@@ -5940,14 +5947,14 @@ const qf = {
5940
5947
  h: 1 / 24,
5941
5948
  min: 1 / 1440,
5942
5949
  s: 1 / 86400
5943
- }, Ty = (e, t, r) => {
5950
+ }, Oy = (e, t, r) => {
5944
5951
  const n = typeof e == "string" ? new Date(e) : e;
5945
5952
  if (isNaN(n.getTime()))
5946
5953
  throw new Error(`Invalid date: ${e}`);
5947
5954
  const s = qf[r] ?? 1, o = t * s;
5948
5955
  return za(n, o);
5949
- }, Oy = (e, t, r, n) => e <= n && r <= t;
5950
- function Ay(e, t, r = !1) {
5956
+ }, Ay = (e, t, r, n) => e <= n && r <= t;
5957
+ function Ny(e, t, r = !1) {
5951
5958
  return !e || !Array.isArray(e) ? [] : e.sort((n, s) => {
5952
5959
  const o = new Date(n[t]), a = new Date(s[t]);
5953
5960
  if (isNaN(o.getTime()) && isNaN(a.getTime())) return 0;
@@ -5986,7 +5993,7 @@ const Mf = () => {
5986
5993
  );
5987
5994
  }
5988
5995
  };
5989
- }, Ny = Mf(), Ff = (e) => ce + `/ValueSet/${e}/$expand`, jf = (e) => ce + `/ValueSet/$expand?filter=${encodeURIComponent(e)}`, Vf = (e, t, r) => W + `/bahmni/terminologies/concepts?limit=${t}&locale=${r}&term=${e}`, Bf = (e) => W + `/concept/${e}`, Hf = (e) => `${W}/concept?s=byFullySpecifiedName&name=${encodeURIComponent(e)}`, zf = "SHORT", Gf = "FULLY_SPECIFIED", $y = async (e, t = 20) => {
5996
+ }, $y = Mf(), Ff = (e) => ce + `/ValueSet/${e}/$expand`, jf = (e) => ce + `/ValueSet/$expand?filter=${encodeURIComponent(e)}`, Vf = (e, t, r) => W + `/bahmni/terminologies/concepts?limit=${t}&locale=${r}&term=${e}`, Bf = (e) => W + `/concept/${e}`, Hf = (e) => `${W}/concept?s=byFullySpecifiedName&name=${encodeURIComponent(e)}`, zf = "SHORT", Gf = "FULLY_SPECIFIED", Py = async (e, t = 20) => {
5990
5997
  const r = qr(), n = Vf(e, t, r);
5991
5998
  return F(n);
5992
5999
  }, br = async (e) => {
@@ -5996,10 +6003,10 @@ const Mf = () => {
5996
6003
  const t = `${jf(e)}`;
5997
6004
  return F(t);
5998
6005
  };
5999
- async function Py(e) {
6006
+ async function Iy(e) {
6000
6007
  return await F(Bf(e));
6001
6008
  }
6002
- async function Iy(e) {
6009
+ async function Cy(e) {
6003
6010
  const t = Hf(e), r = await F(t);
6004
6011
  return !r.results || r.results.length === 0 ? null : r.results[0];
6005
6012
  }
@@ -6035,7 +6042,7 @@ const Wf = (e) => ce + `/AllergyIntolerance?patient=${e}&_count=100&_sort=-_last
6035
6042
  }), an = (e, t) => {
6036
6043
  const r = e.expansion?.contains ?? [];
6037
6044
  return Qf(r).map((s) => Xf(s, t));
6038
- }, Cy = async (e, t, r) => {
6045
+ }, Dy = async (e, t, r) => {
6039
6046
  const n = e ?? et.MEDICATION.code, s = t ?? et.FOOD.code, o = r ?? et.ENVIRONMENT.code, [a, i, c] = await Promise.all([
6040
6047
  br(n),
6041
6048
  br(s),
@@ -6055,7 +6062,7 @@ const Wf = (e) => ce + `/AllergyIntolerance?patient=${e}&_count=100&_sort=-_last
6055
6062
  et.ENVIRONMENT.display
6056
6063
  )
6057
6064
  ];
6058
- }, Dy = async (e) => {
6065
+ }, Ly = async (e) => {
6059
6066
  const t = e ?? Jf.code;
6060
6067
  return (await br(t)).compose?.include[0]?.concept ?? [];
6061
6068
  };
@@ -6089,22 +6096,22 @@ function tp(e) {
6089
6096
  };
6090
6097
  });
6091
6098
  }
6092
- async function Ly(e) {
6099
+ async function ky(e) {
6093
6100
  const t = await ep(e);
6094
6101
  return tp(t);
6095
6102
  }
6096
6103
  var rp = /* @__PURE__ */ ((e) => (e.Active = "Active", e.Inactive = "Inactive", e))(rp || {}), np = /* @__PURE__ */ ((e) => (e.mild = "mild", e.moderate = "moderate", e.severe = "severe", e))(np || {});
6097
- const ky = "http://fhir.openmrs.org/code-system/encounter-type", ei = "problem-list-item", Uy = "http://terminology.hl7.org/CodeSystem/condition-ver-status", ti = "encounter-diagnosis", xy = "http://terminology.hl7.org/CodeSystem/condition-clinical", qy = "http://terminology.hl7.org/CodeSystem/condition-category", My = "http://fhir.bahmni.org/ext/lab-order-concept-type", Fy = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", jy = "http://fhir.bahmni.org/ext/observation/form-namespace-path", Vy = "http://fhir.bahmni.org/ext/observation/obs-value-attachment", By = "Numeric", Hy = "Complex", zy = "final", Gy = "Observation", Ky = /^\d{4}-\d{2}-\d{2}/, sp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/, Yy = {
6104
+ const Uy = "http://fhir.openmrs.org/code-system/encounter-type", ei = "problem-list-item", xy = "http://terminology.hl7.org/CodeSystem/condition-ver-status", ti = "encounter-diagnosis", qy = "http://terminology.hl7.org/CodeSystem/condition-clinical", My = "http://terminology.hl7.org/CodeSystem/condition-category", Fy = "http://fhir.bahmni.org/ext/lab-order-concept-type", jy = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", Vy = "http://fhir.bahmni.org/ext/observation/form-namespace-path", By = "http://fhir.bahmni.org/ext/observation/obs-value-attachment", Hy = "Numeric", zy = "Complex", Gy = "final", Ky = "Observation", Yy = /^\d{4}-\d{2}-\d{2}/, sp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/, Wy = {
6098
6105
  ABNORMAL: { code: "A", display: "Abnormal" },
6099
6106
  NORMAL: { code: "N", display: "Normal" }
6100
6107
  }, op = (e) => ce + `/Condition?category=${ei}&patient=${e}&_count=100&_sort=-_lastUpdated`, ap = (e, t = 10, r = 0) => ce + `/Condition?category=${ei}&patient=${e}&_count=${t}&_getpagesoffset=${r}&_sort=-_lastUpdated`;
6101
6108
  async function ip(e) {
6102
6109
  return await F(`${op(e)}`);
6103
6110
  }
6104
- async function Wy(e) {
6111
+ async function Jy(e) {
6105
6112
  return (await ip(e)).entry?.filter((n) => n.resource?.resourceType === "Condition").map((n) => n.resource) ?? [];
6106
6113
  }
6107
- async function Jy(e, t = 10, r = 1) {
6114
+ async function Qy(e, t = 10, r = 1) {
6108
6115
  const n = (r - 1) * t, s = await F(
6109
6116
  ap(e, t, n)
6110
6117
  );
@@ -6170,11 +6177,11 @@ function gp(e) {
6170
6177
  }
6171
6178
  return Array.from(t.values());
6172
6179
  }
6173
- async function Qy(e) {
6180
+ async function Xy(e) {
6174
6181
  const t = await fp(e), r = ri(t);
6175
6182
  return gp(r);
6176
6183
  }
6177
- async function Xy(e, t = 10, r = 1) {
6184
+ async function Zy(e, t = 10, r = 1) {
6178
6185
  const n = (r - 1) * t, s = await pp(
6179
6186
  e,
6180
6187
  t,
@@ -6348,7 +6355,7 @@ function Lp(e) {
6348
6355
  });
6349
6356
  }
6350
6357
  const Bs = (e) => e.priority === "stat" || e.dosageInstruction?.[0]?.timing?.code?.text === "Immediately" || !1;
6351
- async function Zy(e, t, r, n = !1) {
6358
+ async function ev(e, t, r, n = !1) {
6352
6359
  const s = await Sp(
6353
6360
  e,
6354
6361
  t,
@@ -6357,17 +6364,17 @@ async function Zy(e, t, r, n = !1) {
6357
6364
  );
6358
6365
  return Lp(s);
6359
6366
  }
6360
- async function ev() {
6367
+ async function tv() {
6361
6368
  return await F(
6362
6369
  wp
6363
6370
  );
6364
6371
  }
6365
- async function tv(e, t = 20) {
6372
+ async function rv(e, t = 20) {
6366
6373
  return await F(
6367
6374
  Ep(e, t)
6368
6375
  );
6369
6376
  }
6370
- async function rv() {
6377
+ async function nv() {
6371
6378
  return await F(bp);
6372
6379
  }
6373
6380
  const kp = 200, Up = (e, t, r, n, s) => {
@@ -6401,7 +6408,7 @@ async function Pt(e, t, r, n, s) {
6401
6408
  return a.entry && (a.entry = xp(a.entry), a.total = a.entry.length), a;
6402
6409
  }
6403
6410
  const qp = (e) => `${ce}/ImagingStudy/${e}/$fetch-quality-assessment`;
6404
- async function nv(e, t, r, n) {
6411
+ async function sv(e, t, r, n) {
6405
6412
  return await Pt(
6406
6413
  t,
6407
6414
  e,
@@ -6409,7 +6416,7 @@ async function nv(e, t, r, n) {
6409
6416
  n
6410
6417
  );
6411
6418
  }
6412
- async function sv(e, t, r, n) {
6419
+ async function ov(e, t, r, n) {
6413
6420
  return await Pt(
6414
6421
  t,
6415
6422
  e,
@@ -6418,7 +6425,7 @@ async function sv(e, t, r, n) {
6418
6425
  "ImagingStudy:basedon"
6419
6426
  );
6420
6427
  }
6421
- async function ov(e, t, r, n) {
6428
+ async function av(e, t, r, n) {
6422
6429
  return (await Pt(
6423
6430
  t,
6424
6431
  e,
@@ -6426,10 +6433,10 @@ async function ov(e, t, r, n) {
6426
6433
  n
6427
6434
  )).entry?.filter((a) => a.resource?.resourceType === "ServiceRequest").map((a) => a.resource) ?? [];
6428
6435
  }
6429
- async function av(e) {
6436
+ async function iv(e) {
6430
6437
  return await F(qp(e));
6431
6438
  }
6432
- async function iv(e, t, r, n) {
6439
+ async function cv(e, t, r, n) {
6433
6440
  return await Pt(
6434
6441
  t,
6435
6442
  e,
@@ -6441,29 +6448,29 @@ const Mp = (e, t) => {
6441
6448
  const r = `${ce}/DiagnosticReport?patient=${e}`;
6442
6449
  return t ? `${r}&based-on=${t}` : r;
6443
6450
  }, Fp = (e) => `${ce}/DiagnosticReport/${e}/$fetch-bundle`, jp = (e) => `${ce}/DiagnosticReport/${e}/$update-bundle`;
6444
- async function cv(e, t = []) {
6451
+ async function uv(e, t = []) {
6445
6452
  const r = t.length > 0 ? t.join(",") : void 0, n = Mp(e, r);
6446
6453
  return await F(n);
6447
6454
  }
6448
- async function uv(e) {
6455
+ async function lv(e) {
6449
6456
  const t = Fp(e);
6450
6457
  return await F(t);
6451
6458
  }
6452
- async function lv(e, t) {
6459
+ async function dv(e, t) {
6453
6460
  const r = jp(e);
6454
6461
  return await Ce(r, t);
6455
6462
  }
6456
- const dv = [
6463
+ const fv = [
6457
6464
  "preliminary",
6458
6465
  "final",
6459
6466
  "amended",
6460
6467
  "corrected",
6461
6468
  "appended"
6462
- ], fv = [
6469
+ ], pv = [
6463
6470
  "registered",
6464
6471
  "unknown",
6465
6472
  "partial"
6466
- ], Vp = "All Orderables", Bp = "/openmrs/ws/rest/v1/ordertype?v=custom:(uuid,display,conceptClasses:(uuid,name))", Hp = "LabSet", zp = "http://fhir.bahmni.org/ext/ValueSet/concept-class", pv = ["orderTypes"], Gp = async () => await Kf(Vp), zn = async () => await F(Bp), Kp = (e) => {
6473
+ ], Vp = "All Orderables", Bp = "/openmrs/ws/rest/v1/ordertype?v=custom:(uuid,display,conceptClasses:(uuid,name))", Hp = "LabSet", zp = "http://fhir.bahmni.org/ext/ValueSet/concept-class", hv = ["orderTypes"], Gp = async () => await Kf(Vp), zn = async () => await F(Bp), Kp = (e) => {
6467
6474
  let t = e.display ?? "Unknown investigation";
6468
6475
  return ni(e) === Hp && (t += ` (${ie.t("INVESTIGATION_PANEL")})`), t;
6469
6476
  }, Yp = (e) => {
@@ -6495,12 +6502,12 @@ const dv = [
6495
6502
  });
6496
6503
  });
6497
6504
  }), r;
6498
- }, hv = async () => {
6505
+ }, mv = async () => {
6499
6506
  const e = await Gp(), t = await zn();
6500
6507
  return Wp(e, Yp(t));
6501
- }, mv = async (e) => e ? (await zn()).results.find(
6508
+ }, gv = async (e) => e ? (await zn()).results.find(
6502
6509
  (n) => n.display.toLowerCase() === e.toLowerCase()
6503
- )?.uuid : void 0, gv = async () => (await zn()).results.map((t) => t.display), yv = async (e, t, r) => {
6510
+ )?.uuid : void 0, yv = async () => (await zn()).results.map((t) => t.display), vv = async (e, t, r) => {
6504
6511
  const n = [];
6505
6512
  for (const s of e) {
6506
6513
  const o = s.uuid;
@@ -10915,7 +10922,7 @@ var sm = nm();
10915
10922
  const om = /* @__PURE__ */ Jp(sm), oa = {
10916
10923
  CONFIG_NOT_FOUND: "CONFIG_ERROR_NOT_FOUND",
10917
10924
  VALIDATION_FAILED: "CONFIG_ERROR_VALIDATION_FAILED"
10918
- }, vv = async (e, t) => {
10925
+ }, wv = async (e, t) => {
10919
10926
  const r = await am(e);
10920
10927
  if (!r)
10921
10928
  throw new Error(oa.CONFIG_NOT_FOUND);
@@ -10925,7 +10932,7 @@ const om = /* @__PURE__ */ Jp(sm), oa = {
10925
10932
  }, am = async (e) => await F(e), im = async (e, t) => new om().compile(t)(e), cm = (e) => W + `/form/${e}?v=custom:(resources:(value))`, um = (e) => {
10926
10933
  const t = W + "/bahmniie/form/latestPublishedForms";
10927
10934
  return e ? t + `?episodeUuid=${e}` : t;
10928
- }, wv = (e) => W + `/user/${e}?v=full`, lm = (e, t, r, n) => W + `/bahmniie/form/translations?formName=${encodeURIComponent(e)}&formUuid=${t}&formVersion=${r}&locale=${n}`, _r = "Bahmni", dm = (e, t, r) => {
10935
+ }, Ev = (e) => W + `/user/${e}?v=full`, lm = (e, t, r, n) => W + `/bahmniie/form/translations?formName=${encodeURIComponent(e)}&formUuid=${t}&formVersion=${r}&locale=${n}`, _r = "Bahmni", dm = (e, t, r) => {
10929
10936
  let s = W + "/bahmnicore/patient/" + e + "/forms";
10930
10937
  return r ? s += `?patientProgramUuid=${r}` : t && (s += `?numberOfVisits=${t}`), s;
10931
10938
  }, fm = (e, t) => {
@@ -10939,15 +10946,15 @@ async function hm(e, t) {
10939
10946
  const r = fm(e, t);
10940
10947
  return await F(r);
10941
10948
  }
10942
- async function Ev(e, t) {
10949
+ async function bv(e, t) {
10943
10950
  const r = pm(e, t);
10944
10951
  return await F(r);
10945
10952
  }
10946
- async function bv(e, t) {
10953
+ async function _v(e, t) {
10947
10954
  return (await hm(e, t)).entry?.filter((s) => s.resource?.resourceType === "Observation").map((s) => s.resource) ?? [];
10948
10955
  }
10949
10956
  const mm = (e) => W + `/provider?user=${e}&v=custom:(uuid,display,person)`;
10950
- async function _v(e) {
10957
+ async function Sv(e) {
10951
10958
  const t = await F(
10952
10959
  mm(e)
10953
10960
  );
@@ -10963,13 +10970,13 @@ async function wm(e) {
10963
10970
  async function Em(e) {
10964
10971
  return (await wm(e)).find((r) => !r.period?.end) ?? null;
10965
10972
  }
10966
- async function Sv(e) {
10973
+ async function Rv(e) {
10967
10974
  return await F(
10968
10975
  ym(e)
10969
10976
  );
10970
10977
  }
10971
- const Rv = (e, t) => e?.length === 0 ? !1 : t?.length === 0, bm = ce + "/Encounter", _m = W + "/systemsetting/bahmni.encountersession.duration", Sm = "d34fe3ab-5e07-11ef-8f7c-0242ac120002";
10972
- async function Rm(e) {
10978
+ const Tv = (e, t) => e?.length === 0 ? !1 : t?.length === 0, bm = ce + "/Encounter", _m = W + "/systemsetting/bahmni.encountersession.duration";
10979
+ async function Sm(e) {
10973
10980
  const t = new URLSearchParams();
10974
10981
  Object.entries(e).forEach(([s, o]) => {
10975
10982
  o && t.append(s, o);
@@ -10977,7 +10984,7 @@ async function Rm(e) {
10977
10984
  const r = `${bm}?${t.toString()}`;
10978
10985
  return (await F(r)).entry?.map((s) => s.resource).filter((s) => s !== void 0) ?? [];
10979
10986
  }
10980
- async function Tm() {
10987
+ async function Rm() {
10981
10988
  try {
10982
10989
  const e = await F(
10983
10990
  _m
@@ -10987,7 +10994,7 @@ async function Tm() {
10987
10994
  return 30;
10988
10995
  }
10989
10996
  }
10990
- async function Om(e, t) {
10997
+ async function Tm(e, t) {
10991
10998
  if (!e.length) return null;
10992
10999
  try {
10993
11000
  const r = await Em(t);
@@ -10999,25 +11006,25 @@ async function Om(e, t) {
10999
11006
  return null;
11000
11007
  }
11001
11008
  }
11002
- async function Tv(e, t, r) {
11009
+ async function Ov(e, t, r, n) {
11003
11010
  try {
11004
11011
  if (!e) return null;
11005
- const n = r ?? await Tm(), o = `ge${new Date(Date.now() - n * 60 * 1e3).toISOString()}`, a = {
11012
+ const s = r ?? await Rm(), a = `ge${new Date(Date.now() - s * 60 * 1e3).toISOString()}`, i = {
11006
11013
  patient: e,
11007
11014
  _tag: "encounter",
11008
- _lastUpdated: o,
11009
- type: Sm
11015
+ _lastUpdated: a,
11016
+ type: n
11010
11017
  };
11011
- t && (a.participant = t);
11012
- const i = await Rm(a);
11013
- return i.length === 0 ? null : await Om(i, e);
11018
+ t && (i.participant = t);
11019
+ const c = await Sm(i);
11020
+ return c.length === 0 ? null : await Tm(c, e);
11014
11021
  } catch {
11015
11022
  return null;
11016
11023
  }
11017
11024
  }
11018
- const Am = (e) => ce + `/EpisodeOfCare?_revinclude=Encounter:episode-of-care&_id=${e}`;
11019
- async function Ov(e) {
11020
- const t = e.join(","), r = await F(Am(t));
11025
+ const Om = (e) => ce + `/EpisodeOfCare?_revinclude=Encounter:episode-of-care&_id=${e}`;
11026
+ async function Av(e) {
11027
+ const t = e.join(","), r = await F(Om(t));
11021
11028
  if (r.total === 0)
11022
11029
  throw new Error(
11023
11030
  "No episode of care found for the provided UUIDs: " + e.join(", ")
@@ -11029,13 +11036,13 @@ async function Ov(e) {
11029
11036
  c && s.add(c);
11030
11037
  }), { visitUuids: Array.from(s), encounterUuids: o };
11031
11038
  }
11032
- const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11039
+ const En = /* @__PURE__ */ new Map(), Am = async (e) => {
11033
11040
  if (En.has(e))
11034
11041
  return En.get(e) ?? null;
11035
11042
  const t = await F(Ma(e)), r = t ? String(t) : null;
11036
11043
  return En.set(e, r), r;
11037
- }, $m = async () => await Nm(el) === "true", Pm = async (e, t, r, n = nt.CLINICAL) => {
11038
- if (!await $m())
11044
+ }, Nm = async () => await Am(el) === "true", $m = async (e, t, r, n = nt.CLINICAL) => {
11045
+ if (!await Nm())
11039
11046
  return { logged: !1 };
11040
11047
  const o = $n[t];
11041
11048
  if (!o)
@@ -11052,21 +11059,21 @@ const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11052
11059
  module: n
11053
11060
  };
11054
11061
  return await Ce(Fl, a), { logged: !0 };
11055
- }, Av = () => Ml(async (t) => {
11056
- await Pm(
11062
+ }, Nv = () => Ml(async (t) => {
11063
+ await $m(
11057
11064
  t.patientUuid,
11058
11065
  t.eventType,
11059
11066
  t.messageParams,
11060
11067
  t.module
11061
11068
  );
11062
- }), Nv = async () => {
11069
+ }), $v = async () => {
11063
11070
  try {
11064
11071
  return (await F(xa)).user.privileges;
11065
11072
  } catch (e) {
11066
11073
  const { message: t } = Rr(e);
11067
11074
  throw new Error(t);
11068
11075
  }
11069
- }, $v = (e, t) => {
11076
+ }, Pv = (e, t) => {
11070
11077
  if (!e || e.length === 0)
11071
11078
  return !1;
11072
11079
  if (!t || t.length === 0)
@@ -11075,7 +11082,7 @@ const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11075
11082
  return e.some(
11076
11083
  (n) => r.includes(n.name)
11077
11084
  );
11078
- }, Im = async (e) => {
11085
+ }, Pm = async (e) => {
11079
11086
  let t;
11080
11087
  e && e.length > 0 && (t = e.join(","));
11081
11088
  const r = await fetch(um(t));
@@ -11085,7 +11092,7 @@ const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11085
11092
  );
11086
11093
  const n = await r.json();
11087
11094
  return Array.isArray(n) ? n : [];
11088
- }, Cm = (e, t) => {
11095
+ }, Im = (e, t) => {
11089
11096
  const r = JSON.parse(e.nameTranslation);
11090
11097
  if (Array.isArray(r) && r.length > 0) {
11091
11098
  const n = r.find(
@@ -11095,8 +11102,8 @@ const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11095
11102
  return n.display;
11096
11103
  }
11097
11104
  return e.name;
11098
- }, Dm = (e, t) => {
11099
- const r = Cm(e, t);
11105
+ }, Cm = (e, t) => {
11106
+ const r = Im(e, t);
11100
11107
  return {
11101
11108
  uuid: e.uuid,
11102
11109
  name: r,
@@ -11106,12 +11113,12 @@ const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11106
11113
  editable: n.editable
11107
11114
  }))
11108
11115
  };
11109
- }, Pv = async (e) => {
11110
- const t = await Im(e), r = qr();
11116
+ }, Iv = async (e) => {
11117
+ const t = await Pm(e), r = qr();
11111
11118
  return t.map(
11112
- (n) => Dm(n, r)
11119
+ (n) => Cm(n, r)
11113
11120
  );
11114
- }, Iv = async (e) => {
11121
+ }, Cv = async (e) => {
11115
11122
  const t = await fetch(cm(e));
11116
11123
  if (!t.ok)
11117
11124
  throw new Error(
@@ -11145,7 +11152,7 @@ const En = /* @__PURE__ */ new Map(), Nm = async (e) => {
11145
11152
  schema: n,
11146
11153
  translations: d
11147
11154
  };
11148
- }, Cv = async (e, t, r) => {
11155
+ }, Dv = async (e, t, r) => {
11149
11156
  let n;
11150
11157
  t && t.length > 0 && (n = t.join(","));
11151
11158
  const s = dm(e, r, n), o = await F(s);
@@ -11190,7 +11197,7 @@ function fi(e, t) {
11190
11197
  };
11191
11198
  return n(r.controls);
11192
11199
  }
11193
- function Dv(e, t) {
11200
+ function Lv(e, t) {
11194
11201
  if (!e.controls || e.controls.length === 0)
11195
11202
  return [];
11196
11203
  const r = [], n = (/* @__PURE__ */ new Date()).toISOString();
@@ -11235,7 +11242,7 @@ function Dv(e, t) {
11235
11242
  s.interpretation && (a.interpretation = s.interpretation), s.comment && (a.comment = s.comment), r.push(a);
11236
11243
  }), r;
11237
11244
  }
11238
- function Lv(e, t) {
11245
+ function kv(e, t) {
11239
11246
  if (!e || e.length === 0)
11240
11247
  return {
11241
11248
  controls: [],
@@ -11268,7 +11275,7 @@ function Lv(e, t) {
11268
11275
  metadata: { formMetadata: t }
11269
11276
  };
11270
11277
  }
11271
- function kv(e) {
11278
+ function Uv(e) {
11272
11279
  const t = (n) => {
11273
11280
  const s = (d) => d == null ? null : typeof d == "string" || typeof d == "number" || typeof d == "boolean" || typeof d == "object" ? d : null, o = n.concept, a = typeof o == "object" && o !== null && "uuid" in o ? o.uuid : o, i = typeof o == "object" && o !== null && "datatype" in o ? o.datatype : void 0, c = {
11274
11281
  concept: {
@@ -11288,11 +11295,11 @@ function kv(e) {
11288
11295
  };
11289
11296
  return (e?.filter((n) => n.uuid && n.voided ? !0 : !(!n.uuid && n.voided || n.value && typeof n.value == "string" && n.value.endsWith("voided"))) ?? []).map(t);
11290
11297
  }
11291
- function Uv(e) {
11298
+ function xv(e) {
11292
11299
  if (!(!e || typeof e != "object"))
11293
11300
  return "toJS" in e && typeof e.toJS == "function" ? e.toJS() : e;
11294
11301
  }
11295
- function xv(e, t) {
11302
+ function qv(e, t) {
11296
11303
  !e || !Array.isArray(e.children) || e.children.forEach((r) => {
11297
11304
  r && typeof r == "object" && pi(
11298
11305
  r,
@@ -11322,7 +11329,7 @@ function pi(e, t) {
11322
11329
  );
11323
11330
  });
11324
11331
  }
11325
- const Lm = W + "/bahmnicore/diseaseSummaryData?", qv = async (e, t, r, n) => {
11332
+ const Dm = W + "/bahmnicore/diseaseSummaryData?", Mv = async (e, t, r, n) => {
11326
11333
  const s = new URLSearchParams({
11327
11334
  groupBy: n,
11328
11335
  latestCount: t.toString(),
@@ -11331,17 +11338,17 @@ const Lm = W + "/bahmnicore/diseaseSummaryData?", qv = async (e, t, r, n) => {
11331
11338
  r.forEach((a) => {
11332
11339
  s.append("obsConcepts", a);
11333
11340
  });
11334
- const o = Lm + s.toString();
11341
+ const o = Dm + s.toString();
11335
11342
  return F(o);
11336
- }, Wn = "custom:(uuid,episodeUuid,patient,program,display,dateEnrolled,dateCompleted,location,voided,allowedStates,outcome,states:(uuid,startDate,endDate,voided,state:(uuid,concept:(uuid,display,name,names)),auditInfo),auditInfo,attributes)", km = (e) => `${W}/bahmniprogramenrollment?patient=${e}&v=${Wn}`, Um = (e, t = 15, r = 0) => `${W}/bahmniprogramenrollment?patient=${e}&v=${Wn}&limit=${t}&startIndex=${r}&totalCount=true`, hi = (e) => `${W}/bahmniprogramenrollment/${e}`, xm = (e) => `${hi(e)}?v=${Wn}`, Mv = async (e) => await F(km(e)), Fv = async (e, t = 15, r = 1) => {
11343
+ }, Wn = "custom:(uuid,episodeUuid,patient,program,display,dateEnrolled,dateCompleted,location,voided,allowedStates,outcome,states:(uuid,startDate,endDate,voided,state:(uuid,concept:(uuid,display,name,names)),auditInfo),auditInfo,attributes)", Lm = (e) => `${W}/bahmniprogramenrollment?patient=${e}&v=${Wn}`, km = (e, t = 15, r = 0) => `${W}/bahmniprogramenrollment?patient=${e}&v=${Wn}&limit=${t}&startIndex=${r}&totalCount=true`, hi = (e) => `${W}/bahmniprogramenrollment/${e}`, Um = (e) => `${hi(e)}?v=${Wn}`, Fv = async (e) => await F(Lm(e)), jv = async (e, t = 15, r = 1) => {
11337
11344
  const n = (r - 1) * t, s = await F(
11338
- Um(e, t, n)
11345
+ km(e, t, n)
11339
11346
  );
11340
11347
  return {
11341
11348
  programs: s.results,
11342
11349
  total: s.totalCount
11343
11350
  };
11344
- }, jv = async (e) => await F(xm(e)), Vv = async (e, t) => {
11351
+ }, Vv = async (e) => await F(Um(e)), Bv = async (e, t) => {
11345
11352
  const r = {
11346
11353
  uuid: e,
11347
11354
  states: [
@@ -11355,7 +11362,7 @@ const Lm = W + "/bahmnicore/diseaseSummaryData?", qv = async (e, t, r, n) => {
11355
11362
  r
11356
11363
  );
11357
11364
  };
11358
- function Bv(e) {
11365
+ function Hv(e) {
11359
11366
  if (e.states.length === 0)
11360
11367
  return null;
11361
11368
  let t;
@@ -11371,7 +11378,7 @@ function Bv(e) {
11371
11378
  t = e.states.find((r) => r.endDate === null);
11372
11379
  return t ? Yf(t.state.concept.names) ?? t.state.concept.display : null;
11373
11380
  }
11374
- function Hv(e, t) {
11381
+ function zv(e, t) {
11375
11382
  if (t.length === 0)
11376
11383
  return {};
11377
11384
  const r = {};
@@ -11383,12 +11390,12 @@ function Hv(e, t) {
11383
11390
  }
11384
11391
  return r;
11385
11392
  }
11386
- const In = "consultation:saved", zv = (e) => {
11393
+ const In = "consultation:saved", Gv = (e) => {
11387
11394
  const t = new CustomEvent(In, {
11388
11395
  detail: e
11389
11396
  });
11390
11397
  window.dispatchEvent(t);
11391
- }, Gv = (e, t = []) => {
11398
+ }, Kv = (e, t = []) => {
11392
11399
  const r = bn(e);
11393
11400
  _n(() => {
11394
11401
  r.current = e;
@@ -11420,17 +11427,17 @@ function gi(e) {
11420
11427
  };
11421
11428
  });
11422
11429
  }
11423
- async function qm(e, t) {
11430
+ async function xm(e, t) {
11424
11431
  const r = mi(e, t);
11425
11432
  return F(r);
11426
11433
  }
11427
- async function Kv(e, t) {
11428
- const n = ((await qm(e, t)).entry ?? []).filter(
11434
+ async function Yv(e, t) {
11435
+ const n = ((await xm(e, t)).entry ?? []).filter(
11429
11436
  (s) => !!s.resource
11430
11437
  );
11431
11438
  return gi(n);
11432
11439
  }
11433
- async function Yv(e, t, r = 10, n = 1) {
11440
+ async function Wv(e, t, r = 10, n = 1) {
11434
11441
  const s = (n - 1) * r, o = mi(
11435
11442
  e,
11436
11443
  t,
@@ -11444,11 +11451,15 @@ async function Yv(e, t, r = 10, n = 1) {
11444
11451
  total: a.total ?? i.length
11445
11452
  };
11446
11453
  }
11454
+ const qm = (e) => `${W}/location?operator=ALL&s=byTags&tags=${encodeURIComponent(e)}&v=custom:(uuid,display,childLocations:(uuid,display,retired))`;
11455
+ async function Jv(e) {
11456
+ return (await F(qm(e))).results ?? [];
11457
+ }
11447
11458
  const Mm = ce + "/Immunization", Fm = (e, t) => {
11448
11459
  let r = `${Mm}?patient=${e}&_sort=-_lastUpdated&_count=100`;
11449
11460
  return t && (r += `&status=${t}`), r;
11450
11461
  };
11451
- async function Wv(e, t) {
11462
+ async function Qv(e, t) {
11452
11463
  return (await jm(e, t)).entry?.filter((n) => n.resource?.resourceType === "Immunization").map((n) => n.resource) ?? [];
11453
11464
  }
11454
11465
  async function jm(e, t) {
@@ -11482,7 +11493,7 @@ async function Hm(e) {
11482
11493
  }, n.readAsDataURL(e);
11483
11494
  });
11484
11495
  }
11485
- async function Jv(e, t, r) {
11496
+ async function Xv(e, t, r) {
11486
11497
  const n = await Hm(e), s = {
11487
11498
  content: n.content,
11488
11499
  encounterTypeName: t,
@@ -11494,191 +11505,193 @@ async function Jv(e, t, r) {
11494
11505
  return Ce(Vm, s);
11495
11506
  }
11496
11507
  export {
11497
- uy as APPOINTMENT_IDENTIFIER_SYSTEM,
11498
- cy as APPOINTMENT_STATUSES,
11508
+ ly as APPOINTMENT_IDENTIFIER_SYSTEM,
11509
+ uy as APPOINTMENT_STATUSES,
11499
11510
  $n as AUDIT_LOG_EVENT_DETAILS,
11500
11511
  np as AllergySeverity,
11501
11512
  rp as AllergyStatus,
11502
11513
  Ul as AttributeFormat,
11503
11514
  xl as AttributeInputType,
11504
11515
  hg as BAHMNI_HOME_PATH,
11505
- Hy as CONCEPT_DATATYPE_COMPLEX,
11506
- By as CONCEPT_DATATYPE_NUMERIC,
11516
+ zy as CONCEPT_DATATYPE_COMPLEX,
11517
+ Hy as CONCEPT_DATATYPE_NUMERIC,
11507
11518
  In as CONSULTATION_SAVED_EVENT,
11508
11519
  sp as DATETIME_REGEX_PATTERN,
11509
- Ky as DATE_REGEX_PATTERN,
11520
+ Yy as DATE_REGEX_PATTERN,
11510
11521
  Xa as DEFAULT_DATE_FORMAT,
11511
11522
  Lf as DEFAULT_DATE_FORMAT_STORAGE_KEY,
11512
11523
  kf as DEFAULT_TIME_FORMAT,
11513
11524
  qf as DURATION_UNIT_TO_DAYS,
11514
- ky as FHIR_ENCOUNTER_TYPE_CODE_SYSTEM,
11515
- My as FHIR_LAB_ORDER_CONCEPT_TYPE_EXTENSION_URL,
11516
- jy as FHIR_OBSERVATION_FORM_NAMESPACE_PATH_URL,
11517
- Fy as FHIR_OBSERVATION_INTERPRETATION_SYSTEM,
11518
- zy as FHIR_OBSERVATION_STATUS_FINAL,
11519
- Vy as FHIR_OBSERVATION_VALUE_ATTACHMENT_URL,
11520
- Gy as FHIR_RESOURCE_TYPE_OBSERVATION,
11521
- qy as HL7_CONDITION_CATEGORY_CODE_SYSTEM,
11525
+ Uy as FHIR_ENCOUNTER_TYPE_CODE_SYSTEM,
11526
+ Fy as FHIR_LAB_ORDER_CONCEPT_TYPE_EXTENSION_URL,
11527
+ Vy as FHIR_OBSERVATION_FORM_NAMESPACE_PATH_URL,
11528
+ jy as FHIR_OBSERVATION_INTERPRETATION_SYSTEM,
11529
+ Gy as FHIR_OBSERVATION_STATUS_FINAL,
11530
+ By as FHIR_OBSERVATION_VALUE_ATTACHMENT_URL,
11531
+ Ky as FHIR_RESOURCE_TYPE_OBSERVATION,
11532
+ My as HL7_CONDITION_CATEGORY_CODE_SYSTEM,
11522
11533
  ei as HL7_CONDITION_CATEGORY_CONDITION_CODE,
11523
11534
  ti as HL7_CONDITION_CATEGORY_DIAGNOSIS_CODE,
11524
- xy as HL7_CONDITION_CLINICAL_STATUS_CODE_SYSTEM,
11525
- Uy as HL7_CONDITION_VERIFICATION_STATUS_CODE_SYSTEM,
11526
- Yy as INTERPRETATION_TO_CODE,
11527
- xg as MAX_NAME_LENGTH,
11528
- Ug as MAX_PATIENT_AGE_YEARS,
11529
- qg as MAX_PHONE_NUMBER_LENGTH,
11535
+ qy as HL7_CONDITION_CLINICAL_STATUS_CODE_SYSTEM,
11536
+ xy as HL7_CONDITION_VERIFICATION_STATUS_CODE_SYSTEM,
11537
+ Wy as INTERPRETATION_TO_CODE,
11538
+ qg as MAX_NAME_LENGTH,
11539
+ xg as MAX_PATIENT_AGE_YEARS,
11540
+ Mg as MAX_PHONE_NUMBER_LENGTH,
11530
11541
  Ue as MedicationStatus,
11531
11542
  ce as OPENMRS_FHIR_R4,
11532
11543
  W as OPENMRS_REST_V1,
11533
- pv as ORDER_TYPE_QUERY_KEY,
11534
- fv as PENDING_REPORT_STATUSES,
11535
- dv as PROCESSED_REPORT_STATUSES,
11536
- wv as USER_PINNED_PREFERENCE_URL,
11537
- wy as calculateAge,
11538
- Ty as calculateEndDate,
11539
- by as calculateOnsetDate,
11544
+ hv as ORDER_TYPE_QUERY_KEY,
11545
+ pv as PENDING_REPORT_STATUSES,
11546
+ fv as PROCESSED_REPORT_STATUSES,
11547
+ Ev as USER_PINNED_PREFERENCE_URL,
11548
+ Ey as calculateAge,
11549
+ Oy as calculateEndDate,
11550
+ _y as calculateOnsetDate,
11540
11551
  $g as camelToScreamingSnakeCase,
11541
11552
  bg as capitalize,
11542
- ay as checkIfActiveVisitExists,
11543
- Uv as convertImmutableToPlainObject,
11544
- Pg as convertToSentenceCase,
11545
- zg as createPatient,
11546
- iy as createVisitForPatient,
11553
+ iy as checkIfActiveVisitExists,
11554
+ xv as convertImmutableToPlainObject,
11555
+ Ig as convertToSentenceCase,
11556
+ Gg as createPatient,
11557
+ cy as createVisitForPatient,
11547
11558
  Pa as del,
11548
- gy as deleteAppointmentService,
11559
+ yy as deleteAppointmentService,
11549
11560
  tl as deleteCookie,
11550
11561
  ql as dispatchAuditEvent,
11551
- zv as dispatchConsultationSaved,
11552
- Oy as doDateRangesOverlap,
11553
- Hv as extractAttributes,
11554
- xv as extractNotesFromFormData,
11555
- Cy as fetchAndFormatAllergenConcepts,
11556
- Iv as fetchFormMetadata,
11557
- ev as fetchMedicationOrdersMetadata,
11558
- Pv as fetchObservationForms,
11559
- av as fetchQualityAssessment,
11560
- Dy as fetchReactionConcepts,
11562
+ Gv as dispatchConsultationSaved,
11563
+ Ay as doDateRangesOverlap,
11564
+ zv as extractAttributes,
11565
+ qv as extractNotesFromFormData,
11566
+ Dy as fetchAndFormatAllergenConcepts,
11567
+ Cv as fetchFormMetadata,
11568
+ tv as fetchMedicationOrdersMetadata,
11569
+ Iv as fetchObservationForms,
11570
+ iv as fetchQualityAssessment,
11571
+ Ly as fetchReactionConcepts,
11561
11572
  Og as filterReplacementEntries,
11562
- Tv as findActiveEncounterInSession,
11563
- _y as formatDateDistance,
11564
- Ey as formatDateTime,
11573
+ Ov as findActiveEncounterInSession,
11574
+ Sy as formatDateDistance,
11575
+ by as formatDateTime,
11565
11576
  Ag as formatUrl,
11566
11577
  wg as generateId,
11567
11578
  Eg as generateUUID,
11568
11579
  F as get,
11569
11580
  Em as getActiveVisit,
11570
11581
  Gl as getActiveVisitByPatient,
11571
- Yg as getAddressHierarchyEntries,
11572
- my as getAllAppointmentServices,
11582
+ Wg as getAddressHierarchyEntries,
11583
+ gy as getAllAppointmentServices,
11573
11584
  ep as getAllergies,
11574
- hy as getAppointmentById,
11575
- Dg as getAvailableLocations,
11576
- mv as getCategoryUuidFromOrderTypes,
11577
- Py as getConceptById,
11578
- Jy as getConditionPage,
11579
- Wy as getConditions,
11580
- vv as getConfig,
11585
+ my as getAppointmentById,
11586
+ Lg as getAvailableLocations,
11587
+ gv as getCategoryUuidFromOrderTypes,
11588
+ Iy as getConceptById,
11589
+ Qy as getConditionPage,
11590
+ Jy as getConditions,
11591
+ wv as getConfig,
11581
11592
  Fa as getCookieByName,
11582
- _v as getCurrentProvider,
11583
- Bv as getCurrentStateName,
11584
- Ig as getCurrentUser,
11585
- Nv as getCurrentUserPrivileges,
11586
- Cg as getDefaultDateFormat,
11587
- Xy as getDiagnosesPage,
11588
- uv as getDiagnosticReportBundle,
11589
- cv as getDiagnosticReports,
11590
- Yv as getDocumentReferencePage,
11591
- qm as getDocumentReferences,
11592
- Ov as getEncountersAndVisitsForEOC,
11593
- yv as getExistingServiceRequestsForAllCategories,
11594
- hv as getFlattenedInvestigations,
11595
- Ry as getFormattedAge,
11596
- Ly as getFormattedAllergies,
11597
- Kv as getFormattedDocumentReferences,
11593
+ Sv as getCurrentProvider,
11594
+ Hv as getCurrentStateName,
11595
+ Cg as getCurrentUser,
11596
+ $v as getCurrentUserPrivileges,
11597
+ Dg as getDefaultDateFormat,
11598
+ Zy as getDiagnosesPage,
11599
+ lv as getDiagnosticReportBundle,
11600
+ uv as getDiagnosticReports,
11601
+ Wv as getDocumentReferencePage,
11602
+ xm as getDocumentReferences,
11603
+ Av as getEncountersAndVisitsForEOC,
11604
+ vv as getExistingServiceRequestsForAllCategories,
11605
+ mv as getFlattenedInvestigations,
11606
+ Ty as getFormattedAge,
11607
+ ky as getFormattedAllergies,
11608
+ Yv as getFormattedDocumentReferences,
11598
11609
  Rr as getFormattedError,
11599
- Mg as getFormattedPatientById,
11600
- Kg as getGenders,
11601
- Hg as getIdentifierData,
11602
- Bg as getIdentifierTypes,
11603
- Zg as getInputTypeForFormat,
11604
- iv as getLabInvestigationsBundle,
11605
- Sv as getObservationsBundleByEncounterUuid,
11606
- gv as getOrderTypeNames,
11610
+ Fg as getFormattedPatientById,
11611
+ Yg as getGenders,
11612
+ zg as getIdentifierData,
11613
+ Hg as getIdentifierTypes,
11614
+ ey as getInputTypeForFormat,
11615
+ cv as getLabInvestigationsBundle,
11616
+ Jv as getLocationByTag,
11617
+ Rv as getObservationsBundleByEncounterUuid,
11618
+ yv as getOrderTypeNames,
11607
11619
  zn as getOrderTypes,
11608
- Wg as getOrderedAddressHierarchyLevels,
11609
- fy as getPastAppointments,
11610
- vy as getPastAppointmentsPage,
11620
+ Jg as getOrderedAddressHierarchyLevels,
11621
+ py as getPastAppointments,
11622
+ wy as getPastAppointmentsPage,
11611
11623
  $l as getPatientById,
11612
- Qy as getPatientDiagnoses,
11613
- Cv as getPatientFormData,
11614
- Fg as getPatientImageAsDataUrl,
11615
- Wv as getPatientImmunizations,
11624
+ Xy as getPatientDiagnoses,
11625
+ Dv as getPatientFormData,
11626
+ jg as getPatientImageAsDataUrl,
11627
+ Qv as getPatientImmunizations,
11616
11628
  Sp as getPatientMedicationBundle,
11617
- Zy as getPatientMedications,
11618
- bv as getPatientObservations,
11629
+ ev as getPatientMedications,
11630
+ _v as getPatientObservations,
11619
11631
  hm as getPatientObservationsBundle,
11620
- Ev as getPatientObservationsWithEncounterBundle,
11621
- Jg as getPatientProfile,
11622
- Mv as getPatientPrograms,
11623
- Fv as getPatientProgramsPage,
11624
- nv as getPatientRadiologyInvestigationBundle,
11625
- sv as getPatientRadiologyInvestigationBundleWithImagingStudy,
11626
- ov as getPatientRadiologyInvestigations,
11627
- Xg as getPersonAttributeTypes,
11632
+ bv as getPatientObservationsWithEncounterBundle,
11633
+ Qg as getPatientProfile,
11634
+ Fv as getPatientPrograms,
11635
+ jv as getPatientProgramsPage,
11636
+ sv as getPatientRadiologyInvestigationBundle,
11637
+ ov as getPatientRadiologyInvestigationBundleWithImagingStudy,
11638
+ av as getPatientRadiologyInvestigations,
11639
+ Zg as getPersonAttributeTypes,
11628
11640
  kl as getPrimaryIdentifierType,
11629
11641
  Rg as getPriorityByOrder,
11630
- jv as getProgramByUUID,
11631
- Qg as getRelationshipTypes,
11642
+ Vv as getProgramByUUID,
11643
+ Xg as getRelationshipTypes,
11632
11644
  Pt as getServiceRequests,
11633
- Sy as getTodayDate,
11634
- dy as getUpcomingAppointments,
11635
- yy as getUpcomingAppointmentsPage,
11645
+ Ry as getTodayDate,
11646
+ fy as getUpcomingAppointments,
11647
+ vy as getUpcomingAppointmentsPage,
11636
11648
  qn as getUserLoginLocation,
11637
11649
  qr as getUserPreferredLocale,
11638
- rv as getVaccinations,
11650
+ nv as getVaccinations,
11639
11651
  Ng as getValueType,
11640
- oy as getVisitTypes,
11641
- qv as getVitalFlowSheetData,
11652
+ ay as getVisitTypes,
11653
+ Mv as getVitalFlowSheetData,
11642
11654
  Tg as groupByDate,
11643
- $v as hasPrivilege,
11655
+ Pv as hasPrivilege,
11644
11656
  gg as initAppI18n,
11645
- Av as initializeAuditListener,
11646
- ey as isBooleanFormat,
11647
- ty as isConceptFormat,
11648
- ny as isDateFormat,
11649
- ry as isNumberFormat,
11657
+ Nv as initializeAuditListener,
11658
+ ty as isBooleanFormat,
11659
+ ry as isConceptFormat,
11660
+ sy as isDateFormat,
11661
+ ny as isNumberFormat,
11650
11662
  Sg as isStringEmpty,
11651
- sy as isTextFormat,
11652
- Pm as logAuditEvent,
11653
- Lg as logout,
11663
+ oy as isTextFormat,
11664
+ $m as logAuditEvent,
11665
+ kg as logout,
11654
11666
  mg as normalizeTranslationKey,
11655
- Ny as notificationService,
11667
+ $y as notificationService,
11656
11668
  rl as parseQueryParams,
11657
11669
  pg as patch,
11658
11670
  Ce as post,
11659
11671
  fg as put,
11660
11672
  vg as refreshQueries,
11661
- kg as saveUserLocation,
11662
- ly as searchAppointmentsByAttribute,
11663
- Iy as searchConceptByName,
11664
- $y as searchConcepts,
11673
+ Pg as resolveComboBoxItems,
11674
+ Ug as saveUserLocation,
11675
+ dy as searchAppointmentsByAttribute,
11676
+ Cy as searchConceptByName,
11677
+ Py as searchConcepts,
11665
11678
  br as searchFHIRConcepts,
11666
11679
  Kf as searchFHIRConceptsByName,
11667
- tv as searchMedications,
11668
- Vg as searchPatientByCustomAttribute,
11669
- jg as searchPatientByNameOrId,
11680
+ rv as searchMedications,
11681
+ Bg as searchPatientByCustomAttribute,
11682
+ Vg as searchPatientByNameOrId,
11670
11683
  _g as setCookie,
11671
- Rv as shouldEnableEncounterFilter,
11672
- Ay as sortByDate,
11673
- kv as transformContainerObservationsToForm2Observations,
11674
- Dv as transformFormDataToObservations,
11675
- Lv as transformObservationsToFormData,
11676
- py as updateAppointmentStatus,
11677
- lv as updateDiagnosticReportBundle,
11678
- Gg as updatePatient,
11679
- Vv as updateProgramState,
11680
- Jv as uploadDocument,
11684
+ Tv as shouldEnableEncounterFilter,
11685
+ Ny as sortByDate,
11686
+ Uv as transformContainerObservationsToForm2Observations,
11687
+ Lv as transformFormDataToObservations,
11688
+ kv as transformObservationsToFormData,
11689
+ hy as updateAppointmentStatus,
11690
+ dv as updateDiagnosticReportBundle,
11691
+ Kg as updatePatient,
11692
+ Bv as updateProgramState,
11693
+ Xv as uploadDocument,
11681
11694
  yg as useCamera,
11682
- Gv as useSubscribeConsultationSaved,
11683
- Zv as useTranslation
11695
+ Kv as useSubscribeConsultationSaved,
11696
+ tw as useTranslation
11684
11697
  };