@medplum/agent 5.1.15 → 5.1.17

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 +490 -464
  2. package/package.json +7 -7
@@ -3997,6 +3997,18 @@ var require_semver = __commonJS({
3997
3997
  var { safeRe: re2, t } = require_re();
3998
3998
  var parseOptions = require_parse_options();
3999
3999
  var { compareIdentifiers } = require_identifiers();
4000
+ var isPrereleaseIdentifier = (prerelease, identifier) => {
4001
+ const identifiers = identifier.split(".");
4002
+ if (identifiers.length > prerelease.length) {
4003
+ return false;
4004
+ }
4005
+ for (let i = 0; i < identifiers.length; i++) {
4006
+ if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
4007
+ return false;
4008
+ }
4009
+ }
4010
+ return true;
4011
+ };
4000
4012
  var SemVer = class _SemVer {
4001
4013
  constructor(version, options) {
4002
4014
  options = parseOptions(options);
@@ -4243,8 +4255,9 @@ var require_semver = __commonJS({
4243
4255
  if (identifierBase === false) {
4244
4256
  prerelease = [identifier];
4245
4257
  }
4246
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
4247
- if (isNaN(this.prerelease[1])) {
4258
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
4259
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
4260
+ if (isNaN(prereleaseBase)) {
4248
4261
  this.prerelease = prerelease;
4249
4262
  }
4250
4263
  } else {
@@ -4803,8 +4816,8 @@ var require_range = __commonJS({
4803
4816
  return cached;
4804
4817
  }
4805
4818
  const loose = this.options.loose;
4806
- const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
4807
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
4819
+ const hr2 = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
4820
+ range = range.replace(hr2, hyphenReplace(this.options.includePrerelease));
4808
4821
  debug("hyphen replace", range);
4809
4822
  range = range.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
4810
4823
  debug("comparator trim", range);
@@ -10653,11 +10666,11 @@ var require_dcmjs = __commonJS({
10653
10666
  Promise.resolve(value).then(_next, _throw);
10654
10667
  }
10655
10668
  }
10656
- function _asyncToGenerator2(fn2) {
10669
+ function _asyncToGenerator2(fn) {
10657
10670
  return function() {
10658
10671
  var self2 = this, args = arguments;
10659
10672
  return new Promise(function(resolve2, reject) {
10660
- var gen = fn2.apply(self2, args);
10673
+ var gen = fn.apply(self2, args);
10661
10674
  function _next(value) {
10662
10675
  asyncGeneratorStep2(gen, resolve2, reject, _next, _throw, "next", value);
10663
10676
  }
@@ -10733,11 +10746,11 @@ var require_dcmjs = __commonJS({
10733
10746
  };
10734
10747
  return _setPrototypeOf2(o2, p2);
10735
10748
  }
10736
- function _isNativeFunction(fn2) {
10749
+ function _isNativeFunction(fn) {
10737
10750
  try {
10738
- return Function.toString.call(fn2).indexOf("[native code]") !== -1;
10751
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
10739
10752
  } catch (e) {
10740
- return typeof fn2 === "function";
10753
+ return typeof fn === "function";
10741
10754
  }
10742
10755
  }
10743
10756
  function _wrapNativeSuper(Class) {
@@ -15772,9 +15785,9 @@ var require_dcmjs = __commonJS({
15772
15785
  }, {
15773
15786
  key: "readVR",
15774
15787
  value: function readVR() {
15775
- var vr = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
15788
+ var vr2 = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
15776
15789
  this.increment(2);
15777
- return vr;
15790
+ return vr2;
15778
15791
  }
15779
15792
  }, {
15780
15793
  key: "readEncodedString",
@@ -16785,20 +16798,20 @@ var require_dcmjs = __commonJS({
16785
16798
  }, {
16786
16799
  key: "createByTypeString",
16787
16800
  value: function createByTypeString(type) {
16788
- var vr = VRinstances2[type];
16789
- if (vr === void 0) {
16801
+ var vr2 = VRinstances2[type];
16802
+ if (vr2 === void 0) {
16790
16803
  if (type == "ox") {
16791
16804
  validationLog2.error("Invalid vr type", type, "- using OW");
16792
- vr = VRinstances2["OW"];
16805
+ vr2 = VRinstances2["OW"];
16793
16806
  } else if (type == "xs") {
16794
16807
  validationLog2.error("Invalid vr type", type, "- using US");
16795
- vr = VRinstances2["US"];
16808
+ vr2 = VRinstances2["US"];
16796
16809
  } else {
16797
16810
  validationLog2.error("Invalid vr type", type, "- using UN");
16798
- vr = VRinstances2["UN"];
16811
+ vr2 = VRinstances2["UN"];
16799
16812
  }
16800
16813
  }
16801
- return vr;
16814
+ return vr2;
16802
16815
  }
16803
16816
  }, {
16804
16817
  key: "parseUnknownVr",
@@ -17884,10 +17897,10 @@ var require_dcmjs = __commonJS({
17884
17897
  })(BinaryRepresentation2);
17885
17898
  var ParsedUnknownValue2 = /* @__PURE__ */ (function(_BinaryRepresentation2) {
17886
17899
  _inherits2(ParsedUnknownValue3, _BinaryRepresentation2);
17887
- function ParsedUnknownValue3(vr) {
17900
+ function ParsedUnknownValue3(vr2) {
17888
17901
  var _this28;
17889
17902
  _classCallCheck2(this, ParsedUnknownValue3);
17890
- _this28 = _callSuper2(this, ParsedUnknownValue3, [vr]);
17903
+ _this28 = _callSuper2(this, ParsedUnknownValue3, [vr2]);
17891
17904
  _this28.maxLength = null;
17892
17905
  _this28.padByte = 0;
17893
17906
  _this28.noMultiple = true;
@@ -17902,13 +17915,13 @@ var require_dcmjs = __commonJS({
17902
17915
  value: function read(stream, length3, syntax, readOptions) {
17903
17916
  var arrayBuffer = this.readBytes(stream, length3, syntax)[0];
17904
17917
  var streamFromBuffer = new ReadBufferStream2(arrayBuffer, true);
17905
- var vr = ValueRepresentation2.createByTypeString(this.type);
17906
- if (vr.isBinary() && length3 > vr.maxLength && !vr.noMultiple) {
17918
+ var vr2 = ValueRepresentation2.createByTypeString(this.type);
17919
+ if (vr2.isBinary() && length3 > vr2.maxLength && !vr2.noMultiple) {
17907
17920
  var values = [];
17908
17921
  var rawValues = [];
17909
- var times = length3 / vr.maxLength, i = 0;
17922
+ var times = length3 / vr2.maxLength, i = 0;
17910
17923
  while (i++ < times) {
17911
- var _vr$read = vr.read(streamFromBuffer, vr.maxLength, syntax, readOptions), rawValue = _vr$read.rawValue, value = _vr$read.value;
17924
+ var _vr$read = vr2.read(streamFromBuffer, vr2.maxLength, syntax, readOptions), rawValue = _vr$read.rawValue, value = _vr$read.value;
17912
17925
  rawValues.push(rawValue);
17913
17926
  values.push(value);
17914
17927
  }
@@ -17917,7 +17930,7 @@ var require_dcmjs = __commonJS({
17917
17930
  value: values
17918
17931
  };
17919
17932
  } else {
17920
- return vr.read(streamFromBuffer, length3, syntax, readOptions);
17933
+ return vr2.read(streamFromBuffer, length3, syntax, readOptions);
17921
17934
  }
17922
17935
  }
17923
17936
  }]);
@@ -18017,12 +18030,12 @@ var require_dcmjs = __commonJS({
18017
18030
  }
18018
18031
  _createClass2(DicomDict3, [{
18019
18032
  key: "upsertTag",
18020
- value: function upsertTag(tag, vr, values) {
18033
+ value: function upsertTag(tag, vr2, values) {
18021
18034
  if (this.dict[tag]) {
18022
18035
  this.dict[tag].Value = values;
18023
18036
  } else {
18024
18037
  this.dict[tag] = ValueRepresentation2.addTagAccessors({
18025
- vr
18038
+ vr: vr2
18026
18039
  });
18027
18040
  this.dict[tag].Value = values;
18028
18041
  }
@@ -18637,13 +18650,13 @@ var require_dcmjs = __commonJS({
18637
18650
  var end = gi2 + 1 < groupStart.length ? groupStart[gi2 + 1] : elems.length;
18638
18651
  var ei2 = _binSearchU162(elems, start, end, elem);
18639
18652
  if (ei2 < 0) return void 0;
18640
- var vr = vrTable$12[vrCode[ei2]];
18653
+ var vr2 = vrTable$12[vrCode[ei2]];
18641
18654
  var vm = vmTable$12[vmCode[ei2]];
18642
18655
  var off = nameOff[ei2];
18643
18656
  var len3 = nameLen[ei2];
18644
18657
  var name = nameBlob$12.slice(off, off + len3);
18645
18658
  return {
18646
- vr,
18659
+ vr: vr2,
18647
18660
  vm,
18648
18661
  name
18649
18662
  };
@@ -18680,14 +18693,14 @@ var require_dcmjs = __commonJS({
18680
18693
  var elem = elems[ei2];
18681
18694
  var eHex = _pad42(elem.toString(16).toUpperCase());
18682
18695
  var tag = "(" + gHex + "," + eHex + ")";
18683
- var vr = vrTable$12[vrCode[ei2]];
18696
+ var vr2 = vrTable$12[vrCode[ei2]];
18684
18697
  var vm = vmTable$12[vmCode[ei2]];
18685
18698
  var off = nameOff[ei2];
18686
18699
  var len3 = nameLen[ei2];
18687
18700
  var name = nameBlob$12.slice(off, off + len3);
18688
18701
  out.push({
18689
18702
  tag,
18690
- vr,
18703
+ vr: vr2,
18691
18704
  vm,
18692
18705
  name
18693
18706
  });
@@ -19011,9 +19024,9 @@ var require_dcmjs = __commonJS({
19011
19024
  if (dataValue === void 0) {
19012
19025
  return;
19013
19026
  }
19014
- var vr = dataset._vrMap && dataset._vrMap[naturalName] ? dataset._vrMap[naturalName] : entry.vr;
19027
+ var vr2 = dataset._vrMap && dataset._vrMap[naturalName] ? dataset._vrMap[naturalName] : entry.vr;
19015
19028
  var dataItem = ValueRepresentation2.addTagAccessors({
19016
- vr
19029
+ vr: vr2
19017
19030
  });
19018
19031
  dataItem.Value = dataset[naturalName];
19019
19032
  if (dataValue !== null) {
@@ -19267,7 +19280,7 @@ var require_dcmjs = __commonJS({
19267
19280
  }, {
19268
19281
  key: "write",
19269
19282
  value: function write(stream, vrType, values, syntax, writeOptions) {
19270
- var vr = ValueRepresentation2.createByTypeString(vrType);
19283
+ var vr2 = ValueRepresentation2.createByTypeString(vrType);
19271
19284
  var useSyntax = DicomMessage$12._normalizeSyntax(syntax);
19272
19285
  var implicit = useSyntax === IMPLICIT_LITTLE_ENDIAN2;
19273
19286
  var isLittleEndian = useSyntax === IMPLICIT_LITTLE_ENDIAN2 || useSyntax === EXPLICIT_LITTLE_ENDIAN$12;
@@ -19279,11 +19292,11 @@ var require_dcmjs = __commonJS({
19279
19292
  var tagStream = new WriteBufferStream2(256), valueLength;
19280
19293
  tagStream.setEndian(isLittleEndian);
19281
19294
  if (vrType == "OW" || vrType == "OB" || vrType == "UN") {
19282
- valueLength = vr.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
19295
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
19283
19296
  } else if (vrType == "SQ") {
19284
- valueLength = vr.writeBytes(tagStream, values, useSyntax, writeOptions);
19297
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, writeOptions);
19285
19298
  } else {
19286
- valueLength = vr.writeBytes(tagStream, values, writeOptions);
19299
+ valueLength = vr2.writeBytes(tagStream, values, writeOptions);
19287
19300
  }
19288
19301
  if (vrType == "SQ") {
19289
19302
  valueLength = UNDEFINED_LENGTH2;
@@ -19293,14 +19306,14 @@ var require_dcmjs = __commonJS({
19293
19306
  stream.writeUint32(valueLength);
19294
19307
  written += 4;
19295
19308
  } else {
19296
- var isBig16Length = !vr.isLength32() && valueLength >= 65536 && valueLength !== UNDEFINED_LENGTH2;
19297
- if (vr.isLength32() || isBig16Length) {
19298
- stream.writeAsciiString(isBig16Length ? "UN" : vr.type);
19309
+ var isBig16Length = !vr2.isLength32() && valueLength >= 65536 && valueLength !== UNDEFINED_LENGTH2;
19310
+ if (vr2.isLength32() || isBig16Length) {
19311
+ stream.writeAsciiString(isBig16Length ? "UN" : vr2.type);
19299
19312
  stream.writeUint16(0);
19300
19313
  stream.writeUint32(valueLength);
19301
19314
  written += 8;
19302
19315
  } else {
19303
- stream.writeAsciiString(vr.type);
19316
+ stream.writeAsciiString(vr2.type);
19304
19317
  stream.writeUint16(valueLength);
19305
19318
  written += 4;
19306
19319
  }
@@ -19535,9 +19548,9 @@ var require_dcmjs = __commonJS({
19535
19548
  }
19536
19549
  }, {
19537
19550
  key: "writeTagObject",
19538
- value: function writeTagObject(stream, tagString, vr, values, syntax, writeOptions) {
19551
+ value: function writeTagObject(stream, tagString, vr2, values, syntax, writeOptions) {
19539
19552
  var tag = Tag2.fromString(tagString);
19540
- tag.write(stream, vr, values, syntax, writeOptions);
19553
+ tag.write(stream, vr2, values, syntax, writeOptions);
19541
19554
  }
19542
19555
  }, {
19543
19556
  key: "write",
@@ -19557,14 +19570,14 @@ var require_dcmjs = __commonJS({
19557
19570
  if (!tagObject._rawValue) {
19558
19571
  return tagObject.Value;
19559
19572
  }
19560
- var vr = ValueRepresentation2.createByTypeString(vrType);
19573
+ var vr2 = ValueRepresentation2.createByTypeString(vrType);
19561
19574
  var originalValue;
19562
19575
  if (Array.isArray(tagObject._rawValue)) {
19563
19576
  originalValue = tagObject._rawValue.map(function(val) {
19564
- return vr.applyFormatting(val);
19577
+ return vr2.applyFormatting(val);
19565
19578
  });
19566
19579
  } else {
19567
- originalValue = vr.applyFormatting(tagObject._rawValue);
19580
+ originalValue = vr2.applyFormatting(tagObject._rawValue);
19568
19581
  }
19569
19582
  if (deepEqual2(tagObject.Value, originalValue)) {
19570
19583
  return tagObject._rawValue;
@@ -19593,7 +19606,7 @@ var require_dcmjs = __commonJS({
19593
19606
  };
19594
19607
  }
19595
19608
  }
19596
- var length3 = null, vr = null, vrType;
19609
+ var length3 = null, vr2 = null, vrType;
19597
19610
  if (implicit) {
19598
19611
  length3 = stream.readUint32();
19599
19612
  var elementData = DicomMessage3.lookupTag(tag);
@@ -19612,16 +19625,16 @@ var require_dcmjs = __commonJS({
19612
19625
  vrType = "UN";
19613
19626
  }
19614
19627
  }
19615
- vr = ValueRepresentation2.createByTypeString(vrType);
19628
+ vr2 = ValueRepresentation2.createByTypeString(vrType);
19616
19629
  } else {
19617
19630
  vrType = stream.readVR();
19618
19631
  if (vrType === "UN" && DicomMessage3.lookupTag(tag) && DicomMessage3.lookupTag(tag).vr) {
19619
19632
  vrType = DicomMessage3.lookupTag(tag).vr;
19620
- vr = ValueRepresentation2.parseUnknownVr(vrType);
19633
+ vr2 = ValueRepresentation2.parseUnknownVr(vrType);
19621
19634
  } else {
19622
- vr = ValueRepresentation2.createByTypeString(vrType);
19635
+ vr2 = ValueRepresentation2.createByTypeString(vrType);
19623
19636
  }
19624
- if (vr.isLength32()) {
19637
+ if (vr2.isLength32()) {
19625
19638
  stream.increment(2);
19626
19639
  length3 = stream.readUint32();
19627
19640
  } else {
@@ -19630,27 +19643,27 @@ var require_dcmjs = __commonJS({
19630
19643
  }
19631
19644
  var values = [];
19632
19645
  var rawValues = [];
19633
- if (vr.isBinary() && length3 > vr.maxLength && !vr.noMultiple) {
19634
- var times = length3 / vr.maxLength, i = 0;
19646
+ if (vr2.isBinary() && length3 > vr2.maxLength && !vr2.noMultiple) {
19647
+ var times = length3 / vr2.maxLength, i = 0;
19635
19648
  while (i++ < times) {
19636
- var _vr$read = vr.read(stream, vr.maxLength, syntax, options), rawValue = _vr$read.rawValue, value = _vr$read.value;
19649
+ var _vr$read = vr2.read(stream, vr2.maxLength, syntax, options), rawValue = _vr$read.rawValue, value = _vr$read.value;
19637
19650
  rawValues.push(rawValue);
19638
19651
  values.push(value);
19639
19652
  }
19640
19653
  } else {
19641
- var _ref = vr.read(stream, length3, syntax, options) || {}, _rawValue = _ref.rawValue, _value2 = _ref.value;
19642
- if (!vr.isBinary() && singleVRs2.indexOf(vr.type) == -1) {
19654
+ var _ref = vr2.read(stream, length3, syntax, options) || {}, _rawValue = _ref.rawValue, _value2 = _ref.value;
19655
+ if (!vr2.isBinary() && singleVRs2.indexOf(vr2.type) == -1) {
19643
19656
  rawValues = _rawValue;
19644
19657
  values = _value2;
19645
19658
  if (typeof _value2 === "string") {
19646
19659
  var delimiterChar = String.fromCharCode(VM_DELIMITER2);
19647
- rawValues = vr.dropPadByte(_rawValue.split(delimiterChar));
19648
- values = vr.dropPadByte(_value2.split(delimiterChar));
19660
+ rawValues = vr2.dropPadByte(_rawValue.split(delimiterChar));
19661
+ values = vr2.dropPadByte(_value2.split(delimiterChar));
19649
19662
  }
19650
- } else if (vr.type == "SQ") {
19663
+ } else if (vr2.type == "SQ") {
19651
19664
  rawValues = _rawValue;
19652
19665
  values = _value2;
19653
- } else if (vr.type == "OW" || vr.type == "OB") {
19666
+ } else if (vr2.type == "OW" || vr2.type == "OB") {
19654
19667
  rawValues = _rawValue;
19655
19668
  values = _value2;
19656
19669
  } else {
@@ -19661,7 +19674,7 @@ var require_dcmjs = __commonJS({
19661
19674
  stream.setEndian(oldEndian);
19662
19675
  var retObj = ValueRepresentation2.addTagAccessors({
19663
19676
  tag,
19664
- vr
19677
+ vr: vr2
19665
19678
  });
19666
19679
  retObj.values = values;
19667
19680
  retObj.rawValues = rawValues;
@@ -19732,13 +19745,13 @@ var require_dcmjs = __commonJS({
19732
19745
  if (keyStr < candidate) hi2 = mid - 1;
19733
19746
  else if (keyStr > candidate) lo = mid + 1;
19734
19747
  else {
19735
- var vr = vrTable2[vrCode[mid]];
19748
+ var vr2 = vrTable2[vrCode[mid]];
19736
19749
  var vm = vmTable2[vmCode[mid]];
19737
19750
  var off = nameOff[mid];
19738
19751
  var nlen = nameLen[mid];
19739
19752
  var name = nameBlob2.slice(off, off + nlen);
19740
19753
  return {
19741
- vr,
19754
+ vr: vr2,
19742
19755
  vm,
19743
19756
  name
19744
19757
  };
@@ -20084,8 +20097,8 @@ var require_dcmjs = __commonJS({
20084
20097
  *
20085
20098
  * @param {(() => Promise<void>) | null} fn - Function that returns a Promise, or null to clear
20086
20099
  */
20087
- function setDrain(fn2) {
20088
- this._drain = typeof fn2 === "function" ? fn2 : null;
20100
+ function setDrain(fn) {
20101
+ this._drain = typeof fn === "function" ? fn : null;
20089
20102
  }
20090
20103
  )
20091
20104
  /**
@@ -21078,8 +21091,8 @@ var require_dcmjs = __commonJS({
21078
21091
  }, {
21079
21092
  key: "isSequence",
21080
21093
  value: function isSequence(tagInfo) {
21081
- var vr = tagInfo.vr, length3 = tagInfo.length;
21082
- return vr === "SQ" || vr === "UN" && length3 === UNDEFINED_LENGTH_FIX2;
21094
+ var vr2 = tagInfo.vr, length3 = tagInfo.length;
21095
+ return vr2 === "SQ" || vr2 === "UN" && length3 === UNDEFINED_LENGTH_FIX2;
21083
21096
  }
21084
21097
  /**
21085
21098
  * Reads a tag header.
@@ -21110,12 +21123,12 @@ var require_dcmjs = __commonJS({
21110
21123
  }
21111
21124
  }
21112
21125
  var length3 = null;
21113
- var vr = null;
21126
+ var vr2 = null;
21114
21127
  var vrType;
21115
21128
  var isCommand = tagObj.group() === 0;
21116
21129
  if (tagObj.isInstruction()) {
21117
21130
  length3 = stream.readUint32();
21118
- vr = ValueRepresentation2.createByTypeString("UN");
21131
+ vr2 = ValueRepresentation2.createByTypeString("UN");
21119
21132
  } else if (implicit && !isCommand) {
21120
21133
  length3 = stream.readUint32();
21121
21134
  var elementData = DicomMessage2.lookupTag(tagObj);
@@ -21136,17 +21149,17 @@ var require_dcmjs = __commonJS({
21136
21149
  vrType = "UN";
21137
21150
  }
21138
21151
  }
21139
- vr = ValueRepresentation2.createByTypeString(vrType);
21152
+ vr2 = ValueRepresentation2.createByTypeString(vrType);
21140
21153
  } else {
21141
21154
  var _DicomMessage$lookupT;
21142
21155
  vrType = stream.readVR();
21143
21156
  if (vrType === "UN" && (_DicomMessage$lookupT = DicomMessage2.lookupTag(tagObj)) !== null && _DicomMessage$lookupT !== void 0 && _DicomMessage$lookupT.vr) {
21144
21157
  vrType = DicomMessage2.lookupTag(tagObj).vr;
21145
- vr = ValueRepresentation2.parseUnknownVr(vrType);
21158
+ vr2 = ValueRepresentation2.parseUnknownVr(vrType);
21146
21159
  } else {
21147
- vr = ValueRepresentation2.createByTypeString(vrType);
21160
+ vr2 = ValueRepresentation2.createByTypeString(vrType);
21148
21161
  }
21149
- if (vr.isLength32()) {
21162
+ if (vr2.isLength32()) {
21150
21163
  stream.increment(2);
21151
21164
  length3 = stream.readUint32();
21152
21165
  } else {
@@ -21156,8 +21169,8 @@ var require_dcmjs = __commonJS({
21156
21169
  var punctuatedTag = DicomMetaDictionary2.punctuateTag(tag);
21157
21170
  var entry = DicomMetaDictionary2.dictionary[punctuatedTag];
21158
21171
  var header = {
21159
- vrObj: vr,
21160
- vr: vr.type,
21172
+ vrObj: vr2,
21173
+ vr: vr2.type,
21161
21174
  tag,
21162
21175
  tagObj,
21163
21176
  vm: entry === null || entry === void 0 ? void 0 : entry.vm,
@@ -21176,7 +21189,7 @@ var require_dcmjs = __commonJS({
21176
21189
  key: "readSingle",
21177
21190
  value: (function() {
21178
21191
  var _readSingle = _asyncToGenerator2(/* @__PURE__ */ _regeneratorRuntime2().mark(function _callee11(tagInfo, listener, options) {
21179
- var length3, stream, syntax, vr, values, times, i, _vr$read, value, _vr$read2, _value2, delimiterChar, _values, _values2, coding2;
21192
+ var length3, stream, syntax, vr2, values, times, i, _vr$read, value, _vr$read2, _value2, delimiterChar, _values, _values2, coding2;
21180
21193
  return _regeneratorRuntime2().wrap(function _callee11$(_context11) {
21181
21194
  while (1) switch (_context11.prev = _context11.next) {
21182
21195
  case 0:
@@ -21185,25 +21198,25 @@ var require_dcmjs = __commonJS({
21185
21198
  _context11.next = 4;
21186
21199
  return this.stream.ensureAvailable(length3);
21187
21200
  case 4:
21188
- vr = ValueRepresentation2.createByTypeString(tagInfo.vr);
21201
+ vr2 = ValueRepresentation2.createByTypeString(tagInfo.vr);
21189
21202
  values = [];
21190
- if (vr.isBinary() && length3 > vr.maxLength && !vr.noMultiple) {
21191
- times = length3 / vr.maxLength;
21203
+ if (vr2.isBinary() && length3 > vr2.maxLength && !vr2.noMultiple) {
21204
+ times = length3 / vr2.maxLength;
21192
21205
  i = 0;
21193
21206
  while (i++ < times) {
21194
21207
  readLog2.trace("readSingle multi-value loop", i, times);
21195
- _vr$read = vr.read(stream, vr.maxLength, syntax), value = _vr$read.value;
21208
+ _vr$read = vr2.read(stream, vr2.maxLength, syntax), value = _vr$read.value;
21196
21209
  values.push(value);
21197
21210
  }
21198
21211
  } else {
21199
- _value2 = (_vr$read2 = vr.read(stream, length3, syntax)) === null || _vr$read2 === void 0 ? void 0 : _vr$read2.value;
21200
- if (!vr.isBinary() && singleVRs2.indexOf(vr.type) == -1) {
21212
+ _value2 = (_vr$read2 = vr2.read(stream, length3, syntax)) === null || _vr$read2 === void 0 ? void 0 : _vr$read2.value;
21213
+ if (!vr2.isBinary() && singleVRs2.indexOf(vr2.type) == -1) {
21201
21214
  values = _value2;
21202
21215
  if (typeof _value2 === "string") {
21203
21216
  delimiterChar = String.fromCharCode(VM_DELIMITER2);
21204
- values = vr.dropPadByte(_value2.split(delimiterChar));
21217
+ values = vr2.dropPadByte(_value2.split(delimiterChar));
21205
21218
  }
21206
- } else if (vr.type == "OW" || vr.type == "OB") {
21219
+ } else if (vr2.type == "OW" || vr2.type == "OB") {
21207
21220
  values = _value2;
21208
21221
  } else {
21209
21222
  Array.isArray(_value2) ? values = _value2 : values.push(_value2);
@@ -27232,7 +27245,7 @@ var require_dcmjs = __commonJS({
27232
27245
  var sqrLen2 = squaredLength2;
27233
27246
  var forEach2 = (function() {
27234
27247
  var vec = create2();
27235
- return function(a, stride, offset, count, fn2, arg) {
27248
+ return function(a, stride, offset, count, fn, arg) {
27236
27249
  var i, l;
27237
27250
  if (!stride) {
27238
27251
  stride = 3;
@@ -27249,7 +27262,7 @@ var require_dcmjs = __commonJS({
27249
27262
  vec[0] = a[i];
27250
27263
  vec[1] = a[i + 1];
27251
27264
  vec[2] = a[i + 2];
27252
- fn2(vec, vec, arg);
27265
+ fn(vec, vec, arg);
27253
27266
  a[i] = vec[0];
27254
27267
  a[i + 1] = vec[1];
27255
27268
  a[i + 2] = vec[2];
@@ -34541,11 +34554,11 @@ var require_decorator = __commonJS({
34541
34554
  };
34542
34555
  };
34543
34556
  var mergeDecorators = (d1, d2) => {
34544
- var _a, _b, _c, _d, _e, _f;
34557
+ var _a, _b, _c, _d, _e2, _f;
34545
34558
  return {
34546
34559
  class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
34547
34560
  static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
34548
- instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
34561
+ instance: mergePropertyAndMethodDecorators((_e2 = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e2 !== void 0 ? _e2 : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
34549
34562
  };
34550
34563
  };
34551
34564
  var decorators = /* @__PURE__ */ new Map();
@@ -40693,11 +40706,11 @@ var require_from = __commonJS({
40693
40706
  Promise.resolve(value).then(_next, _throw);
40694
40707
  }
40695
40708
  }
40696
- function _asyncToGenerator2(fn2) {
40709
+ function _asyncToGenerator2(fn) {
40697
40710
  return function() {
40698
40711
  var self2 = this, args = arguments;
40699
40712
  return new Promise(function(resolve2, reject) {
40700
- var gen = fn2.apply(self2, args);
40713
+ var gen = fn.apply(self2, args);
40701
40714
  function _next(value) {
40702
40715
  asyncGeneratorStep2(gen, resolve2, reject, _next, _throw, "next", value);
40703
40716
  }
@@ -40840,11 +40853,11 @@ var require_stream_readable = __commonJS({
40840
40853
  require_inherits()(Readable2, Stream);
40841
40854
  var errorOrDestroy = destroyImpl.errorOrDestroy;
40842
40855
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
40843
- function prependListener(emitter, event, fn2) {
40844
- if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn2);
40845
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn2);
40846
- else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn2);
40847
- else emitter._events[event] = [fn2, emitter._events[event]];
40856
+ function prependListener(emitter, event, fn) {
40857
+ if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
40858
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
40859
+ else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
40860
+ else emitter._events[event] = [fn, emitter._events[event]];
40848
40861
  }
40849
40862
  function ReadableState(options, stream, isDuplex) {
40850
40863
  Duplex = Duplex || require_stream_duplex();
@@ -41292,8 +41305,8 @@ var require_stream_readable = __commonJS({
41292
41305
  dest.emit("unpipe", this, unpipeInfo);
41293
41306
  return this;
41294
41307
  };
41295
- Readable2.prototype.on = function(ev, fn2) {
41296
- var res = Stream.prototype.on.call(this, ev, fn2);
41308
+ Readable2.prototype.on = function(ev, fn) {
41309
+ var res = Stream.prototype.on.call(this, ev, fn);
41297
41310
  var state = this._readableState;
41298
41311
  if (ev === "data") {
41299
41312
  state.readableListening = this.listenerCount("readable") > 0;
@@ -41314,8 +41327,8 @@ var require_stream_readable = __commonJS({
41314
41327
  return res;
41315
41328
  };
41316
41329
  Readable2.prototype.addListener = Readable2.prototype.on;
41317
- Readable2.prototype.removeListener = function(ev, fn2) {
41318
- var res = Stream.prototype.removeListener.call(this, ev, fn2);
41330
+ Readable2.prototype.removeListener = function(ev, fn) {
41331
+ var res = Stream.prototype.removeListener.call(this, ev, fn);
41319
41332
  if (ev === "readable") {
41320
41333
  process.nextTick(updateReadableListening, this);
41321
41334
  }
@@ -42391,10 +42404,10 @@ var require_initialParams = __commonJS({
42391
42404
  Object.defineProperty(exports2, "__esModule", {
42392
42405
  value: true
42393
42406
  });
42394
- exports2.default = function(fn2) {
42407
+ exports2.default = function(fn) {
42395
42408
  return function(...args) {
42396
42409
  var callback = args.pop();
42397
- return fn2.call(this, args, callback);
42410
+ return fn.call(this, args, callback);
42398
42411
  };
42399
42412
  };
42400
42413
  module2.exports = exports2.default;
@@ -42413,11 +42426,11 @@ var require_setImmediate = __commonJS({
42413
42426
  var hasQueueMicrotask = exports2.hasQueueMicrotask = typeof queueMicrotask === "function" && queueMicrotask;
42414
42427
  var hasSetImmediate = exports2.hasSetImmediate = typeof setImmediate === "function" && setImmediate;
42415
42428
  var hasNextTick = exports2.hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
42416
- function fallback(fn2) {
42417
- setTimeout(fn2, 0);
42429
+ function fallback(fn) {
42430
+ setTimeout(fn, 0);
42418
42431
  }
42419
42432
  function wrap(defer) {
42420
- return (fn2, ...args) => defer(() => fn2(...args));
42433
+ return (fn, ...args) => defer(() => fn(...args));
42421
42434
  }
42422
42435
  var _defer;
42423
42436
  if (hasQueueMicrotask) {
@@ -42504,11 +42517,11 @@ var require_wrapAsync = __commonJS({
42504
42517
  function _interopRequireDefault(obj) {
42505
42518
  return obj && obj.__esModule ? obj : { default: obj };
42506
42519
  }
42507
- function isAsync(fn2) {
42508
- return fn2[Symbol.toStringTag] === "AsyncFunction";
42520
+ function isAsync(fn) {
42521
+ return fn[Symbol.toStringTag] === "AsyncFunction";
42509
42522
  }
42510
- function isAsyncGenerator(fn2) {
42511
- return fn2[Symbol.toStringTag] === "AsyncGenerator";
42523
+ function isAsyncGenerator(fn) {
42524
+ return fn[Symbol.toStringTag] === "AsyncGenerator";
42512
42525
  }
42513
42526
  function isAsyncIterable(obj) {
42514
42527
  return typeof obj[Symbol.asyncIterator] === "function";
@@ -42593,14 +42606,14 @@ var require_once = __commonJS({
42593
42606
  value: true
42594
42607
  });
42595
42608
  exports2.default = once;
42596
- function once(fn2) {
42609
+ function once(fn) {
42597
42610
  function wrapper(...args) {
42598
- if (fn2 === null) return;
42599
- var callFn = fn2;
42600
- fn2 = null;
42611
+ if (fn === null) return;
42612
+ var callFn = fn;
42613
+ fn = null;
42601
42614
  callFn.apply(this, args);
42602
42615
  }
42603
- Object.assign(wrapper, fn2);
42616
+ Object.assign(wrapper, fn);
42604
42617
  return wrapper;
42605
42618
  }
42606
42619
  module2.exports = exports2.default;
@@ -42683,11 +42696,11 @@ var require_onlyOnce = __commonJS({
42683
42696
  value: true
42684
42697
  });
42685
42698
  exports2.default = onlyOnce;
42686
- function onlyOnce(fn2) {
42699
+ function onlyOnce(fn) {
42687
42700
  return function(...args) {
42688
- if (fn2 === null) throw new Error("Callback was already called.");
42689
- var callFn = fn2;
42690
- fn2 = null;
42701
+ if (fn === null) throw new Error("Callback was already called.");
42702
+ var callFn = fn;
42703
+ fn = null;
42691
42704
  callFn.apply(this, args);
42692
42705
  };
42693
42706
  }
@@ -43086,8 +43099,8 @@ var require_pipeline = __commonJS({
43086
43099
  callback(err2 || new ERR_STREAM_DESTROYED("pipe"));
43087
43100
  };
43088
43101
  }
43089
- function call(fn2) {
43090
- fn2();
43102
+ function call(fn) {
43103
+ fn();
43091
43104
  }
43092
43105
  function pipe(from, to2) {
43093
43106
  return from.pipe(to2);
@@ -43175,17 +43188,17 @@ var require_diagnostics = __commonJS({
43175
43188
  if (!async.length) return false;
43176
43189
  return new Promise(function pinky(resolve2) {
43177
43190
  Promise.all(
43178
- async.map(function prebind(fn2) {
43179
- return fn2(namespace);
43191
+ async.map(function prebind(fn) {
43192
+ return fn(namespace);
43180
43193
  })
43181
43194
  ).then(function resolved(values) {
43182
43195
  resolve2(values.some(Boolean));
43183
43196
  });
43184
43197
  });
43185
43198
  }
43186
- function modify(fn2) {
43187
- if (~modifiers.indexOf(fn2)) return false;
43188
- modifiers.push(fn2);
43199
+ function modify(fn) {
43200
+ if (~modifiers.indexOf(fn)) return false;
43201
+ modifiers.push(fn);
43189
43202
  return true;
43190
43203
  }
43191
43204
  function write() {
@@ -43197,14 +43210,14 @@ var require_diagnostics = __commonJS({
43197
43210
  }
43198
43211
  return message;
43199
43212
  }
43200
- function introduce(fn2, options) {
43213
+ function introduce(fn, options) {
43201
43214
  var has2 = Object.prototype.hasOwnProperty;
43202
43215
  for (var key in options) {
43203
43216
  if (has2.call(options, key)) {
43204
- fn2[key] = options[key];
43217
+ fn[key] = options[key];
43205
43218
  }
43206
43219
  }
43207
- return fn2;
43220
+ return fn;
43208
43221
  }
43209
43222
  function nope(options) {
43210
43223
  options.enabled = false;
@@ -44056,8 +44069,8 @@ var require_index_cjs = __commonJS({
44056
44069
  const a = lab[1];
44057
44070
  const b3 = lab[2];
44058
44071
  let h2;
44059
- const hr = Math.atan2(b3, a);
44060
- h2 = hr * 360 / 2 / Math.PI;
44072
+ const hr2 = Math.atan2(b3, a);
44073
+ h2 = hr2 * 360 / 2 / Math.PI;
44061
44074
  if (h2 < 0) {
44062
44075
  h2 += 360;
44063
44076
  }
@@ -44068,9 +44081,9 @@ var require_index_cjs = __commonJS({
44068
44081
  const l = lch[0];
44069
44082
  const c2 = lch[1];
44070
44083
  const h2 = lch[2];
44071
- const hr = h2 / 360 * 2 * Math.PI;
44072
- const a = c2 * Math.cos(hr);
44073
- const b3 = c2 * Math.sin(hr);
44084
+ const hr2 = h2 / 360 * 2 * Math.PI;
44085
+ const a = c2 * Math.cos(hr2);
44086
+ const b3 = c2 * Math.sin(hr2);
44074
44087
  return [l, a, b3];
44075
44088
  };
44076
44089
  convert$1.rgb.ansi16 = function(args, saturation = null) {
@@ -44362,15 +44375,15 @@ var require_index_cjs = __commonJS({
44362
44375
  }
44363
44376
  function wrapConversion(toModel, graph) {
44364
44377
  const path4 = [graph[toModel].parent, toModel];
44365
- let fn2 = convert$1[graph[toModel].parent][toModel];
44378
+ let fn = convert$1[graph[toModel].parent][toModel];
44366
44379
  let cur = graph[toModel].parent;
44367
44380
  while (graph[cur].parent) {
44368
44381
  path4.unshift(graph[cur].parent);
44369
- fn2 = link(convert$1[graph[cur].parent][cur], fn2);
44382
+ fn = link(convert$1[graph[cur].parent][cur], fn);
44370
44383
  cur = graph[cur].parent;
44371
44384
  }
44372
- fn2.conversion = path4;
44373
- return fn2;
44385
+ fn.conversion = path4;
44386
+ return fn;
44374
44387
  }
44375
44388
  function route(fromModel) {
44376
44389
  const graph = deriveBFS(fromModel);
@@ -44388,7 +44401,7 @@ var require_index_cjs = __commonJS({
44388
44401
  }
44389
44402
  var convert = {};
44390
44403
  var models = Object.keys(convert$1);
44391
- function wrapRaw(fn2) {
44404
+ function wrapRaw(fn) {
44392
44405
  const wrappedFn = function(...args) {
44393
44406
  const arg0 = args[0];
44394
44407
  if (arg0 === void 0 || arg0 === null) {
@@ -44397,14 +44410,14 @@ var require_index_cjs = __commonJS({
44397
44410
  if (arg0.length > 1) {
44398
44411
  args = arg0;
44399
44412
  }
44400
- return fn2(args);
44413
+ return fn(args);
44401
44414
  };
44402
- if ("conversion" in fn2) {
44403
- wrappedFn.conversion = fn2.conversion;
44415
+ if ("conversion" in fn) {
44416
+ wrappedFn.conversion = fn.conversion;
44404
44417
  }
44405
44418
  return wrappedFn;
44406
44419
  }
44407
- function wrapRounded(fn2) {
44420
+ function wrapRounded(fn) {
44408
44421
  const wrappedFn = function(...args) {
44409
44422
  const arg0 = args[0];
44410
44423
  if (arg0 === void 0 || arg0 === null) {
@@ -44413,7 +44426,7 @@ var require_index_cjs = __commonJS({
44413
44426
  if (arg0.length > 1) {
44414
44427
  args = arg0;
44415
44428
  }
44416
- const result = fn2(args);
44429
+ const result = fn(args);
44417
44430
  if (typeof result === "object") {
44418
44431
  for (let { length: length2 } = result, i = 0; i < length2; i++) {
44419
44432
  result[i] = Math.round(result[i]);
@@ -44421,8 +44434,8 @@ var require_index_cjs = __commonJS({
44421
44434
  }
44422
44435
  return result;
44423
44436
  };
44424
- if ("conversion" in fn2) {
44425
- wrappedFn.conversion = fn2.conversion;
44437
+ if ("conversion" in fn) {
44438
+ wrappedFn.conversion = fn.conversion;
44426
44439
  }
44427
44440
  return wrappedFn;
44428
44441
  }
@@ -44433,9 +44446,9 @@ var require_index_cjs = __commonJS({
44433
44446
  const routes = route(fromModel);
44434
44447
  const routeModels = Object.keys(routes);
44435
44448
  for (const toModel of routeModels) {
44436
- const fn2 = routes[toModel];
44437
- convert[fromModel][toModel] = wrapRounded(fn2);
44438
- convert[fromModel][toModel].raw = wrapRaw(fn2);
44449
+ const fn = routes[toModel];
44450
+ convert[fromModel][toModel] = wrapRounded(fn);
44451
+ convert[fromModel][toModel].raw = wrapRaw(fn);
44439
44452
  }
44440
44453
  }
44441
44454
  var skippedModels = [
@@ -44929,10 +44942,10 @@ var require_adapters = __commonJS({
44929
44942
  "../../node_modules/@dabh/diagnostics/adapters/index.js"(exports2, module2) {
44930
44943
  "use strict";
44931
44944
  var enabled = require_enabled();
44932
- module2.exports = function create2(fn2) {
44945
+ module2.exports = function create2(fn) {
44933
44946
  return function adapter(namespace) {
44934
44947
  try {
44935
- return enabled(namespace, fn2());
44948
+ return enabled(namespace, fn());
44936
44949
  } catch (e) {
44937
44950
  }
44938
44951
  return false;
@@ -46143,14 +46156,14 @@ var require_fn = __commonJS({
46143
46156
  "../../node_modules/fn.name/index.js"(exports2, module2) {
46144
46157
  "use strict";
46145
46158
  var toString2 = Object.prototype.toString;
46146
- module2.exports = function name(fn2) {
46147
- if ("string" === typeof fn2.displayName && fn2.constructor.name) {
46148
- return fn2.displayName;
46149
- } else if ("string" === typeof fn2.name && fn2.name) {
46150
- return fn2.name;
46151
- }
46152
- if ("object" === typeof fn2 && fn2.constructor && "string" === typeof fn2.constructor.name) return fn2.constructor.name;
46153
- var named = fn2.toString(), type = toString2.call(fn2).slice(8, -1);
46159
+ module2.exports = function name(fn) {
46160
+ if ("string" === typeof fn.displayName && fn.constructor.name) {
46161
+ return fn.displayName;
46162
+ } else if ("string" === typeof fn.name && fn.name) {
46163
+ return fn.name;
46164
+ }
46165
+ if ("object" === typeof fn && fn.constructor && "string" === typeof fn.constructor.name) return fn.constructor.name;
46166
+ var named = fn.toString(), type = toString2.call(fn).slice(8, -1);
46154
46167
  if ("Function" === type) {
46155
46168
  named = named.substring(named.indexOf("(") + 1, named.indexOf(")"));
46156
46169
  } else {
@@ -46166,16 +46179,16 @@ var require_one_time = __commonJS({
46166
46179
  "../../node_modules/one-time/index.js"(exports2, module2) {
46167
46180
  "use strict";
46168
46181
  var name = require_fn();
46169
- module2.exports = function one(fn2) {
46182
+ module2.exports = function one(fn) {
46170
46183
  var called = 0, value;
46171
46184
  function onetime() {
46172
46185
  if (called) return value;
46173
46186
  called = 1;
46174
- value = fn2.apply(this, arguments);
46175
- fn2 = null;
46187
+ value = fn.apply(this, arguments);
46188
+ fn = null;
46176
46189
  return value;
46177
46190
  }
46178
- onetime.displayName = name(fn2);
46191
+ onetime.displayName = name(fn);
46179
46192
  return onetime;
46180
46193
  };
46181
46194
  }
@@ -47815,18 +47828,18 @@ var require_object_hash = __commonJS({
47815
47828
  write("string:" + string.length + ":");
47816
47829
  write(string.toString());
47817
47830
  },
47818
- _function: function(fn2) {
47831
+ _function: function(fn) {
47819
47832
  write("fn:");
47820
- if (isNativeFunction(fn2)) {
47833
+ if (isNativeFunction(fn)) {
47821
47834
  this.dispatch("[native]");
47822
47835
  } else {
47823
- this.dispatch(fn2.toString());
47836
+ this.dispatch(fn.toString());
47824
47837
  }
47825
47838
  if (options.respectFunctionNames !== false) {
47826
- this.dispatch("function-name:" + String(fn2.name));
47839
+ this.dispatch("function-name:" + String(fn.name));
47827
47840
  }
47828
47841
  if (options.respectFunctionProperties) {
47829
- this._object(fn2);
47842
+ this._object(fn);
47830
47843
  }
47831
47844
  },
47832
47845
  _number: function(number) {
@@ -48030,10 +48043,10 @@ var require_moment = __commonJS({
48030
48043
  function isDate(input) {
48031
48044
  return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
48032
48045
  }
48033
- function map(arr, fn2) {
48046
+ function map(arr, fn) {
48034
48047
  var res = [], i, arrLen = arr.length;
48035
48048
  for (i = 0; i < arrLen; ++i) {
48036
- res.push(fn2(arr[i], i));
48049
+ res.push(fn(arr[i], i));
48037
48050
  }
48038
48051
  return res;
48039
48052
  }
@@ -48186,7 +48199,7 @@ var require_moment = __commonJS({
48186
48199
  console.warn("Deprecation warning: " + msg);
48187
48200
  }
48188
48201
  }
48189
- function deprecate(msg, fn2) {
48202
+ function deprecate(msg, fn) {
48190
48203
  var firstTime = true;
48191
48204
  return extend(function() {
48192
48205
  if (hooks.deprecationHandler != null) {
@@ -48214,8 +48227,8 @@ var require_moment = __commonJS({
48214
48227
  );
48215
48228
  firstTime = false;
48216
48229
  }
48217
- return fn2.apply(this, arguments);
48218
- }, fn2);
48230
+ return fn.apply(this, arguments);
48231
+ }, fn);
48219
48232
  }
48220
48233
  var deprecations = {};
48221
48234
  function deprecateSimple(name, msg) {
@@ -50182,7 +50195,7 @@ var require_moment = __commonJS({
50182
50195
  }
50183
50196
  }
50184
50197
  );
50185
- function pickBy(fn2, moments) {
50198
+ function pickBy(fn, moments) {
50186
50199
  var res, i;
50187
50200
  if (moments.length === 1 && isArray(moments[0])) {
50188
50201
  moments = moments[0];
@@ -50192,7 +50205,7 @@ var require_moment = __commonJS({
50192
50205
  }
50193
50206
  res = moments[0];
50194
50207
  for (i = 1; i < moments.length; ++i) {
50195
- if (!moments[i].isValid() || moments[i][fn2](res)) {
50208
+ if (!moments[i].isValid() || moments[i][fn](res)) {
50196
50209
  res = moments[i];
50197
50210
  }
50198
50211
  }
@@ -52831,10 +52844,10 @@ var pt = class {
52831
52844
  }, precedence: t });
52832
52845
  }
52833
52846
  construct(e) {
52834
- return new mr(e, this.prefixParselets, this.infixParselets);
52847
+ return new fr(e, this.prefixParselets, this.infixParselets);
52835
52848
  }
52836
52849
  };
52837
- var mr = class {
52850
+ var fr = class {
52838
52851
  constructor(e, t, n) {
52839
52852
  c(this, "tokens");
52840
52853
  c(this, "prefixParselets");
@@ -52891,28 +52904,28 @@ function oe(r6) {
52891
52904
  var ft = "http://hl7.org";
52892
52905
  var mt = "ok";
52893
52906
  var ht = "created";
52894
- var gr = "not-modified";
52895
- var xr = "not-found";
52896
- var Tr = "unauthorized";
52907
+ var hr = "not-modified";
52908
+ var yr = "not-found";
52909
+ var vr = "unauthorized";
52897
52910
  var gt = "accepted";
52898
- var Fn = { resourceType: "OperationOutcome", id: xr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
52899
- var Le = { resourceType: "OperationOutcome", id: Tr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
52900
- var Un = { ...Le, issue: [...Le.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
52901
- var Sr = { ...Le, issue: [...Le.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
52911
+ var Fn = { resourceType: "OperationOutcome", id: yr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
52912
+ var Ne = { resourceType: "OperationOutcome", id: vr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
52913
+ var Un = { ...Ne, issue: [...Ne.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
52914
+ var Tr = { ...Ne, issue: [...Ne.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
52902
52915
  function P(r6, e) {
52903
52916
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: oe(e) } : void 0 }] };
52904
52917
  }
52905
52918
  function T(r6, e, t, n) {
52906
52919
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: t ?? "structure", details: { text: r6 }, ...e ? { expression: e } : void 0, ...n ? { diagnostics: n } : void 0 }] };
52907
52920
  }
52908
- function br(r6) {
52921
+ function Sr(r6) {
52909
52922
  return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
52910
52923
  }
52911
52924
  function ze(r6) {
52912
52925
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
52913
52926
  }
52914
- function Er(r6) {
52915
- return r6.id === mt || r6.id === ht || r6.id === gr || r6.id === gt;
52927
+ function br(r6) {
52928
+ return r6.id === mt || r6.id === ht || r6.id === hr || r6.id === gt;
52916
52929
  }
52917
52930
  var f = class extends Error {
52918
52931
  constructor(t, n) {
@@ -52922,10 +52935,10 @@ var f = class extends Error {
52922
52935
  }
52923
52936
  };
52924
52937
  function yt(r6) {
52925
- return r6 instanceof f ? r6.outcome : ze(r6) ? r6 : P(Ne(r6));
52938
+ return r6 instanceof f ? r6.outcome : ze(r6) ? r6 : P(Se(r6));
52926
52939
  }
52927
- function Ne(r6) {
52928
- return r6 ? typeof r6 == "string" ? r6 : br(r6) ? r6.message : ze(r6) ? Bn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
52940
+ function Se(r6) {
52941
+ return r6 ? typeof r6 == "string" ? r6 : Sr(r6) ? r6.message : ze(r6) ? Bn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
52929
52942
  }
52930
52943
  function Bn(r6) {
52931
52944
  let e = r6.issue?.map(Uo) ?? [];
@@ -52945,44 +52958,44 @@ function jn(r6) {
52945
52958
  return e;
52946
52959
  }
52947
52960
  var $n = { 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" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, 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"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { 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" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, 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" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, 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" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, 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" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, 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" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] }, identitySource: { type: [{ code: "code" }] }, identityMappingMode: { type: [{ code: "code" }] } } } };
52948
- function Ar(r6) {
52949
- return new Cr(r6).parse();
52961
+ function Pr(r6) {
52962
+ return new Rr(r6).parse();
52950
52963
  }
52951
- var be = jn($n);
52952
- var wr = /* @__PURE__ */ Object.create(null);
52964
+ var Ee = jn($n);
52965
+ var Ar = /* @__PURE__ */ Object.create(null);
52953
52966
  var Hn = /* @__PURE__ */ Object.create(null);
52954
52967
  var jo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
52955
52968
  function Jn(r6) {
52956
52969
  let e;
52957
52970
  return e = Hn[r6], e || (e = Hn[r6] = /* @__PURE__ */ Object.create(null)), e;
52958
52971
  }
52959
- function Or(r6) {
52972
+ function wr(r6) {
52960
52973
  let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
52961
52974
  ei(t);
52962
- for (let n of t) Ir(n);
52975
+ for (let n of t) Or(n);
52963
52976
  }
52964
- function Ir(r6) {
52977
+ function Or(r6) {
52965
52978
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
52966
52979
  if (r6.resourceType !== "StructureDefinition") return;
52967
- let e = Ar(r6), t = jo[r6.url], n, i;
52968
- t ? (n = be, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = be, i = r6.type) : (n = Jn(r6.url), i = r6.type), n[i] = e;
52980
+ let e = Pr(r6), t = jo[r6.url], n, i;
52981
+ t ? (n = Ee, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = Ee, i = r6.type) : (n = Jn(r6.url), i = r6.type), n[i] = e;
52969
52982
  for (let o2 of e.innerTypes) o2.parentType = e, n[o2.name] = o2;
52970
- wr[r6.url] = e;
52983
+ Ar[r6.url] = e;
52971
52984
  }
52972
52985
  function Yn(r6) {
52973
- return !!be[r6];
52986
+ return !!Ee[r6];
52974
52987
  }
52975
- function Ee(r6, e) {
52988
+ function Re(r6, e) {
52976
52989
  if (e) {
52977
52990
  let t = Jn(e)[r6];
52978
52991
  if (t) return t;
52979
52992
  }
52980
- return be[r6];
52993
+ return Ee[r6];
52981
52994
  }
52982
52995
  function Xn(r6) {
52983
- return !!wr[r6];
52996
+ return !!Ar[r6];
52984
52997
  }
52985
- var Cr = class {
52998
+ var Rr = class {
52986
52999
  constructor(e) {
52987
53000
  c(this, "root");
52988
53001
  c(this, "elements");
@@ -53001,7 +53014,7 @@ var Cr = class {
53001
53014
  if (e.sliceName) this.parseSliceStart(e);
53002
53015
  else if (e.id?.includes(":")) {
53003
53016
  if (this.slicingContext?.current) {
53004
- let t = Rr(e, this.slicingContext.path);
53017
+ let t = Er(e, this.slicingContext.path);
53005
53018
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
53006
53019
  }
53007
53020
  } else {
@@ -53010,13 +53023,13 @@ var Cr = class {
53010
53023
  let n = this.backboneContext;
53011
53024
  for (; n; ) {
53012
53025
  if (e.path?.startsWith(n.path + ".")) {
53013
- n.type.elements[Rr(e, n.path)] = t;
53026
+ n.type.elements[Er(e, n.path)] = t;
53014
53027
  break;
53015
53028
  }
53016
53029
  n = n.parent;
53017
53030
  }
53018
53031
  if (!n) {
53019
- let i = Rr(e, this.root.path);
53032
+ let i = Er(e, this.root.path);
53020
53033
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
53021
53034
  }
53022
53035
  this.checkFieldExit(e);
@@ -53030,7 +53043,7 @@ var Cr = class {
53030
53043
  }
53031
53044
  enterInnerType(e) {
53032
53045
  for (; this.backboneContext && !Fe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
53033
- let t = Pr(e);
53046
+ let t = Cr(e);
53034
53047
  this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Fe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
53035
53048
  }
53036
53049
  enterSlice(e, t) {
@@ -53070,7 +53083,7 @@ var Cr = class {
53070
53083
  parseElementDefinitionType(e) {
53071
53084
  return (e.type ?? []).map((t) => {
53072
53085
  let n;
53073
- return (t.code === "BackboneElement" || t.code === "Element") && (n = Pr(e)), n || (n = pe(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
53086
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = Cr(e)), n || (n = pe(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
53074
53087
  });
53075
53088
  }
53076
53089
  parseElementDefinition(e) {
@@ -53081,7 +53094,7 @@ var Cr = class {
53081
53094
  function Qn(r6) {
53082
53095
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
53083
53096
  }
53084
- function Rr(r6, e = "") {
53097
+ function Er(r6, e = "") {
53085
53098
  return Ho(r6.path, e);
53086
53099
  }
53087
53100
  function Ho(r6, e) {
@@ -53101,7 +53114,7 @@ function Qo(r6) {
53101
53114
  let e = r6.description;
53102
53115
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
53103
53116
  }
53104
- function _r(r6, e, t) {
53117
+ function Mr(r6, e, t) {
53105
53118
  let n = r6.path;
53106
53119
  return zo(L(r6, e, t), n, e);
53107
53120
  }
@@ -53115,7 +53128,7 @@ function h(r6) {
53115
53128
  return [{ type: d.boolean, value: r6 }];
53116
53129
  }
53117
53130
  function b(r6) {
53118
- return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: d.integer, value: r6 } : typeof r6 == "number" ? { type: d.decimal, value: r6 } : typeof r6 == "boolean" ? { type: d.boolean, value: r6 } : typeof r6 == "string" ? { type: d.string, value: r6 } : V(r6) ? { type: d.Quantity, value: r6 } : I(r6) ? { type: r6.resourceType, value: r6 } : $r(r6) ? { type: d.CodeableConcept, value: r6 } : jr(r6) ? { type: d.Coding, value: r6 } : { type: d.BackboneElement, value: r6 };
53131
+ return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: d.integer, value: r6 } : typeof r6 == "number" ? { type: d.decimal, value: r6 } : typeof r6 == "boolean" ? { type: d.boolean, value: r6 } : typeof r6 == "string" ? { type: d.string, value: r6 } : V(r6) ? { type: d.Quantity, value: r6 } : I(r6) ? { type: r6.resourceType, value: r6 } : jr(r6) ? { type: d.CodeableConcept, value: r6 } : qr(r6) ? { type: d.Coding, value: r6 } : { type: d.BackboneElement, value: r6 };
53119
53132
  }
53120
53133
  function j(r6) {
53121
53134
  return r6.length === 0 ? false : !!r6[0].value;
@@ -53145,11 +53158,11 @@ function os(r6, e, t) {
53145
53158
  }
53146
53159
  if (a) if (Array.isArray(o2)) {
53147
53160
  o2 = o2.slice();
53148
- for (let v2 = 0; v2 < Math.max(o2.length, a.length); v2++) o2[v2] = Br(o2[v2], a[v2]);
53161
+ for (let v2 = 0; v2 < Math.max(o2.length, a.length); v2++) o2[v2] = Ur(o2[v2], a[v2]);
53149
53162
  } else if (!o2 && Array.isArray(a)) {
53150
53163
  o2 = a.slice();
53151
- for (let v2 = 0; v2 < a.length; v2++) o2[v2] = Br(void 0, a[v2]);
53152
- } else o2 = Br(o2, a);
53164
+ for (let v2 = 0; v2 < a.length; v2++) o2[v2] = Ur(void 0, a[v2]);
53165
+ } else o2 = Ur(o2, a);
53153
53166
  if (!A(o2)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o2) ? o2.map((v2) => ti(v2, s)) : ti(o2, s);
53154
53167
  }
53155
53168
  function ti(r6, e) {
@@ -53201,14 +53214,14 @@ function si(r6, e) {
53201
53214
  }
53202
53215
  function Ke(r6, e) {
53203
53216
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
53204
- return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : V(t) && V(n) ? h(ui(t, n)) : h(typeof t == "object" && typeof n == "object" ? qr(r6, e) : t === n);
53217
+ return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : V(t) && V(n) ? h(ui(t, n)) : h(typeof t == "object" && typeof n == "object" ? Wr(r6, e) : t === n);
53205
53218
  }
53206
- function Wr(r6, e) {
53219
+ function Br(r6, e) {
53207
53220
  return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(ri), e.sort(ri), h(r6.every((t, n) => j(as(t, e[n])))));
53208
53221
  }
53209
53222
  function as(r6, e) {
53210
53223
  let { type: t, value: n } = r6, { type: i, value: o2 } = e, s = n?.valueOf(), a = o2?.valueOf();
53211
- return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : V(s) && V(a) ? h(ui(s, a)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? qr({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
53224
+ return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : V(s) && V(a) ? h(ui(s, a)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Wr({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
53212
53225
  }
53213
53226
  function ri(r6, e) {
53214
53227
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
@@ -53253,13 +53266,13 @@ function V(r6) {
53253
53266
  function ui(r6, e) {
53254
53267
  return Math.abs(r6.value - e.value) < 0.01 && (r6.unit === e.unit || r6.code === e.code || r6.unit === e.code || r6.code === e.unit);
53255
53268
  }
53256
- function qr(r6, e) {
53269
+ function Wr(r6, e) {
53257
53270
  let t = Object.keys(r6), n = Object.keys(e);
53258
53271
  if (t.length !== n.length) return false;
53259
53272
  for (let i of t) {
53260
53273
  let o2 = r6[i], s = e[i];
53261
53274
  if (ni(o2) && ni(s)) {
53262
- if (!qr(o2, s)) return false;
53275
+ if (!Wr(o2, s)) return false;
53263
53276
  } else if (o2 !== s) return false;
53264
53277
  }
53265
53278
  return true;
@@ -53267,7 +53280,7 @@ function qr(r6, e) {
53267
53280
  function ni(r6) {
53268
53281
  return r6 !== null && typeof r6 == "object";
53269
53282
  }
53270
- function Br(r6, e) {
53283
+ function Ur(r6, e) {
53271
53284
  if (e) {
53272
53285
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
53273
53286
  return cs(r6 ?? {}, e);
@@ -53280,7 +53293,7 @@ function cs(r6, e) {
53280
53293
  function Xe(r6, e) {
53281
53294
  return I(r6, e) && "id" in r6 && typeof r6.id == "string";
53282
53295
  }
53283
- function Re(r6) {
53296
+ function Ce(r6) {
53284
53297
  let e = O(r6) ?? "undefined/undefined", t = ls(r6);
53285
53298
  return t === e ? { reference: e } : { reference: e, display: t };
53286
53299
  }
@@ -53288,7 +53301,7 @@ function O(r6) {
53288
53301
  if (Q(r6)) return r6.reference;
53289
53302
  if (Xe(r6)) return `${r6.resourceType}/${r6.id}`;
53290
53303
  }
53291
- function Ce(r6) {
53304
+ function Pe(r6) {
53292
53305
  if (r6) return Q(r6) ? r6.reference.split("/")[1] : r6.id;
53293
53306
  }
53294
53307
  function us(r6) {
@@ -53309,7 +53322,7 @@ function ls(r6) {
53309
53322
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
53310
53323
  if ("code" in r6 && r6.code) {
53311
53324
  let e = r6.code;
53312
- if (Array.isArray(e) && (e = e[0]), $r(e)) return Ye(e);
53325
+ if (Array.isArray(e) && (e = e[0]), jr(e)) return Ye(e);
53313
53326
  if (Ts(e)) return e.text;
53314
53327
  }
53315
53328
  return O(r6) ?? "";
@@ -53340,10 +53353,10 @@ function pe(r6, ...e) {
53340
53353
  return t;
53341
53354
  }
53342
53355
  function At(r6, e) {
53343
- let t = Jr(r6);
53356
+ let t = zr(r6);
53344
53357
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
53345
53358
  }
53346
- function Jr(r6) {
53359
+ function zr(r6) {
53347
53360
  if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? fs2(r6) : ms(r6) : r6;
53348
53361
  }
53349
53362
  function fs2(r6) {
@@ -53351,7 +53364,7 @@ function fs2(r6) {
53351
53364
  if (e === 0) return;
53352
53365
  let t, n = 0;
53353
53366
  for (let i = 0; i < e; i++) {
53354
- let o2 = r6[i], s = Jr(o2);
53367
+ let o2 = r6[i], s = zr(o2);
53355
53368
  s !== o2 && !t && (t = Array.from(r6)), s === void 0 ? t && (t[i] = null) : (t && (t[i] = s), n++);
53356
53369
  }
53357
53370
  if (n !== 0) return t ?? r6;
@@ -53359,7 +53372,7 @@ function fs2(r6) {
53359
53372
  function ms(r6) {
53360
53373
  let e, t = 0;
53361
53374
  for (let n in r6) {
53362
- let i = r6[n], o2 = Jr(i);
53375
+ let i = r6[n], o2 = zr(i);
53363
53376
  o2 !== i && !e && (e = { ...r6 }), o2 === void 0 ? e && delete e[n] : (e && (e[n] = o2), t++);
53364
53377
  }
53365
53378
  if (t !== 0) return e ?? r6;
@@ -53396,11 +53409,11 @@ function gs(r6, e, t) {
53396
53409
  function C(r6) {
53397
53410
  return r6 !== null && typeof r6 == "object";
53398
53411
  }
53399
- function jr(r6) {
53412
+ function qr(r6) {
53400
53413
  return C(r6) && "code" in r6 && typeof r6.code == "string";
53401
53414
  }
53402
- function $r(r6) {
53403
- return C(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(jr);
53415
+ function jr(r6) {
53416
+ return C(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(qr);
53404
53417
  }
53405
53418
  function Ts(r6) {
53406
53419
  return C(r6) && "text" in r6 && typeof r6.text == "string";
@@ -53423,7 +53436,7 @@ function gi(r6) {
53423
53436
  function N(r6) {
53424
53437
  return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
53425
53438
  }
53426
- var Yr = (r6, e) => new Promise((t, n) => {
53439
+ var Kr = (r6, e) => new Promise((t, n) => {
53427
53440
  e?.signal?.throwIfAborted();
53428
53441
  let i = setTimeout(t, r6);
53429
53442
  e?.signal?.addEventListener("abort", () => {
@@ -53442,14 +53455,14 @@ function qe(r6, e, t) {
53442
53455
  function wt(r6) {
53443
53456
  return r6.sort((e, t) => e.localeCompare(t));
53444
53457
  }
53445
- function Xr(r6) {
53458
+ function Yr(r6) {
53446
53459
  return r6.endsWith("/") ? r6 : r6 + "/";
53447
53460
  }
53448
53461
  function As(r6) {
53449
53462
  return r6.startsWith("/") ? r6.slice(1) : r6;
53450
53463
  }
53451
53464
  function U(r6, e) {
53452
- return new URL(As(e), Xr(r6.toString())).toString();
53465
+ return new URL(As(e), Yr(r6.toString())).toString();
53453
53466
  }
53454
53467
  function Ti(r6, e) {
53455
53468
  return U(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
@@ -53466,25 +53479,25 @@ function Ze(r6, e) {
53466
53479
  if (!r6) return "";
53467
53480
  let t = [];
53468
53481
  if (r6.prefix && e?.prefix !== false && t.push(...r6.prefix), r6.given && t.push(...r6.given), r6.family && t.push(r6.family), r6.suffix && e?.suffix !== false && t.push(...r6.suffix), r6.use && (e?.all || e?.use) && t.push("[" + r6.use + "]"), t.length === 0) {
53469
- let n = Ae(r6.text);
53482
+ let n = we(r6.text);
53470
53483
  if (n) return n;
53471
53484
  }
53472
53485
  return t.join(" ").trim();
53473
53486
  }
53474
53487
  function Ye(r6) {
53475
53488
  if (!r6) return "";
53476
- let e = Ae(r6.text);
53489
+ let e = we(r6.text);
53477
53490
  return e || (r6.coding ? r6.coding.map((t) => Ei(t)).join(", ") : "");
53478
53491
  }
53479
53492
  function Ei(r6, e) {
53480
- let t = Ae(r6?.display);
53493
+ let t = we(r6?.display);
53481
53494
  if (t) {
53482
- let n = e ? Ae(r6?.code) : void 0;
53495
+ let n = e ? we(r6?.code) : void 0;
53483
53496
  return `${t}${n ? " (" + n + ")" : ""}`;
53484
53497
  }
53485
- return Ae(r6?.code) ?? "";
53498
+ return we(r6?.code) ?? "";
53486
53499
  }
53487
- function Ae(r6) {
53500
+ function we(r6) {
53488
53501
  return typeof r6 == "string" ? r6 : void 0;
53489
53502
  }
53490
53503
  var d = { 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", Element: "Element", ElementDefinition: "ElementDefinition", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", MoneyQuantity: "MoneyQuantity", 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", SimpleQuantity: "SimpleQuantity", 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", xhtml: "xhtml" };
@@ -53496,13 +53509,13 @@ function Pi(r6) {
53496
53509
  let e = $.types[r6];
53497
53510
  return e || (e = { searchParamsDetails: {} }, $.types[r6] = e), !e.searchParams && r6 !== "Binary" && (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" }, _project: { base: [r6], code: "_project", type: "token", expression: r6 + ".meta.project" } }), e;
53498
53511
  }
53499
- function en(r6) {
53512
+ function Zr(r6) {
53500
53513
  for (let e of r6.base ?? y) {
53501
53514
  let t = Pi(e);
53502
53515
  t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
53503
53516
  }
53504
53517
  }
53505
- function Pr(r6) {
53518
+ function Cr(r6) {
53506
53519
  let e = r6.type?.[0]?.code;
53507
53520
  return e === "BackboneElement" || e === "Element" ? Us((r6.base?.path ?? r6.path)?.split(".")) : e;
53508
53521
  }
@@ -53510,7 +53523,7 @@ function Us(r6) {
53510
53523
  return r6.length === 1 ? r6[0] : r6.map(N).join("");
53511
53524
  }
53512
53525
  function Ct(r6, e, t) {
53513
- let n = Ee(r6, t);
53526
+ let n = Re(r6, t);
53514
53527
  if (n) return Ai(n.elements, e);
53515
53528
  }
53516
53529
  function Ai(r6, e) {
@@ -53555,10 +53568,10 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
53555
53568
  return h(false);
53556
53569
  }, subsetOf: (r6, e, t) => {
53557
53570
  if (e.length === 0) return h(true);
53558
- let n = t.eval(r6, we(r6));
53571
+ let n = t.eval(r6, Oe(r6));
53559
53572
  return n.length === 0 ? h(false) : h(e.every((i) => n.some((o2) => o2.value === i.value)));
53560
53573
  }, supersetOf: (r6, e, t) => {
53561
- let n = t.eval(r6, we(r6));
53574
+ let n = t.eval(r6, Oe(r6));
53562
53575
  return n.length === 0 ? h(true) : e.length === 0 ? h(false) : h(n.every((i) => e.some((o2) => o2.value === i.value)));
53563
53576
  }, count: (r6, e) => [{ type: d.integer, value: e.length }], distinct: (r6, e) => {
53564
53577
  let t = [];
@@ -53577,21 +53590,21 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
53577
53590
  return n <= 0 ? [] : e.slice(0, n);
53578
53591
  }, intersect: (r6, e, t) => {
53579
53592
  if (!t) return e;
53580
- let n = t.eval(r6, we(r6)), i = [];
53593
+ let n = t.eval(r6, Oe(r6)), i = [];
53581
53594
  for (let o2 of e) !i.some((s) => s.value === o2.value) && n.some((s) => s.value === o2.value) && i.push(o2);
53582
53595
  return i;
53583
53596
  }, exclude: (r6, e, t) => {
53584
53597
  if (!t) return e;
53585
- let n = t.eval(r6, we(r6)), i = [];
53598
+ let n = t.eval(r6, Oe(r6)), i = [];
53586
53599
  for (let o2 of e) n.some((s) => s.value === o2.value) || i.push(o2);
53587
53600
  return i;
53588
53601
  }, union: (r6, e, t) => {
53589
53602
  if (!t) return e;
53590
- let n = t.eval(r6, we(r6));
53603
+ let n = t.eval(r6, Oe(r6));
53591
53604
  return bt([...e, ...n]);
53592
53605
  }, combine: (r6, e, t) => {
53593
53606
  if (!t) return e;
53594
- let n = t.eval(r6, we(r6));
53607
+ let n = t.eval(r6, Oe(r6));
53595
53608
  return [...e, ...n];
53596
53609
  }, htmlChecks: (r6, e, t) => [b(true)], iif: (r6, e, t, n, i) => {
53597
53610
  let o2 = t.eval(r6, e);
@@ -53644,7 +53657,7 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
53644
53657
  let a = o2, u2 = s ? a + s : i.length;
53645
53658
  return a < 0 || a >= i.length ? void 0 : i.substring(a, u2);
53646
53659
  }, r6, e, t, n), startsWith: (r6, e, t) => H((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => H((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => H((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => H((t) => t.toUpperCase(), r6, e), lower: (r6, e) => H((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => H((i, o2, s) => i.replaceAll(o2, s), r6, e, t, n), matches: (r6, e, t) => H((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => H((i, o2, s) => i.replaceAll(new RegExp(o2, "g"), s.replaceAll(/\$\{(\w+)\}/g, "$<$1>")), r6, e, t, n), length: (r6, e) => H((t) => t.length, r6, e), toChars: (r6, e) => H((t) => t ? t.split("") : void 0, r6, e), encode: ae, decode: ae, escape: ae, unescape: ae, trim: ae, split: ae, join: (r6, e, t) => {
53647
- let n = t?.eval(r6, we(r6))[0]?.value ?? "";
53660
+ let n = t?.eval(r6, Oe(r6))[0]?.value ?? "";
53648
53661
  if (typeof n != "string") throw new TypeError("Separator must be a string.");
53649
53662
  return [{ type: d.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
53650
53663
  }, abs: (r6, e) => Z(Math.abs, r6, e), ceiling: (r6, e) => Z(Math.ceil, r6, e), exp: (r6, e) => Z(Math.exp, r6, e), floor: (r6, e) => Z(Math.floor, r6, e), ln: (r6, e) => Z(Math.log, r6, e), log: (r6, e, t) => Z((n, i) => Math.log(n) / Math.log(i), r6, e, t), power: (r6, e, t) => Z(Math.pow, r6, e, t), round: (r6, e, ...t) => Z((n, i = 0) => {
@@ -53695,7 +53708,7 @@ var _ = { empty: (r6, e) => h(e.every((t) => A(t.value))), hasValue: (r6, e) =>
53695
53708
  let n = e[0].value;
53696
53709
  if (!n?.reference) return [];
53697
53710
  let i = "";
53698
- return t instanceof B && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: d.id, value: Ce(n) }];
53711
+ return t instanceof B && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: d.id, value: Pe(n) }];
53699
53712
  }, extension: (r6, e, t) => {
53700
53713
  let n = t.eval(r6, e)[0].value, i = e?.[0]?.value;
53701
53714
  if (i) {
@@ -53723,7 +53736,7 @@ function ee(r6, e) {
53723
53736
  for (let t of r6) if (t == null) throw new Error("Expected non-null argument");
53724
53737
  return r6;
53725
53738
  }
53726
- function we(r6) {
53739
+ function Oe(r6) {
53727
53740
  let e = r6;
53728
53741
  for (; e.parent?.variables.$this; ) e = e.parent;
53729
53742
  return [e.variables.$this];
@@ -53760,7 +53773,7 @@ var B = class {
53760
53773
  }
53761
53774
  evalValue(e) {
53762
53775
  let t = e.value;
53763
- if (!(!t || typeof t != "object")) return I(t, this.name) ? ("path" in e || (e.path = t.resourceType), e) : _r(e, this.name);
53776
+ if (!(!t || typeof t != "object")) return I(t, this.name) ? ("path" in e || (e.path = t.resourceType), e) : Mr(e, this.name);
53764
53777
  }
53765
53778
  toString() {
53766
53779
  return this.name;
@@ -53849,7 +53862,7 @@ var te = class extends R {
53849
53862
  return `${this.left.toString()}.${this.right.toString()}`;
53850
53863
  }
53851
53864
  };
53852
- var Oe = class extends R {
53865
+ var Ie = class extends R {
53853
53866
  constructor(e, t) {
53854
53867
  super("|", e, t);
53855
53868
  }
@@ -53882,7 +53895,7 @@ var Nt = class extends R {
53882
53895
  }
53883
53896
  eval(e, t) {
53884
53897
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
53885
- return Wr(n, i);
53898
+ return Br(n, i);
53886
53899
  }
53887
53900
  };
53888
53901
  var Ft = class extends R {
@@ -53891,10 +53904,10 @@ var Ft = class extends R {
53891
53904
  }
53892
53905
  eval(e, t) {
53893
53906
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
53894
- return ii(Wr(n, i));
53907
+ return ii(Br(n, i));
53895
53908
  }
53896
53909
  };
53897
- var Ie = class extends R {
53910
+ var ke = class extends R {
53898
53911
  constructor(e, t) {
53899
53912
  super("is", e, t);
53900
53913
  }
@@ -53956,7 +53969,7 @@ var re = class {
53956
53969
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
53957
53970
  }
53958
53971
  };
53959
- var ke = class {
53972
+ var Ve = class {
53960
53973
  constructor(e, t) {
53961
53974
  c(this, "left");
53962
53975
  c(this, "expr");
@@ -53984,7 +53997,7 @@ var Gs = { parse(r6) {
53984
53997
  var Qs = { parse(r6, e) {
53985
53998
  let t = r6.consumeAndParse();
53986
53999
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
53987
- return new ke(e, t);
54000
+ return new Ve(e, t);
53988
54001
  }, precedence: S.Indexer };
53989
54002
  var zs = { parse(r6, e) {
53990
54003
  if (!(e instanceof B)) throw new Error("Unexpected parentheses");
@@ -53997,21 +54010,21 @@ function Js(r6) {
53997
54010
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
53998
54011
  }
53999
54012
  function rt() {
54000
- return new pt().registerPrefix("String", { parse: (r6, e) => new G({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new G({ type: d.dateTime, value: je(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new G({ type: d.Quantity, value: Js(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new G({ type: e.value.includes(".") ? d.decimal : d.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new G({ type: d.boolean, value: true }) }).registerPrefix("false", { parse: () => new G({ type: d.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new It() }).registerPrefix("(", Gs).registerInfix("[", Qs).registerInfix("(", zs).prefix("+", S.UnaryAdd, (r6, e) => new kt("+", e, (t) => t)).prefix("-", S.UnarySubtract, (r6, e) => new F("-", e, e, (t, n) => -n)).infixLeft(".", S.Dot, (r6, e, t) => new te(r6, t)).infixLeft("/", S.Divide, (r6, e, t) => new F("/", r6, t, (n, i) => n / i)).infixLeft("*", S.Multiply, (r6, e, t) => new F("*", r6, t, (n, i) => n * i)).infixLeft("+", S.Add, (r6, e, t) => new F("+", r6, t, (n, i) => n + i)).infixLeft("-", S.Subtract, (r6, e, t) => new F("-", r6, t, (n, i) => n - i)).infixLeft("|", S.Union, (r6, e, t) => new Oe(r6, t)).infixLeft("=", S.Equals, (r6, e, t) => new _t(r6, t)).infixLeft("!=", S.NotEquals, (r6, e, t) => new Lt(r6, t)).infixLeft("~", S.Equivalent, (r6, e, t) => new Nt(r6, t)).infixLeft("!~", S.NotEquivalent, (r6, e, t) => new Ft(r6, t)).infixLeft("<", S.LessThan, (r6, e, t) => new F("<", r6, t, (n, i) => n < i)).infixLeft("<=", S.LessThanOrEquals, (r6, e, t) => new F("<=", r6, t, (n, i) => n <= i)).infixLeft(">", S.GreaterThan, (r6, e, t) => new F(">", r6, t, (n, i) => n > i)).infixLeft(">=", S.GreaterThanOrEquals, (r6, e, t) => new F(">=", r6, t, (n, i) => n >= i)).infixLeft("&", S.Ampersand, (r6, e, t) => new Vt(r6, t)).infixLeft("and", S.And, (r6, e, t) => new Ut(r6, t)).infixLeft("as", S.As, (r6, e, t) => new ye(r6, t)).infixLeft("contains", S.Contains, (r6, e, t) => new Dt(r6, t)).infixLeft("div", S.Divide, (r6, e, t) => new F("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", S.In, (r6, e, t) => new Mt(r6, t)).infixLeft("is", S.Is, (r6, e, t) => new Ie(r6, t)).infixLeft("mod", S.Modulo, (r6, e, t) => new F("mod", r6, t, (n, i) => n % i)).infixLeft("or", S.Or, (r6, e, t) => new Bt(r6, t)).infixLeft("xor", S.Xor, (r6, e, t) => new Wt(r6, t)).infixLeft("implies", S.Implies, (r6, e, t) => new qt(r6, t));
54013
+ return new pt().registerPrefix("String", { parse: (r6, e) => new G({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new G({ type: d.dateTime, value: je(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new G({ type: d.Quantity, value: Js(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new G({ type: e.value.includes(".") ? d.decimal : d.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new G({ type: d.boolean, value: true }) }).registerPrefix("false", { parse: () => new G({ type: d.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new It() }).registerPrefix("(", Gs).registerInfix("[", Qs).registerInfix("(", zs).prefix("+", S.UnaryAdd, (r6, e) => new kt("+", e, (t) => t)).prefix("-", S.UnarySubtract, (r6, e) => new F("-", e, e, (t, n) => -n)).infixLeft(".", S.Dot, (r6, e, t) => new te(r6, t)).infixLeft("/", S.Divide, (r6, e, t) => new F("/", r6, t, (n, i) => n / i)).infixLeft("*", S.Multiply, (r6, e, t) => new F("*", r6, t, (n, i) => n * i)).infixLeft("+", S.Add, (r6, e, t) => new F("+", r6, t, (n, i) => n + i)).infixLeft("-", S.Subtract, (r6, e, t) => new F("-", r6, t, (n, i) => n - i)).infixLeft("|", S.Union, (r6, e, t) => new Ie(r6, t)).infixLeft("=", S.Equals, (r6, e, t) => new _t(r6, t)).infixLeft("!=", S.NotEquals, (r6, e, t) => new Lt(r6, t)).infixLeft("~", S.Equivalent, (r6, e, t) => new Nt(r6, t)).infixLeft("!~", S.NotEquivalent, (r6, e, t) => new Ft(r6, t)).infixLeft("<", S.LessThan, (r6, e, t) => new F("<", r6, t, (n, i) => n < i)).infixLeft("<=", S.LessThanOrEquals, (r6, e, t) => new F("<=", r6, t, (n, i) => n <= i)).infixLeft(">", S.GreaterThan, (r6, e, t) => new F(">", r6, t, (n, i) => n > i)).infixLeft(">=", S.GreaterThanOrEquals, (r6, e, t) => new F(">=", r6, t, (n, i) => n >= i)).infixLeft("&", S.Ampersand, (r6, e, t) => new Vt(r6, t)).infixLeft("and", S.And, (r6, e, t) => new Ut(r6, t)).infixLeft("as", S.As, (r6, e, t) => new ye(r6, t)).infixLeft("contains", S.Contains, (r6, e, t) => new Dt(r6, t)).infixLeft("div", S.Divide, (r6, e, t) => new F("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", S.In, (r6, e, t) => new Mt(r6, t)).infixLeft("is", S.Is, (r6, e, t) => new ke(r6, t)).infixLeft("mod", S.Modulo, (r6, e, t) => new F("mod", r6, t, (n, i) => n % i)).infixLeft("or", S.Or, (r6, e, t) => new Bt(r6, t)).infixLeft("xor", S.Xor, (r6, e, t) => new Wt(r6, t)).infixLeft("implies", S.Implies, (r6, e, t) => new qt(r6, t));
54001
54014
  }
54002
54015
  var Ks = rt();
54003
54016
  var m = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
54004
- var tn = { contains: m.CONTAINS, exact: m.EXACT, above: m.ABOVE, below: m.BELOW, text: m.TEXT, not: m.NOT, in: m.IN, "not-in": m.NOT_IN, "of-type": m.OF_TYPE, missing: m.MISSING, identifier: m.IDENTIFIER, iterate: m.ITERATE };
54005
- var rn = { eq: m.EQUALS, ne: m.NOT_EQUALS, lt: m.LESS_THAN, le: m.LESS_THAN_OR_EQUALS, gt: m.GREATER_THAN, ge: m.GREATER_THAN_OR_EQUALS, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, ap: m.APPROXIMATELY, sw: m.STARTS_WITH };
54017
+ var en = { contains: m.CONTAINS, exact: m.EXACT, above: m.ABOVE, below: m.BELOW, text: m.TEXT, not: m.NOT, in: m.IN, "not-in": m.NOT_IN, "of-type": m.OF_TYPE, missing: m.MISSING, identifier: m.IDENTIFIER, iterate: m.ITERATE };
54018
+ var tn = { eq: m.EQUALS, ne: m.NOT_EQUALS, lt: m.LESS_THAN, le: m.LESS_THAN_OR_EQUALS, gt: m.GREATER_THAN, ge: m.GREATER_THAN_OR_EQUALS, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, ap: m.APPROXIMATELY, sw: m.STARTS_WITH };
54006
54019
  var ia = [m.MISSING, m.PRESENT];
54007
54020
  var fa = new K(1e3);
54008
- var De = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
54009
- var Pa = [De.READ, De.VREAD, De.HISTORY, De.SEARCH];
54021
+ var Me = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
54022
+ var Pa = [Me.READ, Me.VREAD, Me.HISTORY, Me.SEARCH];
54010
54023
  var af = { FIRST: "first", APPLICATION: "application" };
54011
54024
  function z() {
54012
54025
  return typeof window < "u";
54013
54026
  }
54014
- function nn() {
54027
+ function rn() {
54015
54028
  return typeof Buffer < "u" ? Buffer : void 0;
54016
54029
  }
54017
54030
  var ce = { assign(r6) {
@@ -54032,7 +54045,7 @@ function Oa(r6) {
54032
54045
  let t = window.atob(r6), n = Uint8Array.from(t, (i) => i.codePointAt(0));
54033
54046
  return new window.TextDecoder().decode(n);
54034
54047
  }
54035
- let e = nn();
54048
+ let e = rn();
54036
54049
  if (e) return e.from(r6, "base64").toString("utf-8");
54037
54050
  throw new Error("Unable to decode base64");
54038
54051
  }
@@ -54041,7 +54054,7 @@ function Gt(r6) {
54041
54054
  let t = new window.TextEncoder().encode(r6), n = String.fromCodePoint.apply(null, t);
54042
54055
  return window.btoa(n);
54043
54056
  }
54044
- let e = nn();
54057
+ let e = rn();
54045
54058
  if (e) return e.from(r6, "utf8").toString("base64");
54046
54059
  throw new Error("Unable to encode base64");
54047
54060
  }
@@ -54050,7 +54063,7 @@ function Wi(r6) {
54050
54063
  let e = r6.replaceAll("-", "+").replaceAll("_", "/");
54051
54064
  return Oa(e);
54052
54065
  }
54053
- function on() {
54066
+ function nn() {
54054
54067
  let r6 = new Uint32Array(28);
54055
54068
  return crypto.getRandomValues(r6), mi(r6.buffer);
54056
54069
  }
@@ -54064,7 +54077,7 @@ function ne() {
54064
54077
  });
54065
54078
  }
54066
54079
  var k = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml", OCTET_STREAM: "application/octet-stream" };
54067
- var sn = class {
54080
+ var on = class {
54068
54081
  constructor() {
54069
54082
  c(this, "listeners");
54070
54083
  this.listeners = {};
@@ -54095,7 +54108,7 @@ var sn = class {
54095
54108
  };
54096
54109
  var ie = class {
54097
54110
  constructor() {
54098
- c(this, "emitter", new sn());
54111
+ c(this, "emitter", new on());
54099
54112
  }
54100
54113
  dispatchEvent(e) {
54101
54114
  this.emitter.dispatchEvent(e);
@@ -54113,14 +54126,14 @@ var ie = class {
54113
54126
  return this.emitter.listenerCount(e);
54114
54127
  }
54115
54128
  };
54116
- var an = { "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" };
54129
+ var sn = { "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" };
54117
54130
  var Ba = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
54118
- var cn = ["DiagnosticReport-update"];
54131
+ var an = ["DiagnosticReport-update"];
54119
54132
  function $i(r6) {
54120
- return cn.includes(r6);
54133
+ return an.includes(r6);
54121
54134
  }
54122
54135
  function Hi(r6) {
54123
- if (cn.includes(r6)) throw new f(T(`'context.version' is required for '${r6}'.`));
54136
+ if (an.includes(r6)) throw new f(T(`'context.version' is required for '${r6}'.`));
54124
54137
  }
54125
54138
  var Wa = { "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", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
54126
54139
  function qa(r6) {
@@ -54129,7 +54142,7 @@ function qa(r6) {
54129
54142
  function Gi(r6) {
54130
54143
  return !!r6.endpoint;
54131
54144
  }
54132
- function un(r6) {
54145
+ function cn(r6) {
54133
54146
  if (!zt(r6)) throw new f(T("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
54134
54147
  let { channelType: e, mode: t, topic: n, events: i } = r6, o2 = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
54135
54148
  return Gi(r6) && (o2.endpoint = r6.endpoint), new URLSearchParams(o2).toString();
@@ -54138,7 +54151,7 @@ function zt(r6) {
54138
54151
  if (typeof r6 != "object") return false;
54139
54152
  let { channelType: e, mode: t, topic: n, events: i } = r6;
54140
54153
  if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
54141
- for (let o2 of i) if (!an[o2]) return false;
54154
+ for (let o2 of i) if (!sn[o2]) return false;
54142
54155
  return !(Gi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
54143
54156
  }
54144
54157
  function ja(r6, e, t, n) {
@@ -54168,11 +54181,11 @@ function Ha(r6, e) {
54168
54181
  if (!o2.manyAllowed && (t.get(i) ?? 0) > 1) throw new f(T(`${t.get(i)} context entries with key '${i}' found for the '${r6}' event when schema only allows for 1.`));
54169
54182
  }
54170
54183
  }
54171
- function ln(r6, e, t, n) {
54184
+ function un(r6, e, t, n) {
54172
54185
  if (!(r6 && typeof r6 == "string")) throw new f(T("Must provide a topic."));
54173
- if (!an[e]) throw new f(T(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(an).join(", ")}`));
54186
+ if (!sn[e]) throw new f(T(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(sn).join(", ")}`));
54174
54187
  if (typeof t != "object") throw new f(T("context must be a context object or array of context objects."));
54175
- if (cn.includes(e) && !n) throw new f(T(`The '${e}' event must contain a 'context.versionId'.`));
54188
+ if (an.includes(e) && !n) throw new f(T(`The '${e}' event must contain a 'context.versionId'.`));
54176
54189
  let i = Array.isArray(t) ? t : [t];
54177
54190
  return Ha(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ne(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
54178
54191
  }
@@ -54282,7 +54295,7 @@ var ot = class {
54282
54295
  constructor(e, t = "") {
54283
54296
  c(this, "storage");
54284
54297
  c(this, "prefix", "");
54285
- this.storage = e ?? globalThis.localStorage ?? new dn(), this.prefix = t;
54298
+ this.storage = e ?? globalThis.localStorage ?? new ln(), this.prefix = t;
54286
54299
  }
54287
54300
  makeKey(e) {
54288
54301
  return this.prefix + e;
@@ -54306,7 +54319,7 @@ var ot = class {
54306
54319
  this.setString(e, t ? At(t) : void 0);
54307
54320
  }
54308
54321
  };
54309
- var dn = class {
54322
+ var ln = class {
54310
54323
  constructor() {
54311
54324
  c(this, "data");
54312
54325
  this.data = /* @__PURE__ */ new Map();
@@ -54357,7 +54370,7 @@ function za(r6, e) {
54357
54370
  function Yt(r6) {
54358
54371
  return new r6.constructor(r6.type, r6);
54359
54372
  }
54360
- var Me = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
54373
+ var _e = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
54361
54374
  var Zi = false;
54362
54375
  var Xt = class r extends ie {
54363
54376
  constructor(t, n, i = {}) {
@@ -54382,7 +54395,7 @@ var Xt = class r extends ie {
54382
54395
  c(this, "onopen", null);
54383
54396
  c(this, "_handleOpen", (t2) => {
54384
54397
  this._debug("open event");
54385
- let { minUptime: n2 = Me.minUptime } = this._options;
54398
+ let { minUptime: n2 = _e.minUptime } = this._options;
54386
54399
  clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), za(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Yt(t2));
54387
54400
  });
54388
54401
  c(this, "_handleMessage", (t2) => {
@@ -54464,7 +54477,7 @@ var Xt = class r extends ie {
54464
54477
  send(t) {
54465
54478
  if (this._ws?.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
54466
54479
  else {
54467
- let { maxEnqueuedMessages: n = Me.maxEnqueuedMessages } = this._options;
54480
+ let { maxEnqueuedMessages: n = _e.maxEnqueuedMessages } = this._options;
54468
54481
  this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
54469
54482
  }
54470
54483
  }
@@ -54472,7 +54485,7 @@ var Xt = class r extends ie {
54472
54485
  this._options.debug && this._debugLogger("RWS>", ...t);
54473
54486
  }
54474
54487
  _getNextDelay() {
54475
- let { reconnectionDelayGrowFactor: t = Me.reconnectionDelayGrowFactor, minReconnectionDelay: n = Me.minReconnectionDelay, maxReconnectionDelay: i = Me.maxReconnectionDelay } = this._options, o2 = 0;
54488
+ let { reconnectionDelayGrowFactor: t = _e.reconnectionDelayGrowFactor, minReconnectionDelay: n = _e.minReconnectionDelay, maxReconnectionDelay: i = _e.maxReconnectionDelay } = this._options, o2 = 0;
54476
54489
  return this._retryCount > 0 && (o2 = n * Math.pow(t, this._retryCount - 1), o2 > i && (o2 = i)), this._debug("next delay", o2), o2;
54477
54490
  }
54478
54491
  _wait() {
@@ -54483,7 +54496,7 @@ var Xt = class r extends ie {
54483
54496
  _connect() {
54484
54497
  if (this._connectLock || !this._shouldReconnect) return;
54485
54498
  this._connectLock = true;
54486
- let { maxRetries: t = Me.maxRetries, connectionTimeout: n = Me.connectionTimeout } = this._options;
54499
+ let { maxRetries: t = _e.maxRetries, connectionTimeout: n = _e.connectionTimeout } = this._options;
54487
54500
  if (this._retryCount >= t) {
54488
54501
  this._debug("max retries reached", this._retryCount, ">=", t);
54489
54502
  return;
@@ -54542,7 +54555,7 @@ var at = class extends ie {
54542
54555
  this.criteria.delete(t);
54543
54556
  }
54544
54557
  };
54545
- var pn = class {
54558
+ var dn = class {
54546
54559
  constructor(e, t) {
54547
54560
  c(this, "criteria");
54548
54561
  c(this, "emitter");
@@ -54598,7 +54611,7 @@ var Zt = class {
54598
54611
  return;
54599
54612
  }
54600
54613
  if (o2.type === "handshake") {
54601
- let a = Ce(o2.subscription), u2 = { type: "connect", payload: { subscriptionId: a } };
54614
+ let a = Pe(o2.subscription), u2 = { type: "connect", payload: { subscriptionId: a } };
54602
54615
  this.masterSubEmitter?.dispatchEvent(u2);
54603
54616
  let l = this.criteriaEntriesBySubscriptionId.get(a);
54604
54617
  if (!l) {
@@ -54609,7 +54622,7 @@ var Zt = class {
54609
54622
  return;
54610
54623
  }
54611
54624
  this.masterSubEmitter?.dispatchEvent({ type: "message", payload: i });
54612
- let s = this.criteriaEntriesBySubscriptionId.get(Ce(o2.subscription));
54625
+ let s = this.criteriaEntriesBySubscriptionId.get(Pe(o2.subscription));
54613
54626
  if (!s) {
54614
54627
  console.warn("Received notification for criteria the SubscriptionManager is not listening for");
54615
54628
  return;
@@ -54622,7 +54635,7 @@ var Zt = class {
54622
54635
  for (let o2 of this.getAllCriteriaEmitters()) o2.dispatchEvent({ ...i });
54623
54636
  }
54624
54637
  }), e.addEventListener("error", (t) => {
54625
- let n = { type: "error", payload: new f({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "WebSocket connection closed due to an error" }, diagnostics: t.error.toString() }] }) };
54638
+ let n = { type: "error", payload: new f({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "WebSocket connection closed due to an error" }, diagnostics: t.error ? Se(t.error) : t.message }] }) };
54626
54639
  this.masterSubEmitter?.dispatchEvent(n);
54627
54640
  for (let i of this.getAllCriteriaEmitters()) i.dispatchEvent({ ...n });
54628
54641
  }), e.addEventListener("close", () => {
@@ -54698,7 +54711,7 @@ var Zt = class {
54698
54711
  let e = [], t = [];
54699
54712
  for (let n of this.criteriaEntries.values()) for (let i of st(n)) i.refCount === 0 ? t.push(i) : e.push(i);
54700
54713
  for (let n of t) this.removeCriteriaEntry(n);
54701
- for (let n of e) n.token && this.sendUnbind(n.token), n.token = void 0, n.tokenExpiry = void 0, n.state = "idle", n.generation++, await this.subscribeToCriteria(n);
54714
+ for (let n of e) n.token && this.sendUnbind(n.token), n.token = void 0, n.tokenExpiry = void 0, n.subscriptionId = void 0, n.state = "idle", n.generation++, await this.subscribeToCriteria(n);
54702
54715
  }
54703
54716
  async rebindCriteriaEntry(e) {
54704
54717
  let t = e.nextGeneration();
@@ -54714,7 +54727,7 @@ var Zt = class {
54714
54727
  if (this.isStale(e, t)) return;
54715
54728
  e.token = i, e.tokenExpiry = new Date(s).getTime(), this.criteriaEntriesBySubscriptionId.set(e.subscriptionId, e), this.sendBind(i);
54716
54729
  } catch (n) {
54717
- console.error(Ne(n)), e.generation === t && !this.isEntryGettingRemoved(e) && (e.state = e.state === "refreshing" ? "active" : "idle"), this.emitError(e, n);
54730
+ console.error(Se(n)), e.generation === t && !this.isEntryGettingRemoved(e) && (e.state = e.state === "refreshing" ? "active" : "idle"), this.emitError(e, n);
54718
54731
  }
54719
54732
  }
54720
54733
  checkTokenExpirations() {
@@ -54728,7 +54741,7 @@ var Zt = class {
54728
54741
  this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
54729
54742
  let n = this.maybeGetCriteriaEntry(e, t);
54730
54743
  if (n) return n.refCount === 0 && (n.lastUnrefTime = void 0, n.generation++, n.state !== "active" && (n.state = n.token ? "active" : "idle")), n.refCount += 1, n.state === "idle" && this.subscribeToCriteria(n).catch(console.error), n.emitter;
54731
- let i = new pn(e, t);
54744
+ let i = new dn(e, t);
54732
54745
  return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
54733
54746
  }
54734
54747
  removeCriteria(e, t) {
@@ -54779,7 +54792,7 @@ function st(r6) {
54779
54792
  return r6.bareCriteria ? [r6.bareCriteria, ...r6.criteriaWithProps] : r6.criteriaWithProps;
54780
54793
  }
54781
54794
  var Ka = new K(1e3);
54782
- var fn = "5.1.15-088bfde";
54795
+ var pn = "5.1.17-3a68674";
54783
54796
  var Za = k.FHIR_JSON + ", */*; q=0.1";
54784
54797
  var ec = "https://api.medplum.com/";
54785
54798
  var tc = 1e3;
@@ -54833,7 +54846,7 @@ var er = class extends ie {
54833
54846
  c(this, "keyValueClient");
54834
54847
  c(this, "logLevel");
54835
54848
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
54836
- this.options = t ?? {}, this.fetch = t?.fetch ?? cc(), this.storage = t?.storage ?? new ot(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = Xr(t?.baseUrl ?? ec), this.fhirBaseUrl = U(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = U(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = U(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = U(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = U(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = U(this.baseUrl, t?.cdsServicesUrl ?? "cds-services"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? ic, this.logLevel = this.initializeLogLevel(t), this.maxRetries = t?.maxRetries ?? 2, this.maxRetryTime = t?.maxRetryTime ?? 2e3, this.cacheTime = t?.cacheTime ?? (z() ? rc : nc), this.cacheTime > 0 ? this.requestCache = new K(t?.resourceCacheSize ?? tc) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
54849
+ this.options = t ?? {}, this.fetch = t?.fetch ?? cc(), this.storage = t?.storage ?? new ot(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = Yr(t?.baseUrl ?? ec), this.fhirBaseUrl = U(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = U(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = U(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = U(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = U(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = U(this.baseUrl, t?.cdsServicesUrl ?? "cds-services"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? ic, this.logLevel = this.initializeLogLevel(t), this.maxRetries = t?.maxRetries ?? 2, this.maxRetryTime = t?.maxRetryTime ?? 2e3, this.cacheTime = t?.cacheTime ?? (z() ? rc : nc), this.cacheTime > 0 ? this.requestCache = new K(t?.resourceCacheSize ?? tc) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
54837
54850
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
54838
54851
  }).catch((n) => {
54839
54852
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -55076,8 +55089,8 @@ var er = class extends ie {
55076
55089
  target
55077
55090
  }
55078
55091
  }`.replaceAll(/\s+/g, " "), u2 = await this.graphql(a);
55079
- Or(u2.data.StructureDefinitionList);
55080
- for (let l of u2.data.SearchParameterList) en(l);
55092
+ wr(u2.data.StructureDefinitionList);
55093
+ for (let l of u2.data.SearchParameterList) Zr(l);
55081
55094
  })());
55082
55095
  return this.setCacheEntry(i, s, n), s;
55083
55096
  }
@@ -55090,14 +55103,14 @@ var er = class extends ie {
55090
55103
  let a = this.fhirUrl("StructureDefinition", "$expand-profile");
55091
55104
  a.search = new URLSearchParams({ url: t }).toString();
55092
55105
  let u2 = await this.post(a.toString(), {});
55093
- Or(u2);
55106
+ wr(u2);
55094
55107
  } else {
55095
55108
  let a = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
55096
55109
  if (!a) {
55097
55110
  console.warn(`No StructureDefinition found for ${t}!`);
55098
55111
  return;
55099
55112
  }
55100
- Ir(a);
55113
+ Or(a);
55101
55114
  }
55102
55115
  })());
55103
55116
  return this.setCacheEntry(i, s, n), s;
@@ -55174,7 +55187,7 @@ var er = class extends ie {
55174
55187
  }
55175
55188
  createComment(t, n, i) {
55176
55189
  let o2 = this.getProfile(), s, a;
55177
- return t.resourceType === "Encounter" && (s = Re(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = Re(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [Re(t)], encounter: s, subject: a, sender: o2 ? Re(o2) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
55190
+ return t.resourceType === "Encounter" && (s = Ce(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = Ce(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [Ce(t)], encounter: s, subject: a, sender: o2 ? Ce(o2) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
55178
55191
  }
55179
55192
  async updateResource(t, n) {
55180
55193
  if (!t.resourceType) throw new Error("Missing resourceType");
@@ -55217,7 +55230,7 @@ var er = class extends ie {
55217
55230
  }
55218
55231
  pushToAgent(t, n, i, o2, s, a) {
55219
55232
  let { waitTimeout: u2, returnAck: l, ...p2 } = a ?? {};
55220
- return this.post(this.fhirUrl("Agent", Ce(t), "$push"), { destination: typeof n == "string" ? n : O(n), body: i, contentType: o2, waitForResponse: s, ...u2 !== void 0 ? { waitTimeout: u2 } : void 0, ...l !== void 0 ? { returnAck: l } : void 0 }, k.FHIR_JSON, p2);
55233
+ return this.post(this.fhirUrl("Agent", Pe(t), "$push"), { destination: typeof n == "string" ? n : O(n), body: i, contentType: o2, waitForResponse: s, ...u2 !== void 0 ? { waitTimeout: u2 } : void 0, ...l !== void 0 ? { returnAck: l } : void 0 }, k.FHIR_JSON, p2);
55221
55234
  }
55222
55235
  getCdsServices(t) {
55223
55236
  return this.get(this.cdsServicesUrl, t);
@@ -55252,10 +55265,16 @@ var er = class extends ie {
55252
55265
  this.get("auth/me", { cache: "no-cache" }).then((i) => {
55253
55266
  this.profilePromise = void 0;
55254
55267
  let o2 = this.sessionDetails?.profile?.id !== i.profile.id;
55255
- this.sessionDetails = i, o2 && this.dispatchEvent({ type: "change" }), t(i.profile), this.dispatchEvent({ type: "profileRefreshed" });
55268
+ this.sessionDetails = i, this.syncStoredLoginProject(), o2 && this.dispatchEvent({ type: "change" }), t(i.profile), this.dispatchEvent({ type: "profileRefreshed" });
55256
55269
  }).catch(n);
55257
55270
  }), this.dispatchEvent({ type: "profileRefreshing" }), this.profilePromise;
55258
55271
  }
55272
+ syncStoredLoginProject() {
55273
+ let t = this.getActiveLogin(), n = this.sessionDetails?.project?.name;
55274
+ if (!t || !n || t.project.display === n) return;
55275
+ let i = { ...t, project: { ...t.project, display: n } };
55276
+ this.storage.setObject("activeLogin", i), this.addLogin(i);
55277
+ }
55259
55278
  isLoading() {
55260
55279
  return !this.isInitialized || !!this.profilePromise && !this.sessionDetails?.profile;
55261
55280
  }
@@ -55295,7 +55314,7 @@ var er = class extends ie {
55295
55314
  }
55296
55315
  async createMedia(t, n) {
55297
55316
  let { additionalFields: i, ...o2 } = t, s = await this.createResource({ resourceType: "Media", status: "preparation", content: { contentType: t.contentType }, ...i });
55298
- o2.securityContext || (o2.securityContext = Re(s));
55317
+ o2.securityContext || (o2.securityContext = Ce(s));
55299
55318
  let a = await this.createAttachment(o2, n);
55300
55319
  return this.updateResource({ ...s, status: "completed", content: a });
55301
55320
  }
@@ -55304,7 +55323,7 @@ var er = class extends ie {
55304
55323
  }
55305
55324
  async createDocumentReference(t, n) {
55306
55325
  let { additionalFields: i, ...o2 } = t, s = await this.createResource({ resourceType: "DocumentReference", status: "current", content: [{ attachment: { contentType: t.contentType } }], ...i });
55307
- o2.securityContext || (o2.securityContext = Re(s));
55326
+ o2.securityContext || (o2.securityContext = Ce(s));
55308
55327
  let a = await this.createAttachment(o2, n);
55309
55328
  return this.updateResource({ ...s, content: [{ attachment: a }] });
55310
55329
  }
@@ -55388,7 +55407,7 @@ var er = class extends ie {
55388
55407
  if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !pc(s)) return s;
55389
55408
  let a = this.getRetryDelay(o2), u2 = n.maxRetryTime ?? this.maxRetryTime;
55390
55409
  if (a > u2) return s;
55391
- await Yr(a, { signal: n.signal });
55410
+ await Kr(a, { signal: n.signal });
55392
55411
  } catch (s) {
55393
55412
  if (s.message === "Failed to fetch" && o2 === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o2 === i) throw s;
55394
55413
  }
@@ -55429,7 +55448,7 @@ var er = class extends ie {
55429
55448
  if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o2.headers = { ...n.headers }, delete o2.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
55430
55449
  else {
55431
55450
  let s = n.pollStatusPeriod ?? 1e3;
55432
- await Yr(s, { signal: n.signal }), i.pollCount++;
55451
+ await Kr(s, { signal: n.signal }), i.pollCount++;
55433
55452
  }
55434
55453
  return this.request(t, { ...n, method: "GET" }, i);
55435
55454
  }
@@ -55448,7 +55467,7 @@ var er = class extends ie {
55448
55467
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o2) => ({ request: { method: o2.method, url: o2.url }, resource: o2.options.body ? JSON.parse(o2.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
55449
55468
  for (let o2 = 0; o2 < t.length; o2++) {
55450
55469
  let s = t[o2], a = i.entry?.[o2];
55451
- a?.response?.outcome && !Er(a.response.outcome) ? s.reject(new f(a.response.outcome)) : s.resolve(a?.resource);
55470
+ a?.response?.outcome && !br(a.response.outcome) ? s.reject(new f(a.response.outcome)) : s.resolve(a?.resource);
55452
55471
  }
55453
55472
  }
55454
55473
  addFetchOptionsDefaults(t) {
@@ -55479,12 +55498,12 @@ var er = class extends ie {
55479
55498
  }
55480
55499
  handleUnauthenticated(t, n) {
55481
55500
  if (this.refresh()) return this.request(t, n);
55482
- throw this.clear(), this.onUnauthenticated?.(), new f(Le);
55501
+ throw this.clear(), this.onUnauthenticated?.(), new f(Ne);
55483
55502
  }
55484
55503
  async startPkce() {
55485
- let t = on();
55504
+ let t = nn();
55486
55505
  this.storage.setString("pkceState", t);
55487
- let n = on().slice(0, 128);
55506
+ let n = nn().slice(0, 128);
55488
55507
  this.storage.setString("codeVerifier", n);
55489
55508
  try {
55490
55509
  let i = await qi(n);
@@ -55541,20 +55560,20 @@ var er = class extends ie {
55541
55560
  async fhircastSubscribe(t, n) {
55542
55561
  if (!(typeof t == "string" && t !== "")) throw new f(T("Invalid topic provided. Topic must be a valid string."));
55543
55562
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new f(T("Invalid events provided. Events must be an array of event names containing at least one event."));
55544
- let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, un(i), k.FORM_URL_ENCODED))["hub.channel.endpoint"];
55563
+ let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, cn(i), k.FORM_URL_ENCODED))["hub.channel.endpoint"];
55545
55564
  if (!s) throw new Error("Invalid response!");
55546
55565
  return i.endpoint = s, i;
55547
55566
  }
55548
55567
  async fhircastUnsubscribe(t) {
55549
55568
  if (!zt(t)) throw new f(T("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
55550
55569
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new f(T("Provided subscription request must have an endpoint in order to unsubscribe."));
55551
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, un(t), k.FORM_URL_ENCODED);
55570
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, cn(t), k.FORM_URL_ENCODED);
55552
55571
  }
55553
55572
  fhircastConnect(t) {
55554
55573
  return new Qt(t);
55555
55574
  }
55556
55575
  async fhircastPublish(t, n, i, o2) {
55557
- return $i(n) ? this.post(this.fhircastHubUrl, ln(t, n, i, o2), k.JSON) : (Hi(n), this.post(this.fhircastHubUrl, ln(t, n, i), k.JSON));
55576
+ return $i(n) ? this.post(this.fhircastHubUrl, un(t, n, i, o2), k.JSON) : (Hi(n), this.post(this.fhircastHubUrl, un(t, n, i), k.JSON));
55558
55577
  }
55559
55578
  async fhircastGetContext(t) {
55560
55579
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -55589,8 +55608,8 @@ var er = class extends ie {
55589
55608
  let i = Jt(n);
55590
55609
  if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new f(Un);
55591
55610
  if (i.cid) {
55592
- if (i.cid !== this.clientId) throw this.clearActiveLogin(), new f(Sr);
55593
- } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new f(Sr);
55611
+ if (i.cid !== this.clientId) throw this.clearActiveLogin(), new f(Tr);
55612
+ } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new f(Tr);
55594
55613
  }
55595
55614
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
55596
55615
  }
@@ -55924,7 +55943,7 @@ var Po = class r5 {
55924
55943
  log(e, t, n) {
55925
55944
  if (e > this.level) return;
55926
55945
  let i;
55927
- if (br(n)) i = lr(n);
55946
+ if (Sr(n)) i = lr(n);
55928
55947
  else if (n) {
55929
55948
  i = { ...n };
55930
55949
  for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] = lr(s));
@@ -55950,12 +55969,12 @@ function lr(r6, e = 0, t = 10) {
55950
55969
  }
55951
55970
  return n;
55952
55971
  }
55953
- var Pn = `${ft}/fhir/StructureDefinition/patient-preferredPharmacy`;
55972
+ var Cn = `${ft}/fhir/StructureDefinition/patient-preferredPharmacy`;
55954
55973
  var bu = "https://meta.medplum.com/releases";
55955
- var fr = /* @__PURE__ */ new Map();
55974
+ var An = /* @__PURE__ */ new Map();
55956
55975
  function Eu(r6) {
55957
55976
  let e = r6;
55958
- if (!e.tag_name) throw new Error("Manifest missing tag_name");
55977
+ if (!e.tag_name?.startsWith("v")) throw new Error("Manifest missing valid tag_name starting with a 'v' (eg. v5.1.15)");
55959
55978
  let t = e.assets;
55960
55979
  if (!t?.length) throw new Error("Manifest missing assets list");
55961
55980
  for (let n of t) {
@@ -55964,22 +55983,22 @@ function Eu(r6) {
55964
55983
  }
55965
55984
  }
55966
55985
  async function wn(r6, e, t) {
55967
- let n = fr.get(e ?? "latest");
55986
+ let n = e ? An.get(e) : void 0;
55968
55987
  if (!n) {
55969
55988
  let i = e ? `v${e}` : "latest", o2 = new URL(`${bu}/${i}.json`);
55970
- if (o2.searchParams.set("a", r6), o2.searchParams.set("c", fn), t) for (let [u2, l] of Object.entries(t)) o2.searchParams.set(u2, l);
55989
+ if (o2.searchParams.set("a", r6), o2.searchParams.set("c", pn), t) for (let [u2, l] of Object.entries(t)) o2.searchParams.set(u2, l);
55971
55990
  let s = await fetch(o2.toString());
55972
55991
  if (s.status !== 200) {
55973
55992
  let u2;
55974
55993
  try {
55975
55994
  u2 = (await s.json()).message;
55976
55995
  } catch (l) {
55977
- console.error(`Failed to parse message from body: ${Ne(l)}`);
55996
+ console.error(`Failed to parse message from body: ${Se(l)}`);
55978
55997
  }
55979
55998
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${u2}`);
55980
55999
  }
55981
56000
  let a = await s.json();
55982
- Eu(a), n = a, fr.set(e ?? "latest", n), e || fr.set(n.tag_name.slice(1), n);
56001
+ Eu(a), n = a, An.set(n.tag_name.slice(1), n);
55983
56002
  }
55984
56003
  return n;
55985
56004
  }
@@ -56122,7 +56141,7 @@ var v = class extends m2 {
56122
56141
  for (this.responseQueueProcessing = true; this.responseQueue.length; ) {
56123
56142
  if (this.messagesPerMin) {
56124
56143
  let t = B2 / this.messagesPerMin, s = Date.now() - this.lastMessageDispatchedTime;
56125
- t > s && await Yr(t - s);
56144
+ t > s && await Kr(t - s);
56126
56145
  }
56127
56146
  let e = this.responseQueue.shift();
56128
56147
  e && this.dispatchEvent(e), this.lastMessageDispatchedTime = Date.now();
@@ -56334,7 +56353,7 @@ var x = class {
56334
56353
  c2(T2);
56335
56354
  });
56336
56355
  }, h2 = (l) => {
56337
- l?.code === "EADDRINUSE" ? n.close(() => Yr(50).then(() => a(i))) : r6(l);
56356
+ l?.code === "EADDRINUSE" ? n.close(() => Kr(50).then(() => a(i))) : r6(l);
56338
56357
  };
56339
56358
  n.on("error", h2), n.once("listening", () => {
56340
56359
  n.off("error", h2);
@@ -56608,7 +56627,7 @@ var ByteStreamChannelConnection = class {
56608
56627
  }
56609
56628
  } catch (err2) {
56610
56629
  this.channel.log.error(`Byte stream error occurred - check channel logs`);
56611
- this.channel.channelLog.error(`Byte stream error: ${Ne(err2)}`);
56630
+ this.channel.channelLog.error(`Byte stream error: ${Se(err2)}`);
56612
56631
  }
56613
56632
  }
56614
56633
  write(data2) {
@@ -57337,11 +57356,11 @@ function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
57337
57356
  Promise.resolve(value).then(_next, _throw);
57338
57357
  }
57339
57358
  }
57340
- function _asyncToGenerator(fn2) {
57359
+ function _asyncToGenerator(fn) {
57341
57360
  return function() {
57342
57361
  var self2 = this, args = arguments;
57343
57362
  return new Promise(function(resolve2, reject) {
57344
- var gen = fn2.apply(self2, args);
57363
+ var gen = fn.apply(self2, args);
57345
57364
  function _next(value) {
57346
57365
  asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "next", value);
57347
57366
  }
@@ -62424,9 +62443,9 @@ var BufferStream = /* @__PURE__ */ (function() {
62424
62443
  }, {
62425
62444
  key: "readVR",
62426
62445
  value: function readVR() {
62427
- var vr = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
62446
+ var vr2 = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
62428
62447
  this.increment(2);
62429
- return vr;
62448
+ return vr2;
62430
62449
  }
62431
62450
  }, {
62432
62451
  key: "readEncodedString",
@@ -63369,20 +63388,20 @@ var ValueRepresentation = /* @__PURE__ */ (function() {
63369
63388
  }, {
63370
63389
  key: "createByTypeString",
63371
63390
  value: function createByTypeString(type) {
63372
- var vr = VRinstances[type];
63373
- if (vr === void 0) {
63391
+ var vr2 = VRinstances[type];
63392
+ if (vr2 === void 0) {
63374
63393
  if (type == "ox") {
63375
63394
  validationLog.error("Invalid vr type", type, "- using OW");
63376
- vr = VRinstances["OW"];
63395
+ vr2 = VRinstances["OW"];
63377
63396
  } else if (type == "xs") {
63378
63397
  validationLog.error("Invalid vr type", type, "- using US");
63379
- vr = VRinstances["US"];
63398
+ vr2 = VRinstances["US"];
63380
63399
  } else {
63381
63400
  validationLog.error("Invalid vr type", type, "- using UN");
63382
- vr = VRinstances["UN"];
63401
+ vr2 = VRinstances["UN"];
63383
63402
  }
63384
63403
  }
63385
- return vr;
63404
+ return vr2;
63386
63405
  }
63387
63406
  }, {
63388
63407
  key: "parseUnknownVr",
@@ -64468,10 +64487,10 @@ var UnknownValue = /* @__PURE__ */ (function(_BinaryRepresentation) {
64468
64487
  })(BinaryRepresentation);
64469
64488
  var ParsedUnknownValue = /* @__PURE__ */ (function(_BinaryRepresentation2) {
64470
64489
  _inherits(ParsedUnknownValue2, _BinaryRepresentation2);
64471
- function ParsedUnknownValue2(vr) {
64490
+ function ParsedUnknownValue2(vr2) {
64472
64491
  var _this28;
64473
64492
  _classCallCheck(this, ParsedUnknownValue2);
64474
- _this28 = _callSuper(this, ParsedUnknownValue2, [vr]);
64493
+ _this28 = _callSuper(this, ParsedUnknownValue2, [vr2]);
64475
64494
  _this28.maxLength = null;
64476
64495
  _this28.padByte = 0;
64477
64496
  _this28.noMultiple = true;
@@ -64486,13 +64505,13 @@ var ParsedUnknownValue = /* @__PURE__ */ (function(_BinaryRepresentation2) {
64486
64505
  value: function read(stream, length2, syntax, readOptions) {
64487
64506
  var arrayBuffer = this.readBytes(stream, length2, syntax)[0];
64488
64507
  var streamFromBuffer = new ReadBufferStream(arrayBuffer, true);
64489
- var vr = ValueRepresentation.createByTypeString(this.type);
64490
- if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
64508
+ var vr2 = ValueRepresentation.createByTypeString(this.type);
64509
+ if (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
64491
64510
  var values = [];
64492
64511
  var rawValues = [];
64493
- var times = length2 / vr.maxLength, i = 0;
64512
+ var times = length2 / vr2.maxLength, i = 0;
64494
64513
  while (i++ < times) {
64495
- var _vr$read = vr.read(streamFromBuffer, vr.maxLength, syntax, readOptions), rawValue = _vr$read.rawValue, value = _vr$read.value;
64514
+ var _vr$read = vr2.read(streamFromBuffer, vr2.maxLength, syntax, readOptions), rawValue = _vr$read.rawValue, value = _vr$read.value;
64496
64515
  rawValues.push(rawValue);
64497
64516
  values.push(value);
64498
64517
  }
@@ -64501,7 +64520,7 @@ var ParsedUnknownValue = /* @__PURE__ */ (function(_BinaryRepresentation2) {
64501
64520
  value: values
64502
64521
  };
64503
64522
  } else {
64504
- return vr.read(streamFromBuffer, length2, syntax, readOptions);
64523
+ return vr2.read(streamFromBuffer, length2, syntax, readOptions);
64505
64524
  }
64506
64525
  }
64507
64526
  }]);
@@ -64601,12 +64620,12 @@ var DicomDict = /* @__PURE__ */ (function() {
64601
64620
  }
64602
64621
  _createClass(DicomDict2, [{
64603
64622
  key: "upsertTag",
64604
- value: function upsertTag(tag, vr, values) {
64623
+ value: function upsertTag(tag, vr2, values) {
64605
64624
  if (this.dict[tag]) {
64606
64625
  this.dict[tag].Value = values;
64607
64626
  } else {
64608
64627
  this.dict[tag] = ValueRepresentation.addTagAccessors({
64609
- vr
64628
+ vr: vr2
64610
64629
  });
64611
64630
  this.dict[tag].Value = values;
64612
64631
  }
@@ -65221,13 +65240,13 @@ function lookupTagHex(hex8) {
65221
65240
  var end = gi2 + 1 < groupStart.length ? groupStart[gi2 + 1] : elems.length;
65222
65241
  var ei2 = _binSearchU16(elems, start, end, elem);
65223
65242
  if (ei2 < 0) return void 0;
65224
- var vr = vrTable$1[vrCode[ei2]];
65243
+ var vr2 = vrTable$1[vrCode[ei2]];
65225
65244
  var vm = vmTable$1[vmCode[ei2]];
65226
65245
  var off = nameOff[ei2];
65227
65246
  var len2 = nameLen[ei2];
65228
65247
  var name = nameBlob$1.slice(off, off + len2);
65229
65248
  return {
65230
- vr,
65249
+ vr: vr2,
65231
65250
  vm,
65232
65251
  name
65233
65252
  };
@@ -65264,14 +65283,14 @@ function getAllStandardTagEntries() {
65264
65283
  var elem = elems[ei2];
65265
65284
  var eHex = _pad4(elem.toString(16).toUpperCase());
65266
65285
  var tag = "(" + gHex + "," + eHex + ")";
65267
- var vr = vrTable$1[vrCode[ei2]];
65286
+ var vr2 = vrTable$1[vrCode[ei2]];
65268
65287
  var vm = vmTable$1[vmCode[ei2]];
65269
65288
  var off = nameOff[ei2];
65270
65289
  var len2 = nameLen[ei2];
65271
65290
  var name = nameBlob$1.slice(off, off + len2);
65272
65291
  out.push({
65273
65292
  tag,
65274
- vr,
65293
+ vr: vr2,
65275
65294
  vm,
65276
65295
  name
65277
65296
  });
@@ -65595,9 +65614,9 @@ var DicomMetaDictionary = /* @__PURE__ */ (function() {
65595
65614
  if (dataValue === void 0) {
65596
65615
  return;
65597
65616
  }
65598
- var vr = dataset._vrMap && dataset._vrMap[naturalName] ? dataset._vrMap[naturalName] : entry.vr;
65617
+ var vr2 = dataset._vrMap && dataset._vrMap[naturalName] ? dataset._vrMap[naturalName] : entry.vr;
65599
65618
  var dataItem = ValueRepresentation.addTagAccessors({
65600
- vr
65619
+ vr: vr2
65601
65620
  });
65602
65621
  dataItem.Value = dataset[naturalName];
65603
65622
  if (dataValue !== null) {
@@ -65851,7 +65870,7 @@ var Tag = /* @__PURE__ */ (function() {
65851
65870
  }, {
65852
65871
  key: "write",
65853
65872
  value: function write(stream, vrType, values, syntax, writeOptions) {
65854
- var vr = ValueRepresentation.createByTypeString(vrType);
65873
+ var vr2 = ValueRepresentation.createByTypeString(vrType);
65855
65874
  var useSyntax = DicomMessage$1._normalizeSyntax(syntax);
65856
65875
  var implicit = useSyntax === IMPLICIT_LITTLE_ENDIAN;
65857
65876
  var isLittleEndian = useSyntax === IMPLICIT_LITTLE_ENDIAN || useSyntax === EXPLICIT_LITTLE_ENDIAN$1;
@@ -65863,11 +65882,11 @@ var Tag = /* @__PURE__ */ (function() {
65863
65882
  var tagStream = new WriteBufferStream(256), valueLength;
65864
65883
  tagStream.setEndian(isLittleEndian);
65865
65884
  if (vrType == "OW" || vrType == "OB" || vrType == "UN") {
65866
- valueLength = vr.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
65885
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
65867
65886
  } else if (vrType == "SQ") {
65868
- valueLength = vr.writeBytes(tagStream, values, useSyntax, writeOptions);
65887
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, writeOptions);
65869
65888
  } else {
65870
- valueLength = vr.writeBytes(tagStream, values, writeOptions);
65889
+ valueLength = vr2.writeBytes(tagStream, values, writeOptions);
65871
65890
  }
65872
65891
  if (vrType == "SQ") {
65873
65892
  valueLength = UNDEFINED_LENGTH;
@@ -65877,14 +65896,14 @@ var Tag = /* @__PURE__ */ (function() {
65877
65896
  stream.writeUint32(valueLength);
65878
65897
  written += 4;
65879
65898
  } else {
65880
- var isBig16Length = !vr.isLength32() && valueLength >= 65536 && valueLength !== UNDEFINED_LENGTH;
65881
- if (vr.isLength32() || isBig16Length) {
65882
- stream.writeAsciiString(isBig16Length ? "UN" : vr.type);
65899
+ var isBig16Length = !vr2.isLength32() && valueLength >= 65536 && valueLength !== UNDEFINED_LENGTH;
65900
+ if (vr2.isLength32() || isBig16Length) {
65901
+ stream.writeAsciiString(isBig16Length ? "UN" : vr2.type);
65883
65902
  stream.writeUint16(0);
65884
65903
  stream.writeUint32(valueLength);
65885
65904
  written += 8;
65886
65905
  } else {
65887
- stream.writeAsciiString(vr.type);
65906
+ stream.writeAsciiString(vr2.type);
65888
65907
  stream.writeUint16(valueLength);
65889
65908
  written += 4;
65890
65909
  }
@@ -66119,9 +66138,9 @@ var DicomMessage = /* @__PURE__ */ (function() {
66119
66138
  }
66120
66139
  }, {
66121
66140
  key: "writeTagObject",
66122
- value: function writeTagObject(stream, tagString, vr, values, syntax, writeOptions) {
66141
+ value: function writeTagObject(stream, tagString, vr2, values, syntax, writeOptions) {
66123
66142
  var tag = Tag.fromString(tagString);
66124
- tag.write(stream, vr, values, syntax, writeOptions);
66143
+ tag.write(stream, vr2, values, syntax, writeOptions);
66125
66144
  }
66126
66145
  }, {
66127
66146
  key: "write",
@@ -66141,14 +66160,14 @@ var DicomMessage = /* @__PURE__ */ (function() {
66141
66160
  if (!tagObject._rawValue) {
66142
66161
  return tagObject.Value;
66143
66162
  }
66144
- var vr = ValueRepresentation.createByTypeString(vrType);
66163
+ var vr2 = ValueRepresentation.createByTypeString(vrType);
66145
66164
  var originalValue;
66146
66165
  if (Array.isArray(tagObject._rawValue)) {
66147
66166
  originalValue = tagObject._rawValue.map(function(val) {
66148
- return vr.applyFormatting(val);
66167
+ return vr2.applyFormatting(val);
66149
66168
  });
66150
66169
  } else {
66151
- originalValue = vr.applyFormatting(tagObject._rawValue);
66170
+ originalValue = vr2.applyFormatting(tagObject._rawValue);
66152
66171
  }
66153
66172
  if (deepEqual(tagObject.Value, originalValue)) {
66154
66173
  return tagObject._rawValue;
@@ -66177,7 +66196,7 @@ var DicomMessage = /* @__PURE__ */ (function() {
66177
66196
  };
66178
66197
  }
66179
66198
  }
66180
- var length2 = null, vr = null, vrType;
66199
+ var length2 = null, vr2 = null, vrType;
66181
66200
  if (implicit) {
66182
66201
  length2 = stream.readUint32();
66183
66202
  var elementData = DicomMessage2.lookupTag(tag);
@@ -66196,16 +66215,16 @@ var DicomMessage = /* @__PURE__ */ (function() {
66196
66215
  vrType = "UN";
66197
66216
  }
66198
66217
  }
66199
- vr = ValueRepresentation.createByTypeString(vrType);
66218
+ vr2 = ValueRepresentation.createByTypeString(vrType);
66200
66219
  } else {
66201
66220
  vrType = stream.readVR();
66202
66221
  if (vrType === "UN" && DicomMessage2.lookupTag(tag) && DicomMessage2.lookupTag(tag).vr) {
66203
66222
  vrType = DicomMessage2.lookupTag(tag).vr;
66204
- vr = ValueRepresentation.parseUnknownVr(vrType);
66223
+ vr2 = ValueRepresentation.parseUnknownVr(vrType);
66205
66224
  } else {
66206
- vr = ValueRepresentation.createByTypeString(vrType);
66225
+ vr2 = ValueRepresentation.createByTypeString(vrType);
66207
66226
  }
66208
- if (vr.isLength32()) {
66227
+ if (vr2.isLength32()) {
66209
66228
  stream.increment(2);
66210
66229
  length2 = stream.readUint32();
66211
66230
  } else {
@@ -66214,27 +66233,27 @@ var DicomMessage = /* @__PURE__ */ (function() {
66214
66233
  }
66215
66234
  var values = [];
66216
66235
  var rawValues = [];
66217
- if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
66218
- var times = length2 / vr.maxLength, i = 0;
66236
+ if (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
66237
+ var times = length2 / vr2.maxLength, i = 0;
66219
66238
  while (i++ < times) {
66220
- var _vr$read = vr.read(stream, vr.maxLength, syntax, options), rawValue = _vr$read.rawValue, value = _vr$read.value;
66239
+ var _vr$read = vr2.read(stream, vr2.maxLength, syntax, options), rawValue = _vr$read.rawValue, value = _vr$read.value;
66221
66240
  rawValues.push(rawValue);
66222
66241
  values.push(value);
66223
66242
  }
66224
66243
  } else {
66225
- var _ref = vr.read(stream, length2, syntax, options) || {}, _rawValue = _ref.rawValue, _value = _ref.value;
66226
- if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {
66244
+ var _ref = vr2.read(stream, length2, syntax, options) || {}, _rawValue = _ref.rawValue, _value = _ref.value;
66245
+ if (!vr2.isBinary() && singleVRs.indexOf(vr2.type) == -1) {
66227
66246
  rawValues = _rawValue;
66228
66247
  values = _value;
66229
66248
  if (typeof _value === "string") {
66230
66249
  var delimiterChar = String.fromCharCode(VM_DELIMITER);
66231
- rawValues = vr.dropPadByte(_rawValue.split(delimiterChar));
66232
- values = vr.dropPadByte(_value.split(delimiterChar));
66250
+ rawValues = vr2.dropPadByte(_rawValue.split(delimiterChar));
66251
+ values = vr2.dropPadByte(_value.split(delimiterChar));
66233
66252
  }
66234
- } else if (vr.type == "SQ") {
66253
+ } else if (vr2.type == "SQ") {
66235
66254
  rawValues = _rawValue;
66236
66255
  values = _value;
66237
- } else if (vr.type == "OW" || vr.type == "OB") {
66256
+ } else if (vr2.type == "OW" || vr2.type == "OB") {
66238
66257
  rawValues = _rawValue;
66239
66258
  values = _value;
66240
66259
  } else {
@@ -66245,7 +66264,7 @@ var DicomMessage = /* @__PURE__ */ (function() {
66245
66264
  stream.setEndian(oldEndian);
66246
66265
  var retObj = ValueRepresentation.addTagAccessors({
66247
66266
  tag,
66248
- vr
66267
+ vr: vr2
66249
66268
  });
66250
66269
  retObj.values = values;
66251
66270
  retObj.rawValues = rawValues;
@@ -66316,13 +66335,13 @@ function lookupPrivateTag(keyStr) {
66316
66335
  if (keyStr < candidate) hi2 = mid - 1;
66317
66336
  else if (keyStr > candidate) lo = mid + 1;
66318
66337
  else {
66319
- var vr = vrTable[vrCode[mid]];
66338
+ var vr2 = vrTable[vrCode[mid]];
66320
66339
  var vm = vmTable[vmCode[mid]];
66321
66340
  var off = nameOff[mid];
66322
66341
  var nlen = nameLen[mid];
66323
66342
  var name = nameBlob.slice(off, off + nlen);
66324
66343
  return {
66325
- vr,
66344
+ vr: vr2,
66326
66345
  vm,
66327
66346
  name
66328
66347
  };
@@ -66550,8 +66569,8 @@ var DicomMetadataListener = /* @__PURE__ */ (function() {
66550
66569
  *
66551
66570
  * @param {(() => Promise<void>) | null} fn - Function that returns a Promise, or null to clear
66552
66571
  */
66553
- function setDrain(fn2) {
66554
- this._drain = typeof fn2 === "function" ? fn2 : null;
66572
+ function setDrain(fn) {
66573
+ this._drain = typeof fn === "function" ? fn : null;
66555
66574
  }
66556
66575
  )
66557
66576
  /**
@@ -67544,8 +67563,8 @@ var AsyncDicomReader = /* @__PURE__ */ (function() {
67544
67563
  }, {
67545
67564
  key: "isSequence",
67546
67565
  value: function isSequence(tagInfo) {
67547
- var vr = tagInfo.vr, length2 = tagInfo.length;
67548
- return vr === "SQ" || vr === "UN" && length2 === UNDEFINED_LENGTH_FIX;
67566
+ var vr2 = tagInfo.vr, length2 = tagInfo.length;
67567
+ return vr2 === "SQ" || vr2 === "UN" && length2 === UNDEFINED_LENGTH_FIX;
67549
67568
  }
67550
67569
  /**
67551
67570
  * Reads a tag header.
@@ -67576,12 +67595,12 @@ var AsyncDicomReader = /* @__PURE__ */ (function() {
67576
67595
  }
67577
67596
  }
67578
67597
  var length2 = null;
67579
- var vr = null;
67598
+ var vr2 = null;
67580
67599
  var vrType;
67581
67600
  var isCommand = tagObj.group() === 0;
67582
67601
  if (tagObj.isInstruction()) {
67583
67602
  length2 = stream.readUint32();
67584
- vr = ValueRepresentation.createByTypeString("UN");
67603
+ vr2 = ValueRepresentation.createByTypeString("UN");
67585
67604
  } else if (implicit && !isCommand) {
67586
67605
  length2 = stream.readUint32();
67587
67606
  var elementData = DicomMessage.lookupTag(tagObj);
@@ -67602,17 +67621,17 @@ var AsyncDicomReader = /* @__PURE__ */ (function() {
67602
67621
  vrType = "UN";
67603
67622
  }
67604
67623
  }
67605
- vr = ValueRepresentation.createByTypeString(vrType);
67624
+ vr2 = ValueRepresentation.createByTypeString(vrType);
67606
67625
  } else {
67607
67626
  var _DicomMessage$lookupT;
67608
67627
  vrType = stream.readVR();
67609
67628
  if (vrType === "UN" && (_DicomMessage$lookupT = DicomMessage.lookupTag(tagObj)) !== null && _DicomMessage$lookupT !== void 0 && _DicomMessage$lookupT.vr) {
67610
67629
  vrType = DicomMessage.lookupTag(tagObj).vr;
67611
- vr = ValueRepresentation.parseUnknownVr(vrType);
67630
+ vr2 = ValueRepresentation.parseUnknownVr(vrType);
67612
67631
  } else {
67613
- vr = ValueRepresentation.createByTypeString(vrType);
67632
+ vr2 = ValueRepresentation.createByTypeString(vrType);
67614
67633
  }
67615
- if (vr.isLength32()) {
67634
+ if (vr2.isLength32()) {
67616
67635
  stream.increment(2);
67617
67636
  length2 = stream.readUint32();
67618
67637
  } else {
@@ -67622,8 +67641,8 @@ var AsyncDicomReader = /* @__PURE__ */ (function() {
67622
67641
  var punctuatedTag = DicomMetaDictionary.punctuateTag(tag);
67623
67642
  var entry = DicomMetaDictionary.dictionary[punctuatedTag];
67624
67643
  var header = {
67625
- vrObj: vr,
67626
- vr: vr.type,
67644
+ vrObj: vr2,
67645
+ vr: vr2.type,
67627
67646
  tag,
67628
67647
  tagObj,
67629
67648
  vm: entry === null || entry === void 0 ? void 0 : entry.vm,
@@ -67642,7 +67661,7 @@ var AsyncDicomReader = /* @__PURE__ */ (function() {
67642
67661
  key: "readSingle",
67643
67662
  value: (function() {
67644
67663
  var _readSingle = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee11(tagInfo, listener, options) {
67645
- var length2, stream, syntax, vr, values, times, i, _vr$read, value, _vr$read2, _value, delimiterChar, _values, _values2, coding;
67664
+ var length2, stream, syntax, vr2, values, times, i, _vr$read, value, _vr$read2, _value, delimiterChar, _values, _values2, coding;
67646
67665
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
67647
67666
  while (1) switch (_context11.prev = _context11.next) {
67648
67667
  case 0:
@@ -67651,25 +67670,25 @@ var AsyncDicomReader = /* @__PURE__ */ (function() {
67651
67670
  _context11.next = 4;
67652
67671
  return this.stream.ensureAvailable(length2);
67653
67672
  case 4:
67654
- vr = ValueRepresentation.createByTypeString(tagInfo.vr);
67673
+ vr2 = ValueRepresentation.createByTypeString(tagInfo.vr);
67655
67674
  values = [];
67656
- if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
67657
- times = length2 / vr.maxLength;
67675
+ if (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
67676
+ times = length2 / vr2.maxLength;
67658
67677
  i = 0;
67659
67678
  while (i++ < times) {
67660
67679
  readLog.trace("readSingle multi-value loop", i, times);
67661
- _vr$read = vr.read(stream, vr.maxLength, syntax), value = _vr$read.value;
67680
+ _vr$read = vr2.read(stream, vr2.maxLength, syntax), value = _vr$read.value;
67662
67681
  values.push(value);
67663
67682
  }
67664
67683
  } else {
67665
- _value = (_vr$read2 = vr.read(stream, length2, syntax)) === null || _vr$read2 === void 0 ? void 0 : _vr$read2.value;
67666
- if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {
67684
+ _value = (_vr$read2 = vr2.read(stream, length2, syntax)) === null || _vr$read2 === void 0 ? void 0 : _vr$read2.value;
67685
+ if (!vr2.isBinary() && singleVRs.indexOf(vr2.type) == -1) {
67667
67686
  values = _value;
67668
67687
  if (typeof _value === "string") {
67669
67688
  delimiterChar = String.fromCharCode(VM_DELIMITER);
67670
- values = vr.dropPadByte(_value.split(delimiterChar));
67689
+ values = vr2.dropPadByte(_value.split(delimiterChar));
67671
67690
  }
67672
- } else if (vr.type == "OW" || vr.type == "OB") {
67691
+ } else if (vr2.type == "OW" || vr2.type == "OB") {
67673
67692
  values = _value;
67674
67693
  } else {
67675
67694
  Array.isArray(_value) ? values = _value : values.push(_value);
@@ -72225,7 +72244,7 @@ var len = length;
72225
72244
  var sqrLen = squaredLength;
72226
72245
  var forEach = (function() {
72227
72246
  var vec = create();
72228
- return function(a, stride, offset, count, fn2, arg) {
72247
+ return function(a, stride, offset, count, fn, arg) {
72229
72248
  var i, l;
72230
72249
  if (!stride) {
72231
72250
  stride = 3;
@@ -72242,7 +72261,7 @@ var forEach = (function() {
72242
72261
  vec[0] = a[i];
72243
72262
  vec[1] = a[i + 1];
72244
72263
  vec[2] = a[i + 2];
72245
- fn2(vec, vec, arg);
72264
+ fn(vec, vec, arg);
72246
72265
  a[i] = vec[0];
72247
72266
  a[i + 1] = vec[1];
72248
72267
  a[i + 2] = vec[2];
@@ -73306,7 +73325,7 @@ var AgentDicomChannel = class extends BaseChannel {
73306
73325
  calledAeTitle: this.association?.getCalledAeTitle()
73307
73326
  },
73308
73327
  dataset: dicomJson2,
73309
- binary: binary ? Re(binary) : void 0
73328
+ binary: binary ? Ce(binary) : void 0
73310
73329
  };
73311
73330
  App.instance.addToWebSocketQueue({
73312
73331
  type: "agent:transmit:request",
@@ -73320,7 +73339,7 @@ var AgentDicomChannel = class extends BaseChannel {
73320
73339
  response2.setStatus(dimse.constants.Status.Success);
73321
73340
  } catch (err2) {
73322
73341
  _DcmjsDimseScp.channel.log.error(`DICOM error - check channel logs`);
73323
- _DcmjsDimseScp.channel.channelLog.error(`DICOM error: ${Ne(err2)}`);
73342
+ _DcmjsDimseScp.channel.channelLog.error(`DICOM error: ${Se(err2)}`);
73324
73343
  response2.setStatus(dimse.constants.Status.ProcessingFailure);
73325
73344
  }
73326
73345
  return response2;
@@ -73367,7 +73386,7 @@ var AgentDicomChannel = class extends BaseChannel {
73367
73386
  this.server.on("networkError", async (err2) => {
73368
73387
  this.log.error("Network error: ", { err: err2 });
73369
73388
  if (err2?.code === "EADDRINUSE") {
73370
- await Yr(50);
73389
+ await Kr(50);
73371
73390
  this.server.close();
73372
73391
  this.server.listen(port);
73373
73392
  }
@@ -73644,6 +73663,9 @@ var AgentHl7Channel = class extends BaseChannel {
73644
73663
  this.channelLog.debug(
73645
73664
  `[Skipping ACK -- Mode: ${this.appLevelAckMode} -- ID: ${msgControlId ?? "not provided"} -- ACK: ${ackCode ?? "unknown"}]`
73646
73665
  );
73666
+ if (msgControlId) {
73667
+ this.stats.recordAckReceived(msgControlId);
73668
+ }
73647
73669
  return;
73648
73670
  }
73649
73671
  this.channelLog.info(`[Sending ACK -- ID: ${msgControlId}]: ${hl7Message.toString().replaceAll("\r", "\n")}`);
@@ -73760,12 +73782,12 @@ var AgentHl7ChannelConnection = class {
73760
73782
  }
73761
73783
  } catch (err2) {
73762
73784
  this.channel.log.error(`HL7 error occurred - check channel logs`);
73763
- this.channel.channelLog.error(`HL7 error: ${Ne(err2)}`);
73785
+ this.channel.channelLog.error(`HL7 error: ${Se(err2)}`);
73764
73786
  }
73765
73787
  }
73766
73788
  async handleError(event) {
73767
- this.channel.log.error(`HL7 connection error: ${Ne(event.error)}`);
73768
- this.channel.channelLog.error(`HL7 connection error: ${Ne(event.error)}`);
73789
+ this.channel.log.error(`HL7 connection error: ${Se(event.error)}`);
73790
+ this.channel.channelLog.error(`HL7 connection error: ${Se(event.error)}`);
73769
73791
  }
73770
73792
  handleEnhancedAckSent(event) {
73771
73793
  const hl7Message = event.message;
@@ -74160,13 +74182,13 @@ var Hl7ClientPool = class {
74160
74182
  this.closeAndRemoveClient(client);
74161
74183
  if (this.keepAlive) {
74162
74184
  this.log.error(
74163
- `Persistent connection to remote 'mllp://${this.host}:${this.port}' encountered error: '${Ne(event.error)}' - Closing connection...`
74185
+ `Persistent connection to remote 'mllp://${this.host}:${this.port}' encountered error: '${Se(event.error)}' - Closing connection...`
74164
74186
  );
74165
74187
  }
74166
74188
  });
74167
74189
  client.addEventListener("warning", (event) => {
74168
74190
  this.log.warn(
74169
- `Connection to remote 'mllp://${this.host}:${this.port}' warning: '${Ne(event.error)}'`
74191
+ `Connection to remote 'mllp://${this.host}:${this.port}' warning: '${Se(event.error)}'`
74170
74192
  );
74171
74193
  });
74172
74194
  return client;
@@ -74275,7 +74297,7 @@ function parseLoggerConfigFromArgs(args) {
74275
74297
  try {
74276
74298
  configValue = Jh(propVal);
74277
74299
  } catch (err2) {
74278
- warnings.push(`Error while parsing ${propName}: ${Ne(err2)}`);
74300
+ warnings.push(`Error while parsing ${propName}: ${Se(err2)}`);
74279
74301
  }
74280
74302
  } else if (LOGGER_CONFIG_INTEGER_KEYS.includes(settingName)) {
74281
74303
  try {
@@ -74565,7 +74587,7 @@ async function waitForPidFile(appName, timeoutMs = 3e3) {
74565
74587
  if (Date.now() - startTime > timeoutMs) {
74566
74588
  throw new Error("Timeout while waiting for PID file");
74567
74589
  }
74568
- await Yr(0);
74590
+ await Kr(0);
74569
74591
  }
74570
74592
  }
74571
74593
  function removeAllPidFiles() {
@@ -74610,7 +74632,9 @@ async function downloadRelease(version, path4) {
74610
74632
  try {
74611
74633
  await (0, import_promises.pipeline)(readable, (0, import_node_fs3.createWriteStream)(path4));
74612
74634
  } catch (err2) {
74613
- (0, import_node_fs3.unlinkSync)(path4);
74635
+ if ((0, import_node_fs3.existsSync)(path4)) {
74636
+ (0, import_node_fs3.unlinkSync)(path4);
74637
+ }
74614
74638
  throw new Error(`Error while downloading release version ${version} to ${path4}`, { cause: err2 });
74615
74639
  }
74616
74640
  }
@@ -74708,7 +74732,7 @@ var _App = class _App {
74708
74732
  this.medplum.addEventListener("change", () => {
74709
74733
  if (!this.webSocket) {
74710
74734
  this.connectWebSocket().catch((err2) => {
74711
- this.log.error(Ne(err2));
74735
+ this.log.error(Se(err2));
74712
74736
  });
74713
74737
  } else {
74714
74738
  this.startWebSocketWorker();
@@ -74739,7 +74763,7 @@ var _App = class _App {
74739
74763
  if (!upgradeDetails) {
74740
74764
  return;
74741
74765
  }
74742
- if (fn.startsWith(upgradeDetails.targetVersion)) {
74766
+ if (pn.startsWith(upgradeDetails.targetVersion)) {
74743
74767
  await this.sendToWebSocket({
74744
74768
  type: "agent:upgrade:response",
74745
74769
  statusCode: 200,
@@ -74747,7 +74771,7 @@ var _App = class _App {
74747
74771
  });
74748
74772
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
74749
74773
  } else {
74750
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${fn}`;
74774
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${pn}`;
74751
74775
  await this.sendToWebSocket({
74752
74776
  type: "agent:error",
74753
74777
  body: errMsg,
@@ -74774,7 +74798,7 @@ var _App = class _App {
74774
74798
  if (attempt === maxAttempts) {
74775
74799
  throw new Error("Too many unsuccessful attempts to create agent PID file");
74776
74800
  }
74777
- await Yr(50);
74801
+ await Kr(50);
74778
74802
  }
74779
74803
  }
74780
74804
  }
@@ -74787,7 +74811,7 @@ var _App = class _App {
74787
74811
  if (!this.webSocket) {
74788
74812
  this.log.warn("WebSocket not connected");
74789
74813
  this.connectWebSocket().catch((err2) => {
74790
- this.log.error(Ne(err2));
74814
+ this.log.error(Se(err2));
74791
74815
  });
74792
74816
  return;
74793
74817
  }
@@ -74847,7 +74871,7 @@ var _App = class _App {
74847
74871
  break;
74848
74872
  case "agent:heartbeat:request":
74849
74873
  this.outstandingHeartbeats = 0;
74850
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: fn });
74874
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: pn });
74851
74875
  break;
74852
74876
  case "agent:heartbeat:response":
74853
74877
  this.outstandingHeartbeats = 0;
@@ -74899,7 +74923,7 @@ var _App = class _App {
74899
74923
  } catch (err2) {
74900
74924
  await this.sendToWebSocket({
74901
74925
  type: "agent:error",
74902
- body: Ne(err2),
74926
+ body: Se(err2),
74903
74927
  callback: command.callback
74904
74928
  });
74905
74929
  }
@@ -74927,7 +74951,7 @@ var _App = class _App {
74927
74951
  }
74928
74952
  }
74929
74953
  } catch (err2) {
74930
- const errMsg = `WebSocket error on incoming message: ${Ne(err2)}`;
74954
+ const errMsg = `WebSocket error on incoming message: ${Se(err2)}`;
74931
74955
  this.log.error(errMsg);
74932
74956
  try {
74933
74957
  await this.sendToWebSocket({
@@ -74936,7 +74960,7 @@ var _App = class _App {
74936
74960
  callback: command?.callback
74937
74961
  });
74938
74962
  } catch (sendErr) {
74939
- this.log.error(`Failed to send agent:error response: ${Ne(sendErr)}`);
74963
+ this.log.error(`Failed to send agent:error response: ${Se(sendErr)}`);
74940
74964
  }
74941
74965
  }
74942
74966
  });
@@ -74972,7 +74996,7 @@ var _App = class _App {
74972
74996
  const results = await Promise.allSettled(Array.from(this.hl7Clients.values()).map((pool) => pool.closeAll()));
74973
74997
  for (const result of results) {
74974
74998
  if (result.status === "rejected") {
74975
- this.log.error(Ne(result.reason));
74999
+ this.log.error(Se(result.reason));
74976
75000
  }
74977
75001
  }
74978
75002
  this.hl7Clients.clear();
@@ -75098,7 +75122,7 @@ var _App = class _App {
75098
75122
  }
75099
75123
  } catch (err2) {
75100
75124
  errors.push(err2);
75101
- this.log.error(Ne(err2));
75125
+ this.log.error(Se(err2));
75102
75126
  }
75103
75127
  }
75104
75128
  if (errors.length) {
@@ -75116,7 +75140,7 @@ var _App = class _App {
75116
75140
  (err2) => ({
75117
75141
  severity: "error",
75118
75142
  code: "invalid",
75119
- details: { text: Ne(err2) }
75143
+ details: { text: Se(err2) }
75120
75144
  })
75121
75145
  )
75122
75146
  ]
@@ -75137,7 +75161,7 @@ var _App = class _App {
75137
75161
  return;
75138
75162
  }
75139
75163
  for (const err2 of errors) {
75140
- this.log.error(Ne(err2));
75164
+ this.log.error(Se(err2));
75141
75165
  }
75142
75166
  throw new f({
75143
75167
  resourceType: "OperationOutcome",
@@ -75153,7 +75177,7 @@ var _App = class _App {
75153
75177
  (err2) => ({
75154
75178
  severity: "error",
75155
75179
  code: "invalid",
75156
- details: { text: Ne(err2) }
75180
+ details: { text: Se(err2) }
75157
75181
  })
75158
75182
  )
75159
75183
  ]
@@ -75181,7 +75205,7 @@ var _App = class _App {
75181
75205
  parsedEndpoint = new URL(endpoint.address);
75182
75206
  } catch (err2) {
75183
75207
  throw new Error(
75184
- `Error while validating endpoint address for channel '${channel.name}': ${Ne(err2)}`
75208
+ `Error while validating endpoint address for channel '${channel.name}': ${Se(err2)}`
75185
75209
  );
75186
75210
  }
75187
75211
  if (seenPorts.has(parsedEndpoint.port)) {
@@ -75222,7 +75246,7 @@ var _App = class _App {
75222
75246
  const channelType = getChannelType(endpoint);
75223
75247
  return this.createChannel(channelType, definition, endpoint);
75224
75248
  } catch (err2) {
75225
- this.log.error(Ne(err2));
75249
+ this.log.error(Se(err2));
75226
75250
  return void 0;
75227
75251
  }
75228
75252
  }
@@ -75295,7 +75319,7 @@ var _App = class _App {
75295
75319
  try {
75296
75320
  await this.sendToWebSocket(msg);
75297
75321
  } catch (err2) {
75298
- this.log.error(`WebSocket error while attempting to send message: ${Ne(err2)}`);
75322
+ this.log.error(`WebSocket error while attempting to send message: ${Se(err2)}`);
75299
75323
  this.webSocketQueue.unshift(msg);
75300
75324
  throw err2;
75301
75325
  }
@@ -75371,7 +75395,7 @@ ${result}`);
75371
75395
  body: result
75372
75396
  });
75373
75397
  } catch (err2) {
75374
- this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ne(err2)}`);
75398
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Se(err2)}`);
75375
75399
  this.addToWebSocketQueue({
75376
75400
  type: "agent:transmit:response",
75377
75401
  channel: message.channel,
@@ -75379,12 +75403,12 @@ ${result}`);
75379
75403
  remote: message.remote,
75380
75404
  callback: message.callback,
75381
75405
  statusCode: 400,
75382
- body: Ne(err2)
75406
+ body: Se(err2)
75383
75407
  });
75384
75408
  }
75385
75409
  }
75386
75410
  async tryUpgradeAgent(message) {
75387
- this.log.info(`Attempting to upgrade from ${fn} to ${message.version ?? "latest"}...`);
75411
+ this.log.info(`Attempting to upgrade from ${pn} to ${message.version ?? "latest"}...`);
75388
75412
  if ((0, import_node_os4.platform)() !== "win32") {
75389
75413
  const errMsg = "Auto-upgrading is currently only supported on Windows";
75390
75414
  this.log.error(errMsg);
@@ -75419,7 +75443,7 @@ ${result}`);
75419
75443
  return;
75420
75444
  }
75421
75445
  const targetVersion = message.version ?? await Qg("agent-upgrader");
75422
- if (fn.startsWith(targetVersion)) {
75446
+ if (pn.startsWith(targetVersion)) {
75423
75447
  if (!message?.force) {
75424
75448
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
75425
75449
  await this.sendToWebSocket({
@@ -75429,7 +75453,7 @@ ${result}`);
75429
75453
  });
75430
75454
  return;
75431
75455
  }
75432
- this.log.info(`Forcing upgrade from ${fn} to ${targetVersion}`);
75456
+ this.log.info(`Forcing upgrade from ${pn} to ${targetVersion}`);
75433
75457
  }
75434
75458
  if (semver.lt(targetVersion, "4.2.4") && !message.force) {
75435
75459
  const errMsg = `WARNING: ${targetVersion} predates the zero-downtime upgrade feature. Downgrading to this version will 1) incur downtime during the downgrade process, as the current agent must stop itself before installing the older agent, and 2) incur downtime on any subsequent upgrade to a later version. We recommend against downgrading to this version, but if you must, reissue the command with force set to true to downgrade.`;
@@ -75449,14 +75473,16 @@ ${result}`);
75449
75473
  forceKillApp("medplum-agent-upgrader");
75450
75474
  removePidFile("medplum-agent-upgrader");
75451
75475
  }
75452
- (0, import_node_fs4.unlinkSync)(UPGRADE_MANIFEST_PATH);
75476
+ if ((0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH)) {
75477
+ (0, import_node_fs4.unlinkSync)(UPGRADE_MANIFEST_PATH);
75478
+ }
75453
75479
  }
75454
75480
  try {
75455
75481
  const release = await wn("agent-upgrader", targetVersion);
75456
75482
  parseDownloadUrl(release, (0, import_node_os4.platform)());
75457
75483
  } catch (err2) {
75458
75484
  const versionTag = message.version ? `v${message.version}` : "latest";
75459
- const errMsg = `Error during upgrading to version '${versionTag}': ${Ne(err2)}`;
75485
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Se(err2)}`;
75460
75486
  this.log.error(errMsg);
75461
75487
  await this.sendToWebSocket({
75462
75488
  type: "agent:error",
@@ -75490,13 +75516,13 @@ ${result}`);
75490
75516
  }
75491
75517
  });
75492
75518
  child.on("error", (err2) => {
75493
- this.log.error(Ne(err2));
75519
+ this.log.error(Se(err2));
75494
75520
  reject(err2);
75495
75521
  });
75496
75522
  });
75497
75523
  } catch (err2) {
75498
75524
  const versionTag = message.version ? `v${message.version}` : "latest";
75499
- const errMsg = `Error during upgrading to version '${versionTag}': ${Ne(err2)}`;
75525
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Se(err2)}`;
75500
75526
  this.log.error(errMsg);
75501
75527
  await this.sendToWebSocket({
75502
75528
  type: "agent:error",
@@ -75506,11 +75532,11 @@ ${result}`);
75506
75532
  return;
75507
75533
  }
75508
75534
  try {
75509
- this.log.info("Writing upgrade manifest...", { previousVersion: fn, targetVersion });
75535
+ this.log.info("Writing upgrade manifest...", { previousVersion: pn, targetVersion });
75510
75536
  (0, import_node_fs4.writeFileSync)(
75511
75537
  UPGRADE_MANIFEST_PATH,
75512
75538
  JSON.stringify({
75513
- previousVersion: fn,
75539
+ previousVersion: pn,
75514
75540
  targetVersion,
75515
75541
  callback: message.callback ?? null
75516
75542
  }),
@@ -75520,7 +75546,7 @@ ${result}`);
75520
75546
  child.disconnect();
75521
75547
  } catch (err2) {
75522
75548
  this.log.error(
75523
- `Error while stopping agent or messaging child process as part of upgrade: ${Ne(err2)}`
75549
+ `Error while stopping agent or messaging child process as part of upgrade: ${Se(err2)}`
75524
75550
  );
75525
75551
  import_node_process2.default.exit(1);
75526
75552
  }
@@ -75534,10 +75560,10 @@ ${result}`);
75534
75560
  callback: command.callback
75535
75561
  });
75536
75562
  } catch (err2) {
75537
- this.log.error(Ne(err2));
75563
+ this.log.error(Se(err2));
75538
75564
  await this.sendToWebSocket({
75539
75565
  type: "agent:error",
75540
- body: Ne(err2),
75566
+ body: Se(err2),
75541
75567
  callback: command.callback
75542
75568
  });
75543
75569
  }
@@ -75562,10 +75588,10 @@ ${result}`);
75562
75588
  callback: command.callback
75563
75589
  });
75564
75590
  } catch (err2) {
75565
- this.log.error(Ne(err2));
75591
+ this.log.error(Se(err2));
75566
75592
  await this.sendToWebSocket({
75567
75593
  type: "agent:error",
75568
- body: Ne(err2),
75594
+ body: Se(err2),
75569
75595
  callback: command.callback
75570
75596
  });
75571
75597
  }
@@ -75606,7 +75632,7 @@ ${result}`);
75606
75632
  try {
75607
75633
  msgReturnAck = this.parseReturnAck(message.returnAck);
75608
75634
  } catch (err2) {
75609
- this.log.error(Ne(err2));
75635
+ this.log.error(Se(err2));
75610
75636
  this.addToWebSocketQueue({
75611
75637
  type: "agent:transmit:response",
75612
75638
  channel: message.channel,
@@ -75614,7 +75640,7 @@ ${result}`);
75614
75640
  callback: message.callback,
75615
75641
  contentType: k.TEXT,
75616
75642
  statusCode: 400,
75617
- body: Ne(err2)
75643
+ body: Se(err2)
75618
75644
  });
75619
75645
  return;
75620
75646
  }
@@ -75622,7 +75648,7 @@ ${result}`);
75622
75648
  try {
75623
75649
  defaultReturnAck = this.parseReturnAck(address.searchParams.get("defaultReturnAck"));
75624
75650
  } catch (err2) {
75625
- this.log.warn(`${Ne(err2)} - falling back to default return ACK behavior of 'first'.`);
75651
+ this.log.warn(`${Se(err2)} - falling back to default return ACK behavior of 'first'.`);
75626
75652
  }
75627
75653
  const returnAck = msgReturnAck ?? defaultReturnAck ?? af.FIRST;
75628
75654
  let pool;
@@ -75667,7 +75693,7 @@ ${result}`);
75667
75693
  try {
75668
75694
  client = pool.getClient();
75669
75695
  } catch (err2) {
75670
- this.log.error(`Failed to get client from pool: ${Ne(err2)}`);
75696
+ this.log.error(`Failed to get client from pool: ${Se(err2)}`);
75671
75697
  this.addToWebSocketQueue({
75672
75698
  type: "agent:transmit:response",
75673
75699
  channel: message.channel,
@@ -75675,7 +75701,7 @@ ${result}`);
75675
75701
  callback: message.callback,
75676
75702
  contentType: k.TEXT,
75677
75703
  statusCode: 400,
75678
- body: Ne(err2)
75704
+ body: Se(err2)
75679
75705
  });
75680
75706
  return;
75681
75707
  }
@@ -75691,7 +75717,7 @@ ${result}`);
75691
75717
  body: response2.toString()
75692
75718
  });
75693
75719
  }).catch((err2) => {
75694
- this.log.error(`HL7 error: ${Ne(err2)}`);
75720
+ this.log.error(`HL7 error: ${Se(err2)}`);
75695
75721
  this.addToWebSocketQueue({
75696
75722
  type: "agent:transmit:response",
75697
75723
  channel: message.channel,
@@ -75699,7 +75725,7 @@ ${result}`);
75699
75725
  callback: message.callback,
75700
75726
  contentType: k.TEXT,
75701
75727
  statusCode: 400,
75702
- body: Ne(err2)
75728
+ body: Se(err2)
75703
75729
  });
75704
75730
  forceClose = true;
75705
75731
  }).finally(() => {
@@ -75778,9 +75804,9 @@ async function agentMain(argv) {
75778
75804
  await medplum.startClientLogin(clientId, clientSecret);
75779
75805
  loggedIn = true;
75780
75806
  } catch (err2) {
75781
- console.error("Failed to login", { err: Ne(err2) });
75807
+ console.error("Failed to login", { err: Se(err2) });
75782
75808
  console.log("Retrying login in 10 seconds...");
75783
- await Yr(RETRY_WAIT_DURATION_MS);
75809
+ await Kr(RETRY_WAIT_DURATION_MS);
75784
75810
  }
75785
75811
  }
75786
75812
  if (args.logLevel) {
@@ -75850,7 +75876,7 @@ async function upgraderMain(argv) {
75850
75876
  globalLogger.info("Release successfully downloaded");
75851
75877
  }
75852
75878
  } catch (err2) {
75853
- import_node_process3.default.send({ type: "ERROR", err: Ne(err2) });
75879
+ import_node_process3.default.send({ type: "ERROR", err: Se(err2) });
75854
75880
  throw err2;
75855
75881
  }
75856
75882
  import_node_process3.default.send({ type: "STARTED" });
@@ -75871,7 +75897,7 @@ async function upgraderMain(argv) {
75871
75897
  (0, import_node_child_process2.spawnSync)(`"${binPath}" /S`, { windowsHide: true, shell: true });
75872
75898
  globalLogger.info(`Agent version ${version} successfully installed`);
75873
75899
  } catch (err2) {
75874
- globalLogger.error(`Error while attempting to run installer: ${Ne(err2)}`);
75900
+ globalLogger.error(`Error while attempting to run installer: ${Se(err2)}`);
75875
75901
  globalLogger.error("Failed to run installer, attempting to restart agent service...");
75876
75902
  try {
75877
75903
  (0, import_node_child_process2.execSync)('net start "Medplum Agent"');
@@ -75897,7 +75923,7 @@ async function main(argv) {
75897
75923
  } else if (argv[2] === "--remove-old-services") {
75898
75924
  const logFileFd = (0, import_node_fs7.openSync)(TEMP_LOG_FILE, "a");
75899
75925
  let allAgentServices = [];
75900
- const currentServiceName = `MedplumAgent_${fn}`;
75926
+ const currentServiceName = `MedplumAgent_${pn}`;
75901
75927
  while (!allAgentServices.includes(currentServiceName)) {
75902
75928
  const output = (0, import_node_child_process3.execSync)('cmd.exe /c sc query type= service state= all | findstr /i "SERVICE_NAME.*MedplumAgent"');
75903
75929
  (0, import_node_fs7.appendFileSync)(logFileFd, `${output}\r
@@ -75907,8 +75933,8 @@ async function main(argv) {
75907
75933
  ${allAgentServices.join("\r\n")}\r
75908
75934
  `, { encoding: "utf-8" });
75909
75935
  }
75910
- const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${fn}`);
75911
- (0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${fn}\r
75936
+ const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${pn}`);
75937
+ (0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${pn}\r
75912
75938
  `, {
75913
75939
  encoding: "utf-8"
75914
75940
  });
@@ -75921,10 +75947,10 @@ ${allAgentServices.join("\r\n")}\r
75921
75947
  } catch (err2) {
75922
75948
  (0, import_node_fs7.appendFileSync)(logFileFd, `Failed to stop service: ${serviceName}\r
75923
75949
  `, { encoding: "utf-8" });
75924
- (0, import_node_fs7.appendFileSync)(logFileFd, `${Ne(err2)}\r
75950
+ (0, import_node_fs7.appendFileSync)(logFileFd, `${Se(err2)}\r
75925
75951
  `, { encoding: "utf-8" });
75926
75952
  console.error(`Failed to stop service: ${serviceName}`);
75927
- console.error(Ne(err2));
75953
+ console.error(Se(err2));
75928
75954
  }
75929
75955
  try {
75930
75956
  (0, import_node_child_process3.execSync)(`sc.exe delete ${serviceName}`);
@@ -75934,10 +75960,10 @@ ${allAgentServices.join("\r\n")}\r
75934
75960
  } catch (err2) {
75935
75961
  (0, import_node_fs7.appendFileSync)(logFileFd, `Failed to delete service: ${serviceName}\r
75936
75962
  `, { encoding: "utf-8" });
75937
- (0, import_node_fs7.appendFileSync)(logFileFd, `${Ne(err2)}\r
75963
+ (0, import_node_fs7.appendFileSync)(logFileFd, `${Se(err2)}\r
75938
75964
  `, { encoding: "utf-8" });
75939
75965
  console.error(`Failed to delete service: ${serviceName}`);
75940
- console.error(Ne(err2));
75966
+ console.error(Se(err2));
75941
75967
  }
75942
75968
  }
75943
75969
  (0, import_node_fs7.closeSync)(logFileFd);