@medplum/agent 5.1.3 → 5.1.4

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 +462 -461
  2. package/package.json +5 -5
@@ -17092,8 +17092,8 @@ var require_dcmjs = __commonJS({
17092
17092
  key: "writeBytes",
17093
17093
  value: function writeBytes(stream, value, writeOptions) {
17094
17094
  var _this8 = this;
17095
- var val = Array.isArray(value) ? value.map(function(ds2) {
17096
- return _this8.convertToString(ds2);
17095
+ var val = Array.isArray(value) ? value.map(function(ds) {
17096
+ return _this8.convertToString(ds);
17097
17097
  }) : [this.convertToString(value)];
17098
17098
  return _get2(_getPrototypeOf2(DecimalString3.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
17099
17099
  }
@@ -21715,8 +21715,8 @@ var require_dcmjs = __commonJS({
21715
21715
  }, {
21716
21716
  key: "isMultiframeDataset",
21717
21717
  value: function isMultiframeDataset() {
21718
- var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
21719
- var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
21718
+ var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
21719
+ var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
21720
21720
  return Normalizer3.isMultiframeSOPClassUID(sopClassUID);
21721
21721
  }
21722
21722
  }, {
@@ -21756,16 +21756,16 @@ var require_dcmjs = __commonJS({
21756
21756
  }
21757
21757
  this.derivation = new DerivedImage2(this.datasets);
21758
21758
  this.dataset = this.derivation.dataset;
21759
- var ds2 = this.dataset;
21759
+ var ds = this.dataset;
21760
21760
  var referenceDataset = this.datasets[0];
21761
- ds2.NumberOfFrames = this.datasets.length;
21762
- ds2.SOPClassUID = referenceDataset.SOPClassUID;
21763
- ds2.Rows = referenceDataset.Rows;
21764
- ds2.Columns = referenceDataset.Columns;
21765
- ds2.BitsAllocated = referenceDataset.BitsAllocated;
21766
- ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
21767
- ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
21768
- ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
21761
+ ds.NumberOfFrames = this.datasets.length;
21762
+ ds.SOPClassUID = referenceDataset.SOPClassUID;
21763
+ ds.Rows = referenceDataset.Rows;
21764
+ ds.Columns = referenceDataset.Columns;
21765
+ ds.BitsAllocated = referenceDataset.BitsAllocated;
21766
+ ds.PixelRepresentation = referenceDataset.PixelRepresentation;
21767
+ ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
21768
+ ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
21769
21769
  var referencePosition = referenceDataset.ImagePositionPatient;
21770
21770
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
21771
21771
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -21780,43 +21780,43 @@ var require_dcmjs = __commonJS({
21780
21780
  distanceDatasetPairs.sort(function(a, b3) {
21781
21781
  return b3[0] - a[0];
21782
21782
  });
21783
- if (ds2.BitsAllocated !== 16) {
21783
+ if (ds.BitsAllocated !== 16) {
21784
21784
  log3.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
21785
21785
  }
21786
21786
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
21787
21787
  log3.warn("No vr map given for pixel data, using OW");
21788
- ds2._vrMap = {
21788
+ ds._vrMap = {
21789
21789
  PixelData: "OW"
21790
21790
  };
21791
21791
  } else {
21792
- ds2._vrMap = {
21792
+ ds._vrMap = {
21793
21793
  PixelData: referenceDataset._vrMap.PixelData
21794
21794
  };
21795
21795
  }
21796
21796
  var frameSize = referenceDataset.PixelData.byteLength;
21797
- ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
21797
+ ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
21798
21798
  var frame = 0;
21799
21799
  distanceDatasetPairs.forEach(function(pair) {
21800
21800
  var dataset = pair[1];
21801
21801
  var pixels = new Uint16Array(dataset.PixelData);
21802
- var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
21802
+ var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
21803
21803
  try {
21804
21804
  frameView.set(pixels);
21805
21805
  } catch (e) {
21806
21806
  if (e instanceof RangeError) {
21807
- 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);
21807
+ 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);
21808
21808
  log3.error(message2);
21809
21809
  }
21810
21810
  }
21811
21811
  frame++;
21812
21812
  });
21813
- if (ds2.NumberOfFrames < 2) {
21813
+ if (ds.NumberOfFrames < 2) {
21814
21814
  log3.error("Cannot populate shared groups uniquely without multiple frames");
21815
21815
  }
21816
21816
  var _distanceDatasetPairs = _slicedToArray2(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
21817
21817
  var distance1 = distanceDatasetPairs[1][0];
21818
21818
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
21819
- ds2.SharedFunctionalGroupsSequence = {
21819
+ ds.SharedFunctionalGroupsSequence = {
21820
21820
  PlaneOrientationSequence: {
21821
21821
  ImageOrientationPatient: dataset0.ImageOrientationPatient
21822
21822
  },
@@ -21826,14 +21826,14 @@ var require_dcmjs = __commonJS({
21826
21826
  SliceThickness: SpacingBetweenSlices
21827
21827
  }
21828
21828
  };
21829
- ds2.ReferencedSeriesSequence = {
21829
+ ds.ReferencedSeriesSequence = {
21830
21830
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
21831
21831
  ReferencedInstanceSequence: []
21832
21832
  };
21833
- ds2.PerFrameFunctionalGroupsSequence = [];
21833
+ ds.PerFrameFunctionalGroupsSequence = [];
21834
21834
  distanceDatasetPairs.forEach(function(pair) {
21835
21835
  var dataset = pair[1];
21836
- ds2.PerFrameFunctionalGroupsSequence.push({
21836
+ ds.PerFrameFunctionalGroupsSequence.push({
21837
21837
  PlanePositionSequence: {
21838
21838
  ImagePositionPatient: dataset.ImagePositionPatient
21839
21839
  },
@@ -21842,7 +21842,7 @@ var require_dcmjs = __commonJS({
21842
21842
  WindowWidth: dataset.WindowWidth
21843
21843
  }
21844
21844
  });
21845
- ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
21845
+ ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
21846
21846
  ReferencedSOPClassUID: dataset.SOPClassUID,
21847
21847
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
21848
21848
  });
@@ -21862,29 +21862,29 @@ var require_dcmjs = __commonJS({
21862
21862
  }, {
21863
21863
  key: "normalizeMultiframe",
21864
21864
  value: function normalizeMultiframe() {
21865
- var ds2 = this.dataset;
21866
- if (!ds2.NumberOfFrames) {
21865
+ var ds = this.dataset;
21866
+ if (!ds.NumberOfFrames) {
21867
21867
  log3.error("Missing number or frames not supported");
21868
21868
  return;
21869
21869
  }
21870
- if (!ds2.PixelRepresentation) {
21871
- ds2.PixelRepresentation = 1;
21870
+ if (!ds.PixelRepresentation) {
21871
+ ds.PixelRepresentation = 1;
21872
21872
  }
21873
- if (!ds2.StudyID || ds2.StudyID === "") {
21874
- ds2.StudyID = "No Study ID";
21873
+ if (!ds.StudyID || ds.StudyID === "") {
21874
+ ds.StudyID = "No Study ID";
21875
21875
  }
21876
21876
  var validLateralities = ["R", "L"];
21877
- if (validLateralities.indexOf(ds2.Laterality) === -1) {
21878
- delete ds2.Laterality;
21877
+ if (validLateralities.indexOf(ds.Laterality) === -1) {
21878
+ delete ds.Laterality;
21879
21879
  }
21880
- if (!ds2.PresentationLUTShape) {
21881
- ds2.PresentationLUTShape = "IDENTITY";
21880
+ if (!ds.PresentationLUTShape) {
21881
+ ds.PresentationLUTShape = "IDENTITY";
21882
21882
  }
21883
- if (!ds2.SharedFunctionalGroupsSequence) {
21883
+ if (!ds.SharedFunctionalGroupsSequence) {
21884
21884
  log3.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
21885
21885
  }
21886
- if (ds2.BodyPartExamined === "PROSTATE") {
21887
- ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
21886
+ if (ds.BodyPartExamined === "PROSTATE") {
21887
+ ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
21888
21888
  AnatomicRegionSequence: {
21889
21889
  CodeValue: "T-9200B",
21890
21890
  CodingSchemeDesignator: "SRT",
@@ -21893,17 +21893,17 @@ var require_dcmjs = __commonJS({
21893
21893
  FrameLaterality: "U"
21894
21894
  };
21895
21895
  }
21896
- var rescaleIntercept = ds2.RescaleIntercept || 0;
21897
- var rescaleSlope = ds2.RescaleSlope || 1;
21898
- ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
21896
+ var rescaleIntercept = ds.RescaleIntercept || 0;
21897
+ var rescaleSlope = ds.RescaleSlope || 1;
21898
+ ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
21899
21899
  RescaleIntercept: rescaleIntercept,
21900
21900
  RescaleSlope: rescaleSlope,
21901
21901
  RescaleType: "US"
21902
21902
  };
21903
21903
  var frameNumber = 1;
21904
21904
  this.datasets.forEach(function(dataset) {
21905
- if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
21906
- ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
21905
+ if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
21906
+ ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
21907
21907
  FrameAcquisitionDuration: 0,
21908
21908
  StackID: 1,
21909
21909
  InStackPositionNumber: frameNumber,
@@ -21911,30 +21911,30 @@ var require_dcmjs = __commonJS({
21911
21911
  };
21912
21912
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
21913
21913
  if (!isNaN(frameTime)) {
21914
- var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
21914
+ var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
21915
21915
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
21916
21916
  frameContentSequence.FrameReferenceDateTime = frameTime;
21917
21917
  }
21918
21918
  frameNumber++;
21919
21919
  });
21920
- if (ds2.WindowCenter && ds2.WindowWidth) {
21921
- if (!Array.isArray(ds2.WindowCenter)) {
21922
- ds2.WindowCenter = [ds2.WindowCenter];
21920
+ if (ds.WindowCenter && ds.WindowWidth) {
21921
+ if (!Array.isArray(ds.WindowCenter)) {
21922
+ ds.WindowCenter = [ds.WindowCenter];
21923
21923
  }
21924
- if (!Array.isArray(ds2.WindowWidth)) {
21925
- ds2.WindowWidth = [ds2.WindowWidth];
21924
+ if (!Array.isArray(ds.WindowWidth)) {
21925
+ ds.WindowWidth = [ds.WindowWidth];
21926
21926
  }
21927
21927
  }
21928
- if (!ds2.WindowCenter || !ds2.WindowWidth) {
21929
- ds2.WindowCenter = [];
21930
- ds2.WindowWidth = [];
21931
- if (ds2.PerFrameFunctionalGroupsSequence) {
21928
+ if (!ds.WindowCenter || !ds.WindowWidth) {
21929
+ ds.WindowCenter = [];
21930
+ ds.WindowWidth = [];
21931
+ if (ds.PerFrameFunctionalGroupsSequence) {
21932
21932
  var wcww = {
21933
21933
  center: 0,
21934
21934
  width: 0,
21935
21935
  count: 0
21936
21936
  };
21937
- ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
21937
+ ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
21938
21938
  if (functionalGroup.FrameVOILUT) {
21939
21939
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
21940
21940
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -21952,26 +21952,26 @@ var require_dcmjs = __commonJS({
21952
21952
  }
21953
21953
  });
21954
21954
  if (wcww.count > 0) {
21955
- ds2.WindowCenter.push(String(wcww.center / wcww.count));
21956
- ds2.WindowWidth.push(String(wcww.width / wcww.count));
21955
+ ds.WindowCenter.push(String(wcww.center / wcww.count));
21956
+ ds.WindowWidth.push(String(wcww.width / wcww.count));
21957
21957
  }
21958
21958
  }
21959
21959
  }
21960
- if (ds2.WindowCenter.length === 0) {
21961
- ds2.WindowCenter = [300];
21960
+ if (ds.WindowCenter.length === 0) {
21961
+ ds.WindowCenter = [300];
21962
21962
  }
21963
- if (ds2.WindowWidth.length === 0) {
21964
- ds2.WindowWidth = [500];
21963
+ if (ds.WindowWidth.length === 0) {
21964
+ ds.WindowWidth = [500];
21965
21965
  }
21966
21966
  }
21967
21967
  }], [{
21968
21968
  key: "vec3CrossProduct",
21969
21969
  value: function vec3CrossProduct(a, b3) {
21970
- var ax = a[0], ay2 = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2];
21970
+ var ax = a[0], ay = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2];
21971
21971
  var out = [];
21972
- out[0] = ay2 * bz - az * by;
21972
+ out[0] = ay * bz - az * by;
21973
21973
  out[1] = az * bx - ax * bz;
21974
- out[2] = ax * by - ay2 * bx;
21974
+ out[2] = ax * by - ay * bx;
21975
21975
  return out;
21976
21976
  }
21977
21977
  }, {
@@ -22007,12 +22007,12 @@ var require_dcmjs = __commonJS({
22007
22007
  key: "normalizeMultiframe",
22008
22008
  value: function normalizeMultiframe() {
22009
22009
  _get2(_getPrototypeOf2(MRImageNormalizer3.prototype), "normalizeMultiframe", this).call(this);
22010
- var ds2 = this.dataset;
22011
- if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
22012
- ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
22010
+ var ds = this.dataset;
22011
+ if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
22012
+ ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
22013
22013
  }
22014
- ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
22015
- FrameType: ds2.ImageType,
22014
+ ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
22015
+ FrameType: ds.ImageType,
22016
22016
  PixelPresentation: "MONOCHROME",
22017
22017
  VolumetricProperties: "VOLUME",
22018
22018
  VolumeBasedCalculationTechnique: "NONE",
@@ -22137,9 +22137,9 @@ var require_dcmjs = __commonJS({
22137
22137
  key: "normalize",
22138
22138
  value: function normalize3() {
22139
22139
  _get2(_getPrototypeOf2(PMImageNormalizer3.prototype), "normalize", this).call(this);
22140
- var ds2 = this.datasets[0];
22141
- if (ds2.BitsAllocated !== 32) {
22142
- log3.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
22140
+ var ds = this.datasets[0];
22141
+ if (ds.BitsAllocated !== 32) {
22142
+ log3.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
22143
22143
  }
22144
22144
  }
22145
22145
  }]);
@@ -26389,8 +26389,8 @@ var require_dcmjs = __commonJS({
26389
26389
  key: "getCornerstoneLabelFromDefaultState",
26390
26390
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
26391
26391
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
26392
- var freeTextLabel = findingSites.find(function(fs3) {
26393
- return isFreeTextCodeValue3(fs3.CodeValue) || isLegacyFreeTextCodeValue3(fs3.CodeValue);
26392
+ var freeTextLabel = findingSites.find(function(fs4) {
26393
+ return isFreeTextCodeValue3(fs4.CodeValue) || isLegacyFreeTextCodeValue3(fs4.CodeValue);
26394
26394
  });
26395
26395
  if (freeTextLabel) {
26396
26396
  return freeTextLabel.CodeMeaning;
@@ -26969,19 +26969,19 @@ var require_dcmjs = __commonJS({
26969
26969
  return a[0] * b3[0] + a[1] * b3[1] + a[2] * b3[2];
26970
26970
  }
26971
26971
  function cross$12(out, a, b3) {
26972
- var ax = a[0], ay2 = a[1], az = a[2];
26972
+ var ax = a[0], ay = a[1], az = a[2];
26973
26973
  var bx = b3[0], by = b3[1], bz = b3[2];
26974
- out[0] = ay2 * bz - az * by;
26974
+ out[0] = ay * bz - az * by;
26975
26975
  out[1] = az * bx - ax * bz;
26976
- out[2] = ax * by - ay2 * bx;
26976
+ out[2] = ax * by - ay * bx;
26977
26977
  return out;
26978
26978
  }
26979
26979
  function lerp2(out, a, b3, t) {
26980
26980
  var ax = a[0];
26981
- var ay2 = a[1];
26981
+ var ay = a[1];
26982
26982
  var az = a[2];
26983
26983
  out[0] = ax + t * (b3[0] - ax);
26984
- out[1] = ay2 + t * (b3[1] - ay2);
26984
+ out[1] = ay + t * (b3[1] - ay);
26985
26985
  out[2] = az + t * (b3[2] - az);
26986
26986
  return out;
26987
26987
  }
@@ -27092,7 +27092,7 @@ var require_dcmjs = __commonJS({
27092
27092
  return out;
27093
27093
  }
27094
27094
  function angle2(a, b3) {
27095
- var ax = a[0], ay2 = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2], mag1 = Math.sqrt(ax * ax + ay2 * ay2 + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot2(a, b3) / mag;
27095
+ var ax = a[0], ay = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot2(a, b3) / mag;
27096
27096
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
27097
27097
  }
27098
27098
  function zero2(out) {
@@ -37890,8 +37890,8 @@ var require_dcmjs2 = __commonJS({
37890
37890
  key: "writeBytes",
37891
37891
  value: function writeBytes(stream, value, writeOptions) {
37892
37892
  var _this8 = this;
37893
- var val = Array.isArray(value) ? value.map(function(ds2) {
37894
- return _this8.convertToString(ds2);
37893
+ var val = Array.isArray(value) ? value.map(function(ds) {
37894
+ return _this8.convertToString(ds);
37895
37895
  }) : [this.convertToString(value)];
37896
37896
  return _get2(_getPrototypeOf2(DecimalString3.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
37897
37897
  }
@@ -39664,8 +39664,8 @@ var require_dcmjs2 = __commonJS({
39664
39664
  }, {
39665
39665
  key: "isMultiframeDataset",
39666
39666
  value: function isMultiframeDataset() {
39667
- var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
39668
- var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
39667
+ var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
39668
+ var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
39669
39669
  return Normalizer3.isMultiframeSOPClassUID(sopClassUID);
39670
39670
  }
39671
39671
  }, {
@@ -39705,16 +39705,16 @@ var require_dcmjs2 = __commonJS({
39705
39705
  }
39706
39706
  this.derivation = new DerivedImage2(this.datasets);
39707
39707
  this.dataset = this.derivation.dataset;
39708
- var ds2 = this.dataset;
39708
+ var ds = this.dataset;
39709
39709
  var referenceDataset = this.datasets[0];
39710
- ds2.NumberOfFrames = this.datasets.length;
39711
- ds2.SOPClassUID = referenceDataset.SOPClassUID;
39712
- ds2.Rows = referenceDataset.Rows;
39713
- ds2.Columns = referenceDataset.Columns;
39714
- ds2.BitsAllocated = referenceDataset.BitsAllocated;
39715
- ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
39716
- ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
39717
- ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
39710
+ ds.NumberOfFrames = this.datasets.length;
39711
+ ds.SOPClassUID = referenceDataset.SOPClassUID;
39712
+ ds.Rows = referenceDataset.Rows;
39713
+ ds.Columns = referenceDataset.Columns;
39714
+ ds.BitsAllocated = referenceDataset.BitsAllocated;
39715
+ ds.PixelRepresentation = referenceDataset.PixelRepresentation;
39716
+ ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
39717
+ ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
39718
39718
  var referencePosition = referenceDataset.ImagePositionPatient;
39719
39719
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
39720
39720
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -39729,43 +39729,43 @@ var require_dcmjs2 = __commonJS({
39729
39729
  distanceDatasetPairs.sort(function(a, b3) {
39730
39730
  return b3[0] - a[0];
39731
39731
  });
39732
- if (ds2.BitsAllocated !== 16) {
39732
+ if (ds.BitsAllocated !== 16) {
39733
39733
  log3.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
39734
39734
  }
39735
39735
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
39736
39736
  log3.warn("No vr map given for pixel data, using OW");
39737
- ds2._vrMap = {
39737
+ ds._vrMap = {
39738
39738
  PixelData: "OW"
39739
39739
  };
39740
39740
  } else {
39741
- ds2._vrMap = {
39741
+ ds._vrMap = {
39742
39742
  PixelData: referenceDataset._vrMap.PixelData
39743
39743
  };
39744
39744
  }
39745
39745
  var frameSize = referenceDataset.PixelData.byteLength;
39746
- ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
39746
+ ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
39747
39747
  var frame = 0;
39748
39748
  distanceDatasetPairs.forEach(function(pair) {
39749
39749
  var dataset = pair[1];
39750
39750
  var pixels = new Uint16Array(dataset.PixelData);
39751
- var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
39751
+ var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
39752
39752
  try {
39753
39753
  frameView.set(pixels);
39754
39754
  } catch (e) {
39755
39755
  if (e instanceof RangeError) {
39756
- 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);
39756
+ 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);
39757
39757
  log3.error(message2);
39758
39758
  }
39759
39759
  }
39760
39760
  frame++;
39761
39761
  });
39762
- if (ds2.NumberOfFrames < 2) {
39762
+ if (ds.NumberOfFrames < 2) {
39763
39763
  log3.error("Cannot populate shared groups uniquely without multiple frames");
39764
39764
  }
39765
39765
  var _distanceDatasetPairs = _slicedToArray2(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
39766
39766
  var distance1 = distanceDatasetPairs[1][0];
39767
39767
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
39768
- ds2.SharedFunctionalGroupsSequence = {
39768
+ ds.SharedFunctionalGroupsSequence = {
39769
39769
  PlaneOrientationSequence: {
39770
39770
  ImageOrientationPatient: dataset0.ImageOrientationPatient
39771
39771
  },
@@ -39775,14 +39775,14 @@ var require_dcmjs2 = __commonJS({
39775
39775
  SliceThickness: SpacingBetweenSlices
39776
39776
  }
39777
39777
  };
39778
- ds2.ReferencedSeriesSequence = {
39778
+ ds.ReferencedSeriesSequence = {
39779
39779
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
39780
39780
  ReferencedInstanceSequence: []
39781
39781
  };
39782
- ds2.PerFrameFunctionalGroupsSequence = [];
39782
+ ds.PerFrameFunctionalGroupsSequence = [];
39783
39783
  distanceDatasetPairs.forEach(function(pair) {
39784
39784
  var dataset = pair[1];
39785
- ds2.PerFrameFunctionalGroupsSequence.push({
39785
+ ds.PerFrameFunctionalGroupsSequence.push({
39786
39786
  PlanePositionSequence: {
39787
39787
  ImagePositionPatient: dataset.ImagePositionPatient
39788
39788
  },
@@ -39791,7 +39791,7 @@ var require_dcmjs2 = __commonJS({
39791
39791
  WindowWidth: dataset.WindowWidth
39792
39792
  }
39793
39793
  });
39794
- ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
39794
+ ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
39795
39795
  ReferencedSOPClassUID: dataset.SOPClassUID,
39796
39796
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
39797
39797
  });
@@ -39811,29 +39811,29 @@ var require_dcmjs2 = __commonJS({
39811
39811
  }, {
39812
39812
  key: "normalizeMultiframe",
39813
39813
  value: function normalizeMultiframe() {
39814
- var ds2 = this.dataset;
39815
- if (!ds2.NumberOfFrames) {
39814
+ var ds = this.dataset;
39815
+ if (!ds.NumberOfFrames) {
39816
39816
  log3.error("Missing number or frames not supported");
39817
39817
  return;
39818
39818
  }
39819
- if (!ds2.PixelRepresentation) {
39820
- ds2.PixelRepresentation = 1;
39819
+ if (!ds.PixelRepresentation) {
39820
+ ds.PixelRepresentation = 1;
39821
39821
  }
39822
- if (!ds2.StudyID || ds2.StudyID === "") {
39823
- ds2.StudyID = "No Study ID";
39822
+ if (!ds.StudyID || ds.StudyID === "") {
39823
+ ds.StudyID = "No Study ID";
39824
39824
  }
39825
39825
  var validLateralities = ["R", "L"];
39826
- if (validLateralities.indexOf(ds2.Laterality) === -1) {
39827
- delete ds2.Laterality;
39826
+ if (validLateralities.indexOf(ds.Laterality) === -1) {
39827
+ delete ds.Laterality;
39828
39828
  }
39829
- if (!ds2.PresentationLUTShape) {
39830
- ds2.PresentationLUTShape = "IDENTITY";
39829
+ if (!ds.PresentationLUTShape) {
39830
+ ds.PresentationLUTShape = "IDENTITY";
39831
39831
  }
39832
- if (!ds2.SharedFunctionalGroupsSequence) {
39832
+ if (!ds.SharedFunctionalGroupsSequence) {
39833
39833
  log3.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
39834
39834
  }
39835
- if (ds2.BodyPartExamined === "PROSTATE") {
39836
- ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
39835
+ if (ds.BodyPartExamined === "PROSTATE") {
39836
+ ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
39837
39837
  AnatomicRegionSequence: {
39838
39838
  CodeValue: "T-9200B",
39839
39839
  CodingSchemeDesignator: "SRT",
@@ -39842,17 +39842,17 @@ var require_dcmjs2 = __commonJS({
39842
39842
  FrameLaterality: "U"
39843
39843
  };
39844
39844
  }
39845
- var rescaleIntercept = ds2.RescaleIntercept || 0;
39846
- var rescaleSlope = ds2.RescaleSlope || 1;
39847
- ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
39845
+ var rescaleIntercept = ds.RescaleIntercept || 0;
39846
+ var rescaleSlope = ds.RescaleSlope || 1;
39847
+ ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
39848
39848
  RescaleIntercept: rescaleIntercept,
39849
39849
  RescaleSlope: rescaleSlope,
39850
39850
  RescaleType: "US"
39851
39851
  };
39852
39852
  var frameNumber = 1;
39853
39853
  this.datasets.forEach(function(dataset) {
39854
- if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
39855
- ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
39854
+ if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
39855
+ ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
39856
39856
  FrameAcquisitionDuration: 0,
39857
39857
  StackID: 1,
39858
39858
  InStackPositionNumber: frameNumber,
@@ -39860,30 +39860,30 @@ var require_dcmjs2 = __commonJS({
39860
39860
  };
39861
39861
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
39862
39862
  if (!isNaN(frameTime)) {
39863
- var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
39863
+ var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
39864
39864
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
39865
39865
  frameContentSequence.FrameReferenceDateTime = frameTime;
39866
39866
  }
39867
39867
  frameNumber++;
39868
39868
  });
39869
- if (ds2.WindowCenter && ds2.WindowWidth) {
39870
- if (!Array.isArray(ds2.WindowCenter)) {
39871
- ds2.WindowCenter = [ds2.WindowCenter];
39869
+ if (ds.WindowCenter && ds.WindowWidth) {
39870
+ if (!Array.isArray(ds.WindowCenter)) {
39871
+ ds.WindowCenter = [ds.WindowCenter];
39872
39872
  }
39873
- if (!Array.isArray(ds2.WindowWidth)) {
39874
- ds2.WindowWidth = [ds2.WindowWidth];
39873
+ if (!Array.isArray(ds.WindowWidth)) {
39874
+ ds.WindowWidth = [ds.WindowWidth];
39875
39875
  }
39876
39876
  }
39877
- if (!ds2.WindowCenter || !ds2.WindowWidth) {
39878
- ds2.WindowCenter = [];
39879
- ds2.WindowWidth = [];
39880
- if (ds2.PerFrameFunctionalGroupsSequence) {
39877
+ if (!ds.WindowCenter || !ds.WindowWidth) {
39878
+ ds.WindowCenter = [];
39879
+ ds.WindowWidth = [];
39880
+ if (ds.PerFrameFunctionalGroupsSequence) {
39881
39881
  var wcww = {
39882
39882
  center: 0,
39883
39883
  width: 0,
39884
39884
  count: 0
39885
39885
  };
39886
- ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
39886
+ ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
39887
39887
  if (functionalGroup.FrameVOILUT) {
39888
39888
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
39889
39889
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -39901,26 +39901,26 @@ var require_dcmjs2 = __commonJS({
39901
39901
  }
39902
39902
  });
39903
39903
  if (wcww.count > 0) {
39904
- ds2.WindowCenter.push(String(wcww.center / wcww.count));
39905
- ds2.WindowWidth.push(String(wcww.width / wcww.count));
39904
+ ds.WindowCenter.push(String(wcww.center / wcww.count));
39905
+ ds.WindowWidth.push(String(wcww.width / wcww.count));
39906
39906
  }
39907
39907
  }
39908
39908
  }
39909
- if (ds2.WindowCenter.length === 0) {
39910
- ds2.WindowCenter = [300];
39909
+ if (ds.WindowCenter.length === 0) {
39910
+ ds.WindowCenter = [300];
39911
39911
  }
39912
- if (ds2.WindowWidth.length === 0) {
39913
- ds2.WindowWidth = [500];
39912
+ if (ds.WindowWidth.length === 0) {
39913
+ ds.WindowWidth = [500];
39914
39914
  }
39915
39915
  }
39916
39916
  }], [{
39917
39917
  key: "vec3CrossProduct",
39918
39918
  value: function vec3CrossProduct(a, b3) {
39919
- var ax = a[0], ay2 = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2];
39919
+ var ax = a[0], ay = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2];
39920
39920
  var out = [];
39921
- out[0] = ay2 * bz - az * by;
39921
+ out[0] = ay * bz - az * by;
39922
39922
  out[1] = az * bx - ax * bz;
39923
- out[2] = ax * by - ay2 * bx;
39923
+ out[2] = ax * by - ay * bx;
39924
39924
  return out;
39925
39925
  }
39926
39926
  }, {
@@ -39956,12 +39956,12 @@ var require_dcmjs2 = __commonJS({
39956
39956
  key: "normalizeMultiframe",
39957
39957
  value: function normalizeMultiframe() {
39958
39958
  _get2(_getPrototypeOf2(MRImageNormalizer3.prototype), "normalizeMultiframe", this).call(this);
39959
- var ds2 = this.dataset;
39960
- if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
39961
- ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
39959
+ var ds = this.dataset;
39960
+ if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
39961
+ ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
39962
39962
  }
39963
- ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
39964
- FrameType: ds2.ImageType,
39963
+ ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
39964
+ FrameType: ds.ImageType,
39965
39965
  PixelPresentation: "MONOCHROME",
39966
39966
  VolumetricProperties: "VOLUME",
39967
39967
  VolumeBasedCalculationTechnique: "NONE",
@@ -40086,9 +40086,9 @@ var require_dcmjs2 = __commonJS({
40086
40086
  key: "normalize",
40087
40087
  value: function normalize3() {
40088
40088
  _get2(_getPrototypeOf2(PMImageNormalizer3.prototype), "normalize", this).call(this);
40089
- var ds2 = this.datasets[0];
40090
- if (ds2.BitsAllocated !== 32) {
40091
- log3.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
40089
+ var ds = this.datasets[0];
40090
+ if (ds.BitsAllocated !== 32) {
40091
+ log3.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
40092
40092
  }
40093
40093
  }
40094
40094
  }]);
@@ -44366,8 +44366,8 @@ var require_dcmjs2 = __commonJS({
44366
44366
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
44367
44367
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
44368
44368
  var cornersoneFreeTextCodingValue = CodingScheme2.codeValues.CORNERSTONEFREETEXT;
44369
- var freeTextLabel = findingSites.find(function(fs3) {
44370
- return fs3.CodeValue === cornersoneFreeTextCodingValue;
44369
+ var freeTextLabel = findingSites.find(function(fs4) {
44370
+ return fs4.CodeValue === cornersoneFreeTextCodingValue;
44371
44371
  });
44372
44372
  if (freeTextLabel) {
44373
44373
  return freeTextLabel.CodeMeaning;
@@ -44946,19 +44946,19 @@ var require_dcmjs2 = __commonJS({
44946
44946
  return a[0] * b3[0] + a[1] * b3[1] + a[2] * b3[2];
44947
44947
  }
44948
44948
  function cross$12(out, a, b3) {
44949
- var ax = a[0], ay2 = a[1], az = a[2];
44949
+ var ax = a[0], ay = a[1], az = a[2];
44950
44950
  var bx = b3[0], by = b3[1], bz = b3[2];
44951
- out[0] = ay2 * bz - az * by;
44951
+ out[0] = ay * bz - az * by;
44952
44952
  out[1] = az * bx - ax * bz;
44953
- out[2] = ax * by - ay2 * bx;
44953
+ out[2] = ax * by - ay * bx;
44954
44954
  return out;
44955
44955
  }
44956
44956
  function lerp2(out, a, b3, t) {
44957
44957
  var ax = a[0];
44958
- var ay2 = a[1];
44958
+ var ay = a[1];
44959
44959
  var az = a[2];
44960
44960
  out[0] = ax + t * (b3[0] - ax);
44961
- out[1] = ay2 + t * (b3[1] - ay2);
44961
+ out[1] = ay + t * (b3[1] - ay);
44962
44962
  out[2] = az + t * (b3[2] - az);
44963
44963
  return out;
44964
44964
  }
@@ -45069,7 +45069,7 @@ var require_dcmjs2 = __commonJS({
45069
45069
  return out;
45070
45070
  }
45071
45071
  function angle2(a, b3) {
45072
- var ax = a[0], ay2 = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2], mag1 = Math.sqrt(ax * ax + ay2 * ay2 + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot2(a, b3) / mag;
45072
+ var ax = a[0], ay = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot2(a, b3) / mag;
45073
45073
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
45074
45074
  }
45075
45075
  function zero2(out) {
@@ -52259,17 +52259,17 @@ var require_decorator = __commonJS({
52259
52259
  return mergedObject;
52260
52260
  };
52261
52261
  var mergePropertyAndMethodDecorators = (d1, d2) => {
52262
- var _a2, _b, _c, _d2;
52262
+ var _a2, _b, _c, _d;
52263
52263
  return {
52264
52264
  property: mergeObjectsOfDecorators((_a2 = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a2 !== void 0 ? _a2 : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
52265
- method: mergeObjectsOfDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c !== void 0 ? _c : {}, (_d2 = d2 === null || d2 === void 0 ? void 0 : d2.method) !== null && _d2 !== void 0 ? _d2 : {})
52265
+ 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 : {})
52266
52266
  };
52267
52267
  };
52268
52268
  var mergeDecorators = (d1, d2) => {
52269
- var _a2, _b, _c, _d2, _e2, _f;
52269
+ var _a2, _b, _c, _d, _e2, _f;
52270
52270
  return {
52271
52271
  class: (0, util_1.unique)([...(_a2 = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a2 !== void 0 ? _a2 : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
52272
- static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d2 = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d2 !== void 0 ? _d2 : {}),
52272
+ 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 : {}),
52273
52273
  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 : {})
52274
52274
  };
52275
52275
  };
@@ -61456,9 +61456,9 @@ var require_index_cjs = __commonJS({
61456
61456
  const mp = Math.cbrt(0.2119034982 * r6 + 0.6806995451 * g3 + 0.1073969566 * b3);
61457
61457
  const sp = Math.cbrt(0.0883024619 * r6 + 0.2817188376 * g3 + 0.6299787005 * b3);
61458
61458
  const l2 = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
61459
- const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
61459
+ const aa2 = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
61460
61460
  const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
61461
- return [l2 * 100, aa * 100, bb * 100];
61461
+ return [l2 * 100, aa2 * 100, bb * 100];
61462
61462
  };
61463
61463
  convert$1.rgb.cmyk = function(rgb) {
61464
61464
  const r6 = rgb[0] / 255;
@@ -61742,11 +61742,11 @@ var require_index_cjs = __commonJS({
61742
61742
  };
61743
61743
  convert$1.oklab.rgb = function(oklab) {
61744
61744
  const ll = oklab[0] / 100;
61745
- const aa = oklab[1] / 100;
61745
+ const aa2 = oklab[1] / 100;
61746
61746
  const bb = oklab[2] / 100;
61747
- const l2 = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
61748
- const m3 = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
61749
- const s = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
61747
+ const l2 = (ll + 0.3963377774 * aa2 + 0.2158037573 * bb) ** 3;
61748
+ const m3 = (ll - 0.1055613458 * aa2 - 0.0638541728 * bb) ** 3;
61749
+ const s = (ll - 0.0894841775 * aa2 - 1.291485548 * bb) ** 3;
61750
61750
  const r6 = srgbNonlinearTransform(4.0767416621 * l2 - 3.3077115913 * m3 + 0.2309699292 * s);
61751
61751
  const g3 = srgbNonlinearTransform(-1.2684380046 * l2 + 2.6097574011 * m3 - 0.3413193965 * s);
61752
61752
  const b3 = srgbNonlinearTransform(-0.0041960863 * l2 - 0.7034186147 * m3 + 1.707614701 * s);
@@ -62730,7 +62730,7 @@ var require_node2 = __commonJS({
62730
62730
  var require_tail_file = __commonJS({
62731
62731
  "../../node_modules/winston/lib/winston/tail-file.js"(exports2, module2) {
62732
62732
  "use strict";
62733
- var fs3 = require("fs");
62733
+ var fs4 = require("fs");
62734
62734
  var { StringDecoder } = require("string_decoder");
62735
62735
  var { Stream } = require_readable();
62736
62736
  function noop() {
@@ -62751,7 +62751,7 @@ var require_tail_file = __commonJS({
62751
62751
  stream.emit("end");
62752
62752
  stream.emit("close");
62753
62753
  };
62754
- fs3.open(options.file, "a+", "0644", (err2, fd) => {
62754
+ fs4.open(options.file, "a+", "0644", (err2, fd) => {
62755
62755
  if (err2) {
62756
62756
  if (!iter) {
62757
62757
  stream.emit("error", err2);
@@ -62763,10 +62763,10 @@ var require_tail_file = __commonJS({
62763
62763
  }
62764
62764
  (function read() {
62765
62765
  if (stream.destroyed) {
62766
- fs3.close(fd, noop);
62766
+ fs4.close(fd, noop);
62767
62767
  return;
62768
62768
  }
62769
- return fs3.read(fd, buffer2, 0, buffer2.length, pos, (error, bytes) => {
62769
+ return fs4.read(fd, buffer2, 0, buffer2.length, pos, (error, bytes) => {
62770
62770
  if (error) {
62771
62771
  if (!iter) {
62772
62772
  stream.emit("error", error);
@@ -62825,7 +62825,7 @@ var require_tail_file = __commonJS({
62825
62825
  var require_file = __commonJS({
62826
62826
  "../../node_modules/winston/lib/winston/transports/file.js"(exports2, module2) {
62827
62827
  "use strict";
62828
- var fs3 = require("fs");
62828
+ var fs4 = require("fs");
62829
62829
  var path4 = require("path");
62830
62830
  var asyncSeries = require_series();
62831
62831
  var zlib = require("zlib");
@@ -63030,7 +63030,7 @@ var require_file = __commonJS({
63030
63030
  let buff = "";
63031
63031
  let results = [];
63032
63032
  let row = 0;
63033
- const stream = fs3.createReadStream(file, {
63033
+ const stream = fs4.createReadStream(file, {
63034
63034
  encoding: "utf8"
63035
63035
  });
63036
63036
  stream.on("error", (err2) => {
@@ -63182,7 +63182,7 @@ var require_file = __commonJS({
63182
63182
  stat(callback) {
63183
63183
  const target = this._getFile();
63184
63184
  const fullpath = path4.join(this.dirname, target);
63185
- fs3.stat(fullpath, (err2, stat) => {
63185
+ fs4.stat(fullpath, (err2, stat) => {
63186
63186
  if (err2 && err2.code === "ENOENT") {
63187
63187
  debug("ENOENT\xA0ok", fullpath);
63188
63188
  this.filename = target;
@@ -63287,7 +63287,7 @@ var require_file = __commonJS({
63287
63287
  _createStream(source) {
63288
63288
  const fullpath = path4.join(this.dirname, this.filename);
63289
63289
  debug("create stream start", fullpath, this.options);
63290
- const dest = fs3.createWriteStream(fullpath, this.options).on("error", (err2) => debug(err2)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
63290
+ const dest = fs4.createWriteStream(fullpath, this.options).on("error", (err2) => debug(err2)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
63291
63291
  debug("file open ok", fullpath);
63292
63292
  this.emit("open", fullpath);
63293
63293
  source.pipe(dest);
@@ -63366,7 +63366,7 @@ var require_file = __commonJS({
63366
63366
  const isZipped = this.zippedArchive ? ".gz" : "";
63367
63367
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
63368
63368
  const target = path4.join(this.dirname, filePath);
63369
- fs3.unlink(target, callback);
63369
+ fs4.unlink(target, callback);
63370
63370
  }
63371
63371
  /**
63372
63372
  * Roll files forward based on integer, up to maxFiles. e.g. if base if
@@ -63389,17 +63389,17 @@ var require_file = __commonJS({
63389
63389
  tasks.push(function(i, cb) {
63390
63390
  let fileName = `${basename}${i - 1}${ext}${isZipped}`;
63391
63391
  const tmppath = path4.join(this.dirname, fileName);
63392
- fs3.exists(tmppath, (exists) => {
63392
+ fs4.exists(tmppath, (exists) => {
63393
63393
  if (!exists) {
63394
63394
  return cb(null);
63395
63395
  }
63396
63396
  fileName = `${basename}${i}${ext}${isZipped}`;
63397
- fs3.rename(tmppath, path4.join(this.dirname, fileName), cb);
63397
+ fs4.rename(tmppath, path4.join(this.dirname, fileName), cb);
63398
63398
  });
63399
63399
  }.bind(this, x2));
63400
63400
  }
63401
63401
  asyncSeries(tasks, () => {
63402
- fs3.rename(
63402
+ fs4.rename(
63403
63403
  path4.join(this.dirname, `${basename}${ext}${isZipped}`),
63404
63404
  path4.join(this.dirname, `${basename}1${ext}${isZipped}`),
63405
63405
  callback
@@ -63415,22 +63415,22 @@ var require_file = __commonJS({
63415
63415
  * @private
63416
63416
  */
63417
63417
  _compressFile(src, dest, callback) {
63418
- fs3.access(src, fs3.F_OK, (err2) => {
63418
+ fs4.access(src, fs4.F_OK, (err2) => {
63419
63419
  if (err2) {
63420
63420
  return callback();
63421
63421
  }
63422
63422
  var gzip2 = zlib.createGzip();
63423
- var inp = fs3.createReadStream(src);
63424
- var out = fs3.createWriteStream(dest);
63423
+ var inp = fs4.createReadStream(src);
63424
+ var out = fs4.createWriteStream(dest);
63425
63425
  out.on("finish", () => {
63426
- fs3.unlink(src, callback);
63426
+ fs4.unlink(src, callback);
63427
63427
  });
63428
63428
  inp.pipe(gzip2).pipe(out);
63429
63429
  });
63430
63430
  }
63431
63431
  _createLogDirIfNotExist(dirPath) {
63432
- if (!fs3.existsSync(dirPath)) {
63433
- fs3.mkdirSync(dirPath, { recursive: true });
63432
+ if (!fs4.existsSync(dirPath)) {
63433
+ fs4.mkdirSync(dirPath, { recursive: true });
63434
63434
  }
63435
63435
  }
63436
63436
  };
@@ -69714,7 +69714,7 @@ var require_moment = __commonJS({
69714
69714
  var require_FileStreamRotator = __commonJS({
69715
69715
  "../../node_modules/file-stream-rotator/FileStreamRotator.js"(exports2, module2) {
69716
69716
  "use strict";
69717
- var fs3 = require("fs");
69717
+ var fs4 = require("fs");
69718
69718
  var path4 = require("path");
69719
69719
  var moment = require_moment();
69720
69720
  var crypto2 = require("crypto");
@@ -69764,15 +69764,15 @@ var require_FileStreamRotator = __commonJS({
69764
69764
  };
69765
69765
  FileStreamRotator.parseFileSize = function(size) {
69766
69766
  if (size && typeof size == "string") {
69767
- var _s2 = size.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);
69768
- if (_s2) {
69769
- switch (_s2[2]) {
69767
+ var _s = size.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);
69768
+ if (_s) {
69769
+ switch (_s[2]) {
69770
69770
  case "k":
69771
- return _s2[1] * 1024;
69771
+ return _s[1] * 1024;
69772
69772
  case "m":
69773
- return _s2[1] * 1024 * 1024;
69773
+ return _s[1] * 1024 * 1024;
69774
69774
  case "g":
69775
- return _s2[1] * 1024 * 1024 * 1024;
69775
+ return _s[1] * 1024 * 1024 * 1024;
69776
69776
  }
69777
69777
  }
69778
69778
  }
@@ -69809,10 +69809,10 @@ var require_FileStreamRotator = __commonJS({
69809
69809
  try {
69810
69810
  if (audit_file) {
69811
69811
  var full_path = path4.resolve(audit_file);
69812
- _rtn = JSON.parse(fs3.readFileSync(full_path, { encoding: "utf-8" }));
69812
+ _rtn = JSON.parse(fs4.readFileSync(full_path, { encoding: "utf-8" }));
69813
69813
  } else {
69814
69814
  var full_path = path4.resolve(baseLog + "/.audit.json");
69815
- _rtn = JSON.parse(fs3.readFileSync(full_path, { encoding: "utf-8" }));
69815
+ _rtn = JSON.parse(fs4.readFileSync(full_path, { encoding: "utf-8" }));
69816
69816
  }
69817
69817
  } catch (e) {
69818
69818
  if (e.code !== "ENOENT") {
@@ -69838,7 +69838,7 @@ var require_FileStreamRotator = __commonJS({
69838
69838
  FileStreamRotator.writeAuditLog = function(audit, verbose) {
69839
69839
  try {
69840
69840
  mkDirForFile(audit.auditLog);
69841
- fs3.writeFileSync(audit.auditLog, JSON.stringify(audit, null, 4));
69841
+ fs4.writeFileSync(audit.auditLog, JSON.stringify(audit, null, 4));
69842
69842
  } catch (e) {
69843
69843
  if (verbose) {
69844
69844
  console.error(/* @__PURE__ */ new Date(), "[FileStreamRotator] Failed to store log audit at:", audit.auditLog, "Error:", e);
@@ -69848,8 +69848,8 @@ var require_FileStreamRotator = __commonJS({
69848
69848
  function removeFile(file, verbose) {
69849
69849
  if (file.hash === crypto2.createHash(file.hashType).update(file.name + "LOG_FILE" + file.date).digest("hex")) {
69850
69850
  try {
69851
- if (fs3.existsSync(file.name)) {
69852
- fs3.unlinkSync(file.name);
69851
+ if (fs4.existsSync(file.name)) {
69852
+ fs4.unlinkSync(file.name);
69853
69853
  }
69854
69854
  } catch (e) {
69855
69855
  if (verbose) {
@@ -69864,15 +69864,15 @@ var require_FileStreamRotator = __commonJS({
69864
69864
  let logfileName = path4.basename(logfile);
69865
69865
  let current = logPath + "/" + symLinkName;
69866
69866
  try {
69867
- let stats = fs3.lstatSync(current);
69867
+ let stats = fs4.lstatSync(current);
69868
69868
  if (stats.isSymbolicLink()) {
69869
- fs3.unlinkSync(current);
69870
- fs3.symlinkSync(logfileName, current);
69869
+ fs4.unlinkSync(current);
69870
+ fs4.symlinkSync(logfileName, current);
69871
69871
  }
69872
69872
  } catch (err2) {
69873
69873
  if (err2 && err2.code == "ENOENT") {
69874
69874
  try {
69875
- fs3.symlinkSync(logfileName, current);
69875
+ fs4.symlinkSync(logfileName, current);
69876
69876
  } catch (e) {
69877
69877
  if (verbose) {
69878
69878
  console.error(/* @__PURE__ */ new Date(), "[FileStreamRotator] Could not create symlink file: ", current, " -> ", logfileName);
@@ -69884,11 +69884,11 @@ var require_FileStreamRotator = __commonJS({
69884
69884
  function createLogWatcher(logfile, verbose, cb) {
69885
69885
  if (!logfile) return null;
69886
69886
  try {
69887
- let stats = fs3.lstatSync(logfile);
69888
- return fs3.watch(logfile, function(event, filename) {
69887
+ let stats = fs4.lstatSync(logfile);
69888
+ return fs4.watch(logfile, function(event, filename) {
69889
69889
  if (event == "rename") {
69890
69890
  try {
69891
- let stats2 = fs3.lstatSync(logfile);
69891
+ let stats2 = fs4.lstatSync(logfile);
69892
69892
  } catch (err2) {
69893
69893
  cb(err2, logfile);
69894
69894
  }
@@ -70004,13 +70004,13 @@ var require_FileStreamRotator = __commonJS({
70004
70004
  if (fileCount == 0 && t_log == logfile) {
70005
70005
  t_log += options.extension;
70006
70006
  }
70007
- while (f2 = fs3.existsSync(t_log)) {
70007
+ while (f2 = fs4.existsSync(t_log)) {
70008
70008
  lastLogFile = t_log;
70009
70009
  fileCount++;
70010
70010
  t_log = logfile + "." + fileCount + options.extension;
70011
70011
  }
70012
70012
  if (lastLogFile) {
70013
- var lastLogFileStats = fs3.statSync(lastLogFile);
70013
+ var lastLogFileStats = fs4.statSync(lastLogFile);
70014
70014
  if (lastLogFileStats.size < fileSize) {
70015
70015
  t_log = lastLogFile;
70016
70016
  fileCount--;
@@ -70026,7 +70026,7 @@ var require_FileStreamRotator = __commonJS({
70026
70026
  }
70027
70027
  mkDirForFile(logfile);
70028
70028
  var file_options = options.file_options || { flags: "a" };
70029
- var rotateStream = fs3.createWriteStream(logfile, file_options);
70029
+ var rotateStream = fs4.createWriteStream(logfile, file_options);
70030
70030
  if (curDate && frequencyMetaData && staticFrequency.indexOf(frequencyMetaData.type) > -1 || fileSize > 0) {
70031
70031
  if (self2.verbose) {
70032
70032
  console.log(/* @__PURE__ */ new Date(), "[FileStreamRotator] Rotating file: ", frequencyMetaData ? frequencyMetaData.type : "", fileSize ? "size: " + fileSize : "");
@@ -70065,12 +70065,12 @@ var require_FileStreamRotator = __commonJS({
70065
70065
  });
70066
70066
  stream.on("createLog", function(file) {
70067
70067
  try {
70068
- let stats = fs3.lstatSync(file);
70068
+ let stats = fs4.lstatSync(file);
70069
70069
  } catch (err2) {
70070
70070
  if (rotateStream && rotateStream.end == "function") {
70071
70071
  rotateStream.end();
70072
70072
  }
70073
- rotateStream = fs3.createWriteStream(file, file_options);
70073
+ rotateStream = fs4.createWriteStream(file, file_options);
70074
70074
  stream.emit("new", file);
70075
70075
  BubbleEvents(rotateStream, stream);
70076
70076
  }
@@ -70102,7 +70102,7 @@ var require_FileStreamRotator = __commonJS({
70102
70102
  rotateStream.destroy();
70103
70103
  }
70104
70104
  mkDirForFile(logfile);
70105
- rotateStream = fs3.createWriteStream(newLogfile, file_options);
70105
+ rotateStream = fs4.createWriteStream(newLogfile, file_options);
70106
70106
  stream.emit("new", newLogfile);
70107
70107
  stream.emit("rotate", oldFile, newLogfile);
70108
70108
  BubbleEvents(rotateStream, stream);
@@ -70130,9 +70130,9 @@ var require_FileStreamRotator = __commonJS({
70130
70130
  _path.split(path4.sep).reduce(
70131
70131
  function(fullPath, folder) {
70132
70132
  fullPath += folder + path4.sep;
70133
- if (!fs3.existsSync(fullPath)) {
70133
+ if (!fs4.existsSync(fullPath)) {
70134
70134
  try {
70135
- fs3.mkdirSync(fullPath);
70135
+ fs4.mkdirSync(fullPath);
70136
70136
  } catch (e) {
70137
70137
  if (e.code !== "EEXIST") {
70138
70138
  throw e;
@@ -70165,7 +70165,7 @@ var require_FileStreamRotator = __commonJS({
70165
70165
  var require_daily_rotate_file = __commonJS({
70166
70166
  "../../node_modules/winston-daily-rotate-file/daily-rotate-file.js"(exports2, module2) {
70167
70167
  "use strict";
70168
- var fs3 = require("fs");
70168
+ var fs4 = require("fs");
70169
70169
  var os = require("os");
70170
70170
  var path4 = require("path");
70171
70171
  var util = require("util");
@@ -70257,7 +70257,7 @@ var require_daily_rotate_file = __commonJS({
70257
70257
  if (options.zippedArchive) {
70258
70258
  const gzName = params.name + ".gz";
70259
70259
  try {
70260
- fs3.unlinkSync(gzName);
70260
+ fs4.unlinkSync(gzName);
70261
70261
  } catch (err2) {
70262
70262
  if (err2.code !== "ENOENT") {
70263
70263
  err2.message = `Error occurred while removing ${gzName}: ${err2.message}`;
@@ -70273,7 +70273,7 @@ var require_daily_rotate_file = __commonJS({
70273
70273
  if (options.zippedArchive) {
70274
70274
  this.logStream.on("rotate", (oldFile) => {
70275
70275
  try {
70276
- if (!fs3.existsSync(oldFile)) {
70276
+ if (!fs4.existsSync(oldFile)) {
70277
70277
  return;
70278
70278
  }
70279
70279
  } catch (err2) {
@@ -70282,7 +70282,7 @@ var require_daily_rotate_file = __commonJS({
70282
70282
  return;
70283
70283
  }
70284
70284
  try {
70285
- if (fs3.existsSync(`${oldFile}.gz`)) {
70285
+ if (fs4.existsSync(`${oldFile}.gz`)) {
70286
70286
  return;
70287
70287
  }
70288
70288
  } catch (err2) {
@@ -70291,19 +70291,19 @@ var require_daily_rotate_file = __commonJS({
70291
70291
  return;
70292
70292
  }
70293
70293
  const gzip2 = zlib.createGzip();
70294
- const inp = fs3.createReadStream(oldFile);
70294
+ const inp = fs4.createReadStream(oldFile);
70295
70295
  inp.on("error", (err2) => {
70296
70296
  err2.message = `Error occurred while reading ${oldFile}: ${err2.message}`;
70297
70297
  this.emit("error", err2);
70298
70298
  });
70299
- const out = fs3.createWriteStream(oldFile + ".gz");
70299
+ const out = fs4.createWriteStream(oldFile + ".gz");
70300
70300
  out.on("error", (err2) => {
70301
70301
  err2.message = `Error occurred while writing ${oldFile}.gz: ${err2.message}`;
70302
70302
  this.emit("error", err2);
70303
70303
  });
70304
70304
  inp.pipe(gzip2).pipe(out).on("finish", () => {
70305
70305
  try {
70306
- fs3.unlinkSync(oldFile);
70306
+ fs4.unlinkSync(oldFile);
70307
70307
  } catch (err2) {
70308
70308
  if (err2.code !== "ENOENT") {
70309
70309
  err2.message = `Error occurred while removing ${oldFile}: ${err2.message}`;
@@ -70368,7 +70368,7 @@ var require_daily_rotate_file = __commonJS({
70368
70368
  options.order = options.order || "desc";
70369
70369
  const logFiles = (() => {
70370
70370
  const fileRegex = new RegExp(this.filename.replace("%DATE%", ".*"), "i");
70371
- return fs3.readdirSync(this.dirname).filter((file) => path4.basename(file).match(fileRegex));
70371
+ return fs4.readdirSync(this.dirname).filter((file) => path4.basename(file).match(fileRegex));
70372
70372
  })();
70373
70373
  if (logFiles.length === 0 && callback) {
70374
70374
  callback(null, results);
@@ -70382,14 +70382,14 @@ var require_daily_rotate_file = __commonJS({
70382
70382
  let stream;
70383
70383
  if (file.endsWith(".gz")) {
70384
70384
  stream = new PassThrough();
70385
- const inp = fs3.createReadStream(logFile);
70385
+ const inp = fs4.createReadStream(logFile);
70386
70386
  inp.on("error", (err2) => {
70387
70387
  err2.message = `Error occurred while reading ${logFile}: ${err2.message}`;
70388
70388
  stream.emit("error", err2);
70389
70389
  });
70390
70390
  inp.pipe(zlib.createGunzip()).pipe(stream);
70391
70391
  } else {
70392
- stream = fs3.createReadStream(logFile, {
70392
+ stream = fs4.createReadStream(logFile, {
70393
70393
  encoding: "utf8"
70394
70394
  });
70395
70395
  }
@@ -70632,7 +70632,7 @@ function _n(r6) {
70632
70632
  function Tr(r6) {
70633
70633
  return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
70634
70634
  }
70635
- function Ge(r6) {
70635
+ function Qe(r6) {
70636
70636
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
70637
70637
  }
70638
70638
  function br(r6) {
@@ -70646,10 +70646,10 @@ var f = class extends Error {
70646
70646
  }
70647
70647
  };
70648
70648
  function ht(r6) {
70649
- return r6 instanceof f ? r6.outcome : Ge(r6) ? r6 : R(_e(r6));
70649
+ return r6 instanceof f ? r6.outcome : Qe(r6) ? r6 : R(_e(r6));
70650
70650
  }
70651
70651
  function _e(r6) {
70652
- return r6 ? typeof r6 == "string" ? r6 : Tr(r6) ? r6.message : Ge(r6) ? Ln(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
70652
+ return r6 ? typeof r6 == "string" ? r6 : Tr(r6) ? r6.message : Qe(r6) ? Ln(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
70653
70653
  }
70654
70654
  function Ln(r6) {
70655
70655
  let e = r6.issue?.map(ko) ?? [];
@@ -70696,7 +70696,7 @@ function wr(r6) {
70696
70696
  function Qn(r6) {
70697
70697
  return !!be[r6];
70698
70698
  }
70699
- function Qe(r6, e) {
70699
+ function ze(r6, e) {
70700
70700
  if (e) {
70701
70701
  let t = Hn(e)[r6];
70702
70702
  if (t) return t;
@@ -70906,7 +70906,7 @@ function Tt(r6) {
70906
70906
  let e = [];
70907
70907
  for (let t of r6) {
70908
70908
  let n = false;
70909
- for (let i of e) if (q(Je(t, i))) {
70909
+ for (let i of e) if (q(Ke(t, i))) {
70910
70910
  n = true;
70911
70911
  break;
70912
70912
  }
@@ -70918,12 +70918,12 @@ function ei(r6) {
70918
70918
  return h(!q(r6));
70919
70919
  }
70920
70920
  function ti(r6, e) {
70921
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => q(Je(t, e[n]))));
70921
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => q(Ke(t, e[n]))));
70922
70922
  }
70923
70923
  function ri(r6, e) {
70924
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !q(Je(t, e[n]))));
70924
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !q(Ke(t, e[n]))));
70925
70925
  }
70926
- function Je(r6, e) {
70926
+ function Ke(r6, e) {
70927
70927
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
70928
70928
  return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : I(t) && I(n) ? h(oi(t, n)) : h(typeof t == "object" && typeof n == "object" ? Br(r6, e) : t === n);
70929
70929
  }
@@ -71001,7 +71001,7 @@ function Nr(r6, e) {
71001
71001
  function es(r6, e) {
71002
71002
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
71003
71003
  }
71004
- function Ye(r6, e) {
71004
+ function Xe(r6, e) {
71005
71005
  return V(r6, e) && "id" in r6 && typeof r6.id == "string";
71006
71006
  }
71007
71007
  function Se(r6) {
@@ -71010,7 +71010,7 @@ function Se(r6) {
71010
71010
  }
71011
71011
  function A(r6) {
71012
71012
  if (G(r6)) return r6.reference;
71013
- if (Ye(r6)) return `${r6.resourceType}/${r6.id}`;
71013
+ if (Xe(r6)) return `${r6.resourceType}/${r6.id}`;
71014
71014
  }
71015
71015
  function Ee(r6) {
71016
71016
  if (r6) return G(r6) ? r6.reference.split("/")[1] : r6.id;
@@ -71027,14 +71027,14 @@ function rs(r6) {
71027
71027
  let e = is(r6);
71028
71028
  if (e) return e;
71029
71029
  }
71030
- if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ke(r6.medicationCodeableConcept);
71030
+ if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ye(r6.medicationCodeableConcept);
71031
71031
  if (r6.resourceType === "Subscription" && r6.criteria) return r6.criteria;
71032
71032
  if (r6.resourceType === "User" && r6.email) return r6.email;
71033
71033
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
71034
71034
  if ("code" in r6 && r6.code) {
71035
71035
  let e = r6.code;
71036
- if (Array.isArray(e) && (e = e[0]), Wr(e)) return Ke(e);
71037
- if (ds(e)) return e.text;
71036
+ if (Array.isArray(e) && (e = e[0]), Wr(e)) return Ye(e);
71037
+ if (fs2(e)) return e.text;
71038
71038
  }
71039
71039
  return A(r6) ?? "";
71040
71040
  }
@@ -71132,7 +71132,7 @@ function qr(r6) {
71132
71132
  function Wr(r6) {
71133
71133
  return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(qr);
71134
71134
  }
71135
- function ds(r6) {
71135
+ function fs2(r6) {
71136
71136
  return E(r6) && "text" in r6 && typeof r6.text == "string";
71137
71137
  }
71138
71138
  var li = [];
@@ -71160,7 +71160,7 @@ var Qr = (r6, e) => new Promise((t, n) => {
71160
71160
  clearTimeout(i), n(e.signal?.reason);
71161
71161
  }, { once: true });
71162
71162
  });
71163
- function Xe(r6, e, t) {
71163
+ function qe(r6, e, t) {
71164
71164
  let n = [];
71165
71165
  for (let i = 0; i < t - 1; i++) {
71166
71166
  let o2 = r6.indexOf(e);
@@ -71175,11 +71175,11 @@ function Pt(r6) {
71175
71175
  function zr(r6) {
71176
71176
  return r6.endsWith("/") ? r6 : r6 + "/";
71177
71177
  }
71178
- function vs(r6) {
71178
+ function Ts(r6) {
71179
71179
  return r6.startsWith("/") ? r6.slice(1) : r6;
71180
71180
  }
71181
71181
  function F(r6, e) {
71182
- return new URL(vs(e), zr(r6.toString())).toString();
71182
+ return new URL(Ts(e), zr(r6.toString())).toString();
71183
71183
  }
71184
71184
  function gi(r6, e) {
71185
71185
  return F(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
@@ -71187,9 +71187,9 @@ function gi(r6, e) {
71187
71187
  function xi(r6) {
71188
71188
  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();
71189
71189
  }
71190
- 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])$/;
71191
- function rp(r6) {
71192
- return Ts.test(r6);
71190
+ var bs = /^(([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])$/;
71191
+ function ip(r6) {
71192
+ return bs.test(r6);
71193
71193
  }
71194
71194
  var g = Object.freeze([]);
71195
71195
  function Ze(r6, e) {
@@ -71201,7 +71201,7 @@ function Ze(r6, e) {
71201
71201
  }
71202
71202
  return t.join(" ").trim();
71203
71203
  }
71204
- function Ke(r6) {
71204
+ function Ye(r6) {
71205
71205
  if (!r6) return "";
71206
71206
  let e = Ce(r6.text);
71207
71207
  return e || (r6.coding ? r6.coding.map((t) => Ti(t)).join(", ") : "");
@@ -71234,16 +71234,16 @@ function Kr(r6) {
71234
71234
  }
71235
71235
  function Rr(r6) {
71236
71236
  let e = r6.type?.[0]?.code;
71237
- return e === "BackboneElement" || e === "Element" ? ks((r6.base?.path ?? r6.path)?.split(".")) : e;
71237
+ return e === "BackboneElement" || e === "Element" ? Vs((r6.base?.path ?? r6.path)?.split(".")) : e;
71238
71238
  }
71239
- function ks(r6) {
71239
+ function Vs(r6) {
71240
71240
  return r6.length === 1 ? r6[0] : r6.map(_).join("");
71241
71241
  }
71242
71242
  function Et(r6, e, t) {
71243
- let n = Qe(r6, t);
71244
- if (n) return _s(n.elements, e);
71243
+ let n = ze(r6, t);
71244
+ if (n) return Ls(n.elements, e);
71245
71245
  }
71246
- function _s(r6, e) {
71246
+ function Ls(r6, e) {
71247
71247
  let t = r6[e] ?? r6[e + "[x]"];
71248
71248
  if (t) return t;
71249
71249
  for (let n = 0; n < e.length; n++) {
@@ -71261,7 +71261,7 @@ function G(r6, e) {
71261
71261
  return r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string" ? e ? r6.reference.match(new RegExp(`^${e}(/|\\?)`)) !== null : true : false;
71262
71262
  }
71263
71263
  var W = { types: {} };
71264
- function qe(r6) {
71264
+ function We(r6) {
71265
71265
  if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
71266
71266
  if (r6.length <= 10) return r6;
71267
71267
  try {
@@ -71345,11 +71345,11 @@ var D = { empty: (r6, e) => h(e.every((t) => C(t.value))), hasValue: (r6, e) =>
71345
71345
  }, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(D.toInteger(r6, e).length === 1), toDate: (r6, e) => {
71346
71346
  if (e.length === 0) return [];
71347
71347
  let [{ value: t }] = Z(e, 1);
71348
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: p.date, value: qe(t) }] : [];
71348
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: p.date, value: We(t) }] : [];
71349
71349
  }, convertsToDate: (r6, e) => e.length === 0 ? [] : h(D.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
71350
71350
  if (e.length === 0) return [];
71351
71351
  let [{ value: t }] = Z(e, 1);
71352
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: p.dateTime, value: qe(t) }] : [];
71352
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: p.dateTime, value: We(t) }] : [];
71353
71353
  }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(D.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
71354
71354
  if (e.length === 0) return [];
71355
71355
  let [{ value: t }] = Z(e, 1);
@@ -71367,7 +71367,7 @@ var D = { empty: (r6, e) => h(e.every((t) => C(t.value))), hasValue: (r6, e) =>
71367
71367
  let [{ value: t }] = Z(e, 1);
71368
71368
  if (typeof t == "string") {
71369
71369
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
71370
- if (n) return [{ type: p.time, value: qe("T" + n[1]) }];
71370
+ if (n) return [{ type: p.time, value: We("T" + n[1]) }];
71371
71371
  }
71372
71372
  return [];
71373
71373
  }, convertsToTime: (r6, e) => e.length === 0 ? [] : h(D.toTime(r6, e).length === 1), indexOf: (r6, e, t) => j((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => j((i, o2, s) => {
@@ -71563,7 +71563,7 @@ var Vt = class extends w {
71563
71563
  }
71564
71564
  eval(e, t) {
71565
71565
  let n = K(this.left.eval(e, t)), i = this.right.eval(e, t);
71566
- return n ? h(i.some((o2) => Je(n, o2)[0].value)) : [];
71566
+ return n ? h(i.some((o2) => Ke(n, o2)[0].value)) : [];
71567
71567
  }
71568
71568
  };
71569
71569
  var ee = class extends ue {
@@ -71704,38 +71704,38 @@ var Oe = class {
71704
71704
  };
71705
71705
  var tt = ["!=", "!~", "<=", ">=", "{}", "->"];
71706
71706
  var T = { 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 };
71707
- var Us = { parse(r6) {
71707
+ var Bs = { parse(r6) {
71708
71708
  let e = r6.consumeAndParse();
71709
71709
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
71710
71710
  return e;
71711
71711
  } };
71712
- var Bs = { parse(r6, e) {
71712
+ var qs = { parse(r6, e) {
71713
71713
  let t = r6.consumeAndParse();
71714
71714
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
71715
71715
  return new Oe(e, t);
71716
71716
  }, precedence: T.Indexer };
71717
- var qs = { parse(r6, e) {
71717
+ var Ws = { parse(r6, e) {
71718
71718
  if (!(e instanceof N)) throw new Error("Unexpected parentheses");
71719
71719
  let t = [];
71720
71720
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
71721
71721
  return new oe(e.name, t);
71722
71722
  }, precedence: T.FunctionCall };
71723
- function Ws(r6) {
71723
+ function js(r6) {
71724
71724
  let e = r6.split(" "), t = Number.parseFloat(e[0]), n = e[1];
71725
71725
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
71726
71726
  }
71727
71727
  function rt() {
71728
- return new pt().registerPrefix("String", { parse: (r6, e) => new $({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new $({ type: p.dateTime, value: qe(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new $({ type: p.Quantity, value: Ws(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new $({ type: e.value.includes(".") ? p.decimal : p.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new $({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new $({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new N(e.value) }).registerPrefix("{}", { parse: () => new wt() }).registerPrefix("(", Us).registerInfix("[", Bs).registerInfix("(", qs).prefix("+", T.UnaryAdd, (r6, e) => new Ot("+", e, (t) => t)).prefix("-", T.UnarySubtract, (r6, e) => new L("-", e, e, (t, n) => -n)).infixLeft(".", T.Dot, (r6, e, t) => new ee(r6, t)).infixLeft("/", T.Divide, (r6, e, t) => new L("/", r6, t, (n, i) => n / i)).infixLeft("*", T.Multiply, (r6, e, t) => new L("*", r6, t, (n, i) => n * i)).infixLeft("+", T.Add, (r6, e, t) => new L("+", r6, t, (n, i) => n + i)).infixLeft("-", T.Subtract, (r6, e, t) => new L("-", r6, t, (n, i) => n - i)).infixLeft("|", T.Union, (r6, e, t) => new Ae(r6, t)).infixLeft("=", T.Equals, (r6, e, t) => new Dt(r6, t)).infixLeft("!=", T.NotEquals, (r6, e, t) => new Mt(r6, t)).infixLeft("~", T.Equivalent, (r6, e, t) => new _t(r6, t)).infixLeft("!~", T.NotEquivalent, (r6, e, t) => new Lt(r6, t)).infixLeft("<", T.LessThan, (r6, e, t) => new L("<", r6, t, (n, i) => n < i)).infixLeft("<=", T.LessThanOrEquals, (r6, e, t) => new L("<=", r6, t, (n, i) => n <= i)).infixLeft(">", T.GreaterThan, (r6, e, t) => new L(">", r6, t, (n, i) => n > i)).infixLeft(">=", T.GreaterThanOrEquals, (r6, e, t) => new L(">=", r6, t, (n, i) => n >= i)).infixLeft("&", T.Ampersand, (r6, e, t) => new It(r6, t)).infixLeft("and", T.And, (r6, e, t) => new Ft(r6, t)).infixLeft("as", T.As, (r6, e, t) => new ye(r6, t)).infixLeft("contains", T.Contains, (r6, e, t) => new kt(r6, t)).infixLeft("div", T.Divide, (r6, e, t) => new L("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", T.In, (r6, e, t) => new Vt(r6, t)).infixLeft("is", T.Is, (r6, e, t) => new we(r6, t)).infixLeft("mod", T.Modulo, (r6, e, t) => new L("mod", r6, t, (n, i) => n % i)).infixLeft("or", T.Or, (r6, e, t) => new Nt(r6, t)).infixLeft("xor", T.Xor, (r6, e, t) => new Ut(r6, t)).infixLeft("implies", T.Implies, (r6, e, t) => new Bt(r6, t));
71728
+ return new pt().registerPrefix("String", { parse: (r6, e) => new $({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new $({ type: p.dateTime, value: We(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new $({ type: p.Quantity, value: js(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new $({ type: e.value.includes(".") ? p.decimal : p.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new $({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new $({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new N(e.value) }).registerPrefix("{}", { parse: () => new wt() }).registerPrefix("(", Bs).registerInfix("[", qs).registerInfix("(", Ws).prefix("+", T.UnaryAdd, (r6, e) => new Ot("+", e, (t) => t)).prefix("-", T.UnarySubtract, (r6, e) => new L("-", e, e, (t, n) => -n)).infixLeft(".", T.Dot, (r6, e, t) => new ee(r6, t)).infixLeft("/", T.Divide, (r6, e, t) => new L("/", r6, t, (n, i) => n / i)).infixLeft("*", T.Multiply, (r6, e, t) => new L("*", r6, t, (n, i) => n * i)).infixLeft("+", T.Add, (r6, e, t) => new L("+", r6, t, (n, i) => n + i)).infixLeft("-", T.Subtract, (r6, e, t) => new L("-", r6, t, (n, i) => n - i)).infixLeft("|", T.Union, (r6, e, t) => new Ae(r6, t)).infixLeft("=", T.Equals, (r6, e, t) => new Dt(r6, t)).infixLeft("!=", T.NotEquals, (r6, e, t) => new Mt(r6, t)).infixLeft("~", T.Equivalent, (r6, e, t) => new _t(r6, t)).infixLeft("!~", T.NotEquivalent, (r6, e, t) => new Lt(r6, t)).infixLeft("<", T.LessThan, (r6, e, t) => new L("<", r6, t, (n, i) => n < i)).infixLeft("<=", T.LessThanOrEquals, (r6, e, t) => new L("<=", r6, t, (n, i) => n <= i)).infixLeft(">", T.GreaterThan, (r6, e, t) => new L(">", r6, t, (n, i) => n > i)).infixLeft(">=", T.GreaterThanOrEquals, (r6, e, t) => new L(">=", r6, t, (n, i) => n >= i)).infixLeft("&", T.Ampersand, (r6, e, t) => new It(r6, t)).infixLeft("and", T.And, (r6, e, t) => new Ft(r6, t)).infixLeft("as", T.As, (r6, e, t) => new ye(r6, t)).infixLeft("contains", T.Contains, (r6, e, t) => new kt(r6, t)).infixLeft("div", T.Divide, (r6, e, t) => new L("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", T.In, (r6, e, t) => new Vt(r6, t)).infixLeft("is", T.Is, (r6, e, t) => new we(r6, t)).infixLeft("mod", T.Modulo, (r6, e, t) => new L("mod", r6, t, (n, i) => n % i)).infixLeft("or", T.Or, (r6, e, t) => new Nt(r6, t)).infixLeft("xor", T.Xor, (r6, e, t) => new Ut(r6, t)).infixLeft("implies", T.Implies, (r6, e, t) => new Bt(r6, t));
71729
71729
  }
71730
- var js = rt();
71730
+ var $s = rt();
71731
71731
  var m = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
71732
71732
  var Yr = { contains: m.CONTAINS, exact: m.EXACT, above: m.ABOVE, below: m.BELOW, text: m.TEXT, not: m.NOT, in: m.IN, "not-in": m.NOT_IN, "of-type": m.OF_TYPE, missing: m.MISSING, identifier: m.IDENTIFIER, iterate: m.ITERATE };
71733
71733
  var Xr = { eq: m.EQUALS, ne: m.NOT_EQUALS, lt: m.LESS_THAN, le: m.LESS_THAN_OR_EQUALS, gt: m.GREATER_THAN, ge: m.GREATER_THAN_OR_EQUALS, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, ap: m.APPROXIMATELY, sw: m.STARTS_WITH };
71734
- var Ys = [m.MISSING, m.PRESENT];
71735
- var sa = new z(1e3);
71734
+ var Xs = [m.MISSING, m.PRESENT];
71735
+ var aa = new z(1e3);
71736
71736
  var ke = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
71737
- var va = [ke.READ, ke.VREAD, ke.HISTORY, ke.SEARCH];
71738
- var _d = { FIRST: "first", APPLICATION: "application" };
71737
+ var Ta = [ke.READ, ke.VREAD, ke.HISTORY, ke.SEARCH];
71738
+ var Fd = { FIRST: "first", APPLICATION: "application" };
71739
71739
  function H() {
71740
71740
  return typeof window < "u";
71741
71741
  }
@@ -71755,7 +71755,7 @@ var se = { assign(r6) {
71755
71755
  }, getOrigin() {
71756
71756
  return H() ? globalThis.location.protocol + "//" + globalThis.location.host + "/" : "";
71757
71757
  } };
71758
- function Sa(r6) {
71758
+ function Ea(r6) {
71759
71759
  if (H()) {
71760
71760
  let t = window.atob(r6), n = Uint8Array.from(t, (i) => i.codePointAt(0));
71761
71761
  return new window.TextDecoder().decode(n);
@@ -71776,7 +71776,7 @@ function $t(r6) {
71776
71776
  function Li(r6) {
71777
71777
  r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
71778
71778
  let e = r6.replaceAll("-", "+").replaceAll("_", "/");
71779
- return Sa(e);
71779
+ return Ea(e);
71780
71780
  }
71781
71781
  function en() {
71782
71782
  let r6 = new Uint32Array(28);
@@ -71842,7 +71842,7 @@ var te = class {
71842
71842
  }
71843
71843
  };
71844
71844
  var rn = { "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" };
71845
- var Da = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
71845
+ var Ma = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
71846
71846
  var nn = ["DiagnosticReport-update"];
71847
71847
  function Ui(r6) {
71848
71848
  return nn.includes(r6);
@@ -71850,9 +71850,9 @@ function Ui(r6) {
71850
71850
  function Bi(r6) {
71851
71851
  if (nn.includes(r6)) throw new f(v(`'context.version' is required for '${r6}'.`));
71852
71852
  }
71853
- var Ma = { "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" } } };
71854
- function _a(r6) {
71855
- return Da.includes(r6);
71853
+ var _a = { "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" } } };
71854
+ function La(r6) {
71855
+ return Ma.includes(r6);
71856
71856
  }
71857
71857
  function qi(r6) {
71858
71858
  return !!r6.endpoint;
@@ -71869,27 +71869,27 @@ function Gt(r6) {
71869
71869
  for (let o2 of i) if (!rn[o2]) return false;
71870
71870
  return !(qi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
71871
71871
  }
71872
- function La(r6, e, t, n) {
71872
+ function Fa(r6, e, t, n) {
71873
71873
  if (typeof e != "object") throw new f(v(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
71874
71874
  if (!(e.id && typeof e.id == "string")) throw new f(v(`context[${t}] is invalid. Resource must contain a valid string ID.`));
71875
71875
  if (!e.resourceType) throw new f(v(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
71876
71876
  let i = n.resourceType;
71877
71877
  if (i !== "*") {
71878
- if (!_a(e.resourceType)) throw new f(v(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
71878
+ if (!La(e.resourceType)) throw new f(v(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
71879
71879
  if (i && e.resourceType !== i) throw new f(v(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i}.`));
71880
71880
  }
71881
71881
  }
71882
- function Fa(r6, e, t, n, i) {
71882
+ function Na(r6, e, t, n, i) {
71883
71883
  if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
71884
71884
  if (!G(e.reference)) throw new f(v(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
71885
- } else La(r6, e.resource, t, n);
71885
+ } else Fa(r6, e.resource, t, n);
71886
71886
  }
71887
- function Na(r6, e) {
71888
- let t = /* @__PURE__ */ new Map(), n = Ma[r6];
71887
+ function Ua(r6, e) {
71888
+ let t = /* @__PURE__ */ new Map(), n = _a[r6];
71889
71889
  for (let i = 0; i < e.length; i++) {
71890
71890
  let o2 = e[i].key;
71891
71891
  if (!n[o2]) throw new f(v(`Key '${o2}' not found for event '${r6}'. Make sure to add only valid keys.`));
71892
- Fa(r6, e[i], i, n[o2], t);
71892
+ Na(r6, e[i], i, n[o2], t);
71893
71893
  }
71894
71894
  for (let [i, o2] of Object.entries(n)) {
71895
71895
  if (!(o2.optional || t.has(i))) throw new f(v(`Missing required key '${i}' on context for '${r6}' event.`));
@@ -71902,7 +71902,7 @@ function sn(r6, e, t, n) {
71902
71902
  if (typeof t != "object") throw new f(v("context must be a context object or array of context objects."));
71903
71903
  if (nn.includes(e) && !n) throw new f(v(`The '${e}' event must contain a 'context.versionId'.`));
71904
71904
  let i = Array.isArray(t) ? t : [t];
71905
- return Na(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ae(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
71905
+ return Ua(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ae(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
71906
71906
  }
71907
71907
  var Ht = class extends te {
71908
71908
  constructor(t) {
@@ -71927,7 +71927,7 @@ var Ht = class extends te {
71927
71927
  this.websocket.close();
71928
71928
  }
71929
71929
  };
71930
- function Ua(r6) {
71930
+ function Ba(r6) {
71931
71931
  return JSON.parse(Li(r6));
71932
71932
  }
71933
71933
  function Wi(r6) {
@@ -71935,7 +71935,7 @@ function Wi(r6) {
71935
71935
  }
71936
71936
  function Qt(r6) {
71937
71937
  let [e, t, n] = r6.split(".");
71938
- return Ua(t);
71938
+ return Ba(t);
71939
71939
  }
71940
71940
  function ji(r6) {
71941
71941
  try {
@@ -72058,18 +72058,18 @@ var an = class {
72058
72058
  return Array.from(this.data.keys())[e];
72059
72059
  }
72060
72060
  };
72061
- var je = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
72061
+ var $e = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
72062
72062
  var Qi = false;
72063
- function Ba() {
72063
+ function qa() {
72064
72064
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
72065
- je.Event = globalThis.Event, je.ErrorEvent = class extends Event {
72065
+ $e.Event = globalThis.Event, $e.ErrorEvent = class extends Event {
72066
72066
  constructor(t, n) {
72067
72067
  super("error", n);
72068
72068
  c(this, "message");
72069
72069
  c(this, "error");
72070
72070
  this.message = t.message, this.error = t;
72071
72071
  }
72072
- }, je.CloseEvent = class extends Event {
72072
+ }, $e.CloseEvent = class extends Event {
72073
72073
  constructor(t = 1e3, n = "", i) {
72074
72074
  super("close", i);
72075
72075
  c(this, "code");
@@ -72079,7 +72079,7 @@ function Ba() {
72079
72079
  }
72080
72080
  };
72081
72081
  }
72082
- function qa(r6, e) {
72082
+ function Wa(r6, e) {
72083
72083
  if (!r6) throw new Error(e);
72084
72084
  }
72085
72085
  function Jt(r6) {
@@ -72089,7 +72089,7 @@ var Ve = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random()
72089
72089
  var zi = false;
72090
72090
  var Kt = class r extends te {
72091
72091
  constructor(t, n, i = {}) {
72092
- Qi || (Ba(), Qi = true);
72092
+ Qi || (qa(), Qi = true);
72093
72093
  super();
72094
72094
  c(this, "_ws");
72095
72095
  c(this, "_retryCount", -1);
@@ -72111,7 +72111,7 @@ var Kt = class r extends te {
72111
72111
  c(this, "_handleOpen", (t2) => {
72112
72112
  this._debug("open event");
72113
72113
  let { minUptime: n2 = Ve.minUptime } = this._options;
72114
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), qa(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(Jt(t2));
72114
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Wa(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(Jt(t2));
72115
72115
  });
72116
72116
  c(this, "_handleMessage", (t2) => {
72117
72117
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Jt(t2));
@@ -72225,17 +72225,17 @@ var Kt = class r extends te {
72225
72225
  let i = this._options.WebSocket || WebSocket;
72226
72226
  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);
72227
72227
  }).catch((i) => {
72228
- this._connectLock = false, this._handleError(new je.ErrorEvent(Error(i.message), this));
72228
+ this._connectLock = false, this._handleError(new $e.ErrorEvent(Error(i.message), this));
72229
72229
  });
72230
72230
  }
72231
72231
  _handleTimeout() {
72232
- this._debug("timeout event"), this._handleError(new je.ErrorEvent(Error("TIMEOUT"), this));
72232
+ this._debug("timeout event"), this._handleError(new $e.ErrorEvent(Error("TIMEOUT"), this));
72233
72233
  }
72234
72234
  _disconnect(t = 1e3, n) {
72235
72235
  if (this._clearTimeouts(), !!this._ws) {
72236
72236
  this._removeListeners();
72237
72237
  try {
72238
- this._ws.close(t, n), this._handleClose(new je.CloseEvent(t, n, this));
72238
+ this._ws.close(t, n), this._handleClose(new $e.CloseEvent(t, n, this));
72239
72239
  } catch {
72240
72240
  }
72241
72241
  }
@@ -72253,7 +72253,7 @@ var Kt = class r extends te {
72253
72253
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
72254
72254
  }
72255
72255
  };
72256
- var Wa = [WebSocket.CLOSING, WebSocket.CLOSED];
72256
+ var ja = [WebSocket.CLOSING, WebSocket.CLOSED];
72257
72257
  var st = class extends te {
72258
72258
  constructor(...t) {
72259
72259
  super();
@@ -72388,7 +72388,7 @@ var Yt = class {
72388
72388
  async getTokenForCriteria(e) {
72389
72389
  let t = e?.subscriptionId;
72390
72390
  t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${A(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
72391
- let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`), i = n?.find((a) => a.name === "token")?.valueString, o2 = n?.find((a) => a.name === "websocket-url")?.valueUrl, s = n?.find((a) => a.name === "expiration")?.valueDateTime;
72391
+ let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`, { cache: "no-cache" }), i = n?.find((a) => a.name === "token")?.valueString, o2 = n?.find((a) => a.name === "websocket-url")?.valueUrl, s = n?.find((a) => a.name === "expiration")?.valueDateTime;
72392
72392
  if (!i) throw new f(v("Failed to get token"));
72393
72393
  if (!o2) throw new f(v("Failed to get URL from $get-ws-binding-token"));
72394
72394
  if (!s) throw new f(v("Failed to get expiration from $get-ws-binding-token"));
@@ -72477,7 +72477,7 @@ var Yt = class {
72477
72477
  return this.masterSubEmitter || (this.masterSubEmitter = new st(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
72478
72478
  }
72479
72479
  async reconnectIfNeeded() {
72480
- Wa.includes(this.getWebSocket().readyState) && await new Promise((e) => {
72480
+ ja.includes(this.getWebSocket().readyState) && await new Promise((e) => {
72481
72481
  let t = () => {
72482
72482
  this.getWebSocket().removeEventListener("open", t), e();
72483
72483
  };
@@ -72485,19 +72485,19 @@ var Yt = class {
72485
72485
  });
72486
72486
  }
72487
72487
  };
72488
- var ja = new z(1e3);
72489
- var un = "5.1.3-2dacd53";
72490
- var Ga = O.FHIR_JSON + ", */*; q=0.1";
72491
- var Qa = "https://api.medplum.com/";
72492
- var za = 1e3;
72493
- var Ja = 6e4;
72494
- var Ka = 0;
72495
- var Ya = 3e5;
72496
- var Xa = "Binary/";
72488
+ var $a = new z(1e3);
72489
+ var un = "5.1.4-1e14b88";
72490
+ var Qa = O.FHIR_JSON + ", */*; q=0.1";
72491
+ var za = "https://api.medplum.com/";
72492
+ var Ja = 1e3;
72493
+ var Ka = 6e4;
72494
+ var Ya = 0;
72495
+ var Xa = 3e5;
72496
+ var Za = "Binary/";
72497
72497
  var Ji = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
72498
- var $e = { 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" };
72499
- var Za = { 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" };
72500
- var ec = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
72498
+ var He = { 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" };
72499
+ var ec = { 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" };
72500
+ var tc = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
72501
72501
  var Xt = class extends te {
72502
72502
  constructor(t) {
72503
72503
  super();
@@ -72518,6 +72518,7 @@ var Xt = class extends te {
72518
72518
  c(this, "onUnauthenticated");
72519
72519
  c(this, "autoBatchTime");
72520
72520
  c(this, "autoBatchQueue");
72521
+ c(this, "maxRetries");
72521
72522
  c(this, "maxRetryTime");
72522
72523
  c(this, "refreshGracePeriod");
72523
72524
  c(this, "subscriptionManager");
@@ -72539,7 +72540,7 @@ var Xt = class extends te {
72539
72540
  c(this, "keyValueClient");
72540
72541
  c(this, "logLevel");
72541
72542
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
72542
- this.options = t ?? {}, this.fetch = t?.fetch ?? tc(), this.storage = t?.storage ?? new ot(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = zr(t?.baseUrl ?? Qa), this.fhirBaseUrl = F(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = F(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = F(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = F(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = F(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = F(this.baseUrl, t?.cdsServicesUrl ?? "cds-services"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Ya, this.logLevel = this.initializeLogLevel(t), this.maxRetryTime = t?.maxRetryTime ?? 2e3, this.cacheTime = t?.cacheTime ?? (H() ? Ja : Ka), this.cacheTime > 0 ? this.requestCache = new z(t?.resourceCacheSize ?? za) : 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(() => {
72543
+ this.options = t ?? {}, this.fetch = t?.fetch ?? rc(), this.storage = t?.storage ?? new ot(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = zr(t?.baseUrl ?? za), this.fhirBaseUrl = F(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = F(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = F(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = F(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = F(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = F(this.baseUrl, t?.cdsServicesUrl ?? "cds-services"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Xa, this.logLevel = this.initializeLogLevel(t), this.maxRetries = t?.maxRetries ?? 2, this.maxRetryTime = t?.maxRetryTime ?? 2e3, this.cacheTime = t?.cacheTime ?? (H() ? Ka : Ya), this.cacheTime > 0 ? this.requestCache = new z(t?.resourceCacheSize ?? Ja) : 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(() => {
72543
72544
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
72544
72545
  }).catch((n) => {
72545
72546
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -72657,7 +72658,7 @@ var Xt = class extends te {
72657
72658
  }
72658
72659
  async exchangeExternalAccessToken(t, n, i) {
72659
72660
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
72660
- let o2 = { grant_type: $e.TokenExchange, subject_token_type: Za.AccessToken, client_id: n, subject_token: t };
72661
+ let o2 = { grant_type: He.TokenExchange, subject_token_type: ec.AccessToken, client_id: n, subject_token: t };
72661
72662
  return i && (o2.membership_id = i), this.fetchTokens(o2);
72662
72663
  }
72663
72664
  getExternalAuthRedirectUri(t, n, i, o2, s = true) {
@@ -72875,7 +72876,7 @@ var Xt = class extends te {
72875
72876
  }
72876
72877
  async createPdf(t, n, i, o2) {
72877
72878
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
72878
- let s = ic(t, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l2, fonts: d, ...y2 } = s, x2 = await this.createPdfImpl(u2, l2, d), k = { ...y2, data: x2, contentType: "application/pdf" };
72879
+ let s = oc(t, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l2, fonts: d, ...y2 } = s, x2 = await this.createPdfImpl(u2, l2, d), k = { ...y2, data: x2, contentType: "application/pdf" };
72879
72880
  return this.createBinary(k, a);
72880
72881
  }
72881
72882
  createComment(t, n, i) {
@@ -72992,7 +72993,7 @@ var Xt = class extends te {
72992
72993
  async download(t, n = {}) {
72993
72994
  this.refreshPromise && await this.refreshPromise;
72994
72995
  let i = t.toString();
72995
- i.startsWith(Xa) && (t = this.fhirUrl(i));
72996
+ i.startsWith(Za) && (t = this.fhirUrl(i));
72996
72997
  let o2 = n.headers;
72997
72998
  return o2 || (o2 = {}, n.headers = o2), o2.Accept || (o2.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
72998
72999
  }
@@ -73082,11 +73083,11 @@ var Xt = class extends te {
73082
73083
  }
73083
73084
  async fetchWithRetry(t, n) {
73084
73085
  t.startsWith("http") || (t = F(this.baseUrl, t));
73085
- let i = n?.maxRetries ?? 2;
73086
+ let i = n?.maxRetries ?? this.maxRetries;
73086
73087
  for (let o2 = 0; o2 <= i; o2++) try {
73087
73088
  this.logLevel !== "none" && this.logRequest(t, n);
73088
73089
  let s = await this.fetch(t, n);
73089
- if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !oc(s)) return s;
73090
+ if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !sc(s)) return s;
73090
73091
  let a = this.getRetryDelay(o2), u2 = n.maxRetryTime ?? this.maxRetryTime;
73091
73092
  if (a > u2) return s;
73092
73093
  await Qr(a, { signal: n.signal });
@@ -73155,7 +73156,7 @@ var Xt = class extends te {
73155
73156
  addFetchOptionsDefaults(t) {
73156
73157
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
73157
73158
  this.setRequestHeader(t, n, i);
73158
- }), this.setRequestHeader(t, "Accept", Ga, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", O.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");
73159
+ }), this.setRequestHeader(t, "Accept", Qa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", O.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");
73159
73160
  }
73160
73161
  setRequestContentType(t, n) {
73161
73162
  this.setRequestHeader(t, "Content-Type", n);
@@ -73199,7 +73200,7 @@ var Xt = class extends te {
73199
73200
  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 ?? se.getOrigin()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), se.assign(i.toString());
73200
73201
  }
73201
73202
  processCode(t, n) {
73202
- let i = { grant_type: $e.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? se.getOrigin() };
73203
+ let i = { grant_type: He.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? se.getOrigin() };
73203
73204
  if (typeof sessionStorage < "u") {
73204
73205
  let o2 = sessionStorage.getItem("codeVerifier");
73205
73206
  o2 && (i.code_verifier = o2);
@@ -73211,17 +73212,17 @@ var Xt = class extends te {
73211
73212
  }
73212
73213
  refresh() {
73213
73214
  if (this.refreshPromise) return this.refreshPromise;
73214
- if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: $e.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
73215
+ if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: He.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
73215
73216
  if (this.clientId && this.clientSecret) return this.refreshPromise = this.startClientLogin(this.clientId, this.clientSecret), this.refreshPromise;
73216
73217
  }
73217
73218
  async startClientLogin(t, n) {
73218
- return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: $e.ClientCredentials, client_id: t, client_secret: n });
73219
+ return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: He.ClientCredentials, client_id: t, client_secret: n });
73219
73220
  }
73220
73221
  async startJwtBearerLogin(t, n, i) {
73221
- return this.clientId = t, this.fetchTokens({ grant_type: $e.JwtBearer, client_id: t, assertion: n, scope: i });
73222
+ return this.clientId = t, this.fetchTokens({ grant_type: He.JwtBearer, client_id: t, assertion: n, scope: i });
73222
73223
  }
73223
73224
  async startJwtAssertionLogin(t) {
73224
- return this.fetchTokens({ grant_type: $e.ClientCredentials, client_assertion_type: ec.JwtBearer, client_assertion: t });
73225
+ return this.fetchTokens({ grant_type: He.ClientCredentials, client_assertion_type: tc.JwtBearer, client_assertion: t });
73225
73226
  }
73226
73227
  setBasicAuth(t, n) {
73227
73228
  this.clientId = t, this.clientSecret = n, this.basicAuth = $t(t + ":" + n);
@@ -73262,7 +73263,7 @@ var Xt = class extends te {
73262
73263
  async handleTokenError(t) {
73263
73264
  try {
73264
73265
  let n = await t.json();
73265
- throw Ge(n) ? new f(n) : n.error_description ? new f(R(n.error_description)) : new Error(JSON.stringify(n));
73266
+ throw Qe(n) ? new f(n) : n.error_description ? new f(R(n.error_description)) : new Error(JSON.stringify(n));
73266
73267
  } catch (n) {
73267
73268
  throw n instanceof f ? (n.message = `Failed to fetch tokens: ${n.message}`, n) : new f(R("Failed to fetch tokens"), { cause: n });
73268
73269
  }
@@ -73319,7 +73320,7 @@ var Xt = class extends te {
73319
73320
  return this.getSubscriptionManager().getMasterEmitter();
73320
73321
  }
73321
73322
  };
73322
- function tc() {
73323
+ function rc() {
73323
73324
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
73324
73325
  return globalThis.fetch.bind(globalThis);
73325
73326
  }
@@ -73328,34 +73329,34 @@ async function Ki(r6, e) {
73328
73329
  if (t) return t;
73329
73330
  let n = r6.headers.get("location");
73330
73331
  if (n) return n;
73331
- if (Ge(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
73332
+ if (Qe(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
73332
73333
  }
73333
73334
  function Yi(r6) {
73334
73335
  let e = r6.entry?.map((t) => t.resource) ?? [];
73335
73336
  return Object.assign(e, { bundle: r6 });
73336
73337
  }
73337
- function rc(r6) {
73338
+ function nc(r6) {
73338
73339
  return E(r6) && "data" in r6 && "contentType" in r6;
73339
73340
  }
73340
73341
  function Xi(r6, e, t, n) {
73341
- return rc(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
73342
+ return nc(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
73342
73343
  }
73343
- function nc(r6) {
73344
+ function ic(r6) {
73344
73345
  return E(r6) && "docDefinition" in r6;
73345
73346
  }
73346
- function ic(r6, e, t, n) {
73347
- return nc(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
73347
+ function oc(r6, e, t, n) {
73348
+ return ic(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
73348
73349
  }
73349
- function oc(r6) {
73350
+ function sc(r6) {
73350
73351
  return r6.status === 429 || r6.status >= 500;
73351
73352
  }
73352
- var gc = [...tt, "->", "<<", ">>", "=="];
73353
- var Tc = rt().registerInfix("->", { precedence: T.Arrow }).registerInfix(";", { precedence: T.Semicolon });
73354
- var Nc = " ".repeat(2);
73355
- var Bc = [...tt, "eq", "ne", "co"];
73356
- var qc = { eq: m.EXACT, ne: m.NOT_EQUALS, co: m.CONTAINS, sw: m.STARTS_WITH, ew: void 0, gt: m.GREATER_THAN, lt: m.LESS_THAN, ge: m.GREATER_THAN_OR_EQUALS, le: m.LESS_THAN_OR_EQUALS, ap: m.APPROXIMATELY, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, pr: m.PRESENT, po: void 0, ss: void 0, sb: void 0, in: m.IN, ni: m.NOT_IN, re: m.EQUALS, identifier: m.IDENTIFIER };
73357
- var jc = rt();
73358
- var $c = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
73353
+ var xc = [...tt, "->", "<<", ">>", "=="];
73354
+ var bc = rt().registerInfix("->", { precedence: T.Arrow }).registerInfix(";", { precedence: T.Semicolon });
73355
+ var Uc = " ".repeat(2);
73356
+ var qc = [...tt, "eq", "ne", "co"];
73357
+ var Wc = { eq: m.EXACT, ne: m.NOT_EQUALS, co: m.CONTAINS, sw: m.STARTS_WITH, ew: void 0, gt: m.GREATER_THAN, lt: m.LESS_THAN, ge: m.GREATER_THAN_OR_EQUALS, le: m.LESS_THAN_OR_EQUALS, ap: m.APPROXIMATELY, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, pr: m.PRESENT, po: void 0, ss: void 0, sb: void 0, in: m.IN, ni: m.NOT_IN, re: m.EQUALS, identifier: m.IDENTIFIER };
73358
+ var $c = rt();
73359
+ var Hc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
73359
73360
  var ve = class {
73360
73361
  constructor(e = "\r", t = "|", n = "^", i = "~", o2 = "\\", s = "&") {
73361
73362
  c(this, "segmentSeparator");
@@ -73399,7 +73400,7 @@ var vo = class r2 {
73399
73400
  }
73400
73401
  buildAck(e) {
73401
73402
  let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o2 = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", u2 = n?.getField(10)?.toString() ?? "", l2 = n?.getField(12)?.toString() ?? "2.5.1", d = e?.ackCode ?? "AA";
73402
- return new r2([new ut(["MSH", this.context.getMsh2(), s, a, i, o2, Gc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", l2], this.context), new ut(["MSA", d, u2, $c[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
73403
+ return new r2([new ut(["MSH", this.context.getMsh2(), s, a, i, o2, Qc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", l2], this.context), new ut(["MSA", d, u2, Hc[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
73403
73404
  }
73404
73405
  buildAckMessageType(e) {
73405
73406
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o2 = "ACK";
@@ -73499,14 +73500,14 @@ var re = class r4 {
73499
73500
  return true;
73500
73501
  }
73501
73502
  };
73502
- function Gc(r6) {
73503
+ function Qc(r6) {
73503
73504
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replaceAll(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
73504
73505
  return i > 0 && (n += "." + i.toString()), n;
73505
73506
  }
73506
- var He = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
73507
- var Qc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
73507
+ var Ge = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
73508
+ var zc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
73508
73509
  var To = class r5 {
73509
- constructor(e, t = {}, n = He.INFO, i = {}) {
73510
+ constructor(e, t = {}, n = Ge.INFO, i = {}) {
73510
73511
  c(this, "write");
73511
73512
  c(this, "metadata");
73512
73513
  c(this, "options");
@@ -73523,16 +73524,16 @@ var To = class r5 {
73523
73524
  return { write: e, metadata: t, level: n, options: i };
73524
73525
  }
73525
73526
  error(e, t) {
73526
- this.log(He.ERROR, e, t);
73527
+ this.log(Ge.ERROR, e, t);
73527
73528
  }
73528
73529
  warn(e, t) {
73529
- this.log(He.WARN, e, t);
73530
+ this.log(Ge.WARN, e, t);
73530
73531
  }
73531
73532
  info(e, t) {
73532
- this.log(He.INFO, e, t);
73533
+ this.log(Ge.INFO, e, t);
73533
73534
  }
73534
73535
  debug(e, t) {
73535
- this.log(He.DEBUG, e, t);
73536
+ this.log(Ge.DEBUG, e, t);
73536
73537
  }
73537
73538
  log(e, t, n) {
73538
73539
  if (e > this.level) return;
@@ -73542,11 +73543,11 @@ var To = class r5 {
73542
73543
  i = { ...n };
73543
73544
  for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] = cr(s));
73544
73545
  }
73545
- this.write(JSON.stringify({ level: Qc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
73546
+ this.write(JSON.stringify({ level: zc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
73546
73547
  }
73547
73548
  };
73548
- function Rh(r6) {
73549
- let e = He[r6.toUpperCase()];
73549
+ function Ph(r6) {
73550
+ let e = Ge[r6.toUpperCase()];
73550
73551
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
73551
73552
  return e;
73552
73553
  }
@@ -73564,9 +73565,9 @@ function cr(r6, e = 0, t = 10) {
73564
73565
  return n;
73565
73566
  }
73566
73567
  var Sn = `${dt}/fhir/StructureDefinition/patient-preferredPharmacy`;
73567
- var au = "https://meta.medplum.com/releases";
73568
+ var cu = "https://meta.medplum.com/releases";
73568
73569
  var pr = /* @__PURE__ */ new Map();
73569
- function cu(r6) {
73570
+ function uu(r6) {
73570
73571
  let e = r6;
73571
73572
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
73572
73573
  let t = e.assets;
@@ -73579,7 +73580,7 @@ function cu(r6) {
73579
73580
  async function Rn(r6, e, t) {
73580
73581
  let n = pr.get(e ?? "latest");
73581
73582
  if (!n) {
73582
- let i = e ? `v${e}` : "latest", o2 = new URL(`${au}/${i}.json`);
73583
+ let i = e ? `v${e}` : "latest", o2 = new URL(`${cu}/${i}.json`);
73583
73584
  if (o2.searchParams.set("a", r6), o2.searchParams.set("c", un), t) for (let [u2, l2] of Object.entries(t)) o2.searchParams.set(u2, l2);
73584
73585
  let s = await fetch(o2.toString());
73585
73586
  if (s.status !== 200) {
@@ -73592,15 +73593,15 @@ async function Rn(r6, e, t) {
73592
73593
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${u2}`);
73593
73594
  }
73594
73595
  let a = await s.json();
73595
- cu(a), n = a, pr.set(e ?? "latest", n), e || pr.set(n.tag_name.slice(1), n);
73596
+ uu(a), n = a, pr.set(e ?? "latest", n), e || pr.set(n.tag_name.slice(1), n);
73596
73597
  }
73597
73598
  return n;
73598
73599
  }
73599
- function uu(r6) {
73600
+ function lu(r6) {
73600
73601
  return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
73601
73602
  }
73602
- async function sy(r6, e) {
73603
- if (!uu(e)) return false;
73603
+ async function cy(r6, e) {
73604
+ if (!lu(e)) return false;
73604
73605
  try {
73605
73606
  await Rn(r6, e);
73606
73607
  } catch {
@@ -73608,7 +73609,7 @@ async function sy(r6, e) {
73608
73609
  }
73609
73610
  return true;
73610
73611
  }
73611
- async function ay(r6) {
73612
+ async function uy(r6) {
73612
73613
  let e = await Rn(r6);
73613
73614
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
73614
73615
  return e.tag_name.slice(1);
@@ -73706,7 +73707,7 @@ var g2 = class extends m2 {
73706
73707
  return;
73707
73708
  }
73708
73709
  let p2 = c2.message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
73709
- p2 && (h2.returnAck === _d.APPLICATION && p2 === "CA" || (h2.resolve(c2.message), this.pendingMessages.delete(a)));
73710
+ p2 && (h2.returnAck === Fd.APPLICATION && p2 === "CA" || (h2.resolve(c2.message), this.pendingMessages.delete(a)));
73710
73711
  });
73711
73712
  }
73712
73713
  isClosed() {
@@ -73759,7 +73760,7 @@ var g2 = class extends m2 {
73759
73760
  let r6;
73760
73761
  t?.timeoutMs && (r6 = setTimeout(() => {
73761
73762
  this.pendingMessages.delete(c2), n(new f({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "timeout", details: { text: "Client timeout" }, diagnostics: `Request timed out after waiting ${t.timeoutMs} milliseconds for response` }] }));
73762
- }, t.timeoutMs)), this.pendingMessages.set(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ?? _d.APPLICATION, timer: r6 }), this.sendImpl(e);
73763
+ }, t.timeoutMs)), this.pendingMessages.set(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ?? Fd.APPLICATION, timer: r6 }), this.sendImpl(e);
73763
73764
  });
73764
73765
  }
73765
73766
  async close() {
@@ -81359,8 +81360,8 @@ var DecimalString = /* @__PURE__ */ (function(_NumericStringReprese) {
81359
81360
  key: "writeBytes",
81360
81361
  value: function writeBytes(stream, value, writeOptions) {
81361
81362
  var _this8 = this;
81362
- var val = Array.isArray(value) ? value.map(function(ds2) {
81363
- return _this8.convertToString(ds2);
81363
+ var val = Array.isArray(value) ? value.map(function(ds) {
81364
+ return _this8.convertToString(ds);
81364
81365
  }) : [this.convertToString(value)];
81365
81366
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
81366
81367
  }
@@ -85845,8 +85846,8 @@ var Normalizer = /* @__PURE__ */ (function() {
85845
85846
  }, {
85846
85847
  key: "isMultiframeDataset",
85847
85848
  value: function isMultiframeDataset() {
85848
- var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
85849
- var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
85849
+ var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
85850
+ var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
85850
85851
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
85851
85852
  }
85852
85853
  }, {
@@ -85886,16 +85887,16 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
85886
85887
  }
85887
85888
  this.derivation = new DerivedImage(this.datasets);
85888
85889
  this.dataset = this.derivation.dataset;
85889
- var ds2 = this.dataset;
85890
+ var ds = this.dataset;
85890
85891
  var referenceDataset = this.datasets[0];
85891
- ds2.NumberOfFrames = this.datasets.length;
85892
- ds2.SOPClassUID = referenceDataset.SOPClassUID;
85893
- ds2.Rows = referenceDataset.Rows;
85894
- ds2.Columns = referenceDataset.Columns;
85895
- ds2.BitsAllocated = referenceDataset.BitsAllocated;
85896
- ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
85897
- ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
85898
- ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
85892
+ ds.NumberOfFrames = this.datasets.length;
85893
+ ds.SOPClassUID = referenceDataset.SOPClassUID;
85894
+ ds.Rows = referenceDataset.Rows;
85895
+ ds.Columns = referenceDataset.Columns;
85896
+ ds.BitsAllocated = referenceDataset.BitsAllocated;
85897
+ ds.PixelRepresentation = referenceDataset.PixelRepresentation;
85898
+ ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
85899
+ ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
85899
85900
  var referencePosition = referenceDataset.ImagePositionPatient;
85900
85901
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
85901
85902
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -85910,43 +85911,43 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
85910
85911
  distanceDatasetPairs.sort(function(a, b3) {
85911
85912
  return b3[0] - a[0];
85912
85913
  });
85913
- if (ds2.BitsAllocated !== 16) {
85914
+ if (ds.BitsAllocated !== 16) {
85914
85915
  log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
85915
85916
  }
85916
85917
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
85917
85918
  log2.warn("No vr map given for pixel data, using OW");
85918
- ds2._vrMap = {
85919
+ ds._vrMap = {
85919
85920
  PixelData: "OW"
85920
85921
  };
85921
85922
  } else {
85922
- ds2._vrMap = {
85923
+ ds._vrMap = {
85923
85924
  PixelData: referenceDataset._vrMap.PixelData
85924
85925
  };
85925
85926
  }
85926
85927
  var frameSize = referenceDataset.PixelData.byteLength;
85927
- ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
85928
+ ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
85928
85929
  var frame = 0;
85929
85930
  distanceDatasetPairs.forEach(function(pair) {
85930
85931
  var dataset = pair[1];
85931
85932
  var pixels = new Uint16Array(dataset.PixelData);
85932
- var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
85933
+ var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
85933
85934
  try {
85934
85935
  frameView.set(pixels);
85935
85936
  } catch (e) {
85936
85937
  if (e instanceof RangeError) {
85937
- var message = "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);
85938
+ var message = "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);
85938
85939
  log2.error(message);
85939
85940
  }
85940
85941
  }
85941
85942
  frame++;
85942
85943
  });
85943
- if (ds2.NumberOfFrames < 2) {
85944
+ if (ds.NumberOfFrames < 2) {
85944
85945
  log2.error("Cannot populate shared groups uniquely without multiple frames");
85945
85946
  }
85946
85947
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
85947
85948
  var distance1 = distanceDatasetPairs[1][0];
85948
85949
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
85949
- ds2.SharedFunctionalGroupsSequence = {
85950
+ ds.SharedFunctionalGroupsSequence = {
85950
85951
  PlaneOrientationSequence: {
85951
85952
  ImageOrientationPatient: dataset0.ImageOrientationPatient
85952
85953
  },
@@ -85956,14 +85957,14 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
85956
85957
  SliceThickness: SpacingBetweenSlices
85957
85958
  }
85958
85959
  };
85959
- ds2.ReferencedSeriesSequence = {
85960
+ ds.ReferencedSeriesSequence = {
85960
85961
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
85961
85962
  ReferencedInstanceSequence: []
85962
85963
  };
85963
- ds2.PerFrameFunctionalGroupsSequence = [];
85964
+ ds.PerFrameFunctionalGroupsSequence = [];
85964
85965
  distanceDatasetPairs.forEach(function(pair) {
85965
85966
  var dataset = pair[1];
85966
- ds2.PerFrameFunctionalGroupsSequence.push({
85967
+ ds.PerFrameFunctionalGroupsSequence.push({
85967
85968
  PlanePositionSequence: {
85968
85969
  ImagePositionPatient: dataset.ImagePositionPatient
85969
85970
  },
@@ -85972,7 +85973,7 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
85972
85973
  WindowWidth: dataset.WindowWidth
85973
85974
  }
85974
85975
  });
85975
- ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
85976
+ ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
85976
85977
  ReferencedSOPClassUID: dataset.SOPClassUID,
85977
85978
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
85978
85979
  });
@@ -85992,29 +85993,29 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
85992
85993
  }, {
85993
85994
  key: "normalizeMultiframe",
85994
85995
  value: function normalizeMultiframe() {
85995
- var ds2 = this.dataset;
85996
- if (!ds2.NumberOfFrames) {
85996
+ var ds = this.dataset;
85997
+ if (!ds.NumberOfFrames) {
85997
85998
  log2.error("Missing number or frames not supported");
85998
85999
  return;
85999
86000
  }
86000
- if (!ds2.PixelRepresentation) {
86001
- ds2.PixelRepresentation = 1;
86001
+ if (!ds.PixelRepresentation) {
86002
+ ds.PixelRepresentation = 1;
86002
86003
  }
86003
- if (!ds2.StudyID || ds2.StudyID === "") {
86004
- ds2.StudyID = "No Study ID";
86004
+ if (!ds.StudyID || ds.StudyID === "") {
86005
+ ds.StudyID = "No Study ID";
86005
86006
  }
86006
86007
  var validLateralities = ["R", "L"];
86007
- if (validLateralities.indexOf(ds2.Laterality) === -1) {
86008
- delete ds2.Laterality;
86008
+ if (validLateralities.indexOf(ds.Laterality) === -1) {
86009
+ delete ds.Laterality;
86009
86010
  }
86010
- if (!ds2.PresentationLUTShape) {
86011
- ds2.PresentationLUTShape = "IDENTITY";
86011
+ if (!ds.PresentationLUTShape) {
86012
+ ds.PresentationLUTShape = "IDENTITY";
86012
86013
  }
86013
- if (!ds2.SharedFunctionalGroupsSequence) {
86014
+ if (!ds.SharedFunctionalGroupsSequence) {
86014
86015
  log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
86015
86016
  }
86016
- if (ds2.BodyPartExamined === "PROSTATE") {
86017
- ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
86017
+ if (ds.BodyPartExamined === "PROSTATE") {
86018
+ ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
86018
86019
  AnatomicRegionSequence: {
86019
86020
  CodeValue: "T-9200B",
86020
86021
  CodingSchemeDesignator: "SRT",
@@ -86023,17 +86024,17 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
86023
86024
  FrameLaterality: "U"
86024
86025
  };
86025
86026
  }
86026
- var rescaleIntercept = ds2.RescaleIntercept || 0;
86027
- var rescaleSlope = ds2.RescaleSlope || 1;
86028
- ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
86027
+ var rescaleIntercept = ds.RescaleIntercept || 0;
86028
+ var rescaleSlope = ds.RescaleSlope || 1;
86029
+ ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
86029
86030
  RescaleIntercept: rescaleIntercept,
86030
86031
  RescaleSlope: rescaleSlope,
86031
86032
  RescaleType: "US"
86032
86033
  };
86033
86034
  var frameNumber = 1;
86034
86035
  this.datasets.forEach(function(dataset) {
86035
- if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
86036
- ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
86036
+ if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
86037
+ ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
86037
86038
  FrameAcquisitionDuration: 0,
86038
86039
  StackID: 1,
86039
86040
  InStackPositionNumber: frameNumber,
@@ -86041,30 +86042,30 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
86041
86042
  };
86042
86043
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
86043
86044
  if (!isNaN(frameTime)) {
86044
- var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
86045
+ var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
86045
86046
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
86046
86047
  frameContentSequence.FrameReferenceDateTime = frameTime;
86047
86048
  }
86048
86049
  frameNumber++;
86049
86050
  });
86050
- if (ds2.WindowCenter && ds2.WindowWidth) {
86051
- if (!Array.isArray(ds2.WindowCenter)) {
86052
- ds2.WindowCenter = [ds2.WindowCenter];
86051
+ if (ds.WindowCenter && ds.WindowWidth) {
86052
+ if (!Array.isArray(ds.WindowCenter)) {
86053
+ ds.WindowCenter = [ds.WindowCenter];
86053
86054
  }
86054
- if (!Array.isArray(ds2.WindowWidth)) {
86055
- ds2.WindowWidth = [ds2.WindowWidth];
86055
+ if (!Array.isArray(ds.WindowWidth)) {
86056
+ ds.WindowWidth = [ds.WindowWidth];
86056
86057
  }
86057
86058
  }
86058
- if (!ds2.WindowCenter || !ds2.WindowWidth) {
86059
- ds2.WindowCenter = [];
86060
- ds2.WindowWidth = [];
86061
- if (ds2.PerFrameFunctionalGroupsSequence) {
86059
+ if (!ds.WindowCenter || !ds.WindowWidth) {
86060
+ ds.WindowCenter = [];
86061
+ ds.WindowWidth = [];
86062
+ if (ds.PerFrameFunctionalGroupsSequence) {
86062
86063
  var wcww = {
86063
86064
  center: 0,
86064
86065
  width: 0,
86065
86066
  count: 0
86066
86067
  };
86067
- ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
86068
+ ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
86068
86069
  if (functionalGroup.FrameVOILUT) {
86069
86070
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
86070
86071
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -86082,26 +86083,26 @@ var ImageNormalizer = /* @__PURE__ */ (function(_Normalizer) {
86082
86083
  }
86083
86084
  });
86084
86085
  if (wcww.count > 0) {
86085
- ds2.WindowCenter.push(String(wcww.center / wcww.count));
86086
- ds2.WindowWidth.push(String(wcww.width / wcww.count));
86086
+ ds.WindowCenter.push(String(wcww.center / wcww.count));
86087
+ ds.WindowWidth.push(String(wcww.width / wcww.count));
86087
86088
  }
86088
86089
  }
86089
86090
  }
86090
- if (ds2.WindowCenter.length === 0) {
86091
- ds2.WindowCenter = [300];
86091
+ if (ds.WindowCenter.length === 0) {
86092
+ ds.WindowCenter = [300];
86092
86093
  }
86093
- if (ds2.WindowWidth.length === 0) {
86094
- ds2.WindowWidth = [500];
86094
+ if (ds.WindowWidth.length === 0) {
86095
+ ds.WindowWidth = [500];
86095
86096
  }
86096
86097
  }
86097
86098
  }], [{
86098
86099
  key: "vec3CrossProduct",
86099
86100
  value: function vec3CrossProduct(a, b3) {
86100
- var ax = a[0], ay2 = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2];
86101
+ var ax = a[0], ay = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2];
86101
86102
  var out = [];
86102
- out[0] = ay2 * bz - az * by;
86103
+ out[0] = ay * bz - az * by;
86103
86104
  out[1] = az * bx - ax * bz;
86104
- out[2] = ax * by - ay2 * bx;
86105
+ out[2] = ax * by - ay * bx;
86105
86106
  return out;
86106
86107
  }
86107
86108
  }, {
@@ -86137,12 +86138,12 @@ var MRImageNormalizer = /* @__PURE__ */ (function(_ImageNormalizer) {
86137
86138
  key: "normalizeMultiframe",
86138
86139
  value: function normalizeMultiframe() {
86139
86140
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
86140
- var ds2 = this.dataset;
86141
- if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
86142
- ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
86141
+ var ds = this.dataset;
86142
+ if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
86143
+ ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
86143
86144
  }
86144
- ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
86145
- FrameType: ds2.ImageType,
86145
+ ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
86146
+ FrameType: ds.ImageType,
86146
86147
  PixelPresentation: "MONOCHROME",
86147
86148
  VolumetricProperties: "VOLUME",
86148
86149
  VolumeBasedCalculationTechnique: "NONE",
@@ -86267,9 +86268,9 @@ var PMImageNormalizer = /* @__PURE__ */ (function(_ImageNormalizer9) {
86267
86268
  key: "normalize",
86268
86269
  value: function normalize2() {
86269
86270
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
86270
- var ds2 = this.datasets[0];
86271
- if (ds2.BitsAllocated !== 32) {
86272
- log2.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
86271
+ var ds = this.datasets[0];
86272
+ if (ds.BitsAllocated !== 32) {
86273
+ log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
86273
86274
  }
86274
86275
  }
86275
86276
  }]);
@@ -89065,8 +89066,8 @@ var MeasurementReport$2 = /* @__PURE__ */ (function() {
89065
89066
  key: "getCornerstoneLabelFromDefaultState",
89066
89067
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
89067
89068
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
89068
- var freeTextLabel = findingSites.find(function(fs3) {
89069
- return isFreeTextCodeValue(fs3.CodeValue) || isLegacyFreeTextCodeValue(fs3.CodeValue);
89069
+ var freeTextLabel = findingSites.find(function(fs4) {
89070
+ return isFreeTextCodeValue(fs4.CodeValue) || isLegacyFreeTextCodeValue(fs4.CodeValue);
89070
89071
  });
89071
89072
  if (freeTextLabel) {
89072
89073
  return freeTextLabel.CodeMeaning;
@@ -89645,19 +89646,19 @@ function dot(a, b3) {
89645
89646
  return a[0] * b3[0] + a[1] * b3[1] + a[2] * b3[2];
89646
89647
  }
89647
89648
  function cross$1(out, a, b3) {
89648
- var ax = a[0], ay2 = a[1], az = a[2];
89649
+ var ax = a[0], ay = a[1], az = a[2];
89649
89650
  var bx = b3[0], by = b3[1], bz = b3[2];
89650
- out[0] = ay2 * bz - az * by;
89651
+ out[0] = ay * bz - az * by;
89651
89652
  out[1] = az * bx - ax * bz;
89652
- out[2] = ax * by - ay2 * bx;
89653
+ out[2] = ax * by - ay * bx;
89653
89654
  return out;
89654
89655
  }
89655
89656
  function lerp(out, a, b3, t) {
89656
89657
  var ax = a[0];
89657
- var ay2 = a[1];
89658
+ var ay = a[1];
89658
89659
  var az = a[2];
89659
89660
  out[0] = ax + t * (b3[0] - ax);
89660
- out[1] = ay2 + t * (b3[1] - ay2);
89661
+ out[1] = ay + t * (b3[1] - ay);
89661
89662
  out[2] = az + t * (b3[2] - az);
89662
89663
  return out;
89663
89664
  }
@@ -89768,7 +89769,7 @@ function rotateZ(out, a, b3, rad) {
89768
89769
  return out;
89769
89770
  }
89770
89771
  function angle(a, b3) {
89771
- var ax = a[0], ay2 = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2], mag1 = Math.sqrt(ax * ax + ay2 * ay2 + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b3) / mag;
89772
+ var ax = a[0], ay = a[1], az = a[2], bx = b3[0], by = b3[1], bz = b3[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b3) / mag;
89772
89773
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
89773
89774
  }
89774
89775
  function zero(out) {
@@ -91701,7 +91702,7 @@ var DEFAULT_LOGGER_CONFIG = {
91701
91702
  logDir: __dirname,
91702
91703
  maxFileSizeMb: 10,
91703
91704
  filesToKeep: 10,
91704
- logLevel: He.INFO
91705
+ logLevel: Ge.INFO
91705
91706
  };
91706
91707
  var LOGGER_CONFIG_INTEGER_KEYS = ["maxFileSizeMb", "filesToKeep"];
91707
91708
  var LEVELS_TO_UPPERCASE = {
@@ -91730,7 +91731,7 @@ function cleanupLoggerConfig(config, configPathRoot = "config") {
91730
91731
  warnings.push(`${configPathRoot}.filesToKeep must be a valid integer`);
91731
91732
  config.filesToKeep = void 0;
91732
91733
  }
91733
- if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && Qc[config.logLevel] !== void 0)) {
91734
+ if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && zc[config.logLevel] !== void 0)) {
91734
91735
  warnings.push(`${configPathRoot}.logLevel must be a valid log level between LogLevel.NONE and LogLevel.DEBUG`);
91735
91736
  config.logLevel = void 0;
91736
91737
  }
@@ -91768,14 +91769,14 @@ function parseLoggerConfigFromArgs(args) {
91768
91769
  if (!propName.startsWith("logger.") || propVal === void 0) {
91769
91770
  continue;
91770
91771
  }
91771
- const [_2, configType, settingName] = Xe(propName, ".", 3);
91772
+ const [_2, configType, settingName] = qe(propName, ".", 3);
91772
91773
  if (!LOGGER_CONFIG_KEYS.includes(settingName)) {
91773
91774
  warnings.push(`${propName} is not a valid setting name`);
91774
91775
  }
91775
91776
  let configValue;
91776
91777
  if (settingName === "logLevel") {
91777
91778
  try {
91778
- configValue = Rh(propVal);
91779
+ configValue = Ph(propVal);
91779
91780
  } catch (err2) {
91780
91781
  warnings.push(`Error while parsing ${propName}: ${_e(err2)}`);
91781
91782
  }
@@ -91803,14 +91804,14 @@ function parseLoggerConfigFromArgs(args) {
91803
91804
  function getWinstonLevelFromMedplumLevel(level) {
91804
91805
  switch (level) {
91805
91806
  // Return error for NONE since we are going to turn silent on anyways
91806
- case He.NONE:
91807
- case He.ERROR:
91807
+ case Ge.NONE:
91808
+ case Ge.ERROR:
91808
91809
  return "error";
91809
- case He.WARN:
91810
+ case Ge.WARN:
91810
91811
  return "warn";
91811
- case He.INFO:
91812
+ case Ge.INFO:
91812
91813
  return "info";
91813
- case He.DEBUG:
91814
+ case Ge.DEBUG:
91814
91815
  return "debug";
91815
91816
  default:
91816
91817
  throw new Error("Invalid log level");
@@ -91820,7 +91821,7 @@ function createWinstonFromLoggerConfig(config, loggerType) {
91820
91821
  const level = getWinstonLevelFromMedplumLevel(config.logLevel);
91821
91822
  const logger = import_winston.default.createLogger({
91822
91823
  level,
91823
- silent: config.logLevel === He.NONE,
91824
+ silent: config.logLevel === Ge.NONE,
91824
91825
  format: import_winston.default.format.combine(
91825
91826
  import_winston.default.format.timestamp(),
91826
91827
  // Custom transform to match previous Medplum logger output
@@ -91874,16 +91875,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
91874
91875
  this.prefix = options?.prefix;
91875
91876
  }
91876
91877
  debug(msg, data2) {
91877
- this.log(He.DEBUG, msg, data2);
91878
+ this.log(Ge.DEBUG, msg, data2);
91878
91879
  }
91879
91880
  info(msg, data2) {
91880
- this.log(He.INFO, msg, data2);
91881
+ this.log(Ge.INFO, msg, data2);
91881
91882
  }
91882
91883
  warn(msg, data2) {
91883
- this.log(He.WARN, msg, data2);
91884
+ this.log(Ge.WARN, msg, data2);
91884
91885
  }
91885
91886
  error(msg, data2) {
91886
- this.log(He.ERROR, msg, data2);
91887
+ this.log(Ge.ERROR, msg, data2);
91887
91888
  }
91888
91889
  log(level, msg, data2) {
91889
91890
  if (level > this.level) {
@@ -91898,16 +91899,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
91898
91899
  const dataToLog = { ...data2, ...this.metadata };
91899
91900
  const msgToLog = this.prefix ? `${this.prefix}${msg}` : msg;
91900
91901
  switch (level) {
91901
- case He.DEBUG:
91902
+ case Ge.DEBUG:
91902
91903
  this.winston.debug(msgToLog, dataToLog);
91903
91904
  return;
91904
- case He.INFO:
91905
+ case Ge.INFO:
91905
91906
  this.winston.info(msgToLog, dataToLog);
91906
91907
  return;
91907
- case He.WARN:
91908
+ case Ge.WARN:
91908
91909
  this.winston.warn(msgToLog, dataToLog);
91909
91910
  return;
91910
- case He.ERROR:
91911
+ case Ge.ERROR:
91911
91912
  this.winston.error(msgToLog, dataToLog);
91912
91913
  }
91913
91914
  }
@@ -92702,7 +92703,7 @@ IPv6 is currently unsupported.`;
92702
92703
  this.log.error(errMsg);
92703
92704
  throw new Error(errMsg);
92704
92705
  }
92705
- if (!((0, import_node_net4.isIPv4)(message.remote) || rp(message.remote))) {
92706
+ if (!((0, import_node_net4.isIPv4)(message.remote) || ip(message.remote))) {
92706
92707
  const errMsg = `Attempted to ping an invalid host.
92707
92708
 
92708
92709
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -92777,7 +92778,7 @@ ${result}`);
92777
92778
  return;
92778
92779
  }
92779
92780
  let child;
92780
- if (message.version && !await sy("agent-upgrader", message.version)) {
92781
+ if (message.version && !await cy("agent-upgrader", message.version)) {
92781
92782
  const versionTag = message.version ? `v${message.version}` : "latest";
92782
92783
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
92783
92784
  this.log.error(errMsg);
@@ -92788,7 +92789,7 @@ ${result}`);
92788
92789
  });
92789
92790
  return;
92790
92791
  }
92791
- const targetVersion = message.version ?? await ay("agent-upgrader");
92792
+ const targetVersion = message.version ?? await uy("agent-upgrader");
92792
92793
  if (un.startsWith(targetVersion)) {
92793
92794
  if (!message?.force) {
92794
92795
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
@@ -92954,7 +92955,7 @@ ${result}`);
92954
92955
  } catch (err2) {
92955
92956
  this.log.warn(`${_e(err2)} - falling back to default return ACK behavior of 'first'.`);
92956
92957
  }
92957
- const returnAck = msgReturnAck ?? defaultReturnAck ?? _d.FIRST;
92958
+ const returnAck = msgReturnAck ?? defaultReturnAck ?? Fd.FIRST;
92958
92959
  let pool;
92959
92960
  if (this.hl7Clients.has(message.remote)) {
92960
92961
  pool = this.hl7Clients.get(message.remote);
@@ -93052,10 +93053,10 @@ ${result}`);
93052
93053
  }
93053
93054
  const normalizedValue = rawValue.toLowerCase();
93054
93055
  if (normalizedValue === "application") {
93055
- return _d.APPLICATION;
93056
+ return Fd.APPLICATION;
93056
93057
  }
93057
93058
  if (normalizedValue === "first") {
93058
- return _d.FIRST;
93059
+ return Fd.FIRST;
93059
93060
  }
93060
93061
  throw new Error(`Invalid value for returnAck; expected: 'first' or 'application', received: ${rawValue}`);
93061
93062
  }
@@ -93118,7 +93119,7 @@ async function agentMain(argv) {
93118
93119
  for (const warning of warnings) {
93119
93120
  mainLogger.warn(warning);
93120
93121
  }
93121
- const app = new App(medplum, agentId, args.logLevel ? Rh(args.logLevel) : void 0, {
93122
+ const app = new App(medplum, agentId, args.logLevel ? Ph(args.logLevel) : void 0, {
93122
93123
  mainLogger,
93123
93124
  channelLogger
93124
93125
  });
@@ -93160,10 +93161,10 @@ async function upgraderMain(argv) {
93160
93161
  rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
93161
93162
  import_node_process3.default.once("disconnect", resolve2);
93162
93163
  });
93163
- if (argv[3] && !uu(argv[3])) {
93164
+ if (argv[3] && !lu(argv[3])) {
93164
93165
  throw new Error("Invalid version specified");
93165
93166
  }
93166
- const version = argv[3] ?? await ay("agent-upgrader");
93167
+ const version = argv[3] ?? await uy("agent-upgrader");
93167
93168
  const binPath = getReleaseBinPath(version);
93168
93169
  if (!(0, import_node_fs6.existsSync)(binPath)) {
93169
93170
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);