@medplum/agent 3.0.1 → 3.0.2

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 +461 -454
  2. package/package.json +1 -1
@@ -4128,11 +4128,11 @@ var require_dcmjs = __commonJS({
4128
4128
  if (_i == null)
4129
4129
  return;
4130
4130
  var _arr = [];
4131
- var _n2 = true;
4131
+ var _n = true;
4132
4132
  var _d = false;
4133
4133
  var _s, _e2;
4134
4134
  try {
4135
- for (_i = _i.call(arr); !(_n2 = (_s = _i.next()).done); _n2 = true) {
4135
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
4136
4136
  _arr.push(_s.value);
4137
4137
  if (i2 && _arr.length === i2)
4138
4138
  break;
@@ -4142,7 +4142,7 @@ var require_dcmjs = __commonJS({
4142
4142
  _e2 = err2;
4143
4143
  } finally {
4144
4144
  try {
4145
- if (!_n2 && _i["return"] != null)
4145
+ if (!_n && _i["return"] != null)
4146
4146
  _i["return"]();
4147
4147
  } finally {
4148
4148
  if (_d)
@@ -4533,17 +4533,17 @@ var require_dcmjs = __commonJS({
4533
4533
  };
4534
4534
  const pqdownheap = (s, tree, k2) => {
4535
4535
  const v4 = s.heap[k2];
4536
- let j = k2 << 1;
4537
- while (j <= s.heap_len) {
4538
- if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
4539
- j++;
4536
+ let j2 = k2 << 1;
4537
+ while (j2 <= s.heap_len) {
4538
+ if (j2 < s.heap_len && smaller(tree, s.heap[j2 + 1], s.heap[j2], s.depth)) {
4539
+ j2++;
4540
4540
  }
4541
- if (smaller(tree, v4, s.heap[j], s.depth)) {
4541
+ if (smaller(tree, v4, s.heap[j2], s.depth)) {
4542
4542
  break;
4543
4543
  }
4544
- s.heap[k2] = s.heap[j];
4545
- k2 = j;
4546
- j <<= 1;
4544
+ s.heap[k2] = s.heap[j2];
4545
+ k2 = j2;
4546
+ j2 <<= 1;
4547
4547
  }
4548
4548
  s.heap[k2] = v4;
4549
4549
  };
@@ -8517,9 +8517,9 @@ var require_dcmjs = __commonJS({
8517
8517
  }, {
8518
8518
  key: "readVR",
8519
8519
  value: function readVR() {
8520
- var vr = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
8520
+ var vr2 = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
8521
8521
  this.increment(2);
8522
- return vr;
8522
+ return vr2;
8523
8523
  }
8524
8524
  }, {
8525
8525
  key: "readEncodedString",
@@ -8869,7 +8869,7 @@ var require_dcmjs = __commonJS({
8869
8869
  }, {
8870
8870
  key: "write",
8871
8871
  value: function write(stream, vrType, values, syntax, writeOptions) {
8872
- var vr = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
8872
+ var vr2 = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
8873
8873
  var implicit = useSyntax == IMPLICIT_LITTLE_ENDIAN ? true : false, isLittleEndian = useSyntax == IMPLICIT_LITTLE_ENDIAN || useSyntax == EXPLICIT_LITTLE_ENDIAN$1 ? true : false, isEncapsulated = this.isPixelDataTag() && DicomMessage.isEncapsulated(syntax);
8874
8874
  var oldEndian = stream.isLittleEndian;
8875
8875
  stream.setEndian(isLittleEndian);
@@ -8878,11 +8878,11 @@ var require_dcmjs = __commonJS({
8878
8878
  var tagStream = new WriteBufferStream(256), valueLength;
8879
8879
  tagStream.setEndian(isLittleEndian);
8880
8880
  if (vrType == "OW" || vrType == "OB" || vrType == "UN") {
8881
- valueLength = vr.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
8881
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
8882
8882
  } else if (vrType == "SQ") {
8883
- valueLength = vr.writeBytes(tagStream, values, useSyntax, writeOptions);
8883
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, writeOptions);
8884
8884
  } else {
8885
- valueLength = vr.writeBytes(tagStream, values, writeOptions);
8885
+ valueLength = vr2.writeBytes(tagStream, values, writeOptions);
8886
8886
  }
8887
8887
  if (vrType == "SQ") {
8888
8888
  valueLength = 4294967295;
@@ -8892,13 +8892,13 @@ var require_dcmjs = __commonJS({
8892
8892
  stream.writeUint32(valueLength);
8893
8893
  written += 4;
8894
8894
  } else {
8895
- if (vr.isExplicit()) {
8896
- stream.writeAsciiString(vr.type);
8895
+ if (vr2.isExplicit()) {
8896
+ stream.writeAsciiString(vr2.type);
8897
8897
  stream.writeUint16(0);
8898
8898
  stream.writeUint32(valueLength);
8899
8899
  written += 8;
8900
8900
  } else {
8901
- stream.writeAsciiString(vr.type);
8901
+ stream.writeAsciiString(vr2.type);
8902
8902
  stream.writeUint16(valueLength);
8903
8903
  written += 4;
8904
8904
  }
@@ -9203,20 +9203,20 @@ var require_dcmjs = __commonJS({
9203
9203
  }, {
9204
9204
  key: "createByTypeString",
9205
9205
  value: function createByTypeString(type) {
9206
- var vr = VRinstances[type];
9207
- if (vr === void 0) {
9206
+ var vr2 = VRinstances[type];
9207
+ if (vr2 === void 0) {
9208
9208
  if (type == "ox") {
9209
9209
  validationLog.error("Invalid vr type", type, "- using OW");
9210
- vr = VRinstances["OW"];
9210
+ vr2 = VRinstances["OW"];
9211
9211
  } else if (type == "xs") {
9212
9212
  validationLog.error("Invalid vr type", type, "- using US");
9213
- vr = VRinstances["US"];
9213
+ vr2 = VRinstances["US"];
9214
9214
  } else {
9215
9215
  validationLog.error("Invalid vr type", type, "- using UN");
9216
- vr = VRinstances["UN"];
9216
+ vr2 = VRinstances["UN"];
9217
9217
  }
9218
9218
  }
9219
- return vr;
9219
+ return vr2;
9220
9220
  }
9221
9221
  }]);
9222
9222
  return ValueRepresentation2;
@@ -9299,8 +9299,8 @@ var require_dcmjs = __commonJS({
9299
9299
  if (fragmentMultiframe) {
9300
9300
  fragmentsLength = Math.ceil(frameStream.size / fragmentSize);
9301
9301
  }
9302
- for (var j = 0, fragmentStart = 0; j < fragmentsLength; j++) {
9303
- var isFinalFragment = j === fragmentsLength - 1;
9302
+ for (var j2 = 0, fragmentStart = 0; j2 < fragmentsLength; j2++) {
9303
+ var isFinalFragment = j2 === fragmentsLength - 1;
9304
9304
  var fragmentEnd = fragmentStart + frameStream.size;
9305
9305
  if (fragmentMultiframe) {
9306
9306
  fragmentEnd = fragmentStart + fragmentSize;
@@ -10494,7 +10494,7 @@ var require_dcmjs = __commonJS({
10494
10494
  log.error("No value representation given for", naturalName);
10495
10495
  }
10496
10496
  }
10497
- var vr = ValueRepresentation.createByTypeString(dataItem.vr);
10497
+ var vr2 = ValueRepresentation.createByTypeString(dataItem.vr);
10498
10498
  dataItem.Value = DicomMetaDictionary2.denaturalizeValue(dataItem.Value);
10499
10499
  if (entry.vr == "SQ") {
10500
10500
  var unnaturalValues = [];
@@ -10504,11 +10504,11 @@ var require_dcmjs = __commonJS({
10504
10504
  }
10505
10505
  dataItem.Value = unnaturalValues;
10506
10506
  }
10507
- if (!vr.isBinary() && vr.maxLength) {
10507
+ if (!vr2.isBinary() && vr2.maxLength) {
10508
10508
  dataItem.Value = dataItem.Value.map(function(value) {
10509
- if (value.length > vr.maxLength) {
10510
- log.warn("Truncating value ".concat(value, " of ").concat(naturalName, " because it is longer than ").concat(vr.maxLength));
10511
- return value.slice(0, vr.maxLength);
10509
+ if (value.length > vr2.maxLength) {
10510
+ log.warn("Truncating value ".concat(value, " of ").concat(naturalName, " because it is longer than ").concat(vr2.maxLength));
10511
+ return value.slice(0, vr2.maxLength);
10512
10512
  } else {
10513
10513
  return value;
10514
10514
  }
@@ -10789,9 +10789,9 @@ var require_dcmjs = __commonJS({
10789
10789
  }
10790
10790
  }, {
10791
10791
  key: "writeTagObject",
10792
- value: function writeTagObject(stream, tagString, vr, values, syntax, writeOptions) {
10792
+ value: function writeTagObject(stream, tagString, vr2, values, syntax, writeOptions) {
10793
10793
  var tag = Tag.fromString(tagString);
10794
- tag.write(stream, vr, values, syntax, writeOptions);
10794
+ tag.write(stream, vr2, values, syntax, writeOptions);
10795
10795
  }
10796
10796
  }, {
10797
10797
  key: "write",
@@ -10825,7 +10825,7 @@ var require_dcmjs = __commonJS({
10825
10825
  };
10826
10826
  }
10827
10827
  }
10828
- var length2 = null, vr = null, vrType;
10828
+ var length2 = null, vr2 = null, vrType;
10829
10829
  if (implicit) {
10830
10830
  length2 = stream.readUint32();
10831
10831
  var elementData = DicomMessage2.lookupTag(tag);
@@ -10844,11 +10844,11 @@ var require_dcmjs = __commonJS({
10844
10844
  vrType = "UN";
10845
10845
  }
10846
10846
  }
10847
- vr = ValueRepresentation.createByTypeString(vrType);
10847
+ vr2 = ValueRepresentation.createByTypeString(vrType);
10848
10848
  } else {
10849
10849
  vrType = stream.readVR();
10850
- vr = ValueRepresentation.createByTypeString(vrType);
10851
- if (vr.isExplicit()) {
10850
+ vr2 = ValueRepresentation.createByTypeString(vrType);
10851
+ if (vr2.isExplicit()) {
10852
10852
  stream.increment(2);
10853
10853
  length2 = stream.readUint32();
10854
10854
  } else {
@@ -10856,21 +10856,21 @@ var require_dcmjs = __commonJS({
10856
10856
  }
10857
10857
  }
10858
10858
  var values = [];
10859
- if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
10860
- var times = length2 / vr.maxLength, i2 = 0;
10859
+ if (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
10860
+ var times = length2 / vr2.maxLength, i2 = 0;
10861
10861
  while (i2++ < times) {
10862
- values.push(vr.read(stream, vr.maxLength, syntax));
10862
+ values.push(vr2.read(stream, vr2.maxLength, syntax));
10863
10863
  }
10864
10864
  } else {
10865
- var val = vr.read(stream, length2, syntax);
10866
- if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {
10865
+ var val = vr2.read(stream, length2, syntax);
10866
+ if (!vr2.isBinary() && singleVRs.indexOf(vr2.type) == -1) {
10867
10867
  values = val;
10868
10868
  if (typeof val === "string") {
10869
10869
  values = val.split(String.fromCharCode(VM_DELIMITER));
10870
10870
  }
10871
- } else if (vr.type == "SQ") {
10871
+ } else if (vr2.type == "SQ") {
10872
10872
  values = val;
10873
- } else if (vr.type == "OW" || vr.type == "OB") {
10873
+ } else if (vr2.type == "OW" || vr2.type == "OB") {
10874
10874
  values = val;
10875
10875
  } else {
10876
10876
  Array.isArray(val) ? values = val : values.push(val);
@@ -10879,7 +10879,7 @@ var require_dcmjs = __commonJS({
10879
10879
  stream.setEndian(oldEndian);
10880
10880
  var retObj = ValueRepresentation.addTagAccessors({
10881
10881
  tag,
10882
- vr
10882
+ vr: vr2
10883
10883
  });
10884
10884
  retObj.values = values;
10885
10885
  return retObj;
@@ -10901,12 +10901,12 @@ var require_dcmjs = __commonJS({
10901
10901
  }
10902
10902
  _createClass(DicomDict2, [{
10903
10903
  key: "upsertTag",
10904
- value: function upsertTag(tag, vr, values) {
10904
+ value: function upsertTag(tag, vr2, values) {
10905
10905
  if (this.dict[tag]) {
10906
10906
  this.dict[tag].Value = values;
10907
10907
  } else {
10908
10908
  this.dict[tag] = ValueRepresentation.addTagAccessors({
10909
- vr
10909
+ vr: vr2
10910
10910
  });
10911
10911
  this.dict[tag].Value = values;
10912
10912
  }
@@ -14016,8 +14016,8 @@ var require_dcmjs = __commonJS({
14016
14016
  var _matrix$shape = _slicedToArray(matrix.shape, 2), rows = _matrix$shape[0], cols = _matrix$shape[1];
14017
14017
  var result = ndarray$1(new Uint8Array(rows * cols), [rows, cols]);
14018
14018
  for (var i2 = 0; i2 < rows; i2++) {
14019
- for (var j = 0; j < cols; j++) {
14020
- result.set(i2, j, matrix.get(i2, cols - 1 - j));
14019
+ for (var j2 = 0; j2 < cols; j2++) {
14020
+ result.set(i2, j2, matrix.get(i2, cols - 1 - j2));
14021
14021
  }
14022
14022
  }
14023
14023
  return result;
@@ -14025,9 +14025,9 @@ var require_dcmjs = __commonJS({
14025
14025
  function v3(matrix) {
14026
14026
  var _matrix$shape2 = _slicedToArray(matrix.shape, 2), rows = _matrix$shape2[0], cols = _matrix$shape2[1];
14027
14027
  var result = ndarray$1(new Uint8Array(rows * cols), [rows, cols]);
14028
- for (var j = 0; j < cols; j++) {
14028
+ for (var j2 = 0; j2 < cols; j2++) {
14029
14029
  for (var i2 = 0; i2 < rows; i2++) {
14030
- result.set(i2, j, matrix.get(rows - 1 - i2, j));
14030
+ result.set(i2, j2, matrix.get(rows - 1 - i2, j2));
14031
14031
  }
14032
14032
  }
14033
14033
  return result;
@@ -14037,8 +14037,8 @@ var require_dcmjs = __commonJS({
14037
14037
  var result = ndarray$1(new Uint8Array(rows * cols), [cols, rows]);
14038
14038
  var resultColsMinus1 = result.shape[1] - 1;
14039
14039
  for (var i2 = 0; i2 < rows; i2++) {
14040
- for (var j = 0; j < cols; j++) {
14041
- result.set(j, resultColsMinus1 - i2, matrix.get(i2, j));
14040
+ for (var j2 = 0; j2 < cols; j2++) {
14041
+ result.set(j2, resultColsMinus1 - i2, matrix.get(i2, j2));
14042
14042
  }
14043
14043
  }
14044
14044
  return result;
@@ -15737,10 +15737,10 @@ var require_dcmjs = __commonJS({
15737
15737
  continue;
15738
15738
  }
15739
15739
  var data3 = alignedPixelDataI.data;
15740
- for (var j = 0, len2 = data3.length; j < len2; ++j) {
15741
- if (data3[j] !== 0) {
15742
- temp2DArray[j]++;
15743
- if (temp2DArray[j] > 1) {
15740
+ for (var j2 = 0, len2 = data3.length; j2 < len2; ++j2) {
15741
+ if (data3[j2] !== 0) {
15742
+ temp2DArray[j2]++;
15743
+ if (temp2DArray[j2] > 1) {
15744
15744
  return true;
15745
15745
  }
15746
15746
  }
@@ -15798,9 +15798,9 @@ var require_dcmjs = __commonJS({
15798
15798
  var labelmap2DView = new Uint16Array(tempBuffer, byteOffset, sliceLength);
15799
15799
  var data3 = alignedPixelDataI.data;
15800
15800
  var segmentOnFrame = false;
15801
- for (var j = 0, len2 = alignedPixelDataI.data.length; j < len2; ++j) {
15802
- if (data3[j]) {
15803
- if (labelmap2DView[j] !== 0) {
15801
+ for (var j2 = 0, len2 = alignedPixelDataI.data.length; j2 < len2; ++j2) {
15802
+ if (data3[j2]) {
15803
+ if (labelmap2DView[j2] !== 0) {
15804
15804
  m3++;
15805
15805
  if (m3 >= M) {
15806
15806
  labelmapBufferArray[m3] = new ArrayBuffer(arrayBufferLength);
@@ -15812,7 +15812,7 @@ var require_dcmjs = __commonJS({
15812
15812
  _i2 = 0;
15813
15813
  break;
15814
15814
  } else {
15815
- labelmap2DView[j] = segmentIndex;
15815
+ labelmap2DView[j2] = segmentIndex;
15816
15816
  segmentOnFrame = true;
15817
15817
  }
15818
15818
  }
@@ -15877,9 +15877,9 @@ var require_dcmjs = __commonJS({
15877
15877
  var byteOffset = sliceLength * 2 * imageIdIndex;
15878
15878
  var labelmap2DView = new Uint16Array(labelmapBufferArray[0], byteOffset, sliceLength);
15879
15879
  var data3 = alignedPixelDataI.data;
15880
- for (var j = 0, len2 = alignedPixelDataI.data.length; j < len2; ++j) {
15881
- if (data3[j]) {
15882
- for (var x = j; x < len2; ++x) {
15880
+ for (var j2 = 0, len2 = alignedPixelDataI.data.length; j2 < len2; ++j2) {
15881
+ if (data3[j2]) {
15882
+ for (var x = j2; x < len2; ++x) {
15883
15883
  if (data3[x]) {
15884
15884
  labelmap2DView[x] = segmentIndex;
15885
15885
  }
@@ -16426,8 +16426,8 @@ var require_dcmjs = __commonJS({
16426
16426
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
16427
16427
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
16428
16428
  var cornersoneFreeTextCodingValue = CodingScheme.codeValues.CORNERSTONEFREETEXT;
16429
- var freeTextLabel = findingSites.find(function(fs) {
16430
- return fs.CodeValue === cornersoneFreeTextCodingValue;
16429
+ var freeTextLabel = findingSites.find(function(fs2) {
16430
+ return fs2.CodeValue === cornersoneFreeTextCodingValue;
16431
16431
  });
16432
16432
  if (freeTextLabel) {
16433
16433
  return freeTextLabel.CodeMeaning;
@@ -17506,8 +17506,8 @@ var require_dcmjs = __commonJS({
17506
17506
  return item.GraphicData;
17507
17507
  }).filter(/* @__PURE__ */ function(s) {
17508
17508
  return function(a) {
17509
- return function(j) {
17510
- return !s.has(j) && s.add(j);
17509
+ return function(j2) {
17510
+ return !s.has(j2) && s.add(j2);
17511
17511
  }(JSON.stringify(a));
17512
17512
  };
17513
17513
  }(/* @__PURE__ */ new Set()));
@@ -17625,8 +17625,8 @@ var require_dcmjs = __commonJS({
17625
17625
  return item.GraphicData;
17626
17626
  }).filter(/* @__PURE__ */ function(s) {
17627
17627
  return function(a) {
17628
- return function(j) {
17629
- return !s.has(j) && s.add(j);
17628
+ return function(j2) {
17629
+ return !s.has(j2) && s.add(j2);
17630
17630
  }(JSON.stringify(a));
17631
17631
  };
17632
17632
  }(/* @__PURE__ */ new Set()));
@@ -17671,8 +17671,8 @@ var require_dcmjs = __commonJS({
17671
17671
  });
17672
17672
  return measurement.filter(/* @__PURE__ */ function(s) {
17673
17673
  return function(a) {
17674
- return function(j) {
17675
- return !s.has(j) && s.add(j);
17674
+ return function(j2) {
17675
+ return !s.has(j2) && s.add(j2);
17676
17676
  }(JSON.stringify(a));
17677
17677
  };
17678
17678
  }(/* @__PURE__ */ new Set()));
@@ -17709,8 +17709,8 @@ var require_dcmjs = __commonJS({
17709
17709
  return item.GraphicData;
17710
17710
  }).filter(/* @__PURE__ */ function(s) {
17711
17711
  return function(a) {
17712
- return function(j) {
17713
- return !s.has(j) && s.add(j);
17712
+ return function(j2) {
17713
+ return !s.has(j2) && s.add(j2);
17714
17714
  }(JSON.stringify(a));
17715
17715
  };
17716
17716
  }(/* @__PURE__ */ new Set()));
@@ -17754,8 +17754,8 @@ var require_dcmjs = __commonJS({
17754
17754
  return item.GraphicData;
17755
17755
  }).filter(/* @__PURE__ */ function(s) {
17756
17756
  return function(a) {
17757
- return function(j) {
17758
- return !s.has(j) && s.add(j);
17757
+ return function(j2) {
17758
+ return !s.has(j2) && s.add(j2);
17759
17759
  }(JSON.stringify(a));
17760
17760
  };
17761
17761
  }(/* @__PURE__ */ new Set()));
@@ -17869,7 +17869,7 @@ var require_dcmjs = __commonJS({
17869
17869
  }
17870
17870
  function stringToUint8Array(str2) {
17871
17871
  var arr = new Uint8Array(str2.length);
17872
- for (var i2 = 0, j = str2.length; i2 < j; i2++) {
17872
+ for (var i2 = 0, j2 = str2.length; i2 < j2; i2++) {
17873
17873
  arr[i2] = str2.charCodeAt(i2);
17874
17874
  }
17875
17875
  return arr;
@@ -20776,7 +20776,7 @@ var require_dcmjs = __commonJS({
20776
20776
  __proto__: null,
20777
20777
  Comprehensive3DSR
20778
20778
  });
20779
- var sr2 = {
20779
+ var sr = {
20780
20780
  coding,
20781
20781
  contentItems,
20782
20782
  documents,
@@ -21088,7 +21088,7 @@ var require_dcmjs = __commonJS({
21088
21088
  data: data2,
21089
21089
  derivations,
21090
21090
  normalizers,
21091
- sr: sr2,
21091
+ sr,
21092
21092
  utilities,
21093
21093
  log,
21094
21094
  anonymizer
@@ -21101,7 +21101,7 @@ var require_dcmjs = __commonJS({
21101
21101
  exports3.derivations = derivations;
21102
21102
  exports3.log = log;
21103
21103
  exports3.normalizers = normalizers;
21104
- exports3.sr = sr2;
21104
+ exports3.sr = sr;
21105
21105
  exports3.utilities = utilities;
21106
21106
  Object.defineProperty(exports3, "__esModule", { value: true });
21107
21107
  });
@@ -27181,26 +27181,26 @@ var require_string_decoder = __commonJS({
27181
27181
  return byte >> 6 === 2 ? -1 : -2;
27182
27182
  }
27183
27183
  function utf8CheckIncomplete(self2, buf, i2) {
27184
- var j = buf.length - 1;
27185
- if (j < i2)
27184
+ var j2 = buf.length - 1;
27185
+ if (j2 < i2)
27186
27186
  return 0;
27187
- var nb = utf8CheckByte(buf[j]);
27187
+ var nb = utf8CheckByte(buf[j2]);
27188
27188
  if (nb >= 0) {
27189
27189
  if (nb > 0)
27190
27190
  self2.lastNeed = nb - 1;
27191
27191
  return nb;
27192
27192
  }
27193
- if (--j < i2 || nb === -2)
27193
+ if (--j2 < i2 || nb === -2)
27194
27194
  return 0;
27195
- nb = utf8CheckByte(buf[j]);
27195
+ nb = utf8CheckByte(buf[j2]);
27196
27196
  if (nb >= 0) {
27197
27197
  if (nb > 0)
27198
27198
  self2.lastNeed = nb - 2;
27199
27199
  return nb;
27200
27200
  }
27201
- if (--j < i2 || nb === -2)
27201
+ if (--j2 < i2 || nb === -2)
27202
27202
  return 0;
27203
- nb = utf8CheckByte(buf[j]);
27203
+ nb = utf8CheckByte(buf[j2]);
27204
27204
  if (nb >= 0) {
27205
27205
  if (nb > 0) {
27206
27206
  if (nb === 2)
@@ -28512,9 +28512,9 @@ var require_stream_readable = __commonJS({
28512
28512
  return from(Readable, iterable, opts);
28513
28513
  };
28514
28514
  }
28515
- function indexOf(xs, x) {
28516
- for (var i2 = 0, l2 = xs.length; i2 < l2; i2++) {
28517
- if (xs[i2] === x)
28515
+ function indexOf(xs2, x) {
28516
+ for (var i2 = 0, l2 = xs2.length; i2 < l2; i2++) {
28517
+ if (xs2[i2] === x)
28518
28518
  return i2;
28519
28519
  }
28520
28520
  return -1;
@@ -32241,9 +32241,9 @@ var require_stream_readable2 = __commonJS({
32241
32241
  return from(Readable, iterable, opts);
32242
32242
  };
32243
32243
  }
32244
- function indexOf(xs, x) {
32245
- for (var i2 = 0, l2 = xs.length; i2 < l2; i2++) {
32246
- if (xs[i2] === x)
32244
+ function indexOf(xs2, x) {
32245
+ for (var i2 = 0, l2 = xs2.length; i2 < l2; i2++) {
32246
+ if (xs2[i2] === x)
32247
32247
  return i2;
32248
32248
  }
32249
32249
  return -1;
@@ -32827,25 +32827,25 @@ var require_color_string = __commonJS({
32827
32827
  }
32828
32828
  }
32829
32829
  var name;
32830
- var cs2 = module2.exports = {
32830
+ var cs = module2.exports = {
32831
32831
  to: {},
32832
32832
  get: {}
32833
32833
  };
32834
- cs2.get = function(string) {
32834
+ cs.get = function(string) {
32835
32835
  var prefix = string.substring(0, 3).toLowerCase();
32836
32836
  var val;
32837
32837
  var model;
32838
32838
  switch (prefix) {
32839
32839
  case "hsl":
32840
- val = cs2.get.hsl(string);
32840
+ val = cs.get.hsl(string);
32841
32841
  model = "hsl";
32842
32842
  break;
32843
32843
  case "hwb":
32844
- val = cs2.get.hwb(string);
32844
+ val = cs.get.hwb(string);
32845
32845
  model = "hwb";
32846
32846
  break;
32847
32847
  default:
32848
- val = cs2.get.rgb(string);
32848
+ val = cs.get.rgb(string);
32849
32849
  model = "rgb";
32850
32850
  break;
32851
32851
  }
@@ -32854,7 +32854,7 @@ var require_color_string = __commonJS({
32854
32854
  }
32855
32855
  return { model, value: val };
32856
32856
  };
32857
- cs2.get.rgb = function(string) {
32857
+ cs.get.rgb = function(string) {
32858
32858
  if (!string) {
32859
32859
  return null;
32860
32860
  }
@@ -32927,7 +32927,7 @@ var require_color_string = __commonJS({
32927
32927
  rgb[3] = clamp(rgb[3], 0, 1);
32928
32928
  return rgb;
32929
32929
  };
32930
- cs2.get.hsl = function(string) {
32930
+ cs.get.hsl = function(string) {
32931
32931
  if (!string) {
32932
32932
  return null;
32933
32933
  }
@@ -32943,7 +32943,7 @@ var require_color_string = __commonJS({
32943
32943
  }
32944
32944
  return null;
32945
32945
  };
32946
- cs2.get.hwb = function(string) {
32946
+ cs.get.hwb = function(string) {
32947
32947
  if (!string) {
32948
32948
  return null;
32949
32949
  }
@@ -32959,26 +32959,26 @@ var require_color_string = __commonJS({
32959
32959
  }
32960
32960
  return null;
32961
32961
  };
32962
- cs2.to.hex = function() {
32962
+ cs.to.hex = function() {
32963
32963
  var rgba = swizzle(arguments);
32964
32964
  return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
32965
32965
  };
32966
- cs2.to.rgb = function() {
32966
+ cs.to.rgb = function() {
32967
32967
  var rgba = swizzle(arguments);
32968
32968
  return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
32969
32969
  };
32970
- cs2.to.rgb.percent = function() {
32970
+ cs.to.rgb.percent = function() {
32971
32971
  var rgba = swizzle(arguments);
32972
32972
  var r4 = Math.round(rgba[0] / 255 * 100);
32973
32973
  var g3 = Math.round(rgba[1] / 255 * 100);
32974
32974
  var b2 = Math.round(rgba[2] / 255 * 100);
32975
32975
  return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g3 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g3 + "%, " + b2 + "%, " + rgba[3] + ")";
32976
32976
  };
32977
- cs2.to.hsl = function() {
32977
+ cs.to.hsl = function() {
32978
32978
  var hsla = swizzle(arguments);
32979
32979
  return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
32980
32980
  };
32981
- cs2.to.hwb = function() {
32981
+ cs.to.hwb = function() {
32982
32982
  var hwba = swizzle(arguments);
32983
32983
  var a = "";
32984
32984
  if (hwba.length >= 4 && hwba[3] !== 1) {
@@ -32986,7 +32986,7 @@ var require_color_string = __commonJS({
32986
32986
  }
32987
32987
  return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")";
32988
32988
  };
32989
- cs2.to.keyword = function(rgb) {
32989
+ cs.to.keyword = function(rgb) {
32990
32990
  return reverseNames[rgb.slice(0, 3)];
32991
32991
  };
32992
32992
  function clamp(num, min, max) {
@@ -33419,13 +33419,13 @@ var require_conversions = __commonJS({
33419
33419
  var h3 = hsv[0] / 60;
33420
33420
  var s = hsv[1] / 100;
33421
33421
  var v3 = hsv[2] / 100;
33422
- var hi2 = Math.floor(h3) % 6;
33422
+ var hi = Math.floor(h3) % 6;
33423
33423
  var f = h3 - Math.floor(h3);
33424
33424
  var p3 = 255 * v3 * (1 - s);
33425
33425
  var q = 255 * v3 * (1 - s * f);
33426
33426
  var t = 255 * v3 * (1 - s * (1 - f));
33427
33427
  v3 *= 255;
33428
- switch (hi2) {
33428
+ switch (hi) {
33429
33429
  case 0:
33430
33430
  return [v3, t, p3];
33431
33431
  case 1:
@@ -33589,11 +33589,11 @@ var require_conversions = __commonJS({
33589
33589
  var l2 = lab[0];
33590
33590
  var a = lab[1];
33591
33591
  var b2 = lab[2];
33592
- var hr2;
33592
+ var hr;
33593
33593
  var h3;
33594
33594
  var c3;
33595
- hr2 = Math.atan2(b2, a);
33596
- h3 = hr2 * 360 / 2 / Math.PI;
33595
+ hr = Math.atan2(b2, a);
33596
+ h3 = hr * 360 / 2 / Math.PI;
33597
33597
  if (h3 < 0) {
33598
33598
  h3 += 360;
33599
33599
  }
@@ -33606,10 +33606,10 @@ var require_conversions = __commonJS({
33606
33606
  var h3 = lch[2];
33607
33607
  var a;
33608
33608
  var b2;
33609
- var hr2;
33610
- hr2 = h3 / 360 * 2 * Math.PI;
33611
- a = c3 * Math.cos(hr2);
33612
- b2 = c3 * Math.sin(hr2);
33609
+ var hr;
33610
+ hr = h3 / 360 * 2 * Math.PI;
33611
+ a = c3 * Math.cos(hr);
33612
+ b2 = c3 * Math.sin(hr);
33613
33613
  return [l2, a, b2];
33614
33614
  };
33615
33615
  convert.rgb.ansi16 = function(args) {
@@ -33755,11 +33755,11 @@ var require_conversions = __commonJS({
33755
33755
  return [g3 * 255, g3 * 255, g3 * 255];
33756
33756
  }
33757
33757
  var pure = [0, 0, 0];
33758
- var hi2 = h3 % 1 * 6;
33759
- var v3 = hi2 % 1;
33758
+ var hi = h3 % 1 * 6;
33759
+ var v3 = hi % 1;
33760
33760
  var w2 = 1 - v3;
33761
33761
  var mg = 0;
33762
- switch (Math.floor(hi2)) {
33762
+ switch (Math.floor(hi)) {
33763
33763
  case 0:
33764
33764
  pure[0] = 1;
33765
33765
  pure[1] = v3;
@@ -34585,7 +34585,7 @@ var require_node2 = __commonJS({
34585
34585
  var require_tail_file = __commonJS({
34586
34586
  "../../node_modules/winston/lib/winston/tail-file.js"(exports2, module2) {
34587
34587
  "use strict";
34588
- var fs = require("fs");
34588
+ var fs2 = require("fs");
34589
34589
  var { StringDecoder } = require("string_decoder");
34590
34590
  var { Stream } = require_readable();
34591
34591
  function noop() {
@@ -34606,7 +34606,7 @@ var require_tail_file = __commonJS({
34606
34606
  stream.emit("end");
34607
34607
  stream.emit("close");
34608
34608
  };
34609
- fs.open(options.file, "a+", "0644", (err, fd) => {
34609
+ fs2.open(options.file, "a+", "0644", (err, fd) => {
34610
34610
  if (err) {
34611
34611
  if (!iter) {
34612
34612
  stream.emit("error", err);
@@ -34618,10 +34618,10 @@ var require_tail_file = __commonJS({
34618
34618
  }
34619
34619
  (function read() {
34620
34620
  if (stream.destroyed) {
34621
- fs.close(fd, noop);
34621
+ fs2.close(fd, noop);
34622
34622
  return;
34623
34623
  }
34624
- return fs.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
34624
+ return fs2.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
34625
34625
  if (error) {
34626
34626
  if (!iter) {
34627
34627
  stream.emit("error", error);
@@ -34680,7 +34680,7 @@ var require_tail_file = __commonJS({
34680
34680
  var require_file = __commonJS({
34681
34681
  "../../node_modules/winston/lib/winston/transports/file.js"(exports2, module2) {
34682
34682
  "use strict";
34683
- var fs = require("fs");
34683
+ var fs2 = require("fs");
34684
34684
  var path = require("path");
34685
34685
  var asyncSeries = require_series();
34686
34686
  var zlib = require("zlib");
@@ -34865,7 +34865,7 @@ var require_file = __commonJS({
34865
34865
  let buff = "";
34866
34866
  let results = [];
34867
34867
  let row = 0;
34868
- const stream = fs.createReadStream(file, {
34868
+ const stream = fs2.createReadStream(file, {
34869
34869
  encoding: "utf8"
34870
34870
  });
34871
34871
  stream.on("error", (err) => {
@@ -35022,7 +35022,7 @@ var require_file = __commonJS({
35022
35022
  stat(callback) {
35023
35023
  const target = this._getFile();
35024
35024
  const fullpath = path.join(this.dirname, target);
35025
- fs.stat(fullpath, (err, stat) => {
35025
+ fs2.stat(fullpath, (err, stat) => {
35026
35026
  if (err && err.code === "ENOENT") {
35027
35027
  debug("ENOENT\xA0ok", fullpath);
35028
35028
  this.filename = target;
@@ -35127,7 +35127,7 @@ var require_file = __commonJS({
35127
35127
  _createStream(source) {
35128
35128
  const fullpath = path.join(this.dirname, this.filename);
35129
35129
  debug("create stream start", fullpath, this.options);
35130
- const dest = fs.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
35130
+ const dest = fs2.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
35131
35131
  debug("file open ok", fullpath);
35132
35132
  this.emit("open", fullpath);
35133
35133
  source.pipe(dest);
@@ -35194,7 +35194,7 @@ var require_file = __commonJS({
35194
35194
  const isZipped = this.zippedArchive ? ".gz" : "";
35195
35195
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
35196
35196
  const target = path.join(this.dirname, filePath);
35197
- fs.unlink(target, callback);
35197
+ fs2.unlink(target, callback);
35198
35198
  }
35199
35199
  /**
35200
35200
  * Roll files forward based on integer, up to maxFiles. e.g. if base if
@@ -35217,17 +35217,17 @@ var require_file = __commonJS({
35217
35217
  tasks.push(function(i2, cb) {
35218
35218
  let fileName = `${basename}${i2 - 1}${ext}${isZipped}`;
35219
35219
  const tmppath = path.join(this.dirname, fileName);
35220
- fs.exists(tmppath, (exists) => {
35220
+ fs2.exists(tmppath, (exists) => {
35221
35221
  if (!exists) {
35222
35222
  return cb(null);
35223
35223
  }
35224
35224
  fileName = `${basename}${i2}${ext}${isZipped}`;
35225
- fs.rename(tmppath, path.join(this.dirname, fileName), cb);
35225
+ fs2.rename(tmppath, path.join(this.dirname, fileName), cb);
35226
35226
  });
35227
35227
  }.bind(this, x));
35228
35228
  }
35229
35229
  asyncSeries(tasks, () => {
35230
- fs.rename(
35230
+ fs2.rename(
35231
35231
  path.join(this.dirname, `${basename}${ext}`),
35232
35232
  path.join(this.dirname, `${basename}1${ext}${isZipped}`),
35233
35233
  callback
@@ -35235,8 +35235,8 @@ var require_file = __commonJS({
35235
35235
  });
35236
35236
  }
35237
35237
  _createLogDirIfNotExist(dirPath) {
35238
- if (!fs.existsSync(dirPath)) {
35239
- fs.mkdirSync(dirPath, { recursive: true });
35238
+ if (!fs2.existsSync(dirPath)) {
35239
+ fs2.mkdirSync(dirPath, { recursive: true });
35240
35240
  }
35241
35241
  }
35242
35242
  };
@@ -38150,7 +38150,7 @@ var require_dcmjs_dimse_min = __commonJS({
38150
38150
  }
38151
38151
  };
38152
38152
  }, 988: (e2, t2, s2) => {
38153
- const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c3, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g3, Status: l2, TranscodableTransferSyntaxes: p3 } = s2(855), { CCancelRequest: R2, CEchoRequest: f, CEchoResponse: y, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $2 } = s2(406), j = s2(347), V2 = s2(719), G2 = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q2 } = s2(37), W = s2(425);
38153
+ const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c3, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g3, Status: l2, TranscodableTransferSyntaxes: p3 } = s2(855), { CCancelRequest: R2, CEchoRequest: f, CEchoResponse: y, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(406), j2 = s2(347), V2 = s2(719), G2 = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q2 } = s2(37), W = s2(425);
38154
38154
  class J2 extends W {
38155
38155
  constructor() {
38156
38156
  super();
@@ -38347,7 +38347,7 @@ var require_dcmjs_dimse_min = __commonJS({
38347
38347
  const t3 = this.association.getPresentationContext(e4.getPresentationContextId());
38348
38348
  if (e4.isLastFragment())
38349
38349
  if (e4.isCommand()) {
38350
- const s3 = new w2(new j(this.dimseBuffer.toBuffer()));
38350
+ const s3 = new w2(new j2(this.dimseBuffer.toBuffer()));
38351
38351
  switch (s3.getCommandFieldType()) {
38352
38352
  case g3.CEchoRequest:
38353
38353
  this.dimse = Object.assign(new f(), s3);
@@ -38425,7 +38425,7 @@ var require_dcmjs_dimse_min = __commonJS({
38425
38425
  return this._performDimse(t3, this.dimse), void (this.dimse = void 0);
38426
38426
  this.dimseBuffer = void 0;
38427
38427
  } else {
38428
- const e5 = new j(this.dimseBuffer.toBuffer(), t3.getAcceptedTransferSyntaxUid(), this.datasetReadOptions);
38428
+ const e5 = new j2(this.dimseBuffer.toBuffer(), t3.getAcceptedTransferSyntaxUid(), this.datasetReadOptions);
38429
38429
  this.dimse.setDataset(e5), this._performDimse(t3, this.dimse), this.dimseBuffer = void 0, this.dimse = void 0;
38430
38430
  }
38431
38431
  });
@@ -38434,7 +38434,7 @@ var require_dcmjs_dimse_min = __commonJS({
38434
38434
  }
38435
38435
  }
38436
38436
  _performDimse(e3, t3) {
38437
- if (t3 instanceof $2) {
38437
+ if (t3 instanceof $) {
38438
38438
  const e4 = Object.assign(Object.create(Object.getPrototypeOf(t3)), t3), s3 = this.pending.find((e5) => e5.getMessageId() === t3.getMessageIdBeingRespondedTo());
38439
38439
  s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== l2.Pending && s3.raiseDoneEvent());
38440
38440
  } else
@@ -39091,7 +39091,7 @@ var require_dcmjs_dimse_min = __commonJS({
39091
39091
  }
39092
39092
  };
39093
39093
  }, 10: (e2, t2, s2) => {
39094
- const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g3, CMoveRequest: l2, CMoveResponse: p3, CStoreRequest: R2, CStoreResponse: f, NActionRequest: y, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q, NSetResponse: D2 } = s2(406), { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j, Uid: V2, UserIdentityType: G2 } = s2(855), _2 = s2(185), z2 = s2(347), Q2 = s2(719), W = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j, Uid: V2, UserIdentityType: G2 }, Dataset: z2, Implementation: Q2, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
39094
+ const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g3, CMoveRequest: l2, CMoveResponse: p3, CStoreRequest: R2, CStoreResponse: f, NActionRequest: y, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q, NSetResponse: D2 } = s2(406), { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 } = s2(855), _2 = s2(185), z2 = s2(347), Q2 = s2(719), W = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 }, Dataset: z2, Implementation: Q2, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
39095
39095
  e2.exports = J2;
39096
39096
  }, 437: (e2, t2, s2) => {
39097
39097
  const { createLogger: n2, format: i3, transports: r5 } = s2(469), { combine: o2, printf: a, timestamp: c3 } = i3, d3 = n2({ format: o2(c3(), a(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r5.Console()] });
@@ -39188,10 +39188,10 @@ var Ce = class {
39188
39188
  }, precedence: t });
39189
39189
  }
39190
39190
  construct(e) {
39191
- return new lt(e, this.prefixParselets, this.infixParselets);
39191
+ return new pt(e, this.prefixParselets, this.infixParselets);
39192
39192
  }
39193
39193
  };
39194
- var lt = class {
39194
+ var pt = class {
39195
39195
  constructor(e, t, n) {
39196
39196
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
39197
39197
  }
@@ -39242,12 +39242,12 @@ var lt = class {
39242
39242
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
39243
39243
  }
39244
39244
  };
39245
- var dt = "ok";
39245
+ var ft = "ok";
39246
39246
  var Ae = "created";
39247
- var ft = "not-modified";
39248
- var mt = "not-found";
39247
+ var ht = "not-modified";
39248
+ var gt = "not-found";
39249
39249
  var we = "accepted";
39250
- var sr = { resourceType: "OperationOutcome", id: mt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39250
+ var cr = { resourceType: "OperationOutcome", id: gt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39251
39251
  function v(r4, e) {
39252
39252
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39253
39253
  }
@@ -39257,61 +39257,61 @@ function h(r4) {
39257
39257
  function ne(r4) {
39258
39258
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39259
39259
  }
39260
- function ht(r4) {
39261
- return r4.id === dt || r4.id === Ae || r4.id === ft || r4.id === we;
39260
+ function yt(r4) {
39261
+ return r4.id === ft || r4.id === Ae || r4.id === ht || r4.id === we;
39262
39262
  }
39263
39263
  var p = class extends Error {
39264
39264
  constructor(e, t) {
39265
- super(ar(e)), this.outcome = e, this.cause = t;
39265
+ super(ur(e)), this.outcome = e, this.cause = t;
39266
39266
  }
39267
39267
  };
39268
39268
  function Ie(r4) {
39269
- return r4 instanceof p ? r4.outcome : ne(r4) ? r4 : v(_n(r4));
39269
+ return r4 instanceof p ? r4.outcome : ne(r4) ? r4 : v($n(r4));
39270
39270
  }
39271
- function _n(r4) {
39272
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ne(r4) ? ar(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39271
+ function $n(r4) {
39272
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ne(r4) ? ur(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39273
39273
  }
39274
- function ar(r4) {
39275
- let e = r4.issue?.map(Ln) ?? [];
39274
+ function ur(r4) {
39275
+ let e = r4.issue?.map(jn) ?? [];
39276
39276
  return e.length > 0 ? e.join("; ") : "Unknown error";
39277
39277
  }
39278
- function Ln(r4) {
39278
+ function jn(r4) {
39279
39279
  let e;
39280
39280
  return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
39281
39281
  }
39282
39282
  function J(r4) {
39283
- let e = fe(r4), t = Bn(r4);
39283
+ let e = fe(r4), t = Hn(r4);
39284
39284
  return t === e ? { reference: e } : { reference: e, display: t };
39285
39285
  }
39286
39286
  function fe(r4) {
39287
39287
  return me(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39288
39288
  }
39289
- function dr(r4) {
39289
+ function fr(r4) {
39290
39290
  if (r4)
39291
39291
  return me(r4) ? r4.reference.split("/")[1] : r4.id;
39292
39292
  }
39293
- function Un(r4) {
39293
+ function Qn(r4) {
39294
39294
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39295
39295
  }
39296
- function Bn(r4) {
39297
- if (Un(r4)) {
39298
- let e = qn(r4);
39296
+ function Hn(r4) {
39297
+ if (Qn(r4)) {
39298
+ let e = Gn(r4);
39299
39299
  if (e)
39300
39300
  return e;
39301
39301
  }
39302
39302
  if (r4.resourceType === "Device") {
39303
- let e = $n(r4);
39303
+ let e = Kn(r4);
39304
39304
  if (e)
39305
39305
  return e;
39306
39306
  }
39307
39307
  return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : fe(r4);
39308
39308
  }
39309
- function qn(r4) {
39309
+ function Gn(r4) {
39310
39310
  let e = r4.name;
39311
39311
  if (e && e.length > 0)
39312
39312
  return Me(e[0]);
39313
39313
  }
39314
- function $n(r4) {
39314
+ function Kn(r4) {
39315
39315
  let e = r4.deviceName;
39316
39316
  if (e && e.length > 0)
39317
39317
  return e[0].name;
@@ -39328,46 +39328,46 @@ function ke(r4, e) {
39328
39328
  let q = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39329
39329
  return { years: f, months: E2, days: q };
39330
39330
  }
39331
- function mr(r4, ...e) {
39331
+ function gr(r4, ...e) {
39332
39332
  let t = r4;
39333
39333
  for (let n = 0; n < e.length && t; n++)
39334
39334
  t = t?.extension?.find((i2) => i2.url === e[n]);
39335
39335
  return t;
39336
39336
  }
39337
- function hr(r4, e) {
39338
- return JSON.stringify(r4, jn, e ? 2 : void 0);
39337
+ function yr(r4, e) {
39338
+ return JSON.stringify(r4, Wn, e ? 2 : void 0);
39339
39339
  }
39340
- function jn(r4, e) {
39341
- return !Qn(r4) && R(e) ? void 0 : e;
39340
+ function Wn(r4, e) {
39341
+ return !zn(r4) && R(e) ? void 0 : e;
39342
39342
  }
39343
- function Qn(r4) {
39343
+ function zn(r4) {
39344
39344
  return !!/\d+$/.exec(r4);
39345
39345
  }
39346
39346
  function R(r4) {
39347
39347
  if (r4 == null)
39348
39348
  return true;
39349
39349
  let e = typeof r4;
39350
- return e === "string" || e === "object" ? !Hn(r4) : false;
39350
+ return e === "string" || e === "object" ? !Jn(r4) : false;
39351
39351
  }
39352
- function Hn(r4) {
39352
+ function Jn(r4) {
39353
39353
  if (r4 == null)
39354
39354
  return false;
39355
39355
  let e = typeof r4;
39356
39356
  return e === "string" && r4 !== "" || e === "object" && ("length" in r4 && r4.length > 0 || Object.keys(r4).length > 0);
39357
39357
  }
39358
- function gr(r4) {
39358
+ function xr(r4) {
39359
39359
  return r4.every((e) => typeof e == "string");
39360
39360
  }
39361
- var yr = [];
39361
+ var Tr = [];
39362
39362
  for (let r4 = 0; r4 < 256; r4++)
39363
- yr.push(r4.toString(16).padStart(2, "0"));
39364
- function xr(r4) {
39363
+ Tr.push(r4.toString(16).padStart(2, "0"));
39364
+ function vr(r4) {
39365
39365
  let e = new Uint8Array(r4), t = new Array(e.length);
39366
39366
  for (let n = 0; n < e.length; n++)
39367
- t[n] = yr[e[n]];
39367
+ t[n] = Tr[e[n]];
39368
39368
  return t.join("");
39369
39369
  }
39370
- function Tr(r4) {
39370
+ function Sr(r4) {
39371
39371
  let e = new Uint8Array(r4), t = [];
39372
39372
  for (let n = 0; n < e.length; n++)
39373
39373
  t[n] = String.fromCharCode(e[n]);
@@ -39376,7 +39376,7 @@ function Tr(r4) {
39376
39376
  function I(r4) {
39377
39377
  return r4 ? r4.charAt(0).toUpperCase() + r4.substring(1) : "";
39378
39378
  }
39379
- var Tt = (r4) => new Promise((e) => {
39379
+ var St = (r4) => new Promise((e) => {
39380
39380
  setTimeout(e, r4);
39381
39381
  });
39382
39382
  function Me(r4, e) {
@@ -39391,27 +39391,28 @@ function Me(r4, e) {
39391
39391
  function oe(r4) {
39392
39392
  return typeof r4 == "string" ? r4 : void 0;
39393
39393
  }
39394
- function pi(r4, e) {
39394
+ function yi(r4, e) {
39395
39395
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39396
39396
  return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39397
39397
  }
39398
- function br(r4) {
39398
+ function Pr(r4) {
39399
39399
  let e = /* @__PURE__ */ Object.create(null);
39400
39400
  for (let [t, n] of Object.entries(r4))
39401
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, pi(i2, o)])), constraints: [], innerTypes: [] };
39401
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, yi(i2, o)])), constraints: [], innerTypes: [] };
39402
39402
  return e;
39403
39403
  }
39404
- var Rr = { 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" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, 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" }] } } } };
39404
+ var Cr = { 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" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, 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" }] } } } };
39405
+ var Fe = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\s\S]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\s\S]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
39405
39406
  function d(r4) {
39406
39407
  return [{ type: c.boolean, value: r4 }];
39407
39408
  }
39408
39409
  function g(r4) {
39409
- return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: c.integer, value: r4 } : typeof r4 == "number" ? { type: c.decimal, value: r4 } : typeof r4 == "boolean" ? { type: c.boolean, value: r4 } : typeof r4 == "string" ? { type: c.string, value: r4 } : P(r4) ? { type: c.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39410
+ return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: c.integer, value: r4 } : typeof r4 == "number" ? { type: c.decimal, value: r4 } : typeof r4 == "boolean" ? { type: c.boolean, value: r4 } : typeof r4 == "string" ? { type: c.string, value: r4 } : P(r4) ? { type: c.Quantity, value: r4 } : F(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39410
39411
  }
39411
39412
  function D(r4) {
39412
39413
  return r4.length === 0 ? false : !!r4[0].value;
39413
39414
  }
39414
- function F(r4, e) {
39415
+ function _(r4, e) {
39415
39416
  if (r4.length !== 0) {
39416
39417
  if (r4.length === 1 && (!e || r4[0].type === e))
39417
39418
  return r4[0];
@@ -39421,10 +39422,10 @@ function F(r4, e) {
39421
39422
  function A(r4, e) {
39422
39423
  if (!r4.value)
39423
39424
  return;
39424
- let t = Le(r4.type, e);
39425
- return t ? mi(r4.value, e, t) : hi(r4, e);
39425
+ let t = Be(r4.type, e);
39426
+ return t ? Pi(r4.value, e, t) : Ci(r4, e);
39426
39427
  }
39427
- function mi(r4, e, t) {
39428
+ function Pi(r4, e, t) {
39428
39429
  let n = t.type;
39429
39430
  if (!n || n.length === 0)
39430
39431
  return;
@@ -39443,16 +39444,16 @@ function mi(r4, e, t) {
39443
39444
  if (s)
39444
39445
  if (Array.isArray(i2))
39445
39446
  for (let a = 0; a < Math.max(i2.length, s.length); a++)
39446
- i2[a] = wr(i2[a], s[a]);
39447
+ i2[a] = Nr(i2[a], s[a]);
39447
39448
  else
39448
- i2 = wr(i2, s);
39449
+ i2 = Nr(i2, s);
39449
39450
  if (!R(i2))
39450
- return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => Pr(a, o)) : Pr(i2, o);
39451
+ return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => kr(a, o)) : kr(i2, o);
39451
39452
  }
39452
- function Pr(r4, e) {
39453
- return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
39453
+ function kr(r4, e) {
39454
+ return e === "Resource" && F(r4) && (e = r4.resourceType), { type: e, value: r4 };
39454
39455
  }
39455
- function hi(r4, e) {
39456
+ function Ci(r4, e) {
39456
39457
  let t = r4.value;
39457
39458
  if (!t || typeof t != "object")
39458
39459
  return;
@@ -39470,12 +39471,12 @@ function hi(r4, e) {
39470
39471
  if (!R(n))
39471
39472
  return Array.isArray(n) ? n.map(g) : g(n);
39472
39473
  }
39473
- function Fe(r4) {
39474
+ function Ue(r4) {
39474
39475
  let e = [];
39475
39476
  for (let t of r4) {
39476
39477
  let n = false;
39477
39478
  for (let i2 of e)
39478
- if (D(Ir(t, i2))) {
39479
+ if (D(Mr(t, i2))) {
39479
39480
  n = true;
39480
39481
  break;
39481
39482
  }
@@ -39483,28 +39484,28 @@ function Fe(r4) {
39483
39484
  }
39484
39485
  return e;
39485
39486
  }
39486
- function Et(r4) {
39487
+ function kt(r4) {
39487
39488
  return d(!D(r4));
39488
39489
  }
39489
- function bt(r4, e) {
39490
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => D(Ir(t, e[n]))));
39490
+ function Ot(r4, e) {
39491
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => D(Mr(t, e[n]))));
39491
39492
  }
39492
- function Ir(r4, e) {
39493
+ function Mr(r4, e) {
39493
39494
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39494
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? d(kr(t, n)) : d(typeof t == "object" && typeof n == "object" ? Pt(r4, e) : t === n);
39495
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? d(Ur(t, n)) : d(typeof t == "object" && typeof n == "object" ? Dt(r4, e) : t === n);
39495
39496
  }
39496
- function Rt(r4, e) {
39497
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(Cr), e.sort(Cr), d(r4.every((t, n) => D(gi(t, e[n])))));
39497
+ function Vt(r4, e) {
39498
+ return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(Or), e.sort(Or), d(r4.every((t, n) => D(Ai(t, e[n])))));
39498
39499
  }
39499
- function gi(r4, e) {
39500
+ function Ai(r4, e) {
39500
39501
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
39501
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : P(s) && P(a) ? d(kr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Pt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39502
+ return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : P(s) && P(a) ? d(Ur(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Dt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39502
39503
  }
39503
- function Cr(r4, e) {
39504
+ function Or(r4, e) {
39504
39505
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39505
39506
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39506
39507
  }
39507
- function _e(r4, e) {
39508
+ function Le(r4, e) {
39508
39509
  let { value: t } = r4;
39509
39510
  if (t == null)
39510
39511
  return false;
@@ -39515,95 +39516,101 @@ function _e(r4, e) {
39515
39516
  case "Integer":
39516
39517
  return typeof t == "number";
39517
39518
  case "Date":
39518
- return typeof t == "string" && !!/^\d{4}(-\d{2}(-\d{2})?)?/.exec(t);
39519
+ return Fr(t);
39519
39520
  case "DateTime":
39520
- return typeof t == "string" && !!/^\d{4}(-\d{2}(-\d{2})?)?T/.exec(t);
39521
+ return _e(t);
39521
39522
  case "Time":
39522
39523
  return typeof t == "string" && !!/^T\d/.exec(t);
39523
39524
  case "Period":
39524
- return yi(t);
39525
+ return _r(t);
39525
39526
  case "Quantity":
39526
39527
  return P(t);
39527
39528
  default:
39528
39529
  return typeof t == "object" && t?.resourceType === e;
39529
39530
  }
39530
39531
  }
39531
- function yi(r4) {
39532
- return !!(r4 && typeof r4 == "object" && "start" in r4);
39532
+ function Fr(r4) {
39533
+ return typeof r4 == "string" && !!Fe.date.exec(r4);
39534
+ }
39535
+ function _e(r4) {
39536
+ return typeof r4 == "string" && !!Fe.dateTime.exec(r4);
39537
+ }
39538
+ function _r(r4) {
39539
+ return !!(r4 && typeof r4 == "object" && ("start" in r4 && _e(r4.start) || "end" in r4 && _e(r4.end)));
39533
39540
  }
39534
39541
  function P(r4) {
39535
39542
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39536
39543
  }
39537
- function kr(r4, e) {
39544
+ function Ur(r4, e) {
39538
39545
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
39539
39546
  }
39540
- function Pt(r4, e) {
39547
+ function Dt(r4, e) {
39541
39548
  let t = Object.keys(r4), n = Object.keys(e);
39542
39549
  if (t.length !== n.length)
39543
39550
  return false;
39544
39551
  for (let i2 of t) {
39545
39552
  let o = r4[i2], s = e[i2];
39546
- if (Ar(o) && Ar(s)) {
39547
- if (!Pt(o, s))
39553
+ if (Dr(o) && Dr(s)) {
39554
+ if (!Dt(o, s))
39548
39555
  return false;
39549
39556
  } else if (o !== s)
39550
39557
  return false;
39551
39558
  }
39552
39559
  return true;
39553
39560
  }
39554
- function Ar(r4) {
39561
+ function Dr(r4) {
39555
39562
  return r4 !== null && typeof r4 == "object";
39556
39563
  }
39557
- function wr(r4, e) {
39564
+ function Nr(r4, e) {
39558
39565
  if (e) {
39559
39566
  if (typeof e != "object")
39560
39567
  throw new Error("Primitive extension must be an object");
39561
- return xi(r4 ?? {}, e);
39568
+ return wi(r4 ?? {}, e);
39562
39569
  }
39563
39570
  return r4;
39564
39571
  }
39565
- function xi(r4, e) {
39572
+ function wi(r4, e) {
39566
39573
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39567
39574
  }
39568
39575
  function It(r4) {
39569
- return new At(r4).parse();
39576
+ return new Mt(r4).parse();
39570
39577
  }
39571
- var he = br(Rr);
39572
- var kt = /* @__PURE__ */ Object.create(null);
39573
- var Or = /* @__PURE__ */ Object.create(null);
39574
- function Ot(r4) {
39578
+ var he = Pr(Cr);
39579
+ var _t = /* @__PURE__ */ Object.create(null);
39580
+ var Lr = /* @__PURE__ */ Object.create(null);
39581
+ function Ut(r4) {
39575
39582
  let e;
39576
- return r4 ? (e = Or[r4], e || (e = Or[r4] = /* @__PURE__ */ Object.create(null))) : e = he, e;
39583
+ return r4 ? (e = Lr[r4], e || (e = Lr[r4] = /* @__PURE__ */ Object.create(null))) : e = he, e;
39577
39584
  }
39578
- function Vt(r4, e) {
39585
+ function Lt(r4, e) {
39579
39586
  let t = Array.isArray(r4) ? r4 : r4.entry?.map((n) => n.resource) ?? [];
39580
39587
  for (let n of t)
39581
- Ti(n, e);
39588
+ Ii(n, e);
39582
39589
  }
39583
- function Ti(r4, e) {
39590
+ function Ii(r4, e) {
39584
39591
  if (!r4?.name)
39585
39592
  throw new Error("Failed loading StructureDefinition from bundle");
39586
39593
  if (r4.resourceType !== "StructureDefinition")
39587
39594
  return;
39588
- let t = It(r4), n = Ot(e);
39589
- n[r4.name] = t, e && r4.url === e && (kt[e] = t);
39595
+ let t = It(r4), n = Ut(e);
39596
+ n[r4.name] = t, e && r4.url === e && (_t[e] = t);
39590
39597
  for (let i2 of t.innerTypes)
39591
39598
  i2.parentType = t, n[i2.name] = i2;
39592
39599
  }
39593
- function Fr(r4) {
39600
+ function Qr(r4) {
39594
39601
  return !!he[r4];
39595
39602
  }
39596
- function Ue(r4, e) {
39597
- return Ot(e)[r4];
39603
+ function qe(r4, e) {
39604
+ return Ut(e)[r4];
39598
39605
  }
39599
- function Lr(r4) {
39600
- return !!kt[r4];
39606
+ function Gr(r4) {
39607
+ return !!_t[r4];
39601
39608
  }
39602
- var At = class {
39609
+ var Mt = class {
39603
39610
  constructor(e) {
39604
39611
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
39605
39612
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
39606
- 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: bi(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
39613
+ 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 = [];
39607
39614
  }
39608
39615
  parse() {
39609
39616
  let e = this.next();
@@ -39612,7 +39619,7 @@ var At = class {
39612
39619
  this.parseSliceStart(e);
39613
39620
  else if (e.id?.includes(":")) {
39614
39621
  if (this.slicingContext?.current) {
39615
- let t = Ct(e, this.slicingContext.path);
39622
+ let t = Nt(e, this.slicingContext.path);
39616
39623
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
39617
39624
  }
39618
39625
  } else {
@@ -39621,13 +39628,13 @@ var At = class {
39621
39628
  let n = this.backboneContext;
39622
39629
  for (; n; ) {
39623
39630
  if (e.path?.startsWith(n.path + ".")) {
39624
- n.type.elements[Ct(e, n.path)] = t;
39631
+ n.type.elements[Nt(e, n.path)] = t;
39625
39632
  break;
39626
39633
  }
39627
39634
  n = n.parent;
39628
39635
  }
39629
39636
  if (!n) {
39630
- let i2 = Ct(e, this.root.path);
39637
+ let i2 = Nt(e, this.root.path);
39631
39638
  e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
39632
39639
  }
39633
39640
  this.checkFieldExit(e);
@@ -39640,26 +39647,26 @@ var At = class {
39640
39647
  this.isInnerType(e) && this.enterInnerType(e), e.slicing && !this.slicingContext && this.enterSlice(e, t);
39641
39648
  }
39642
39649
  enterInnerType(e) {
39643
- for (; this.backboneContext && !se(this.backboneContext?.path, e.path); )
39650
+ for (; this.backboneContext && !ae(this.backboneContext?.path, e.path); )
39644
39651
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39645
- this.backboneContext = { type: { name: wt(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: se(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39652
+ this.backboneContext = { type: { name: Ft(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ae(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39646
39653
  }
39647
39654
  enterSlice(e, t) {
39648
- Ei(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39655
+ Vi(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39649
39656
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type")
39650
39657
  throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
39651
39658
  return { path: n.path, type: n.type };
39652
39659
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
39653
39660
  }
39654
39661
  checkFieldExit(e = void 0) {
39655
- if (this.backboneContext && !se(this.backboneContext.path, e?.path))
39662
+ if (this.backboneContext && !ae(this.backboneContext.path, e?.path))
39656
39663
  if (this.backboneContext.parent)
39657
39664
  do
39658
39665
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39659
- while (this.backboneContext && !se(this.backboneContext.path, e?.path));
39666
+ while (this.backboneContext && !ae(this.backboneContext.path, e?.path));
39660
39667
  else
39661
39668
  this.innerTypes.push(this.backboneContext.type), delete this.backboneContext;
39662
- this.slicingContext && !se(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), delete this.slicingContext);
39669
+ this.slicingContext && !ae(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), delete this.slicingContext);
39663
39670
  }
39664
39671
  next() {
39665
39672
  let e = this.peek();
@@ -39678,7 +39685,7 @@ var At = class {
39678
39685
  }
39679
39686
  isInnerType(e) {
39680
39687
  let t = this.peek();
39681
- return !!(se(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
39688
+ return !!(ae(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
39682
39689
  }
39683
39690
  parseSliceStart(e) {
39684
39691
  if (!this.slicingContext)
@@ -39688,57 +39695,57 @@ var At = class {
39688
39695
  parseElementDefinitionType(e) {
39689
39696
  return (e.type ?? []).map((t) => {
39690
39697
  let n;
39691
- return (t.code === "BackboneElement" || t.code === "Element") && (n = wt(e)), n || (n = mr(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39698
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = Ft(e)), n || (n = gr(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39692
39699
  });
39693
39700
  }
39694
39701
  parseElementDefinition(e) {
39695
- let t = Dr(e.max), n = e.base?.max ? Dr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39696
- 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: Nr(A(i2, "fixed[x]")), pattern: Nr(A(i2, "pattern[x]")), binding: e.binding };
39702
+ let t = qr(e.max), n = e.base?.max ? qr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39703
+ 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: $r(A(i2, "fixed[x]")), pattern: $r(A(i2, "pattern[x]")), binding: e.binding };
39697
39704
  }
39698
39705
  };
39699
- function Dr(r4) {
39706
+ function qr(r4) {
39700
39707
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
39701
39708
  }
39702
- function Ct(r4, e = "") {
39703
- return Si(r4.path, e);
39709
+ function Nt(r4, e = "") {
39710
+ return Oi(r4.path, e);
39704
39711
  }
39705
- function Si(r4, e) {
39712
+ function Oi(r4, e) {
39706
39713
  return r4 ? e && r4.startsWith(e) ? r4.substring(e.length + 1) : r4 : "";
39707
39714
  }
39708
- function se(r4, e) {
39715
+ function ae(r4, e) {
39709
39716
  return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
39710
39717
  }
39711
- function Nr(r4) {
39718
+ function $r(r4) {
39712
39719
  return Array.isArray(r4) && r4.length > 0 ? r4[0] : R(r4) ? void 0 : r4;
39713
39720
  }
39714
- function Ei(r4) {
39721
+ function Vi(r4) {
39715
39722
  let e = r4.slicing?.discriminator;
39716
39723
  return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
39717
39724
  }
39718
- function bi(r4) {
39725
+ function Di(r4) {
39719
39726
  let e = r4.description;
39720
39727
  return e?.startsWith(`Base StructureDefinition for ${r4.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r4.name} Type: `.length)), e;
39721
39728
  }
39722
39729
  var c = { 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" };
39723
- function Nt(r4) {
39730
+ function qt(r4) {
39724
39731
  for (let e of r4.base ?? []) {
39725
39732
  let t = N.types[e];
39726
39733
  t || (t = { searchParamsDetails: {} }, N.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[r4.code] = r4;
39727
39734
  }
39728
39735
  }
39729
- function wt(r4) {
39736
+ function Ft(r4) {
39730
39737
  let e = r4.type?.[0]?.code;
39731
- return e === "BackboneElement" || e === "Element" ? Ri((r4.base?.path ?? r4.path)?.split(".")) : e;
39738
+ return e === "BackboneElement" || e === "Element" ? Ni((r4.base?.path ?? r4.path)?.split(".")) : e;
39732
39739
  }
39733
- function Ri(r4) {
39740
+ function Ni(r4) {
39734
39741
  return r4.length === 1 ? r4[0] : r4.map(I).join("");
39735
39742
  }
39736
- function Le(r4, e) {
39737
- let t = Ue(r4);
39743
+ function Be(r4, e) {
39744
+ let t = qe(r4);
39738
39745
  if (t)
39739
- return wi(t.elements, e);
39746
+ return Ui(t.elements, e);
39740
39747
  }
39741
- function wi(r4, e) {
39748
+ function Ui(r4, e) {
39742
39749
  let t = r4[e] ?? r4[e + "[x]"];
39743
39750
  if (t)
39744
39751
  return t;
@@ -39751,7 +39758,7 @@ function wi(r4, e) {
39751
39758
  }
39752
39759
  }
39753
39760
  }
39754
- function _(r4) {
39761
+ function F(r4) {
39755
39762
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
39756
39763
  }
39757
39764
  function me(r4) {
@@ -39827,7 +39834,7 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39827
39834
  if (!t)
39828
39835
  return e;
39829
39836
  let n = t.eval(r4, e);
39830
- return Fe([...e, ...n]);
39837
+ return Ue([...e, ...n]);
39831
39838
  }, combine: (r4, e, t) => {
39832
39839
  if (!t)
39833
39840
  return e;
@@ -39841,7 +39848,7 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39841
39848
  }, toBoolean: (r4, e) => {
39842
39849
  if (e.length === 0)
39843
39850
  return [];
39844
- let [{ value: t }] = U(e, 1);
39851
+ let [{ value: t }] = L(e, 1);
39845
39852
  if (typeof t == "boolean")
39846
39853
  return [{ type: c.boolean, value: t }];
39847
39854
  if (typeof t == "number" && (t === 0 || t === 1))
@@ -39857,37 +39864,37 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39857
39864
  }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(b.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39858
39865
  if (e.length === 0)
39859
39866
  return [];
39860
- let [{ value: t }] = U(e, 1);
39867
+ let [{ value: t }] = L(e, 1);
39861
39868
  return typeof t == "number" ? [{ type: c.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: c.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: c.integer, value: t ? 1 : 0 }] : [];
39862
39869
  }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(b.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39863
39870
  if (e.length === 0)
39864
39871
  return [];
39865
- let [{ value: t }] = U(e, 1);
39872
+ let [{ value: t }] = L(e, 1);
39866
39873
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: ce(t) }] : [];
39867
39874
  }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(b.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39868
39875
  if (e.length === 0)
39869
39876
  return [];
39870
- let [{ value: t }] = U(e, 1);
39877
+ let [{ value: t }] = L(e, 1);
39871
39878
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: ce(t) }] : [];
39872
39879
  }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(b.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39873
39880
  if (e.length === 0)
39874
39881
  return [];
39875
- let [{ value: t }] = U(e, 1);
39882
+ let [{ value: t }] = L(e, 1);
39876
39883
  return typeof t == "number" ? [{ type: c.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: c.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: c.decimal, value: t ? 1 : 0 }] : [];
39877
39884
  }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(b.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39878
39885
  if (e.length === 0)
39879
39886
  return [];
39880
- let [{ value: t }] = U(e, 1);
39887
+ let [{ value: t }] = L(e, 1);
39881
39888
  return P(t) ? [{ type: c.Quantity, value: t }] : typeof t == "number" ? [{ type: c.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: c.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: c.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
39882
39889
  }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(b.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39883
39890
  if (e.length === 0)
39884
39891
  return [];
39885
- let [{ value: t }] = U(e, 1);
39892
+ let [{ value: t }] = L(e, 1);
39886
39893
  return t == null ? [] : P(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39887
39894
  }, convertsToString: (r4, e) => e.length === 0 ? [] : d(b.toString(r4, e).length === 1), toTime: (r4, e) => {
39888
39895
  if (e.length === 0)
39889
39896
  return [];
39890
- let [{ value: t }] = U(e, 1);
39897
+ let [{ value: t }] = L(e, 1);
39891
39898
  if (typeof t == "string") {
39892
39899
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
39893
39900
  if (n)
@@ -39897,7 +39904,7 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39897
39904
  }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(b.toTime(r4, e).length === 1), indexOf: (r4, e, t) => k((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => k((i2, o, s) => {
39898
39905
  let a = o, u2 = s ? a + s : i2.length;
39899
39906
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, u2);
39900
- }, r4, e, t, n), startsWith: (r4, e, t) => k((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => k((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => k((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => k((t) => t.toUpperCase(), r4, e), lower: (r4, e) => k((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => k((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => k((t) => t.length, r4, e), toChars: (r4, e) => k((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: ge, descendants: ge, trace: (r4, e, t) => e, now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39907
+ }, r4, e, t, n), startsWith: (r4, e, t) => k((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => k((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => k((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => k((t) => t.toUpperCase(), r4, e), lower: (r4, e) => k((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => k((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => k((t) => t.length, r4, e), toChars: (r4, e) => k((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => U(Math.abs, r4, e), ceiling: (r4, e) => U(Math.ceil, r4, e), exp: (r4, e) => U(Math.exp, r4, e), floor: (r4, e) => U(Math.floor, r4, e), ln: (r4, e) => U(Math.log, r4, e), log: (r4, e, t) => U((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => U(Math.pow, r4, e, t), round: (r4, e) => U(Math.round, r4, e), sqrt: (r4, e) => U(Math.sqrt, r4, e), truncate: (r4, e) => U((t) => t | 0, r4, e), children: ge, descendants: ge, trace: (r4, e, t) => e, now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39901
39908
  let o = b.toDateTime(r4, t.eval(r4, e));
39902
39909
  if (o.length === 0)
39903
39910
  throw new Error("Invalid start date");
@@ -39911,7 +39918,7 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39911
39918
  return [{ type: c.Quantity, value: { value: u2[a], unit: a } }];
39912
39919
  }, is: (r4, e, t) => {
39913
39920
  let n = "";
39914
- return t instanceof B ? n = t.name : t instanceof G && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: _e(i2, n) })) : [];
39921
+ return t instanceof B ? n = t.name : t instanceof G && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: Le(i2, n) })) : [];
39915
39922
  }, not: (r4, e) => b.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39916
39923
  let n = t.value, i2;
39917
39924
  if (typeof n == "string")
@@ -39931,7 +39938,7 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39931
39938
  return { type: o, value: { resourceType: o, id: s } };
39932
39939
  }
39933
39940
  return { type: c.BackboneElement, value: void 0 };
39934
- }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: c.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: c.BackboneElement, value: { namespace: "System", name: "Integer" } } : _(t) ? { type: c.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: c.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39941
+ }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: c.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: c.BackboneElement, value: { namespace: "System", name: "Integer" } } : F(t) ? { type: c.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: c.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39935
39942
  let n = t.eval(r4, e)[0].value;
39936
39943
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
39937
39944
  throw new Error("Expected a StructureDefinition URL");
@@ -39941,22 +39948,22 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39941
39948
  function k(r4, e, t, ...n) {
39942
39949
  if (t.length === 0)
39943
39950
  return [];
39944
- let [{ value: i2 }] = U(t, 1);
39951
+ let [{ value: i2 }] = L(t, 1);
39945
39952
  if (typeof i2 != "string")
39946
39953
  throw new Error("String function cannot be called with non-string");
39947
39954
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
39948
39955
  return o === void 0 ? [] : Array.isArray(o) ? o.map(g) : [g(o)];
39949
39956
  }
39950
- function L(r4, e, t, ...n) {
39957
+ function U(r4, e, t, ...n) {
39951
39958
  if (t.length === 0)
39952
39959
  return [];
39953
- let [{ value: i2 }] = U(t, 1), o = P(i2), s = o ? i2.value : i2;
39960
+ let [{ value: i2 }] = L(t, 1), o = P(i2), s = o ? i2.value : i2;
39954
39961
  if (typeof s != "number")
39955
39962
  throw new Error("Math function cannot be called with non-number");
39956
39963
  let a = r4(s, ...n.map((f) => f.eval(e, t)[0]?.value)), u2 = o ? c.Quantity : t[0].type, l2 = o ? { ...i2, value: a } : a;
39957
39964
  return [{ type: u2, value: l2 }];
39958
39965
  }
39959
- function U(r4, e) {
39966
+ function L(r4, e) {
39960
39967
  if (r4.length !== e)
39961
39968
  throw new Error(`Expected ${e} arguments`);
39962
39969
  for (let t of r4)
@@ -39993,13 +40000,13 @@ var B = class {
39993
40000
  evalValue(e) {
39994
40001
  let t = e.value;
39995
40002
  if (!(!t || typeof t != "object"))
39996
- return _(t) && t.resourceType === this.name ? e : A(e, this.name);
40003
+ return F(t) && t.resourceType === this.name ? e : A(e, this.name);
39997
40004
  }
39998
40005
  toString() {
39999
40006
  return this.name;
40000
40007
  }
40001
40008
  };
40002
- var qe = class {
40009
+ var je = class {
40003
40010
  eval() {
40004
40011
  return [];
40005
40012
  }
@@ -40007,7 +40014,7 @@ var qe = class {
40007
40014
  return "{}";
40008
40015
  }
40009
40016
  };
40010
- var $e = class extends Pe {
40017
+ var Qe = class extends Pe {
40011
40018
  constructor(t, n, i2) {
40012
40019
  super(t, n);
40013
40020
  this.impl = i2;
@@ -40019,7 +40026,7 @@ var $e = class extends Pe {
40019
40026
  return this.operator + this.child.toString();
40020
40027
  }
40021
40028
  };
40022
- var X = class extends Q {
40029
+ var Z = class extends Q {
40023
40030
  constructor(e, t) {
40024
40031
  super("as", e, t);
40025
40032
  }
@@ -40045,7 +40052,7 @@ var C = class extends S {
40045
40052
  return typeof f == "boolean" ? d(f) : P(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [g(f)];
40046
40053
  }
40047
40054
  };
40048
- var je = class extends Q {
40055
+ var He = class extends Q {
40049
40056
  constructor(e, t) {
40050
40057
  super("&", e, t);
40051
40058
  }
@@ -40054,7 +40061,7 @@ var je = class extends Q {
40054
40061
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: c.string, value: o.map((s) => s.value).join("") }] : o;
40055
40062
  }
40056
40063
  };
40057
- var Qe = class extends S {
40064
+ var Ge = class extends S {
40058
40065
  constructor(e, t) {
40059
40066
  super("contains", e, t);
40060
40067
  }
@@ -40063,12 +40070,12 @@ var Qe = class extends S {
40063
40070
  return d(n.some((o) => o.value === i2[0].value));
40064
40071
  }
40065
40072
  };
40066
- var He = class extends S {
40073
+ var Ke = class extends S {
40067
40074
  constructor(e, t) {
40068
40075
  super("in", e, t);
40069
40076
  }
40070
40077
  eval(e, t) {
40071
- let n = F(this.left.eval(e, t)), i2 = this.right.eval(e, t);
40078
+ let n = _(this.left.eval(e, t)), i2 = this.right.eval(e, t);
40072
40079
  return n ? d(i2.some((o) => o.value === n.value)) : [];
40073
40080
  }
40074
40081
  };
@@ -40089,46 +40096,46 @@ var ue = class extends Q {
40089
40096
  }
40090
40097
  eval(e, t) {
40091
40098
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40092
- return Fe([...n, ...i2]);
40099
+ return Ue([...n, ...i2]);
40093
40100
  }
40094
40101
  };
40095
- var Ge = class extends S {
40102
+ var We = class extends S {
40096
40103
  constructor(e, t) {
40097
40104
  super("=", e, t);
40098
40105
  }
40099
40106
  eval(e, t) {
40100
40107
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40101
- return bt(n, i2);
40108
+ return Ot(n, i2);
40102
40109
  }
40103
40110
  };
40104
- var Ke = class extends S {
40111
+ var ze = class extends S {
40105
40112
  constructor(e, t) {
40106
40113
  super("!=", e, t);
40107
40114
  }
40108
40115
  eval(e, t) {
40109
40116
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40110
- return Et(bt(n, i2));
40117
+ return kt(Ot(n, i2));
40111
40118
  }
40112
40119
  };
40113
- var We = class extends S {
40120
+ var Je = class extends S {
40114
40121
  constructor(e, t) {
40115
40122
  super("~", e, t);
40116
40123
  }
40117
40124
  eval(e, t) {
40118
40125
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40119
- return Rt(n, i2);
40126
+ return Vt(n, i2);
40120
40127
  }
40121
40128
  };
40122
- var ze = class extends S {
40129
+ var Ye = class extends S {
40123
40130
  constructor(e, t) {
40124
40131
  super("!~", e, t);
40125
40132
  }
40126
40133
  eval(e, t) {
40127
40134
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40128
- return Et(Rt(n, i2));
40135
+ return kt(Vt(n, i2));
40129
40136
  }
40130
40137
  };
40131
- var Z = class extends S {
40138
+ var X = class extends S {
40132
40139
  constructor(e, t) {
40133
40140
  super("is", e, t);
40134
40141
  }
@@ -40137,46 +40144,46 @@ var Z = class extends S {
40137
40144
  if (n.length !== 1)
40138
40145
  return [];
40139
40146
  let i2 = this.right.name;
40140
- return d(_e(n[0], i2));
40147
+ return d(Le(n[0], i2));
40141
40148
  }
40142
40149
  };
40143
- var Je = class extends S {
40150
+ var Ze = class extends S {
40144
40151
  constructor(e, t) {
40145
40152
  super("and", e, t);
40146
40153
  }
40147
40154
  eval(e, t) {
40148
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
40155
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40149
40156
  return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
40150
40157
  }
40151
40158
  };
40152
- var Ye = class extends S {
40159
+ var Xe = class extends S {
40153
40160
  constructor(e, t) {
40154
40161
  super("or", e, t);
40155
40162
  }
40156
40163
  eval(e, t) {
40157
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
40164
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40158
40165
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
40159
40166
  }
40160
40167
  };
40161
- var Xe = class extends S {
40168
+ var et = class extends S {
40162
40169
  constructor(e, t) {
40163
40170
  super("xor", e, t);
40164
40171
  }
40165
40172
  eval(e, t) {
40166
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
40173
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40167
40174
  return !n || !i2 ? [] : d(n.value !== i2.value);
40168
40175
  }
40169
40176
  };
40170
- var Ze = class extends S {
40177
+ var tt = class extends S {
40171
40178
  constructor(e, t) {
40172
40179
  super("implies", e, t);
40173
40180
  }
40174
40181
  eval(e, t) {
40175
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
40182
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40176
40183
  return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(false);
40177
40184
  }
40178
40185
  };
40179
- var $ = class {
40186
+ var j = class {
40180
40187
  constructor(e, t) {
40181
40188
  this.name = e;
40182
40189
  this.args = t;
@@ -40212,56 +40219,56 @@ var ee = class {
40212
40219
  };
40213
40220
  var xe = ["!=", "!~", "<=", ">=", "{}", "->"];
40214
40221
  var m = { 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 };
40215
- var Oi = { parse(r4) {
40222
+ var qi = { parse(r4) {
40216
40223
  let e = r4.consumeAndParse();
40217
40224
  if (!r4.match(")"))
40218
40225
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
40219
40226
  return e;
40220
40227
  } };
40221
- var Vi = { parse(r4, e) {
40228
+ var $i = { parse(r4, e) {
40222
40229
  let t = r4.consumeAndParse();
40223
40230
  if (!r4.match("]"))
40224
40231
  throw new Error("Parse error: expected `]`");
40225
40232
  return new ee(e, t);
40226
40233
  }, precedence: m.Indexer };
40227
- var Di = { parse(r4, e) {
40234
+ var ji = { parse(r4, e) {
40228
40235
  if (!(e instanceof B))
40229
40236
  throw new Error("Unexpected parentheses");
40230
40237
  let t = [];
40231
40238
  for (; !r4.match(")"); )
40232
40239
  t.push(r4.consumeAndParse()), r4.match(",");
40233
- return new $(e.name, t);
40240
+ return new j(e.name, t);
40234
40241
  }, precedence: m.FunctionCall };
40235
- function Ni(r4) {
40242
+ function Qi(r4) {
40236
40243
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
40237
40244
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
40238
40245
  }
40239
40246
  function Te() {
40240
- return new Ce().registerPrefix("String", { parse: (r4, e) => new O({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: c.dateTime, value: ce(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: c.Quantity, value: Ni(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new O({ type: e.value.includes(".") ? c.decimal : c.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new O({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new O({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new qe() }).registerPrefix("(", Oi).registerInfix("[", Vi).registerInfix("(", Di).prefix("+", m.UnaryAdd, (r4, e) => new $e("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new C("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new G(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new C("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new C("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new C("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new C("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new ue(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new Ge(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new Ke(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new We(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new ze(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new C("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new C("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new C(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new C(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new je(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Je(r4, t)).infixLeft("as", m.As, (r4, e, t) => new X(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new Qe(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new C("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new He(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new Z(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new C("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new Ye(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new Xe(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new Ze(r4, t));
40247
+ return new Ce().registerPrefix("String", { parse: (r4, e) => new O({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: c.dateTime, value: ce(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: c.Quantity, value: Qi(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new O({ type: e.value.includes(".") ? c.decimal : c.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new O({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new O({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new je() }).registerPrefix("(", qi).registerInfix("[", $i).registerInfix("(", ji).prefix("+", m.UnaryAdd, (r4, e) => new Qe("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new C("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new G(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new C("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new C("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new C("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new C("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new ue(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new We(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new ze(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new Je(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new Ye(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new C("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new C("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new C(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new C(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new He(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Ze(r4, t)).infixLeft("as", m.As, (r4, e, t) => new Z(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new Ge(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new C("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new Ke(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new X(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new C("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new Xe(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new et(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new tt(r4, t));
40241
40248
  }
40242
- var Mi = Te();
40243
- var $r = ((f) => (f.BOOLEAN = "BOOLEAN", f.NUMBER = "NUMBER", f.QUANTITY = "QUANTITY", f.TEXT = "TEXT", f.REFERENCE = "REFERENCE", f.CANONICAL = "CANONICAL", f.DATE = "DATE", f.DATETIME = "DATETIME", f.PERIOD = "PERIOD", f.UUID = "UUID", f))($r || {});
40244
- var $i = ((x) => (x.EQUALS = "eq", x.NOT_EQUALS = "ne", x.GREATER_THAN = "gt", x.LESS_THAN = "lt", x.GREATER_THAN_OR_EQUALS = "ge", x.LESS_THAN_OR_EQUALS = "le", x.STARTS_AFTER = "sa", x.ENDS_BEFORE = "eb", x.APPROXIMATELY = "ap", x.CONTAINS = "contains", x.EXACT = "exact", x.TEXT = "text", x.NOT = "not", x.ABOVE = "above", x.BELOW = "below", x.IN = "in", x.NOT_IN = "not-in", x.OF_TYPE = "of-type", x.MISSING = "missing", x.IDENTIFIER = "identifier", x.ITERATE = "iterate", x))($i || {});
40245
- var uo = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(uo || {});
40246
- function en(r4) {
40249
+ var Hi = Te();
40250
+ var Jr = ((f) => (f.BOOLEAN = "BOOLEAN", f.NUMBER = "NUMBER", f.QUANTITY = "QUANTITY", f.TEXT = "TEXT", f.REFERENCE = "REFERENCE", f.CANONICAL = "CANONICAL", f.DATE = "DATE", f.DATETIME = "DATETIME", f.PERIOD = "PERIOD", f.UUID = "UUID", f))(Jr || {});
40251
+ var Zi = ((x) => (x.EQUALS = "eq", x.NOT_EQUALS = "ne", x.GREATER_THAN = "gt", x.LESS_THAN = "lt", x.GREATER_THAN_OR_EQUALS = "ge", x.LESS_THAN_OR_EQUALS = "le", x.STARTS_AFTER = "sa", x.ENDS_BEFORE = "eb", x.APPROXIMATELY = "ap", x.CONTAINS = "contains", x.EXACT = "exact", x.TEXT = "text", x.NOT = "not", x.ABOVE = "above", x.BELOW = "below", x.IN = "in", x.NOT_IN = "not-in", x.OF_TYPE = "of-type", x.MISSING = "missing", x.IDENTIFIER = "identifier", x.ITERATE = "iterate", x))(Zi || {});
40252
+ var vo = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(vo || {});
40253
+ function un(r4) {
40247
40254
  if (typeof window < "u")
40248
40255
  return window.atob(r4);
40249
40256
  if (typeof Buffer < "u")
40250
40257
  return Buffer.from(r4, "base64").toString("binary");
40251
40258
  throw new Error("Unable to decode base64");
40252
40259
  }
40253
- function tn(r4) {
40260
+ function ln(r4) {
40254
40261
  if (typeof window < "u")
40255
40262
  return window.btoa(r4);
40256
40263
  if (typeof Buffer < "u")
40257
40264
  return Buffer.from(r4, "binary").toString("base64");
40258
40265
  throw new Error("Unable to encode base64");
40259
40266
  }
40260
- function qt() {
40267
+ function Wt() {
40261
40268
  let r4 = new Uint32Array(28);
40262
- return crypto.getRandomValues(r4), xr(r4.buffer);
40269
+ return crypto.getRandomValues(r4), vr(r4.buffer);
40263
40270
  }
40264
- async function rn(r4) {
40271
+ async function dn(r4) {
40265
40272
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
40266
40273
  }
40267
40274
  function te() {
@@ -40270,7 +40277,7 @@ function te() {
40270
40277
  return (r4 === "x" ? e : e & 3 | 8).toString(16);
40271
40278
  });
40272
40279
  }
40273
- var tt = class {
40280
+ var nt = class {
40274
40281
  constructor(e = 10) {
40275
40282
  this.max = e, this.cache = /* @__PURE__ */ new Map();
40276
40283
  }
@@ -40320,7 +40327,7 @@ var Se = class {
40320
40327
  return !e.defaultPrevented;
40321
40328
  }
40322
40329
  };
40323
- var rt = class {
40330
+ var it = class {
40324
40331
  constructor() {
40325
40332
  this.emitter = new Se();
40326
40333
  }
@@ -40334,41 +40341,41 @@ var rt = class {
40334
40341
  this.emitter.removeEventListener(e, t);
40335
40342
  }
40336
40343
  };
40337
- var $t = { "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" };
40338
- var To = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40339
- var jt = ["DiagnosticReport-update"];
40340
- function sn(r4) {
40341
- return jt.includes(r4);
40344
+ var zt = { "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" };
40345
+ var Io = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40346
+ var Jt = ["DiagnosticReport-update"];
40347
+ function mn(r4) {
40348
+ return Jt.includes(r4);
40342
40349
  }
40343
- function an(r4) {
40344
- if (jt.includes(r4))
40350
+ function hn(r4) {
40351
+ if (Jt.includes(r4))
40345
40352
  throw new p(h(`'context.version' is required for '${r4}'.`));
40346
40353
  }
40347
- var vo = { "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" } } };
40348
- function So(r4) {
40349
- return To.includes(r4);
40354
+ var ko = { "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" } } };
40355
+ function Oo(r4) {
40356
+ return Io.includes(r4);
40350
40357
  }
40351
- function cn(r4) {
40358
+ function gn(r4) {
40352
40359
  return !!r4.endpoint;
40353
40360
  }
40354
- function Qt(r4) {
40355
- if (!it(r4))
40361
+ function Yt(r4) {
40362
+ if (!st(r4))
40356
40363
  throw new p(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40357
40364
  let { channelType: e, mode: t, topic: n, events: i2 } = r4, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
40358
- return cn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40365
+ return gn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40359
40366
  }
40360
- function it(r4) {
40367
+ function st(r4) {
40361
40368
  if (typeof r4 != "object")
40362
40369
  return false;
40363
40370
  let { channelType: e, mode: t, topic: n, events: i2 } = r4;
40364
40371
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
40365
40372
  return false;
40366
40373
  for (let o of i2)
40367
- if (!$t[o])
40374
+ if (!zt[o])
40368
40375
  return false;
40369
- return !(cn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40376
+ return !(gn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40370
40377
  }
40371
- function on(r4, e, t, n) {
40378
+ function fn(r4, e, t, n) {
40372
40379
  if (typeof e != "object")
40373
40380
  throw new p(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40374
40381
  if (!(e.id && typeof e.id == "string"))
@@ -40377,30 +40384,30 @@ function on(r4, e, t, n) {
40377
40384
  throw new p(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40378
40385
  let i2 = n.resourceType;
40379
40386
  if (i2 !== "*") {
40380
- if (!So(e.resourceType))
40387
+ if (!Oo(e.resourceType))
40381
40388
  throw new p(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40382
40389
  if (i2 && e.resourceType !== i2)
40383
40390
  throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40384
40391
  }
40385
40392
  }
40386
- function Eo(r4, e, t, n, i2) {
40393
+ function Vo(r4, e, t, n, i2) {
40387
40394
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), !n.isArray)
40388
- on(r4, e.resource, t, n);
40395
+ fn(r4, e.resource, t, n);
40389
40396
  else {
40390
40397
  let { resources: o } = e;
40391
40398
  if (!o)
40392
40399
  throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
40393
40400
  for (let s of o)
40394
- on(r4, s, t, n);
40401
+ fn(r4, s, t, n);
40395
40402
  }
40396
40403
  }
40397
- function bo(r4, e) {
40398
- let t = /* @__PURE__ */ new Map(), n = vo[r4];
40404
+ function Do(r4, e) {
40405
+ let t = /* @__PURE__ */ new Map(), n = ko[r4];
40399
40406
  for (let i2 = 0; i2 < e.length; i2++) {
40400
40407
  let o = e[i2].key;
40401
40408
  if (!n[o])
40402
40409
  throw new p(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40403
- Eo(r4, e[i2], i2, n[o], t);
40410
+ Vo(r4, e[i2], i2, n[o], t);
40404
40411
  }
40405
40412
  for (let [i2, o] of Object.entries(n)) {
40406
40413
  if (!(o.optional || t.has(i2)))
@@ -40409,23 +40416,23 @@ function bo(r4, e) {
40409
40416
  throw new p(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40410
40417
  }
40411
40418
  }
40412
- function Ht(r4, e, t, n) {
40419
+ function Zt(r4, e, t, n) {
40413
40420
  if (!(r4 && typeof r4 == "string"))
40414
40421
  throw new p(h("Must provide a topic."));
40415
- if (!$t[e])
40416
- throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys($t).join(", ")}`));
40422
+ if (!zt[e])
40423
+ throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(zt).join(", ")}`));
40417
40424
  if (typeof t != "object")
40418
40425
  throw new p(h("context must be a context object or array of context objects."));
40419
- if (jt.includes(e) && !n)
40426
+ if (Jt.includes(e) && !n)
40420
40427
  throw new p(h(`The '${e}' event must contain a 'context.versionId'.`));
40421
40428
  let i2 = Array.isArray(t) ? t : [t];
40422
- return bo(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: te(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40429
+ return Do(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: te(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40423
40430
  }
40424
- var nt = class extends rt {
40431
+ var ot = class extends it {
40425
40432
  constructor(e) {
40426
40433
  if (super(), this.subRequest = e, !e.endpoint)
40427
40434
  throw new p(h("Subscription request should contain an endpoint."));
40428
- if (!it(e))
40435
+ if (!st(e))
40429
40436
  throw new p(h("Subscription request failed validation."));
40430
40437
  let t = new WebSocket(e.endpoint);
40431
40438
  t.addEventListener("open", () => {
@@ -40444,39 +40451,39 @@ var nt = class extends rt {
40444
40451
  this.websocket.close();
40445
40452
  }
40446
40453
  };
40447
- function Ro(r4) {
40448
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = en(e), n = Array.from(t).reduce((o, s) => {
40454
+ function No(r4) {
40455
+ let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = un(e), n = Array.from(t).reduce((o, s) => {
40449
40456
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
40450
40457
  return `${o}%${a}`;
40451
40458
  }, ""), i2 = decodeURIComponent(n);
40452
40459
  return JSON.parse(i2);
40453
40460
  }
40454
- function un(r4) {
40461
+ function yn(r4) {
40455
40462
  return r4.split(".").length === 3;
40456
40463
  }
40457
- function ot(r4) {
40464
+ function at(r4) {
40458
40465
  let [e, t, n] = r4.split(".");
40459
- return Ro(t);
40466
+ return No(t);
40460
40467
  }
40461
- function ln(r4) {
40468
+ function xn(r4) {
40462
40469
  try {
40463
- return typeof ot(r4).login_id == "string";
40470
+ return typeof at(r4).login_id == "string";
40464
40471
  } catch {
40465
40472
  return false;
40466
40473
  }
40467
40474
  }
40468
- function dn(r4) {
40475
+ function Tn(r4) {
40469
40476
  try {
40470
- let t = ot(r4).exp;
40477
+ let t = at(r4).exp;
40471
40478
  return typeof t == "number" ? t * 1e3 : void 0;
40472
40479
  } catch {
40473
40480
  return;
40474
40481
  }
40475
40482
  }
40476
- var Po;
40483
+ var Mo;
40477
40484
  var w = class {
40478
40485
  constructor(e) {
40479
- this[Po] = "ReadablePromise";
40486
+ this[Mo] = "ReadablePromise";
40480
40487
  this.status = "pending";
40481
40488
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
40482
40489
  throw this.status = "error", this.error = t, t;
@@ -40508,10 +40515,10 @@ var w = class {
40508
40515
  return this.suspender.finally(e);
40509
40516
  }
40510
40517
  };
40511
- Po = Symbol.toStringTag;
40518
+ Mo = Symbol.toStringTag;
40512
40519
  var Ee = class {
40513
40520
  constructor(e) {
40514
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Gt());
40521
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Xt());
40515
40522
  }
40516
40523
  clear() {
40517
40524
  this.storage.clear();
@@ -40527,10 +40534,10 @@ var Ee = class {
40527
40534
  return t ? JSON.parse(t) : void 0;
40528
40535
  }
40529
40536
  setObject(e, t) {
40530
- this.setString(e, t ? hr(t) : void 0);
40537
+ this.setString(e, t ? yr(t) : void 0);
40531
40538
  }
40532
40539
  };
40533
- var Gt = class {
40540
+ var Xt = class {
40534
40541
  constructor() {
40535
40542
  this.data = /* @__PURE__ */ new Map();
40536
40543
  }
@@ -40553,24 +40560,24 @@ var Gt = class {
40553
40560
  return Array.from(this.data.keys())[e];
40554
40561
  }
40555
40562
  };
40556
- var Co = V.FHIR_JSON + ", */*; q=0.1";
40557
- var Ao = "https://api.medplum.com/";
40558
- var wo = 1e3;
40559
- var Io = 6e4;
40560
- var ko = 0;
40561
- var fn = "Binary/";
40562
- var mn = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
40563
- var Oo = ((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))(Oo || {});
40564
- var Vo = ((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))(Vo || {});
40565
- var Do = ((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))(Do || {});
40566
- var No = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(No || {});
40567
- var hn = class extends Se {
40563
+ var Fo = V.FHIR_JSON + ", */*; q=0.1";
40564
+ var _o = "https://api.medplum.com/";
40565
+ var Uo = 1e3;
40566
+ var Lo = 6e4;
40567
+ var Bo = 0;
40568
+ var Sn = "Binary/";
40569
+ var En = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
40570
+ var qo = ((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))(qo || {});
40571
+ var $o = ((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))($o || {});
40572
+ var jo = ((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))(jo || {});
40573
+ var Qo = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Qo || {});
40574
+ var bn = class extends Se {
40568
40575
  constructor(t) {
40569
40576
  super();
40570
40577
  this.initComplete = true;
40571
40578
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40572
40579
  throw new Error("Base URL must start with http or https");
40573
- if (this.options = t ?? {}, this.fetch = t?.fetch ?? Mo(), this.storage = t?.storage ?? new Ee(), this.createPdfImpl = t?.createPdf, this.baseUrl = yn(t?.baseUrl ?? Ao), this.fhirBaseUrl = yn(st(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = st(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = st(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = st(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" ? ko : Io), this.cacheTime > 0 ? this.requestCache = new tt(t?.resourceCacheSize ?? wo) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40580
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? Ho(), this.storage = t?.storage ?? new Ee(), this.createPdfImpl = t?.createPdf, this.baseUrl = Pn(t?.baseUrl ?? _o), this.fhirBaseUrl = Pn(ct(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = ct(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = ct(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = ct(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" ? Bo : Lo), this.cacheTime > 0 ? this.requestCache = new nt(t?.resourceCacheSize ?? Uo) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40574
40581
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40575
40582
  else if (this.storage.getInitPromise !== void 0) {
40576
40583
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40735,7 +40742,7 @@ var hn = class extends Se {
40735
40742
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i2);
40736
40743
  if (a)
40737
40744
  return a.value;
40738
- let u2 = new w(this.search(t, n, i2).then(Tn));
40745
+ let u2 = new w(this.search(t, n, i2).then(An));
40739
40746
  return this.setCacheEntry(s, u2), u2;
40740
40747
  }
40741
40748
  async *searchResourcePages(t, n, i2) {
@@ -40744,7 +40751,7 @@ var hn = class extends Se {
40744
40751
  let s = new URL(o).searchParams, a = await this.search(t, s, i2), u2 = a.link?.find((l2) => l2.relation === "next");
40745
40752
  if (!a.entry?.length && !u2)
40746
40753
  break;
40747
- yield Tn(a), o = u2?.url ? new URL(u2.url) : void 0;
40754
+ yield An(a), o = u2?.url ? new URL(u2.url) : void 0;
40748
40755
  }
40749
40756
  }
40750
40757
  searchValueSet(t, n, i2) {
@@ -40763,7 +40770,7 @@ var hn = class extends Se {
40763
40770
  if (!n)
40764
40771
  return;
40765
40772
  if (n === "system")
40766
- return mn;
40773
+ return En;
40767
40774
  let [i2, o] = n.split("/");
40768
40775
  if (!(!i2 || !o))
40769
40776
  return this.getCached(i2, o);
@@ -40776,12 +40783,12 @@ var hn = class extends Se {
40776
40783
  if (!i2)
40777
40784
  return new w(Promise.reject(new Error("Missing reference")));
40778
40785
  if (i2 === "system")
40779
- return new w(Promise.resolve(mn));
40786
+ return new w(Promise.resolve(En));
40780
40787
  let [o, s] = i2.split("/");
40781
40788
  return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40782
40789
  }
40783
40790
  requestSchema(t) {
40784
- if (Fr(t))
40791
+ if (Qr(t))
40785
40792
  return Promise.resolve();
40786
40793
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40787
40794
  if (i2)
@@ -40827,21 +40834,21 @@ var hn = class extends Se {
40827
40834
  target
40828
40835
  }
40829
40836
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40830
- Vt(a.data.StructureDefinitionList);
40837
+ Lt(a.data.StructureDefinitionList);
40831
40838
  for (let u2 of a.data.SearchParameterList)
40832
- Nt(u2);
40839
+ qt(u2);
40833
40840
  })());
40834
40841
  return this.setCacheEntry(n, o), o;
40835
40842
  }
40836
40843
  requestProfileSchema(t) {
40837
- if (Lr(t))
40844
+ if (Gr(t))
40838
40845
  return Promise.resolve();
40839
40846
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40840
40847
  if (i2)
40841
40848
  return i2.value;
40842
40849
  let o = new w((async () => {
40843
40850
  let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40844
- s ? Vt([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40851
+ s ? Lt([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40845
40852
  })());
40846
40853
  return this.setCacheEntry(n, o), o;
40847
40854
  }
@@ -40933,7 +40940,7 @@ var hn = class extends Se {
40933
40940
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40934
40941
  }
40935
40942
  pushToAgent(t, n, i2, o, s, a) {
40936
- return this.post(this.fhirUrl("Agent", dr(t), "$push"), { destination: fe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40943
+ return this.post(this.fhirUrl("Agent", fr(t), "$push"), { destination: fe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40937
40944
  }
40938
40945
  getActiveLogin() {
40939
40946
  return this.storage.getObject("activeLogin");
@@ -40945,7 +40952,7 @@ var hn = class extends Se {
40945
40952
  return this.accessToken;
40946
40953
  }
40947
40954
  setAccessToken(t, n) {
40948
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = dn(t), this.medplumServer = ln(t);
40955
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = Tn(t), this.medplumServer = xn(t);
40949
40956
  }
40950
40957
  getLogins() {
40951
40958
  return this.storage.getObject("logins") ?? [];
@@ -40993,11 +41000,11 @@ var hn = class extends Se {
40993
41000
  async download(t, n = {}) {
40994
41001
  this.refreshPromise && await this.refreshPromise;
40995
41002
  let i2 = t.toString();
40996
- return i2.startsWith(fn) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
41003
+ return i2.startsWith(Sn) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40997
41004
  }
40998
41005
  async uploadMedia(t, n, i2, o, s) {
40999
41006
  let a = await this.createBinary(t, i2, n);
41000
- return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: fn + a.id, title: i2 }, ...o }, s);
41007
+ return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: Sn + a.id, title: i2 }, ...o }, s);
41001
41008
  }
41002
41009
  async bulkExport(t = "", n, i2, o) {
41003
41010
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -41009,7 +41016,7 @@ var hn = class extends Se {
41009
41016
  i2.Prefer = "respond-async";
41010
41017
  let o = await this.fetchWithRetry(t, n);
41011
41018
  if (o.status === 202) {
41012
- let s = await xn(o);
41019
+ let s = await Cn(o);
41013
41020
  if (s)
41014
41021
  return this.pollStatus(s);
41015
41022
  }
@@ -41043,7 +41050,7 @@ var hn = class extends Se {
41043
41050
  return;
41044
41051
  let a = t.headers.get("content-type")?.includes("json");
41045
41052
  if (t.status === 404 && !a)
41046
- throw new p(sr);
41053
+ throw new p(cr);
41047
41054
  let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
41048
41055
  if (t.status === 201 && u2 && l2 === "follow")
41049
41056
  return this.request("GET", u2, { ...o, body: void 0 });
@@ -41070,7 +41077,7 @@ var hn = class extends Se {
41070
41077
  } catch (u2) {
41071
41078
  this.retryCatch(a, i2, u2);
41072
41079
  }
41073
- await Tt(o);
41080
+ await St(o);
41074
41081
  }
41075
41082
  return s;
41076
41083
  }
@@ -41091,10 +41098,10 @@ var hn = class extends Se {
41091
41098
  this.addFetchOptionsDefaults(s);
41092
41099
  let a = await this.fetchWithRetry(t, s);
41093
41100
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
41094
- let u2 = await xn(a);
41101
+ let u2 = await Cn(a);
41095
41102
  u2 && (i2 = await this.fetchWithRetry(u2, s));
41096
41103
  }
41097
- await Tt(o);
41104
+ await St(o);
41098
41105
  }
41099
41106
  return this.parseResponse(i2, "POST", t);
41100
41107
  }
@@ -41112,12 +41119,12 @@ var hn = class extends Se {
41112
41119
  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 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
41113
41120
  for (let o = 0; o < t.length; o++) {
41114
41121
  let s = t[o], a = i2.entry?.[o];
41115
- a?.response?.outcome && !ht(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
41122
+ a?.response?.outcome && !yt(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
41116
41123
  }
41117
41124
  }
41118
41125
  addFetchOptionsDefaults(t) {
41119
41126
  let n = t.headers;
41120
- n || (n = {}, t.headers = n), n.Accept || (n.Accept = Co), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = V.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
41127
+ n || (n = {}, t.headers = n), n.Accept || (n.Accept = Fo), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = V.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
41121
41128
  }
41122
41129
  setRequestContentType(t, n) {
41123
41130
  t.headers || (t.headers = {});
@@ -41125,26 +41132,26 @@ var hn = class extends Se {
41125
41132
  i2["Content-Type"] = n;
41126
41133
  }
41127
41134
  setRequestBody(t, n) {
41128
- typeof n == "string" || typeof Blob < "u" && n instanceof Blob || typeof File < "u" && n instanceof File || typeof Uint8Array < "u" && n instanceof Uint8Array ? t.body = n : n && (t.body = JSON.stringify(n));
41135
+ typeof n == "string" || typeof Blob < "u" && (n instanceof Blob || n.constructor.name === "Blob") || typeof File < "u" && (n instanceof File || n.constructor.name === "File") || typeof Uint8Array < "u" && (n instanceof Uint8Array || n.constructor.name === "Uint8Array") ? t.body = n : n && (t.body = JSON.stringify(n));
41129
41136
  }
41130
41137
  handleUnauthenticated(t, n, i2) {
41131
41138
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
41132
41139
  }
41133
41140
  async startPkce() {
41134
- let t = qt();
41141
+ let t = Wt();
41135
41142
  sessionStorage.setItem("pkceState", t);
41136
- let n = qt();
41143
+ let n = Wt();
41137
41144
  sessionStorage.setItem("codeVerifier", n);
41138
- let i2 = await rn(n), o = Tr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
41145
+ let i2 = await dn(n), o = Sr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
41139
41146
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
41140
41147
  }
41141
41148
  async requestAuthorization(t) {
41142
41149
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
41143
- i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? gn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
41150
+ i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Rn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
41144
41151
  }
41145
41152
  processCode(t, n) {
41146
41153
  let i2 = new URLSearchParams();
41147
- if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? gn()), typeof sessionStorage < "u") {
41154
+ if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Rn()), typeof sessionStorage < "u") {
41148
41155
  let o = sessionStorage.getItem("codeVerifier");
41149
41156
  o && i2.set("code_verifier", o);
41150
41157
  }
@@ -41178,30 +41185,30 @@ var hn = class extends Se {
41178
41185
  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);
41179
41186
  }
41180
41187
  setBasicAuth(t, n) {
41181
- this.clientId = t, this.clientSecret = n, this.basicAuth = tn(t + ":" + n);
41188
+ this.clientId = t, this.clientSecret = n, this.basicAuth = ln(t + ":" + n);
41182
41189
  }
41183
41190
  async fhircastSubscribe(t, n) {
41184
41191
  if (!(typeof t == "string" && t !== ""))
41185
41192
  throw new p(h("Invalid topic provided. Topic must be a valid string."));
41186
41193
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
41187
41194
  throw new p(h("Invalid events provided. Events must be an array of event names containing at least one event."));
41188
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Qt(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
41195
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Yt(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
41189
41196
  if (!s)
41190
41197
  throw new Error("Invalid response!");
41191
41198
  return i2.endpoint = s, i2;
41192
41199
  }
41193
41200
  async fhircastUnsubscribe(t) {
41194
- if (!it(t))
41201
+ if (!st(t))
41195
41202
  throw new p(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
41196
41203
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
41197
41204
  throw new p(h("Provided subscription request must have an endpoint in order to unsubscribe."));
41198
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", Qt(t), V.FORM_URL_ENCODED);
41205
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", Yt(t), V.FORM_URL_ENCODED);
41199
41206
  }
41200
41207
  fhircastConnect(t) {
41201
- return new nt(t);
41208
+ return new ot(t);
41202
41209
  }
41203
41210
  async fhircastPublish(t, n, i2, o) {
41204
- return sn(n) ? this.post(`/fhircast/STU3/${t}`, Ht(t, n, i2, o), V.JSON) : (an(n), this.post(`/fhircast/STU3/${t}`, Ht(t, n, i2), V.JSON));
41211
+ return mn(n) ? this.post(`/fhircast/STU3/${t}`, Zt(t, n, i2, o), V.JSON) : (hn(n), this.post(`/fhircast/STU3/${t}`, Zt(t, n, i2), V.JSON));
41205
41212
  }
41206
41213
  async fhircastGetContext(t) {
41207
41214
  return this.get(`/fhircast/STU3/${t}`);
@@ -41232,8 +41239,8 @@ var hn = class extends Se {
41232
41239
  }
41233
41240
  async verifyTokens(t) {
41234
41241
  let n = t.access_token;
41235
- if (un(n)) {
41236
- let i2 = ot(n);
41242
+ if (yn(n)) {
41243
+ let i2 = at(n);
41237
41244
  if (Date.now() >= i2.exp * 1e3)
41238
41245
  throw this.clearActiveLogin(), new Error("Token expired");
41239
41246
  if (i2.cid) {
@@ -41257,21 +41264,21 @@ var hn = class extends Se {
41257
41264
  throw i2;
41258
41265
  }
41259
41266
  };
41260
- function Mo() {
41267
+ function Ho() {
41261
41268
  if (!globalThis.fetch)
41262
41269
  throw new Error("Fetch not available in this environment");
41263
41270
  return globalThis.fetch.bind(globalThis);
41264
41271
  }
41265
- function gn() {
41272
+ function Rn() {
41266
41273
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
41267
41274
  }
41268
- function yn(r4) {
41275
+ function Pn(r4) {
41269
41276
  return r4.endsWith("/") ? r4 : r4 + "/";
41270
41277
  }
41271
- function st(r4, e) {
41278
+ function ct(r4, e) {
41272
41279
  return new URL(e, r4).toString();
41273
41280
  }
41274
- async function xn(r4) {
41281
+ async function Cn(r4) {
41275
41282
  let e = r4.headers.get("content-location");
41276
41283
  if (e)
41277
41284
  return e;
@@ -41282,14 +41289,14 @@ async function xn(r4) {
41282
41289
  if (ne(n) && n.issue?.[0]?.diagnostics)
41283
41290
  return n.issue[0].diagnostics;
41284
41291
  }
41285
- function Tn(r4) {
41292
+ function An(r4) {
41286
41293
  let e = r4.entry?.map((t) => t.resource) ?? [];
41287
41294
  return Object.assign(e, { bundle: r4 });
41288
41295
  }
41289
- var Bo = [...xe, "->", "<<", ">>", "=="];
41290
- var jo = Te().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41291
- var ns = [...xe, "eq", "ne", "co"];
41292
- var ss = Te();
41296
+ var Jo = [...xe, "->", "<<", ">>", "=="];
41297
+ var Xo = Te().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41298
+ var fs = [...xe, "eq", "ne", "co"];
41299
+ var gs = Te();
41293
41300
  var z = class {
41294
41301
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
41295
41302
  this.segmentSeparator = e;
@@ -41306,7 +41313,7 @@ var z = class {
41306
41313
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
41307
41314
  }
41308
41315
  };
41309
- var Vn = class r {
41316
+ var Ln = class r {
41310
41317
  constructor(e, t = new z()) {
41311
41318
  this.context = t, this.segments = e;
41312
41319
  }
@@ -41330,7 +41337,7 @@ var Vn = class r {
41330
41337
  }
41331
41338
  buildAck() {
41332
41339
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i2 = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a = t?.getField(10)?.toString() ?? "", u2 = t?.getField(12)?.toString() ?? "2.5.1";
41333
- return new r([new Re(["MSH", this.context.getMsh2(), o, s, n, i2, cs(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new Re(["MSA", "AA", a, "OK"], this.context)]);
41340
+ return new r([new Re(["MSH", this.context.getMsh2(), o, s, n, i2, xs(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new Re(["MSA", "AA", a, "OK"], this.context)]);
41334
41341
  }
41335
41342
  buildAckMessageType(e) {
41336
41343
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41347,7 +41354,7 @@ var Vn = class r {
41347
41354
  };
41348
41355
  var Re = class r2 {
41349
41356
  constructor(e, t = new z()) {
41350
- this.context = t, gr(e) ? this.fields = e.map((n) => pe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41357
+ this.context = t, xr(e) ? this.fields = e.map((n) => pe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41351
41358
  }
41352
41359
  get(e) {
41353
41360
  return this.fields[e];
@@ -41391,12 +41398,12 @@ var pe = class r3 {
41391
41398
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
41392
41399
  }
41393
41400
  };
41394
- function cs(r4) {
41401
+ function xs(r4) {
41395
41402
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41396
41403
  return i2 > 0 && (n += "." + i2.toString()), n;
41397
41404
  }
41398
- var Jt = ((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))(Jt || {});
41399
- var Dn = class {
41405
+ var nr = ((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))(nr || {});
41406
+ var Bn = class {
41400
41407
  constructor(e, t = {}, n = 3) {
41401
41408
  this.write = e;
41402
41409
  this.metadata = t;
@@ -41416,11 +41423,11 @@ var Dn = class {
41416
41423
  }
41417
41424
  log(e, t, n) {
41418
41425
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
41419
- `) }), this.write(JSON.stringify({ level: Jt[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: t, ...n, ...this.metadata })));
41426
+ `) }), this.write(JSON.stringify({ level: nr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: t, ...n, ...this.metadata })));
41420
41427
  }
41421
41428
  };
41422
- function Il(r4) {
41423
- let e = Jt[r4.toUpperCase()];
41429
+ function od(r4) {
41430
+ let e = nr[r4.toUpperCase()];
41424
41431
  if (e === void 0)
41425
41432
  throw new Error(`Invalid log level: ${r4}`);
41426
41433
  return e;
@@ -41465,7 +41472,7 @@ var c2 = class extends i {
41465
41472
  t.on("data", (s) => {
41466
41473
  try {
41467
41474
  if (o += s.toString(), o.endsWith(p2 + v2)) {
41468
- let r4 = Vn.parse(o.substring(1, o.length - 2));
41475
+ let r4 = Ln.parse(o.substring(1, o.length - 2));
41469
41476
  this.dispatchEvent(new d2(this, r4)), o = "";
41470
41477
  }
41471
41478
  } catch (r4) {
@@ -41646,7 +41653,7 @@ var DcmjsDimseScp = class extends dimse.Scp {
41646
41653
  });
41647
41654
  response.setStatus(dimse.constants.Status.Success);
41648
41655
  } catch (err) {
41649
- App.instance.log.error(`DICOM error: ${_n(err)}`);
41656
+ App.instance.log.error(`DICOM error: ${$n(err)}`);
41650
41657
  response.setStatus(dimse.constants.Status.ProcessingFailure);
41651
41658
  }
41652
41659
  return response;
@@ -41677,7 +41684,7 @@ var AgentHl7Channel = class {
41677
41684
  sendToRemote(msg) {
41678
41685
  const connection = this.connections.get(msg.remote);
41679
41686
  if (connection) {
41680
- connection.hl7Connection.send(Vn.parse(msg.body));
41687
+ connection.hl7Connection.send(Ln.parse(msg.body));
41681
41688
  }
41682
41689
  }
41683
41690
  handleNewConnection(connection) {
@@ -41706,7 +41713,7 @@ var AgentHl7ChannelConnection = class {
41706
41713
  body: event.message.toString()
41707
41714
  });
41708
41715
  } catch (err) {
41709
- this.channel.app.log.error(`HL7 error: ${_n(err)}`);
41716
+ this.channel.app.log.error(`HL7 error: ${$n(err)}`);
41710
41717
  }
41711
41718
  }
41712
41719
  close() {
@@ -41727,7 +41734,7 @@ var App = class _App {
41727
41734
  this.live = false;
41728
41735
  this.shutdown = false;
41729
41736
  _App.instance = this;
41730
- this.log = new Dn((msg) => console.log(msg), void 0, logLevel);
41737
+ this.log = new Bn((msg) => console.log(msg), void 0, logLevel);
41731
41738
  }
41732
41739
  async start() {
41733
41740
  this.log.info("Medplum service starting...");
@@ -41769,7 +41776,7 @@ var App = class _App {
41769
41776
  this.webSocket.binaryType = "nodebuffer";
41770
41777
  this.webSocket.addEventListener("error", (err) => {
41771
41778
  if (!this.shutdown) {
41772
- this.log.error(_n(err.error));
41779
+ this.log.error($n(err.error));
41773
41780
  }
41774
41781
  });
41775
41782
  this.webSocket.addEventListener("open", async () => {
@@ -41819,7 +41826,7 @@ var App = class _App {
41819
41826
  this.log.error(`Unknown message type: ${command.type}`);
41820
41827
  }
41821
41828
  } catch (err) {
41822
- this.log.error(`WebSocket error: ${_n(err)}`);
41829
+ this.log.error(`WebSocket error: ${$n(err)}`);
41823
41830
  }
41824
41831
  });
41825
41832
  }
@@ -41885,7 +41892,7 @@ var App = class _App {
41885
41892
  try {
41886
41893
  await this.sendToWebSocket(msg);
41887
41894
  } catch (err) {
41888
- this.log.error(`WebSocket error: ${_n(err)}`);
41895
+ this.log.error(`WebSocket error: ${$n(err)}`);
41889
41896
  this.webSocketQueue.unshift(msg);
41890
41897
  throw err;
41891
41898
  }
@@ -41925,7 +41932,7 @@ var App = class _App {
41925
41932
  host: address.hostname,
41926
41933
  port: parseInt(address.port, 10)
41927
41934
  });
41928
- client.sendAndWait(Vn.parse(message.body)).then((response) => {
41935
+ client.sendAndWait(Ln.parse(message.body)).then((response) => {
41929
41936
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41930
41937
  this.addToWebSocketQueue({
41931
41938
  type: "agent:transmit:response",
@@ -41936,7 +41943,7 @@ var App = class _App {
41936
41943
  body: response.toString()
41937
41944
  });
41938
41945
  }).catch((err) => {
41939
- this.log.error(`HL7 error: ${_n(err)}`);
41946
+ this.log.error(`HL7 error: ${$n(err)}`);
41940
41947
  }).finally(() => {
41941
41948
  client.close();
41942
41949
  });
@@ -41969,9 +41976,9 @@ async function main(argv) {
41969
41976
  process.exit(1);
41970
41977
  }
41971
41978
  const { baseUrl, clientId, clientSecret, agentId } = args;
41972
- const medplum = new hn({ baseUrl, clientId });
41979
+ const medplum = new bn({ baseUrl, clientId });
41973
41980
  await medplum.startClientLogin(clientId, clientSecret);
41974
- const app = new App(medplum, agentId, Il(args.logLevel ?? "INFO"));
41981
+ const app = new App(medplum, agentId, od(args.logLevel ?? "INFO"));
41975
41982
  await app.start();
41976
41983
  process.on("SIGINT", () => {
41977
41984
  console.log("Gracefully shutting down from SIGINT (Crtl-C)");