@medplum/agent 3.1.10 → 3.1.11

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.
Files changed (2) hide show
  1. package/dist/cjs/index.cjs +566 -552
  2. package/package.json +5 -5
@@ -7662,7 +7662,7 @@ var require_dcmjs = __commonJS({
7662
7662
  var _arr = [];
7663
7663
  var _n = true;
7664
7664
  var _d = false;
7665
- var _s2, _e;
7665
+ var _s2, _e2;
7666
7666
  try {
7667
7667
  for (_i = _i.call(arr); !(_n = (_s2 = _i.next()).done); _n = true) {
7668
7668
  _arr.push(_s2.value);
@@ -7670,12 +7670,12 @@ var require_dcmjs = __commonJS({
7670
7670
  }
7671
7671
  } catch (err2) {
7672
7672
  _d = true;
7673
- _e = err2;
7673
+ _e2 = err2;
7674
7674
  } finally {
7675
7675
  try {
7676
7676
  if (!_n && _i["return"] != null) _i["return"]();
7677
7677
  } finally {
7678
- if (_d) throw _e;
7678
+ if (_d) throw _e2;
7679
7679
  }
7680
7680
  }
7681
7681
  return _arr;
@@ -9574,8 +9574,8 @@ var require_dcmjs = __commonJS({
9574
9574
  STR_APPLY_UIA_OK = false;
9575
9575
  }
9576
9576
  const _utf8len = new Uint8Array(256);
9577
- for (let q2 = 0; q2 < 256; q2++) {
9578
- _utf8len[q2] = q2 >= 252 ? 6 : q2 >= 248 ? 5 : q2 >= 240 ? 4 : q2 >= 224 ? 3 : q2 >= 192 ? 2 : 1;
9577
+ for (let q = 0; q < 256; q++) {
9578
+ _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
9579
9579
  }
9580
9580
  _utf8len[254] = _utf8len[254] = 1;
9581
9581
  var string2buf = (str2) => {
@@ -10447,8 +10447,8 @@ var require_dcmjs = __commonJS({
10447
10447
  const ENOUGH_DISTS = 592;
10448
10448
  const MAX_WBITS = 15;
10449
10449
  const DEF_WBITS = MAX_WBITS;
10450
- const zswap32 = (q2) => {
10451
- return (q2 >>> 24 & 255) + (q2 >>> 8 & 65280) + ((q2 & 65280) << 8) + ((q2 & 255) << 24);
10450
+ const zswap32 = (q) => {
10451
+ return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
10452
10452
  };
10453
10453
  function InflateState() {
10454
10454
  this.mode = 0;
@@ -14671,20 +14671,20 @@ var require_dcmjs = __commonJS({
14671
14671
  value: function rgb2XYZ(rgb) {
14672
14672
  var R2 = Colors2.invGammaCorrection(rgb[0]);
14673
14673
  var G = Colors2.invGammaCorrection(rgb[1]);
14674
- var B = Colors2.invGammaCorrection(rgb[2]);
14675
- return [0.41239558896741424 * R2 + 0.3575834307637148 * G + 0.18049264738170157 * B, 0.21258623078559555 * R2 + 0.7151703037034108 * G + 0.07220049864333623 * B, 0.019297215491746945 * R2 + 0.11918386458084854 * G + 0.9504971251315798 * B];
14674
+ var B2 = Colors2.invGammaCorrection(rgb[2]);
14675
+ return [0.41239558896741424 * R2 + 0.3575834307637148 * G + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G + 0.9504971251315798 * B2];
14676
14676
  }
14677
14677
  }, {
14678
14678
  key: "xyz2LAB",
14679
14679
  value: function xyz2LAB(xyz) {
14680
14680
  var whitePoint = Colors2.d65WhitePointXYZ();
14681
14681
  var X2 = xyz[0] / whitePoint[0];
14682
- var Y2 = xyz[1] / whitePoint[1];
14682
+ var Y = xyz[1] / whitePoint[1];
14683
14683
  var Z2 = xyz[2] / whitePoint[2];
14684
14684
  X2 = Colors2.labf(X2);
14685
- Y2 = Colors2.labf(Y2);
14685
+ Y = Colors2.labf(Y);
14686
14686
  Z2 = Colors2.labf(Z2);
14687
- return [116 * Y2 - 16, 500 * (X2 - Y2), 200 * (Y2 - Z2)];
14687
+ return [116 * Y - 16, 500 * (X2 - Y), 200 * (Y - Z2)];
14688
14688
  }
14689
14689
  }, {
14690
14690
  key: "lab2RGB",
@@ -14694,11 +14694,11 @@ var require_dcmjs = __commonJS({
14694
14694
  }, {
14695
14695
  key: "lab2XYZ",
14696
14696
  value: function lab2XYZ(lab) {
14697
- var L = (lab[0] + 16) / 116;
14698
- var a2 = L + lab[1] / 500;
14699
- var b3 = L - lab[2] / 200;
14697
+ var L2 = (lab[0] + 16) / 116;
14698
+ var a2 = L2 + lab[1] / 500;
14699
+ var b3 = L2 - lab[2] / 200;
14700
14700
  var whitePoint = Colors2.d65WhitePointXYZ();
14701
- return [whitePoint[0] * Colors2.labfInv(a2), whitePoint[1] * Colors2.labfInv(L), whitePoint[2] * Colors2.labfInv(b3)];
14701
+ return [whitePoint[0] * Colors2.labfInv(a2), whitePoint[1] * Colors2.labfInv(L2), whitePoint[2] * Colors2.labfInv(b3)];
14702
14702
  }
14703
14703
  }, {
14704
14704
  key: "xyz2RGB",
@@ -18114,8 +18114,8 @@ var require_dcmjs = __commonJS({
18114
18114
  out[2] = x3 * m2[2] + y2 * m2[5] + z2 * m2[8];
18115
18115
  return out;
18116
18116
  }
18117
- function transformQuat(out, a2, q2) {
18118
- var qx = q2[0], qy = q2[1], qz = q2[2], qw = q2[3];
18117
+ function transformQuat(out, a2, q) {
18118
+ var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
18119
18119
  var x3 = a2[0], y2 = a2[1], z2 = a2[2];
18120
18120
  var uvx = qy * z2 - qz * y2, uvy = qz * x3 - qx * z2, uvz = qx * y2 - qy * x3;
18121
18121
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
@@ -27116,11 +27116,11 @@ var require_decorator = __commonJS({
27116
27116
  };
27117
27117
  };
27118
27118
  var mergeDecorators = (d1, d22) => {
27119
- var _a, _b, _c, _d, _e, _f;
27119
+ var _a, _b, _c, _d, _e2, _f;
27120
27120
  return {
27121
27121
  class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d22 === null || d22 === void 0 ? void 0 : d22.class) !== null && _b !== void 0 ? _b : []]),
27122
27122
  static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.static) !== null && _d !== void 0 ? _d : {}),
27123
- instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d22 === null || d22 === void 0 ? void 0 : d22.instance) !== null && _f !== void 0 ? _f : {})
27123
+ instance: mergePropertyAndMethodDecorators((_e2 = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e2 !== void 0 ? _e2 : {}, (_f = d22 === null || d22 === void 0 ? void 0 : d22.instance) !== null && _f !== void 0 ? _f : {})
27124
27124
  };
27125
27125
  };
27126
27126
  var decorators = /* @__PURE__ */ new Map();
@@ -29170,41 +29170,41 @@ var require_ms = __commonJS({
29170
29170
  return void 0;
29171
29171
  }
29172
29172
  }
29173
- function fmtShort(ms2) {
29174
- var msAbs = Math.abs(ms2);
29173
+ function fmtShort(ms) {
29174
+ var msAbs = Math.abs(ms);
29175
29175
  if (msAbs >= d3) {
29176
- return Math.round(ms2 / d3) + "d";
29176
+ return Math.round(ms / d3) + "d";
29177
29177
  }
29178
29178
  if (msAbs >= h2) {
29179
- return Math.round(ms2 / h2) + "h";
29179
+ return Math.round(ms / h2) + "h";
29180
29180
  }
29181
29181
  if (msAbs >= m2) {
29182
- return Math.round(ms2 / m2) + "m";
29182
+ return Math.round(ms / m2) + "m";
29183
29183
  }
29184
29184
  if (msAbs >= s) {
29185
- return Math.round(ms2 / s) + "s";
29185
+ return Math.round(ms / s) + "s";
29186
29186
  }
29187
- return ms2 + "ms";
29187
+ return ms + "ms";
29188
29188
  }
29189
- function fmtLong(ms2) {
29190
- var msAbs = Math.abs(ms2);
29189
+ function fmtLong(ms) {
29190
+ var msAbs = Math.abs(ms);
29191
29191
  if (msAbs >= d3) {
29192
- return plural(ms2, msAbs, d3, "day");
29192
+ return plural(ms, msAbs, d3, "day");
29193
29193
  }
29194
29194
  if (msAbs >= h2) {
29195
- return plural(ms2, msAbs, h2, "hour");
29195
+ return plural(ms, msAbs, h2, "hour");
29196
29196
  }
29197
29197
  if (msAbs >= m2) {
29198
- return plural(ms2, msAbs, m2, "minute");
29198
+ return plural(ms, msAbs, m2, "minute");
29199
29199
  }
29200
29200
  if (msAbs >= s) {
29201
- return plural(ms2, msAbs, s, "second");
29201
+ return plural(ms, msAbs, s, "second");
29202
29202
  }
29203
- return ms2 + " ms";
29203
+ return ms + " ms";
29204
29204
  }
29205
- function plural(ms2, msAbs, n, name) {
29205
+ function plural(ms, msAbs, n, name) {
29206
29206
  var isPlural = msAbs >= n * 1.5;
29207
- return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : "");
29207
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
29208
29208
  }
29209
29209
  }
29210
29210
  });
@@ -29214,12 +29214,12 @@ var require_ms2 = __commonJS({
29214
29214
  "../../node_modules/logform/ms.js"(exports2, module2) {
29215
29215
  "use strict";
29216
29216
  var format = require_format();
29217
- var ms2 = require_ms();
29217
+ var ms = require_ms();
29218
29218
  module2.exports = format((info) => {
29219
29219
  const curr = +/* @__PURE__ */ new Date();
29220
29220
  exports2.diff = curr - (exports2.prevTime || curr);
29221
29221
  exports2.prevTime = curr;
29222
- info.ms = `+${ms2(exports2.diff)}`;
29222
+ info.ms = `+${ms(exports2.diff)}`;
29223
29223
  return info;
29224
29224
  });
29225
29225
  }
@@ -36632,22 +36632,22 @@ var require_conversions = __commonJS({
36632
36632
  var hi = Math.floor(h2) % 6;
36633
36633
  var f2 = h2 - Math.floor(h2);
36634
36634
  var p2 = 255 * v * (1 - s);
36635
- var q2 = 255 * v * (1 - s * f2);
36635
+ var q = 255 * v * (1 - s * f2);
36636
36636
  var t = 255 * v * (1 - s * (1 - f2));
36637
36637
  v *= 255;
36638
36638
  switch (hi) {
36639
36639
  case 0:
36640
36640
  return [v, t, p2];
36641
36641
  case 1:
36642
- return [q2, v, p2];
36642
+ return [q, v, p2];
36643
36643
  case 2:
36644
36644
  return [p2, v, t];
36645
36645
  case 3:
36646
- return [p2, q2, v];
36646
+ return [p2, q, v];
36647
36647
  case 4:
36648
36648
  return [t, p2, v];
36649
36649
  case 5:
36650
- return [v, p2, q2];
36650
+ return [v, p2, q];
36651
36651
  }
36652
36652
  };
36653
36653
  convert.hsv.hsl = function(hsv) {
@@ -36799,11 +36799,11 @@ var require_conversions = __commonJS({
36799
36799
  var l3 = lab[0];
36800
36800
  var a2 = lab[1];
36801
36801
  var b3 = lab[2];
36802
- var hr;
36802
+ var hr2;
36803
36803
  var h2;
36804
36804
  var c;
36805
- hr = Math.atan2(b3, a2);
36806
- h2 = hr * 360 / 2 / Math.PI;
36805
+ hr2 = Math.atan2(b3, a2);
36806
+ h2 = hr2 * 360 / 2 / Math.PI;
36807
36807
  if (h2 < 0) {
36808
36808
  h2 += 360;
36809
36809
  }
@@ -36816,10 +36816,10 @@ var require_conversions = __commonJS({
36816
36816
  var h2 = lch[2];
36817
36817
  var a2;
36818
36818
  var b3;
36819
- var hr;
36820
- hr = h2 / 360 * 2 * Math.PI;
36821
- a2 = c * Math.cos(hr);
36822
- b3 = c * Math.sin(hr);
36819
+ var hr2;
36820
+ hr2 = h2 / 360 * 2 * Math.PI;
36821
+ a2 = c * Math.cos(hr2);
36822
+ b3 = c * Math.sin(hr2);
36823
36823
  return [l3, a2, b3];
36824
36824
  };
36825
36825
  convert.rgb.ansi16 = function(args) {
@@ -41127,7 +41127,7 @@ var require_dcmjs_dimse_min = __commonJS({
41127
41127
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
41128
41128
  }
41129
41129
  }
41130
- class A2 extends l3 {
41130
+ class A extends l3 {
41131
41131
  constructor(e3, t3) {
41132
41132
  super(n2.NCreateRequest, e3, false), this.setAffectedSopInstanceUid(t3);
41133
41133
  }
@@ -41137,12 +41137,12 @@ var require_dcmjs_dimse_min = __commonJS({
41137
41137
  super(n2.NCreateResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
41138
41138
  }
41139
41139
  static fromRequest(e3) {
41140
- if (!(e3 instanceof A2)) throw new Error("Request should be an instance of NCreateRequest");
41140
+ if (!(e3 instanceof A)) throw new Error("Request should be an instance of NCreateRequest");
41141
41141
  const t3 = new U2(e3.getAffectedSopClassUid(), e3.getAffectedSopInstanceUid(), o2.ProcessingFailure);
41142
41142
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
41143
41143
  }
41144
41144
  }
41145
- class q2 extends l3 {
41145
+ class q extends l3 {
41146
41146
  constructor(e3, t3, s3) {
41147
41147
  super(n2.NActionRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setActionTypeId(s3);
41148
41148
  }
@@ -41164,7 +41164,7 @@ var require_dcmjs_dimse_min = __commonJS({
41164
41164
  this.getCommandDataset().setElement("ActionTypeID", e3);
41165
41165
  }
41166
41166
  static fromRequest(e3) {
41167
- if (!(e3 instanceof q2)) throw new Error("Request should be an instance of NActionRequest");
41167
+ if (!(e3 instanceof q)) throw new Error("Request should be an instance of NActionRequest");
41168
41168
  const t3 = new D2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), e3.getActionTypeId(), o2.ProcessingFailure);
41169
41169
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
41170
41170
  }
@@ -41237,13 +41237,13 @@ var require_dcmjs_dimse_min = __commonJS({
41237
41237
  return "0".repeat(t3 - s3.length) + s3;
41238
41238
  }
41239
41239
  }
41240
- class B extends p2 {
41240
+ class B2 extends p2 {
41241
41241
  constructor(e3, t3, s3, i3) {
41242
41242
  super(n2.NGetResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
41243
41243
  }
41244
41244
  static fromRequest(e3) {
41245
41245
  if (!(e3 instanceof N2)) throw new Error("Request should be an instance of NGetRequest");
41246
- const t3 = new B(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
41246
+ const t3 = new B2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
41247
41247
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
41248
41248
  }
41249
41249
  }
@@ -41252,13 +41252,13 @@ var require_dcmjs_dimse_min = __commonJS({
41252
41252
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3);
41253
41253
  }
41254
41254
  }
41255
- class L extends p2 {
41255
+ class L2 extends p2 {
41256
41256
  constructor(e3, t3, s3, i3) {
41257
41257
  super(n2.NSetResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
41258
41258
  }
41259
41259
  static fromRequest(e3) {
41260
41260
  if (!(e3 instanceof M3)) throw new Error("Request should be an instance of NSetRequest");
41261
- const t3 = new L(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
41261
+ const t3 = new L2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
41262
41262
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
41263
41263
  }
41264
41264
  }
@@ -41277,7 +41277,7 @@ var require_dcmjs_dimse_min = __commonJS({
41277
41277
  return new F2(e3.getAffectedSopClassUid(), e3.getMessageId());
41278
41278
  }
41279
41279
  }
41280
- e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: f2, CFindRequest: y2, CFindResponse: S2, CGetRequest: x3, CGetResponse: w3, CMoveRequest: P2, CMoveResponse: v, Command: g, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: A2, NCreateResponse: U2, NDeleteRequest: E, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b3, NGetRequest: N2, NGetResponse: B, NSetRequest: M3, NSetResponse: L, Request: l3, Response: p2 };
41280
+ e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: f2, CFindRequest: y2, CFindResponse: S2, CGetRequest: x3, CGetResponse: w3, CMoveRequest: P2, CMoveResponse: v, Command: g, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q, NActionResponse: D2, NCreateRequest: A, NCreateResponse: U2, NDeleteRequest: E, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b3, NGetRequest: N2, NGetResponse: B2, NSetRequest: M3, NSetResponse: L2, Request: l3, Response: p2 };
41281
41281
  }, 492: (e2) => {
41282
41282
  const t2 = { CStoreRequest: 1, CStoreResponse: 32769, CGetRequest: 16, CGetResponse: 32784, CFindRequest: 32, CFindResponse: 32800, CMoveRequest: 33, CMoveResponse: 32801, CEchoRequest: 48, CEchoResponse: 32816, NEventReportRequest: 256, NEventReportResponse: 33024, NGetRequest: 272, NGetResponse: 33040, NSetRequest: 288, NSetResponse: 33056, NActionRequest: 304, NActionResponse: 33072, NCreateRequest: 320, NCreateResponse: 33088, NDeleteRequest: 336, NDeleteResponse: 33104, CCancelRequest: 4095 };
41283
41283
  Object.freeze(t2);
@@ -41398,8 +41398,8 @@ var require_dcmjs_dimse_min = __commonJS({
41398
41398
  }
41399
41399
  };
41400
41400
  }, 371: (e2, t2, s2) => {
41401
- const { Association: n2 } = s2(570), { AAbort: i2, AAssociateAC: r7, AAssociateRJ: o2, AAssociateRQ: a2, AReleaseRP: c, AReleaseRQ: d3, PDataTF: u2, Pdv: h2, RawPdu: m2 } = s2(942), { CommandFieldType: g, Status: l3, TranscodableTransferSyntaxes: p2 } = s2(492), { CCancelRequest: R2, CEchoRequest: f2, CEchoResponse: y2, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v, CMoveResponse: x3, Command: w3, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b3, NEventReportRequest: N2, NEventReportResponse: B, NGetRequest: M3, NGetResponse: L, NSetRequest: F2, NSetResponse: k2, Response: $2 } = s2(940), j2 = s2(825), V2 = s2(139), G = s2(906), _2 = s2(547), { SmartBuffer: z2 } = s2(766), { EOL: Q2 } = s2(857), W2 = s2(733);
41402
- class J extends W2 {
41401
+ const { Association: n2 } = s2(570), { AAbort: i2, AAssociateAC: r7, AAssociateRJ: o2, AAssociateRQ: a2, AReleaseRP: c, AReleaseRQ: d3, PDataTF: u2, Pdv: h2, RawPdu: m2 } = s2(942), { CommandFieldType: g, Status: l3, TranscodableTransferSyntaxes: p2 } = s2(492), { CCancelRequest: R2, CEchoRequest: f2, CEchoResponse: y2, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v, CMoveResponse: x3, Command: w3, CStoreRequest: A, CStoreResponse: U2, NActionRequest: q, NActionResponse: D2, NCreateRequest: E, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b3, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M3, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $2 } = s2(940), j2 = s2(825), V2 = s2(139), G = s2(906), _2 = s2(547), { SmartBuffer: z2 } = s2(766), { EOL: Q2 } = s2(857), W2 = s2(733);
41402
+ class J2 extends W2 {
41403
41403
  constructor() {
41404
41404
  super();
41405
41405
  }
@@ -41493,7 +41493,7 @@ var require_dcmjs_dimse_min = __commonJS({
41493
41493
  if (!t3) return void this.emit("done");
41494
41494
  const s3 = this.association.getAcceptedPresentationContextFromRequest(t3);
41495
41495
  if (s3) {
41496
- t3 instanceof A2 && t3.loadFullDatasetIfNeeded(), t3.setMessageId(this._getNextMessageId()), this.pending.push(t3);
41496
+ t3 instanceof A && t3.loadFullDatasetIfNeeded(), t3.setMessageId(this._getNextMessageId()), this.pending.push(t3);
41497
41497
  const n3 = { context: s3, command: t3 };
41498
41498
  n3.command.on("done", () => {
41499
41499
  e3();
@@ -41597,7 +41597,7 @@ var require_dcmjs_dimse_min = __commonJS({
41597
41597
  this.dimse = Object.assign(new I2(), s3);
41598
41598
  break;
41599
41599
  case g.CStoreRequest:
41600
- this.dimse = Object.assign(new A2(), s3);
41600
+ this.dimse = Object.assign(new A(), s3);
41601
41601
  break;
41602
41602
  case g.CStoreResponse:
41603
41603
  this.dimse = Object.assign(new U2(), s3);
@@ -41621,7 +41621,7 @@ var require_dcmjs_dimse_min = __commonJS({
41621
41621
  this.dimse = Object.assign(new T(), s3);
41622
41622
  break;
41623
41623
  case g.NActionRequest:
41624
- this.dimse = Object.assign(new q2(), s3);
41624
+ this.dimse = Object.assign(new q(), s3);
41625
41625
  break;
41626
41626
  case g.NActionResponse:
41627
41627
  this.dimse = Object.assign(new D2(), s3);
@@ -41636,13 +41636,13 @@ var require_dcmjs_dimse_min = __commonJS({
41636
41636
  this.dimse = Object.assign(new N2(), s3);
41637
41637
  break;
41638
41638
  case g.NEventReportResponse:
41639
- this.dimse = Object.assign(new B(), s3);
41639
+ this.dimse = Object.assign(new B2(), s3);
41640
41640
  break;
41641
41641
  case g.NGetRequest:
41642
41642
  this.dimse = Object.assign(new M3(), s3);
41643
41643
  break;
41644
41644
  case g.NGetResponse:
41645
- this.dimse = Object.assign(new L(), s3);
41645
+ this.dimse = Object.assign(new L2(), s3);
41646
41646
  break;
41647
41647
  case g.NSetRequest:
41648
41648
  this.dimse = Object.assign(new F2(), s3);
@@ -41705,7 +41705,7 @@ var require_dcmjs_dimse_min = __commonJS({
41705
41705
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
41706
41706
  this.connected = true, this.connectedTime = Date.now(), this.emit("connect");
41707
41707
  });
41708
- const e3 = new J();
41708
+ const e3 = new J2();
41709
41709
  e3.on("pdu", (e4) => {
41710
41710
  this.lastPduTime = Date.now(), this._processPdu(e4);
41711
41711
  }), this.socket.on("data", (t3) => {
@@ -42301,8 +42301,8 @@ var require_dcmjs_dimse_min = __commonJS({
42301
42301
  }
42302
42302
  };
42303
42303
  }, 237: (e2, t2, s2) => {
42304
- const { Association: n2, PresentationContext: i2 } = s2(570), { Scp: r7, Server: o2 } = s2(538), { CCancelRequest: a2, CEchoRequest: c, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h2, CGetRequest: m2, CGetResponse: g, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: f2, NActionRequest: y2, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v, NEventReportRequest: x3, NEventReportResponse: w3, NGetRequest: A2, NGetResponse: U2, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b3, Priority: N2, RejectReason: B, RejectResult: M3, RejectSource: L, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G } = s2(492), _2 = s2(422), z2 = s2(825), Q2 = s2(139), W2 = s2(906), J = { association: { Association: n2, PresentationContext: i2 }, Client: _2, constants: { AbortReason: E, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b3, Priority: N2, RejectReason: B, RejectResult: M3, RejectSource: L, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G }, Dataset: z2, Implementation: Q2, log: s2(547), requests: { CCancelRequest: a2, CEchoRequest: c, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y2, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x3, NGetRequest: A2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h2, CGetResponse: g, CMoveResponse: p2, CStoreResponse: f2, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v, NEventReportResponse: w3, NGetResponse: U2, NSetResponse: D2 }, Scp: r7, Server: o2, Statistics: W2, version: s2(837) };
42305
- e2.exports = J;
42304
+ const { Association: n2, PresentationContext: i2 } = s2(570), { Scp: r7, Server: o2 } = s2(538), { CCancelRequest: a2, CEchoRequest: c, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h2, CGetRequest: m2, CGetResponse: g, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: f2, NActionRequest: y2, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v, NEventReportRequest: x3, NEventReportResponse: w3, NGetRequest: A, NGetResponse: U2, NSetRequest: q, NSetResponse: D2 } = s2(940), { AbortReason: E, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b3, Priority: N2, RejectReason: B2, RejectResult: M3, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G } = s2(492), _2 = s2(422), z2 = s2(825), Q2 = s2(139), W2 = s2(906), J2 = { association: { Association: n2, PresentationContext: i2 }, Client: _2, constants: { AbortReason: E, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b3, Priority: N2, RejectReason: B2, RejectResult: M3, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G }, Dataset: z2, Implementation: Q2, log: s2(547), requests: { CCancelRequest: a2, CEchoRequest: c, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y2, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x3, NGetRequest: A, NSetRequest: q }, responses: { CEchoResponse: d3, CFindResponse: h2, CGetResponse: g, CMoveResponse: p2, CStoreResponse: f2, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v, NEventReportResponse: w3, NGetResponse: U2, NSetResponse: D2 }, Scp: r7, Server: o2, Statistics: W2, version: s2(837) };
42305
+ e2.exports = J2;
42306
42306
  }, 547: (e2, t2, s2) => {
42307
42307
  const { createLogger: n2, format: i2, transports: r7 } = s2(688), { combine: o2, printf: a2, timestamp: c } = i2, d3 = n2({ format: o2(c(), a2(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r7.Console()] });
42308
42308
  e2.exports = d3;
@@ -42363,7 +42363,7 @@ var Ge = class {
42363
42363
  return `${this.operator}(${this.child.toString()})`;
42364
42364
  }
42365
42365
  };
42366
- var z = class {
42366
+ var J = class {
42367
42367
  constructor(e, t, n) {
42368
42368
  this.operator = e;
42369
42369
  this.left = t;
@@ -42397,10 +42397,10 @@ var He = class {
42397
42397
  }, precedence: t });
42398
42398
  }
42399
42399
  construct(e) {
42400
- return new _t(e, this.prefixParselets, this.infixParselets);
42400
+ return new Lt(e, this.prefixParselets, this.infixParselets);
42401
42401
  }
42402
42402
  };
42403
- var _t = class {
42403
+ var Lt = class {
42404
42404
  constructor(e, t, n) {
42405
42405
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
42406
42406
  }
@@ -42448,91 +42448,91 @@ var _t = class {
42448
42448
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
42449
42449
  }
42450
42450
  };
42451
- var Ut = "ok";
42451
+ var _t = "ok";
42452
42452
  var Qe = "created";
42453
- var qt = "not-modified";
42454
- var jt = "not-found";
42453
+ var Bt = "not-modified";
42454
+ var qt = "not-found";
42455
42455
  var Ke = "accepted";
42456
- var Gr = { resourceType: "OperationOutcome", id: jt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
42456
+ var Hr = { resourceType: "OperationOutcome", id: qt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
42457
42457
  function R(r6, e) {
42458
42458
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
42459
42459
  }
42460
42460
  function h(r6) {
42461
42461
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
42462
42462
  }
42463
- function Hr(r6) {
42463
+ function Qr(r6) {
42464
42464
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
42465
42465
  }
42466
- function ye(r6) {
42466
+ function ge(r6) {
42467
42467
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
42468
42468
  }
42469
- function $t(r6) {
42470
- return r6.id === Ut || r6.id === Qe || r6.id === qt || r6.id === Ke;
42469
+ function jt(r6) {
42470
+ return r6.id === _t || r6.id === Qe || r6.id === Bt || r6.id === Ke;
42471
42471
  }
42472
42472
  var f = class extends Error {
42473
42473
  constructor(e, t) {
42474
- super(Qr(e)), this.outcome = e, this.cause = t;
42474
+ super(Kr(e)), this.outcome = e, this.cause = t;
42475
42475
  }
42476
42476
  };
42477
42477
  function ze(r6) {
42478
- return r6 instanceof f ? r6.outcome : ye(r6) ? r6 : R(Pi(r6));
42478
+ return r6 instanceof f ? r6.outcome : ge(r6) ? r6 : R(Ci(r6));
42479
42479
  }
42480
- function Pi(r6) {
42481
- return r6 ? typeof r6 == "string" ? r6 : r6 instanceof Error ? r6.message : ye(r6) ? Qr(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
42480
+ function Ci(r6) {
42481
+ return r6 ? typeof r6 == "string" ? r6 : r6 instanceof Error ? r6.message : ge(r6) ? Kr(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
42482
42482
  }
42483
- function Qr(r6) {
42484
- let e = r6.issue?.map(Ci) ?? [];
42483
+ function Kr(r6) {
42484
+ let e = r6.issue?.map(wi) ?? [];
42485
42485
  return e.length > 0 ? e.join("; ") : "Unknown error";
42486
42486
  }
42487
- function Ci(r6) {
42487
+ function wi(r6) {
42488
42488
  let e;
42489
42489
  return r6.details?.text ? r6.diagnostics ? e = `${r6.details.text} (${r6.diagnostics})` : e = r6.details.text : r6.diagnostics ? e = r6.diagnostics : e = "Unknown error", r6.expression?.length && (e += ` (${r6.expression.join(", ")})`), e;
42490
42490
  }
42491
- function Ai(r6, e) {
42491
+ function Oi(r6, e) {
42492
42492
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
42493
42493
  return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
42494
42494
  }
42495
- function Jr(r6) {
42495
+ function Yr(r6) {
42496
42496
  let e = /* @__PURE__ */ Object.create(null);
42497
- for (let [t, n] of Object.entries(r6)) e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, Ai(i, o)])), constraints: [], innerTypes: [] };
42497
+ for (let [t, n] of Object.entries(r6)) e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, Oi(i, o)])), constraints: [], innerTypes: [] };
42498
42498
  return e;
42499
42499
  }
42500
- var Yr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
42501
- function Kt(r6) {
42502
- return new Ht(r6).parse();
42500
+ var Zr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
42501
+ function Qt(r6) {
42502
+ return new Gt(r6).parse();
42503
42503
  }
42504
- var Ie = Jr(Yr);
42505
- var zt = /* @__PURE__ */ Object.create(null);
42506
- var Zr = /* @__PURE__ */ Object.create(null);
42507
- function Gt(r6) {
42504
+ var ke = Yr(Zr);
42505
+ var Kt = /* @__PURE__ */ Object.create(null);
42506
+ var Xr = /* @__PURE__ */ Object.create(null);
42507
+ function Wt(r6) {
42508
42508
  let e;
42509
- return r6 ? (e = Zr[r6], e || (e = Zr[r6] = /* @__PURE__ */ Object.create(null))) : e = Ie, e;
42509
+ return r6 ? (e = Xr[r6], e || (e = Xr[r6] = /* @__PURE__ */ Object.create(null))) : e = ke, e;
42510
42510
  }
42511
- function Jt(r6, e) {
42511
+ function zt(r6, e) {
42512
42512
  let t = Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? [];
42513
- for (let n of t) Yt(n, e);
42513
+ for (let n of t) Jt(n, e);
42514
42514
  }
42515
- function Yt(r6, e) {
42515
+ function Jt(r6, e) {
42516
42516
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
42517
42517
  if (r6.resourceType !== "StructureDefinition") return;
42518
- let t = Kt(r6), n = Gt(e);
42519
- n[r6.name] = t, e && r6.url === e && (zt[e] = t);
42518
+ let t = Qt(r6), n = Wt(e);
42519
+ n[r6.name] = t, e && r6.url === e && (Kt[e] = t);
42520
42520
  for (let i of t.innerTypes) i.parentType = t, n[i.name] = i;
42521
42521
  }
42522
- function nn(r6) {
42523
- return !!Ie[r6];
42522
+ function on(r6) {
42523
+ return !!ke[r6];
42524
42524
  }
42525
- function ke(r6, e) {
42526
- let t = Gt(e)[r6];
42527
- return !t && e && (t = Gt()[r6]), t;
42525
+ function Ve(r6, e) {
42526
+ let t = Wt(e)[r6];
42527
+ return !t && e && (t = Wt()[r6]), t;
42528
42528
  }
42529
- function sn(r6) {
42530
- return !!zt[r6];
42529
+ function an(r6) {
42530
+ return !!Kt[r6];
42531
42531
  }
42532
- var Ht = class {
42532
+ var Gt = class {
42533
42533
  constructor(e) {
42534
42534
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
42535
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, title: e.title, type: e.type, url: e.url, kind: e.kind, description: Di(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
42535
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, title: e.title, type: e.type, url: e.url, kind: e.kind, description: Mi(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
42536
42536
  }
42537
42537
  parse() {
42538
42538
  let e = this.next();
@@ -42540,7 +42540,7 @@ var Ht = class {
42540
42540
  if (e.sliceName) this.parseSliceStart(e);
42541
42541
  else if (e.id?.includes(":")) {
42542
42542
  if (this.slicingContext?.current) {
42543
- let t = Wt(e, this.slicingContext.path);
42543
+ let t = $t(e, this.slicingContext.path);
42544
42544
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
42545
42545
  }
42546
42546
  } else {
@@ -42549,13 +42549,13 @@ var Ht = class {
42549
42549
  let n = this.backboneContext;
42550
42550
  for (; n; ) {
42551
42551
  if (e.path?.startsWith(n.path + ".")) {
42552
- n.type.elements[Wt(e, n.path)] = t;
42552
+ n.type.elements[$t(e, n.path)] = t;
42553
42553
  break;
42554
42554
  }
42555
42555
  n = n.parent;
42556
42556
  }
42557
42557
  if (!n) {
42558
- let i = Wt(e, this.root.path);
42558
+ let i = $t(e, this.root.path);
42559
42559
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
42560
42560
  }
42561
42561
  this.checkFieldExit(e);
@@ -42568,21 +42568,21 @@ var Ht = class {
42568
42568
  this.isInnerType(e) && this.enterInnerType(e), e.slicing && !this.slicingContext && this.enterSlice(e, t);
42569
42569
  }
42570
42570
  enterInnerType(e) {
42571
- for (; this.backboneContext && !ge(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
42572
- this.backboneContext = { type: { name: Qt(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ge(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
42571
+ for (; this.backboneContext && !xe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
42572
+ this.backboneContext = { type: { name: Ht(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: xe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
42573
42573
  }
42574
42574
  enterSlice(e, t) {
42575
- Vi(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
42575
+ Di(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
42576
42576
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
42577
42577
  return { path: n.path, type: n.type };
42578
42578
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
42579
42579
  }
42580
42580
  checkFieldExit(e = void 0) {
42581
- if (this.backboneContext && !ge(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
42581
+ if (this.backboneContext && !xe(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
42582
42582
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
42583
- while (this.backboneContext && !ge(this.backboneContext.path, e?.path));
42583
+ while (this.backboneContext && !xe(this.backboneContext.path, e?.path));
42584
42584
  else this.innerTypes.push(this.backboneContext.type), this.backboneContext = void 0;
42585
- this.slicingContext && !ge(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext = void 0);
42585
+ this.slicingContext && !xe(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext = void 0);
42586
42586
  }
42587
42587
  next() {
42588
42588
  let e = this.peek();
@@ -42600,7 +42600,7 @@ var Ht = class {
42600
42600
  }
42601
42601
  isInnerType(e) {
42602
42602
  let t = this.peek();
42603
- return !!(ge(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
42603
+ return !!(xe(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
42604
42604
  }
42605
42605
  parseSliceStart(e) {
42606
42606
  if (!this.slicingContext) throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
@@ -42609,34 +42609,34 @@ var Ht = class {
42609
42609
  parseElementDefinitionType(e) {
42610
42610
  return (e.type ?? []).map((t) => {
42611
42611
  let n;
42612
- return (t.code === "BackboneElement" || t.code === "Element") && (n = Qt(e)), n || (n = xe(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
42612
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = Ht(e)), n || (n = Z(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
42613
42613
  });
42614
42614
  }
42615
42615
  parseElementDefinition(e) {
42616
- let t = en(e.max), n = e.base?.max ? en(e.base.max) : t, i = { type: "ElementDefinition", value: e };
42617
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: tn(A(i, "fixed[x]")), pattern: tn(A(i, "pattern[x]")), binding: e.binding };
42616
+ let t = tn(e.max), n = e.base?.max ? tn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
42617
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: rn(C(i, "fixed[x]")), pattern: rn(C(i, "pattern[x]")), binding: e.binding };
42618
42618
  }
42619
42619
  };
42620
- function en(r6) {
42620
+ function tn(r6) {
42621
42621
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
42622
42622
  }
42623
- function Wt(r6, e = "") {
42624
- return ki(r6.path, e);
42623
+ function $t(r6, e = "") {
42624
+ return Vi(r6.path, e);
42625
42625
  }
42626
- function ki(r6, e) {
42626
+ function Vi(r6, e) {
42627
42627
  return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
42628
42628
  }
42629
- function ge(r6, e) {
42629
+ function xe(r6, e) {
42630
42630
  return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
42631
42631
  }
42632
- function tn(r6) {
42632
+ function rn(r6) {
42633
42633
  return Array.isArray(r6) && r6.length > 0 ? r6[0] : S(r6) ? void 0 : r6;
42634
42634
  }
42635
- function Vi(r6) {
42635
+ function Di(r6) {
42636
42636
  let e = r6.slicing?.discriminator;
42637
42637
  return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
42638
42638
  }
42639
- function Di(r6) {
42639
+ function Mi(r6) {
42640
42640
  let e = r6.description;
42641
42641
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
42642
42642
  }
@@ -42645,30 +42645,30 @@ function d(r6) {
42645
42645
  return [{ type: l.boolean, value: r6 }];
42646
42646
  }
42647
42647
  function x(r6) {
42648
- return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : O(r6) ? { type: l.Quantity, value: r6 } : F(r6) ? { type: r6.resourceType, value: r6 } : { type: l.BackboneElement, value: r6 };
42648
+ return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : I(r6) ? { type: l.Quantity, value: r6 } : L(r6) ? { type: r6.resourceType, value: r6 } : { type: l.BackboneElement, value: r6 };
42649
42649
  }
42650
42650
  function _(r6) {
42651
42651
  return r6.length === 0 ? false : !!r6[0].value;
42652
42652
  }
42653
- function U(r6, e) {
42653
+ function B(r6, e) {
42654
42654
  if (r6.length !== 0) {
42655
42655
  if (r6.length === 1 && (!e || r6[0].type === e)) return r6[0];
42656
42656
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r6)}`);
42657
42657
  }
42658
42658
  }
42659
- function A(r6, e, t) {
42659
+ function C(r6, e, t) {
42660
42660
  if (!r6.value) return;
42661
42661
  let n = et(r6.type, e, t?.profileUrl);
42662
- return n ? Wi(r6, e, n) : Gi(r6, e);
42662
+ return n ? Gi(r6, e, n) : Hi(r6, e);
42663
42663
  }
42664
- function Wi(r6, e, t) {
42664
+ function Gi(r6, e, t) {
42665
42665
  let n = r6.value, i = t.type;
42666
42666
  if (!i || i.length === 0) return;
42667
42667
  let o, s = "undefined", a2;
42668
42668
  if (t.path.endsWith("[x]")) {
42669
42669
  let c = t.path.split(".").pop().replace("[x]", "");
42670
42670
  for (let u2 of i) {
42671
- let p2 = c + C(u2.code);
42671
+ let p2 = c + w(u2.code);
42672
42672
  if (o = n[p2], a2 = n["_" + p2], o !== void 0 || a2 !== void 0) {
42673
42673
  s = u2.code;
42674
42674
  break;
@@ -42677,20 +42677,20 @@ function Wi(r6, e, t) {
42677
42677
  } else console.assert(i.length === 1, "Expected single type", t.path), o = n[e], s = i[0].code, a2 = n["_" + e];
42678
42678
  if (a2) if (Array.isArray(o)) {
42679
42679
  o = o.slice();
42680
- for (let c = 0; c < Math.max(o.length, a2.length); c++) o[c] = fn(o[c], a2[c]);
42681
- } else o = fn(o, a2);
42682
- if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((c) => un(c, s)) : un(o, s);
42680
+ for (let c = 0; c < Math.max(o.length, a2.length); c++) o[c] = mn(o[c], a2[c]);
42681
+ } else o = mn(o, a2);
42682
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((c) => ln(c, s)) : ln(o, s);
42683
42683
  }
42684
- function un(r6, e) {
42685
- return e === "Resource" && F(r6) && (e = r6.resourceType), { type: e, value: r6 };
42684
+ function ln(r6, e) {
42685
+ return e === "Resource" && L(r6) && (e = r6.resourceType), { type: e, value: r6 };
42686
42686
  }
42687
- function Gi(r6, e) {
42687
+ function Hi(r6, e) {
42688
42688
  let t = r6.value;
42689
42689
  if (!t || typeof t != "object") return;
42690
42690
  let n;
42691
42691
  if (e in t) n = t[e];
42692
42692
  else for (let i in l) {
42693
- let o = e + C(i);
42693
+ let o = e + w(i);
42694
42694
  if (o in t) {
42695
42695
  n = t[o];
42696
42696
  break;
@@ -42702,7 +42702,7 @@ function Ze(r6) {
42702
42702
  let e = [];
42703
42703
  for (let t of r6) {
42704
42704
  let n = false;
42705
- for (let i of e) if (_(mn(t, i))) {
42705
+ for (let i of e) if (_(hn(t, i))) {
42706
42706
  n = true;
42707
42707
  break;
42708
42708
  }
@@ -42710,24 +42710,24 @@ function Ze(r6) {
42710
42710
  }
42711
42711
  return e;
42712
42712
  }
42713
- function or(r6) {
42713
+ function ir(r6) {
42714
42714
  return d(!_(r6));
42715
42715
  }
42716
- function sr(r6, e) {
42717
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? d(false) : d(r6.every((t, n) => _(mn(t, e[n]))));
42716
+ function or(r6, e) {
42717
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? d(false) : d(r6.every((t, n) => _(hn(t, e[n]))));
42718
42718
  }
42719
- function mn(r6, e) {
42719
+ function hn(r6, e) {
42720
42720
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
42721
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : O(t) && O(n) ? d(gn(t, n)) : d(typeof t == "object" && typeof n == "object" ? cr(r6, e) : t === n);
42721
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : I(t) && I(n) ? d(xn(t, n)) : d(typeof t == "object" && typeof n == "object" ? ar(r6, e) : t === n);
42722
42722
  }
42723
- function ar(r6, e) {
42724
- return r6.length === 0 && e.length === 0 ? d(true) : r6.length !== e.length ? d(false) : (r6.sort(ln), e.sort(ln), d(r6.every((t, n) => _(Hi(t, e[n])))));
42723
+ function sr(r6, e) {
42724
+ return r6.length === 0 && e.length === 0 ? d(true) : r6.length !== e.length ? d(false) : (r6.sort(pn), e.sort(pn), d(r6.every((t, n) => _(Qi(t, e[n])))));
42725
42725
  }
42726
- function Hi(r6, e) {
42726
+ function Qi(r6, e) {
42727
42727
  let { type: t, value: n } = r6, { type: i, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
42728
- return typeof s == "number" && typeof a2 == "number" ? d(Math.abs(s - a2) < 0.01) : O(s) && O(a2) ? d(gn(s, a2)) : d(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? cr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
42728
+ return typeof s == "number" && typeof a2 == "number" ? d(Math.abs(s - a2) < 0.01) : I(s) && I(a2) ? d(xn(s, a2)) : d(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? ar({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
42729
42729
  }
42730
- function ln(r6, e) {
42730
+ function pn(r6, e) {
42731
42731
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
42732
42732
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
42733
42733
  }
@@ -42741,78 +42741,78 @@ function Xe(r6, e) {
42741
42741
  case "Integer":
42742
42742
  return typeof t == "number";
42743
42743
  case "Date":
42744
- return hn(t);
42744
+ return yn(t);
42745
42745
  case "DateTime":
42746
42746
  return Ye(t);
42747
42747
  case "Time":
42748
42748
  return typeof t == "string" && !!/^T\d/.exec(t);
42749
42749
  case "Period":
42750
- return yn(t);
42750
+ return gn(t);
42751
42751
  case "Quantity":
42752
- return O(t);
42752
+ return I(t);
42753
42753
  default:
42754
42754
  return typeof t == "object" && t?.resourceType === e;
42755
42755
  }
42756
42756
  }
42757
- function hn(r6) {
42757
+ function yn(r6) {
42758
42758
  return typeof r6 == "string" && !!Je.date.exec(r6);
42759
42759
  }
42760
42760
  function Ye(r6) {
42761
42761
  return typeof r6 == "string" && !!Je.dateTime.exec(r6);
42762
42762
  }
42763
- function yn(r6) {
42763
+ function gn(r6) {
42764
42764
  return !!(r6 && typeof r6 == "object" && ("start" in r6 && Ye(r6.start) || "end" in r6 && Ye(r6.end)));
42765
42765
  }
42766
- function O(r6) {
42766
+ function I(r6) {
42767
42767
  return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
42768
42768
  }
42769
- function gn(r6, e) {
42769
+ function xn(r6, e) {
42770
42770
  return Math.abs(r6.value - e.value) < 0.01 && (r6.unit === e.unit || r6.code === e.code || r6.unit === e.code || r6.code === e.unit);
42771
42771
  }
42772
- function cr(r6, e) {
42772
+ function ar(r6, e) {
42773
42773
  let t = Object.keys(r6), n = Object.keys(e);
42774
42774
  if (t.length !== n.length) return false;
42775
42775
  for (let i of t) {
42776
42776
  let o = r6[i], s = e[i];
42777
- if (dn(o) && dn(s)) {
42778
- if (!cr(o, s)) return false;
42777
+ if (fn(o) && fn(s)) {
42778
+ if (!ar(o, s)) return false;
42779
42779
  } else if (o !== s) return false;
42780
42780
  }
42781
42781
  return true;
42782
42782
  }
42783
- function dn(r6) {
42783
+ function fn(r6) {
42784
42784
  return r6 !== null && typeof r6 == "object";
42785
42785
  }
42786
- function fn(r6, e) {
42786
+ function mn(r6, e) {
42787
42787
  if (e) {
42788
42788
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
42789
- return Qi(r6 ?? {}, e);
42789
+ return Ki(r6 ?? {}, e);
42790
42790
  }
42791
42791
  return r6;
42792
42792
  }
42793
- function Qi(r6, e) {
42793
+ function Ki(r6, e) {
42794
42794
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
42795
42795
  }
42796
- function Z(r6) {
42797
- let e = se(r6), t = zi(r6);
42796
+ function ee(r6) {
42797
+ let e = ce(r6), t = Ji(r6);
42798
42798
  return t === e ? { reference: e } : { reference: e, display: t };
42799
42799
  }
42800
- function se(r6) {
42801
- return oe(r6) ? r6.reference : `${r6.resourceType}/${r6.id}`;
42800
+ function ce(r6) {
42801
+ return ae(r6) ? r6.reference : `${r6.resourceType}/${r6.id}`;
42802
42802
  }
42803
- function rt(r6) {
42804
- if (r6) return oe(r6) ? r6.reference.split("/")[1] : r6.id;
42803
+ function Te(r6) {
42804
+ if (r6) return ae(r6) ? r6.reference.split("/")[1] : r6.id;
42805
42805
  }
42806
- function Ki(r6) {
42806
+ function zi(r6) {
42807
42807
  return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
42808
42808
  }
42809
- function zi(r6) {
42810
- if (Ki(r6)) {
42811
- let e = Ji(r6);
42809
+ function Ji(r6) {
42810
+ if (zi(r6)) {
42811
+ let e = Yi(r6);
42812
42812
  if (e) return e;
42813
42813
  }
42814
42814
  if (r6.resourceType === "Device") {
42815
- let e = Yi(r6);
42815
+ let e = Zi(r6);
42816
42816
  if (e) return e;
42817
42817
  }
42818
42818
  if (r6.resourceType === "MedicationRequest") {
@@ -42823,20 +42823,20 @@ function zi(r6) {
42823
42823
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
42824
42824
  if ("code" in r6 && r6.code) {
42825
42825
  let e = r6.code;
42826
- if (Array.isArray(e) && (e = e[0]), ao(e)) return tt(e);
42827
- if (co(e)) return e.text;
42826
+ if (Array.isArray(e) && (e = e[0]), co(e)) return tt(e);
42827
+ if (uo(e)) return e.text;
42828
42828
  }
42829
- return se(r6);
42829
+ return ce(r6);
42830
42830
  }
42831
- function Ji(r6) {
42831
+ function Yi(r6) {
42832
42832
  let e = r6.name;
42833
- if (e && e.length > 0) return ot(e[0]);
42833
+ if (e && e.length > 0) return it(e[0]);
42834
42834
  }
42835
- function Yi(r6) {
42835
+ function Zi(r6) {
42836
42836
  let e = r6.deviceName;
42837
42837
  if (e && e.length > 0) return e[0].name;
42838
42838
  }
42839
- function nt(r6, e) {
42839
+ function rt(r6, e) {
42840
42840
  let t = new Date(r6);
42841
42841
  t.setUTCHours(0, 0, 0, 0);
42842
42842
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
@@ -42848,18 +42848,18 @@ function nt(r6, e) {
42848
42848
  let g = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
42849
42849
  return { years: p2, months: m2, days: g };
42850
42850
  }
42851
- function xe(r6, ...e) {
42851
+ function Z(r6, ...e) {
42852
42852
  let t = r6;
42853
42853
  for (let n = 0; n < e.length && t; n++) t = t?.extension?.find((i) => i.url === e[n]);
42854
42854
  return t;
42855
42855
  }
42856
- function Sn(r6, e) {
42857
- return JSON.stringify(r6, Xi, e ? 2 : void 0);
42856
+ function En(r6, e) {
42857
+ return JSON.stringify(r6, eo, e ? 2 : void 0);
42858
42858
  }
42859
- function Xi(r6, e) {
42860
- return !eo(r6) && S(e) ? void 0 : e;
42859
+ function eo(r6, e) {
42860
+ return !to(r6) && S(e) ? void 0 : e;
42861
42861
  }
42862
- function eo(r6) {
42862
+ function to(r6) {
42863
42863
  return !!/\d+$/.exec(r6);
42864
42864
  }
42865
42865
  function S(r6) {
@@ -42872,119 +42872,119 @@ function H(r6) {
42872
42872
  let e = typeof r6;
42873
42873
  return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
42874
42874
  }
42875
- function Y(r6, e, t) {
42876
- return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? to(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : b(r6) && b(e) ? ro(r6, e, t) : (b(r6) || b(e), false);
42875
+ function X(r6, e, t) {
42876
+ return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? ro(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : b(r6) && b(e) ? no(r6, e, t) : (b(r6) || b(e), false);
42877
42877
  }
42878
- function to(r6, e) {
42878
+ function ro(r6, e) {
42879
42879
  if (r6.length !== e.length) return false;
42880
- for (let t = 0; t < r6.length; t++) if (!Y(r6[t], e[t])) return false;
42880
+ for (let t = 0; t < r6.length; t++) if (!X(r6[t], e[t])) return false;
42881
42881
  return true;
42882
42882
  }
42883
- function ro(r6, e, t) {
42883
+ function no(r6, e, t) {
42884
42884
  let n = /* @__PURE__ */ new Set();
42885
42885
  Object.keys(r6).forEach((i) => n.add(i)), Object.keys(e).forEach((i) => n.add(i)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
42886
42886
  for (let i of n) {
42887
42887
  let o = r6[i], s = e[i];
42888
- if (!Y(o, s, i)) return false;
42888
+ if (!X(o, s, i)) return false;
42889
42889
  }
42890
42890
  return true;
42891
42891
  }
42892
42892
  function b(r6) {
42893
42893
  return r6 !== null && typeof r6 == "object";
42894
42894
  }
42895
- function En(r6) {
42896
- return r6.every(oo);
42897
- }
42898
- function oo(r6) {
42899
- return typeof r6 == "string";
42895
+ function bn(r6) {
42896
+ return r6.every(so);
42900
42897
  }
42901
42898
  function so(r6) {
42902
- return b(r6) && "code" in r6 && typeof r6.code == "string";
42899
+ return typeof r6 == "string";
42903
42900
  }
42904
42901
  function ao(r6) {
42905
- return b(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(so);
42902
+ return b(r6) && "code" in r6 && typeof r6.code == "string";
42906
42903
  }
42907
42904
  function co(r6) {
42905
+ return b(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(ao);
42906
+ }
42907
+ function uo(r6) {
42908
42908
  return b(r6) && "text" in r6 && typeof r6.text == "string";
42909
42909
  }
42910
- var bn = [];
42911
- for (let r6 = 0; r6 < 256; r6++) bn.push(r6.toString(16).padStart(2, "0"));
42912
- function Rn(r6) {
42910
+ var Rn = [];
42911
+ for (let r6 = 0; r6 < 256; r6++) Rn.push(r6.toString(16).padStart(2, "0"));
42912
+ function Pn(r6) {
42913
42913
  let e = new Uint8Array(r6), t = new Array(e.length);
42914
- for (let n = 0; n < e.length; n++) t[n] = bn[e[n]];
42914
+ for (let n = 0; n < e.length; n++) t[n] = Rn[e[n]];
42915
42915
  return t.join("");
42916
42916
  }
42917
- function Pn(r6) {
42917
+ function Cn(r6) {
42918
42918
  let e = new Uint8Array(r6), t = [];
42919
42919
  for (let n = 0; n < e.length; n++) t[n] = String.fromCharCode(e[n]);
42920
42920
  return window.btoa(t.join(""));
42921
42921
  }
42922
- function C(r6) {
42922
+ function w(r6) {
42923
42923
  return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
42924
42924
  }
42925
- var pr = (r6) => new Promise((e) => {
42925
+ var lr = (r6) => new Promise((e) => {
42926
42926
  setTimeout(e, r6);
42927
42927
  });
42928
- function it(r6) {
42928
+ function nt(r6) {
42929
42929
  return r6.sort((e, t) => e.localeCompare(t));
42930
42930
  }
42931
- function fr(r6) {
42931
+ function dr(r6) {
42932
42932
  return r6.endsWith("/") ? r6 : r6 + "/";
42933
42933
  }
42934
- function ho(r6) {
42934
+ function yo(r6) {
42935
42935
  return r6.startsWith("/") ? r6.slice(1) : r6;
42936
42936
  }
42937
- function q(r6, e) {
42938
- return new URL(ho(e), fr(r6.toString())).toString();
42937
+ function j(r6, e) {
42938
+ return new URL(yo(e), dr(r6.toString())).toString();
42939
42939
  }
42940
- function On(r6, e) {
42941
- return q(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
42940
+ function In(r6, e) {
42941
+ return j(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
42942
42942
  }
42943
- function In(r6) {
42943
+ function kn(r6) {
42944
42944
  return typeof r6 == "object" && !Array.isArray(r6) && !(r6 instanceof URLSearchParams) && (r6 = Object.fromEntries(Object.entries(r6).filter((e) => e[1] !== void 0))), new URLSearchParams(r6).toString();
42945
42945
  }
42946
- var yo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
42947
- function mu(r6) {
42948
- return yo.test(r6);
42946
+ var go = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
42947
+ function vu(r6) {
42948
+ return go.test(r6);
42949
42949
  }
42950
- function ot(r6, e) {
42950
+ function it(r6, e) {
42951
42951
  let t = [];
42952
42952
  if (r6.prefix && e?.prefix !== false && t.push(...r6.prefix), r6.given && t.push(...r6.given), r6.family && t.push(r6.family), r6.suffix && e?.suffix !== false && t.push(...r6.suffix), r6.use && (e?.all || e?.use) && t.push("[" + r6.use + "]"), t.length === 0) {
42953
- let n = Ee(r6.text);
42953
+ let n = be(r6.text);
42954
42954
  if (n) return n;
42955
42955
  }
42956
42956
  return t.join(" ").trim();
42957
42957
  }
42958
42958
  function tt(r6) {
42959
42959
  if (!r6) return "";
42960
- let e = Ee(r6.text);
42961
- return e || (r6.coding ? r6.coding.map((t) => Eo(t)).join(", ") : "");
42960
+ let e = be(r6.text);
42961
+ return e || (r6.coding ? r6.coding.map((t) => bo(t)).join(", ") : "");
42962
42962
  }
42963
- function Eo(r6) {
42964
- return Ee(r6?.display) ?? Ee(r6?.code) ?? "";
42963
+ function bo(r6) {
42964
+ return be(r6?.display) ?? be(r6?.code) ?? "";
42965
42965
  }
42966
- function Ee(r6) {
42966
+ function be(r6) {
42967
42967
  return typeof r6 == "string" ? r6 : void 0;
42968
42968
  }
42969
42969
  var l = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
42970
- function yr(r6) {
42970
+ function hr(r6) {
42971
42971
  for (let e of r6.base ?? []) {
42972
- let t = D.types[e];
42973
- t || (t = { searchParamsDetails: {} }, D.types[e] = t), t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r6.code] = r6;
42972
+ let t = M.types[e];
42973
+ t || (t = { searchParamsDetails: {} }, M.types[e] = t), t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r6.code] = r6;
42974
42974
  }
42975
42975
  }
42976
- function Qt(r6) {
42976
+ function Ht(r6) {
42977
42977
  let e = r6.type?.[0]?.code;
42978
- return e === "BackboneElement" || e === "Element" ? Co((r6.base?.path ?? r6.path)?.split(".")) : e;
42978
+ return e === "BackboneElement" || e === "Element" ? wo((r6.base?.path ?? r6.path)?.split(".")) : e;
42979
42979
  }
42980
- function Co(r6) {
42981
- return r6.length === 1 ? r6[0] : r6.map(C).join("");
42980
+ function wo(r6) {
42981
+ return r6.length === 1 ? r6[0] : r6.map(w).join("");
42982
42982
  }
42983
42983
  function et(r6, e, t) {
42984
- let n = ke(r6, t);
42985
- if (n) return Io(n.elements, e);
42984
+ let n = Ve(r6, t);
42985
+ if (n) return ko(n.elements, e);
42986
42986
  }
42987
- function Io(r6, e) {
42987
+ function ko(r6, e) {
42988
42988
  let t = r6[e] ?? r6[e + "[x]"];
42989
42989
  if (t) return t;
42990
42990
  for (let n = 0; n < e.length; n++) {
@@ -42995,14 +42995,14 @@ function Io(r6, e) {
42995
42995
  }
42996
42996
  }
42997
42997
  }
42998
- function F(r6) {
42998
+ function L(r6) {
42999
42999
  return !!(r6 && typeof r6 == "object" && "resourceType" in r6);
43000
43000
  }
43001
- function oe(r6) {
43001
+ function ae(r6) {
43002
43002
  return !!(r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string");
43003
43003
  }
43004
- var D = { types: {} };
43005
- function be(r6) {
43004
+ var M = { types: {} };
43005
+ function Re(r6) {
43006
43006
  if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
43007
43007
  if (r6.length <= 10) return r6;
43008
43008
  try {
@@ -43012,7 +43012,7 @@ function be(r6) {
43012
43012
  }
43013
43013
  }
43014
43014
  var Q = () => [];
43015
- var w = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r6, e) => d(e.length !== 0), exists: (r6, e, t) => t ? d(e.filter((n) => _(t.eval(r6, [n]))).length > 0) : d(e.length > 0 && e.every((n) => !S(n.value))), all: (r6, e, t) => d(e.every((n) => _(t.eval(r6, [n])))), allTrue: (r6, e) => {
43015
+ var O = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r6, e) => d(e.length !== 0), exists: (r6, e, t) => t ? d(e.filter((n) => _(t.eval(r6, [n]))).length > 0) : d(e.length > 0 && e.every((n) => !S(n.value))), all: (r6, e, t) => d(e.every((n) => _(t.eval(r6, [n])))), allTrue: (r6, e) => {
43016
43016
  for (let t of e) if (!t.value) return d(false);
43017
43017
  return d(true);
43018
43018
  }, anyTrue: (r6, e) => {
@@ -43026,16 +43026,16 @@ var w = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), has
43026
43026
  return d(false);
43027
43027
  }, subsetOf: (r6, e, t) => {
43028
43028
  if (e.length === 0) return d(true);
43029
- let n = t.eval(r6, ue(r6));
43029
+ let n = t.eval(r6, pe(r6));
43030
43030
  return n.length === 0 ? d(false) : d(e.every((i) => n.some((o) => o.value === i.value)));
43031
43031
  }, supersetOf: (r6, e, t) => {
43032
- let n = t.eval(r6, ue(r6));
43032
+ let n = t.eval(r6, pe(r6));
43033
43033
  return n.length === 0 ? d(true) : e.length === 0 ? d(false) : d(n.every((i) => e.some((o) => o.value === i.value)));
43034
43034
  }, count: (r6, e) => [{ type: l.integer, value: e.length }], distinct: (r6, e) => {
43035
43035
  let t = [];
43036
43036
  for (let n of e) t.some((i) => i.value === n.value) || t.push(n);
43037
43037
  return t;
43038
- }, isDistinct: (r6, e) => d(e.length === w.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => _(t.eval(r6, [n]))), select: (r6, e, t) => e.map((n) => t.eval(r6, [n])).flat(), repeat: Q, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
43038
+ }, isDistinct: (r6, e) => d(e.length === O.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => _(t.eval(r6, [n]))), select: (r6, e, t) => e.map((n) => t.eval(r6, [n])).flat(), repeat: Q, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
43039
43039
  if (e.length > 1) throw new Error("Expected input length one for single()");
43040
43040
  return e.length === 0 ? [] : e.slice(0, 1);
43041
43041
  }, first: (r6, e) => e.length === 0 ? [] : e.slice(0, 1), last: (r6, e) => e.length === 0 ? [] : e.slice(e.length - 1, e.length), tail: (r6, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (r6, e, t) => {
@@ -43048,21 +43048,21 @@ var w = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), has
43048
43048
  return n >= e.length ? e : n <= 0 ? [] : e.slice(0, n);
43049
43049
  }, intersect: (r6, e, t) => {
43050
43050
  if (!t) return e;
43051
- let n = t.eval(r6, ue(r6)), i = [];
43051
+ let n = t.eval(r6, pe(r6)), i = [];
43052
43052
  for (let o of e) !i.some((s) => s.value === o.value) && n.some((s) => s.value === o.value) && i.push(o);
43053
43053
  return i;
43054
43054
  }, exclude: (r6, e, t) => {
43055
43055
  if (!t) return e;
43056
- let n = t.eval(r6, ue(r6)), i = [];
43056
+ let n = t.eval(r6, pe(r6)), i = [];
43057
43057
  for (let o of e) n.some((s) => s.value === o.value) || i.push(o);
43058
43058
  return i;
43059
43059
  }, union: (r6, e, t) => {
43060
43060
  if (!t) return e;
43061
- let n = t.eval(r6, ue(r6));
43061
+ let n = t.eval(r6, pe(r6));
43062
43062
  return Ze([...e, ...n]);
43063
43063
  }, combine: (r6, e, t) => {
43064
43064
  if (!t) return e;
43065
- let n = t.eval(r6, ue(r6));
43065
+ let n = t.eval(r6, pe(r6));
43066
43066
  return [...e, ...n];
43067
43067
  }, htmlChecks: (r6, e, t) => [x(true)], iif: (r6, e, t, n, i) => {
43068
43068
  let o = t.eval(r6, e);
@@ -43070,7 +43070,7 @@ var w = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), has
43070
43070
  return _(o) ? n.eval(r6, e) : i ? i.eval(r6, e) : [];
43071
43071
  }, toBoolean: (r6, e) => {
43072
43072
  if (e.length === 0) return [];
43073
- let [{ value: t }] = $(e, 1);
43073
+ let [{ value: t }] = W(e, 1);
43074
43074
  if (typeof t == "boolean") return [{ type: l.boolean, value: t }];
43075
43075
  if (typeof t == "number" && (t === 0 || t === 1)) return d(!!t);
43076
43076
  if (typeof t == "string") {
@@ -43079,58 +43079,58 @@ var w = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), has
43079
43079
  if (["false", "f", "no", "n", "0", "0.0"].includes(n)) return d(false);
43080
43080
  }
43081
43081
  return [];
43082
- }, convertsToBoolean: (r6, e) => e.length === 0 ? [] : d(w.toBoolean(r6, e).length === 1), toInteger: (r6, e) => {
43082
+ }, convertsToBoolean: (r6, e) => e.length === 0 ? [] : d(O.toBoolean(r6, e).length === 1), toInteger: (r6, e) => {
43083
43083
  if (e.length === 0) return [];
43084
- let [{ value: t }] = $(e, 1);
43084
+ let [{ value: t }] = W(e, 1);
43085
43085
  return typeof t == "number" ? [{ type: l.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: l.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: l.integer, value: t ? 1 : 0 }] : [];
43086
- }, convertsToInteger: (r6, e) => e.length === 0 ? [] : d(w.toInteger(r6, e).length === 1), toDate: (r6, e) => {
43086
+ }, convertsToInteger: (r6, e) => e.length === 0 ? [] : d(O.toInteger(r6, e).length === 1), toDate: (r6, e) => {
43087
43087
  if (e.length === 0) return [];
43088
- let [{ value: t }] = $(e, 1);
43089
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: be(t) }] : [];
43090
- }, convertsToDate: (r6, e) => e.length === 0 ? [] : d(w.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
43088
+ let [{ value: t }] = W(e, 1);
43089
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Re(t) }] : [];
43090
+ }, convertsToDate: (r6, e) => e.length === 0 ? [] : d(O.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
43091
43091
  if (e.length === 0) return [];
43092
- let [{ value: t }] = $(e, 1);
43093
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: be(t) }] : [];
43094
- }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : d(w.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
43092
+ let [{ value: t }] = W(e, 1);
43093
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Re(t) }] : [];
43094
+ }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : d(O.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
43095
43095
  if (e.length === 0) return [];
43096
- let [{ value: t }] = $(e, 1);
43096
+ let [{ value: t }] = W(e, 1);
43097
43097
  return typeof t == "number" ? [{ type: l.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: l.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: l.decimal, value: t ? 1 : 0 }] : [];
43098
- }, convertsToDecimal: (r6, e) => e.length === 0 ? [] : d(w.toDecimal(r6, e).length === 1), toQuantity: (r6, e) => {
43098
+ }, convertsToDecimal: (r6, e) => e.length === 0 ? [] : d(O.toDecimal(r6, e).length === 1), toQuantity: (r6, e) => {
43099
43099
  if (e.length === 0) return [];
43100
- let [{ value: t }] = $(e, 1);
43101
- return O(t) ? [{ type: l.Quantity, value: t }] : typeof t == "number" ? [{ type: l.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: l.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: l.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
43102
- }, convertsToQuantity: (r6, e) => e.length === 0 ? [] : d(w.toQuantity(r6, e).length === 1), toString: (r6, e) => {
43100
+ let [{ value: t }] = W(e, 1);
43101
+ return I(t) ? [{ type: l.Quantity, value: t }] : typeof t == "number" ? [{ type: l.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: l.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: l.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
43102
+ }, convertsToQuantity: (r6, e) => e.length === 0 ? [] : d(O.toQuantity(r6, e).length === 1), toString: (r6, e) => {
43103
43103
  if (e.length === 0) return [];
43104
- let [{ value: t }] = $(e, 1);
43105
- return t == null ? [] : O(t) ? [{ type: l.string, value: `${t.value} '${t.unit}'` }] : [{ type: l.string, value: t.toString() }];
43106
- }, convertsToString: (r6, e) => e.length === 0 ? [] : d(w.toString(r6, e).length === 1), toTime: (r6, e) => {
43104
+ let [{ value: t }] = W(e, 1);
43105
+ return t == null ? [] : I(t) ? [{ type: l.string, value: `${t.value} '${t.unit}'` }] : [{ type: l.string, value: t.toString() }];
43106
+ }, convertsToString: (r6, e) => e.length === 0 ? [] : d(O.toString(r6, e).length === 1), toTime: (r6, e) => {
43107
43107
  if (e.length === 0) return [];
43108
- let [{ value: t }] = $(e, 1);
43108
+ let [{ value: t }] = W(e, 1);
43109
43109
  if (typeof t == "string") {
43110
43110
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
43111
- if (n) return [{ type: l.time, value: be("T" + n[1]) }];
43111
+ if (n) return [{ type: l.time, value: Re("T" + n[1]) }];
43112
43112
  }
43113
43113
  return [];
43114
- }, convertsToTime: (r6, e) => e.length === 0 ? [] : d(w.toTime(r6, e).length === 1), indexOf: (r6, e, t) => M((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => M((i, o, s) => {
43114
+ }, convertsToTime: (r6, e) => e.length === 0 ? [] : d(O.toTime(r6, e).length === 1), indexOf: (r6, e, t) => N((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => N((i, o, s) => {
43115
43115
  let a2 = o, c = s ? a2 + s : i.length;
43116
43116
  return a2 < 0 || a2 >= i.length ? void 0 : i.substring(a2, c);
43117
- }, r6, e, t, n), startsWith: (r6, e, t) => M((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => M((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => M((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => M((t) => t.toUpperCase(), r6, e), lower: (r6, e) => M((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => M((i, o, s) => i.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => M((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => M((i, o, s) => i.replaceAll(o, s), r6, e, t, n), length: (r6, e) => M((t) => t.length, r6, e), toChars: (r6, e) => M((t) => t ? t.split("") : void 0, r6, e), encode: Q, decode: Q, escape: Q, unescape: Q, trim: Q, split: Q, join: (r6, e, t) => {
43118
- let n = t?.eval(r6, ue(r6))[0]?.value ?? "";
43117
+ }, r6, e, t, n), startsWith: (r6, e, t) => N((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => N((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => N((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => N((t) => t.toUpperCase(), r6, e), lower: (r6, e) => N((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => N((i, o, s) => i.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => N((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => N((i, o, s) => i.replaceAll(o, s), r6, e, t, n), length: (r6, e) => N((t) => t.length, r6, e), toChars: (r6, e) => N((t) => t ? t.split("") : void 0, r6, e), encode: Q, decode: Q, escape: Q, unescape: Q, trim: Q, split: Q, join: (r6, e, t) => {
43118
+ let n = t?.eval(r6, pe(r6))[0]?.value ?? "";
43119
43119
  if (typeof n != "string") throw new Error("Separator must be a string.");
43120
43120
  return [{ type: l.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
43121
- }, abs: (r6, e) => j(Math.abs, r6, e), ceiling: (r6, e) => j(Math.ceil, r6, e), exp: (r6, e) => j(Math.exp, r6, e), floor: (r6, e) => j(Math.floor, r6, e), ln: (r6, e) => j(Math.log, r6, e), log: (r6, e, t) => j((n, i) => Math.log(n) / Math.log(i), r6, e, t), power: (r6, e, t) => j(Math.pow, r6, e, t), round: (r6, e) => j(Math.round, r6, e), sqrt: (r6, e) => j(Math.sqrt, r6, e), truncate: (r6, e) => j((t) => t | 0, r6, e), children: Q, descendants: Q, trace: (r6, e, t) => e, now: () => [{ type: l.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: l.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: l.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i) => {
43122
- let o = w.toDateTime(r6, t.eval(r6, e));
43121
+ }, abs: (r6, e) => $(Math.abs, r6, e), ceiling: (r6, e) => $(Math.ceil, r6, e), exp: (r6, e) => $(Math.exp, r6, e), floor: (r6, e) => $(Math.floor, r6, e), ln: (r6, e) => $(Math.log, r6, e), log: (r6, e, t) => $((n, i) => Math.log(n) / Math.log(i), r6, e, t), power: (r6, e, t) => $(Math.pow, r6, e, t), round: (r6, e) => $(Math.round, r6, e), sqrt: (r6, e) => $(Math.sqrt, r6, e), truncate: (r6, e) => $((t) => t | 0, r6, e), children: Q, descendants: Q, trace: (r6, e, t) => e, now: () => [{ type: l.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: l.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: l.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i) => {
43122
+ let o = O.toDateTime(r6, t.eval(r6, e));
43123
43123
  if (o.length === 0) throw new Error("Invalid start date");
43124
- let s = w.toDateTime(r6, n.eval(r6, e));
43124
+ let s = O.toDateTime(r6, n.eval(r6, e));
43125
43125
  if (s.length === 0) throw new Error("Invalid end date");
43126
43126
  let a2 = i.eval(r6, e)[0]?.value;
43127
43127
  if (a2 !== "years" && a2 !== "months" && a2 !== "days") throw new Error("Invalid units");
43128
- let c = nt(o[0].value, s[0].value);
43128
+ let c = rt(o[0].value, s[0].value);
43129
43129
  return [{ type: l.Quantity, value: { value: c[a2], unit: a2 } }];
43130
43130
  }, is: (r6, e, t) => {
43131
43131
  let n = "";
43132
- return t instanceof W ? n = t.name : t instanceof X && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: Xe(i, n) })) : [];
43133
- }, not: (r6, e) => w.toBoolean(r6, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
43132
+ return t instanceof U ? n = t.name : t instanceof te && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: Xe(i, n) })) : [];
43133
+ }, not: (r6, e) => O.toBoolean(r6, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
43134
43134
  let n = t.value, i;
43135
43135
  if (typeof n == "string") i = n;
43136
43136
  else if (typeof n == "object") {
@@ -43147,37 +43147,52 @@ var w = { empty: (r6, e) => d(e.length === 0 || e.every((t) => S(t.value))), has
43147
43147
  return { type: o, value: { resourceType: o, id: s } };
43148
43148
  }
43149
43149
  return { type: l.BackboneElement, value: void 0 };
43150
- }).filter((t) => !!t.value), as: (r6, e) => e, type: (r6, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: l.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: l.BackboneElement, value: { namespace: "System", name: "Integer" } } : F(t) ? { type: l.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: l.BackboneElement, value: null }), conformsTo: (r6, e, t) => {
43150
+ }).filter((t) => !!t.value), as: (r6, e) => e, type: (r6, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: l.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: l.BackboneElement, value: { namespace: "System", name: "Integer" } } : L(t) ? { type: l.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: l.BackboneElement, value: null }), conformsTo: (r6, e, t) => {
43151
43151
  let n = t.eval(r6, e)[0].value;
43152
43152
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/")) throw new Error("Expected a StructureDefinition URL");
43153
43153
  let i = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
43154
43154
  return e.map((o) => ({ type: l.boolean, value: o.value?.resourceType === i }));
43155
+ }, getResourceKey: (r6, e) => {
43156
+ let t = e[0].value;
43157
+ return t?.id ? [{ type: l.id, value: t.id }] : [];
43158
+ }, getReferenceKey: (r6, e, t) => {
43159
+ let n = e[0].value;
43160
+ if (!n?.reference) return [];
43161
+ let i = "";
43162
+ return t instanceof U && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: Te(n) }];
43163
+ }, extension: (r6, e, t) => {
43164
+ let n = t.eval(r6, e)[0].value, i = e?.[0]?.value;
43165
+ if (i) {
43166
+ let o = Z(i, n);
43167
+ if (o) return [{ type: l.Extension, value: o }];
43168
+ }
43169
+ return [];
43155
43170
  } };
43156
- function M(r6, e, t, ...n) {
43171
+ function N(r6, e, t, ...n) {
43157
43172
  if (t.length === 0) return [];
43158
- let [{ value: i }] = $(t, 1);
43173
+ let [{ value: i }] = W(t, 1);
43159
43174
  if (typeof i != "string") throw new Error("String function cannot be called with non-string");
43160
43175
  let o = r6(i, ...n.map((s) => s?.eval(e, t)[0]?.value));
43161
43176
  return o === void 0 ? [] : Array.isArray(o) ? o.map(x) : [x(o)];
43162
43177
  }
43163
- function j(r6, e, t, ...n) {
43178
+ function $(r6, e, t, ...n) {
43164
43179
  if (t.length === 0) return [];
43165
- let [{ value: i }] = $(t, 1), o = O(i), s = o ? i.value : i;
43180
+ let [{ value: i }] = W(t, 1), o = I(i), s = o ? i.value : i;
43166
43181
  if (typeof s != "number") throw new Error("Math function cannot be called with non-number");
43167
43182
  let a2 = r6(s, ...n.map((p2) => p2.eval(e, t)[0]?.value)), c = o ? l.Quantity : t[0].type, u2 = o ? { ...i, value: a2 } : a2;
43168
43183
  return [{ type: c, value: u2 }];
43169
43184
  }
43170
- function $(r6, e) {
43185
+ function W(r6, e) {
43171
43186
  if (r6.length !== e) throw new Error(`Expected ${e} arguments`);
43172
43187
  for (let t of r6) if (t == null) throw new Error("Expected non-null argument");
43173
43188
  return r6;
43174
43189
  }
43175
- function ue(r6) {
43190
+ function pe(r6) {
43176
43191
  let e = r6;
43177
43192
  for (; e.parent?.variables.$this; ) e = e.parent;
43178
43193
  return [e.variables.$this];
43179
43194
  }
43180
- var N = class {
43195
+ var F = class {
43181
43196
  constructor(e) {
43182
43197
  this.value = e;
43183
43198
  }
@@ -43189,7 +43204,7 @@ var N = class {
43189
43204
  return typeof e == "string" ? `'${e}'` : e.toString();
43190
43205
  }
43191
43206
  };
43192
- var W = class {
43207
+ var U = class {
43193
43208
  constructor(e) {
43194
43209
  this.name = e;
43195
43210
  }
@@ -43207,13 +43222,13 @@ var W = class {
43207
43222
  }
43208
43223
  evalValue(e) {
43209
43224
  let t = e.value;
43210
- if (!(!t || typeof t != "object")) return F(t) && t.resourceType === this.name ? e : A(e, this.name);
43225
+ if (!(!t || typeof t != "object")) return L(t) && t.resourceType === this.name ? e : C(e, this.name);
43211
43226
  }
43212
43227
  toString() {
43213
43228
  return this.name;
43214
43229
  }
43215
43230
  };
43216
- var at = class {
43231
+ var st = class {
43217
43232
  eval() {
43218
43233
  return [];
43219
43234
  }
@@ -43221,7 +43236,7 @@ var at = class {
43221
43236
  return "{}";
43222
43237
  }
43223
43238
  };
43224
- var ct = class extends Ge {
43239
+ var at = class extends Ge {
43225
43240
  constructor(t, n, i) {
43226
43241
  super(t, n);
43227
43242
  this.impl = i;
@@ -43233,17 +43248,17 @@ var ct = class extends Ge {
43233
43248
  return this.operator + this.child.toString();
43234
43249
  }
43235
43250
  };
43236
- var le = class extends z {
43251
+ var de = class extends J {
43237
43252
  constructor(e, t) {
43238
43253
  super("as", e, t);
43239
43254
  }
43240
43255
  eval(e, t) {
43241
- return w.ofType(e, this.left.eval(e, t), this.right);
43256
+ return O.ofType(e, this.left.eval(e, t), this.right);
43242
43257
  }
43243
43258
  };
43244
- var P = class extends z {
43259
+ var P = class extends J {
43245
43260
  };
43246
- var I = class extends P {
43261
+ var k = class extends P {
43247
43262
  constructor(t, n, i, o) {
43248
43263
  super(t, n, i);
43249
43264
  this.impl = o;
@@ -43253,11 +43268,11 @@ var I = class extends P {
43253
43268
  if (i.length !== 1) return [];
43254
43269
  let o = this.right.eval(t, n);
43255
43270
  if (o.length !== 1) return [];
43256
- let s = i[0].value, a2 = o[0].value, c = O(s) ? s.value : s, u2 = O(a2) ? a2.value : a2, p2 = this.impl(c, u2);
43257
- return typeof p2 == "boolean" ? d(p2) : O(s) ? [{ type: l.Quantity, value: { ...s, value: p2 } }] : [x(p2)];
43271
+ let s = i[0].value, a2 = o[0].value, c = I(s) ? s.value : s, u2 = I(a2) ? a2.value : a2, p2 = this.impl(c, u2);
43272
+ return typeof p2 == "boolean" ? d(p2) : I(s) ? [{ type: l.Quantity, value: { ...s, value: p2 } }] : [x(p2)];
43258
43273
  }
43259
43274
  };
43260
- var ut = class extends z {
43275
+ var ct = class extends J {
43261
43276
  constructor(e, t) {
43262
43277
  super("&", e, t);
43263
43278
  }
@@ -43266,7 +43281,7 @@ var ut = class extends z {
43266
43281
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: l.string, value: o.map((s) => s.value).join("") }] : o;
43267
43282
  }
43268
43283
  };
43269
- var lt = class extends P {
43284
+ var ut = class extends P {
43270
43285
  constructor(e, t) {
43271
43286
  super("contains", e, t);
43272
43287
  }
@@ -43275,16 +43290,16 @@ var lt = class extends P {
43275
43290
  return d(n.some((o) => o.value === i[0].value));
43276
43291
  }
43277
43292
  };
43278
- var pt = class extends P {
43293
+ var lt = class extends P {
43279
43294
  constructor(e, t) {
43280
43295
  super("in", e, t);
43281
43296
  }
43282
43297
  eval(e, t) {
43283
- let n = U(this.left.eval(e, t)), i = this.right.eval(e, t);
43298
+ let n = B(this.left.eval(e, t)), i = this.right.eval(e, t);
43284
43299
  return n ? d(i.some((o) => o.value === n.value)) : [];
43285
43300
  }
43286
43301
  };
43287
- var X = class extends z {
43302
+ var te = class extends J {
43288
43303
  constructor(e, t) {
43289
43304
  super(".", e, t);
43290
43305
  }
@@ -43295,7 +43310,7 @@ var X = class extends z {
43295
43310
  return `${this.left.toString()}.${this.right.toString()}`;
43296
43311
  }
43297
43312
  };
43298
- var Re = class extends z {
43313
+ var Pe = class extends J {
43299
43314
  constructor(e, t) {
43300
43315
  super("|", e, t);
43301
43316
  }
@@ -43304,43 +43319,43 @@ var Re = class extends z {
43304
43319
  return Ze([...n, ...i]);
43305
43320
  }
43306
43321
  };
43307
- var dt = class extends P {
43322
+ var pt = class extends P {
43308
43323
  constructor(e, t) {
43309
43324
  super("=", e, t);
43310
43325
  }
43311
43326
  eval(e, t) {
43312
43327
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
43313
- return sr(n, i);
43328
+ return or(n, i);
43314
43329
  }
43315
43330
  };
43316
- var ft = class extends P {
43331
+ var dt = class extends P {
43317
43332
  constructor(e, t) {
43318
43333
  super("!=", e, t);
43319
43334
  }
43320
43335
  eval(e, t) {
43321
43336
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
43322
- return or(sr(n, i));
43337
+ return ir(or(n, i));
43323
43338
  }
43324
43339
  };
43325
- var mt = class extends P {
43340
+ var ft = class extends P {
43326
43341
  constructor(e, t) {
43327
43342
  super("~", e, t);
43328
43343
  }
43329
43344
  eval(e, t) {
43330
43345
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
43331
- return ar(n, i);
43346
+ return sr(n, i);
43332
43347
  }
43333
43348
  };
43334
- var ht = class extends P {
43349
+ var mt = class extends P {
43335
43350
  constructor(e, t) {
43336
43351
  super("!~", e, t);
43337
43352
  }
43338
43353
  eval(e, t) {
43339
43354
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
43340
- return or(ar(n, i));
43355
+ return ir(sr(n, i));
43341
43356
  }
43342
43357
  };
43343
- var pe = class extends P {
43358
+ var fe = class extends P {
43344
43359
  constructor(e, t) {
43345
43360
  super("is", e, t);
43346
43361
  }
@@ -43351,39 +43366,39 @@ var pe = class extends P {
43351
43366
  return d(Xe(n[0], i));
43352
43367
  }
43353
43368
  };
43354
- var yt = class extends P {
43369
+ var ht = class extends P {
43355
43370
  constructor(e, t) {
43356
43371
  super("and", e, t);
43357
43372
  }
43358
43373
  eval(e, t) {
43359
- let n = U(this.left.eval(e, t), "boolean"), i = U(this.right.eval(e, t), "boolean");
43374
+ let n = B(this.left.eval(e, t), "boolean"), i = B(this.right.eval(e, t), "boolean");
43360
43375
  return n?.value === true && i?.value === true ? d(true) : n?.value === false || i?.value === false ? d(false) : [];
43361
43376
  }
43362
43377
  };
43363
- var gt = class extends P {
43378
+ var yt = class extends P {
43364
43379
  constructor(e, t) {
43365
43380
  super("or", e, t);
43366
43381
  }
43367
43382
  eval(e, t) {
43368
- let n = U(this.left.eval(e, t), "boolean"), i = U(this.right.eval(e, t), "boolean");
43383
+ let n = B(this.left.eval(e, t), "boolean"), i = B(this.right.eval(e, t), "boolean");
43369
43384
  return n?.value === false && i?.value === false ? d(false) : n?.value || i?.value ? d(true) : [];
43370
43385
  }
43371
43386
  };
43372
- var xt = class extends P {
43387
+ var gt = class extends P {
43373
43388
  constructor(e, t) {
43374
43389
  super("xor", e, t);
43375
43390
  }
43376
43391
  eval(e, t) {
43377
- let n = U(this.left.eval(e, t), "boolean"), i = U(this.right.eval(e, t), "boolean");
43392
+ let n = B(this.left.eval(e, t), "boolean"), i = B(this.right.eval(e, t), "boolean");
43378
43393
  return !n || !i ? [] : d(n.value !== i.value);
43379
43394
  }
43380
43395
  };
43381
- var vt = class extends P {
43396
+ var xt = class extends P {
43382
43397
  constructor(e, t) {
43383
43398
  super("implies", e, t);
43384
43399
  }
43385
43400
  eval(e, t) {
43386
- let n = U(this.left.eval(e, t), "boolean"), i = U(this.right.eval(e, t), "boolean");
43401
+ let n = B(this.left.eval(e, t), "boolean"), i = B(this.right.eval(e, t), "boolean");
43387
43402
  return i?.value === true || n?.value === false ? d(true) : !n || !i ? [] : d(false);
43388
43403
  }
43389
43404
  };
@@ -43393,7 +43408,7 @@ var K = class {
43393
43408
  this.args = t;
43394
43409
  }
43395
43410
  eval(e, t) {
43396
- let n = w[this.name];
43411
+ let n = O[this.name];
43397
43412
  if (!n) throw new Error("Unrecognized function: " + this.name);
43398
43413
  return n(e, t, ...this.args);
43399
43414
  }
@@ -43401,7 +43416,7 @@ var K = class {
43401
43416
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
43402
43417
  }
43403
43418
  };
43404
- var de = class {
43419
+ var me = class {
43405
43420
  constructor(e, t) {
43406
43421
  this.left = e;
43407
43422
  this.expr = t;
@@ -43418,59 +43433,59 @@ var de = class {
43418
43433
  return `${this.left.toString()}[${this.expr.toString()}]`;
43419
43434
  }
43420
43435
  };
43421
- var Fe = ["!=", "!~", "<=", ">=", "{}", "->"];
43436
+ var Le = ["!=", "!~", "<=", ">=", "{}", "->"];
43422
43437
  var y = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
43423
- var Do = { parse(r6) {
43438
+ var Mo = { parse(r6) {
43424
43439
  let e = r6.consumeAndParse();
43425
43440
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
43426
43441
  return e;
43427
43442
  } };
43428
- var Mo = { parse(r6, e) {
43443
+ var No = { parse(r6, e) {
43429
43444
  let t = r6.consumeAndParse();
43430
43445
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
43431
- return new de(e, t);
43446
+ return new me(e, t);
43432
43447
  }, precedence: y.Indexer };
43433
- var No = { parse(r6, e) {
43434
- if (!(e instanceof W)) throw new Error("Unexpected parentheses");
43448
+ var Fo = { parse(r6, e) {
43449
+ if (!(e instanceof U)) throw new Error("Unexpected parentheses");
43435
43450
  let t = [];
43436
43451
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
43437
43452
  return new K(e.name, t);
43438
43453
  }, precedence: y.FunctionCall };
43439
- function Fo(r6) {
43454
+ function Lo(r6) {
43440
43455
  let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
43441
43456
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
43442
43457
  }
43443
- function Le() {
43444
- return new He().registerPrefix("String", { parse: (r6, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new N({ type: l.dateTime, value: be(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new N({ type: l.Quantity, value: Fo(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new W(e.value) }).registerPrefix("{}", { parse: () => new at() }).registerPrefix("(", Do).registerInfix("[", Mo).registerInfix("(", No).prefix("+", y.UnaryAdd, (r6, e) => new ct("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r6, e) => new I("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r6, e, t) => new X(r6, t)).infixLeft("/", y.Divide, (r6, e, t) => new I("/", r6, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r6, e, t) => new I("*", r6, t, (n, i) => n * i)).infixLeft("+", y.Add, (r6, e, t) => new I("+", r6, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r6, e, t) => new I("-", r6, t, (n, i) => n - i)).infixLeft("|", y.Union, (r6, e, t) => new Re(r6, t)).infixLeft("=", y.Equals, (r6, e, t) => new dt(r6, t)).infixLeft("!=", y.NotEquals, (r6, e, t) => new ft(r6, t)).infixLeft("~", y.Equivalent, (r6, e, t) => new mt(r6, t)).infixLeft("!~", y.NotEquivalent, (r6, e, t) => new ht(r6, t)).infixLeft("<", y.LessThan, (r6, e, t) => new I("<", r6, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r6, e, t) => new I("<=", r6, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r6, e, t) => new I(">", r6, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r6, e, t) => new I(">=", r6, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r6, e, t) => new ut(r6, t)).infixLeft("and", y.And, (r6, e, t) => new yt(r6, t)).infixLeft("as", y.As, (r6, e, t) => new le(r6, t)).infixLeft("contains", y.Contains, (r6, e, t) => new lt(r6, t)).infixLeft("div", y.Divide, (r6, e, t) => new I("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r6, e, t) => new pt(r6, t)).infixLeft("is", y.Is, (r6, e, t) => new pe(r6, t)).infixLeft("mod", y.Modulo, (r6, e, t) => new I("mod", r6, t, (n, i) => n % i)).infixLeft("or", y.Or, (r6, e, t) => new gt(r6, t)).infixLeft("xor", y.Xor, (r6, e, t) => new xt(r6, t)).infixLeft("implies", y.Implies, (r6, e, t) => new vt(r6, t));
43458
+ function _e() {
43459
+ return new He().registerPrefix("String", { parse: (r6, e) => new F({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new F({ type: l.dateTime, value: Re(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new F({ type: l.Quantity, value: Lo(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new F({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new F({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new F({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new U(e.value) }).registerPrefix("{}", { parse: () => new st() }).registerPrefix("(", Mo).registerInfix("[", No).registerInfix("(", Fo).prefix("+", y.UnaryAdd, (r6, e) => new at("+", e, (t) => t)).prefix("-", y.UnarySubtract, (r6, e) => new k("-", e, e, (t, n) => -n)).infixLeft(".", y.Dot, (r6, e, t) => new te(r6, t)).infixLeft("/", y.Divide, (r6, e, t) => new k("/", r6, t, (n, i) => n / i)).infixLeft("*", y.Multiply, (r6, e, t) => new k("*", r6, t, (n, i) => n * i)).infixLeft("+", y.Add, (r6, e, t) => new k("+", r6, t, (n, i) => n + i)).infixLeft("-", y.Subtract, (r6, e, t) => new k("-", r6, t, (n, i) => n - i)).infixLeft("|", y.Union, (r6, e, t) => new Pe(r6, t)).infixLeft("=", y.Equals, (r6, e, t) => new pt(r6, t)).infixLeft("!=", y.NotEquals, (r6, e, t) => new dt(r6, t)).infixLeft("~", y.Equivalent, (r6, e, t) => new ft(r6, t)).infixLeft("!~", y.NotEquivalent, (r6, e, t) => new mt(r6, t)).infixLeft("<", y.LessThan, (r6, e, t) => new k("<", r6, t, (n, i) => n < i)).infixLeft("<=", y.LessThanOrEquals, (r6, e, t) => new k("<=", r6, t, (n, i) => n <= i)).infixLeft(">", y.GreaterThan, (r6, e, t) => new k(">", r6, t, (n, i) => n > i)).infixLeft(">=", y.GreaterThanOrEquals, (r6, e, t) => new k(">=", r6, t, (n, i) => n >= i)).infixLeft("&", y.Ampersand, (r6, e, t) => new ct(r6, t)).infixLeft("and", y.And, (r6, e, t) => new ht(r6, t)).infixLeft("as", y.As, (r6, e, t) => new de(r6, t)).infixLeft("contains", y.Contains, (r6, e, t) => new ut(r6, t)).infixLeft("div", y.Divide, (r6, e, t) => new k("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", y.In, (r6, e, t) => new lt(r6, t)).infixLeft("is", y.Is, (r6, e, t) => new fe(r6, t)).infixLeft("mod", y.Modulo, (r6, e, t) => new k("mod", r6, t, (n, i) => n % i)).infixLeft("or", y.Or, (r6, e, t) => new yt(r6, t)).infixLeft("xor", y.Xor, (r6, e, t) => new gt(r6, t)).infixLeft("implies", y.Implies, (r6, e, t) => new xt(r6, t));
43445
43460
  }
43446
- var Lo = Le();
43447
- var Nn = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(Nn || {});
43448
- var Bn = ((T) => (T.EQUALS = "eq", T.NOT_EQUALS = "ne", T.GREATER_THAN = "gt", T.LESS_THAN = "lt", T.GREATER_THAN_OR_EQUALS = "ge", T.LESS_THAN_OR_EQUALS = "le", T.STARTS_AFTER = "sa", T.ENDS_BEFORE = "eb", T.APPROXIMATELY = "ap", T.CONTAINS = "contains", T.EXACT = "exact", T.TEXT = "text", T.NOT = "not", T.ABOVE = "above", T.BELOW = "below", T.IN = "in", T.NOT_IN = "not-in", T.OF_TYPE = "of-type", T.MISSING = "missing", T.PRESENT = "present", T.IDENTIFIER = "identifier", T.ITERATE = "iterate", T))(Bn || {});
43449
- var ms = ((E) => (E.READ = "read", E.VREAD = "vread", E.UPDATE = "update", E.PATCH = "patch", E.DELETE = "delete", E.HISTORY = "history", E.HISTORY_INSTANCE = "history-instance", E.HISTORY_TYPE = "history-type", E.HISTORY_SYSTEM = "history-system", E.CREATE = "create", E.SEARCH = "search", E.SEARCH_TYPE = "search-type", E.SEARCH_SYSTEM = "search-system", E.SEARCH_COMPARTMENT = "search-compartment", E.CAPABILITIES = "capabilities", E.TRANSACTION = "transaction", E.BATCH = "batch", E.OPERATION = "operation", E))(ms || {});
43450
- function Wn(r6) {
43461
+ var _o = _e();
43462
+ var Fn = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(Fn || {});
43463
+ var qn = ((T) => (T.EQUALS = "eq", T.NOT_EQUALS = "ne", T.GREATER_THAN = "gt", T.LESS_THAN = "lt", T.GREATER_THAN_OR_EQUALS = "ge", T.LESS_THAN_OR_EQUALS = "le", T.STARTS_AFTER = "sa", T.ENDS_BEFORE = "eb", T.APPROXIMATELY = "ap", T.CONTAINS = "contains", T.EXACT = "exact", T.TEXT = "text", T.NOT = "not", T.ABOVE = "above", T.BELOW = "below", T.IN = "in", T.NOT_IN = "not-in", T.OF_TYPE = "of-type", T.MISSING = "missing", T.PRESENT = "present", T.IDENTIFIER = "identifier", T.ITERATE = "iterate", T))(qn || {});
43464
+ var hs = ((E) => (E.READ = "read", E.VREAD = "vread", E.UPDATE = "update", E.PATCH = "patch", E.DELETE = "delete", E.HISTORY = "history", E.HISTORY_INSTANCE = "history-instance", E.HISTORY_TYPE = "history-type", E.HISTORY_SYSTEM = "history-system", E.CREATE = "create", E.SEARCH = "search", E.SEARCH_TYPE = "search-type", E.SEARCH_SYSTEM = "search-system", E.SEARCH_COMPARTMENT = "search-compartment", E.CAPABILITIES = "capabilities", E.TRANSACTION = "transaction", E.BATCH = "batch", E.OPERATION = "operation", E))(hs || {});
43465
+ function Gn(r6) {
43451
43466
  if (typeof window < "u") return window.atob(r6);
43452
43467
  if (typeof Buffer < "u") return Buffer.from(r6, "base64").toString("binary");
43453
43468
  throw new Error("Unable to decode base64");
43454
43469
  }
43455
- function Gn(r6) {
43470
+ function Hn(r6) {
43456
43471
  if (typeof window < "u") return window.btoa(r6);
43457
43472
  if (typeof Buffer < "u") return Buffer.from(r6, "binary").toString("base64");
43458
43473
  throw new Error("Unable to encode base64");
43459
43474
  }
43460
- function br() {
43475
+ function Er() {
43461
43476
  let r6 = new Uint32Array(28);
43462
- return crypto.getRandomValues(r6), Rn(r6.buffer);
43477
+ return crypto.getRandomValues(r6), Pn(r6.buffer);
43463
43478
  }
43464
- async function Hn(r6) {
43479
+ async function Qn(r6) {
43465
43480
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
43466
43481
  }
43467
- function fe() {
43482
+ function he() {
43468
43483
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r6) => {
43469
43484
  let e = Math.random() * 16 | 0;
43470
43485
  return (r6 === "x" ? e : e & 3 | 8).toString(16);
43471
43486
  });
43472
43487
  }
43473
- var bt = class {
43488
+ var Et = class {
43474
43489
  constructor(e = 10) {
43475
43490
  this.max = e, this.cache = /* @__PURE__ */ new Map();
43476
43491
  }
@@ -43494,8 +43509,8 @@ var bt = class {
43494
43509
  return this.cache.keys().next().value;
43495
43510
  }
43496
43511
  };
43497
- var k = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping" };
43498
- var Ue = class {
43512
+ var V = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping" };
43513
+ var br = class {
43499
43514
  constructor() {
43500
43515
  this.listeners = {};
43501
43516
  }
@@ -43520,9 +43535,9 @@ var Ue = class {
43520
43535
  this.listeners = {};
43521
43536
  }
43522
43537
  };
43523
- var me = class {
43538
+ var z = class {
43524
43539
  constructor() {
43525
- this.emitter = new Ue();
43540
+ this.emitter = new br();
43526
43541
  }
43527
43542
  dispatchEvent(e) {
43528
43543
  this.emitter.dispatchEvent(e);
@@ -43538,57 +43553,57 @@ var me = class {
43538
43553
  }
43539
43554
  };
43540
43555
  var Rr = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
43541
- var bs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
43556
+ var Rs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
43542
43557
  var Pr = ["DiagnosticReport-update"];
43543
- function zn(r6) {
43558
+ function Jn(r6) {
43544
43559
  return Pr.includes(r6);
43545
43560
  }
43546
- function Jn(r6) {
43561
+ function Yn(r6) {
43547
43562
  if (Pr.includes(r6)) throw new f(h(`'context.version' is required for '${r6}'.`));
43548
43563
  }
43549
- var Rs = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
43550
- function Ps(r6) {
43551
- return bs.includes(r6);
43564
+ var Ps = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
43565
+ function Cs(r6) {
43566
+ return Rs.includes(r6);
43552
43567
  }
43553
- function Yn(r6) {
43568
+ function Zn(r6) {
43554
43569
  return !!r6.endpoint;
43555
43570
  }
43556
43571
  function Cr(r6) {
43557
- if (!Pt(r6)) throw new f(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
43572
+ if (!Rt(r6)) throw new f(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
43558
43573
  let { channelType: e, mode: t, topic: n, events: i } = r6, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
43559
- return Yn(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
43574
+ return Zn(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
43560
43575
  }
43561
- function Pt(r6) {
43576
+ function Rt(r6) {
43562
43577
  if (typeof r6 != "object") return false;
43563
43578
  let { channelType: e, mode: t, topic: n, events: i } = r6;
43564
43579
  if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
43565
43580
  for (let o of i) if (!Rr[o]) return false;
43566
- return !(Yn(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
43581
+ return !(Zn(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
43567
43582
  }
43568
- function Kn(r6, e, t, n) {
43583
+ function zn(r6, e, t, n) {
43569
43584
  if (typeof e != "object") throw new f(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
43570
43585
  if (!(e.id && typeof e.id == "string")) throw new f(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
43571
43586
  if (!e.resourceType) throw new f(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
43572
43587
  let i = n.resourceType;
43573
43588
  if (i !== "*") {
43574
- if (!Ps(e.resourceType)) throw new f(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
43589
+ if (!Cs(e.resourceType)) throw new f(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
43575
43590
  if (i && e.resourceType !== i) throw new f(h(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i}.`));
43576
43591
  }
43577
43592
  }
43578
- function Cs(r6, e, t, n, i) {
43579
- if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) Kn(r6, e.resource, t, n);
43593
+ function ws(r6, e, t, n, i) {
43594
+ if (i.set(e.key, (i.get(e.key) ?? 0) + 1), !n.isArray) zn(r6, e.resource, t, n);
43580
43595
  else {
43581
43596
  let { resources: o } = e;
43582
43597
  if (!o) throw new f(h(`context[${t}] is invalid. context[${t}] for the '${r6}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
43583
- for (let s of o) Kn(r6, s, t, n);
43598
+ for (let s of o) zn(r6, s, t, n);
43584
43599
  }
43585
43600
  }
43586
- function ws(r6, e) {
43587
- let t = /* @__PURE__ */ new Map(), n = Rs[r6];
43601
+ function As(r6, e) {
43602
+ let t = /* @__PURE__ */ new Map(), n = Ps[r6];
43588
43603
  for (let i = 0; i < e.length; i++) {
43589
43604
  let o = e[i].key;
43590
43605
  if (!n[o]) throw new f(h(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
43591
- Cs(r6, e[i], i, n[o], t);
43606
+ ws(r6, e[i], i, n[o], t);
43592
43607
  }
43593
43608
  for (let [i, o] of Object.entries(n)) {
43594
43609
  if (!(o.optional || t.has(i))) throw new f(h(`Missing required key '${i}' on context for '${r6}' event.`));
@@ -43601,12 +43616,12 @@ function wr(r6, e, t, n) {
43601
43616
  if (typeof t != "object") throw new f(h("context must be a context object or array of context objects."));
43602
43617
  if (Pr.includes(e) && !n) throw new f(h(`The '${e}' event must contain a 'context.versionId'.`));
43603
43618
  let i = Array.isArray(t) ? t : [t];
43604
- return ws(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: fe(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
43619
+ return As(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: he(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
43605
43620
  }
43606
- var Rt = class extends me {
43621
+ var bt = class extends z {
43607
43622
  constructor(e) {
43608
43623
  if (super(), this.subRequest = e, !e.endpoint) throw new f(h("Subscription request should contain an endpoint."));
43609
- if (!Pt(e)) throw new f(h("Subscription request failed validation."));
43624
+ if (!Rt(e)) throw new f(h("Subscription request failed validation."));
43610
43625
  let t = new WebSocket(e.endpoint);
43611
43626
  t.addEventListener("open", () => {
43612
43627
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -43623,36 +43638,36 @@ var Rt = class extends me {
43623
43638
  this.websocket.close();
43624
43639
  }
43625
43640
  };
43626
- function As(r6) {
43627
- let e = r6.replace(/-/g, "+").replace(/_/g, "/"), t = Wn(e), n = Array.from(t).reduce((o, s) => {
43641
+ function Os(r6) {
43642
+ let e = r6.replace(/-/g, "+").replace(/_/g, "/"), t = Gn(e), n = Array.from(t).reduce((o, s) => {
43628
43643
  let a2 = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
43629
43644
  return `${o}%${a2}`;
43630
43645
  }, ""), i = decodeURIComponent(n);
43631
43646
  return JSON.parse(i);
43632
43647
  }
43633
- function Zn(r6) {
43648
+ function Xn(r6) {
43634
43649
  return r6.split(".").length === 3;
43635
43650
  }
43636
- function Ct(r6) {
43651
+ function Pt(r6) {
43637
43652
  let [e, t, n] = r6.split(".");
43638
- return As(t);
43653
+ return Os(t);
43639
43654
  }
43640
- function Xn(r6) {
43655
+ function ei(r6) {
43641
43656
  try {
43642
- return typeof Ct(r6).login_id == "string";
43657
+ return typeof Pt(r6).login_id == "string";
43643
43658
  } catch {
43644
43659
  return false;
43645
43660
  }
43646
43661
  }
43647
- function ei(r6) {
43662
+ function ti(r6) {
43648
43663
  try {
43649
- let t = Ct(r6).exp;
43664
+ let t = Pt(r6).exp;
43650
43665
  return typeof t == "number" ? t * 1e3 : void 0;
43651
43666
  } catch {
43652
43667
  return;
43653
43668
  }
43654
43669
  }
43655
- var wt = class {
43670
+ var Ct = class {
43656
43671
  constructor(e) {
43657
43672
  this.medplum = e;
43658
43673
  }
@@ -43660,17 +43675,17 @@ var wt = class {
43660
43675
  return this.medplum.get(`keyvalue/v1/${e}`);
43661
43676
  }
43662
43677
  async set(e, t) {
43663
- await this.medplum.put(`keyvalue/v1/${e}`, t, k.TEXT);
43678
+ await this.medplum.put(`keyvalue/v1/${e}`, t, V.TEXT);
43664
43679
  }
43665
43680
  async delete(e) {
43666
43681
  await this.medplum.delete(`keyvalue/v1/${e}`);
43667
43682
  }
43668
43683
  };
43669
- var ti;
43670
- ti = Symbol.toStringTag;
43671
- var V = class {
43684
+ var ri;
43685
+ ri = Symbol.toStringTag;
43686
+ var D = class {
43672
43687
  constructor(e) {
43673
- this[ti] = "ReadablePromise";
43688
+ this[ri] = "ReadablePromise";
43674
43689
  this.status = "pending";
43675
43690
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
43676
43691
  throw this.status = "error", this.error = t, t;
@@ -43720,7 +43735,7 @@ var Be = class {
43720
43735
  return t ? JSON.parse(t) : void 0;
43721
43736
  }
43722
43737
  setObject(e, t) {
43723
- this.setString(e, t ? Sn(t) : void 0);
43738
+ this.setString(e, t ? En(t) : void 0);
43724
43739
  }
43725
43740
  };
43726
43741
  var Ar = class {
@@ -43746,7 +43761,7 @@ var Ar = class {
43746
43761
  return Array.from(this.data.keys())[e];
43747
43762
  }
43748
43763
  };
43749
- var Or = class extends me {
43764
+ var Or = class extends z {
43750
43765
  constructor(t) {
43751
43766
  super();
43752
43767
  this.bufferedAmount = -1 / 0;
@@ -43785,7 +43800,7 @@ var Or = class extends me {
43785
43800
  }
43786
43801
  }
43787
43802
  };
43788
- var qe = class extends me {
43803
+ var qe = class extends z {
43789
43804
  constructor(...e) {
43790
43805
  super(), this.criteria = new Set(e);
43791
43806
  }
@@ -43804,9 +43819,9 @@ var Ir = class {
43804
43819
  this.criteria = e, this.emitter = new qe(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
43805
43820
  }
43806
43821
  };
43807
- var At = class {
43822
+ var wt = class {
43808
43823
  constructor(e, t, n) {
43809
- if (!(e instanceof Ot)) throw new f(h("First arg of constructor should be a `MedplumClient`"));
43824
+ if (!(e instanceof At)) throw new f(h("First arg of constructor should be a `MedplumClient`"));
43810
43825
  let i;
43811
43826
  try {
43812
43827
  i = new URL(t).toString();
@@ -43826,7 +43841,7 @@ var At = class {
43826
43841
  return;
43827
43842
  }
43828
43843
  this.masterSubEmitter?.dispatchEvent({ type: "message", payload: n });
43829
- let o = this.criteriaEntriesBySubscriptionId.get(rt(i.subscription));
43844
+ let o = this.criteriaEntriesBySubscriptionId.get(Te(i.subscription));
43830
43845
  if (!o) {
43831
43846
  console.warn("Received notification for criteria the SubscriptionManager is not listening for");
43832
43847
  return;
@@ -43839,7 +43854,7 @@ var At = class {
43839
43854
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent(i);
43840
43855
  }
43841
43856
  }), e.addEventListener("error", () => {
43842
- let t = { type: "error", payload: new f(Hr(new Error("WebSocket error"))) };
43857
+ let t = { type: "error", payload: new f(Qr(new Error("WebSocket error"))) };
43843
43858
  this.masterSubEmitter?.dispatchEvent(t);
43844
43859
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent(t);
43845
43860
  }), e.addEventListener("close", () => {
@@ -43866,7 +43881,7 @@ var At = class {
43866
43881
  }
43867
43882
  async getTokenForCriteria(e) {
43868
43883
  let t = e?.subscriptionId;
43869
- t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${se(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
43884
+ t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${ce(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
43870
43885
  let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`), i = n?.find((s) => s.name === "token")?.valueString, o = n?.find((s) => s.name === "websocket-url")?.valueUrl;
43871
43886
  if (!i) throw new f(h("Failed to get token"));
43872
43887
  if (!o) throw new f(h("Failed to get URL from $get-ws-binding-token"));
@@ -43876,7 +43891,7 @@ var At = class {
43876
43891
  let n = this.criteriaEntries.get(e);
43877
43892
  if (n) {
43878
43893
  if (!t) return n.bareCriteria;
43879
- for (let i of n.criteriaWithProps) if (Y(t, i.subscriptionProps)) return i;
43894
+ for (let i of n.criteriaWithProps) if (X(t, i.subscriptionProps)) return i;
43880
43895
  }
43881
43896
  }
43882
43897
  getAllCriteriaEmitters() {
@@ -43897,7 +43912,7 @@ var At = class {
43897
43912
  let s = this.criteriaEntries.get(t);
43898
43913
  n ? s.criteriaWithProps = s.criteriaWithProps.filter((a2) => {
43899
43914
  let c = a2.subscriptionProps;
43900
- return !Y(n, c);
43915
+ return !X(n, c);
43901
43916
  }) : s.bareCriteria = void 0, !s.bareCriteria && s.criteriaWithProps.length === 0 && (this.criteriaEntries.delete(t), this.masterSubEmitter?._removeCriteria(t)), i && this.criteriaEntriesBySubscriptionId.delete(i), o && this.ws.send(JSON.stringify({ type: "unbind-from-token", payload: { token: o } }));
43902
43917
  }
43903
43918
  addCriteria(e, t) {
@@ -43929,25 +43944,25 @@ var At = class {
43929
43944
  return this.masterSubEmitter || (this.masterSubEmitter = new qe(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
43930
43945
  }
43931
43946
  };
43932
- var td = "3.1.10-7ae504bff";
43933
- var ks = k.FHIR_JSON + ", */*; q=0.1";
43934
- var Vs = "https://api.medplum.com/";
43935
- var Ds = 1e3;
43936
- var Ms = 6e4;
43937
- var Ns = 0;
43938
- var Fs = "Binary/";
43939
- var ni = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
43940
- var Ls = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(Ls || {});
43941
- var _s = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(_s || {});
43942
- var Us = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(Us || {});
43943
- var Bs = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Bs || {});
43944
- var Ot = class extends Ue {
43947
+ var sd = "3.1.11-4bc60483a";
43948
+ var Vs = V.FHIR_JSON + ", */*; q=0.1";
43949
+ var Ds = "https://api.medplum.com/";
43950
+ var Ms = 1e3;
43951
+ var Ns = 6e4;
43952
+ var Fs = 0;
43953
+ var Ls = "Binary/";
43954
+ var ii = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
43955
+ var _s = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(_s || {});
43956
+ var Us = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(Us || {});
43957
+ var Bs = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(Bs || {});
43958
+ var qs = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(qs || {});
43959
+ var At = class extends z {
43945
43960
  constructor(t) {
43946
43961
  super();
43947
43962
  this.initComplete = true;
43948
43963
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
43949
- this.options = t ?? {}, this.fetch = t?.fetch ?? qs(), this.storage = t?.storage ?? new Be(), this.createPdfImpl = t?.createPdf, this.baseUrl = fr(t?.baseUrl ?? Vs), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? Ns : Ms), this.cacheTime > 0 ? this.requestCache = new bt(t?.resourceCacheSize ?? Ds) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve()) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
43950
- t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true;
43964
+ this.options = t ?? {}, this.fetch = t?.fetch ?? js(), this.storage = t?.storage ?? new Be(), this.createPdfImpl = t?.createPdf, this.baseUrl = dr(t?.baseUrl ?? Ds), this.fhirBaseUrl = j(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = j(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = j(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = j(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? Fs : Ns), this.cacheTime > 0 ? this.requestCache = new Et(t?.resourceCacheSize ?? Ms) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
43965
+ t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
43951
43966
  }).catch(console.error)), this.setupStorageListener();
43952
43967
  }
43953
43968
  get isInitialized() {
@@ -43985,7 +44000,7 @@ var Ot = class extends Ue {
43985
44000
  this.requestCache?.clear();
43986
44001
  }
43987
44002
  invalidateSearches(t) {
43988
- let n = q(this.fhirBaseUrl, t);
44003
+ let n = j(this.fhirBaseUrl, t);
43989
44004
  if (this.requestCache) for (let i of this.requestCache.keys()) (i.endsWith(n) || i.includes(n + "?")) && this.requestCache.delete(i);
43990
44005
  }
43991
44006
  get(t, n = {}) {
@@ -43996,7 +44011,7 @@ var Ot = class extends Ue {
43996
44011
  t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a2, c) => {
43997
44012
  this.autoBatchQueue.push({ method: "GET", url: t.replace(this.fhirBaseUrl, ""), options: n, resolve: a2, reject: c }), this.autoBatchTimerId || (this.autoBatchTimerId = setTimeout(() => this.executeAutoBatch(), this.autoBatchTime));
43998
44013
  }) : o = this.request("GET", t, n);
43999
- let s = new V(o);
44014
+ let s = new D(o);
44000
44015
  return this.setCacheEntry(t, s), s;
44001
44016
  }
44002
44017
  post(t, n, i, o = {}) {
@@ -44006,7 +44021,7 @@ var Ot = class extends Ue {
44006
44021
  return t = t.toString(), this.setRequestBody(o, n), i && this.setRequestContentType(o, i), this.invalidateUrl(t), this.request("PUT", t, o);
44007
44022
  }
44008
44023
  patch(t, n, i = {}) {
44009
- return t = t.toString(), this.setRequestBody(i, n), this.setRequestContentType(i, k.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i);
44024
+ return t = t.toString(), this.setRequestBody(i, n), this.setRequestContentType(i, V.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i);
44010
44025
  }
44011
44026
  delete(t, n) {
44012
44027
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -44064,16 +44079,16 @@ var Ot = class extends Ue {
44064
44079
  return a2.toString();
44065
44080
  }
44066
44081
  fhirUrl(...t) {
44067
- return new URL(q(this.fhirBaseUrl, t.join("/")));
44082
+ return new URL(j(this.fhirBaseUrl, t.join("/")));
44068
44083
  }
44069
44084
  fhirSearchUrl(t, n) {
44070
44085
  let i = this.fhirUrl(t);
44071
- return n && (i.search = In(n)), i;
44086
+ return n && (i.search = kn(n)), i;
44072
44087
  }
44073
44088
  search(t, n, i) {
44074
44089
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a2 = this.getCacheEntry(s, i);
44075
44090
  if (a2) return a2.value;
44076
- let c = new V((async () => {
44091
+ let c = new D((async () => {
44077
44092
  let u2 = await this.get(o, i);
44078
44093
  if (u2.entry) for (let p2 of u2.entry) this.cacheResource(p2.resource);
44079
44094
  return u2;
@@ -44085,13 +44100,13 @@ var Ot = class extends Ue {
44085
44100
  o.searchParams.set("_count", "1"), o.searchParams.sort();
44086
44101
  let s = "searchOne-" + o.toString(), a2 = this.getCacheEntry(s, i);
44087
44102
  if (a2) return a2.value;
44088
- let c = new V(this.search(t, o.searchParams, i).then((u2) => u2.entry?.[0]?.resource));
44103
+ let c = new D(this.search(t, o.searchParams, i).then((u2) => u2.entry?.[0]?.resource));
44089
44104
  return this.setCacheEntry(s, c), c;
44090
44105
  }
44091
44106
  searchResources(t, n, i) {
44092
44107
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i);
44093
44108
  if (a2) return a2.value;
44094
- let c = new V(this.search(t, n, i).then(kr));
44109
+ let c = new D(this.search(t, n, i).then(kr));
44095
44110
  return this.setCacheEntry(s, c), c;
44096
44111
  }
44097
44112
  async *searchResourcePages(t, n, i) {
@@ -44116,7 +44131,7 @@ var Ot = class extends Ue {
44116
44131
  getCachedReference(t) {
44117
44132
  let n = t.reference;
44118
44133
  if (!n) return;
44119
- if (n === "system") return ni;
44134
+ if (n === "system") return ii;
44120
44135
  let [i, o] = n.split("/");
44121
44136
  if (!(!i || !o)) return this.getCached(i, o);
44122
44137
  }
@@ -44125,16 +44140,16 @@ var Ot = class extends Ue {
44125
44140
  }
44126
44141
  readReference(t, n) {
44127
44142
  let i = t.reference;
44128
- if (!i) return new V(Promise.reject(new Error("Missing reference")));
44129
- if (i === "system") return new V(Promise.resolve(ni));
44143
+ if (!i) return new D(Promise.reject(new Error("Missing reference")));
44144
+ if (i === "system") return new D(Promise.resolve(ii));
44130
44145
  let [o, s] = i.split("/");
44131
- return !o || !s ? new V(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
44146
+ return !o || !s ? new D(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
44132
44147
  }
44133
44148
  requestSchema(t) {
44134
- if (nn(t)) return Promise.resolve();
44149
+ if (on(t)) return Promise.resolve();
44135
44150
  let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
44136
44151
  if (i) return i.value;
44137
- let o = new V((async () => {
44152
+ let o = new D((async () => {
44138
44153
  let s = `{
44139
44154
  StructureDefinitionList(name: "${t}") {
44140
44155
  resourceType,
@@ -44175,24 +44190,24 @@ var Ot = class extends Ue {
44175
44190
  target
44176
44191
  }
44177
44192
  }`.replace(/\s+/g, " "), a2 = await this.graphql(s);
44178
- Jt(a2.data.StructureDefinitionList);
44179
- for (let c of a2.data.SearchParameterList) yr(c);
44193
+ zt(a2.data.StructureDefinitionList);
44194
+ for (let c of a2.data.SearchParameterList) hr(c);
44180
44195
  })());
44181
44196
  return this.setCacheEntry(n, o), o;
44182
44197
  }
44183
44198
  requestProfileSchema(t, n) {
44184
- if (!n?.expandProfile && sn(t)) return Promise.resolve([t]);
44199
+ if (!n?.expandProfile && an(t)) return Promise.resolve([t]);
44185
44200
  let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i, void 0);
44186
44201
  if (o) return o.value;
44187
- let s = new V((async () => {
44202
+ let s = new D((async () => {
44188
44203
  if (n?.expandProfile) {
44189
44204
  let a2 = this.fhirUrl("StructureDefinition", "$expand-profile");
44190
44205
  a2.search = new URLSearchParams({ url: t }).toString();
44191
44206
  let c = await this.post(a2.toString(), {});
44192
- return kr(c).map((u2) => (Yt(u2, u2.url), u2.url));
44207
+ return kr(c).map((u2) => (Jt(u2, u2.url), u2.url));
44193
44208
  } else {
44194
44209
  let a2 = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
44195
- return a2 ? (Jt([a2], t), [t]) : (console.warn(`No StructureDefinition found for ${t}!`), []);
44210
+ return a2 ? (zt([a2], t), [t]) : (console.warn(`No StructureDefinition found for ${t}!`), []);
44196
44211
  }
44197
44212
  })());
44198
44213
  return this.setCacheEntry(i, s), s;
@@ -44218,12 +44233,12 @@ var Ot = class extends Ue {
44218
44233
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
44219
44234
  }
44220
44235
  async createAttachment(t, n, i, o, s) {
44221
- let a2 = si(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
44236
+ let a2 = ai(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
44222
44237
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
44223
44238
  }
44224
44239
  createBinary(t, n, i, o, s) {
44225
- let a2 = si(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p2, filename: m2, securityContext: g, onProgress: G } = a2, Oe = this.fhirUrl("Binary");
44226
- return m2 && Oe.searchParams.set("_filename", m2), g?.reference && this.setRequestHeader(c, "X-Security-Context", g.reference), G ? this.uploadwithProgress(Oe, u2, p2, G, c) : this.post(Oe, u2, p2, c);
44240
+ let a2 = ai(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p2, filename: m2, securityContext: g, onProgress: G } = a2, Ie = this.fhirUrl("Binary");
44241
+ return m2 && Ie.searchParams.set("_filename", m2), g?.reference && this.setRequestHeader(c, "X-Security-Context", g.reference), G ? this.uploadwithProgress(Ie, u2, p2, G, c) : this.post(Ie, u2, p2, c);
44227
44242
  }
44228
44243
  uploadwithProgress(t, n, i, o, s) {
44229
44244
  return new Promise((a2, c) => {
@@ -44236,19 +44251,19 @@ var Ot = class extends Ue {
44236
44251
  u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new f(ze(u2.response || u2.statusText)));
44237
44252
  }, u2.open("POST", t), u2.withCredentials = true, u2.setRequestHeader("Authorization", "Bearer " + this.accessToken), u2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), u2.setRequestHeader("Content-Type", i), u2.setRequestHeader("X-Medplum", "extended"), s?.headers) {
44238
44253
  let g = s.headers;
44239
- for (let [G, Oe] of Object.entries(g)) u2.setRequestHeader(G, Oe);
44254
+ for (let [G, Ie] of Object.entries(g)) u2.setRequestHeader(G, Ie);
44240
44255
  }
44241
44256
  u2.send(n);
44242
44257
  });
44243
44258
  }
44244
44259
  async createPdf(t, n, i, o) {
44245
44260
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
44246
- let s = Ws(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p2, ...m2 } = s, g = await this.createPdfImpl(c, u2, p2), G = { ...m2, data: g, contentType: "application/pdf" };
44261
+ let s = Gs(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p2, ...m2 } = s, g = await this.createPdfImpl(c, u2, p2), G = { ...m2, data: g, contentType: "application/pdf" };
44247
44262
  return this.createBinary(G, a2);
44248
44263
  }
44249
44264
  createComment(t, n, i) {
44250
44265
  let o = this.getProfile(), s, a2;
44251
- return t.resourceType === "Encounter" && (s = Z(t), a2 = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a2 = t.subject), t.resourceType === "Patient" && (a2 = Z(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [Z(t)], encounter: s, subject: a2, sender: o ? Z(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
44266
+ return t.resourceType === "Encounter" && (s = ee(t), a2 = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a2 = t.subject), t.resourceType === "Patient" && (a2 = ee(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [ee(t)], encounter: s, subject: a2, sender: o ? ee(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
44252
44267
  }
44253
44268
  async updateResource(t, n) {
44254
44269
  if (!t.resourceType) throw new Error("Missing resourceType");
@@ -44280,28 +44295,28 @@ var Ot = class extends Ue {
44280
44295
  return this.post(this.fhirBaseUrl, t, void 0, n);
44281
44296
  }
44282
44297
  sendEmail(t, n) {
44283
- return this.post("email/v1/send", t, k.JSON, n);
44298
+ return this.post("email/v1/send", t, V.JSON, n);
44284
44299
  }
44285
44300
  graphql(t, n, i, o) {
44286
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i }, k.JSON, o);
44301
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i }, V.JSON, o);
44287
44302
  }
44288
44303
  readResourceGraph(t, n, i, o) {
44289
44304
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i}`, o);
44290
44305
  }
44291
44306
  pushToAgent(t, n, i, o, s, a2) {
44292
- return this.post(this.fhirUrl("Agent", rt(t), "$push"), { destination: typeof n == "string" ? n : se(n), body: i, contentType: o, waitForResponse: s }, k.FHIR_JSON, a2);
44307
+ return this.post(this.fhirUrl("Agent", Te(t), "$push"), { destination: typeof n == "string" ? n : ce(n), body: i, contentType: o, waitForResponse: s }, V.FHIR_JSON, a2);
44293
44308
  }
44294
44309
  getActiveLogin() {
44295
44310
  return this.storage.getObject("activeLogin");
44296
44311
  }
44297
44312
  async setActiveLogin(t) {
44298
- (!this.sessionDetails?.profile || se(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
44313
+ (!this.sessionDetails?.profile || ce(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
44299
44314
  }
44300
44315
  getAccessToken() {
44301
44316
  return this.accessToken;
44302
44317
  }
44303
44318
  setAccessToken(t, n) {
44304
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = ei(t), this.medplumServer = Xn(t);
44319
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = ti(t), this.medplumServer = ei(t);
44305
44320
  }
44306
44321
  getLogins() {
44307
44322
  return this.storage.getObject("logins") ?? [];
@@ -44312,10 +44327,10 @@ var Ot = class extends Ue {
44312
44327
  }
44313
44328
  async refreshProfile() {
44314
44329
  return this.medplumServer ? (this.profilePromise = new Promise((t, n) => {
44315
- this.get("auth/me").then((i) => {
44330
+ this.dispatchEvent({ type: "profileRefreshing" }), this.get("auth/me").then((i) => {
44316
44331
  this.profilePromise = void 0;
44317
44332
  let o = this.sessionDetails?.profile?.id !== i.profile.id;
44318
- this.sessionDetails = i, o && this.dispatchEvent({ type: "change" }), t(i.profile);
44333
+ this.sessionDetails = i, o && this.dispatchEvent({ type: "change" }), this.dispatchEvent({ type: "profileRefreshed" }), t(i.profile);
44319
44334
  }).catch(n);
44320
44335
  }), this.profilePromise) : Promise.resolve(void 0);
44321
44336
  }
@@ -44349,13 +44364,13 @@ var Ot = class extends Ue {
44349
44364
  async download(t, n = {}) {
44350
44365
  this.refreshPromise && await this.refreshPromise;
44351
44366
  let i = t.toString();
44352
- i.startsWith(Fs) && (t = this.fhirUrl(i));
44367
+ i.startsWith(Ls) && (t = this.fhirUrl(i));
44353
44368
  let o = n.headers;
44354
44369
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
44355
44370
  }
44356
44371
  async createMedia(t, n) {
44357
44372
  let { additionalFields: i, ...o } = t, s = await this.createResource({ resourceType: "Media", status: "preparation", content: { contentType: t.contentType }, ...i });
44358
- o.securityContext || (o.securityContext = Z(s));
44373
+ o.securityContext || (o.securityContext = ee(s));
44359
44374
  let a2 = await this.createAttachment(o, n);
44360
44375
  return this.updateResource({ ...s, status: "completed", content: a2 });
44361
44376
  }
@@ -44372,7 +44387,7 @@ var Ot = class extends Ue {
44372
44387
  return i.Prefer = "respond-async", this.request("POST", t, n);
44373
44388
  }
44374
44389
  get keyValue() {
44375
- return this.keyValueClient || (this.keyValueClient = new wt(this)), this.keyValueClient;
44390
+ return this.keyValueClient || (this.keyValueClient = new Ct(this)), this.keyValueClient;
44376
44391
  }
44377
44392
  getCacheEntry(t, n) {
44378
44393
  if (!this.requestCache || n?.cache === "no-cache" || n?.cache === "reload") return;
@@ -44383,7 +44398,7 @@ var Ot = class extends Ue {
44383
44398
  this.requestCache && this.requestCache.set(t, { requestTime: Date.now(), value: n });
44384
44399
  }
44385
44400
  cacheResource(t) {
44386
- t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new V(Promise.resolve(t)));
44401
+ t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new D(Promise.resolve(t)));
44387
44402
  }
44388
44403
  deleteCacheEntry(t) {
44389
44404
  this.requestCache && this.requestCache.delete(t);
@@ -44394,14 +44409,14 @@ var Ot = class extends Ue {
44394
44409
  if (s.status === 401) return this.handleUnauthenticated(t, n, i);
44395
44410
  if (s.status === 204 || s.status === 304) return;
44396
44411
  let c = s.headers.get("content-type")?.includes("json");
44397
- if (s.status === 404 && !c) throw new f(Gr);
44412
+ if (s.status === 404 && !c) throw new f(Hr);
44398
44413
  let u2 = await this.parseBody(s, c);
44399
44414
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
44400
- let p2 = await oi(s, u2);
44415
+ let p2 = await si(s, u2);
44401
44416
  if (p2) return this.request("GET", p2, { ...i, body: void 0 });
44402
44417
  }
44403
44418
  if (s.status === 202 && i.pollStatusOnAccepted) {
44404
- let m2 = await oi(s, u2) ?? o.statusUrl;
44419
+ let m2 = await si(s, u2) ?? o.statusUrl;
44405
44420
  if (m2) return this.pollStatus(m2, i, o);
44406
44421
  }
44407
44422
  if (s.status >= 400) throw new f(ze(u2));
@@ -44418,22 +44433,24 @@ var Ot = class extends Ue {
44418
44433
  return i;
44419
44434
  }
44420
44435
  async fetchWithRetry(t, n) {
44421
- t.startsWith("http") || (t = q(this.baseUrl, t));
44422
- let i = 3, o = 200, s;
44423
- for (let a2 = 0; a2 < i; a2++) {
44436
+ t.startsWith("http") || (t = j(this.baseUrl, t));
44437
+ let i = n?.maxRetries ?? 2, o = 200;
44438
+ for (let s = 0; s <= i; s++) {
44424
44439
  try {
44425
- if (this.options.verbose && this.logRequest(t, n), s = await this.fetch(t, n), this.options.verbose && this.logResponse(s), s.status < 500) return s;
44426
- } catch (c) {
44427
- this.retryCatch(a2, i, c);
44440
+ this.options.verbose && this.logRequest(t, n);
44441
+ let a2 = await this.fetch(t, n);
44442
+ if (this.options.verbose && this.logResponse(a2), a2.status < 500 || s === i) return a2;
44443
+ } catch (a2) {
44444
+ if (a2.message === "Failed to fetch" && s === 0 && this.dispatchEvent({ type: "offline" }), a2.name === "AbortError" || s === i) throw a2;
44428
44445
  }
44429
- await pr(o);
44446
+ await lr(o);
44430
44447
  }
44431
- return s;
44448
+ throw new Error("Unreachable");
44432
44449
  }
44433
44450
  logRequest(t, n) {
44434
44451
  if (console.log(`> ${n.method} ${t}`), n.headers) {
44435
44452
  let i = n.headers;
44436
- for (let o of it(Object.keys(i))) console.log(`> ${o}: ${i[o]}`);
44453
+ for (let o of nt(Object.keys(i))) console.log(`> ${o}: ${i[o]}`);
44437
44454
  }
44438
44455
  }
44439
44456
  logResponse(t) {
@@ -44444,7 +44461,7 @@ var Ot = class extends Ue {
44444
44461
  if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o.headers = { ...n.headers }, delete o.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
44445
44462
  else {
44446
44463
  let s = n.pollStatusPeriod ?? 1e3;
44447
- await pr(s), i.pollCount++;
44464
+ await lr(s), i.pollCount++;
44448
44465
  }
44449
44466
  return this.request("GET", t, o, i);
44450
44467
  }
@@ -44453,7 +44470,7 @@ var Ot = class extends Ue {
44453
44470
  if (this.autoBatchQueue.length = 0, this.autoBatchTimerId = void 0, t.length === 1) {
44454
44471
  let o = t[0];
44455
44472
  try {
44456
- o.resolve(await this.request(o.method, q(this.fhirBaseUrl, o.url), o.options));
44473
+ o.resolve(await this.request(o.method, j(this.fhirBaseUrl, o.url), o.options));
44457
44474
  } catch (s) {
44458
44475
  o.reject(new f(ze(s)));
44459
44476
  }
@@ -44462,11 +44479,11 @@ var Ot = class extends Ue {
44462
44479
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
44463
44480
  for (let o = 0; o < t.length; o++) {
44464
44481
  let s = t[o], a2 = i.entry?.[o];
44465
- a2?.response?.outcome && !$t(a2.response.outcome) ? s.reject(new f(a2.response.outcome)) : s.resolve(a2?.resource);
44482
+ a2?.response?.outcome && !jt(a2.response.outcome) ? s.reject(new f(a2.response.outcome)) : s.resolve(a2?.resource);
44466
44483
  }
44467
44484
  }
44468
44485
  addFetchOptionsDefaults(t) {
44469
- this.setRequestHeader(t, "X-Medplum", "extended"), this.setRequestHeader(t, "Accept", ks, true), t.body && this.setRequestHeader(t, "Content-Type", k.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
44486
+ this.setRequestHeader(t, "X-Medplum", "extended"), this.setRequestHeader(t, "Accept", Vs, true), t.body && this.setRequestHeader(t, "Content-Type", V.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
44470
44487
  }
44471
44488
  setRequestContentType(t, n) {
44472
44489
  this.setRequestHeader(t, "Content-Type", n);
@@ -44483,20 +44500,20 @@ var Ot = class extends Ue {
44483
44500
  return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
44484
44501
  }
44485
44502
  async startPkce() {
44486
- let t = br();
44503
+ let t = Er();
44487
44504
  sessionStorage.setItem("pkceState", t);
44488
- let n = br();
44505
+ let n = Er();
44489
44506
  sessionStorage.setItem("codeVerifier", n);
44490
- let i = await Hn(n), o = Pn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
44507
+ let i = await Qn(n), o = Cn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
44491
44508
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
44492
44509
  }
44493
44510
  async requestAuthorization(t) {
44494
44511
  let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
44495
- i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? ii()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
44512
+ i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? oi()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
44496
44513
  }
44497
44514
  processCode(t, n) {
44498
44515
  let i = new URLSearchParams();
44499
- if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? ii()), typeof sessionStorage < "u") {
44516
+ if (i.set("grant_type", "authorization_code"), i.set("code", t), i.set("client_id", n?.clientId ?? this.clientId), i.set("redirect_uri", n?.redirectUri ?? oi()), typeof sessionStorage < "u") {
44500
44517
  let o = sessionStorage.getItem("codeVerifier");
44501
44518
  o && i.set("code_verifier", o);
44502
44519
  }
@@ -44528,25 +44545,25 @@ var Ot = class extends Ue {
44528
44545
  return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
44529
44546
  }
44530
44547
  setBasicAuth(t, n) {
44531
- this.clientId = t, this.clientSecret = n, this.basicAuth = Gn(t + ":" + n);
44548
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Hn(t + ":" + n);
44532
44549
  }
44533
44550
  async fhircastSubscribe(t, n) {
44534
44551
  if (!(typeof t == "string" && t !== "")) throw new f(h("Invalid topic provided. Topic must be a valid string."));
44535
44552
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new f(h("Invalid events provided. Events must be an array of event names containing at least one event."));
44536
- let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Cr(i), k.FORM_URL_ENCODED))["hub.channel.endpoint"];
44553
+ let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Cr(i), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
44537
44554
  if (!s) throw new Error("Invalid response!");
44538
44555
  return i.endpoint = s, i;
44539
44556
  }
44540
44557
  async fhircastUnsubscribe(t) {
44541
- if (!Pt(t)) throw new f(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
44558
+ if (!Rt(t)) throw new f(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
44542
44559
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new f(h("Provided subscription request must have an endpoint in order to unsubscribe."));
44543
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", Cr(t), k.FORM_URL_ENCODED);
44560
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", Cr(t), V.FORM_URL_ENCODED);
44544
44561
  }
44545
44562
  fhircastConnect(t) {
44546
- return new Rt(t);
44563
+ return new bt(t);
44547
44564
  }
44548
44565
  async fhircastPublish(t, n, i, o) {
44549
- return zn(n) ? this.post(`/fhircast/STU3/${t}`, wr(t, n, i, o), k.JSON) : (Jn(n), this.post(`/fhircast/STU3/${t}`, wr(t, n, i), k.JSON));
44566
+ return Jn(n) ? this.post(`/fhircast/STU3/${t}`, wr(t, n, i, o), V.JSON) : (Yn(n), this.post(`/fhircast/STU3/${t}`, wr(t, n, i), V.JSON));
44550
44567
  }
44551
44568
  async fhircastGetContext(t) {
44552
44569
  return this.get(`/fhircast/STU3/${t}`);
@@ -44555,7 +44572,7 @@ var Ot = class extends Ue {
44555
44572
  return this.post("admin/projects/" + t + "/invite", n);
44556
44573
  }
44557
44574
  async fetchTokens(t) {
44558
- let n = { method: "POST", headers: { "Content-Type": k.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i = n.headers;
44575
+ let n = { method: "POST", headers: { "Content-Type": V.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i = n.headers;
44559
44576
  this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`);
44560
44577
  let o;
44561
44578
  try {
@@ -44577,8 +44594,8 @@ var Ot = class extends Ue {
44577
44594
  }
44578
44595
  async verifyTokens(t) {
44579
44596
  let n = t.access_token;
44580
- if (Zn(n)) {
44581
- let i = Ct(n);
44597
+ if (Xn(n)) {
44598
+ let i = Pt(n);
44582
44599
  if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new Error("Token expired");
44583
44600
  if (i.cid) {
44584
44601
  if (i.cid !== this.clientId) throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
@@ -44594,11 +44611,8 @@ var Ot = class extends Ue {
44594
44611
  } catch {
44595
44612
  }
44596
44613
  }
44597
- retryCatch(t, n, i) {
44598
- if (i.message === "Failed to fetch" && t === 1 && this.dispatchEvent({ type: "offline" }), t >= n - 1) throw i;
44599
- }
44600
44614
  getSubscriptionManager() {
44601
- return this.subscriptionManager || (this.subscriptionManager = new At(this, On(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
44615
+ return this.subscriptionManager || (this.subscriptionManager = new wt(this, In(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
44602
44616
  }
44603
44617
  subscribeToCriteria(t, n) {
44604
44618
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -44610,41 +44624,41 @@ var Ot = class extends Ue {
44610
44624
  return this.getSubscriptionManager().getMasterEmitter();
44611
44625
  }
44612
44626
  };
44613
- function qs() {
44627
+ function js() {
44614
44628
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
44615
44629
  return globalThis.fetch.bind(globalThis);
44616
44630
  }
44617
- function ii() {
44631
+ function oi() {
44618
44632
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
44619
44633
  }
44620
- async function oi(r6, e) {
44634
+ async function si(r6, e) {
44621
44635
  let t = r6.headers.get("content-location");
44622
44636
  if (t) return t;
44623
44637
  let n = r6.headers.get("location");
44624
44638
  if (n) return n;
44625
- if (ye(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
44639
+ if (ge(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
44626
44640
  }
44627
44641
  function kr(r6) {
44628
44642
  let e = r6.entry?.map((t) => t.resource) ?? [];
44629
44643
  return Object.assign(e, { bundle: r6 });
44630
44644
  }
44631
- function js(r6) {
44645
+ function $s(r6) {
44632
44646
  return b(r6) && "data" in r6 && "contentType" in r6;
44633
44647
  }
44634
- function si(r6, e, t, n) {
44635
- return js(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
44648
+ function ai(r6, e, t, n) {
44649
+ return $s(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
44636
44650
  }
44637
- function $s(r6) {
44651
+ function Ws(r6) {
44638
44652
  return b(r6) && "docDefinition" in r6;
44639
44653
  }
44640
- function Ws(r6, e, t, n) {
44641
- return $s(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
44654
+ function Gs(r6, e, t, n) {
44655
+ return Ws(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
44642
44656
  }
44643
- var ra = [...Fe, "->", "<<", ">>", "=="];
44644
- var oa = Le().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
44645
- var Sa = [...Fe, "eq", "ne", "co"];
44646
- var Ra = Le();
44647
- var ne = class {
44657
+ var na = [...Le, "->", "<<", ">>", "=="];
44658
+ var sa = _e().registerInfix("->", { precedence: y.Arrow }).registerInfix(";", { precedence: y.Semicolon });
44659
+ var Ea = [...Le, "eq", "ne", "co"];
44660
+ var Pa = _e();
44661
+ var oe = class {
44648
44662
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
44649
44663
  this.segmentSeparator = e;
44650
44664
  this.fieldSeparator = t;
@@ -44660,8 +44674,8 @@ var ne = class {
44660
44674
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
44661
44675
  }
44662
44676
  };
44663
- var Ei = class r {
44664
- constructor(e, t = new ne()) {
44677
+ var bi = class r {
44678
+ constructor(e, t = new oe()) {
44665
44679
  this.context = t, this.segments = e;
44666
44680
  }
44667
44681
  get header() {
@@ -44684,7 +44698,7 @@ var Ei = class r {
44684
44698
  }
44685
44699
  buildAck() {
44686
44700
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a2 = t?.getField(10)?.toString() ?? "", c = t?.getField(12)?.toString() ?? "2.5.1";
44687
- return new r([new We(["MSH", this.context.getMsh2(), o, s, n, i, Ca(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new We(["MSA", "AA", a2, "OK"], this.context)]);
44701
+ return new r([new We(["MSH", this.context.getMsh2(), o, s, n, i, wa(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new We(["MSA", "AA", a2, "OK"], this.context)]);
44688
44702
  }
44689
44703
  buildAckMessageType(e) {
44690
44704
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -44695,21 +44709,21 @@ var Ei = class r {
44695
44709
  let n = new Error("Invalid HL7 message");
44696
44710
  throw n.type = "entity.parse.failed", n;
44697
44711
  }
44698
- let t = new ne("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
44712
+ let t = new oe("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
44699
44713
  return new r(e.split(/[\r\n]+/).map((n) => We.parse(n, t)), t);
44700
44714
  }
44701
44715
  };
44702
44716
  var We = class r2 {
44703
- constructor(e, t = new ne()) {
44704
- this.context = t, En(e) ? this.fields = e.map((n) => Ae.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
44717
+ constructor(e, t = new oe()) {
44718
+ this.context = t, bn(e) ? this.fields = e.map((n) => Oe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
44705
44719
  }
44706
44720
  get(e) {
44707
44721
  return this.fields[e];
44708
44722
  }
44709
44723
  getField(e) {
44710
44724
  if (this.name === "MSH") {
44711
- if (e === 1) return new Ae([[this.context.getMsh1()]], this.context);
44712
- if (e === 2) return new Ae([[this.context.getMsh2()]], this.context);
44725
+ if (e === 1) return new Oe([[this.context.getMsh1()]], this.context);
44726
+ if (e === 2) return new Oe([[this.context.getMsh2()]], this.context);
44713
44727
  if (e > 2) return this.fields[e - 1];
44714
44728
  }
44715
44729
  return this.fields[e];
@@ -44720,12 +44734,12 @@ var We = class r2 {
44720
44734
  toString() {
44721
44735
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
44722
44736
  }
44723
- static parse(e, t = new ne()) {
44724
- return new r2(e.split(t.fieldSeparator).map((n) => Ae.parse(n, t)), t);
44737
+ static parse(e, t = new oe()) {
44738
+ return new r2(e.split(t.fieldSeparator).map((n) => Oe.parse(n, t)), t);
44725
44739
  }
44726
44740
  };
44727
- var Ae = class r3 {
44728
- constructor(e, t = new ne()) {
44741
+ var Oe = class r3 {
44742
+ constructor(e, t = new oe()) {
44729
44743
  this.context = t, this.components = e;
44730
44744
  }
44731
44745
  get(e, t, n = 0) {
@@ -44738,16 +44752,16 @@ var Ae = class r3 {
44738
44752
  toString() {
44739
44753
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
44740
44754
  }
44741
- static parse(e, t = new ne()) {
44755
+ static parse(e, t = new oe()) {
44742
44756
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
44743
44757
  }
44744
44758
  };
44745
- function Ca(r6) {
44759
+ function wa(r6) {
44746
44760
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
44747
44761
  return i > 0 && (n += "." + i.toString()), n;
44748
44762
  }
44749
44763
  var Fr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(Fr || {});
44750
- var bi = class r4 {
44764
+ var Ri = class r4 {
44751
44765
  constructor(e, t = {}, n = 3, i) {
44752
44766
  this.write = e;
44753
44767
  this.metadata = t;
@@ -44780,7 +44794,7 @@ var bi = class r4 {
44780
44794
  `) }), this.write(JSON.stringify({ level: Fr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
44781
44795
  }
44782
44796
  };
44783
- function mf(r6) {
44797
+ function vf(r6) {
44784
44798
  let e = Fr[r6.toUpperCase()];
44785
44799
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
44786
44800
  return e;
@@ -44829,7 +44843,7 @@ var p = class extends a {
44829
44843
  e.on("data", (s) => {
44830
44844
  try {
44831
44845
  if (this.appendData(s), s.at(-2) === 28 && s.at(-1) === 13) {
44832
- let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g = Ei.parse(f2);
44846
+ let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), f2 = (0, import_iconv_lite.decode)(i, this.encoding), g = bi.parse(f2);
44833
44847
  this.dispatchEvent(new d2(this, g)), this.resetBuffer();
44834
44848
  }
44835
44849
  } catch (o) {
@@ -45069,19 +45083,19 @@ var AgentDicomChannel = class extends BaseChannel {
45069
45083
  calledAeTitle: this.association?.getCalledAeTitle()
45070
45084
  },
45071
45085
  dataset: dicomJson,
45072
- binary: binary ? Z(binary) : void 0
45086
+ binary: binary ? ee(binary) : void 0
45073
45087
  };
45074
45088
  App.instance.addToWebSocketQueue({
45075
45089
  type: "agent:transmit:request",
45076
45090
  accessToken: "placeholder",
45077
45091
  channel: DcmjsDimseScp.channel.getDefinition().name,
45078
45092
  remote: this.association?.getCallingAeTitle(),
45079
- contentType: k.JSON,
45093
+ contentType: V.JSON,
45080
45094
  body: JSON.stringify(payload)
45081
45095
  });
45082
45096
  response.setStatus(dimse.constants.Status.Success);
45083
45097
  } catch (err) {
45084
- DcmjsDimseScp.channel.log.error(`DICOM error: ${Pi(err)}`);
45098
+ DcmjsDimseScp.channel.log.error(`DICOM error: ${Ci(err)}`);
45085
45099
  response.setStatus(dimse.constants.Status.ProcessingFailure);
45086
45100
  }
45087
45101
  return response;
@@ -45156,7 +45170,7 @@ var AgentHl7Channel = class extends BaseChannel {
45156
45170
  sendToRemote(msg) {
45157
45171
  const connection = this.connections.get(msg.remote);
45158
45172
  if (connection) {
45159
- connection.hl7Connection.send(Ei.parse(msg.body));
45173
+ connection.hl7Connection.send(bi.parse(msg.body));
45160
45174
  }
45161
45175
  }
45162
45176
  handleNewConnection(connection) {
@@ -45180,11 +45194,11 @@ var AgentHl7ChannelConnection = class {
45180
45194
  accessToken: "placeholder",
45181
45195
  channel: this.channel.getDefinition().name,
45182
45196
  remote: this.remote,
45183
- contentType: k.HL7_V2,
45197
+ contentType: V.HL7_V2,
45184
45198
  body: event.message.toString()
45185
45199
  });
45186
45200
  } catch (err) {
45187
- this.channel.log.error(`HL7 error: ${Pi(err)}`);
45201
+ this.channel.log.error(`HL7 error: ${Ci(err)}`);
45188
45202
  }
45189
45203
  }
45190
45204
  close() {
@@ -45267,7 +45281,7 @@ async function fetchVersionManifest(version) {
45267
45281
  try {
45268
45282
  message = (await res.json()).message;
45269
45283
  } catch (err) {
45270
- console.error(`Failed to parse message from body: ${Pi(err)}`);
45284
+ console.error(`Failed to parse message from body: ${Ci(err)}`);
45271
45285
  }
45272
45286
  throw new Error(
45273
45287
  `Received status code ${res.status} while fetching manifest for version '${version ?? "latest"}'. Message: ${message}`
@@ -45345,7 +45359,7 @@ var App = class _App {
45345
45359
  this.shutdown = false;
45346
45360
  this.keepAlive = false;
45347
45361
  _App.instance = this;
45348
- this.log = new bi((msg) => console.log(msg), void 0, logLevel);
45362
+ this.log = new Ri((msg) => console.log(msg), void 0, logLevel);
45349
45363
  }
45350
45364
  async start() {
45351
45365
  this.log.info("Medplum service starting...");
@@ -45365,7 +45379,7 @@ var App = class _App {
45365
45379
  if ((0, import_node_fs3.existsSync)(UPGRADE_MANIFEST_PATH)) {
45366
45380
  const upgradeFile = (0, import_node_fs3.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
45367
45381
  const upgradeDetails = JSON.parse(upgradeFile);
45368
- if (upgradeDetails.targetVersion === td.split("-")[0]) {
45382
+ if (upgradeDetails.targetVersion === sd.split("-")[0]) {
45369
45383
  await this.sendToWebSocket({
45370
45384
  type: "agent:upgrade:response",
45371
45385
  statusCode: 200,
@@ -45373,7 +45387,7 @@ var App = class _App {
45373
45387
  });
45374
45388
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
45375
45389
  } else {
45376
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${td}`;
45390
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${sd}`;
45377
45391
  await this.sendToWebSocket({
45378
45392
  type: "agent:error",
45379
45393
  body: errMsg,
@@ -45411,7 +45425,7 @@ var App = class _App {
45411
45425
  this.webSocket.binaryType = "nodebuffer";
45412
45426
  this.webSocket.addEventListener("error", (err) => {
45413
45427
  if (!this.shutdown) {
45414
- this.log.error(`WebSocket closed due to an error: ${Pi(err)}`);
45428
+ this.log.error(`WebSocket closed due to an error: ${Ci(err)}`);
45415
45429
  }
45416
45430
  });
45417
45431
  this.webSocket.addEventListener("open", async () => {
@@ -45442,7 +45456,7 @@ var App = class _App {
45442
45456
  this.startWebSocketWorker();
45443
45457
  break;
45444
45458
  case "agent:heartbeat:request":
45445
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: td });
45459
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: sd });
45446
45460
  break;
45447
45461
  case "agent:heartbeat:response":
45448
45462
  break;
@@ -45458,7 +45472,7 @@ var App = class _App {
45458
45472
  case "agent:transmit:request":
45459
45473
  if (this.config?.status !== "active") {
45460
45474
  this.sendAgentDisabledError(command);
45461
- } else if (command.contentType === k.PING) {
45475
+ } else if (command.contentType === V.PING) {
45462
45476
  await this.tryPingHost(command);
45463
45477
  } else {
45464
45478
  this.pushMessage(command);
@@ -45476,7 +45490,7 @@ var App = class _App {
45476
45490
  } catch (err) {
45477
45491
  await this.sendToWebSocket({
45478
45492
  type: "agent:error",
45479
- body: Pi(err),
45493
+ body: Ci(err),
45480
45494
  callback: command.callback
45481
45495
  });
45482
45496
  }
@@ -45491,7 +45505,7 @@ var App = class _App {
45491
45505
  this.log.error(`Unknown message type: ${command.type}`);
45492
45506
  }
45493
45507
  } catch (err) {
45494
- this.log.error(`WebSocket error on incoming message: ${Pi(err)}`);
45508
+ this.log.error(`WebSocket error on incoming message: ${Ci(err)}`);
45495
45509
  }
45496
45510
  });
45497
45511
  return new Promise((resolve2, reject) => {
@@ -45566,7 +45580,7 @@ var App = class _App {
45566
45580
  try {
45567
45581
  await this.startOrReloadChannel(definition, endpoint);
45568
45582
  } catch (err) {
45569
- this.log.error(Pi(err));
45583
+ this.log.error(Ci(err));
45570
45584
  }
45571
45585
  }
45572
45586
  }
@@ -45592,7 +45606,7 @@ var App = class _App {
45592
45606
  parsedEndpoint = new URL(endpoint.address);
45593
45607
  } catch (err) {
45594
45608
  throw new Error(
45595
- `Error while validating endpoint address for channel '${channel.name}': ${Pi(err)}`
45609
+ `Error while validating endpoint address for channel '${channel.name}': ${Ci(err)}`
45596
45610
  );
45597
45611
  }
45598
45612
  if (seenPorts.has(parsedEndpoint.port)) {
@@ -45675,7 +45689,7 @@ var App = class _App {
45675
45689
  try {
45676
45690
  await this.sendToWebSocket(msg);
45677
45691
  } catch (err) {
45678
- this.log.error(`WebSocket error while attempting to send message: ${Pi(err)}`);
45692
+ this.log.error(`WebSocket error while attempting to send message: ${Ci(err)}`);
45679
45693
  this.webSocketQueue.unshift(msg);
45680
45694
  throw err;
45681
45695
  }
@@ -45712,7 +45726,7 @@ IPv6 is currently unsupported.`;
45712
45726
  this.log.error(errMsg);
45713
45727
  throw new Error(errMsg);
45714
45728
  }
45715
- if (!((0, import_node_net.isIPv4)(message.remote) || mu(message.remote))) {
45729
+ if (!((0, import_node_net.isIPv4)(message.remote) || vu(message.remote))) {
45716
45730
  const errMsg = `Attempted to ping an invalid host.
45717
45731
 
45718
45732
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -45744,22 +45758,22 @@ ${result}`);
45744
45758
  this.addToWebSocketQueue({
45745
45759
  type: "agent:transmit:response",
45746
45760
  channel: message.channel,
45747
- contentType: k.PING,
45761
+ contentType: V.PING,
45748
45762
  remote: message.remote,
45749
45763
  callback: message.callback,
45750
45764
  statusCode: 200,
45751
45765
  body: result
45752
45766
  });
45753
45767
  } catch (err) {
45754
- this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Pi(err)}`);
45768
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ci(err)}`);
45755
45769
  this.addToWebSocketQueue({
45756
45770
  type: "agent:transmit:response",
45757
45771
  channel: message.channel,
45758
- contentType: k.TEXT,
45772
+ contentType: V.TEXT,
45759
45773
  remote: message.remote,
45760
45774
  callback: message.callback,
45761
45775
  statusCode: 400,
45762
- body: Pi(err)
45776
+ body: Ci(err)
45763
45777
  });
45764
45778
  }
45765
45779
  }
@@ -45806,11 +45820,11 @@ ${result}`);
45806
45820
  });
45807
45821
  });
45808
45822
  child.on("error", (err) => {
45809
- this.log.error(Pi(err));
45823
+ this.log.error(Ci(err));
45810
45824
  });
45811
45825
  } catch (err) {
45812
45826
  const versionTag = message.version ? `v${message.version}` : "latest";
45813
- const errMsg = `Error during upgrading to version '${versionTag}': ${Pi(err)}`;
45827
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Ci(err)}`;
45814
45828
  this.log.error(errMsg);
45815
45829
  await this.sendToWebSocket({
45816
45830
  type: "agent:error",
@@ -45823,11 +45837,11 @@ ${result}`);
45823
45837
  await this.stop();
45824
45838
  this.log.info("Successfully stopped agent network services");
45825
45839
  const targetVersion = message.version ?? await fetchLatestVersionString();
45826
- this.log.info("Writing upgrade manifest...", { previousVersion: td, targetVersion });
45840
+ this.log.info("Writing upgrade manifest...", { previousVersion: sd, targetVersion });
45827
45841
  (0, import_node_fs3.writeFileSync)(
45828
45842
  UPGRADE_MANIFEST_PATH,
45829
45843
  JSON.stringify({
45830
- previousVersion: td,
45844
+ previousVersion: sd,
45831
45845
  targetVersion,
45832
45846
  callback: message.callback ?? null
45833
45847
  }),
@@ -45837,7 +45851,7 @@ ${result}`);
45837
45851
  child.disconnect();
45838
45852
  } catch (err) {
45839
45853
  this.log.error(
45840
- `Error while stopping agent or messaging child process as part of upgrade: ${Pi(err)}`
45854
+ `Error while stopping agent or messaging child process as part of upgrade: ${Ci(err)}`
45841
45855
  );
45842
45856
  import_node_process.default.exit(1);
45843
45857
  }
@@ -45895,27 +45909,27 @@ ${result}`);
45895
45909
  });
45896
45910
  }
45897
45911
  }
45898
- client.sendAndWait(Ei.parse(message.body)).then((response) => {
45912
+ client.sendAndWait(bi.parse(message.body)).then((response) => {
45899
45913
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
45900
45914
  this.addToWebSocketQueue({
45901
45915
  type: "agent:transmit:response",
45902
45916
  channel: message.channel,
45903
45917
  remote: message.remote,
45904
45918
  callback: message.callback,
45905
- contentType: k.HL7_V2,
45919
+ contentType: V.HL7_V2,
45906
45920
  statusCode: 200,
45907
45921
  body: response.toString()
45908
45922
  });
45909
45923
  }).catch((err) => {
45910
- this.log.error(`HL7 error: ${Pi(err)}`);
45924
+ this.log.error(`HL7 error: ${Ci(err)}`);
45911
45925
  this.addToWebSocketQueue({
45912
45926
  type: "agent:transmit:response",
45913
45927
  channel: message.channel,
45914
45928
  remote: message.remote,
45915
45929
  callback: message.callback,
45916
- contentType: k.TEXT,
45930
+ contentType: V.TEXT,
45917
45931
  statusCode: 400,
45918
- body: Pi(err)
45932
+ body: Ci(err)
45919
45933
  });
45920
45934
  if (client.keepAlive) {
45921
45935
  this.hl7Clients.delete(message.remote);
@@ -45962,9 +45976,9 @@ async function agentMain(argv) {
45962
45976
  process.exit(1);
45963
45977
  }
45964
45978
  const { baseUrl, clientId, clientSecret, agentId } = args;
45965
- const medplum = new Ot({ baseUrl, clientId });
45979
+ const medplum = new At({ baseUrl, clientId });
45966
45980
  await medplum.startClientLogin(clientId, clientSecret);
45967
- const app = new App(medplum, agentId, mf(args.logLevel ?? "INFO"));
45981
+ const app = new App(medplum, agentId, vf(args.logLevel ?? "INFO"));
45968
45982
  await app.start();
45969
45983
  process.on("SIGINT", async () => {
45970
45984
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -45992,7 +46006,7 @@ async function upgraderMain(argv) {
45992
46006
  if ((0, import_node_os4.platform)() !== "win32") {
45993
46007
  throw new Error(`Unsupported platform: ${(0, import_node_os4.platform)()}. Agent upgrader currently only supports Windows`);
45994
46008
  }
45995
- const globalLogger = new bi((msg) => console.log(msg));
46009
+ const globalLogger = new Ri((msg) => console.log(msg));
45996
46010
  if (!import_node_process2.default.send) {
45997
46011
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
45998
46012
  import_node_process2.default.exit(1);
@@ -46031,7 +46045,7 @@ async function upgraderMain(argv) {
46031
46045
  (0, import_node_child_process2.spawnSync)(binPath, ["/S"]);
46032
46046
  globalLogger.info(`Agent version ${version} successfully installed`);
46033
46047
  } catch (err) {
46034
- globalLogger.error(`Error while attempting to run installer: ${Pi(err)}`);
46048
+ globalLogger.error(`Error while attempting to run installer: ${Ci(err)}`);
46035
46049
  globalLogger.error("Failed to run installer, attempting to restart agent service...");
46036
46050
  try {
46037
46051
  (0, import_node_child_process2.execSync)('net start "Medplum Agent"');