@medplum/agent 4.3.12 → 4.3.13

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 +531 -511
  2. package/package.json +5 -5
@@ -10241,7 +10241,7 @@ var require_dcmjs = __commonJS({
10241
10241
  };
10242
10242
  const compress_block = (s, ltree, dtree) => {
10243
10243
  let dist2;
10244
- let lc2;
10244
+ let lc;
10245
10245
  let sx = 0;
10246
10246
  let code;
10247
10247
  let extra;
@@ -10249,16 +10249,16 @@ var require_dcmjs = __commonJS({
10249
10249
  do {
10250
10250
  dist2 = s.pending_buf[s.sym_buf + sx++] & 255;
10251
10251
  dist2 += (s.pending_buf[s.sym_buf + sx++] & 255) << 8;
10252
- lc2 = s.pending_buf[s.sym_buf + sx++];
10252
+ lc = s.pending_buf[s.sym_buf + sx++];
10253
10253
  if (dist2 === 0) {
10254
- send_code(s, lc2, ltree);
10254
+ send_code(s, lc, ltree);
10255
10255
  } else {
10256
- code = _length_code[lc2];
10256
+ code = _length_code[lc];
10257
10257
  send_code(s, code + LITERALS$1 + 1, ltree);
10258
10258
  extra = extra_lbits[code];
10259
10259
  if (extra !== 0) {
10260
- lc2 -= base_length[code];
10261
- send_bits(s, lc2, extra);
10260
+ lc -= base_length[code];
10261
+ send_bits(s, lc, extra);
10262
10262
  }
10263
10263
  dist2--;
10264
10264
  code = d_code(dist2);
@@ -10543,16 +10543,16 @@ var require_dcmjs = __commonJS({
10543
10543
  bi_windup(s);
10544
10544
  }
10545
10545
  };
10546
- const _tr_tally$1 = (s, dist2, lc2) => {
10546
+ const _tr_tally$1 = (s, dist2, lc) => {
10547
10547
  s.pending_buf[s.sym_buf + s.sym_next++] = dist2;
10548
10548
  s.pending_buf[s.sym_buf + s.sym_next++] = dist2 >> 8;
10549
- s.pending_buf[s.sym_buf + s.sym_next++] = lc2;
10549
+ s.pending_buf[s.sym_buf + s.sym_next++] = lc;
10550
10550
  if (dist2 === 0) {
10551
- s.dyn_ltree[lc2 * 2]++;
10551
+ s.dyn_ltree[lc * 2]++;
10552
10552
  } else {
10553
10553
  s.matches++;
10554
10554
  dist2--;
10555
- s.dyn_ltree[(_length_code[lc2] + LITERALS$1 + 1) * 2]++;
10555
+ s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++;
10556
10556
  s.dyn_dtree[d_code(dist2) * 2]++;
10557
10557
  }
10558
10558
  return s.sym_next === s.sym_end;
@@ -16035,8 +16035,8 @@ var require_dcmjs = __commonJS({
16035
16035
  key: "writeBytes",
16036
16036
  value: function writeBytes(stream, value, writeOptions) {
16037
16037
  var _this8 = this;
16038
- var val = Array.isArray(value) ? value.map(function(ds2) {
16039
- return _this8.convertToString(ds2);
16038
+ var val = Array.isArray(value) ? value.map(function(ds) {
16039
+ return _this8.convertToString(ds);
16040
16040
  }) : [this.convertToString(value)];
16041
16041
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
16042
16042
  }
@@ -17824,8 +17824,8 @@ var require_dcmjs = __commonJS({
17824
17824
  }, {
17825
17825
  key: "isMultiframeDataset",
17826
17826
  value: function isMultiframeDataset() {
17827
- var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
17828
- var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
17827
+ var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
17828
+ var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
17829
17829
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
17830
17830
  }
17831
17831
  }, {
@@ -17865,16 +17865,16 @@ var require_dcmjs = __commonJS({
17865
17865
  }
17866
17866
  this.derivation = new DerivedImage(this.datasets);
17867
17867
  this.dataset = this.derivation.dataset;
17868
- var ds2 = this.dataset;
17868
+ var ds = this.dataset;
17869
17869
  var referenceDataset = this.datasets[0];
17870
- ds2.NumberOfFrames = this.datasets.length;
17871
- ds2.SOPClassUID = referenceDataset.SOPClassUID;
17872
- ds2.Rows = referenceDataset.Rows;
17873
- ds2.Columns = referenceDataset.Columns;
17874
- ds2.BitsAllocated = referenceDataset.BitsAllocated;
17875
- ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
17876
- ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
17877
- ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
17870
+ ds.NumberOfFrames = this.datasets.length;
17871
+ ds.SOPClassUID = referenceDataset.SOPClassUID;
17872
+ ds.Rows = referenceDataset.Rows;
17873
+ ds.Columns = referenceDataset.Columns;
17874
+ ds.BitsAllocated = referenceDataset.BitsAllocated;
17875
+ ds.PixelRepresentation = referenceDataset.PixelRepresentation;
17876
+ ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
17877
+ ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
17878
17878
  var referencePosition = referenceDataset.ImagePositionPatient;
17879
17879
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
17880
17880
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -17889,43 +17889,43 @@ var require_dcmjs = __commonJS({
17889
17889
  distanceDatasetPairs.sort(function(a, b2) {
17890
17890
  return b2[0] - a[0];
17891
17891
  });
17892
- if (ds2.BitsAllocated !== 16) {
17892
+ if (ds.BitsAllocated !== 16) {
17893
17893
  log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
17894
17894
  }
17895
17895
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
17896
17896
  log2.warn("No vr map given for pixel data, using OW");
17897
- ds2._vrMap = {
17897
+ ds._vrMap = {
17898
17898
  PixelData: "OW"
17899
17899
  };
17900
17900
  } else {
17901
- ds2._vrMap = {
17901
+ ds._vrMap = {
17902
17902
  PixelData: referenceDataset._vrMap.PixelData
17903
17903
  };
17904
17904
  }
17905
17905
  var frameSize = referenceDataset.PixelData.byteLength;
17906
- ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
17906
+ ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
17907
17907
  var frame = 0;
17908
17908
  distanceDatasetPairs.forEach(function(pair) {
17909
17909
  var dataset = pair[1];
17910
17910
  var pixels = new Uint16Array(dataset.PixelData);
17911
- var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
17911
+ var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
17912
17912
  try {
17913
17913
  frameView.set(pixels);
17914
17914
  } catch (e) {
17915
17915
  if (e instanceof RangeError) {
17916
- var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds2.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
17916
+ var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
17917
17917
  log2.error(message2);
17918
17918
  }
17919
17919
  }
17920
17920
  frame++;
17921
17921
  });
17922
- if (ds2.NumberOfFrames < 2) {
17922
+ if (ds.NumberOfFrames < 2) {
17923
17923
  log2.error("Cannot populate shared groups uniquely without multiple frames");
17924
17924
  }
17925
17925
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
17926
17926
  var distance1 = distanceDatasetPairs[1][0];
17927
17927
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
17928
- ds2.SharedFunctionalGroupsSequence = {
17928
+ ds.SharedFunctionalGroupsSequence = {
17929
17929
  PlaneOrientationSequence: {
17930
17930
  ImageOrientationPatient: dataset0.ImageOrientationPatient
17931
17931
  },
@@ -17935,14 +17935,14 @@ var require_dcmjs = __commonJS({
17935
17935
  SliceThickness: SpacingBetweenSlices
17936
17936
  }
17937
17937
  };
17938
- ds2.ReferencedSeriesSequence = {
17938
+ ds.ReferencedSeriesSequence = {
17939
17939
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
17940
17940
  ReferencedInstanceSequence: []
17941
17941
  };
17942
- ds2.PerFrameFunctionalGroupsSequence = [];
17942
+ ds.PerFrameFunctionalGroupsSequence = [];
17943
17943
  distanceDatasetPairs.forEach(function(pair) {
17944
17944
  var dataset = pair[1];
17945
- ds2.PerFrameFunctionalGroupsSequence.push({
17945
+ ds.PerFrameFunctionalGroupsSequence.push({
17946
17946
  PlanePositionSequence: {
17947
17947
  ImagePositionPatient: dataset.ImagePositionPatient
17948
17948
  },
@@ -17951,7 +17951,7 @@ var require_dcmjs = __commonJS({
17951
17951
  WindowWidth: dataset.WindowWidth
17952
17952
  }
17953
17953
  });
17954
- ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
17954
+ ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
17955
17955
  ReferencedSOPClassUID: dataset.SOPClassUID,
17956
17956
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
17957
17957
  });
@@ -17971,29 +17971,29 @@ var require_dcmjs = __commonJS({
17971
17971
  }, {
17972
17972
  key: "normalizeMultiframe",
17973
17973
  value: function normalizeMultiframe() {
17974
- var ds2 = this.dataset;
17975
- if (!ds2.NumberOfFrames) {
17974
+ var ds = this.dataset;
17975
+ if (!ds.NumberOfFrames) {
17976
17976
  log2.error("Missing number or frames not supported");
17977
17977
  return;
17978
17978
  }
17979
- if (!ds2.PixelRepresentation) {
17980
- ds2.PixelRepresentation = 1;
17979
+ if (!ds.PixelRepresentation) {
17980
+ ds.PixelRepresentation = 1;
17981
17981
  }
17982
- if (!ds2.StudyID || ds2.StudyID === "") {
17983
- ds2.StudyID = "No Study ID";
17982
+ if (!ds.StudyID || ds.StudyID === "") {
17983
+ ds.StudyID = "No Study ID";
17984
17984
  }
17985
17985
  var validLateralities = ["R", "L"];
17986
- if (validLateralities.indexOf(ds2.Laterality) === -1) {
17987
- delete ds2.Laterality;
17986
+ if (validLateralities.indexOf(ds.Laterality) === -1) {
17987
+ delete ds.Laterality;
17988
17988
  }
17989
- if (!ds2.PresentationLUTShape) {
17990
- ds2.PresentationLUTShape = "IDENTITY";
17989
+ if (!ds.PresentationLUTShape) {
17990
+ ds.PresentationLUTShape = "IDENTITY";
17991
17991
  }
17992
- if (!ds2.SharedFunctionalGroupsSequence) {
17992
+ if (!ds.SharedFunctionalGroupsSequence) {
17993
17993
  log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
17994
17994
  }
17995
- if (ds2.BodyPartExamined === "PROSTATE") {
17996
- ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
17995
+ if (ds.BodyPartExamined === "PROSTATE") {
17996
+ ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
17997
17997
  AnatomicRegionSequence: {
17998
17998
  CodeValue: "T-9200B",
17999
17999
  CodingSchemeDesignator: "SRT",
@@ -18002,17 +18002,17 @@ var require_dcmjs = __commonJS({
18002
18002
  FrameLaterality: "U"
18003
18003
  };
18004
18004
  }
18005
- var rescaleIntercept = ds2.RescaleIntercept || 0;
18006
- var rescaleSlope = ds2.RescaleSlope || 1;
18007
- ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
18005
+ var rescaleIntercept = ds.RescaleIntercept || 0;
18006
+ var rescaleSlope = ds.RescaleSlope || 1;
18007
+ ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
18008
18008
  RescaleIntercept: rescaleIntercept,
18009
18009
  RescaleSlope: rescaleSlope,
18010
18010
  RescaleType: "US"
18011
18011
  };
18012
18012
  var frameNumber = 1;
18013
18013
  this.datasets.forEach(function(dataset) {
18014
- if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
18015
- ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
18014
+ if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
18015
+ ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
18016
18016
  FrameAcquisitionDuration: 0,
18017
18017
  StackID: 1,
18018
18018
  InStackPositionNumber: frameNumber,
@@ -18020,30 +18020,30 @@ var require_dcmjs = __commonJS({
18020
18020
  };
18021
18021
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
18022
18022
  if (!isNaN(frameTime)) {
18023
- var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
18023
+ var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
18024
18024
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
18025
18025
  frameContentSequence.FrameReferenceDateTime = frameTime;
18026
18026
  }
18027
18027
  frameNumber++;
18028
18028
  });
18029
- if (ds2.WindowCenter && ds2.WindowWidth) {
18030
- if (!Array.isArray(ds2.WindowCenter)) {
18031
- ds2.WindowCenter = [ds2.WindowCenter];
18029
+ if (ds.WindowCenter && ds.WindowWidth) {
18030
+ if (!Array.isArray(ds.WindowCenter)) {
18031
+ ds.WindowCenter = [ds.WindowCenter];
18032
18032
  }
18033
- if (!Array.isArray(ds2.WindowWidth)) {
18034
- ds2.WindowWidth = [ds2.WindowWidth];
18033
+ if (!Array.isArray(ds.WindowWidth)) {
18034
+ ds.WindowWidth = [ds.WindowWidth];
18035
18035
  }
18036
18036
  }
18037
- if (!ds2.WindowCenter || !ds2.WindowWidth) {
18038
- ds2.WindowCenter = [];
18039
- ds2.WindowWidth = [];
18040
- if (ds2.PerFrameFunctionalGroupsSequence) {
18037
+ if (!ds.WindowCenter || !ds.WindowWidth) {
18038
+ ds.WindowCenter = [];
18039
+ ds.WindowWidth = [];
18040
+ if (ds.PerFrameFunctionalGroupsSequence) {
18041
18041
  var wcww = {
18042
18042
  center: 0,
18043
18043
  width: 0,
18044
18044
  count: 0
18045
18045
  };
18046
- ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
18046
+ ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
18047
18047
  if (functionalGroup.FrameVOILUT) {
18048
18048
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
18049
18049
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -18061,16 +18061,16 @@ var require_dcmjs = __commonJS({
18061
18061
  }
18062
18062
  });
18063
18063
  if (wcww.count > 0) {
18064
- ds2.WindowCenter.push(String(wcww.center / wcww.count));
18065
- ds2.WindowWidth.push(String(wcww.width / wcww.count));
18064
+ ds.WindowCenter.push(String(wcww.center / wcww.count));
18065
+ ds.WindowWidth.push(String(wcww.width / wcww.count));
18066
18066
  }
18067
18067
  }
18068
18068
  }
18069
- if (ds2.WindowCenter.length === 0) {
18070
- ds2.WindowCenter = [300];
18069
+ if (ds.WindowCenter.length === 0) {
18070
+ ds.WindowCenter = [300];
18071
18071
  }
18072
- if (ds2.WindowWidth.length === 0) {
18073
- ds2.WindowWidth = [500];
18072
+ if (ds.WindowWidth.length === 0) {
18073
+ ds.WindowWidth = [500];
18074
18074
  }
18075
18075
  }
18076
18076
  }], [{
@@ -18116,12 +18116,12 @@ var require_dcmjs = __commonJS({
18116
18116
  key: "normalizeMultiframe",
18117
18117
  value: function normalizeMultiframe() {
18118
18118
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
18119
- var ds2 = this.dataset;
18120
- if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
18121
- ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
18119
+ var ds = this.dataset;
18120
+ if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
18121
+ ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
18122
18122
  }
18123
- ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
18124
- FrameType: ds2.ImageType,
18123
+ ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
18124
+ FrameType: ds.ImageType,
18125
18125
  PixelPresentation: "MONOCHROME",
18126
18126
  VolumetricProperties: "VOLUME",
18127
18127
  VolumeBasedCalculationTechnique: "NONE",
@@ -18246,9 +18246,9 @@ var require_dcmjs = __commonJS({
18246
18246
  key: "normalize",
18247
18247
  value: function normalize2() {
18248
18248
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
18249
- var ds2 = this.datasets[0];
18250
- if (ds2.BitsAllocated !== 32) {
18251
- log2.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
18249
+ var ds = this.datasets[0];
18250
+ if (ds.BitsAllocated !== 32) {
18251
+ log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
18252
18252
  }
18253
18253
  }
18254
18254
  }]);
@@ -27215,7 +27215,7 @@ var require_dcmjs = __commonJS({
27215
27215
  __proto__: null,
27216
27216
  Comprehensive3DSR
27217
27217
  });
27218
- var sr = {
27218
+ var sr2 = {
27219
27219
  coding,
27220
27220
  contentItems,
27221
27221
  documents,
@@ -27527,7 +27527,7 @@ var require_dcmjs = __commonJS({
27527
27527
  data: data2,
27528
27528
  derivations,
27529
27529
  normalizers,
27530
- sr,
27530
+ sr: sr2,
27531
27531
  utilities,
27532
27532
  log: log2,
27533
27533
  anonymizer
@@ -27544,7 +27544,7 @@ var require_dcmjs = __commonJS({
27544
27544
  exports3.derivations = derivations;
27545
27545
  exports3.log = log2;
27546
27546
  exports3.normalizers = normalizers;
27547
- exports3.sr = sr;
27547
+ exports3.sr = sr2;
27548
27548
  exports3.utilities = utilities;
27549
27549
  Object.defineProperty(exports3, "__esModule", { value: true });
27550
27550
  }));
@@ -28618,17 +28618,17 @@ var require_decorator = __commonJS({
28618
28618
  return mergedObject;
28619
28619
  };
28620
28620
  var mergePropertyAndMethodDecorators = (d1, d2) => {
28621
- var _a, _b, _c, _d;
28621
+ var _a, _b, _c2, _d;
28622
28622
  return {
28623
28623
  property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
28624
- method: mergeObjectsOfDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c !== void 0 ? _c : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.method) !== null && _d !== void 0 ? _d : {})
28624
+ method: mergeObjectsOfDecorators((_c2 = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c2 !== void 0 ? _c2 : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.method) !== null && _d !== void 0 ? _d : {})
28625
28625
  };
28626
28626
  };
28627
28627
  var mergeDecorators = (d1, d2) => {
28628
- var _a, _b, _c, _d, _e2, _f;
28628
+ var _a, _b, _c2, _d, _e2, _f;
28629
28629
  return {
28630
28630
  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 : []]),
28631
- 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 : {}),
28631
+ static: mergePropertyAndMethodDecorators((_c2 = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c2 !== void 0 ? _c2 : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
28632
28632
  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 : {})
28633
28633
  };
28634
28634
  };
@@ -28689,7 +28689,7 @@ var require_decorator = __commonJS({
28689
28689
  return decorator(clazz);
28690
28690
  });
28691
28691
  var decorateMember = (decorator) => ((object, key, ...otherArgs) => {
28692
- var _a, _b, _c;
28692
+ var _a, _b, _c2;
28693
28693
  const decoratorTargetType = typeof object === "function" ? "static" : "instance";
28694
28694
  const decoratorType = typeof object[key] === "function" ? "method" : "property";
28695
28695
  const clazz = decoratorTargetType === "static" ? object : object.constructor;
@@ -28698,7 +28698,7 @@ var require_decorator = __commonJS({
28698
28698
  decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
28699
28699
  let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
28700
28700
  decoratorsForTargetType[decoratorType] = decoratorsForType;
28701
- let decoratorsForKey = (_c = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c !== void 0 ? _c : [];
28701
+ let decoratorsForKey = (_c2 = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c2 !== void 0 ? _c2 : [];
28702
28702
  decoratorsForType[key] = decoratorsForKey;
28703
28703
  decoratorsForKey.push(decorator);
28704
28704
  return decorator(object, key, ...otherArgs);
@@ -28724,7 +28724,7 @@ var require_mixins = __commonJS({
28724
28724
  var decorator_1 = require_decorator();
28725
28725
  var mixin_tracking_1 = require_mixin_tracking();
28726
28726
  function Mixin(...constructors) {
28727
- var _a, _b, _c;
28727
+ var _a, _b, _c2;
28728
28728
  const prototypes = constructors.map((constructor) => constructor.prototype);
28729
28729
  const initFunctionName = settings_1.settings.initFunction;
28730
28730
  if (initFunctionName !== null) {
@@ -28754,7 +28754,7 @@ var require_mixins = __commonJS({
28754
28754
  }
28755
28755
  }
28756
28756
  applyPropAndMethodDecorators((_b = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.static) !== null && _b !== void 0 ? _b : {}, DecoratedMixedClass);
28757
- applyPropAndMethodDecorators((_c = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.instance) !== null && _c !== void 0 ? _c : {}, DecoratedMixedClass.prototype);
28757
+ applyPropAndMethodDecorators((_c2 = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.instance) !== null && _c2 !== void 0 ? _c2 : {}, DecoratedMixedClass.prototype);
28758
28758
  }
28759
28759
  (0, mixin_tracking_1.registerMixins)(DecoratedMixedClass, constructors);
28760
28760
  return DecoratedMixedClass;
@@ -29724,7 +29724,7 @@ var require_dcmjs2 = __commonJS({
29724
29724
  };
29725
29725
  const compress_block = (s, ltree, dtree) => {
29726
29726
  let dist2;
29727
- let lc2;
29727
+ let lc;
29728
29728
  let sx = 0;
29729
29729
  let code;
29730
29730
  let extra;
@@ -29732,16 +29732,16 @@ var require_dcmjs2 = __commonJS({
29732
29732
  do {
29733
29733
  dist2 = s.pending_buf[s.sym_buf + sx++] & 255;
29734
29734
  dist2 += (s.pending_buf[s.sym_buf + sx++] & 255) << 8;
29735
- lc2 = s.pending_buf[s.sym_buf + sx++];
29735
+ lc = s.pending_buf[s.sym_buf + sx++];
29736
29736
  if (dist2 === 0) {
29737
- send_code(s, lc2, ltree);
29737
+ send_code(s, lc, ltree);
29738
29738
  } else {
29739
- code = _length_code[lc2];
29739
+ code = _length_code[lc];
29740
29740
  send_code(s, code + LITERALS$1 + 1, ltree);
29741
29741
  extra = extra_lbits[code];
29742
29742
  if (extra !== 0) {
29743
- lc2 -= base_length[code];
29744
- send_bits(s, lc2, extra);
29743
+ lc -= base_length[code];
29744
+ send_bits(s, lc, extra);
29745
29745
  }
29746
29746
  dist2--;
29747
29747
  code = d_code(dist2);
@@ -30026,16 +30026,16 @@ var require_dcmjs2 = __commonJS({
30026
30026
  bi_windup(s);
30027
30027
  }
30028
30028
  };
30029
- const _tr_tally$1 = (s, dist2, lc2) => {
30029
+ const _tr_tally$1 = (s, dist2, lc) => {
30030
30030
  s.pending_buf[s.sym_buf + s.sym_next++] = dist2;
30031
30031
  s.pending_buf[s.sym_buf + s.sym_next++] = dist2 >> 8;
30032
- s.pending_buf[s.sym_buf + s.sym_next++] = lc2;
30032
+ s.pending_buf[s.sym_buf + s.sym_next++] = lc;
30033
30033
  if (dist2 === 0) {
30034
- s.dyn_ltree[lc2 * 2]++;
30034
+ s.dyn_ltree[lc * 2]++;
30035
30035
  } else {
30036
30036
  s.matches++;
30037
30037
  dist2--;
30038
- s.dyn_ltree[(_length_code[lc2] + LITERALS$1 + 1) * 2]++;
30038
+ s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++;
30039
30039
  s.dyn_dtree[d_code(dist2) * 2]++;
30040
30040
  }
30041
30041
  return s.sym_next === s.sym_end;
@@ -35212,8 +35212,8 @@ var require_dcmjs2 = __commonJS({
35212
35212
  key: "writeBytes",
35213
35213
  value: function writeBytes(stream, value, writeOptions) {
35214
35214
  var _this8 = this;
35215
- var val = Array.isArray(value) ? value.map(function(ds2) {
35216
- return _this8.convertToString(ds2);
35215
+ var val = Array.isArray(value) ? value.map(function(ds) {
35216
+ return _this8.convertToString(ds);
35217
35217
  }) : [this.convertToString(value)];
35218
35218
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
35219
35219
  }
@@ -36986,8 +36986,8 @@ var require_dcmjs2 = __commonJS({
36986
36986
  }, {
36987
36987
  key: "isMultiframeDataset",
36988
36988
  value: function isMultiframeDataset() {
36989
- var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
36990
- var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
36989
+ var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
36990
+ var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
36991
36991
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
36992
36992
  }
36993
36993
  }, {
@@ -37027,16 +37027,16 @@ var require_dcmjs2 = __commonJS({
37027
37027
  }
37028
37028
  this.derivation = new DerivedImage(this.datasets);
37029
37029
  this.dataset = this.derivation.dataset;
37030
- var ds2 = this.dataset;
37030
+ var ds = this.dataset;
37031
37031
  var referenceDataset = this.datasets[0];
37032
- ds2.NumberOfFrames = this.datasets.length;
37033
- ds2.SOPClassUID = referenceDataset.SOPClassUID;
37034
- ds2.Rows = referenceDataset.Rows;
37035
- ds2.Columns = referenceDataset.Columns;
37036
- ds2.BitsAllocated = referenceDataset.BitsAllocated;
37037
- ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
37038
- ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
37039
- ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
37032
+ ds.NumberOfFrames = this.datasets.length;
37033
+ ds.SOPClassUID = referenceDataset.SOPClassUID;
37034
+ ds.Rows = referenceDataset.Rows;
37035
+ ds.Columns = referenceDataset.Columns;
37036
+ ds.BitsAllocated = referenceDataset.BitsAllocated;
37037
+ ds.PixelRepresentation = referenceDataset.PixelRepresentation;
37038
+ ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
37039
+ ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
37040
37040
  var referencePosition = referenceDataset.ImagePositionPatient;
37041
37041
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
37042
37042
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -37051,43 +37051,43 @@ var require_dcmjs2 = __commonJS({
37051
37051
  distanceDatasetPairs.sort(function(a, b2) {
37052
37052
  return b2[0] - a[0];
37053
37053
  });
37054
- if (ds2.BitsAllocated !== 16) {
37054
+ if (ds.BitsAllocated !== 16) {
37055
37055
  log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
37056
37056
  }
37057
37057
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
37058
37058
  log2.warn("No vr map given for pixel data, using OW");
37059
- ds2._vrMap = {
37059
+ ds._vrMap = {
37060
37060
  PixelData: "OW"
37061
37061
  };
37062
37062
  } else {
37063
- ds2._vrMap = {
37063
+ ds._vrMap = {
37064
37064
  PixelData: referenceDataset._vrMap.PixelData
37065
37065
  };
37066
37066
  }
37067
37067
  var frameSize = referenceDataset.PixelData.byteLength;
37068
- ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
37068
+ ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
37069
37069
  var frame = 0;
37070
37070
  distanceDatasetPairs.forEach(function(pair) {
37071
37071
  var dataset = pair[1];
37072
37072
  var pixels = new Uint16Array(dataset.PixelData);
37073
- var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
37073
+ var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
37074
37074
  try {
37075
37075
  frameView.set(pixels);
37076
37076
  } catch (e) {
37077
37077
  if (e instanceof RangeError) {
37078
- var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds2.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
37078
+ var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
37079
37079
  log2.error(message2);
37080
37080
  }
37081
37081
  }
37082
37082
  frame++;
37083
37083
  });
37084
- if (ds2.NumberOfFrames < 2) {
37084
+ if (ds.NumberOfFrames < 2) {
37085
37085
  log2.error("Cannot populate shared groups uniquely without multiple frames");
37086
37086
  }
37087
37087
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
37088
37088
  var distance1 = distanceDatasetPairs[1][0];
37089
37089
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
37090
- ds2.SharedFunctionalGroupsSequence = {
37090
+ ds.SharedFunctionalGroupsSequence = {
37091
37091
  PlaneOrientationSequence: {
37092
37092
  ImageOrientationPatient: dataset0.ImageOrientationPatient
37093
37093
  },
@@ -37097,14 +37097,14 @@ var require_dcmjs2 = __commonJS({
37097
37097
  SliceThickness: SpacingBetweenSlices
37098
37098
  }
37099
37099
  };
37100
- ds2.ReferencedSeriesSequence = {
37100
+ ds.ReferencedSeriesSequence = {
37101
37101
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
37102
37102
  ReferencedInstanceSequence: []
37103
37103
  };
37104
- ds2.PerFrameFunctionalGroupsSequence = [];
37104
+ ds.PerFrameFunctionalGroupsSequence = [];
37105
37105
  distanceDatasetPairs.forEach(function(pair) {
37106
37106
  var dataset = pair[1];
37107
- ds2.PerFrameFunctionalGroupsSequence.push({
37107
+ ds.PerFrameFunctionalGroupsSequence.push({
37108
37108
  PlanePositionSequence: {
37109
37109
  ImagePositionPatient: dataset.ImagePositionPatient
37110
37110
  },
@@ -37113,7 +37113,7 @@ var require_dcmjs2 = __commonJS({
37113
37113
  WindowWidth: dataset.WindowWidth
37114
37114
  }
37115
37115
  });
37116
- ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
37116
+ ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
37117
37117
  ReferencedSOPClassUID: dataset.SOPClassUID,
37118
37118
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
37119
37119
  });
@@ -37133,29 +37133,29 @@ var require_dcmjs2 = __commonJS({
37133
37133
  }, {
37134
37134
  key: "normalizeMultiframe",
37135
37135
  value: function normalizeMultiframe() {
37136
- var ds2 = this.dataset;
37137
- if (!ds2.NumberOfFrames) {
37136
+ var ds = this.dataset;
37137
+ if (!ds.NumberOfFrames) {
37138
37138
  log2.error("Missing number or frames not supported");
37139
37139
  return;
37140
37140
  }
37141
- if (!ds2.PixelRepresentation) {
37142
- ds2.PixelRepresentation = 1;
37141
+ if (!ds.PixelRepresentation) {
37142
+ ds.PixelRepresentation = 1;
37143
37143
  }
37144
- if (!ds2.StudyID || ds2.StudyID === "") {
37145
- ds2.StudyID = "No Study ID";
37144
+ if (!ds.StudyID || ds.StudyID === "") {
37145
+ ds.StudyID = "No Study ID";
37146
37146
  }
37147
37147
  var validLateralities = ["R", "L"];
37148
- if (validLateralities.indexOf(ds2.Laterality) === -1) {
37149
- delete ds2.Laterality;
37148
+ if (validLateralities.indexOf(ds.Laterality) === -1) {
37149
+ delete ds.Laterality;
37150
37150
  }
37151
- if (!ds2.PresentationLUTShape) {
37152
- ds2.PresentationLUTShape = "IDENTITY";
37151
+ if (!ds.PresentationLUTShape) {
37152
+ ds.PresentationLUTShape = "IDENTITY";
37153
37153
  }
37154
- if (!ds2.SharedFunctionalGroupsSequence) {
37154
+ if (!ds.SharedFunctionalGroupsSequence) {
37155
37155
  log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
37156
37156
  }
37157
- if (ds2.BodyPartExamined === "PROSTATE") {
37158
- ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
37157
+ if (ds.BodyPartExamined === "PROSTATE") {
37158
+ ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
37159
37159
  AnatomicRegionSequence: {
37160
37160
  CodeValue: "T-9200B",
37161
37161
  CodingSchemeDesignator: "SRT",
@@ -37164,17 +37164,17 @@ var require_dcmjs2 = __commonJS({
37164
37164
  FrameLaterality: "U"
37165
37165
  };
37166
37166
  }
37167
- var rescaleIntercept = ds2.RescaleIntercept || 0;
37168
- var rescaleSlope = ds2.RescaleSlope || 1;
37169
- ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
37167
+ var rescaleIntercept = ds.RescaleIntercept || 0;
37168
+ var rescaleSlope = ds.RescaleSlope || 1;
37169
+ ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
37170
37170
  RescaleIntercept: rescaleIntercept,
37171
37171
  RescaleSlope: rescaleSlope,
37172
37172
  RescaleType: "US"
37173
37173
  };
37174
37174
  var frameNumber = 1;
37175
37175
  this.datasets.forEach(function(dataset) {
37176
- if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
37177
- ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
37176
+ if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
37177
+ ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
37178
37178
  FrameAcquisitionDuration: 0,
37179
37179
  StackID: 1,
37180
37180
  InStackPositionNumber: frameNumber,
@@ -37182,30 +37182,30 @@ var require_dcmjs2 = __commonJS({
37182
37182
  };
37183
37183
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
37184
37184
  if (!isNaN(frameTime)) {
37185
- var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
37185
+ var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
37186
37186
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
37187
37187
  frameContentSequence.FrameReferenceDateTime = frameTime;
37188
37188
  }
37189
37189
  frameNumber++;
37190
37190
  });
37191
- if (ds2.WindowCenter && ds2.WindowWidth) {
37192
- if (!Array.isArray(ds2.WindowCenter)) {
37193
- ds2.WindowCenter = [ds2.WindowCenter];
37191
+ if (ds.WindowCenter && ds.WindowWidth) {
37192
+ if (!Array.isArray(ds.WindowCenter)) {
37193
+ ds.WindowCenter = [ds.WindowCenter];
37194
37194
  }
37195
- if (!Array.isArray(ds2.WindowWidth)) {
37196
- ds2.WindowWidth = [ds2.WindowWidth];
37195
+ if (!Array.isArray(ds.WindowWidth)) {
37196
+ ds.WindowWidth = [ds.WindowWidth];
37197
37197
  }
37198
37198
  }
37199
- if (!ds2.WindowCenter || !ds2.WindowWidth) {
37200
- ds2.WindowCenter = [];
37201
- ds2.WindowWidth = [];
37202
- if (ds2.PerFrameFunctionalGroupsSequence) {
37199
+ if (!ds.WindowCenter || !ds.WindowWidth) {
37200
+ ds.WindowCenter = [];
37201
+ ds.WindowWidth = [];
37202
+ if (ds.PerFrameFunctionalGroupsSequence) {
37203
37203
  var wcww = {
37204
37204
  center: 0,
37205
37205
  width: 0,
37206
37206
  count: 0
37207
37207
  };
37208
- ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
37208
+ ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
37209
37209
  if (functionalGroup.FrameVOILUT) {
37210
37210
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
37211
37211
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -37223,16 +37223,16 @@ var require_dcmjs2 = __commonJS({
37223
37223
  }
37224
37224
  });
37225
37225
  if (wcww.count > 0) {
37226
- ds2.WindowCenter.push(String(wcww.center / wcww.count));
37227
- ds2.WindowWidth.push(String(wcww.width / wcww.count));
37226
+ ds.WindowCenter.push(String(wcww.center / wcww.count));
37227
+ ds.WindowWidth.push(String(wcww.width / wcww.count));
37228
37228
  }
37229
37229
  }
37230
37230
  }
37231
- if (ds2.WindowCenter.length === 0) {
37232
- ds2.WindowCenter = [300];
37231
+ if (ds.WindowCenter.length === 0) {
37232
+ ds.WindowCenter = [300];
37233
37233
  }
37234
- if (ds2.WindowWidth.length === 0) {
37235
- ds2.WindowWidth = [500];
37234
+ if (ds.WindowWidth.length === 0) {
37235
+ ds.WindowWidth = [500];
37236
37236
  }
37237
37237
  }
37238
37238
  }], [{
@@ -37278,12 +37278,12 @@ var require_dcmjs2 = __commonJS({
37278
37278
  key: "normalizeMultiframe",
37279
37279
  value: function normalizeMultiframe() {
37280
37280
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
37281
- var ds2 = this.dataset;
37282
- if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
37283
- ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
37281
+ var ds = this.dataset;
37282
+ if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
37283
+ ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
37284
37284
  }
37285
- ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
37286
- FrameType: ds2.ImageType,
37285
+ ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
37286
+ FrameType: ds.ImageType,
37287
37287
  PixelPresentation: "MONOCHROME",
37288
37288
  VolumetricProperties: "VOLUME",
37289
37289
  VolumeBasedCalculationTechnique: "NONE",
@@ -37408,9 +37408,9 @@ var require_dcmjs2 = __commonJS({
37408
37408
  key: "normalize",
37409
37409
  value: function normalize2() {
37410
37410
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
37411
- var ds2 = this.datasets[0];
37412
- if (ds2.BitsAllocated !== 32) {
37413
- log2.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
37411
+ var ds = this.datasets[0];
37412
+ if (ds.BitsAllocated !== 32) {
37413
+ log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
37414
37414
  }
37415
37415
  }
37416
37416
  }]);
@@ -46377,7 +46377,7 @@ var require_dcmjs2 = __commonJS({
46377
46377
  __proto__: null,
46378
46378
  Comprehensive3DSR
46379
46379
  });
46380
- var sr = {
46380
+ var sr2 = {
46381
46381
  coding,
46382
46382
  contentItems,
46383
46383
  documents,
@@ -46689,7 +46689,7 @@ var require_dcmjs2 = __commonJS({
46689
46689
  data: data2,
46690
46690
  derivations,
46691
46691
  normalizers,
46692
- sr,
46692
+ sr: sr2,
46693
46693
  utilities,
46694
46694
  log: log2,
46695
46695
  anonymizer
@@ -46706,7 +46706,7 @@ var require_dcmjs2 = __commonJS({
46706
46706
  exports3.derivations = derivations;
46707
46707
  exports3.log = log2;
46708
46708
  exports3.normalizers = normalizers;
46709
- exports3.sr = sr;
46709
+ exports3.sr = sr2;
46710
46710
  exports3.utilities = utilities;
46711
46711
  Object.defineProperty(exports3, "__esModule", { value: true });
46712
46712
  }));
@@ -51132,10 +51132,10 @@ var ot = class {
51132
51132
  }, precedence: t });
51133
51133
  }
51134
51134
  construct(e) {
51135
- return new ir(e, this.prefixParselets, this.infixParselets);
51135
+ return new or(e, this.prefixParselets, this.infixParselets);
51136
51136
  }
51137
51137
  };
51138
- var ir = class {
51138
+ var or = class {
51139
51139
  constructor(e, t, n) {
51140
51140
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
51141
51141
  }
@@ -51207,104 +51207,104 @@ var we = class {
51207
51207
  return this.cache.keys().next().value;
51208
51208
  }
51209
51209
  };
51210
- var or = "ok";
51210
+ var sr = "ok";
51211
51211
  var st = "created";
51212
- var ar = "not-modified";
51213
- var ur = "not-found";
51214
- var dr = "unauthorized";
51212
+ var cr = "not-modified";
51213
+ var lr = "not-found";
51214
+ var pr = "unauthorized";
51215
51215
  var at = "accepted";
51216
- var gn = { resourceType: "OperationOutcome", id: ur, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
51217
- var Ae = { resourceType: "OperationOutcome", id: dr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
51218
- var xn = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
51219
- var pr = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
51216
+ var xn = { resourceType: "OperationOutcome", id: lr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
51217
+ var Ae = { resourceType: "OperationOutcome", id: pr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
51218
+ var vn = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
51219
+ var fr = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
51220
51220
  function b(r6, e) {
51221
51221
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
51222
51222
  }
51223
51223
  function y(r6) {
51224
51224
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
51225
51225
  }
51226
- function vn(r6) {
51226
+ function Tn(r6) {
51227
51227
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
51228
51228
  }
51229
- function po(r6) {
51229
+ function fo(r6) {
51230
51230
  return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
51231
51231
  }
51232
51232
  function Oe(r6) {
51233
51233
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
51234
51234
  }
51235
- function fr(r6) {
51236
- return r6.id === or || r6.id === st || r6.id === ar || r6.id === at;
51235
+ function hr(r6) {
51236
+ return r6.id === sr || r6.id === st || r6.id === cr || r6.id === at;
51237
51237
  }
51238
51238
  var p = class extends Error {
51239
51239
  constructor(e, t) {
51240
- super(Tn(e)), this.outcome = e, this.cause = t;
51240
+ super(Sn(e)), this.outcome = e, this.cause = t;
51241
51241
  }
51242
51242
  };
51243
51243
  function ct(r6) {
51244
51244
  return r6 instanceof p ? r6.outcome : Oe(r6) ? r6 : b(Ie(r6));
51245
51245
  }
51246
51246
  function Ie(r6) {
51247
- return r6 ? typeof r6 == "string" ? r6 : po(r6) ? r6.message : Oe(r6) ? Tn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
51247
+ return r6 ? typeof r6 == "string" ? r6 : fo(r6) ? r6.message : Oe(r6) ? Sn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
51248
51248
  }
51249
- function Tn(r6) {
51250
- let e = r6.issue?.map(fo) ?? [];
51249
+ function Sn(r6) {
51250
+ let e = r6.issue?.map(ho) ?? [];
51251
51251
  return e.length > 0 ? e.join("; ") : "Unknown error";
51252
51252
  }
51253
- function fo(r6) {
51253
+ function ho(r6) {
51254
51254
  let e;
51255
51255
  return r6.details?.text ? r6.diagnostics ? e = `${r6.details.text} (${r6.diagnostics})` : e = r6.details.text : r6.diagnostics ? e = r6.diagnostics : e = "Unknown error", r6.expression?.length && (e += ` (${r6.expression.join(", ")})`), e;
51256
51256
  }
51257
- function mo(r6, e) {
51257
+ function yo(r6, e) {
51258
51258
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
51259
51259
  return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
51260
51260
  }
51261
- function En(r6) {
51261
+ function Rn(r6) {
51262
51262
  let e = /* @__PURE__ */ Object.create(null);
51263
- for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, mo(i, o)])), constraints: [], innerTypes: [] };
51263
+ for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, yo(i, o)])), constraints: [], innerTypes: [] };
51264
51264
  return e;
51265
51265
  }
51266
- var Rn = { 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" }] } } } };
51267
- function gr(r6) {
51268
- return new mr(r6).parse();
51266
+ var Cn = { 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" }] } } } };
51267
+ function xr(r6) {
51268
+ return new yr(r6).parse();
51269
51269
  }
51270
- var fe = En(Rn);
51271
- var xr = /* @__PURE__ */ Object.create(null);
51272
- var Cn = /* @__PURE__ */ Object.create(null);
51273
- var go = { "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" };
51274
- function On(r6) {
51270
+ var fe = Rn(Cn);
51271
+ var vr = /* @__PURE__ */ Object.create(null);
51272
+ var Pn = /* @__PURE__ */ Object.create(null);
51273
+ var xo = { "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" };
51274
+ function In(r6) {
51275
51275
  let e;
51276
- return e = Cn[r6], e || (e = Cn[r6] = /* @__PURE__ */ Object.create(null)), e;
51276
+ return e = Pn[r6], e || (e = Pn[r6] = /* @__PURE__ */ Object.create(null)), e;
51277
51277
  }
51278
- function vr(r6) {
51278
+ function Tr(r6) {
51279
51279
  let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
51280
- _n(t);
51281
- for (let n of t) Tr(n);
51280
+ Ln(t);
51281
+ for (let n of t) Sr(n);
51282
51282
  }
51283
- function Tr(r6) {
51283
+ function Sr(r6) {
51284
51284
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
51285
51285
  if (r6.resourceType !== "StructureDefinition") return;
51286
- let e = gr(r6), t = go[r6.url], n, i;
51287
- t ? (n = fe, 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 = fe, i = r6.type) : (n = On(r6.url), i = r6.type), n[i] = e;
51286
+ let e = xr(r6), t = xo[r6.url], n, i;
51287
+ t ? (n = fe, 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 = fe, i = r6.type) : (n = In(r6.url), i = r6.type), n[i] = e;
51288
51288
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
51289
- xr[r6.url] = e;
51289
+ vr[r6.url] = e;
51290
51290
  }
51291
- function kn(r6) {
51291
+ function Vn(r6) {
51292
51292
  return !!fe[r6];
51293
51293
  }
51294
51294
  function We(r6, e) {
51295
51295
  if (e) {
51296
- let t = On(e)[r6];
51296
+ let t = In(e)[r6];
51297
51297
  if (t) return t;
51298
51298
  }
51299
51299
  return fe[r6];
51300
51300
  }
51301
- function Dn(r6) {
51302
- return !!xr[r6];
51301
+ function Mn(r6) {
51302
+ return !!vr[r6];
51303
51303
  }
51304
- var mr = class {
51304
+ var yr = class {
51305
51305
  constructor(e) {
51306
51306
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
51307
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: So(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
51307
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: bo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
51308
51308
  }
51309
51309
  parse() {
51310
51310
  let e = this.next();
@@ -51312,7 +51312,7 @@ var mr = class {
51312
51312
  if (e.sliceName) this.parseSliceStart(e);
51313
51313
  else if (e.id?.includes(":")) {
51314
51314
  if (this.slicingContext?.current) {
51315
- let t = hr(e, this.slicingContext.path);
51315
+ let t = mr(e, this.slicingContext.path);
51316
51316
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
51317
51317
  }
51318
51318
  } else {
@@ -51321,13 +51321,13 @@ var mr = class {
51321
51321
  let n = this.backboneContext;
51322
51322
  for (; n; ) {
51323
51323
  if (e.path?.startsWith(n.path + ".")) {
51324
- n.type.elements[hr(e, n.path)] = t;
51324
+ n.type.elements[mr(e, n.path)] = t;
51325
51325
  break;
51326
51326
  }
51327
51327
  n = n.parent;
51328
51328
  }
51329
51329
  if (!n) {
51330
- let i = hr(e, this.root.path);
51330
+ let i = mr(e, this.root.path);
51331
51331
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
51332
51332
  }
51333
51333
  this.checkFieldExit(e);
@@ -51341,11 +51341,11 @@ var mr = class {
51341
51341
  }
51342
51342
  enterInnerType(e) {
51343
51343
  for (; this.backboneContext && !ke(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
51344
- let t = yr(e);
51344
+ let t = gr(e);
51345
51345
  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: ke(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
51346
51346
  }
51347
51347
  enterSlice(e, t) {
51348
- To(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
51348
+ So(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
51349
51349
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
51350
51350
  return { path: n.path, type: n.type };
51351
51351
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
@@ -51381,44 +51381,44 @@ var mr = class {
51381
51381
  parseElementDefinitionType(e) {
51382
51382
  return (e.type ?? []).map((t) => {
51383
51383
  let n;
51384
- return (t.code === "BackboneElement" || t.code === "Element") && (n = yr(e)), n || (n = ne(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
51384
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = gr(e)), n || (n = ne(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
51385
51385
  });
51386
51386
  }
51387
51387
  parseElementDefinition(e) {
51388
- let t = wn(e.max), n = e.base?.max ? wn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
51389
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: An(P(i, "fixed[x]")), pattern: An(P(i, "pattern[x]")), binding: e.binding };
51388
+ let t = An(e.max), n = e.base?.max ? An(e.base.max) : t, i = { type: "ElementDefinition", value: e };
51389
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: On(P(i, "fixed[x]")), pattern: On(P(i, "pattern[x]")), binding: e.binding };
51390
51390
  }
51391
51391
  };
51392
- function wn(r6) {
51392
+ function An(r6) {
51393
51393
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
51394
51394
  }
51395
- function hr(r6, e = "") {
51396
- return vo(r6.path, e);
51395
+ function mr(r6, e = "") {
51396
+ return To(r6.path, e);
51397
51397
  }
51398
- function vo(r6, e) {
51398
+ function To(r6, e) {
51399
51399
  return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
51400
51400
  }
51401
51401
  function ke(r6, e) {
51402
51402
  return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
51403
51403
  }
51404
- function An(r6) {
51404
+ function On(r6) {
51405
51405
  return Array.isArray(r6) && r6.length > 0 ? r6[0] : S(r6) ? void 0 : r6;
51406
51406
  }
51407
- function To(r6) {
51407
+ function So(r6) {
51408
51408
  let e = r6.slicing?.discriminator;
51409
51409
  return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
51410
51410
  }
51411
- function So(r6) {
51411
+ function bo(r6) {
51412
51412
  let e = r6.description;
51413
51413
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
51414
51414
  }
51415
- var Ro = new we(1e3);
51415
+ var Co = new we(1e3);
51416
51416
  var dt = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\r\n\t\u0020-\uFFFF]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\r\n\t\u0020-\uFFFF]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
51417
51417
  function h(r6) {
51418
51418
  return [{ type: l.boolean, value: r6 }];
51419
51419
  }
51420
51420
  function v(r6) {
51421
- return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : w(r6) ? { type: l.Quantity, value: r6 } : O(r6) ? { type: r6.resourceType, value: r6 } : kr(r6) ? { type: l.CodeableConcept, value: r6 } : Ir(r6) ? { type: l.Coding, value: r6 } : { type: l.BackboneElement, value: r6 };
51421
+ return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : w(r6) ? { type: l.Quantity, value: r6 } : O(r6) ? { type: r6.resourceType, value: r6 } : Vr(r6) ? { type: l.CodeableConcept, value: r6 } : kr(r6) ? { type: l.Coding, value: r6 } : { type: l.BackboneElement, value: r6 };
51422
51422
  }
51423
51423
  function L(r6) {
51424
51424
  return r6.length === 0 ? false : !!r6[0].value;
@@ -51432,9 +51432,9 @@ function G(r6, e) {
51432
51432
  function P(r6, e, t) {
51433
51433
  if (!r6.value) return;
51434
51434
  let n = yt(r6.type, e, t?.profileUrl);
51435
- return n ? ko(r6, e, n) : Vo(r6, e);
51435
+ return n ? Vo(r6, e, n) : Do(r6, e);
51436
51436
  }
51437
- function ko(r6, e, t) {
51437
+ function Vo(r6, e, t) {
51438
51438
  let n = r6.value, i = t.type;
51439
51439
  if (!i || i.length === 0) return;
51440
51440
  let o, s = "undefined", a, c2 = t.path.lastIndexOf("."), u = t.path.substring(c2 + 1);
@@ -51447,14 +51447,14 @@ function ko(r6, e, t) {
51447
51447
  }
51448
51448
  if (a) if (Array.isArray(o)) {
51449
51449
  o = o.slice();
51450
- for (let d = 0; d < Math.max(o.length, a.length); d++) o[d] = Un(o[d], a[d]);
51451
- } else o = Un(o, a);
51452
- if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d) => Ln(d, s)) : Ln(o, s);
51450
+ for (let d = 0; d < Math.max(o.length, a.length); d++) o[d] = Bn(o[d], a[d]);
51451
+ } else o = Bn(o, a);
51452
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d) => Fn(d, s)) : Fn(o, s);
51453
51453
  }
51454
- function Ln(r6, e) {
51454
+ function Fn(r6, e) {
51455
51455
  return e === "Resource" && O(r6) && (e = r6.resourceType), { type: e, value: r6 };
51456
51456
  }
51457
- function Vo(r6, e) {
51457
+ function Do(r6, e) {
51458
51458
  let t = r6.value;
51459
51459
  if (!t || typeof t != "object") return;
51460
51460
  let n;
@@ -51489,27 +51489,27 @@ function ft(r6) {
51489
51489
  }
51490
51490
  return e;
51491
51491
  }
51492
- function Bn(r6) {
51492
+ function Wn(r6) {
51493
51493
  return h(!L(r6));
51494
51494
  }
51495
- function Wn(r6, e) {
51495
+ function qn(r6, e) {
51496
51496
  return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => L($e(t, e[n]))));
51497
51497
  }
51498
- function qn(r6, e) {
51498
+ function jn(r6, e) {
51499
51499
  return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !L($e(t, e[n]))));
51500
51500
  }
51501
51501
  function $e(r6, e) {
51502
51502
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
51503
- return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : w(t) && w(n) ? h(Gn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Or(r6, e) : t === n);
51503
+ return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : w(t) && w(n) ? h(Hn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Ir(r6, e) : t === n);
51504
51504
  }
51505
- function Ar(r6, e) {
51506
- return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Fn), e.sort(Fn), h(r6.every((t, n) => L(Do(t, e[n])))));
51505
+ function Or(r6, e) {
51506
+ return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Nn), e.sort(Nn), h(r6.every((t, n) => L(Mo(t, e[n])))));
51507
51507
  }
51508
- function Do(r6, e) {
51508
+ function Mo(r6, e) {
51509
51509
  let { type: t, value: n } = r6, { type: i, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
51510
- return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : w(s) && w(a) ? h(Gn(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" ? Or({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
51510
+ return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : w(s) && w(a) ? h(Hn(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" ? Ir({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
51511
51511
  }
51512
- function Fn(r6, e) {
51512
+ function Nn(r6, e) {
51513
51513
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
51514
51514
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
51515
51515
  }
@@ -51524,63 +51524,63 @@ function ht(r6, e) {
51524
51524
  case "Integer":
51525
51525
  return typeof t == "number";
51526
51526
  case "Date":
51527
- return jn(t);
51527
+ return $n(t);
51528
51528
  case "DateTime":
51529
51529
  return De(t);
51530
51530
  case "Time":
51531
51531
  return typeof t == "string" && !!/^T\d/.exec(t);
51532
51532
  case "Period":
51533
- return $n(t);
51533
+ return Gn(t);
51534
51534
  case "Quantity":
51535
51535
  return w(t);
51536
51536
  default:
51537
51537
  return r6.type === n || typeof t == "object" && t?.resourceType === n;
51538
51538
  }
51539
51539
  }
51540
- function jn(r6) {
51540
+ function $n(r6) {
51541
51541
  return typeof r6 == "string" && !!dt.date.exec(r6);
51542
51542
  }
51543
51543
  function De(r6) {
51544
51544
  return typeof r6 == "string" && !!dt.dateTime.exec(r6);
51545
51545
  }
51546
- function $n(r6) {
51546
+ function Gn(r6) {
51547
51547
  return !!(r6 && typeof r6 == "object" && ("start" in r6 && De(r6.start) || "end" in r6 && De(r6.end)));
51548
51548
  }
51549
51549
  function w(r6) {
51550
51550
  return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
51551
51551
  }
51552
- function Gn(r6, e) {
51552
+ function Hn(r6, e) {
51553
51553
  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);
51554
51554
  }
51555
- function Or(r6, e) {
51555
+ function Ir(r6, e) {
51556
51556
  let t = Object.keys(r6), n = Object.keys(e);
51557
51557
  if (t.length !== n.length) return false;
51558
51558
  for (let i of t) {
51559
51559
  let o = r6[i], s = e[i];
51560
- if (Nn(o) && Nn(s)) {
51561
- if (!Or(o, s)) return false;
51560
+ if (Un(o) && Un(s)) {
51561
+ if (!Ir(o, s)) return false;
51562
51562
  } else if (o !== s) return false;
51563
51563
  }
51564
51564
  return true;
51565
51565
  }
51566
- function Nn(r6) {
51566
+ function Un(r6) {
51567
51567
  return r6 !== null && typeof r6 == "object";
51568
51568
  }
51569
- function Un(r6, e) {
51569
+ function Bn(r6, e) {
51570
51570
  if (e) {
51571
51571
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
51572
- return Mo(r6 ?? {}, e);
51572
+ return _o(r6 ?? {}, e);
51573
51573
  }
51574
51574
  return r6;
51575
51575
  }
51576
- function Mo(r6, e) {
51576
+ function _o(r6, e) {
51577
51577
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
51578
51578
  }
51579
51579
  function He(r6, e) {
51580
51580
  return O(r6, e) && "id" in r6 && typeof r6.id == "string";
51581
51581
  }
51582
51582
  function he(r6) {
51583
- let e = D(r6) ?? "undefined/undefined", t = Lo(r6);
51583
+ let e = D(r6) ?? "undefined/undefined", t = Fo(r6);
51584
51584
  return t === e ? { reference: e } : { reference: e, display: t };
51585
51585
  }
51586
51586
  function D(r6) {
@@ -51590,16 +51590,16 @@ function D(r6) {
51590
51590
  function me(r6) {
51591
51591
  if (r6) return W(r6) ? r6.reference.split("/")[1] : r6.id;
51592
51592
  }
51593
- function _o(r6) {
51593
+ function Lo(r6) {
51594
51594
  return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
51595
51595
  }
51596
- function Lo(r6) {
51597
- if (_o(r6)) {
51598
- let e = Fo(r6);
51596
+ function Fo(r6) {
51597
+ if (Lo(r6)) {
51598
+ let e = No(r6);
51599
51599
  if (e) return e;
51600
51600
  }
51601
51601
  if (r6.resourceType === "Device") {
51602
- let e = No(r6);
51602
+ let e = Uo(r6);
51603
51603
  if (e) return e;
51604
51604
  }
51605
51605
  if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ge(r6.medicationCodeableConcept);
@@ -51608,16 +51608,16 @@ function Lo(r6) {
51608
51608
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
51609
51609
  if ("code" in r6 && r6.code) {
51610
51610
  let e = r6.code;
51611
- if (Array.isArray(e) && (e = e[0]), kr(e)) return Ge(e);
51612
- if (Ho(e)) return e.text;
51611
+ if (Array.isArray(e) && (e = e[0]), Vr(e)) return Ge(e);
51612
+ if (Qo(e)) return e.text;
51613
51613
  }
51614
51614
  return D(r6) ?? "";
51615
51615
  }
51616
- function Fo(r6) {
51616
+ function No(r6) {
51617
51617
  let e = r6.name;
51618
51618
  if (e && e.length > 0) return Qe(e[0]);
51619
51619
  }
51620
- function No(r6) {
51620
+ function Uo(r6) {
51621
51621
  let e = r6.deviceName;
51622
51622
  if (e && e.length > 0) return e[0].name;
51623
51623
  }
@@ -51639,26 +51639,26 @@ function ne(r6, ...e) {
51639
51639
  return t;
51640
51640
  }
51641
51641
  function xt(r6, e) {
51642
- let t = Dr(r6);
51642
+ let t = Mr(r6);
51643
51643
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
51644
51644
  }
51645
- function Dr(r6) {
51646
- if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Bo(r6) : Wo(r6) : r6;
51645
+ function Mr(r6) {
51646
+ if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Wo(r6) : qo(r6) : r6;
51647
51647
  }
51648
- function Bo(r6) {
51648
+ function Wo(r6) {
51649
51649
  let e = r6.length;
51650
51650
  if (e === 0) return;
51651
51651
  let t, n = 0;
51652
51652
  for (let i = 0; i < e; i++) {
51653
- let o = r6[i], s = Dr(o);
51653
+ let o = r6[i], s = Mr(o);
51654
51654
  s !== o && !t && (t = Array.from(r6)), s === void 0 ? t && (t[i] = null) : (t && (t[i] = s), n++);
51655
51655
  }
51656
51656
  if (n !== 0) return t ?? r6;
51657
51657
  }
51658
- function Wo(r6) {
51658
+ function qo(r6) {
51659
51659
  let e, t = 0;
51660
51660
  for (let n in r6) {
51661
- let i = r6[n], o = Dr(i);
51661
+ let i = r6[n], o = Mr(i);
51662
51662
  o !== i && !e && (e = { ...r6 }), o === void 0 ? e && delete e[n] : (e && (e[n] = o), t++);
51663
51663
  }
51664
51664
  if (t !== 0) return e ?? r6;
@@ -51674,14 +51674,14 @@ function X(r6) {
51674
51674
  return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
51675
51675
  }
51676
51676
  function ie(r6, e, t) {
51677
- return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? qo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : R(r6) && R(e) ? jo(r6, e, t) : (R(r6) || R(e), false);
51677
+ return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? jo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : R(r6) && R(e) ? $o(r6, e, t) : (R(r6) || R(e), false);
51678
51678
  }
51679
- function qo(r6, e) {
51679
+ function jo(r6, e) {
51680
51680
  if (r6.length !== e.length) return false;
51681
51681
  for (let t = 0; t < r6.length; t++) if (!ie(r6[t], e[t])) return false;
51682
51682
  return true;
51683
51683
  }
51684
- function jo(r6, e, t) {
51684
+ function $o(r6, e, t) {
51685
51685
  let n = /* @__PURE__ */ new Set();
51686
51686
  Object.keys(r6).forEach((i) => n.add(i)), Object.keys(e).forEach((i) => n.add(i)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
51687
51687
  for (let i of n) {
@@ -51693,63 +51693,63 @@ function jo(r6, e, t) {
51693
51693
  function R(r6) {
51694
51694
  return r6 !== null && typeof r6 == "object";
51695
51695
  }
51696
- function Jn(r6) {
51696
+ function Kn(r6) {
51697
51697
  return r6.every(vt);
51698
51698
  }
51699
51699
  function vt(r6) {
51700
51700
  return typeof r6 == "string";
51701
51701
  }
51702
- function Ir(r6) {
51702
+ function kr(r6) {
51703
51703
  return R(r6) && "code" in r6 && typeof r6.code == "string";
51704
51704
  }
51705
- function kr(r6) {
51706
- return R(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(Ir);
51705
+ function Vr(r6) {
51706
+ return R(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(kr);
51707
51707
  }
51708
- function Ho(r6) {
51708
+ function Qo(r6) {
51709
51709
  return R(r6) && "text" in r6 && typeof r6.text == "string";
51710
51710
  }
51711
- var Kn = [];
51712
- for (let r6 = 0; r6 < 256; r6++) Kn.push(r6.toString(16).padStart(2, "0"));
51713
- function Xn(r6) {
51714
- let e = Zn(r6), t = new Uint8Array(e), n = new Array(t.length);
51715
- for (let i = 0; i < t.length; i++) n[i] = Kn[t[i]];
51711
+ var Xn = [];
51712
+ for (let r6 = 0; r6 < 256; r6++) Xn.push(r6.toString(16).padStart(2, "0"));
51713
+ function Yn(r6) {
51714
+ let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
51715
+ for (let i = 0; i < t.length; i++) n[i] = Xn[t[i]];
51716
51716
  return n.join("");
51717
51717
  }
51718
- function Yn(r6) {
51719
- let e = Zn(r6), t = new Uint8Array(e), n = new Array(t.length);
51718
+ function Zn(r6) {
51719
+ let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
51720
51720
  for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
51721
51721
  return window.btoa(n.join(""));
51722
51722
  }
51723
- function Zn(r6) {
51723
+ function ei(r6) {
51724
51724
  return ArrayBuffer.isView(r6) ? r6.buffer : r6;
51725
51725
  }
51726
51726
  function k(r6) {
51727
51727
  return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
51728
51728
  }
51729
- var _r = (r6) => new Promise((e) => {
51729
+ var Lr = (r6) => new Promise((e) => {
51730
51730
  setTimeout(e, r6);
51731
51731
  });
51732
51732
  function Tt(r6) {
51733
51733
  return r6.sort((e, t) => e.localeCompare(t));
51734
51734
  }
51735
- function Fr(r6) {
51735
+ function Nr(r6) {
51736
51736
  return r6.endsWith("/") ? r6 : r6 + "/";
51737
51737
  }
51738
- function Zo(r6) {
51738
+ function es(r6) {
51739
51739
  return r6.startsWith("/") ? r6.slice(1) : r6;
51740
51740
  }
51741
51741
  function q(r6, e) {
51742
- return new URL(Zo(e), Fr(r6.toString())).toString();
51742
+ return new URL(es(e), Nr(r6.toString())).toString();
51743
51743
  }
51744
- function ni(r6, e) {
51744
+ function ii(r6, e) {
51745
51745
  return q(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
51746
51746
  }
51747
- function ii(r6) {
51747
+ function oi(r6) {
51748
51748
  return typeof r6 == "object" && !Array.isArray(r6) && !(r6 instanceof URLSearchParams) && (r6 = Object.fromEntries(Object.entries(r6).filter((e) => e[1] !== void 0))), new URLSearchParams(r6).toString();
51749
51749
  }
51750
- var es = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
51751
- function Vl(r6) {
51752
- return es.test(r6);
51750
+ var ts = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
51751
+ function Dl(r6) {
51752
+ return ts.test(r6);
51753
51753
  }
51754
51754
  function Qe(r6, e) {
51755
51755
  if (!r6) return "";
@@ -51763,9 +51763,9 @@ function Qe(r6, e) {
51763
51763
  function Ge(r6) {
51764
51764
  if (!r6) return "";
51765
51765
  let e = ge(r6.text);
51766
- return e || (r6.coding ? r6.coding.map((t) => si(t)).join(", ") : "");
51766
+ return e || (r6.coding ? r6.coding.map((t) => ai(t)).join(", ") : "");
51767
51767
  }
51768
- function si(r6, e) {
51768
+ function ai(r6, e) {
51769
51769
  let t = ge(r6?.display);
51770
51770
  if (t) {
51771
51771
  let n = e ? ge(r6?.code) : void 0;
@@ -51777,32 +51777,32 @@ function ge(r6) {
51777
51777
  return typeof r6 == "string" ? r6 : void 0;
51778
51778
  }
51779
51779
  var l = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
51780
- function _n(r6) {
51780
+ function Ln(r6) {
51781
51781
  let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
51782
- for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ui(t.type);
51782
+ for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && li(t.type);
51783
51783
  }
51784
- function ui(r6) {
51784
+ function li(r6) {
51785
51785
  let e = F.types[r6];
51786
51786
  return e || (e = { searchParamsDetails: {} }, F.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" } }), e;
51787
51787
  }
51788
- function Br(r6) {
51788
+ function Wr(r6) {
51789
51789
  for (let e of r6.base ?? []) {
51790
- let t = ui(e);
51790
+ let t = li(e);
51791
51791
  t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
51792
51792
  }
51793
51793
  }
51794
- function yr(r6) {
51794
+ function gr(r6) {
51795
51795
  let e = r6.type?.[0]?.code;
51796
- return e === "BackboneElement" || e === "Element" ? ds((r6.base?.path ?? r6.path)?.split(".")) : e;
51796
+ return e === "BackboneElement" || e === "Element" ? ps((r6.base?.path ?? r6.path)?.split(".")) : e;
51797
51797
  }
51798
- function ds(r6) {
51798
+ function ps(r6) {
51799
51799
  return r6.length === 1 ? r6[0] : r6.map(k).join("");
51800
51800
  }
51801
51801
  function yt(r6, e, t) {
51802
51802
  let n = We(r6, t);
51803
- if (n) return ms(n.elements, e);
51803
+ if (n) return ys(n.elements, e);
51804
51804
  }
51805
- function ms(r6, e) {
51805
+ function ys(r6, e) {
51806
51806
  let t = r6[e] ?? r6[e + "[x]"];
51807
51807
  if (t) return t;
51808
51808
  for (let n = 0; n < e.length; n++) {
@@ -52141,7 +52141,7 @@ var Pt = class extends C {
52141
52141
  }
52142
52142
  eval(e, t) {
52143
52143
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
52144
- return Wn(n, i);
52144
+ return qn(n, i);
52145
52145
  }
52146
52146
  };
52147
52147
  var wt = class extends C {
@@ -52150,7 +52150,7 @@ var wt = class extends C {
52150
52150
  }
52151
52151
  eval(e, t) {
52152
52152
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
52153
- return qn(n, i);
52153
+ return jn(n, i);
52154
52154
  }
52155
52155
  };
52156
52156
  var At = class extends C {
@@ -52159,7 +52159,7 @@ var At = class extends C {
52159
52159
  }
52160
52160
  eval(e, t) {
52161
52161
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
52162
- return Ar(n, i);
52162
+ return Or(n, i);
52163
52163
  }
52164
52164
  };
52165
52165
  var Ot = class extends C {
@@ -52168,7 +52168,7 @@ var Ot = class extends C {
52168
52168
  }
52169
52169
  eval(e, t) {
52170
52170
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
52171
- return Bn(Ar(n, i));
52171
+ return Wn(Or(n, i));
52172
52172
  }
52173
52173
  };
52174
52174
  var Te = class extends C {
@@ -52249,37 +52249,37 @@ var Se = class {
52249
52249
  };
52250
52250
  var Je = ["!=", "!~", "<=", ">=", "{}", "->"];
52251
52251
  var g = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
52252
- var xs = { parse(r6) {
52252
+ var vs = { parse(r6) {
52253
52253
  let e = r6.consumeAndParse();
52254
52254
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
52255
52255
  return e;
52256
52256
  } };
52257
- var vs = { parse(r6, e) {
52257
+ var Ts = { parse(r6, e) {
52258
52258
  let t = r6.consumeAndParse();
52259
52259
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
52260
52260
  return new Se(e, t);
52261
52261
  }, precedence: g.Indexer };
52262
- var Ts = { parse(r6, e) {
52262
+ var Ss = { parse(r6, e) {
52263
52263
  if (!(e instanceof j)) throw new Error("Unexpected parentheses");
52264
52264
  let t = [];
52265
52265
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
52266
52266
  return new Z(e.name, t);
52267
52267
  }, precedence: g.FunctionCall };
52268
- function Ss(r6) {
52268
+ function bs(r6) {
52269
52269
  let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
52270
52270
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
52271
52271
  }
52272
52272
  function Ke() {
52273
- return new ot().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: _e(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value: Ss(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new j(e.value) }).registerPrefix("{}", { parse: () => new St() }).registerPrefix("(", xs).registerInfix("[", vs).registerInfix("(", Ts).prefix("+", g.UnaryAdd, (r6, e) => new bt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new V("/", r6, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r6, e, t) => new V("*", r6, t, (n, i) => n * i)).infixLeft("+", g.Add, (r6, e, t) => new V("+", r6, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r6, e, t) => new V("-", r6, t, (n, i) => n - i)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new Pt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new wt(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new At(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ot(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new V("<", r6, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new V("<=", r6, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r6, e, t) => new V(">", r6, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new V(">=", r6, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r6, e, t) => new Et(r6, t)).infixLeft("and", g.And, (r6, e, t) => new It(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Rt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new V("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r6, e, t) => new Ct(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new V("mod", r6, t, (n, i) => n % i)).infixLeft("or", g.Or, (r6, e, t) => new kt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new Vt(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Dt(r6, t));
52273
+ return new ot().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: _e(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value: bs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new j(e.value) }).registerPrefix("{}", { parse: () => new St() }).registerPrefix("(", vs).registerInfix("[", Ts).registerInfix("(", Ss).prefix("+", g.UnaryAdd, (r6, e) => new bt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new V("/", r6, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r6, e, t) => new V("*", r6, t, (n, i) => n * i)).infixLeft("+", g.Add, (r6, e, t) => new V("+", r6, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r6, e, t) => new V("-", r6, t, (n, i) => n - i)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new Pt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new wt(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new At(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ot(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new V("<", r6, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new V("<=", r6, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r6, e, t) => new V(">", r6, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new V(">=", r6, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r6, e, t) => new Et(r6, t)).infixLeft("and", g.And, (r6, e, t) => new It(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Rt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new V("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r6, e, t) => new Ct(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new V("mod", r6, t, (n, i) => n % i)).infixLeft("or", g.Or, (r6, e, t) => new kt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new Vt(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Dt(r6, t));
52274
52274
  }
52275
- var bs = Ke();
52275
+ var Es = Ke();
52276
52276
  var f = { 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" };
52277
- var Ti = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
52278
- var Wr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
52279
- var Is = [f.MISSING, f.PRESENT];
52277
+ var Si = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
52278
+ var qr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
52279
+ var ks = [f.MISSING, f.PRESENT];
52280
52280
  var Ee = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
52281
- var Ks = [Ee.READ, Ee.VREAD, Ee.HISTORY, Ee.SEARCH];
52282
- function Zs(r6) {
52281
+ var Xs = [Ee.READ, Ee.VREAD, Ee.HISTORY, Ee.SEARCH];
52282
+ function ea(r6) {
52283
52283
  if (typeof window < "u") {
52284
52284
  let e = window.atob(r6), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
52285
52285
  return new window.TextDecoder().decode(t);
@@ -52295,16 +52295,16 @@ function Ft(r6) {
52295
52295
  if (typeof Buffer < "u") return Buffer.from(r6, "utf8").toString("base64");
52296
52296
  throw new Error("Unable to encode base64");
52297
52297
  }
52298
- function Ei(r6) {
52298
+ function Ri(r6) {
52299
52299
  r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
52300
52300
  let e = r6.replace(/-/g, "+").replace(/_/g, "/");
52301
- return Zs(e);
52301
+ return ea(e);
52302
52302
  }
52303
- function qr() {
52303
+ function jr() {
52304
52304
  let r6 = new Uint32Array(28);
52305
- return crypto.getRandomValues(r6), Xn(r6.buffer);
52305
+ return crypto.getRandomValues(r6), Yn(r6.buffer);
52306
52306
  }
52307
- async function Ri(r6) {
52307
+ async function Ci(r6) {
52308
52308
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
52309
52309
  }
52310
52310
  function Re() {
@@ -52314,7 +52314,7 @@ function Re() {
52314
52314
  });
52315
52315
  }
52316
52316
  var A = { 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" };
52317
- var jr = class {
52317
+ var $r = class {
52318
52318
  constructor() {
52319
52319
  this.listeners = {};
52320
52320
  }
@@ -52341,7 +52341,7 @@ var jr = class {
52341
52341
  };
52342
52342
  var J = class {
52343
52343
  constructor() {
52344
- this.emitter = new jr();
52344
+ this.emitter = new $r();
52345
52345
  }
52346
52346
  dispatchEvent(e) {
52347
52347
  this.emitter.dispatchEvent(e);
@@ -52356,68 +52356,68 @@ var J = class {
52356
52356
  this.emitter.removeAllListeners();
52357
52357
  }
52358
52358
  };
52359
- var $r = { "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" };
52360
- var oa = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
52361
- var Gr = ["DiagnosticReport-update"];
52362
- function Pi(r6) {
52363
- return Gr.includes(r6);
52364
- }
52359
+ var Gr = { "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" };
52360
+ var sa = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
52361
+ var Hr = ["DiagnosticReport-update"];
52365
52362
  function wi(r6) {
52366
- if (Gr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
52367
- }
52368
- var sa = { "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" } } };
52369
- function aa(r6) {
52370
- return oa.includes(r6);
52363
+ return Hr.includes(r6);
52371
52364
  }
52372
52365
  function Ai(r6) {
52366
+ if (Hr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
52367
+ }
52368
+ var aa = { "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" } } };
52369
+ function ca(r6) {
52370
+ return sa.includes(r6);
52371
+ }
52372
+ function Oi(r6) {
52373
52373
  return !!r6.endpoint;
52374
52374
  }
52375
- function Hr(r6) {
52375
+ function Qr(r6) {
52376
52376
  if (!Ut(r6)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
52377
52377
  let { channelType: e, mode: t, topic: n, events: i } = r6, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
52378
- return Ai(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
52378
+ return Oi(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
52379
52379
  }
52380
52380
  function Ut(r6) {
52381
52381
  if (typeof r6 != "object") return false;
52382
52382
  let { channelType: e, mode: t, topic: n, events: i } = r6;
52383
52383
  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;
52384
- for (let o of i) if (!$r[o]) return false;
52385
- return !(Ai(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
52384
+ for (let o of i) if (!Gr[o]) return false;
52385
+ return !(Oi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
52386
52386
  }
52387
- function ca(r6, e, t, n) {
52387
+ function ua(r6, e, t, n) {
52388
52388
  if (typeof e != "object") throw new p(y(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
52389
52389
  if (!(e.id && typeof e.id == "string")) throw new p(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
52390
52390
  if (!e.resourceType) throw new p(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
52391
52391
  let i = n.resourceType;
52392
52392
  if (i !== "*") {
52393
- if (!aa(e.resourceType)) throw new p(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
52393
+ if (!ca(e.resourceType)) throw new p(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
52394
52394
  if (i && e.resourceType !== i) throw new p(y(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i}.`));
52395
52395
  }
52396
52396
  }
52397
- function ua(r6, e, t, n, i) {
52397
+ function la(r6, e, t, n, i) {
52398
52398
  if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
52399
52399
  if (!W(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
52400
- } else ca(r6, e.resource, t, n);
52400
+ } else ua(r6, e.resource, t, n);
52401
52401
  }
52402
- function la(r6, e) {
52403
- let t = /* @__PURE__ */ new Map(), n = sa[r6];
52402
+ function da(r6, e) {
52403
+ let t = /* @__PURE__ */ new Map(), n = aa[r6];
52404
52404
  for (let i = 0; i < e.length; i++) {
52405
52405
  let o = e[i].key;
52406
52406
  if (!n[o]) throw new p(y(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
52407
- ua(r6, e[i], i, n[o], t);
52407
+ la(r6, e[i], i, n[o], t);
52408
52408
  }
52409
52409
  for (let [i, o] of Object.entries(n)) {
52410
52410
  if (!(o.optional || t.has(i))) throw new p(y(`Missing required key '${i}' on context for '${r6}' event.`));
52411
52411
  if (!o.manyAllowed && (t.get(i) ?? 0) > 1) throw new p(y(`${t.get(i)} context entries with key '${i}' found for the '${r6}' event when schema only allows for 1.`));
52412
52412
  }
52413
52413
  }
52414
- function Qr(r6, e, t, n) {
52414
+ function zr(r6, e, t, n) {
52415
52415
  if (!(r6 && typeof r6 == "string")) throw new p(y("Must provide a topic."));
52416
- if (!$r[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys($r).join(", ")}`));
52416
+ if (!Gr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Gr).join(", ")}`));
52417
52417
  if (typeof t != "object") throw new p(y("context must be a context object or array of context objects."));
52418
- if (Gr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
52418
+ if (Hr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
52419
52419
  let i = Array.isArray(t) ? t : [t];
52420
- return la(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Re(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
52420
+ return da(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Re(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
52421
52421
  }
52422
52422
  var Nt = class extends J {
52423
52423
  constructor(e) {
@@ -52439,24 +52439,24 @@ var Nt = class extends J {
52439
52439
  this.websocket.close();
52440
52440
  }
52441
52441
  };
52442
- function da(r6) {
52443
- return JSON.parse(Ei(r6));
52442
+ function pa(r6) {
52443
+ return JSON.parse(Ri(r6));
52444
52444
  }
52445
- function Oi(r6) {
52445
+ function Ii(r6) {
52446
52446
  return r6.split(".").length === 3;
52447
52447
  }
52448
52448
  function Bt(r6) {
52449
52449
  let [e, t, n] = r6.split(".");
52450
- return da(t);
52450
+ return pa(t);
52451
52451
  }
52452
- function Ii(r6) {
52452
+ function ki(r6) {
52453
52453
  try {
52454
52454
  return typeof Bt(r6).login_id == "string";
52455
52455
  } catch {
52456
52456
  return false;
52457
52457
  }
52458
52458
  }
52459
- function ki(r6) {
52459
+ function Vi(r6) {
52460
52460
  try {
52461
52461
  let t = Bt(r6).exp;
52462
52462
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -52478,11 +52478,11 @@ var Wt = class {
52478
52478
  await this.medplum.delete(`keyvalue/v1/${e}`);
52479
52479
  }
52480
52480
  };
52481
- var Vi;
52482
- Vi = Symbol.toStringTag;
52481
+ var Di;
52482
+ Di = Symbol.toStringTag;
52483
52483
  var M = class {
52484
52484
  constructor(e) {
52485
- this[Vi] = "ReadablePromise";
52485
+ this[Di] = "ReadablePromise";
52486
52486
  this.status = "pending";
52487
52487
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
52488
52488
  throw this.status = "error", this.error = t, t;
@@ -52516,7 +52516,7 @@ var M = class {
52516
52516
  };
52517
52517
  var Ze = class {
52518
52518
  constructor(e) {
52519
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new zr());
52519
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Jr());
52520
52520
  }
52521
52521
  clear() {
52522
52522
  this.storage.clear();
@@ -52535,7 +52535,7 @@ var Ze = class {
52535
52535
  this.setString(e, t ? xt(t) : void 0);
52536
52536
  }
52537
52537
  };
52538
- var zr = class {
52538
+ var Jr = class {
52539
52539
  constructor() {
52540
52540
  this.data = /* @__PURE__ */ new Map();
52541
52541
  }
@@ -52559,8 +52559,8 @@ var zr = class {
52559
52559
  }
52560
52560
  };
52561
52561
  var Ne = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
52562
- var Mi = false;
52563
- function pa() {
52562
+ var _i = false;
52563
+ function fa() {
52564
52564
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
52565
52565
  Ne.Event = globalThis.Event, Ne.ErrorEvent = class extends Event {
52566
52566
  constructor(e, t) {
@@ -52574,17 +52574,17 @@ function pa() {
52574
52574
  }
52575
52575
  };
52576
52576
  }
52577
- function fa(r6, e) {
52577
+ function ha(r6, e) {
52578
52578
  if (!r6) throw new Error(e);
52579
52579
  }
52580
52580
  function qt(r6) {
52581
52581
  return new r6.constructor(r6.type, r6);
52582
52582
  }
52583
52583
  var Ce = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
52584
- var _i = false;
52584
+ var Li = false;
52585
52585
  var jt = class r extends J {
52586
52586
  constructor(t, n, i = {}) {
52587
- Mi || (pa(), Mi = true);
52587
+ _i || (fa(), _i = true);
52588
52588
  super();
52589
52589
  this._retryCount = -1;
52590
52590
  this._shouldReconnect = true;
@@ -52599,7 +52599,7 @@ var jt = class r extends J {
52599
52599
  this._handleOpen = (t2) => {
52600
52600
  this._debug("open event");
52601
52601
  let { minUptime: n2 = Ce.minUptime } = this._options;
52602
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), fa(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(qt(t2));
52602
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ha(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(qt(t2));
52603
52603
  };
52604
52604
  this._handleMessage = (t2) => {
52605
52605
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(qt(t2));
@@ -52709,7 +52709,7 @@ var jt = class r extends J {
52709
52709
  this._connectLock = false;
52710
52710
  return;
52711
52711
  }
52712
- !this._options.WebSocket && typeof WebSocket > "u" && !_i && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), _i = true);
52712
+ !this._options.WebSocket && typeof WebSocket > "u" && !Li && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Li = true);
52713
52713
  let i = this._options.WebSocket || WebSocket;
52714
52714
  this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i(this._url, this._protocols) : new i(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
52715
52715
  }).catch((i) => {
@@ -52741,7 +52741,7 @@ var jt = class r extends J {
52741
52741
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
52742
52742
  }
52743
52743
  };
52744
- var ha = 5e3;
52744
+ var ma = 5e3;
52745
52745
  var et = class extends J {
52746
52746
  constructor(...e) {
52747
52747
  super(), this.criteria = new Set(e);
@@ -52756,7 +52756,7 @@ var et = class extends J {
52756
52756
  this.criteria.delete(e);
52757
52757
  }
52758
52758
  };
52759
- var Jr = class {
52759
+ var Kr = class {
52760
52760
  constructor(e, t) {
52761
52761
  this.connecting = false;
52762
52762
  this.criteria = e, this.emitter = new et(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
@@ -52777,7 +52777,7 @@ var $t = class {
52777
52777
  throw new p(y("Not a valid URL"));
52778
52778
  }
52779
52779
  let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new jt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
52780
- this.medplum = e, this.ws = o, this.masterSubEmitter = new et(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ha, this.currentProfile = e.getProfile(), this.setupListeners();
52780
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new et(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ma, this.currentProfile = e.getProfile(), this.setupListeners();
52781
52781
  }
52782
52782
  setupListeners() {
52783
52783
  let e = this.ws;
@@ -52818,7 +52818,7 @@ var $t = class {
52818
52818
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i });
52819
52819
  }
52820
52820
  }), e.addEventListener("error", () => {
52821
- let t = { type: "error", payload: new p(vn(new Error("WebSocket error"))) };
52821
+ let t = { type: "error", payload: new p(Tn(new Error("WebSocket error"))) };
52822
52822
  this.masterSubEmitter?.dispatchEvent(t);
52823
52823
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
52824
52824
  }), e.addEventListener("close", () => {
@@ -52908,7 +52908,7 @@ var $t = class {
52908
52908
  this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
52909
52909
  let n = this.maybeGetCriteriaEntry(e, t);
52910
52910
  if (n) return n.refCount += 1, n.emitter;
52911
- let i = new Jr(e, t);
52911
+ let i = new Kr(e, t);
52912
52912
  return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
52913
52913
  }
52914
52914
  removeCriteria(e, t) {
@@ -52935,24 +52935,24 @@ var $t = class {
52935
52935
  return this.masterSubEmitter || (this.masterSubEmitter = new et(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
52936
52936
  }
52937
52937
  };
52938
- var Kr = "4.3.12-5e839d331";
52939
- var ga = A.FHIR_JSON + ", */*; q=0.1";
52940
- var xa = "https://api.medplum.com/";
52941
- var va = 1e3;
52942
- var Ta = 6e4;
52943
- var Sa = 0;
52944
- var ba = 3e5;
52945
- var Ea = "Binary/";
52946
- var Li = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
52938
+ var Xr = "4.3.13-a753654fa";
52939
+ var xa = A.FHIR_JSON + ", */*; q=0.1";
52940
+ var va = "https://api.medplum.com/";
52941
+ var Ta = 1e3;
52942
+ var Sa = 6e4;
52943
+ var ba = 0;
52944
+ var Ea = 3e5;
52945
+ var Ra = "Binary/";
52946
+ var Fi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
52947
52947
  var Ue = { ClientCredentials: "client_credentials", AuthorizationCode: "authorization_code", RefreshToken: "refresh_token", JwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer", TokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange" };
52948
- var Ra = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
52949
- var Ca = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
52948
+ var Ca = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
52949
+ var Pa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
52950
52950
  var Gt = class extends J {
52951
52951
  constructor(t) {
52952
52952
  super();
52953
52953
  this.initComplete = true;
52954
52954
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
52955
- this.options = t ?? {}, this.fetch = t?.fetch ?? Pa(), this.storage = t?.storage ?? new Ze(), this.createPdfImpl = t?.createPdf, this.baseUrl = Fr(t?.baseUrl ?? xa), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), 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 ?? ba, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? Sa : Ta), this.cacheTime > 0 ? this.requestCache = new we(t?.resourceCacheSize ?? va) : 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(() => {
52955
+ this.options = t ?? {}, this.fetch = t?.fetch ?? wa(), this.storage = t?.storage ?? new Ze(), this.createPdfImpl = t?.createPdf, this.baseUrl = Nr(t?.baseUrl ?? va), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), 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 ?? Ea, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? ba : Sa), this.cacheTime > 0 ? this.requestCache = new we(t?.resourceCacheSize ?? Ta) : 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(() => {
52956
52956
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
52957
52957
  }).catch((n) => {
52958
52958
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -53064,7 +53064,7 @@ var Gt = class extends J {
53064
53064
  }
53065
53065
  async exchangeExternalAccessToken(t, n) {
53066
53066
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
53067
- return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: Ra.AccessToken, client_id: n, subject_token: t });
53067
+ return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: Ca.AccessToken, client_id: n, subject_token: t });
53068
53068
  }
53069
53069
  getExternalAuthRedirectUri(t, n, i, o, s = true) {
53070
53070
  let a = new URL(t);
@@ -53081,7 +53081,7 @@ var Gt = class extends J {
53081
53081
  }
53082
53082
  fhirSearchUrl(t, n) {
53083
53083
  let i = this.fhirUrl(t);
53084
- return n && (i.search = ii(n)), i;
53084
+ return n && (i.search = oi(n)), i;
53085
53085
  }
53086
53086
  search(t, n, i) {
53087
53087
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a = this.getCacheEntry(s, i);
@@ -53100,7 +53100,7 @@ var Gt = class extends J {
53100
53100
  searchResources(t, n, i) {
53101
53101
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i);
53102
53102
  if (a) return a.value;
53103
- let c2 = new M(this.search(t, n, i).then(Ui));
53103
+ let c2 = new M(this.search(t, n, i).then(Bi));
53104
53104
  return this.setCacheEntry(s, c2), c2;
53105
53105
  }
53106
53106
  async *searchResourcePages(t, n, i) {
@@ -53110,7 +53110,7 @@ var Gt = class extends J {
53110
53110
  s.has("_count") || s.set("_count", "1000");
53111
53111
  let a = await this.search(t, s, i), c2 = a.link?.find((u) => u.relation === "next");
53112
53112
  if (!a.entry?.length && !c2) break;
53113
- yield Ui(a), o = c2?.url ? new URL(c2.url) : void 0;
53113
+ yield Bi(a), o = c2?.url ? new URL(c2.url) : void 0;
53114
53114
  }
53115
53115
  }
53116
53116
  valueSetExpand(t, n) {
@@ -53124,7 +53124,7 @@ var Gt = class extends J {
53124
53124
  getCachedReference(t) {
53125
53125
  let n = t.reference;
53126
53126
  if (!n) return;
53127
- if (n === "system") return Li;
53127
+ if (n === "system") return Fi;
53128
53128
  let [i, o] = n.split("/");
53129
53129
  if (!(!i || !o)) return this.getCached(i, o);
53130
53130
  }
@@ -53135,12 +53135,12 @@ var Gt = class extends J {
53135
53135
  readReference(t, n) {
53136
53136
  let i = t.reference;
53137
53137
  if (!i) return new M(Promise.reject(new Error("Missing reference")));
53138
- if (i === "system") return new M(Promise.resolve(Li));
53138
+ if (i === "system") return new M(Promise.resolve(Fi));
53139
53139
  let [o, s] = i.split("/");
53140
53140
  return !o || !s ? new M(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
53141
53141
  }
53142
53142
  requestSchema(t) {
53143
- if (kn(t)) return Promise.resolve();
53143
+ if (Vn(t)) return Promise.resolve();
53144
53144
  let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
53145
53145
  if (i) return i.value;
53146
53146
  let o = new M((async () => {
@@ -53185,13 +53185,13 @@ var Gt = class extends J {
53185
53185
  target
53186
53186
  }
53187
53187
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
53188
- vr(a.data.StructureDefinitionList);
53189
- for (let c2 of a.data.SearchParameterList) Br(c2);
53188
+ Tr(a.data.StructureDefinitionList);
53189
+ for (let c2 of a.data.SearchParameterList) Wr(c2);
53190
53190
  })());
53191
53191
  return this.setCacheEntry(n, o), o;
53192
53192
  }
53193
53193
  requestProfileSchema(t, n) {
53194
- if (!n?.expandProfile && Dn(t)) return Promise.resolve();
53194
+ if (!n?.expandProfile && Mn(t)) return Promise.resolve();
53195
53195
  let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i, void 0);
53196
53196
  if (o) return o.value;
53197
53197
  let s = new M((async () => {
@@ -53199,20 +53199,21 @@ var Gt = class extends J {
53199
53199
  let a = this.fhirUrl("StructureDefinition", "$expand-profile");
53200
53200
  a.search = new URLSearchParams({ url: t }).toString();
53201
53201
  let c2 = await this.post(a.toString(), {});
53202
- vr(c2);
53202
+ Tr(c2);
53203
53203
  } else {
53204
53204
  let a = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
53205
53205
  if (!a) {
53206
53206
  console.warn(`No StructureDefinition found for ${t}!`);
53207
53207
  return;
53208
53208
  }
53209
- Tr(a);
53209
+ Sr(a);
53210
53210
  }
53211
53211
  })());
53212
53212
  return this.setCacheEntry(i, s), s;
53213
53213
  }
53214
- readHistory(t, n, i) {
53215
- return this.get(this.fhirUrl(t, n, "_history"), i);
53214
+ readHistory(t, n, i, o) {
53215
+ let s = this.fhirUrl(t, n, "_history");
53216
+ return i?.count && s.searchParams.set("_count", i.count.toString()), i?.offset && s.searchParams.set("_offset", i.offset.toString()), this.get(s.toString(), o);
53216
53217
  }
53217
53218
  readVersion(t, n, i, o) {
53218
53219
  return this.get(this.fhirUrl(t, n, "_history", i), o);
@@ -53238,7 +53239,7 @@ var Gt = class extends J {
53238
53239
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
53239
53240
  }
53240
53241
  async createAttachment(t, n, i, o, s) {
53241
- let a = Bi(t, n, i, o);
53242
+ let a = Wi(t, n, i, o);
53242
53243
  if (a.contentType === A.XML) {
53243
53244
  let d = a.data, m2;
53244
53245
  d instanceof Blob ? m2 = await new Promise((x, B) => {
@@ -53256,7 +53257,7 @@ var Gt = class extends J {
53256
53257
  return { contentType: a.contentType, url: u.url, title: a.filename };
53257
53258
  }
53258
53259
  createBinary(t, n, i, o, s) {
53259
- let a = Bi(t, n, i, o), c2 = s ?? (typeof n == "object" ? n : {}), { data: u, contentType: d, filename: m2, securityContext: x, onProgress: B } = a, $ = this.fhirUrl("Binary");
53260
+ let a = Wi(t, n, i, o), c2 = s ?? (typeof n == "object" ? n : {}), { data: u, contentType: d, filename: m2, securityContext: x, onProgress: B } = a, $ = this.fhirUrl("Binary");
53260
53261
  return m2 && $.searchParams.set("_filename", m2), x?.reference && this.setRequestHeader(c2, "X-Security-Context", x.reference), B ? this.uploadwithProgress($, u, d, B, c2) : this.post($, u, d, c2);
53261
53262
  }
53262
53263
  uploadwithProgress(t, n, i, o, s) {
@@ -53277,7 +53278,7 @@ var Gt = class extends J {
53277
53278
  }
53278
53279
  async createPdf(t, n, i, o) {
53279
53280
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
53280
- let s = Oa(t, n, i, o), a = typeof n == "object" ? n : {}, { docDefinition: c2, tableLayouts: u, fonts: d, ...m2 } = s, x = await this.createPdfImpl(c2, u, d), B = { ...m2, data: x, contentType: "application/pdf" };
53281
+ let s = Ia(t, n, i, o), a = typeof n == "object" ? n : {}, { docDefinition: c2, tableLayouts: u, fonts: d, ...m2 } = s, x = await this.createPdfImpl(c2, u, d), B = { ...m2, data: x, contentType: "application/pdf" };
53281
53282
  return this.createBinary(B, a);
53282
53283
  }
53283
53284
  createComment(t, n, i) {
@@ -53340,7 +53341,7 @@ var Gt = class extends J {
53340
53341
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
53341
53342
  }
53342
53343
  setAccessToken(t, n) {
53343
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = ki(t), this.medplumServer = Ii(t);
53344
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Vi(t), this.medplumServer = ki(t);
53344
53345
  }
53345
53346
  getLogins() {
53346
53347
  return this.storage.getObject("logins") ?? [];
@@ -53388,7 +53389,7 @@ var Gt = class extends J {
53388
53389
  async download(t, n = {}) {
53389
53390
  this.refreshPromise && await this.refreshPromise;
53390
53391
  let i = t.toString();
53391
- i.startsWith(Ea) && (t = this.fhirUrl(i));
53392
+ i.startsWith(Ra) && (t = this.fhirUrl(i));
53392
53393
  let o = n.headers;
53393
53394
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
53394
53395
  }
@@ -53446,14 +53447,14 @@ var Gt = class extends J {
53446
53447
  if (s.status === 401) return this.handleUnauthenticated(t, n, i);
53447
53448
  if (s.status === 204 || s.status === 304) return;
53448
53449
  let c2 = s.headers.get("content-type")?.includes("json");
53449
- if (s.status === 404 && !c2) throw new p(gn);
53450
+ if (s.status === 404 && !c2) throw new p(xn);
53450
53451
  let u = await this.parseBody(s, c2);
53451
53452
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
53452
- let d = await Ni(s, u);
53453
+ let d = await Ui(s, u);
53453
53454
  if (d) return this.request("GET", d, { ...i, body: void 0 });
53454
53455
  }
53455
53456
  if (s.status === 202 && i.pollStatusOnAccepted) {
53456
- let m2 = await Ni(s, u) ?? o.statusUrl;
53457
+ let m2 = await Ui(s, u) ?? o.statusUrl;
53457
53458
  if (m2) return this.pollStatus(m2, i, o);
53458
53459
  }
53459
53460
  if (s.status >= 400) throw new p(ct(u));
@@ -53477,10 +53478,10 @@ var Gt = class extends J {
53477
53478
  for (let o = 0; o <= i; o++) try {
53478
53479
  this.options.verbose && this.logRequest(t, n);
53479
53480
  let s = await this.fetch(t, n);
53480
- if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i || !Ia(s)) return s;
53481
+ if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i || !ka(s)) return s;
53481
53482
  let a = this.getRetryDelay(o), c2 = n.maxRetryTime ?? 2e3;
53482
53483
  if (a > c2) return s;
53483
- await _r(a);
53484
+ await Lr(a);
53484
53485
  } catch (s) {
53485
53486
  if (s.message === "Failed to fetch" && o === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o === i) throw s;
53486
53487
  }
@@ -53520,7 +53521,7 @@ var Gt = class extends J {
53520
53521
  if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o.headers = { ...n.headers }, delete o.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
53521
53522
  else {
53522
53523
  let s = n.pollStatusPeriod ?? 1e3;
53523
- await _r(s), i.pollCount++;
53524
+ await Lr(s), i.pollCount++;
53524
53525
  }
53525
53526
  return this.request("GET", t, o, i);
53526
53527
  }
@@ -53539,13 +53540,13 @@ var Gt = class extends J {
53539
53540
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
53540
53541
  for (let o = 0; o < t.length; o++) {
53541
53542
  let s = t[o], a = i.entry?.[o];
53542
- a?.response?.outcome && !fr(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
53543
+ a?.response?.outcome && !hr(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
53543
53544
  }
53544
53545
  }
53545
53546
  addFetchOptionsDefaults(t) {
53546
53547
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
53547
53548
  this.setRequestHeader(t, n, i);
53548
- }), this.setRequestHeader(t, "Accept", ga, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", A.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
53549
+ }), this.setRequestHeader(t, "Accept", xa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", A.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
53549
53550
  }
53550
53551
  setRequestContentType(t, n) {
53551
53552
  this.setRequestHeader(t, "Content-Type", n);
@@ -53562,23 +53563,23 @@ var Gt = class extends J {
53562
53563
  return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(Ae)));
53563
53564
  }
53564
53565
  async startPkce() {
53565
- let t = qr();
53566
+ let t = jr();
53566
53567
  sessionStorage.setItem("pkceState", t);
53567
- let n = qr().slice(0, 128);
53568
+ let n = jr().slice(0, 128);
53568
53569
  sessionStorage.setItem("codeVerifier", n);
53569
53570
  try {
53570
- let i = await Ri(n);
53571
- return { codeChallengeMethod: "S256", codeChallenge: Yn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
53571
+ let i = await Ci(n);
53572
+ return { codeChallengeMethod: "S256", codeChallenge: Zn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
53572
53573
  } catch (i) {
53573
53574
  return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method", i), { codeChallengeMethod: "plain", codeChallenge: n };
53574
53575
  }
53575
53576
  }
53576
53577
  async requestAuthorization(t) {
53577
53578
  let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
53578
- i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? Fi()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
53579
+ i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? Ni()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
53579
53580
  }
53580
53581
  processCode(t, n) {
53581
- let i = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Fi() };
53582
+ let i = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Ni() };
53582
53583
  if (typeof sessionStorage < "u") {
53583
53584
  let o = sessionStorage.getItem("codeVerifier");
53584
53585
  o && (i.code_verifier = o);
@@ -53600,7 +53601,7 @@ var Gt = class extends J {
53600
53601
  return this.clientId = t, this.fetchTokens({ grant_type: Ue.JwtBearer, client_id: t, assertion: n, scope: i });
53601
53602
  }
53602
53603
  async startJwtAssertionLogin(t) {
53603
- return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: Ca.JwtBearer, client_assertion: t });
53604
+ return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: Pa.JwtBearer, client_assertion: t });
53604
53605
  }
53605
53606
  setBasicAuth(t, n) {
53606
53607
  this.clientId = t, this.clientSecret = n, this.basicAuth = Ft(t + ":" + n);
@@ -53608,20 +53609,20 @@ var Gt = class extends J {
53608
53609
  async fhircastSubscribe(t, n) {
53609
53610
  if (!(typeof t == "string" && t !== "")) throw new p(y("Invalid topic provided. Topic must be a valid string."));
53610
53611
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new p(y("Invalid events provided. Events must be an array of event names containing at least one event."));
53611
- let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Hr(i), A.FORM_URL_ENCODED))["hub.channel.endpoint"];
53612
+ let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Qr(i), A.FORM_URL_ENCODED))["hub.channel.endpoint"];
53612
53613
  if (!s) throw new Error("Invalid response!");
53613
53614
  return i.endpoint = s, i;
53614
53615
  }
53615
53616
  async fhircastUnsubscribe(t) {
53616
53617
  if (!Ut(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
53617
53618
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new p(y("Provided subscription request must have an endpoint in order to unsubscribe."));
53618
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Hr(t), A.FORM_URL_ENCODED);
53619
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Qr(t), A.FORM_URL_ENCODED);
53619
53620
  }
53620
53621
  fhircastConnect(t) {
53621
53622
  return new Nt(t);
53622
53623
  }
53623
53624
  async fhircastPublish(t, n, i, o) {
53624
- return Pi(n) ? this.post(this.fhircastHubUrl, Qr(t, n, i, o), A.JSON) : (wi(n), this.post(this.fhircastHubUrl, Qr(t, n, i), A.JSON));
53625
+ return wi(n) ? this.post(this.fhircastHubUrl, zr(t, n, i, o), A.JSON) : (Ai(n), this.post(this.fhircastHubUrl, zr(t, n, i), A.JSON));
53625
53626
  }
53626
53627
  async fhircastGetContext(t) {
53627
53628
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -53652,12 +53653,12 @@ var Gt = class extends J {
53652
53653
  }
53653
53654
  async verifyTokens(t) {
53654
53655
  let n = t.access_token;
53655
- if (Oi(n)) {
53656
+ if (Ii(n)) {
53656
53657
  let i = Bt(n);
53657
- if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new p(xn);
53658
+ if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new p(vn);
53658
53659
  if (i.cid) {
53659
- if (i.cid !== this.clientId) throw this.clearActiveLogin(), new p(pr);
53660
- } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new p(pr);
53660
+ if (i.cid !== this.clientId) throw this.clearActiveLogin(), new p(fr);
53661
+ } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new p(fr);
53661
53662
  }
53662
53663
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
53663
53664
  }
@@ -53677,7 +53678,7 @@ var Gt = class extends J {
53677
53678
  }
53678
53679
  }
53679
53680
  getSubscriptionManager() {
53680
- return this.subscriptionManager || (this.subscriptionManager = new $t(this, ni(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
53681
+ return this.subscriptionManager || (this.subscriptionManager = new $t(this, ii(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
53681
53682
  }
53682
53683
  subscribeToCriteria(t, n) {
53683
53684
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -53689,46 +53690,46 @@ var Gt = class extends J {
53689
53690
  return this.getSubscriptionManager().getMasterEmitter();
53690
53691
  }
53691
53692
  };
53692
- function Pa() {
53693
+ function wa() {
53693
53694
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
53694
53695
  return globalThis.fetch.bind(globalThis);
53695
53696
  }
53696
- function Fi() {
53697
+ function Ni() {
53697
53698
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
53698
53699
  }
53699
- async function Ni(r6, e) {
53700
+ async function Ui(r6, e) {
53700
53701
  let t = r6.headers.get("content-location");
53701
53702
  if (t) return t;
53702
53703
  let n = r6.headers.get("location");
53703
53704
  if (n) return n;
53704
53705
  if (Oe(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
53705
53706
  }
53706
- function Ui(r6) {
53707
+ function Bi(r6) {
53707
53708
  let e = r6.entry?.map((t) => t.resource) ?? [];
53708
53709
  return Object.assign(e, { bundle: r6 });
53709
53710
  }
53710
- function wa(r6) {
53711
+ function Aa(r6) {
53711
53712
  return R(r6) && "data" in r6 && "contentType" in r6;
53712
53713
  }
53713
- function Bi(r6, e, t, n) {
53714
- return wa(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
53714
+ function Wi(r6, e, t, n) {
53715
+ return Aa(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
53715
53716
  }
53716
- function Aa(r6) {
53717
+ function Oa(r6) {
53717
53718
  return R(r6) && "docDefinition" in r6;
53718
53719
  }
53719
- function Oa(r6, e, t, n) {
53720
- return Aa(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
53720
+ function Ia(r6, e, t, n) {
53721
+ return Oa(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
53721
53722
  }
53722
- function Ia(r6) {
53723
+ function ka(r6) {
53723
53724
  return r6.status === 429 || r6.status >= 500;
53724
53725
  }
53725
- var ja = [...Je, "->", "<<", ">>", "=="];
53726
- var Ha = Ke().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
53727
- var lc = " ".repeat(2);
53728
- var pc = [...Je, "eq", "ne", "co"];
53729
- var fc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
53730
- var mc = Ke();
53731
- var yc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
53726
+ var $a = [...Je, "->", "<<", ">>", "=="];
53727
+ var Qa = Ke().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
53728
+ var dc = " ".repeat(2);
53729
+ var fc = [...Je, "eq", "ne", "co"];
53730
+ var hc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
53731
+ var yc = Ke();
53732
+ var gc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
53732
53733
  var de = class {
53733
53734
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
53734
53735
  this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i, this.escapeCharacter = o, this.subcomponentSeparator = s;
@@ -53740,7 +53741,7 @@ var de = class {
53740
53741
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
53741
53742
  }
53742
53743
  };
53743
- var so = class r2 {
53744
+ var ao = class r2 {
53744
53745
  constructor(e, t = new de()) {
53745
53746
  this.context = t, this.segments = e;
53746
53747
  }
@@ -53764,7 +53765,7 @@ var so = class r2 {
53764
53765
  }
53765
53766
  buildAck(e) {
53766
53767
  let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", c2 = n?.getField(10)?.toString() ?? "", u = n?.getField(12)?.toString() ?? "2.5.1", d = e?.ackCode ?? "AA";
53767
- return new r2([new nt(["MSH", this.context.getMsh2(), s, a, i, o, xc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u], this.context), new nt(["MSA", d, c2, yc[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
53768
+ return new r2([new nt(["MSH", this.context.getMsh2(), s, a, i, o, vc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u], this.context), new nt(["MSA", d, c2, gc[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
53768
53769
  }
53769
53770
  buildAckMessageType(e) {
53770
53771
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -53791,7 +53792,7 @@ var so = class r2 {
53791
53792
  };
53792
53793
  var nt = class r3 {
53793
53794
  constructor(e, t = new de()) {
53794
- this.context = t, Jn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
53795
+ this.context = t, Kn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
53795
53796
  }
53796
53797
  get(e) {
53797
53798
  return this.fields[e];
@@ -53859,13 +53860,13 @@ var K = class r4 {
53859
53860
  return true;
53860
53861
  }
53861
53862
  };
53862
- function xc(r6) {
53863
+ function vc(r6) {
53863
53864
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
53864
53865
  return i > 0 && (n += "." + i.toString()), n;
53865
53866
  }
53866
53867
  var Be = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
53867
- var vc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
53868
- var ao = class r5 {
53868
+ var Tc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
53869
+ var co = class r5 {
53869
53870
  constructor(e, t = {}, n = Be.INFO, i = {}) {
53870
53871
  this.write = e, this.metadata = t, this.level = n, this.options = i, i?.prefix && (this.prefix = i.prefix), this.error = this.error.bind(this), this.warn = this.warn.bind(this), this.info = this.info.bind(this), this.debug = this.debug.bind(this), this.log = this.log.bind(this);
53871
53872
  }
@@ -53890,18 +53891,37 @@ var ao = class r5 {
53890
53891
  this.log(Be.DEBUG, e, t);
53891
53892
  }
53892
53893
  log(e, t, n) {
53893
- e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
53894
- `) }), this.write(JSON.stringify({ level: vc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
53894
+ if (e > this.level) return;
53895
+ let i;
53896
+ if (n instanceof Error) i = tr(n);
53897
+ else if (n) {
53898
+ i = { ...n };
53899
+ for (let [o, s] of Object.entries(i)) s instanceof Error && (i[o] = tr(s));
53900
+ }
53901
+ this.write(JSON.stringify({ level: Tc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
53895
53902
  }
53896
53903
  };
53897
- function rm(r6) {
53904
+ function nm(r6) {
53898
53905
  let e = Be[r6.toUpperCase()];
53899
53906
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
53900
53907
  return e;
53901
53908
  }
53902
- var Vc = "https://meta.medplum.com/releases";
53903
- var nr = /* @__PURE__ */ new Map();
53904
- function Dc(r6) {
53909
+ function tr(r6, e = 0, t = 10) {
53910
+ if (e >= t) return { error: "Max error depth reached" };
53911
+ let n = { error: r6.toString(), stack: r6.stack?.split(`
53912
+ `) };
53913
+ r6.name && r6.name !== "Error" && (n.name = r6.name), r6.message && (n.message = r6.message), "cause" in r6 && r6.cause !== void 0 && (r6.cause instanceof Error ? n.cause = tr(r6.cause, e + 1, t) : n.cause = r6.cause);
53914
+ let i = Object.getOwnPropertyNames(r6).filter((o) => !["name", "message", "stack", "cause"].includes(o));
53915
+ for (let o of i) try {
53916
+ let s = r6[o];
53917
+ s instanceof Error ? n[o] = tr(s, e + 1, t) : n[o] = s;
53918
+ } catch {
53919
+ }
53920
+ return n;
53921
+ }
53922
+ var Dc = "https://meta.medplum.com/releases";
53923
+ var ir = /* @__PURE__ */ new Map();
53924
+ function Mc(r6) {
53905
53925
  let e = r6;
53906
53926
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
53907
53927
  let t = e.assets;
@@ -53911,11 +53931,11 @@ function Dc(r6) {
53911
53931
  if (!n.name) throw new Error("Asset missing name");
53912
53932
  }
53913
53933
  }
53914
- async function cn(r6, e, t) {
53915
- let n = nr.get(e ?? "latest");
53934
+ async function un(r6, e, t) {
53935
+ let n = ir.get(e ?? "latest");
53916
53936
  if (!n) {
53917
- let i = e ? `v${e}` : "latest", o = new URL(`${Vc}/${i}.json`);
53918
- if (o.searchParams.set("a", r6), o.searchParams.set("c", Kr), t) for (let [c2, u] of Object.entries(t)) o.searchParams.set(c2, u);
53937
+ let i = e ? `v${e}` : "latest", o = new URL(`${Dc}/${i}.json`);
53938
+ if (o.searchParams.set("a", r6), o.searchParams.set("c", Xr), t) for (let [c2, u] of Object.entries(t)) o.searchParams.set(c2, u);
53919
53939
  let s = await fetch(o.toString());
53920
53940
  if (s.status !== 200) {
53921
53941
  let c2;
@@ -53927,24 +53947,24 @@ async function cn(r6, e, t) {
53927
53947
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c2}`);
53928
53948
  }
53929
53949
  let a = await s.json();
53930
- Dc(a), n = a, nr.set(e ?? "latest", n), e || nr.set(n.tag_name.slice(1), n);
53950
+ Mc(a), n = a, ir.set(e ?? "latest", n), e || ir.set(n.tag_name.slice(1), n);
53931
53951
  }
53932
53952
  return n;
53933
53953
  }
53934
- function Mc(r6) {
53954
+ function _c(r6) {
53935
53955
  return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
53936
53956
  }
53937
- async function Rm(r6, e) {
53938
- if (!Mc(e)) return false;
53957
+ async function Cm(r6, e) {
53958
+ if (!_c(e)) return false;
53939
53959
  try {
53940
- await cn(r6, e);
53960
+ await un(r6, e);
53941
53961
  } catch {
53942
53962
  return false;
53943
53963
  }
53944
53964
  return true;
53945
53965
  }
53946
- async function Cm(r6) {
53947
- let e = await cn(r6);
53966
+ async function Pm(r6) {
53967
+ let e = await un(r6);
53948
53968
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
53949
53969
  return e.tag_name.slice(1);
53950
53970
  }
@@ -54000,7 +54020,7 @@ var p2 = class extends l2 {
54000
54020
  this.socket = e, this.encoding = n, this.enhancedMode = s, this.messagesPerMin = o.messagesPerMin, e.on("data", (i) => {
54001
54021
  try {
54002
54022
  if (this.appendData(i), i.at(-2) === 28 && i.at(-1) === 13) {
54003
- let r6 = Buffer.concat(this.chunks), d = r6.subarray(1, r6.length - 2), g2 = import_iconv_lite.default.decode(d, this.encoding), w2 = so.parse(g2);
54023
+ let r6 = Buffer.concat(this.chunks), d = r6.subarray(1, r6.length - 2), g2 = import_iconv_lite.default.decode(d, this.encoding), w2 = ao.parse(g2);
54004
54024
  this.responseQueue.push(new m(this, w2)), this.resetBuffer(), this.processResponseQueue().catch((y2) => {
54005
54025
  this.dispatchEvent(new c(y2));
54006
54026
  });
@@ -54037,7 +54057,7 @@ var p2 = class extends l2 {
54037
54057
  for (this.responseQueueProcessing = true; this.responseQueue.length; ) {
54038
54058
  if (this.messagesPerMin) {
54039
54059
  let n = L2 / this.messagesPerMin, s = Date.now() - this.lastMessageDispatchedTime;
54040
- n > s && await _r(n - s);
54060
+ n > s && await Lr(n - s);
54041
54061
  }
54042
54062
  let e = this.responseQueue.shift();
54043
54063
  e && this.dispatchEvent(e), this.lastMessageDispatchedTime = Date.now();
@@ -54186,7 +54206,7 @@ var H = class {
54186
54206
  let d = new p2(r6, this.encoding, this.enhancedMode, { messagesPerMin: this.messagesPerMin });
54187
54207
  this.handler(d);
54188
54208
  }), i = async (r6) => {
54189
- r6?.code === "EADDRINUSE" && (await _r(50), o.close(), o.listen(t));
54209
+ r6?.code === "EADDRINUSE" && (await Lr(50), o.close(), o.listen(t));
54190
54210
  };
54191
54211
  o.on("error", i), o.once("listening", () => {
54192
54212
  o.off("error", i);
@@ -54306,8 +54326,8 @@ var AgentDicomChannel = class extends BaseChannel {
54306
54326
  this.association = association;
54307
54327
  association.setMaxPduLength(65536);
54308
54328
  association.getPresentationContexts().forEach(({ context }) => {
54309
- context.getTransferSyntaxUids().forEach((ts) => {
54310
- context.setResult(dimse.constants.PresentationContextResult.Accept, ts);
54329
+ context.getTransferSyntaxUids().forEach((ts2) => {
54330
+ context.setResult(dimse.constants.PresentationContextResult.Accept, ts2);
54311
54331
  });
54312
54332
  });
54313
54333
  this.sendAssociationAccept();
@@ -54421,7 +54441,7 @@ var AgentDicomChannel = class extends BaseChannel {
54421
54441
  this.server.on("networkError", async (err) => {
54422
54442
  this.log.error("Network error: ", { err });
54423
54443
  if (err?.code === "EADDRINUSE") {
54424
- await _r(50);
54444
+ await Lr(50);
54425
54445
  this.server.close();
54426
54446
  this.server.listen(port);
54427
54447
  }
@@ -54495,7 +54515,7 @@ var AgentHl7Channel = class extends BaseChannel {
54495
54515
  sendToRemote(msg) {
54496
54516
  const connection = this.connections.get(msg.remote);
54497
54517
  if (connection) {
54498
- connection.hl7Connection.send(so.parse(msg.body));
54518
+ connection.hl7Connection.send(ao.parse(msg.body));
54499
54519
  } else {
54500
54520
  this.log.warn(`Attempted to send message to disconnected remote: ${msg.remote}`);
54501
54521
  }
@@ -54595,7 +54615,7 @@ var import_node_os2 = require("node:os");
54595
54615
  var import_node_path2 = __toESM(require("node:path"));
54596
54616
  var import_node_process = __toESM(require("node:process"));
54597
54617
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
54598
- var pidLogger = new ao((msg) => `[PID]: ${msg}`);
54618
+ var pidLogger = new co((msg) => `[PID]: ${msg}`);
54599
54619
  var pidFileApps = /* @__PURE__ */ new Set();
54600
54620
  var processExitListener = () => {
54601
54621
  removeAllPidFiles();
@@ -54713,7 +54733,7 @@ async function waitForPidFile(appName, timeoutMs = 3e3) {
54713
54733
  if (Date.now() - startTime > timeoutMs) {
54714
54734
  throw new Error("Timeout while waiting for PID file");
54715
54735
  }
54716
- await _r(0);
54736
+ await Lr(0);
54717
54737
  }
54718
54738
  }
54719
54739
  function removeAllPidFiles() {
@@ -54744,7 +54764,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path3.resolve)(
54744
54764
  );
54745
54765
  var RELEASES_PATH = (0, import_node_path3.resolve)(__dirname);
54746
54766
  async function downloadRelease(version, path4) {
54747
- const release = await cn("agent-upgrader", version);
54767
+ const release = await un("agent-upgrader", version);
54748
54768
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os3.platform)());
54749
54769
  const { body } = await fetch(downloadUrl);
54750
54770
  if (!body) {
@@ -54819,7 +54839,7 @@ var App = class _App {
54819
54839
  this.medplum = medplum;
54820
54840
  this.agentId = agentId;
54821
54841
  this.logLevel = logLevel;
54822
- this.log = new ao((msg) => console.log(msg), void 0, logLevel);
54842
+ this.log = new co((msg) => console.log(msg), void 0, logLevel);
54823
54843
  }
54824
54844
  async start() {
54825
54845
  this.log.info("Medplum service starting...");
@@ -54839,7 +54859,7 @@ var App = class _App {
54839
54859
  if ((0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH)) {
54840
54860
  const upgradeFile = (0, import_node_fs4.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
54841
54861
  const upgradeDetails = JSON.parse(upgradeFile);
54842
- if (Kr.startsWith(upgradeDetails.targetVersion)) {
54862
+ if (Xr.startsWith(upgradeDetails.targetVersion)) {
54843
54863
  await this.sendToWebSocket({
54844
54864
  type: "agent:upgrade:response",
54845
54865
  statusCode: 200,
@@ -54847,7 +54867,7 @@ var App = class _App {
54847
54867
  });
54848
54868
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
54849
54869
  } else {
54850
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Kr}`;
54870
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Xr}`;
54851
54871
  await this.sendToWebSocket({
54852
54872
  type: "agent:error",
54853
54873
  body: errMsg,
@@ -54875,7 +54895,7 @@ var App = class _App {
54875
54895
  if (attempt === maxAttempts) {
54876
54896
  throw new Error("Too many unsuccessful attempts to create agent PID file");
54877
54897
  }
54878
- await _r(500);
54898
+ await Lr(500);
54879
54899
  }
54880
54900
  }
54881
54901
  }
@@ -54943,7 +54963,7 @@ var App = class _App {
54943
54963
  break;
54944
54964
  case "agent:heartbeat:request":
54945
54965
  this.outstandingHeartbeats = 0;
54946
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Kr });
54966
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Xr });
54947
54967
  break;
54948
54968
  case "agent:heartbeat:response":
54949
54969
  this.outstandingHeartbeats = 0;
@@ -55248,7 +55268,7 @@ IPv6 is currently unsupported.`;
55248
55268
  this.log.error(errMsg);
55249
55269
  throw new Error(errMsg);
55250
55270
  }
55251
- if (!((0, import_node_net3.isIPv4)(message.remote) || Vl(message.remote))) {
55271
+ if (!((0, import_node_net3.isIPv4)(message.remote) || Dl(message.remote))) {
55252
55272
  const errMsg = `Attempted to ping an invalid host.
55253
55273
 
55254
55274
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -55300,7 +55320,7 @@ ${result}`);
55300
55320
  }
55301
55321
  }
55302
55322
  async tryUpgradeAgent(message) {
55303
- this.log.info(`Attempting to upgrade from ${Kr} to ${message.version ?? "latest"}...`);
55323
+ this.log.info(`Attempting to upgrade from ${Xr} to ${message.version ?? "latest"}...`);
55304
55324
  if ((0, import_node_os4.platform)() !== "win32") {
55305
55325
  const errMsg = "Auto-upgrading is currently only supported on Windows";
55306
55326
  this.log.error(errMsg);
@@ -55323,7 +55343,7 @@ ${result}`);
55323
55343
  return;
55324
55344
  }
55325
55345
  let child;
55326
- if (message.version && !await Rm("agent-upgrader", message.version)) {
55346
+ if (message.version && !await Cm("agent-upgrader", message.version)) {
55327
55347
  const versionTag = message.version ? `v${message.version}` : "latest";
55328
55348
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
55329
55349
  this.log.error(errMsg);
@@ -55334,8 +55354,8 @@ ${result}`);
55334
55354
  });
55335
55355
  return;
55336
55356
  }
55337
- const targetVersion = message.version ?? await Cm("agent-upgrader");
55338
- if (Kr.startsWith(targetVersion)) {
55357
+ const targetVersion = message.version ?? await Pm("agent-upgrader");
55358
+ if (Xr.startsWith(targetVersion)) {
55339
55359
  if (!message?.force) {
55340
55360
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
55341
55361
  await this.sendToWebSocket({
@@ -55345,7 +55365,7 @@ ${result}`);
55345
55365
  });
55346
55366
  return;
55347
55367
  }
55348
- this.log.info(`Forcing upgrade from ${Kr} to ${targetVersion}`);
55368
+ this.log.info(`Forcing upgrade from ${Xr} to ${targetVersion}`);
55349
55369
  }
55350
55370
  if (semver.lt(targetVersion, "4.2.4") && !message.force) {
55351
55371
  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.`;
@@ -55405,11 +55425,11 @@ ${result}`);
55405
55425
  return;
55406
55426
  }
55407
55427
  try {
55408
- this.log.info("Writing upgrade manifest...", { previousVersion: Kr, targetVersion });
55428
+ this.log.info("Writing upgrade manifest...", { previousVersion: Xr, targetVersion });
55409
55429
  (0, import_node_fs4.writeFileSync)(
55410
55430
  UPGRADE_MANIFEST_PATH,
55411
55431
  JSON.stringify({
55412
- previousVersion: Kr,
55432
+ previousVersion: Xr,
55413
55433
  targetVersion,
55414
55434
  callback: message.callback ?? null
55415
55435
  }),
@@ -55483,7 +55503,7 @@ ${result}`);
55483
55503
  });
55484
55504
  }
55485
55505
  }
55486
- const requestMsg = so.parse(message.body);
55506
+ const requestMsg = ao.parse(message.body);
55487
55507
  const msh10 = requestMsg.getSegment("MSH")?.getField(10);
55488
55508
  if (!msh10) {
55489
55509
  this.log.error("MSH.10 is missing but required");
@@ -55579,10 +55599,10 @@ async function agentMain(argv) {
55579
55599
  } catch (err) {
55580
55600
  console.error("Failed to login", { err: Ie(err) });
55581
55601
  console.log("Retrying login in 10 seconds...");
55582
- await _r(RETRY_WAIT_DURATION_MS);
55602
+ await Lr(RETRY_WAIT_DURATION_MS);
55583
55603
  }
55584
55604
  }
55585
- const app = new App(medplum, agentId, rm(args.logLevel ?? "INFO"));
55605
+ const app = new App(medplum, agentId, nm(args.logLevel ?? "INFO"));
55586
55606
  await app.start();
55587
55607
  process.on("SIGINT", async () => {
55588
55608
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -55611,7 +55631,7 @@ async function upgraderMain(argv) {
55611
55631
  if ((0, import_node_os5.platform)() !== "win32") {
55612
55632
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
55613
55633
  }
55614
- const globalLogger = new ao((msg) => console.log(msg));
55634
+ const globalLogger = new co((msg) => console.log(msg));
55615
55635
  if (!import_node_process3.default.send) {
55616
55636
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
55617
55637
  import_node_process3.default.exit(1);
@@ -55621,10 +55641,10 @@ async function upgraderMain(argv) {
55621
55641
  rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
55622
55642
  import_node_process3.default.once("disconnect", resolve2);
55623
55643
  });
55624
- if (argv[3] && !Mc(argv[3])) {
55644
+ if (argv[3] && !_c(argv[3])) {
55625
55645
  throw new Error("Invalid version specified");
55626
55646
  }
55627
- const version = argv[3] ?? await Cm("agent-upgrader");
55647
+ const version = argv[3] ?? await Pm("agent-upgrader");
55628
55648
  const binPath = getReleaseBinPath(version);
55629
55649
  if (!(0, import_node_fs6.existsSync)(binPath)) {
55630
55650
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -55675,7 +55695,7 @@ async function main(argv) {
55675
55695
  } else if (argv[2] === "--remove-old-services") {
55676
55696
  const logFileFd = (0, import_node_fs7.openSync)(TEMP_LOG_FILE, "a");
55677
55697
  let allAgentServices = [];
55678
- const currentServiceName = `MedplumAgent_${Kr}`;
55698
+ const currentServiceName = `MedplumAgent_${Xr}`;
55679
55699
  while (!allAgentServices.includes(currentServiceName)) {
55680
55700
  const output = (0, import_node_child_process3.execSync)('cmd.exe /c sc query type= service state= all | findstr /i "SERVICE_NAME.*MedplumAgent"');
55681
55701
  (0, import_node_fs7.appendFileSync)(logFileFd, `${output}\r
@@ -55685,8 +55705,8 @@ async function main(argv) {
55685
55705
  ${allAgentServices.join("\r\n")}\r
55686
55706
  `, { encoding: "utf-8" });
55687
55707
  }
55688
- const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${Kr}`);
55689
- (0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${Kr}\r
55708
+ const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${Xr}`);
55709
+ (0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${Xr}\r
55690
55710
  `, {
55691
55711
  encoding: "utf-8"
55692
55712
  });