@medplum/agent 4.1.6 → 4.1.7

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 +763 -755
  2. package/package.json +5 -5
@@ -12,13 +12,13 @@ var __export = (target, all) => {
12
12
  for (var name in all)
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
- var __copyProps = (to2, from, except, desc) => {
15
+ var __copyProps = (to, from, except, desc) => {
16
16
  if (from && typeof from === "object" || typeof from === "function") {
17
17
  for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to2, key) && key !== except)
19
- __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
20
  }
21
- return to2;
21
+ return to;
22
22
  };
23
23
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
24
  // If the importer is in node compatibility mode or this is not an ESM
@@ -5849,7 +5849,7 @@ var require_extension = __commonJS({
5849
5849
  Object.keys(params).map((k2) => {
5850
5850
  let values = params[k2];
5851
5851
  if (!Array.isArray(values)) values = [values];
5852
- return values.map((v) => v === true ? k2 : `${k2}=${v}`).join("; ");
5852
+ return values.map((v2) => v2 === true ? k2 : `${k2}=${v2}`).join("; ");
5853
5853
  })
5854
5854
  ).join("; ");
5855
5855
  }).join(", ");
@@ -7578,8 +7578,8 @@ var require_dcmjs = __commonJS({
7578
7578
  if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
7579
7579
  var o = [null];
7580
7580
  o.push.apply(o, e);
7581
- var p = new (t.bind.apply(t, o))();
7582
- return r7 && _setPrototypeOf(p, r7.prototype), p;
7581
+ var p2 = new (t.bind.apply(t, o))();
7582
+ return r7 && _setPrototypeOf(p2, r7.prototype), p2;
7583
7583
  }
7584
7584
  function _isNativeReflectConstruct() {
7585
7585
  try {
@@ -7713,12 +7713,12 @@ var require_dcmjs = __commonJS({
7713
7713
  };
7714
7714
  return _getPrototypeOf(o);
7715
7715
  }
7716
- function _setPrototypeOf(o, p) {
7717
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
7718
- o2.__proto__ = p2;
7716
+ function _setPrototypeOf(o, p2) {
7717
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
7718
+ o2.__proto__ = p3;
7719
7719
  return o2;
7720
7720
  };
7721
- return _setPrototypeOf(o, p);
7721
+ return _setPrototypeOf(o, p2);
7722
7722
  }
7723
7723
  function _isNativeFunction(fn) {
7724
7724
  try {
@@ -8167,20 +8167,20 @@ var require_dcmjs = __commonJS({
8167
8167
  return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m2];
8168
8168
  };
8169
8169
  const pqdownheap = (s, tree, k2) => {
8170
- const v2 = s.heap[k2];
8170
+ const v3 = s.heap[k2];
8171
8171
  let j = k2 << 1;
8172
8172
  while (j <= s.heap_len) {
8173
8173
  if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
8174
8174
  j++;
8175
8175
  }
8176
- if (smaller(tree, v2, s.heap[j], s.depth)) {
8176
+ if (smaller(tree, v3, s.heap[j], s.depth)) {
8177
8177
  break;
8178
8178
  }
8179
8179
  s.heap[k2] = s.heap[j];
8180
8180
  k2 = j;
8181
8181
  j <<= 1;
8182
8182
  }
8183
- s.heap[k2] = v2;
8183
+ s.heap[k2] = v3;
8184
8184
  };
8185
8185
  const compress_block = (s, ltree, dtree) => {
8186
8186
  let dist2;
@@ -8672,19 +8672,19 @@ var require_dcmjs = __commonJS({
8672
8672
  };
8673
8673
  const slide_hash = (s) => {
8674
8674
  let n, m2;
8675
- let p;
8675
+ let p2;
8676
8676
  let wsize = s.w_size;
8677
8677
  n = s.hash_size;
8678
- p = n;
8678
+ p2 = n;
8679
8679
  do {
8680
- m2 = s.head[--p];
8681
- s.head[p] = m2 >= wsize ? m2 - wsize : 0;
8680
+ m2 = s.head[--p2];
8681
+ s.head[p2] = m2 >= wsize ? m2 - wsize : 0;
8682
8682
  } while (--n);
8683
8683
  n = wsize;
8684
- p = n;
8684
+ p2 = n;
8685
8685
  do {
8686
- m2 = s.prev[--p];
8687
- s.prev[p] = m2 >= wsize ? m2 - wsize : 0;
8686
+ m2 = s.prev[--p2];
8687
+ s.prev[p2] = m2 >= wsize ? m2 - wsize : 0;
8688
8688
  } while (--n);
8689
8689
  };
8690
8690
  let HASH_ZLIB = (s, prev, data3) => (prev << s.hash_shift ^ data3) & s.hash_mask;
@@ -9763,9 +9763,9 @@ var require_dcmjs = __commonJS({
9763
9763
  if (typeof source !== "object") {
9764
9764
  throw new TypeError(source + "must be non-object");
9765
9765
  }
9766
- for (const p in source) {
9767
- if (_has(source, p)) {
9768
- obj[p] = source[p];
9766
+ for (const p2 in source) {
9767
+ if (_has(source, p2)) {
9768
+ obj[p2] = source[p2];
9769
9769
  }
9770
9770
  }
9771
9771
  }
@@ -9795,8 +9795,8 @@ var require_dcmjs = __commonJS({
9795
9795
  STR_APPLY_UIA_OK = false;
9796
9796
  }
9797
9797
  const _utf8len = new Uint8Array(256);
9798
- for (let q = 0; q < 256; q++) {
9799
- _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
9798
+ for (let q2 = 0; q2 < 256; q2++) {
9799
+ _utf8len[q2] = q2 >= 252 ? 6 : q2 >= 248 ? 5 : q2 >= 240 ? 4 : q2 >= 224 ? 3 : q2 >= 192 ? 2 : 1;
9800
9800
  }
9801
9801
  _utf8len[254] = _utf8len[254] = 1;
9802
9802
  var string2buf = (str2) => {
@@ -10664,8 +10664,8 @@ var require_dcmjs = __commonJS({
10664
10664
  const ENOUGH_DISTS = 592;
10665
10665
  const MAX_WBITS = 15;
10666
10666
  const DEF_WBITS = MAX_WBITS;
10667
- const zswap32 = (q) => {
10668
- return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
10667
+ const zswap32 = (q2) => {
10668
+ return (q2 >>> 24 & 255) + (q2 >>> 8 & 65280) + ((q2 & 65280) << 8) + ((q2 & 255) << 24);
10669
10669
  };
10670
10670
  function InflateState() {
10671
10671
  this.strm = null;
@@ -12104,10 +12104,10 @@ var require_dcmjs = __commonJS({
12104
12104
  }, {
12105
12105
  key: "writeUint8Repeat",
12106
12106
  value: function writeUint8Repeat(value, count) {
12107
- var v2 = toInt(value);
12107
+ var v3 = toInt(value);
12108
12108
  this.checkSize(count);
12109
12109
  for (var i = 0; i < count; i++) {
12110
- this.view.setUint8(this.offset + i, v2);
12110
+ this.view.setUint8(this.offset + i, v3);
12111
12111
  }
12112
12112
  return this.increment(count);
12113
12113
  }
@@ -12924,8 +12924,8 @@ var require_dcmjs = __commonJS({
12924
12924
  }
12925
12925
  if (typeof value === "string" || value instanceof String) {
12926
12926
  var values = value.split(String.fromCharCode(VM_DELIMITER)).filter(Boolean);
12927
- var pnObj = values.map(function(v2) {
12928
- var components = v2.split(String.fromCharCode(PN_COMPONENT_DELIMITER));
12927
+ var pnObj = values.map(function(v3) {
12928
+ var components = v3.split(String.fromCharCode(PN_COMPONENT_DELIMITER));
12929
12929
  return _objectSpread2(_objectSpread2(_objectSpread2({}, components[0] ? {
12930
12930
  Alphabetic: components[0]
12931
12931
  } : {}), components[1] ? {
@@ -12950,12 +12950,12 @@ var require_dcmjs = __commonJS({
12950
12950
  if (!Array.isArray(value)) {
12951
12951
  value = [value];
12952
12952
  }
12953
- return value.filter(Boolean).map(function(v2) {
12953
+ return value.filter(Boolean).map(function(v3) {
12954
12954
  var _v$Alphabetic, _v$Ideographic, _v$Phonetic;
12955
- if (v2 === void 0 || typeof v2 === "string" || v2 instanceof String) {
12956
- return v2;
12955
+ if (v3 === void 0 || typeof v3 === "string" || v3 instanceof String) {
12956
+ return v3;
12957
12957
  }
12958
- return [(_v$Alphabetic = v2.Alphabetic) !== null && _v$Alphabetic !== void 0 ? _v$Alphabetic : "", (_v$Ideographic = v2.Ideographic) !== null && _v$Ideographic !== void 0 ? _v$Ideographic : "", (_v$Phonetic = v2.Phonetic) !== null && _v$Phonetic !== void 0 ? _v$Phonetic : ""].join(pnDelim).replace(new RegExp("".concat(pnDelim, "*$")), "");
12958
+ return [(_v$Alphabetic = v3.Alphabetic) !== null && _v$Alphabetic !== void 0 ? _v$Alphabetic : "", (_v$Ideographic = v3.Ideographic) !== null && _v$Ideographic !== void 0 ? _v$Ideographic : "", (_v$Phonetic = v3.Phonetic) !== null && _v$Phonetic !== void 0 ? _v$Phonetic : ""].join(pnDelim).replace(new RegExp("".concat(pnDelim, "*$")), "");
12959
12959
  }).join(String.fromCharCode(VM_DELIMITER));
12960
12960
  }
12961
12961
  function pnAddValueAccessors(_value2) {
@@ -13169,11 +13169,11 @@ var require_dcmjs = __commonJS({
13169
13169
  written.push(0);
13170
13170
  } else {
13171
13171
  var self2 = this;
13172
- valueArgs[0].forEach(function(v2, k2) {
13172
+ valueArgs[0].forEach(function(v3, k2) {
13173
13173
  if (self2.allowMultiple() && k2 > 0) {
13174
13174
  stream.writeUint8(VM_DELIMITER);
13175
13175
  }
13176
- var singularArgs = [v2].concat(valueArgs.slice(1));
13176
+ var singularArgs = [v3].concat(valueArgs.slice(1));
13177
13177
  var byteCount = func.apply(stream, singularArgs);
13178
13178
  written.push(byteCount);
13179
13179
  });
@@ -13672,8 +13672,8 @@ var require_dcmjs = __commonJS({
13672
13672
  key: "writeBytes",
13673
13673
  value: function writeBytes(stream, value, writeOptions) {
13674
13674
  var _this8 = this;
13675
- var val = Array.isArray(value) ? value.map(function(ds2) {
13676
- return _this8.convertToString(ds2);
13675
+ var val = Array.isArray(value) ? value.map(function(ds) {
13676
+ return _this8.convertToString(ds);
13677
13677
  }) : [this.convertToString(value)];
13678
13678
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
13679
13679
  }
@@ -15169,9 +15169,9 @@ var require_dcmjs = __commonJS({
15169
15169
  key: "rgb2XYZ",
15170
15170
  value: function rgb2XYZ(rgb) {
15171
15171
  var R2 = Colors2.invGammaCorrection(rgb[0]);
15172
- var G2 = Colors2.invGammaCorrection(rgb[1]);
15172
+ var G = Colors2.invGammaCorrection(rgb[1]);
15173
15173
  var B2 = Colors2.invGammaCorrection(rgb[2]);
15174
- return [0.41239558896741424 * R2 + 0.3575834307637148 * G2 + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G2 + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G2 + 0.9504971251315798 * B2];
15174
+ return [0.41239558896741424 * R2 + 0.3575834307637148 * G + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G + 0.9504971251315798 * B2];
15175
15175
  }
15176
15176
  }, {
15177
15177
  key: "xyz2LAB",
@@ -15446,8 +15446,8 @@ var require_dcmjs = __commonJS({
15446
15446
  }, {
15447
15447
  key: "isMultiframeDataset",
15448
15448
  value: function isMultiframeDataset() {
15449
- var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
15450
- var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
15449
+ var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
15450
+ var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
15451
15451
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
15452
15452
  }
15453
15453
  }, {
@@ -15487,16 +15487,16 @@ var require_dcmjs = __commonJS({
15487
15487
  }
15488
15488
  this.derivation = new DerivedImage(this.datasets);
15489
15489
  this.dataset = this.derivation.dataset;
15490
- var ds2 = this.dataset;
15490
+ var ds = this.dataset;
15491
15491
  var referenceDataset = this.datasets[0];
15492
- ds2.NumberOfFrames = this.datasets.length;
15493
- ds2.SOPClassUID = referenceDataset.SOPClassUID;
15494
- ds2.Rows = referenceDataset.Rows;
15495
- ds2.Columns = referenceDataset.Columns;
15496
- ds2.BitsAllocated = referenceDataset.BitsAllocated;
15497
- ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
15498
- ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
15499
- ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
15492
+ ds.NumberOfFrames = this.datasets.length;
15493
+ ds.SOPClassUID = referenceDataset.SOPClassUID;
15494
+ ds.Rows = referenceDataset.Rows;
15495
+ ds.Columns = referenceDataset.Columns;
15496
+ ds.BitsAllocated = referenceDataset.BitsAllocated;
15497
+ ds.PixelRepresentation = referenceDataset.PixelRepresentation;
15498
+ ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
15499
+ ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
15500
15500
  var referencePosition = referenceDataset.ImagePositionPatient;
15501
15501
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
15502
15502
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -15511,43 +15511,43 @@ var require_dcmjs = __commonJS({
15511
15511
  distanceDatasetPairs.sort(function(a2, b2) {
15512
15512
  return b2[0] - a2[0];
15513
15513
  });
15514
- if (ds2.BitsAllocated !== 16) {
15514
+ if (ds.BitsAllocated !== 16) {
15515
15515
  log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
15516
15516
  }
15517
15517
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
15518
15518
  log2.warn("No vr map given for pixel data, using OW");
15519
- ds2._vrMap = {
15519
+ ds._vrMap = {
15520
15520
  PixelData: "OW"
15521
15521
  };
15522
15522
  } else {
15523
- ds2._vrMap = {
15523
+ ds._vrMap = {
15524
15524
  PixelData: referenceDataset._vrMap.PixelData
15525
15525
  };
15526
15526
  }
15527
15527
  var frameSize = referenceDataset.PixelData.byteLength;
15528
- ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
15528
+ ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
15529
15529
  var frame = 0;
15530
15530
  distanceDatasetPairs.forEach(function(pair) {
15531
15531
  var dataset = pair[1];
15532
15532
  var pixels = new Uint16Array(dataset.PixelData);
15533
- var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
15533
+ var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
15534
15534
  try {
15535
15535
  frameView.set(pixels);
15536
15536
  } catch (e) {
15537
15537
  if (e instanceof RangeError) {
15538
- 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);
15538
+ 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);
15539
15539
  log2.error(message2);
15540
15540
  }
15541
15541
  }
15542
15542
  frame++;
15543
15543
  });
15544
- if (ds2.NumberOfFrames < 2) {
15544
+ if (ds.NumberOfFrames < 2) {
15545
15545
  log2.error("Cannot populate shared groups uniquely without multiple frames");
15546
15546
  }
15547
15547
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
15548
15548
  var distance1 = distanceDatasetPairs[1][0];
15549
15549
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
15550
- ds2.SharedFunctionalGroupsSequence = {
15550
+ ds.SharedFunctionalGroupsSequence = {
15551
15551
  PlaneOrientationSequence: {
15552
15552
  ImageOrientationPatient: dataset0.ImageOrientationPatient
15553
15553
  },
@@ -15557,14 +15557,14 @@ var require_dcmjs = __commonJS({
15557
15557
  SliceThickness: SpacingBetweenSlices
15558
15558
  }
15559
15559
  };
15560
- ds2.ReferencedSeriesSequence = {
15560
+ ds.ReferencedSeriesSequence = {
15561
15561
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
15562
15562
  ReferencedInstanceSequence: []
15563
15563
  };
15564
- ds2.PerFrameFunctionalGroupsSequence = [];
15564
+ ds.PerFrameFunctionalGroupsSequence = [];
15565
15565
  distanceDatasetPairs.forEach(function(pair) {
15566
15566
  var dataset = pair[1];
15567
- ds2.PerFrameFunctionalGroupsSequence.push({
15567
+ ds.PerFrameFunctionalGroupsSequence.push({
15568
15568
  PlanePositionSequence: {
15569
15569
  ImagePositionPatient: dataset.ImagePositionPatient
15570
15570
  },
@@ -15573,7 +15573,7 @@ var require_dcmjs = __commonJS({
15573
15573
  WindowWidth: dataset.WindowWidth
15574
15574
  }
15575
15575
  });
15576
- ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
15576
+ ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
15577
15577
  ReferencedSOPClassUID: dataset.SOPClassUID,
15578
15578
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
15579
15579
  });
@@ -15593,29 +15593,29 @@ var require_dcmjs = __commonJS({
15593
15593
  }, {
15594
15594
  key: "normalizeMultiframe",
15595
15595
  value: function normalizeMultiframe() {
15596
- var ds2 = this.dataset;
15597
- if (!ds2.NumberOfFrames) {
15596
+ var ds = this.dataset;
15597
+ if (!ds.NumberOfFrames) {
15598
15598
  log2.error("Missing number or frames not supported");
15599
15599
  return;
15600
15600
  }
15601
- if (!ds2.PixelRepresentation) {
15602
- ds2.PixelRepresentation = 1;
15601
+ if (!ds.PixelRepresentation) {
15602
+ ds.PixelRepresentation = 1;
15603
15603
  }
15604
- if (!ds2.StudyID || ds2.StudyID === "") {
15605
- ds2.StudyID = "No Study ID";
15604
+ if (!ds.StudyID || ds.StudyID === "") {
15605
+ ds.StudyID = "No Study ID";
15606
15606
  }
15607
15607
  var validLateralities = ["R", "L"];
15608
- if (validLateralities.indexOf(ds2.Laterality) === -1) {
15609
- delete ds2.Laterality;
15608
+ if (validLateralities.indexOf(ds.Laterality) === -1) {
15609
+ delete ds.Laterality;
15610
15610
  }
15611
- if (!ds2.PresentationLUTShape) {
15612
- ds2.PresentationLUTShape = "IDENTITY";
15611
+ if (!ds.PresentationLUTShape) {
15612
+ ds.PresentationLUTShape = "IDENTITY";
15613
15613
  }
15614
- if (!ds2.SharedFunctionalGroupsSequence) {
15614
+ if (!ds.SharedFunctionalGroupsSequence) {
15615
15615
  log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
15616
15616
  }
15617
- if (ds2.BodyPartExamined === "PROSTATE") {
15618
- ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
15617
+ if (ds.BodyPartExamined === "PROSTATE") {
15618
+ ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
15619
15619
  AnatomicRegionSequence: {
15620
15620
  CodeValue: "T-9200B",
15621
15621
  CodingSchemeDesignator: "SRT",
@@ -15624,17 +15624,17 @@ var require_dcmjs = __commonJS({
15624
15624
  FrameLaterality: "U"
15625
15625
  };
15626
15626
  }
15627
- var rescaleIntercept = ds2.RescaleIntercept || 0;
15628
- var rescaleSlope = ds2.RescaleSlope || 1;
15629
- ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
15627
+ var rescaleIntercept = ds.RescaleIntercept || 0;
15628
+ var rescaleSlope = ds.RescaleSlope || 1;
15629
+ ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
15630
15630
  RescaleIntercept: rescaleIntercept,
15631
15631
  RescaleSlope: rescaleSlope,
15632
15632
  RescaleType: "US"
15633
15633
  };
15634
15634
  var frameNumber = 1;
15635
15635
  this.datasets.forEach(function(dataset) {
15636
- if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
15637
- ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
15636
+ if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
15637
+ ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
15638
15638
  FrameAcquisitionDuration: 0,
15639
15639
  StackID: 1,
15640
15640
  InStackPositionNumber: frameNumber,
@@ -15642,30 +15642,30 @@ var require_dcmjs = __commonJS({
15642
15642
  };
15643
15643
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
15644
15644
  if (!isNaN(frameTime)) {
15645
- var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
15645
+ var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
15646
15646
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
15647
15647
  frameContentSequence.FrameReferenceDateTime = frameTime;
15648
15648
  }
15649
15649
  frameNumber++;
15650
15650
  });
15651
- if (ds2.WindowCenter && ds2.WindowWidth) {
15652
- if (!Array.isArray(ds2.WindowCenter)) {
15653
- ds2.WindowCenter = [ds2.WindowCenter];
15651
+ if (ds.WindowCenter && ds.WindowWidth) {
15652
+ if (!Array.isArray(ds.WindowCenter)) {
15653
+ ds.WindowCenter = [ds.WindowCenter];
15654
15654
  }
15655
- if (!Array.isArray(ds2.WindowWidth)) {
15656
- ds2.WindowWidth = [ds2.WindowWidth];
15655
+ if (!Array.isArray(ds.WindowWidth)) {
15656
+ ds.WindowWidth = [ds.WindowWidth];
15657
15657
  }
15658
15658
  }
15659
- if (!ds2.WindowCenter || !ds2.WindowWidth) {
15660
- ds2.WindowCenter = [];
15661
- ds2.WindowWidth = [];
15662
- if (ds2.PerFrameFunctionalGroupsSequence) {
15659
+ if (!ds.WindowCenter || !ds.WindowWidth) {
15660
+ ds.WindowCenter = [];
15661
+ ds.WindowWidth = [];
15662
+ if (ds.PerFrameFunctionalGroupsSequence) {
15663
15663
  var wcww = {
15664
15664
  center: 0,
15665
15665
  width: 0,
15666
15666
  count: 0
15667
15667
  };
15668
- ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
15668
+ ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
15669
15669
  if (functionalGroup.FrameVOILUT) {
15670
15670
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
15671
15671
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -15683,16 +15683,16 @@ var require_dcmjs = __commonJS({
15683
15683
  }
15684
15684
  });
15685
15685
  if (wcww.count > 0) {
15686
- ds2.WindowCenter.push(String(wcww.center / wcww.count));
15687
- ds2.WindowWidth.push(String(wcww.width / wcww.count));
15686
+ ds.WindowCenter.push(String(wcww.center / wcww.count));
15687
+ ds.WindowWidth.push(String(wcww.width / wcww.count));
15688
15688
  }
15689
15689
  }
15690
15690
  }
15691
- if (ds2.WindowCenter.length === 0) {
15692
- ds2.WindowCenter = [300];
15691
+ if (ds.WindowCenter.length === 0) {
15692
+ ds.WindowCenter = [300];
15693
15693
  }
15694
- if (ds2.WindowWidth.length === 0) {
15695
- ds2.WindowWidth = [500];
15694
+ if (ds.WindowWidth.length === 0) {
15695
+ ds.WindowWidth = [500];
15696
15696
  }
15697
15697
  }
15698
15698
  }], [{
@@ -15738,12 +15738,12 @@ var require_dcmjs = __commonJS({
15738
15738
  key: "normalizeMultiframe",
15739
15739
  value: function normalizeMultiframe() {
15740
15740
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
15741
- var ds2 = this.dataset;
15742
- if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
15743
- ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
15741
+ var ds = this.dataset;
15742
+ if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
15743
+ ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
15744
15744
  }
15745
- ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
15746
- FrameType: ds2.ImageType,
15745
+ ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
15746
+ FrameType: ds.ImageType,
15747
15747
  PixelPresentation: "MONOCHROME",
15748
15748
  VolumetricProperties: "VOLUME",
15749
15749
  VolumeBasedCalculationTechnique: "NONE",
@@ -15868,9 +15868,9 @@ var require_dcmjs = __commonJS({
15868
15868
  key: "normalize",
15869
15869
  value: function normalize2() {
15870
15870
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
15871
- var ds2 = this.datasets[0];
15872
- if (ds2.BitsAllocated !== 32) {
15873
- log2.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
15871
+ var ds = this.datasets[0];
15872
+ if (ds.BitsAllocated !== 32) {
15873
+ log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
15874
15874
  }
15875
15875
  }
15876
15876
  }]);
@@ -16674,8 +16674,8 @@ var require_dcmjs = __commonJS({
16674
16674
  return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
16675
16675
  });
16676
16676
  var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
16677
- var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
16678
- return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
16677
+ var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc) {
16678
+ return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
16679
16679
  });
16680
16680
  if (toolClass) {
16681
16681
  var measurement = toolClass.getMeasurementData(measurementGroup);
@@ -18026,17 +18026,17 @@ var require_dcmjs = __commonJS({
18026
18026
  if (shape === void 0) {
18027
18027
  shape = [data3.length];
18028
18028
  }
18029
- var d3 = shape.length;
18029
+ var d2 = shape.length;
18030
18030
  if (stride === void 0) {
18031
- stride = new Array(d3);
18032
- for (var i = d3 - 1, sz = 1; i >= 0; --i) {
18031
+ stride = new Array(d2);
18032
+ for (var i = d2 - 1, sz = 1; i >= 0; --i) {
18033
18033
  stride[i] = sz;
18034
18034
  sz *= shape[i];
18035
18035
  }
18036
18036
  }
18037
18037
  if (offset === void 0) {
18038
18038
  offset = 0;
18039
- for (var i = 0; i < d3; ++i) {
18039
+ for (var i = 0; i < d2; ++i) {
18040
18040
  if (stride[i] < 0) {
18041
18041
  offset -= (shape[i] - 1) * stride[i];
18042
18042
  }
@@ -18044,10 +18044,10 @@ var require_dcmjs = __commonJS({
18044
18044
  }
18045
18045
  var dtype = arrayDType(data3);
18046
18046
  var ctor_list = CACHED_CONSTRUCTORS[dtype];
18047
- while (ctor_list.length <= d3 + 1) {
18047
+ while (ctor_list.length <= d2 + 1) {
18048
18048
  ctor_list.push(compileConstructor(dtype, ctor_list.length - 1));
18049
18049
  }
18050
- var ctor = ctor_list[d3 + 1];
18050
+ var ctor = ctor_list[d2 + 1];
18051
18051
  return ctor(data3, shape, stride, offset);
18052
18052
  }
18053
18053
  var ndarray = wrappedNDArrayCtor;
@@ -18069,7 +18069,7 @@ var require_dcmjs = __commonJS({
18069
18069
  * @param {Number[6]} iop - ImageOrientationPatient
18070
18070
  * @returns {Number[6]} The transformed ImageOrientationPatient
18071
18071
  */
18072
- v: function v2(iop) {
18072
+ v: function v3(iop) {
18073
18073
  return [-iop[0], -iop[1], -iop[2], iop[3], iop[4], iop[5]];
18074
18074
  },
18075
18075
  /**
@@ -18081,15 +18081,15 @@ var require_dcmjs = __commonJS({
18081
18081
  return [-iop[0], -iop[1], -iop[2], -iop[3], -iop[4], -iop[5]];
18082
18082
  }
18083
18083
  };
18084
- function rotateVectorAroundUnitVector(v2, k2, theta) {
18084
+ function rotateVectorAroundUnitVector(v3, k2, theta) {
18085
18085
  var cosTheta = Math.cos(theta);
18086
18086
  var sinTheta = Math.sin(theta);
18087
18087
  var oneMinusCosTheta = 1 - cosTheta;
18088
- var kdotv = k2[0] * v2[0] + k2[1] * v2[1] + k2[2] * v2[2];
18088
+ var kdotv = k2[0] * v3[0] + k2[1] * v3[1] + k2[2] * v3[2];
18089
18089
  var vRot = [];
18090
- var kxv = crossProduct3D(k2, v2);
18090
+ var kxv = crossProduct3D(k2, v3);
18091
18091
  for (var i = 0; i <= 2; i++) {
18092
- vRot[i] = v2[i] * cosTheta + kxv[i] * sinTheta + k2[i] * kdotv * oneMinusCosTheta;
18092
+ vRot[i] = v3[i] * cosTheta + kxv[i] * sinTheta + k2[i] * kdotv * oneMinusCosTheta;
18093
18093
  vRot[i] *= -1;
18094
18094
  }
18095
18095
  return vRot;
@@ -18104,7 +18104,7 @@ var require_dcmjs = __commonJS({
18104
18104
  }
18105
18105
  var flipMatrix2D = {
18106
18106
  h: h3,
18107
- v
18107
+ v: v2
18108
18108
  };
18109
18109
  function h3(matrix) {
18110
18110
  var _matrix$shape = _slicedToArray(matrix.shape, 2), rows = _matrix$shape[0], cols = _matrix$shape[1];
@@ -18116,7 +18116,7 @@ var require_dcmjs = __commonJS({
18116
18116
  }
18117
18117
  return result;
18118
18118
  }
18119
- function v(matrix) {
18119
+ function v2(matrix) {
18120
18120
  var _matrix$shape2 = _slicedToArray(matrix.shape, 2), rows = _matrix$shape2[0], cols = _matrix$shape2[1];
18121
18121
  var result = ndarray$1(new Uint8Array(rows * cols), [rows, cols]);
18122
18122
  for (var j = 0; j < cols; j++) {
@@ -18208,8 +18208,8 @@ var require_dcmjs = __commonJS({
18208
18208
  var imageId = images[frame].imageId;
18209
18209
  var imageIdSpecificToolState = toolState[imageId];
18210
18210
  var brushPixelData = imageIdSpecificToolState.brush.data[segmentIndex].pixelData;
18211
- for (var p = 0; p < brushPixelData.length; p++) {
18212
- pixelData[pixelDataIndex] = brushPixelData[p];
18211
+ for (var p2 = 0; p2 < brushPixelData.length; p2++) {
18212
+ pixelData[pixelDataIndex] = brushPixelData[p2];
18213
18213
  pixelDataIndex++;
18214
18214
  }
18215
18215
  }
@@ -18349,11 +18349,11 @@ var require_dcmjs = __commonJS({
18349
18349
  var brushDataI = toolState[imageId].brush.data[segmentIndex];
18350
18350
  brushDataI.pixelData = new Uint8Array(pixelData2D.data.length);
18351
18351
  var cToolsPixelData = brushDataI.pixelData;
18352
- for (var p = 0; p < cToolsPixelData.length; p++) {
18353
- if (pixelData2D.data[p]) {
18354
- cToolsPixelData[p] = 1;
18352
+ for (var p2 = 0; p2 < cToolsPixelData.length; p2++) {
18353
+ if (pixelData2D.data[p2]) {
18354
+ cToolsPixelData[p2] = 1;
18355
18355
  } else {
18356
- cToolsPixelData[p] = 0;
18356
+ cToolsPixelData[p2] = 0;
18357
18357
  }
18358
18358
  }
18359
18359
  }
@@ -18547,8 +18547,8 @@ var require_dcmjs = __commonJS({
18547
18547
  if (byteValue <= 127) {
18548
18548
  var N2 = byteValue + 1;
18549
18549
  var next = i + 1;
18550
- for (var p = next; p < next + N2; p++) {
18551
- pixelData[pixelDataIndex] = uInt8Frame[p];
18550
+ for (var p2 = next; p2 < next + N2; p2++) {
18551
+ pixelData[pixelDataIndex] = uInt8Frame[p2];
18552
18552
  pixelDataIndex++;
18553
18553
  }
18554
18554
  i += N2 + 1;
@@ -20335,8 +20335,8 @@ var require_dcmjs = __commonJS({
20335
20335
  return contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER;
20336
20336
  });
20337
20337
  var TrackingIdentifierValue = TrackingIdentifierGroup.TextValue;
20338
- var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc2) {
20339
- return tc2.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
20338
+ var toolClass = hooks.getToolClass ? hooks.getToolClass(measurementGroup, dataset, registeredToolClasses) : registeredToolClasses.find(function(tc) {
20339
+ return tc.isValidCornerstoneTrackingIdentifier(TrackingIdentifierValue);
20340
20340
  });
20341
20341
  if (toolClass) {
20342
20342
  var measurement = toolClass.getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata);
@@ -20744,18 +20744,18 @@ var require_dcmjs = __commonJS({
20744
20744
  out[2] = az + t * (b2[2] - az);
20745
20745
  return out;
20746
20746
  }
20747
- function hermite(out, a2, b2, c, d3, t) {
20747
+ function hermite(out, a2, b2, c, d2, t) {
20748
20748
  var factorTimes2 = t * t;
20749
20749
  var factor1 = factorTimes2 * (2 * t - 3) + 1;
20750
20750
  var factor2 = factorTimes2 * (t - 2) + t;
20751
20751
  var factor3 = factorTimes2 * (t - 1);
20752
20752
  var factor4 = factorTimes2 * (3 - 2 * t);
20753
- out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d3[0] * factor4;
20754
- out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d3[1] * factor4;
20755
- out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d3[2] * factor4;
20753
+ out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d2[0] * factor4;
20754
+ out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d2[1] * factor4;
20755
+ out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d2[2] * factor4;
20756
20756
  return out;
20757
20757
  }
20758
- function bezier(out, a2, b2, c, d3, t) {
20758
+ function bezier(out, a2, b2, c, d2, t) {
20759
20759
  var inverseFactor = 1 - t;
20760
20760
  var inverseFactorTimesTwo = inverseFactor * inverseFactor;
20761
20761
  var factorTimes2 = t * t;
@@ -20763,9 +20763,9 @@ var require_dcmjs = __commonJS({
20763
20763
  var factor2 = 3 * t * inverseFactorTimesTwo;
20764
20764
  var factor3 = 3 * factorTimes2 * inverseFactor;
20765
20765
  var factor4 = factorTimes2 * t;
20766
- out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d3[0] * factor4;
20767
- out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d3[1] * factor4;
20768
- out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d3[2] * factor4;
20766
+ out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d2[0] * factor4;
20767
+ out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d2[1] * factor4;
20768
+ out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d2[2] * factor4;
20769
20769
  return out;
20770
20770
  }
20771
20771
  function random(out, scale2) {
@@ -20794,8 +20794,8 @@ var require_dcmjs = __commonJS({
20794
20794
  out[2] = x2 * m2[2] + y3 * m2[5] + z2 * m2[8];
20795
20795
  return out;
20796
20796
  }
20797
- function transformQuat(out, a2, q) {
20798
- var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
20797
+ function transformQuat(out, a2, q2) {
20798
+ var qx = q2[0], qy = q2[1], qz = q2[2], qw = q2[3];
20799
20799
  var x2 = a2[0], y3 = a2[1], z2 = a2[2];
20800
20800
  var uvx = qy * z2 - qz * y3, uvy = qz * x2 - qx * z2, uvz = qx * y3 - qy * x2;
20801
20801
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
@@ -20812,39 +20812,39 @@ var require_dcmjs = __commonJS({
20812
20812
  return out;
20813
20813
  }
20814
20814
  function rotateX(out, a2, b2, rad) {
20815
- var p = [], r7 = [];
20816
- p[0] = a2[0] - b2[0];
20817
- p[1] = a2[1] - b2[1];
20818
- p[2] = a2[2] - b2[2];
20819
- r7[0] = p[0];
20820
- r7[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);
20821
- r7[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);
20815
+ var p2 = [], r7 = [];
20816
+ p2[0] = a2[0] - b2[0];
20817
+ p2[1] = a2[1] - b2[1];
20818
+ p2[2] = a2[2] - b2[2];
20819
+ r7[0] = p2[0];
20820
+ r7[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
20821
+ r7[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
20822
20822
  out[0] = r7[0] + b2[0];
20823
20823
  out[1] = r7[1] + b2[1];
20824
20824
  out[2] = r7[2] + b2[2];
20825
20825
  return out;
20826
20826
  }
20827
20827
  function rotateY(out, a2, b2, rad) {
20828
- var p = [], r7 = [];
20829
- p[0] = a2[0] - b2[0];
20830
- p[1] = a2[1] - b2[1];
20831
- p[2] = a2[2] - b2[2];
20832
- r7[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);
20833
- r7[1] = p[1];
20834
- r7[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);
20828
+ var p2 = [], r7 = [];
20829
+ p2[0] = a2[0] - b2[0];
20830
+ p2[1] = a2[1] - b2[1];
20831
+ p2[2] = a2[2] - b2[2];
20832
+ r7[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
20833
+ r7[1] = p2[1];
20834
+ r7[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
20835
20835
  out[0] = r7[0] + b2[0];
20836
20836
  out[1] = r7[1] + b2[1];
20837
20837
  out[2] = r7[2] + b2[2];
20838
20838
  return out;
20839
20839
  }
20840
20840
  function rotateZ(out, a2, b2, rad) {
20841
- var p = [], r7 = [];
20842
- p[0] = a2[0] - b2[0];
20843
- p[1] = a2[1] - b2[1];
20844
- p[2] = a2[2] - b2[2];
20845
- r7[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);
20846
- r7[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);
20847
- r7[2] = p[2];
20841
+ var p2 = [], r7 = [];
20842
+ p2[0] = a2[0] - b2[0];
20843
+ p2[1] = a2[1] - b2[1];
20844
+ p2[2] = a2[2] - b2[2];
20845
+ r7[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
20846
+ r7[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
20847
+ r7[2] = p2[2];
20848
20848
  out[0] = r7[0] + b2[0];
20849
20849
  out[1] = r7[1] + b2[1];
20850
20850
  out[2] = r7[2] + b2[2];
@@ -25777,19 +25777,19 @@ var require_decorator = __commonJS({
25777
25777
  mergedObject[key] = (0, util_1.unique)([...(_a = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a !== void 0 ? _a : [], ...(_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : []]);
25778
25778
  return mergedObject;
25779
25779
  };
25780
- var mergePropertyAndMethodDecorators = (d1, d22) => {
25780
+ var mergePropertyAndMethodDecorators = (d1, d2) => {
25781
25781
  var _a, _b, _c, _d;
25782
25782
  return {
25783
- property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d22 === null || d22 === void 0 ? void 0 : d22.property) !== null && _b !== void 0 ? _b : {}),
25784
- method: mergeObjectsOfDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.method) !== null && _d !== void 0 ? _d : {})
25783
+ property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
25784
+ 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 : {})
25785
25785
  };
25786
25786
  };
25787
- var mergeDecorators = (d1, d22) => {
25787
+ var mergeDecorators = (d1, d2) => {
25788
25788
  var _a, _b, _c, _d, _e, _f;
25789
25789
  return {
25790
- class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d22 === null || d22 === void 0 ? void 0 : d22.class) !== null && _b !== void 0 ? _b : []]),
25791
- static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.static) !== null && _d !== void 0 ? _d : {}),
25792
- instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d22 === null || d22 === void 0 ? void 0 : d22.instance) !== null && _f !== void 0 ? _f : {})
25790
+ class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
25791
+ 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 : {}),
25792
+ instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
25793
25793
  };
25794
25794
  };
25795
25795
  var decorators = /* @__PURE__ */ new Map();
@@ -25817,7 +25817,7 @@ var require_decorator = __commonJS({
25817
25817
  return {};
25818
25818
  if (decoratorsForClassChain.length == 1)
25819
25819
  return decoratorsForClassChain[0];
25820
- return decoratorsForClassChain.reduce((d1, d22) => mergeDecorators(d1, d22));
25820
+ return decoratorsForClassChain.reduce((d1, d2) => mergeDecorators(d1, d2));
25821
25821
  };
25822
25822
  exports2.deepDecoratorSearch = deepDecoratorSearch;
25823
25823
  var directDecoratorSearch = (...classes) => {
@@ -25826,7 +25826,7 @@ var require_decorator = __commonJS({
25826
25826
  return {};
25827
25827
  if (classDecorators.length === 1)
25828
25828
  return classDecorators[0];
25829
- return classDecorators.reduce((d1, d22) => mergeDecorators(d1, d22));
25829
+ return classDecorators.reduce((d1, d2) => mergeDecorators(d1, d2));
25830
25830
  };
25831
25831
  exports2.directDecoratorSearch = directDecoratorSearch;
25832
25832
  var getDecoratorsForClass = (clazz) => {
@@ -26162,7 +26162,7 @@ var require_dcmjs_codecs_min = __commonJS({
26162
26162
  "use strict";
26163
26163
  e.exports = __WEBPACK_EXTERNAL_MODULE__111__;
26164
26164
  }, 190: (e, t, r7) => {
26165
- const { Implementation: s, StorageClass: o, TranscodeMap: i, TransferSyntax: n } = r7(492), { Codec: a2 } = r7(258), l3 = r7(111), { DicomDict: c, DicomMessage: d3, DicomMetaDictionary: p, ReadBufferStream: h3, WriteBufferStream: m2 } = l3.data, u2 = l3.log;
26165
+ const { Implementation: s, StorageClass: o, TranscodeMap: i, TransferSyntax: n } = r7(492), { Codec: a2 } = r7(258), l3 = r7(111), { DicomDict: c, DicomMessage: d2, DicomMetaDictionary: p2, ReadBufferStream: h3, WriteBufferStream: m2 } = l3.data, u2 = l3.log;
26166
26166
  e.exports = class {
26167
26167
  constructor(e2, t2, r8 = {}) {
26168
26168
  r8 = { ignoreErrors: true, ...r8 }, u2.level = "error", this.transferSyntaxUid = t2 || n.ImplicitVRLittleEndian, e2 instanceof ArrayBuffer ? t2 ? this._fromElementsBuffer(e2, t2, r8) : this._fromP10Buffer(e2) : this.elements = e2 || {};
@@ -26195,24 +26195,24 @@ var require_dcmjs_codecs_min = __commonJS({
26195
26195
  }
26196
26196
  getDicomDataset(e2, t2) {
26197
26197
  e2 = { fragmentMultiframe: false, ...e2 };
26198
- const r8 = t2 ? p.denaturalizeDataset(this.getElements(), { ...p.nameMap, ...t2 }) : p.denaturalizeDataset(this.getElements()), s2 = new m2();
26199
- return d3.write(r8, s2, this.transferSyntaxUid, e2), s2.getBuffer();
26198
+ const r8 = t2 ? p2.denaturalizeDataset(this.getElements(), { ...p2.nameMap, ...t2 }) : p2.denaturalizeDataset(this.getElements()), s2 = new m2();
26199
+ return d2.write(r8, s2, this.transferSyntaxUid, e2), s2.getBuffer();
26200
26200
  }
26201
26201
  getDicomPart10(e2, t2) {
26202
26202
  e2 = { fragmentMultiframe: false, ...e2 };
26203
- const r8 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this._getElement("SOPClassUID") || o.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this._getElement("SOPInstanceUID") || p.uid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: s.ImplementationClassUid, ImplementationVersionName: s.ImplementationVersion }, ...this.getElements() }, i2 = p.denaturalizeDataset(r8._meta), n2 = new c(i2);
26204
- return n2.dict = t2 ? p.denaturalizeDataset(r8, { ...p.nameMap, ...t2 }) : p.denaturalizeDataset(r8), n2.write(e2);
26203
+ const r8 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this._getElement("SOPClassUID") || o.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this._getElement("SOPInstanceUID") || p2.uid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: s.ImplementationClassUid, ImplementationVersionName: s.ImplementationVersion }, ...this.getElements() }, i2 = p2.denaturalizeDataset(r8._meta), n2 = new c(i2);
26204
+ return n2.dict = t2 ? p2.denaturalizeDataset(r8, { ...p2.nameMap, ...t2 }) : p2.denaturalizeDataset(r8), n2.write(e2);
26205
26205
  }
26206
26206
  _getElement(e2) {
26207
26207
  return this.elements[e2];
26208
26208
  }
26209
26209
  _fromP10Buffer(e2, t2) {
26210
- const r8 = d3.readFile(e2, t2), s2 = p.naturalizeDataset(r8.meta).TransferSyntaxUID, o2 = p.naturalizeDataset(r8.dict);
26210
+ const r8 = d2.readFile(e2, t2), s2 = p2.naturalizeDataset(r8.meta).TransferSyntaxUID, o2 = p2.naturalizeDataset(r8.dict);
26211
26211
  this.elements = o2, this.transferSyntaxUid = s2;
26212
26212
  }
26213
26213
  _fromElementsBuffer(e2, t2, r8) {
26214
- const s2 = new h3(e2), o2 = t2 === n.ImplicitVRLittleEndian ? n.ImplicitVRLittleEndian : t2 === n.ExplicitVRBigEndian ? n.ExplicitVRBigEndian : n.ExplicitVRLittleEndian, i2 = d3._read(s2, o2, r8);
26215
- this.elements = p.naturalizeDataset(i2), this.transferSyntaxUid = t2;
26214
+ const s2 = new h3(e2), o2 = t2 === n.ImplicitVRLittleEndian ? n.ImplicitVRLittleEndian : t2 === n.ExplicitVRBigEndian ? n.ExplicitVRBigEndian : n.ExplicitVRLittleEndian, i2 = d2._read(s2, o2, r8);
26215
+ this.elements = p2.naturalizeDataset(i2), this.transferSyntaxUid = t2;
26216
26216
  }
26217
26217
  };
26218
26218
  }, 213: function(e, t, r7) {
@@ -26246,16 +26246,16 @@ var require_dcmjs_codecs_min = __commonJS({
26246
26246
  }
26247
26247
  if (this.log = this.debug, typeof console === t2 && r9 < this.levels.SILENT) return "No console available for logging";
26248
26248
  }
26249
- function d3(e3) {
26249
+ function d2(e3) {
26250
26250
  return function() {
26251
26251
  typeof console !== t2 && (c.call(this), this[e3].apply(this, arguments));
26252
26252
  };
26253
26253
  }
26254
- function p(e3, t3, r9) {
26255
- return l3(e3) || d3.apply(this, arguments);
26254
+ function p2(e3, t3, r9) {
26255
+ return l3(e3) || d2.apply(this, arguments);
26256
26256
  }
26257
26257
  function h3(e3, r9) {
26258
- var n2, a3, l4, d4 = this, h4 = "loglevel";
26258
+ var n2, a3, l4, d3 = this, h4 = "loglevel";
26259
26259
  function m3(e4) {
26260
26260
  var r10 = (s2[e4] || "silent").toUpperCase();
26261
26261
  if (typeof window !== t2 && h4) {
@@ -26281,7 +26281,7 @@ var require_dcmjs_codecs_min = __commonJS({
26281
26281
  -1 !== o3 && (e4 = /^([^;]+)/.exec(r10.slice(o3 + s3.length + 1))[1]);
26282
26282
  } catch (e5) {
26283
26283
  }
26284
- return void 0 === d4.levels[e4] && (e4 = void 0), e4;
26284
+ return void 0 === d3.levels[e4] && (e4 = void 0), e4;
26285
26285
  }
26286
26286
  }
26287
26287
  function g2() {
@@ -26298,26 +26298,26 @@ var require_dcmjs_codecs_min = __commonJS({
26298
26298
  }
26299
26299
  function f3(e4) {
26300
26300
  var t3 = e4;
26301
- if ("string" == typeof t3 && void 0 !== d4.levels[t3.toUpperCase()] && (t3 = d4.levels[t3.toUpperCase()]), "number" == typeof t3 && t3 >= 0 && t3 <= d4.levels.SILENT) return t3;
26301
+ if ("string" == typeof t3 && void 0 !== d3.levels[t3.toUpperCase()] && (t3 = d3.levels[t3.toUpperCase()]), "number" == typeof t3 && t3 >= 0 && t3 <= d3.levels.SILENT) return t3;
26302
26302
  throw new TypeError("log.setLevel() called with invalid level: " + e4);
26303
26303
  }
26304
- "string" == typeof e3 ? h4 += ":" + e3 : "symbol" == typeof e3 && (h4 = void 0), d4.name = e3, d4.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, d4.methodFactory = r9 || p, d4.getLevel = function() {
26304
+ "string" == typeof e3 ? h4 += ":" + e3 : "symbol" == typeof e3 && (h4 = void 0), d3.name = e3, d3.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, d3.methodFactory = r9 || p2, d3.getLevel = function() {
26305
26305
  return null != l4 ? l4 : null != a3 ? a3 : n2;
26306
- }, d4.setLevel = function(e4, t3) {
26307
- return l4 = f3(e4), false !== t3 && m3(l4), c.call(d4);
26308
- }, d4.setDefaultLevel = function(e4) {
26309
- a3 = f3(e4), u2() || d4.setLevel(e4, false);
26310
- }, d4.resetLevel = function() {
26311
- l4 = null, g2(), c.call(d4);
26312
- }, d4.enableAll = function(e4) {
26313
- d4.setLevel(d4.levels.TRACE, e4);
26314
- }, d4.disableAll = function(e4) {
26315
- d4.setLevel(d4.levels.SILENT, e4);
26316
- }, d4.rebuild = function() {
26317
- if (i !== d4 && (n2 = f3(i.getLevel())), c.call(d4), i === d4) for (var e4 in o2) o2[e4].rebuild();
26306
+ }, d3.setLevel = function(e4, t3) {
26307
+ return l4 = f3(e4), false !== t3 && m3(l4), c.call(d3);
26308
+ }, d3.setDefaultLevel = function(e4) {
26309
+ a3 = f3(e4), u2() || d3.setLevel(e4, false);
26310
+ }, d3.resetLevel = function() {
26311
+ l4 = null, g2(), c.call(d3);
26312
+ }, d3.enableAll = function(e4) {
26313
+ d3.setLevel(d3.levels.TRACE, e4);
26314
+ }, d3.disableAll = function(e4) {
26315
+ d3.setLevel(d3.levels.SILENT, e4);
26316
+ }, d3.rebuild = function() {
26317
+ if (i !== d3 && (n2 = f3(i.getLevel())), c.call(d3), i === d3) for (var e4 in o2) o2[e4].rebuild();
26318
26318
  }, n2 = f3(i ? i.getLevel() : "WARN");
26319
26319
  var w2 = u2();
26320
- null != w2 && (l4 = f3(w2)), c.call(d4);
26320
+ null != w2 && (l4 = f3(w2)), c.call(d3);
26321
26321
  }
26322
26322
  (i = new h3()).getLogger = function(e3) {
26323
26323
  if ("symbol" != typeof e3 && "string" != typeof e3 || "" === e3) throw new TypeError("You must supply a name when creating a logger.");
@@ -26336,8 +26336,8 @@ var require_dcmjs_codecs_min = __commonJS({
26336
26336
  const { PhotometricInterpretation: s } = r7(492);
26337
26337
  class o {
26338
26338
  constructor(e2 = {}) {
26339
- const { width: t2, height: r8, bitsAllocated: s2, bitsStored: o2, samplesPerPixel: i, pixelRepresentation: n, planarConfiguration: a2, photometricInterpretation: l3, encodedBuffer: c, decodedBuffer: d3 } = e2;
26340
- this.width = t2, this.height = r8, this.bitsAllocated = s2, this.bitsStored = o2, this.samplesPerPixel = i, this.pixelRepresentation = n, this.planarConfiguration = a2, this.photometricInterpretation = l3, this.encodedBuffer = c, this.decodedBuffer = d3;
26339
+ const { width: t2, height: r8, bitsAllocated: s2, bitsStored: o2, samplesPerPixel: i, pixelRepresentation: n, planarConfiguration: a2, photometricInterpretation: l3, encodedBuffer: c, decodedBuffer: d2 } = e2;
26340
+ this.width = t2, this.height = r8, this.bitsAllocated = s2, this.bitsStored = o2, this.samplesPerPixel = i, this.pixelRepresentation = n, this.planarConfiguration = a2, this.photometricInterpretation = l3, this.encodedBuffer = c, this.decodedBuffer = d2;
26341
26341
  }
26342
26342
  getWidth() {
26343
26343
  return this.width;
@@ -26422,10 +26422,10 @@ var require_dcmjs_codecs_min = __commonJS({
26422
26422
  }
26423
26423
  e.exports = o;
26424
26424
  }, 237: (e, t, r7) => {
26425
- const { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d3, Jpeg2000LossyCodec: p, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 } = r7(258), { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x2, PlanarConfiguration: C2, TransferSyntax: b2 } = r7(492), _2 = r7(234), I2 = r7(25), A2 = r7(190), S2 = { codecs: { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d3, Jpeg2000LossyCodec: p, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 }, constants: { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x2, PlanarConfiguration: C2, TransferSyntax: b2 }, Context: _2, log: r7(547), NativeCodecs: I2, Transcoder: A2, version: r7(837) };
26425
+ const { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d2, Jpeg2000LossyCodec: p2, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 } = r7(258), { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x2, PlanarConfiguration: C2, TransferSyntax: b2 } = r7(492), _2 = r7(234), I2 = r7(25), A2 = r7(190), S2 = { codecs: { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d2, Jpeg2000LossyCodec: p2, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 }, constants: { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x2, PlanarConfiguration: C2, TransferSyntax: b2 }, Context: _2, log: r7(547), NativeCodecs: I2, Transcoder: A2, version: r7(837) };
26426
26426
  e.exports = S2;
26427
26427
  }, 258: (e, t, r7) => {
26428
- const { Jpeg2000ProgressionOrder: s, JpegSampleFactor: o, PhotometricInterpretation: i, PlanarConfiguration: n, TransferSyntax: a2 } = r7(492), { FrameConverter: l3, Frames: c } = r7(859), d3 = r7(234), p = r7(25), h3 = r7(984);
26428
+ const { Jpeg2000ProgressionOrder: s, JpegSampleFactor: o, PhotometricInterpretation: i, PlanarConfiguration: n, TransferSyntax: a2 } = r7(492), { FrameConverter: l3, Frames: c } = r7(859), d2 = r7(234), p2 = r7(25), h3 = r7(984);
26429
26429
  class m2 {
26430
26430
  encode(e2, t2, r8 = {}) {
26431
26431
  throw new Error("encode should be implemented");
@@ -26434,7 +26434,7 @@ var require_dcmjs_codecs_min = __commonJS({
26434
26434
  throw new Error("decode should be implemented");
26435
26435
  }
26436
26436
  static getCodec(e2) {
26437
- const t2 = { [a2.ImplicitVRLittleEndian]: u2, [a2.ExplicitVRLittleEndian]: g2, [a2.ExplicitVRBigEndian]: f3, [a2.RleLossless]: w2, [a2.JpegBaselineProcess1]: y3, [a2.JpegLosslessProcess14V1]: x2, [a2.JpegLsLossless]: b2, [a2.JpegLsLossy]: _2, [a2.Jpeg2000Lossless]: A2, [a2.Jpeg2000Lossy]: S2, [a2.HtJpeg2000Lossless]: E2, [a2.HtJpeg2000LosslessRpcl]: v, [a2.HtJpeg2000Lossy]: B2 }[e2];
26437
+ const t2 = { [a2.ImplicitVRLittleEndian]: u2, [a2.ExplicitVRLittleEndian]: g2, [a2.ExplicitVRBigEndian]: f3, [a2.RleLossless]: w2, [a2.JpegBaselineProcess1]: y3, [a2.JpegLosslessProcess14V1]: x2, [a2.JpegLsLossless]: b2, [a2.JpegLsLossy]: _2, [a2.Jpeg2000Lossless]: A2, [a2.Jpeg2000Lossy]: S2, [a2.HtJpeg2000Lossless]: E2, [a2.HtJpeg2000LosslessRpcl]: v2, [a2.HtJpeg2000Lossy]: B2 }[e2];
26438
26438
  if (!t2) throw new Error(`Codec for transfer syntax UID ${e2} is not implemented`);
26439
26439
  return new t2();
26440
26440
  }
@@ -26443,9 +26443,9 @@ var require_dcmjs_codecs_min = __commonJS({
26443
26443
  for (let t3 = 0; t3 < i2; t3++) {
26444
26444
  let i3 = o2.getFrameBuffer(t3);
26445
26445
  s2.unpackLow16 && (i3 = l3.unpackLow16(i3)), s2.convertYbrFullToRgb && (i3 = l3.ybrFullToRgb(i3)), s2.convertYbrFull422ToRgb && (i3 = l3.ybrFull422ToRgb(i3, o2.getWidth())), s2.updatePlanarConfiguration && (i3 = l3.changePlanarConfiguration(i3, e2.BitsAllocated, e2.SamplesPerPixel, n.Planar));
26446
- const c2 = d3.fromDicomElements(e2);
26446
+ const c2 = d2.fromDicomElements(e2);
26447
26447
  c2.setDecodedBuffer(i3);
26448
- const m3 = p[r8](c2, s2);
26448
+ const m3 = p2[r8](c2, s2);
26449
26449
  let u3 = m3.getEncodedBuffer();
26450
26450
  u3.length % 2 != 0 && (u3 = h3.concatBuffers([u3, Uint8Array.from([0])])), a3.push(u3.buffer.slice(u3.byteOffset, u3.byteOffset + u3.byteLength)), Object.assign(e2, m3.toDicomElements());
26451
26451
  }
@@ -26454,9 +26454,9 @@ var require_dcmjs_codecs_min = __commonJS({
26454
26454
  _baseDecodeImpl(e2, t2, r8, s2 = {}) {
26455
26455
  const o2 = new c(e2, t2), i2 = o2.getNumberOfFrames(), a3 = [];
26456
26456
  for (let t3 = 0; t3 < i2; t3++) {
26457
- const i3 = o2.getFrameBuffer(t3), c2 = d3.fromDicomElements(e2);
26457
+ const i3 = o2.getFrameBuffer(t3), c2 = d2.fromDicomElements(e2);
26458
26458
  c2.setEncodedBuffer(i3);
26459
- const m3 = p[r8](c2, s2);
26459
+ const m3 = p2[r8](c2, s2);
26460
26460
  let u3 = m3.getDecodedBuffer();
26461
26461
  u3.length % 2 != 0 && (u3 = h3.concatBuffers([u3, Uint8Array.from([0])])), s2.updatePlanarConfiguration && (u3 = l3.changePlanarConfiguration(u3, e2.BitsAllocated, e2.SamplesPerPixel, n.Interleaved)), a3.push(u3.buffer.slice(u3.byteOffset, u3.byteOffset + u3.byteLength)), Object.assign(e2, m3.toDicomElements());
26462
26462
  }
@@ -26634,7 +26634,7 @@ var require_dcmjs_codecs_min = __commonJS({
26634
26634
  return super.decode(e2, t2, "decodeHtJpeg2000", r8);
26635
26635
  }
26636
26636
  }
26637
- class v extends I2 {
26637
+ class v2 extends I2 {
26638
26638
  encode(e2, t2, r8 = {}) {
26639
26639
  return r8.lossy = false, r8.progressionOrder = s.Rpcl, super.encode(e2, t2, "encodeHtJpeg2000", r8);
26640
26640
  }
@@ -26650,7 +26650,7 @@ var require_dcmjs_codecs_min = __commonJS({
26650
26650
  return super.decode(e2, t2, "decodeHtJpeg2000", r8);
26651
26651
  }
26652
26652
  }
26653
- e.exports = { Codec: m2, ExplicitVRBigEndianCodec: f3, ExplicitVRLittleEndianCodec: g2, HtJpeg2000LosslessCodec: E2, HtJpeg2000LosslessRpclCodec: v, HtJpeg2000LossyCodec: B2, ImplicitVRLittleEndianCodec: u2, Jpeg2000LosslessCodec: A2, Jpeg2000LossyCodec: S2, JpegBaselineProcess1Codec: y3, JpegLosslessProcess14V1Codec: x2, JpegLsLosslessCodec: b2, JpegLsLossyCodec: _2, RleLosslessCodec: w2 };
26653
+ e.exports = { Codec: m2, ExplicitVRBigEndianCodec: f3, ExplicitVRLittleEndianCodec: g2, HtJpeg2000LosslessCodec: E2, HtJpeg2000LosslessRpclCodec: v2, HtJpeg2000LossyCodec: B2, ImplicitVRLittleEndianCodec: u2, Jpeg2000LosslessCodec: A2, Jpeg2000LossyCodec: S2, JpegBaselineProcess1Codec: y3, JpegLosslessProcess14V1Codec: x2, JpegLsLosslessCodec: b2, JpegLsLossyCodec: _2, RleLosslessCodec: w2 };
26654
26654
  }, 492: (e) => {
26655
26655
  const t = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaselineProcess1: "1.2.840.10008.1.2.4.50", JpegLosslessProcess14V1: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91", JpegXlLossless: "1.2.840.10008.1.2.4.110", JpegXlRecompression: "1.2.840.10008.1.2.4.111", JpegXl: "1.2.840.10008.1.2.4.112", HtJpeg2000Lossless: "1.2.840.10008.1.2.4.201", HtJpeg2000LosslessRpcl: "1.2.840.10008.1.2.4.202", HtJpeg2000Lossy: "1.2.840.10008.1.2.4.203" };
26656
26656
  Object.freeze(t);
@@ -26670,8 +26670,8 @@ var require_dcmjs_codecs_min = __commonJS({
26670
26670
  Object.freeze(l3);
26671
26671
  const c = { Sf444: 0, Sf422: 1, Unknown: 2 };
26672
26672
  Object.freeze(c);
26673
- const d3 = { Lrcp: 0, Rlcp: 1, Rpcl: 2, Pcrl: 3, Cprl: 4 };
26674
- Object.freeze(d3), e.exports = { ErrNo: l3, Implementation: n, Jpeg2000ProgressionOrder: d3, JpegSampleFactor: c, PhotometricInterpretation: s, PixelRepresentation: i, PlanarConfiguration: o, StorageClass: a2, TranscodeMap: r7, TransferSyntax: t };
26673
+ const d2 = { Lrcp: 0, Rlcp: 1, Rpcl: 2, Pcrl: 3, Cprl: 4 };
26674
+ Object.freeze(d2), e.exports = { ErrNo: l3, Implementation: n, Jpeg2000ProgressionOrder: d2, JpegSampleFactor: c, PhotometricInterpretation: s, PixelRepresentation: i, PlanarConfiguration: o, StorageClass: a2, TranscodeMap: r7, TransferSyntax: t };
26675
26675
  }, 547: (e, t, r7) => {
26676
26676
  const s = r7(213), o = r7(935);
26677
26677
  o.reg(s), s.enableAll(false), o.apply(s, { format: (e2, t2, r8) => `${r8} -- ${e2.toUpperCase()} --`, timestampFormatter: (e2) => e2.toISOString() }), e.exports = s;
@@ -26829,14 +26829,14 @@ var require_dcmjs_codecs_min = __commonJS({
26829
26829
  if (!e3 || !e3.setLevel) throw new TypeError("Argument is not a logger");
26830
26830
  var n2 = e3.methodFactory, a3 = e3.name || "", l3 = i[a3] || i[""] || o2;
26831
26831
  function c(e4, t3, r10) {
26832
- var s3 = n2(e4, t3, r10), o3 = i[r10] || i[""], l4 = -1 !== o3.template.indexOf("%t"), c2 = -1 !== o3.template.indexOf("%l"), d3 = -1 !== o3.template.indexOf("%n");
26832
+ var s3 = n2(e4, t3, r10), o3 = i[r10] || i[""], l4 = -1 !== o3.template.indexOf("%t"), c2 = -1 !== o3.template.indexOf("%l"), d2 = -1 !== o3.template.indexOf("%n");
26833
26833
  return function() {
26834
- for (var t4 = "", n3 = arguments.length, p = Array(n3), h3 = 0; h3 < n3; h3++) p[h3] = arguments[h3];
26834
+ for (var t4 = "", n3 = arguments.length, p2 = Array(n3), h3 = 0; h3 < n3; h3++) p2[h3] = arguments[h3];
26835
26835
  if (a3 || !i[r10]) {
26836
26836
  var m2 = o3.timestampFormatter(/* @__PURE__ */ new Date()), u2 = o3.levelFormatter(e4), g2 = o3.nameFormatter(r10);
26837
- o3.format ? t4 += o3.format(u2, g2, m2) : (t4 += o3.template, l4 && (t4 = t4.replace(/%t/, m2)), c2 && (t4 = t4.replace(/%l/, u2)), d3 && (t4 = t4.replace(/%n/, g2))), p.length && "string" == typeof p[0] ? p[0] = t4 + " " + p[0] : p.unshift(t4);
26837
+ o3.format ? t4 += o3.format(u2, g2, m2) : (t4 += o3.template, l4 && (t4 = t4.replace(/%t/, m2)), c2 && (t4 = t4.replace(/%l/, u2)), d2 && (t4 = t4.replace(/%n/, g2))), p2.length && "string" == typeof p2[0] ? p2[0] = t4 + " " + p2[0] : p2.unshift(t4);
26838
26838
  }
26839
- s3.apply(void 0, p);
26839
+ s3.apply(void 0, p2);
26840
26840
  };
26841
26841
  }
26842
26842
  return i[a3] || (e3.methodFactory = c), (r9 = r9 || {}).template && (r9.format = void 0), i[a3] = s2({}, l3, r9), e3.setLevel(e3.getLevel()), t2 || e3.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"), e3;
@@ -29267,8 +29267,8 @@ var require_dcmjs_dimse_min = __commonJS({
29267
29267
  if (t3 !== a3.ImplicitVRLittleEndian && t3 !== a3.ExplicitVRLittleEndian && t3 !== a3.ExplicitVRBigEndian && true !== n2.isInitialized()) throw new Error("Transcoding is not initialized. Please call Transcoding.initializeAsync() first.");
29268
29268
  if (!r8.includes(e3.getTransferSyntaxUid()) || !r8.includes(t3)) throw new Error(`Transcoding dataset from ${this._transferSyntaxDescriptionFromValue(e3.getTransferSyntaxUid())} to ${this._transferSyntaxDescriptionFromValue(t3)} is not supported.`);
29269
29269
  c2.info(`Transcoding dataset from ${this._transferSyntaxDescriptionFromValue(e3.getTransferSyntaxUid())} to ${this._transferSyntaxDescriptionFromValue(t3)}...`);
29270
- const d4 = new i2(e3.getElements(), e3.getTransferSyntaxUid());
29271
- return d4.transcode(t3, s3), new o2(d4.getElements(), d4.getTransferSyntaxUid());
29270
+ const d3 = new i2(e3.getElements(), e3.getTransferSyntaxUid());
29271
+ return d3.transcode(t3, s3), new o2(d3.getElements(), d3.getTransferSyntaxUid());
29272
29272
  }
29273
29273
  static _transferSyntaxDescriptionFromValue(e3) {
29274
29274
  const t3 = Object.keys(a3).find((t4) => a3[t4] === e3);
@@ -29305,8 +29305,8 @@ var require_dcmjs_dimse_min = __commonJS({
29305
29305
  "use strict";
29306
29306
  e2.exports = t;
29307
29307
  }, 237: (e2, t2, s2) => {
29308
- const { Association: n2, PresentationContext: i2 } = s2(570), { Scp: r8, Server: a3 } = s2(538), { CCancelRequest: o2, CEchoRequest: c2, CEchoResponse: d4, CFindRequest: u2, CFindResponse: h3, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: y3, NActionResponse: f3, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: A2, NEventReportRequest: v, NEventReportResponse: x2, NGetRequest: w2, NGetResponse: U, NSetRequest: q, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T2, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $2, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G2 } = s2(492), z2 = s2(422), Q2 = s2(825), W2 = s2(139), J2 = s2(906), X2 = s2(73), H = { association: { Association: n2, PresentationContext: i2 }, Client: z2, constants: { AbortReason: E2, AbortSource: T2, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $2, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G2 }, Dataset: Q2, Implementation: W2, log: s2(547), requests: { CCancelRequest: o2, CEchoRequest: c2, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y3, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: v, NGetRequest: w2, NSetRequest: q }, responses: { CEchoResponse: d4, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x2, NGetResponse: U, NSetResponse: D2 }, Scp: r8, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
- e2.exports = H;
29308
+ const { Association: n2, PresentationContext: i2 } = s2(570), { Scp: r8, Server: a3 } = s2(538), { CCancelRequest: o2, CEchoRequest: c2, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: y3, NActionResponse: f3, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: A2, NEventReportRequest: v2, NEventReportResponse: x2, NGetRequest: w2, NGetResponse: U, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G } = s2(492), z2 = s2(422), Q2 = s2(825), W2 = s2(139), J2 = s2(906), X2 = s2(73), H2 = { association: { Association: n2, PresentationContext: i2 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G }, Dataset: Q2, Implementation: W2, log: s2(547), requests: { CCancelRequest: o2, CEchoRequest: c2, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y3, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: v2, NGetRequest: w2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x2, NGetResponse: U, NSetResponse: D2 }, Scp: r8, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
+ e2.exports = H2;
29310
29310
  }, 278: (e2) => {
29311
29311
  "use strict";
29312
29312
  e2.exports = require("net");
@@ -29314,8 +29314,8 @@ var require_dcmjs_dimse_min = __commonJS({
29314
29314
  "use strict";
29315
29315
  e2.exports = s;
29316
29316
  }, 371: (e2, t2, s2) => {
29317
- const { Association: n2 } = s2(570), { AAbort: i2, AAssociateAC: r8, AAssociateRJ: a3, AAssociateRQ: o2, AReleaseRP: c2, AReleaseRQ: d4, PDataTF: u2, Pdv: h3, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p } = s2(492), { CCancelRequest: R2, CEchoRequest: S2, CEchoResponse: y3, CFindRequest: f3, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: A2, CMoveResponse: v, Command: x2, CStoreRequest: w2, CStoreResponse: U, NActionRequest: q, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T2, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M, NGetRequest: B2, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $2 } = s2(940), j = s2(825), V2 = s2(139), _2 = s2(906), G2 = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
- class H extends J2 {
29317
+ const { Association: n2 } = s2(570), { AAbort: i2, AAssociateAC: r8, AAssociateRJ: a3, AAssociateRQ: o2, AReleaseRP: c2, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p2 } = s2(492), { CCancelRequest: R2, CEchoRequest: S2, CEchoResponse: y3, CFindRequest: f3, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: A2, CMoveResponse: v2, Command: x2, CStoreRequest: w2, CStoreResponse: U, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M, NGetRequest: B2, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(940), j = s2(825), V2 = s2(139), _2 = s2(906), G = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
+ class H2 extends J2 {
29319
29319
  constructor() {
29320
29320
  super();
29321
29321
  }
@@ -29367,7 +29367,7 @@ var require_dcmjs_dimse_min = __commonJS({
29367
29367
  z2.info(`${this.logId} -> Association reject ${n3.toString()}`), this._sendPdu(i3);
29368
29368
  }
29369
29369
  sendAssociationReleaseRequest() {
29370
- const e3 = new d4().write();
29370
+ const e3 = new d3().write();
29371
29371
  z2.info(`${this.logId} -> Association release request`), this._sendPdu(e3);
29372
29372
  }
29373
29373
  sendAssociationReleaseResponse() {
@@ -29435,7 +29435,7 @@ var require_dcmjs_dimse_min = __commonJS({
29435
29435
  try {
29436
29436
  const t3 = e3.command.getDataset(), s3 = this.association.getPresentationContext(e3.context.getPresentationContextId()).getAcceptedTransferSyntaxUid();
29437
29437
  if (t3 && s3 !== t3.getTransferSyntaxUid()) try {
29438
- const n3 = G2.transcodeDataset(t3, s3, this.datasetTranscodeOptions);
29438
+ const n3 = G.transcodeDataset(t3, s3, this.datasetTranscodeOptions);
29439
29439
  e3.command.setDataset(n3);
29440
29440
  } catch (t4) {
29441
29441
  return z2.error(t4.message), void e3.command.raiseDoneEvent();
@@ -29488,7 +29488,7 @@ var require_dcmjs_dimse_min = __commonJS({
29488
29488
  break;
29489
29489
  }
29490
29490
  case l3.AReleaseRQ:
29491
- new d4().read(t3), z2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
29491
+ new d3().read(t3), z2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
29492
29492
  break;
29493
29493
  case l3.AReleaseRP:
29494
29494
  new c2().read(t3), z2.info(`${this.logId} <- Association release response`), this.emit("associationReleaseResponse");
@@ -29538,7 +29538,7 @@ var require_dcmjs_dimse_min = __commonJS({
29538
29538
  this.dimse = Object.assign(new A2(), e5);
29539
29539
  break;
29540
29540
  case g2.CMoveResponse:
29541
- this.dimse = Object.assign(new v(), e5);
29541
+ this.dimse = Object.assign(new v2(), e5);
29542
29542
  break;
29543
29543
  case g2.CGetRequest:
29544
29544
  this.dimse = Object.assign(new C2(), e5);
@@ -29550,10 +29550,10 @@ var require_dcmjs_dimse_min = __commonJS({
29550
29550
  this.dimse = Object.assign(new E2(), e5);
29551
29551
  break;
29552
29552
  case g2.NCreateResponse:
29553
- this.dimse = Object.assign(new T2(), e5);
29553
+ this.dimse = Object.assign(new T(), e5);
29554
29554
  break;
29555
29555
  case g2.NActionRequest:
29556
- this.dimse = Object.assign(new q(), e5);
29556
+ this.dimse = Object.assign(new q2(), e5);
29557
29557
  break;
29558
29558
  case g2.NActionResponse:
29559
29559
  this.dimse = Object.assign(new D2(), e5);
@@ -29604,9 +29604,9 @@ var require_dcmjs_dimse_min = __commonJS({
29604
29604
  }
29605
29605
  }
29606
29606
  _performDimse(e3, t3) {
29607
- if (t3 instanceof $2) {
29607
+ if (t3 instanceof $) {
29608
29608
  const e4 = Object.assign(Object.create(Object.getPrototypeOf(t3)), t3), s3 = this.pending.find((e5) => e5.getMessageId() === t3.getMessageIdBeingRespondedTo());
29609
- s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== p.Pending && s3.raiseDoneEvent());
29609
+ s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== p2.Pending && s3.raiseDoneEvent());
29610
29610
  } else t3.getCommandFieldType() === g2.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
29611
29611
  this._sendDimse({ context: e3, command: t4 });
29612
29612
  }) : t3.getCommandFieldType() === g2.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
@@ -29641,7 +29641,7 @@ var require_dcmjs_dimse_min = __commonJS({
29641
29641
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
29642
29642
  this.connected = true, this.connectedTime = Date.now(), this.emit("connect");
29643
29643
  });
29644
- const e3 = new H();
29644
+ const e3 = new H2();
29645
29645
  e3.on("pdu", async (e4) => {
29646
29646
  this.lastPduTime = Date.now(), await this._processPdu(e4);
29647
29647
  }), e3.on("error", (e4) => {
@@ -29671,10 +29671,10 @@ var require_dcmjs_dimse_min = __commonJS({
29671
29671
  }
29672
29672
  };
29673
29673
  }, 422: (e2, t2, s2) => {
29674
- const { Association: n2, PresentationContext: i2 } = s2(570), { TransferSyntax: r8, UserIdentityType: a3 } = s2(492), { Request: o2 } = s2(940), c2 = s2(371), d4 = s2(906), u2 = s2(547), h3 = s2(733), m2 = s2(278), g2 = s2(756);
29674
+ const { Association: n2, PresentationContext: i2 } = s2(570), { TransferSyntax: r8, UserIdentityType: a3 } = s2(492), { Request: o2 } = s2(940), c2 = s2(371), d3 = s2(906), u2 = s2(547), h3 = s2(733), m2 = s2(278), g2 = s2(756);
29675
29675
  e2.exports = class extends h3 {
29676
29676
  constructor() {
29677
- super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d4();
29677
+ super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d3();
29678
29678
  }
29679
29679
  addRequest(e3) {
29680
29680
  if (!(e3 instanceof o2)) throw new Error(`${e3.toString()} is not a request`);
@@ -29689,37 +29689,37 @@ var require_dcmjs_dimse_min = __commonJS({
29689
29689
  }
29690
29690
  send(e3, t3, s3, i3, o3) {
29691
29691
  if (o3 = o3 || {}, this.associationLingerTimeout = o3.associationLingerTimeout || 0, 0 === this.requests.length) throw new Error("There are no requests to perform");
29692
- const d5 = new n2(s3, i3);
29693
- o3.asyncOps && (d5.setMaxAsyncOpsInvoked(o3.asyncOps.maxAsyncOpsInvoked || 1), d5.setMaxAsyncOpsPerformed(o3.asyncOps.maxAsyncOpsPerformed || 1), d5.setNegotiateAsyncOps(1 !== d5.getMaxAsyncOpsInvoked() || 1 !== d5.getMaxAsyncOpsPerformed())), o3.userIdentity && (d5.setUserIdentityType(o3.userIdentity.type || a3.Username), d5.setUserIdentityPositiveResponseRequested(o3.userIdentity.positiveResponseRequested || false), d5.setUserIdentityPrimaryField(o3.userIdentity.primaryField || ""), d5.setUserIdentitySecondaryField(o3.userIdentity.secondaryField || ""), d5.setNegotiateUserIdentity(true)), this.requests.forEach((e4) => {
29694
- d5.addPresentationContextFromRequest(e4, [r8.ImplicitVRLittleEndian, r8.ExplicitVRLittleEndian]);
29692
+ const d4 = new n2(s3, i3);
29693
+ o3.asyncOps && (d4.setMaxAsyncOpsInvoked(o3.asyncOps.maxAsyncOpsInvoked || 1), d4.setMaxAsyncOpsPerformed(o3.asyncOps.maxAsyncOpsPerformed || 1), d4.setNegotiateAsyncOps(1 !== d4.getMaxAsyncOpsInvoked() || 1 !== d4.getMaxAsyncOpsPerformed())), o3.userIdentity && (d4.setUserIdentityType(o3.userIdentity.type || a3.Username), d4.setUserIdentityPositiveResponseRequested(o3.userIdentity.positiveResponseRequested || false), d4.setUserIdentityPrimaryField(o3.userIdentity.primaryField || ""), d4.setUserIdentitySecondaryField(o3.userIdentity.secondaryField || ""), d4.setNegotiateUserIdentity(true)), this.requests.forEach((e4) => {
29694
+ d4.addPresentationContextFromRequest(e4, [r8.ImplicitVRLittleEndian, r8.ExplicitVRLittleEndian]);
29695
29695
  }), this.additionalPresentationContexts.forEach((e4) => {
29696
- const t4 = e4.addAsNew ? d5.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d5.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
29696
+ const t4 = e4.addAsNew ? d4.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d4.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
29697
29697
  e4.context.getTransferSyntaxUids().forEach((e5) => {
29698
- d5.addTransferSyntaxToPresentationContext(t4, e5);
29698
+ d4.addTransferSyntaxToPresentationContext(t4, e5);
29699
29699
  });
29700
29700
  });
29701
29701
  let h4 = {};
29702
29702
  o3.securityOptions && (h4 = { key: o3.securityOptions.key, cert: o3.securityOptions.cert, ca: o3.securityOptions.ca, requestCert: o3.securityOptions.requestCert, rejectUnauthorized: o3.securityOptions.rejectUnauthorized, minVersion: o3.securityOptions.minVersion, maxVersion: o3.securityOptions.maxVersion, ciphers: o3.securityOptions.ciphers }), u2.info(`Connecting to ${e3}:${t3} ${o3.securityOptions ? "(TLS)" : ""}`);
29703
- const l3 = (o3.securityOptions ? g2 : m2).connect({ host: e3, port: t3, ...h4 }), p = new c2(l3, o3);
29704
- p.on("connect", () => {
29705
- this.emit("connected"), p.sendAssociationRequest(d5);
29706
- }), p.on("associationAccepted", (e4) => {
29707
- this.emit("associationAccepted", e4), p.sendRequests(this.requests);
29708
- }), p.on("associationReleaseResponse", () => {
29703
+ const l3 = (o3.securityOptions ? g2 : m2).connect({ host: e3, port: t3, ...h4 }), p2 = new c2(l3, o3);
29704
+ p2.on("connect", () => {
29705
+ this.emit("connected"), p2.sendAssociationRequest(d4);
29706
+ }), p2.on("associationAccepted", (e4) => {
29707
+ this.emit("associationAccepted", e4), p2.sendRequests(this.requests);
29708
+ }), p2.on("associationReleaseResponse", () => {
29709
29709
  this.emit("associationReleased"), l3.end();
29710
- }), p.on("associationRejected", (e4) => {
29710
+ }), p2.on("associationRejected", (e4) => {
29711
29711
  this.emit("associationRejected", e4), l3.end();
29712
- }), p.on("done", () => {
29713
- setTimeout(() => p.sendAssociationReleaseRequest(), this.associationLingerTimeout);
29714
- }), p.on("cStoreRequest", (e4, t4) => {
29712
+ }), p2.on("done", () => {
29713
+ setTimeout(() => p2.sendAssociationReleaseRequest(), this.associationLingerTimeout);
29714
+ }), p2.on("cStoreRequest", (e4, t4) => {
29715
29715
  this.emit("cStoreRequest", e4, t4);
29716
- }), p.on("nEventReportRequest", (e4, t4) => {
29716
+ }), p2.on("nEventReportRequest", (e4, t4) => {
29717
29717
  this.emit("nEventReportRequest", e4, t4);
29718
- }), p.on("networkError", (e4) => {
29718
+ }), p2.on("networkError", (e4) => {
29719
29719
  l3.end(), this.emit("networkError", e4);
29720
- }), p.on("close", () => {
29721
- this.statistics.addFromOtherStatistics(p.getStatistics()), this.network = void 0, this.emit("closed");
29722
- }), this.network = p;
29720
+ }), p2.on("close", () => {
29721
+ this.statistics.addFromOtherStatistics(p2.getStatistics()), this.network = void 0, this.emit("closed");
29722
+ }), this.network = p2;
29723
29723
  }
29724
29724
  getStatistics() {
29725
29725
  return this.statistics;
@@ -29753,8 +29753,8 @@ var require_dcmjs_dimse_min = __commonJS({
29753
29753
  Object.freeze(o2);
29754
29754
  const c2 = { ServiceUser: 1, ServiceProviderAcse: 2, ServiceProviderPresentation: 3 };
29755
29755
  Object.freeze(c2);
29756
- const d4 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
29757
- Object.freeze(d4);
29756
+ const d3 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
29757
+ Object.freeze(d3);
29758
29758
  const u2 = { Low: 2, Medium: 0, High: 1 };
29759
29759
  Object.freeze(u2);
29760
29760
  const h3 = { Success: 0, Cancel: 65024, Pending: 65280, ClassInstanceConflict: 281, DataSetSopClassMismatch: 43264, DuplicateSOPInstance: 273, DuplicateInvocation: 528, InvalidArgumentValue: 277, InvalidAttributeValue: 262, InvalidObjectInstance: 279, MissingAttribute: 288, MissingAttributeValue: 289, MistypedArgument: 530, MoveDestinationUnknown: 43009, NoSuchActionType: 291, NoSuchArgument: 276, NoSuchEventType: 275, NoSuchObjectInstance: 274, NoSuchSopClass: 280, NotAuthorized: 292, OutOfResourcesNumberOfMatches: 42753, OutOfResourcesSubOperations: 42754, ProcessingFailure: 272, ResourceLimitation: 531, SopClassNotSupported: 290, UnrecognizedOperation: 529 };
@@ -29765,14 +29765,14 @@ var require_dcmjs_dimse_min = __commonJS({
29765
29765
  Object.freeze(g2);
29766
29766
  const l3 = { Verification: "1.2.840.10008.1.1", StudyRootQueryRetrieveInformationModelFind: "1.2.840.10008.5.1.4.1.2.2.1", ModalityWorklistInformationModelFind: "1.2.840.10008.5.1.4.31", ModalityPerformedProcedureStep: "1.2.840.10008.3.1.2.3.3", StudyRootQueryRetrieveInformationModelMove: "1.2.840.10008.5.1.4.1.2.2.2", StudyRootQueryRetrieveInformationModelGet: "1.2.840.10008.5.1.4.1.2.2.3", StorageCommitmentPushModel: "1.2.840.10008.1.20.1", BasicFilmSession: "1.2.840.10008.5.1.1.1", PrintJob: "1.2.840.10008.5.1.1.14", BasicAnnotationBox: "1.2.840.10008.5.1.1.15", Printer: "1.2.840.10008.5.1.1.16", PrinterConfigurationRetrieval: "1.2.840.10008.5.1.1.16.376", BasicGrayscalePrintManagementMeta: "1.2.840.10008.5.1.1.9", BasicColorPrintManagementMeta: "1.2.840.10008.5.1.1.18", BasicFilmBox: "1.2.840.10008.5.1.1.2", PresentationLut: "1.2.840.10008.5.1.1.23", BasicGrayscaleImageBox: "1.2.840.10008.5.1.1.4", BasicColorImageBox: "1.2.840.10008.5.1.1.4.1", InstanceAvailabilityNotification: "1.2.840.10008.5.1.4.33" };
29767
29767
  Object.freeze(l3);
29768
- const p = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91", JpegXlLossless: "1.2.840.10008.1.2.4.110", JpegXlRecompression: "1.2.840.10008.1.2.4.111", JpegXl: "1.2.840.10008.1.2.4.112", HtJpeg2000Lossless: "1.2.840.10008.1.2.4.201", HtJpeg2000LosslessRpcl: "1.2.840.10008.1.2.4.202", HtJpeg2000Lossy: "1.2.840.10008.1.2.4.203" };
29769
- Object.freeze(p);
29770
- const R2 = [p.ImplicitVRLittleEndian, p.ExplicitVRLittleEndian, p.ExplicitVRBigEndian, p.RleLossless, p.JpegBaseline, p.JpegLossless, p.JpegLsLossless, p.JpegLsLossy, p.Jpeg2000Lossless, p.Jpeg2000Lossy, p.HtJpeg2000Lossless, p.HtJpeg2000LosslessRpcl, p.HtJpeg2000Lossy];
29768
+ const p2 = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91", JpegXlLossless: "1.2.840.10008.1.2.4.110", JpegXlRecompression: "1.2.840.10008.1.2.4.111", JpegXl: "1.2.840.10008.1.2.4.112", HtJpeg2000Lossless: "1.2.840.10008.1.2.4.201", HtJpeg2000LosslessRpcl: "1.2.840.10008.1.2.4.202", HtJpeg2000Lossy: "1.2.840.10008.1.2.4.203" };
29769
+ Object.freeze(p2);
29770
+ const R2 = [p2.ImplicitVRLittleEndian, p2.ExplicitVRLittleEndian, p2.ExplicitVRBigEndian, p2.RleLossless, p2.JpegBaseline, p2.JpegLossless, p2.JpegLsLossless, p2.JpegLsLossy, p2.Jpeg2000Lossless, p2.Jpeg2000Lossy, p2.HtJpeg2000Lossless, p2.HtJpeg2000LosslessRpcl, p2.HtJpeg2000Lossy];
29771
29771
  Object.freeze(R2);
29772
29772
  const S2 = { ImplementationClassUid: "1.2.826.0.1.3680043.10.854", ImplementationVersion: "DCMJS-DIMSE-V0.2", MaxPduLength: 262144 };
29773
- Object.freeze(S2), e2.exports = { AbortReason: a3, AbortSource: r8, CommandFieldType: s2, DefaultImplementation: S2, PresentationContextResult: n2, Priority: u2, RawPduType: t2, RejectReason: d4, RejectResult: o2, RejectSource: c2, SopClass: l3, Status: h3, StorageClass: g2, TranscodableTransferSyntaxes: R2, TransferSyntax: p, Uid: m2, UserIdentityType: i2 };
29773
+ Object.freeze(S2), e2.exports = { AbortReason: a3, AbortSource: r8, CommandFieldType: s2, DefaultImplementation: S2, PresentationContextResult: n2, Priority: u2, RawPduType: t2, RejectReason: d3, RejectResult: o2, RejectSource: c2, SopClass: l3, Status: h3, StorageClass: g2, TranscodableTransferSyntaxes: R2, TransferSyntax: p2, Uid: m2, UserIdentityType: i2 };
29774
29774
  }, 538: (e2, t2, s2) => {
29775
- const { CEchoResponse: n2, CFindResponse: i2, CGetResponse: r8, CMoveResponse: a3, CStoreResponse: o2, NActionResponse: c2, NCreateResponse: d4, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m2, NSetResponse: g2 } = s2(940), l3 = s2(371), p = s2(906), R2 = s2(547), S2 = s2(733), y3 = s2(278), f3 = s2(756);
29775
+ const { CEchoResponse: n2, CFindResponse: i2, CGetResponse: r8, CMoveResponse: a3, CStoreResponse: o2, NActionResponse: c2, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m2, NSetResponse: g2 } = s2(940), l3 = s2(371), p2 = s2(906), R2 = s2(547), S2 = s2(733), y3 = s2(278), f3 = s2(756);
29776
29776
  e2.exports = { Scp: class extends l3 {
29777
29777
  constructor(e3, t3) {
29778
29778
  super(e3, t3), this.on("associationRequested", (e4) => {
@@ -29835,7 +29835,7 @@ var require_dcmjs_dimse_min = __commonJS({
29835
29835
  R2.error("cGetRequest method must be implemented"), t3(r8.fromRequest(e3));
29836
29836
  }
29837
29837
  nCreateRequest(e3, t3) {
29838
- R2.error("nCreateRequest method must be implemented"), t3(d4.fromRequest(e3));
29838
+ R2.error("nCreateRequest method must be implemented"), t3(d3.fromRequest(e3));
29839
29839
  }
29840
29840
  nActionRequest(e3, t3) {
29841
29841
  R2.error("nActionRequest method must be implemented"), t3(c2.fromRequest(e3));
@@ -29860,7 +29860,7 @@ var require_dcmjs_dimse_min = __commonJS({
29860
29860
  }
29861
29861
  }, Server: class extends S2 {
29862
29862
  constructor(e3) {
29863
- super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p();
29863
+ super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p2();
29864
29864
  }
29865
29865
  listen(e3, t3) {
29866
29866
  let s3 = {};
@@ -29892,7 +29892,7 @@ var require_dcmjs_dimse_min = __commonJS({
29892
29892
  const n2 = s2(360), i2 = s2(707);
29893
29893
  i2.reg(n2), n2.enableAll(false), i2.apply(n2, { format: (e3, t3, s3) => `${s3} -- ${e3.toUpperCase()} --`, timestampFormatter: (e3) => e3.toISOString() }), e2.exports = n2;
29894
29894
  }, 570: (e2, t2, s2) => {
29895
- const { CGetRequest: n2, CStoreRequest: i2 } = s2(940), { CommandFieldType: r8, PresentationContextResult: a3, SopClass: o2, StorageClass: c2, TransferSyntax: d4, Uid: u2, UserIdentityType: h3 } = s2(492), m2 = s2(139), { EOL: g2 } = s2(857);
29895
+ const { CGetRequest: n2, CStoreRequest: i2 } = s2(940), { CommandFieldType: r8, PresentationContextResult: a3, SopClass: o2, StorageClass: c2, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(492), m2 = s2(139), { EOL: g2 } = s2(857);
29896
29896
  class l3 {
29897
29897
  constructor(e3, t3, s3, n3) {
29898
29898
  this.pcId = e3, this.abstractSyntaxUid = t3, this.transferSyntaxes = [], s3 && this.transferSyntaxes.push(s3), this.result = n3 || a3.Proposed;
@@ -30087,7 +30087,7 @@ var require_dcmjs_dimse_min = __commonJS({
30087
30087
  this.presentationContexts.length = 0;
30088
30088
  }
30089
30089
  addPresentationContextFromRequest(e3, t3) {
30090
- let s3 = t3 || d4.ImplicitVRLittleEndian;
30090
+ let s3 = t3 || d3.ImplicitVRLittleEndian;
30091
30091
  s3 = Array.isArray(s3) ? s3 : [s3];
30092
30092
  const r9 = this._sopClassFromRequest(e3);
30093
30093
  let a4;
@@ -30098,7 +30098,7 @@ var require_dcmjs_dimse_min = __commonJS({
30098
30098
  this.addTransferSyntaxToPresentationContext(a4, e4);
30099
30099
  });
30100
30100
  const t4 = e3.getDataset().getTransferSyntaxUid();
30101
- t4 !== d4.ImplicitVRLittleEndian && t4 !== d4.ExplicitVRLittleEndian && (a4 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r9, t4), void 0 === a4 && (a4 = this.addPresentationContext(r9), this.addTransferSyntaxToPresentationContext(a4, t4)));
30101
+ t4 !== d3.ImplicitVRLittleEndian && t4 !== d3.ExplicitVRLittleEndian && (a4 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r9, t4), void 0 === a4 && (a4 = this.addPresentationContext(r9), this.addTransferSyntaxToPresentationContext(a4, t4)));
30102
30102
  } else e3 instanceof n2 ? (a4 = this.addOrGetPresentationContext(r9), s3.forEach((e4) => {
30103
30103
  this.addTransferSyntaxToPresentationContext(a4, e4);
30104
30104
  }), true === e3.getAddStorageSopClassesToAssociation() && Object.keys(c2).forEach((e4) => {
@@ -30127,7 +30127,7 @@ var require_dcmjs_dimse_min = __commonJS({
30127
30127
  return e3.push(`Application Context: ${this.getApplicationContextName()}`), e3.push(`Implementation Class: ${this.getImplementationClassUid()}`), e3.push(`Implementation Version: ${this.getImplementationVersion()}`), e3.push(`Maximum PDU Length: ${this.getMaxPduLength()}`), e3.push(`Called AE Title: ${this.getCalledAeTitle()}`), e3.push(`Calling AE Title: ${this.getCallingAeTitle()}`), this.getNegotiateAsyncOps() && e3.push(`Asynchronous Operations: Invoked: ${this.getMaxAsyncOpsInvoked()} Performed:${this.getMaxAsyncOpsPerformed()}`), this.getNegotiateUserIdentity() && e3.push(`User Identity: ${this._userIdentityTypeToString(this.getUserIdentityType()) || ""}`), e3.push(`Presentation Contexts: ${this.presentationContexts.length}`), this.presentationContexts.forEach((t3) => {
30128
30128
  const s3 = this.getPresentationContext(t3.id);
30129
30129
  e3.push(` Presentation Context: ${t3.id} [${s3.getResultDescription()}]`), e3.push(` Abstract: ${this._uidNameFromValue([o2, c2], s3.getAbstractSyntaxUid()) || s3.getAbstractSyntaxUid()}`), s3.getTransferSyntaxUids().forEach((t4) => {
30130
- e3.push(` Transfer: ${this._uidNameFromValue(d4, t4) || t4}`);
30130
+ e3.push(` Transfer: ${this._uidNameFromValue(d3, t4) || t4}`);
30131
30131
  });
30132
30132
  }), e3.push(""), e3.join(g2);
30133
30133
  }
@@ -30188,7 +30188,7 @@ var require_dcmjs_dimse_min = __commonJS({
30188
30188
  "use strict";
30189
30189
  e2.exports = o;
30190
30190
  }, 825: (e2, t2, s2) => {
30191
- const { StorageClass: n2, TransferSyntax: i2 } = s2(492), r8 = s2(139), { readFile: a3, readFileSync: o2, writeFile: c2, writeFileSync: d4 } = s2(896), { EOL: u2 } = s2(857), h3 = s2(111), { DicomDict: m2, DicomMessage: g2, DicomMetaDictionary: l3, ReadBufferStream: p, WriteBufferStream: R2 } = h3.data, S2 = h3.log;
30191
+ const { StorageClass: n2, TransferSyntax: i2 } = s2(492), r8 = s2(139), { readFile: a3, readFileSync: o2, writeFile: c2, writeFileSync: d3 } = s2(896), { EOL: u2 } = s2(857), h3 = s2(111), { DicomDict: m2, DicomMessage: g2, DicomMetaDictionary: l3, ReadBufferStream: p2, WriteBufferStream: R2 } = h3.data, S2 = h3.log;
30192
30192
  class y3 {
30193
30193
  constructor(e3, t3, s3) {
30194
30194
  s3 = s3 || {}, s3 = { ignoreErrors: true, ...s3 }, S2.level = "error", this.transferSyntaxUid = t3 || i2.ImplicitVRLittleEndian, Buffer.isBuffer(e3) ? this.elements = this._fromElementsBuffer(e3, this.transferSyntaxUid, s3) : this.elements = e3 || {};
@@ -30231,7 +30231,7 @@ var require_dcmjs_dimse_min = __commonJS({
30231
30231
  const a4 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y3.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r8.getImplementationClassUid(), ImplementationVersionName: r8.getImplementationVersion() }, ...this.getElements() }, o3 = l3.denaturalizeDataset(a4._meta), u3 = new m2(o3);
30232
30232
  u3.dict = s3 ? l3.denaturalizeDataset(a4, { ...l3.nameMap, ...s3 }) : l3.denaturalizeDataset(a4), t3 instanceof Function ? c2(e3, Buffer.from(u3.write(i3)), (e4) => {
30233
30233
  t3(e4 || void 0);
30234
- }) : d4(e3, Buffer.from(u3.write(i3)));
30234
+ }) : d3(e3, Buffer.from(u3.write(i3)));
30235
30235
  }
30236
30236
  static generateDerivedUid() {
30237
30237
  return l3.uid();
@@ -30246,7 +30246,7 @@ var require_dcmjs_dimse_min = __commonJS({
30246
30246
  return new y3(i3, n3);
30247
30247
  }
30248
30248
  _fromElementsBuffer(e3, t3, s3) {
30249
- const n3 = new p(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength)), r9 = t3 === i2.ImplicitVRLittleEndian ? i2.ImplicitVRLittleEndian : t3 === i2.ExplicitVRBigEndian ? i2.ExplicitVRBigEndian : i2.ExplicitVRLittleEndian, a4 = g2._read(n3, r9, s3);
30249
+ const n3 = new p2(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength)), r9 = t3 === i2.ImplicitVRLittleEndian ? i2.ImplicitVRLittleEndian : t3 === i2.ExplicitVRBigEndian ? i2.ExplicitVRBigEndian : i2.ExplicitVRLittleEndian, a4 = g2._read(n3, r9, s3);
30250
30250
  return l3.naturalizeDataset(a4);
30251
30251
  }
30252
30252
  }
@@ -30292,7 +30292,7 @@ var require_dcmjs_dimse_min = __commonJS({
30292
30292
  }
30293
30293
  };
30294
30294
  }, 940: (e2, t2, s2) => {
30295
- const { CommandFieldType: n2, Priority: i2, SopClass: r8, Status: a3 } = s2(492), o2 = s2(825), { Mixin: c2 } = s2(429), { EOL: d4 } = s2(857), u2 = s2(733), h3 = s2(111), { DicomMetaDictionary: m2 } = h3.data;
30295
+ const { CommandFieldType: n2, Priority: i2, SopClass: r8, Status: a3 } = s2(492), o2 = s2(825), { Mixin: c2 } = s2(429), { EOL: d3 } = s2(857), u2 = s2(733), h3 = s2(111), { DicomMetaDictionary: m2 } = h3.data;
30296
30296
  class g2 {
30297
30297
  constructor(e3, t3) {
30298
30298
  this.commandDataset = e3 || new o2(), this.dataset = t3;
@@ -30317,7 +30317,7 @@ var require_dcmjs_dimse_min = __commonJS({
30317
30317
  }
30318
30318
  toString(e3) {
30319
30319
  const t3 = e3 || {}, s3 = t3.includeCommandDataset || false, n3 = t3.includeDataset || false, i3 = [];
30320
- return i3.push(`${this._typeToString(this.getCommandFieldType())} [HasDataset: ${this.hasDataset()}]`), s3 && (i3.push("DIMSE Command Dataset:"), i3.push("=".repeat(50)), i3.push(JSON.stringify(this.commandDataset.getElements()))), n3 && this.dataset && (i3.push("DIMSE Dataset:"), i3.push("=".repeat(50)), i3.push(JSON.stringify(this.dataset.getElements()))), i3.join(d4);
30320
+ return i3.push(`${this._typeToString(this.getCommandFieldType())} [HasDataset: ${this.hasDataset()}]`), s3 && (i3.push("DIMSE Command Dataset:"), i3.push("=".repeat(50)), i3.push(JSON.stringify(this.commandDataset.getElements()))), n3 && this.dataset && (i3.push("DIMSE Dataset:"), i3.push("=".repeat(50)), i3.push(JSON.stringify(this.dataset.getElements()))), i3.join(d3);
30321
30321
  }
30322
30322
  _typeToString(e3) {
30323
30323
  switch (e3) {
@@ -30435,7 +30435,7 @@ var require_dcmjs_dimse_min = __commonJS({
30435
30435
  return `${super.toString(e3)} [id: ${this.getMessageId() || ""}]`;
30436
30436
  }
30437
30437
  }
30438
- class p extends g2 {
30438
+ class p2 extends g2 {
30439
30439
  constructor(e3, t3, s3, i3, r9) {
30440
30440
  switch (super(new o2({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257, Status: i3, ErrorComment: r9 })), e3) {
30441
30441
  case n2.NGetRequest:
@@ -30547,7 +30547,7 @@ var require_dcmjs_dimse_min = __commonJS({
30547
30547
  super(n2.CEchoRequest, r8.Verification, false);
30548
30548
  }
30549
30549
  }
30550
- class S2 extends p {
30550
+ class S2 extends p2 {
30551
30551
  constructor(e3, t3) {
30552
30552
  super(n2.CEchoResponse, r8.Verification, false, e3, t3);
30553
30553
  }
@@ -30592,7 +30592,7 @@ var require_dcmjs_dimse_min = __commonJS({
30592
30592
  return n3.setAffectedSopClassUid(r8.ModalityWorklistInformationModelFind), n3.setDataset(new o2(s3)), n3;
30593
30593
  }
30594
30594
  }
30595
- class f3 extends p {
30595
+ class f3 extends p2 {
30596
30596
  constructor(e3, t3) {
30597
30597
  super(n2.CFindResponse, r8.StudyRootQueryRetrieveInformationModelFind, false, e3, t3);
30598
30598
  }
@@ -30627,7 +30627,7 @@ var require_dcmjs_dimse_min = __commonJS({
30627
30627
  void 0 !== this.needsFullDatasetLoading && true === this.needsFullDatasetLoading && void 0 !== this.datasetOrFile && "" !== this.datasetOrFile.trim() && this.setDataset(o2.fromFile(this.datasetOrFile));
30628
30628
  }
30629
30629
  }
30630
- class C2 extends p {
30630
+ class C2 extends p2 {
30631
30631
  constructor(e3, t3) {
30632
30632
  super(n2.CStoreResponse, "", false, e3, t3);
30633
30633
  }
@@ -30660,7 +30660,7 @@ var require_dcmjs_dimse_min = __commonJS({
30660
30660
  return a4.setDataset(new o2(r9)), a4.getCommandDataset().setElement("MoveDestination", e3), a4;
30661
30661
  }
30662
30662
  }
30663
- class A2 extends p {
30663
+ class A2 extends p2 {
30664
30664
  constructor(e3, t3) {
30665
30665
  super(n2.CMoveResponse, r8.StudyRootQueryRetrieveInformationModelMove, false, e3, t3);
30666
30666
  }
@@ -30697,7 +30697,7 @@ var require_dcmjs_dimse_min = __commonJS({
30697
30697
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30698
30698
  }
30699
30699
  }
30700
- class v extends l3 {
30700
+ class v2 extends l3 {
30701
30701
  constructor(e3) {
30702
30702
  super(n2.CGetRequest, r8.StudyRootQueryRetrieveInformationModelGet, false), this.setPriority(e3 || i2.Medium), this.addStorageSopClassesToAssociation = true;
30703
30703
  }
@@ -30714,19 +30714,19 @@ var require_dcmjs_dimse_min = __commonJS({
30714
30714
  this.addStorageSopClassesToAssociation = e3;
30715
30715
  }
30716
30716
  static createStudyGetRequest(e3, t3) {
30717
- const s3 = { StudyInstanceUID: e3, QueryRetrieveLevel: "STUDY" }, n3 = new v(t3);
30717
+ const s3 = { StudyInstanceUID: e3, QueryRetrieveLevel: "STUDY" }, n3 = new v2(t3);
30718
30718
  return n3.setDataset(new o2(s3)), n3;
30719
30719
  }
30720
30720
  static createSeriesGetRequest(e3, t3, s3) {
30721
- const n3 = { StudyInstanceUID: e3, SeriesInstanceUID: t3, QueryRetrieveLevel: "SERIES" }, i3 = new v(s3);
30721
+ const n3 = { StudyInstanceUID: e3, SeriesInstanceUID: t3, QueryRetrieveLevel: "SERIES" }, i3 = new v2(s3);
30722
30722
  return i3.setDataset(new o2(n3)), i3;
30723
30723
  }
30724
30724
  static createImageGetRequest(e3, t3, s3, n3) {
30725
- const i3 = { StudyInstanceUID: e3, SeriesInstanceUID: t3, SOPInstanceUID: s3, QueryRetrieveLevel: "IMAGE" }, r9 = new v(n3);
30725
+ const i3 = { StudyInstanceUID: e3, SeriesInstanceUID: t3, SOPInstanceUID: s3, QueryRetrieveLevel: "IMAGE" }, r9 = new v2(n3);
30726
30726
  return r9.setDataset(new o2(i3)), r9;
30727
30727
  }
30728
30728
  }
30729
- class x2 extends p {
30729
+ class x2 extends p2 {
30730
30730
  constructor(e3, t3) {
30731
30731
  super(n2.CGetResponse, r8.StudyRootQueryRetrieveInformationModelGet, false, e3, t3);
30732
30732
  }
@@ -30758,7 +30758,7 @@ var require_dcmjs_dimse_min = __commonJS({
30758
30758
  return `${super.toString(e3)} [Remaining: ${this.getRemaining()}; Completed: ${this.getCompleted()} Warnings: ${this.getWarnings()}; Failures: ${this.getFailures()}]`;
30759
30759
  }
30760
30760
  static fromRequest(e3) {
30761
- if (!(e3 instanceof v)) throw new Error("Request should be an instance of CGetRequest");
30761
+ if (!(e3 instanceof v2)) throw new Error("Request should be an instance of CGetRequest");
30762
30762
  const t3 = new x2(a3.ProcessingFailure);
30763
30763
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30764
30764
  }
@@ -30768,7 +30768,7 @@ var require_dcmjs_dimse_min = __commonJS({
30768
30768
  super(n2.NCreateRequest, e3, false), this.setAffectedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30769
30769
  }
30770
30770
  }
30771
- class U extends p {
30771
+ class U extends p2 {
30772
30772
  constructor(e3, t3, s3, i3) {
30773
30773
  super(n2.NCreateResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
30774
30774
  }
@@ -30778,7 +30778,7 @@ var require_dcmjs_dimse_min = __commonJS({
30778
30778
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30779
30779
  }
30780
30780
  }
30781
- class q extends l3 {
30781
+ class q2 extends l3 {
30782
30782
  constructor(e3, t3, s3, i3) {
30783
30783
  super(n2.NActionRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setActionTypeId(s3), this.setMetaSopClassUid(i3);
30784
30784
  }
@@ -30789,7 +30789,7 @@ var require_dcmjs_dimse_min = __commonJS({
30789
30789
  this.getCommandDataset().setElement("ActionTypeID", e3);
30790
30790
  }
30791
30791
  }
30792
- class D2 extends p {
30792
+ class D2 extends p2 {
30793
30793
  constructor(e3, t3, s3, i3, r9) {
30794
30794
  super(n2.NActionResponse, e3, false, i3, r9), this.setAffectedSopInstanceUid(t3), this.setActionTypeId(s3);
30795
30795
  }
@@ -30800,7 +30800,7 @@ var require_dcmjs_dimse_min = __commonJS({
30800
30800
  this.getCommandDataset().setElement("ActionTypeID", e3);
30801
30801
  }
30802
30802
  static fromRequest(e3) {
30803
- if (!(e3 instanceof q)) throw new Error("Request should be an instance of NActionRequest");
30803
+ if (!(e3 instanceof q2)) throw new Error("Request should be an instance of NActionRequest");
30804
30804
  const t3 = new D2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), e3.getActionTypeId(), a3.ProcessingFailure);
30805
30805
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30806
30806
  }
@@ -30810,13 +30810,13 @@ var require_dcmjs_dimse_min = __commonJS({
30810
30810
  super(n2.NDeleteRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30811
30811
  }
30812
30812
  }
30813
- class T2 extends p {
30813
+ class T extends p2 {
30814
30814
  constructor(e3, t3, s3, i3) {
30815
30815
  super(n2.NDeleteResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
30816
30816
  }
30817
30817
  static fromRequest(e3) {
30818
30818
  if (!(e3 instanceof E2)) throw new Error("Request should be an instance of NDeleteRequest");
30819
- const t3 = new T2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), a3.ProcessingFailure);
30819
+ const t3 = new T(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), a3.ProcessingFailure);
30820
30820
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30821
30821
  }
30822
30822
  }
@@ -30831,7 +30831,7 @@ var require_dcmjs_dimse_min = __commonJS({
30831
30831
  this.getCommandDataset().setElement("EventTypeID", e3);
30832
30832
  }
30833
30833
  }
30834
- class O2 extends p {
30834
+ class O2 extends p2 {
30835
30835
  constructor(e3, t3, s3, i3, r9) {
30836
30836
  super(n2.NEventReportResponse, e3, false, i3, r9), this.setAffectedSopInstanceUid(t3), this.setEventTypeId(s3);
30837
30837
  }
@@ -30873,7 +30873,7 @@ var require_dcmjs_dimse_min = __commonJS({
30873
30873
  return "0".repeat(t3 - s3.length) + s3;
30874
30874
  }
30875
30875
  }
30876
- class M extends p {
30876
+ class M extends p2 {
30877
30877
  constructor(e3, t3, s3, i3) {
30878
30878
  super(n2.NGetResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
30879
30879
  }
@@ -30888,7 +30888,7 @@ var require_dcmjs_dimse_min = __commonJS({
30888
30888
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30889
30889
  }
30890
30890
  }
30891
- class L2 extends p {
30891
+ class L2 extends p2 {
30892
30892
  constructor(e3, t3, s3, i3) {
30893
30893
  super(n2.NSetResponse, e3, false, s3, i3), this.setAffectedSopInstanceUid(t3);
30894
30894
  }
@@ -30909,13 +30909,13 @@ var require_dcmjs_dimse_min = __commonJS({
30909
30909
  this.getCommandDataset().setElement("MessageIDBeingRespondedTo", e3);
30910
30910
  }
30911
30911
  static fromRequest(e3) {
30912
- if (!(e3 instanceof y3 || e3 instanceof P || e3 instanceof v)) throw new Error("Request should be an instance of CFindRequest, CMoveRequest or CGetRequest");
30912
+ if (!(e3 instanceof y3 || e3 instanceof P || e3 instanceof v2)) throw new Error("Request should be an instance of CFindRequest, CMoveRequest or CGetRequest");
30913
30913
  return new F2(e3.getAffectedSopClassUid(), e3.getMessageId());
30914
30914
  }
30915
30915
  }
30916
- e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: S2, CFindRequest: y3, CFindResponse: f3, CGetRequest: v, CGetResponse: x2, CMoveRequest: P, CMoveResponse: A2, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q, NActionResponse: D2, NCreateRequest: w2, NCreateResponse: U, NDeleteRequest: E2, NDeleteResponse: T2, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: M, NSetRequest: B2, NSetResponse: L2, Request: l3, Response: p };
30916
+ e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: S2, CFindRequest: y3, CFindResponse: f3, CGetRequest: v2, CGetResponse: x2, CMoveRequest: P, CMoveResponse: A2, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: w2, NCreateResponse: U, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: M, NSetRequest: B2, NSetResponse: L2, Request: l3, Response: p2 };
30917
30917
  }, 942: (e2, t2, s2) => {
30918
- const { AbortReason: n2, AbortSource: i2, RawPduType: r8, RejectReason: a3, RejectResult: o2, RejectSource: c2, TransferSyntax: d4 } = s2(492), { SmartBuffer: u2 } = s2(766), { EOL: h3 } = s2(857);
30918
+ const { AbortReason: n2, AbortSource: i2, RawPduType: r8, RejectReason: a3, RejectResult: o2, RejectSource: c2, TransferSyntax: d3 } = s2(492), { SmartBuffer: u2 } = s2(766), { EOL: h3 } = s2(857);
30919
30919
  class m2 {
30920
30920
  constructor(e3) {
30921
30921
  if (this.m16 = [], this.m32 = [], Buffer.isBuffer(e3)) return this.buffer = u2.fromBuffer(e3, "ascii"), void (this.type = this.buffer.readUInt8());
@@ -31101,7 +31101,7 @@ var require_dcmjs_dimse_min = __commonJS({
31101
31101
  const e3 = new m2(r8.AAssociateAC);
31102
31102
  return e3.writeUInt16("Version", 1), e3.writeByteMultiple("Reserved", 0, 2), e3.writeStringWithPadding("Called AE", this.association.getCalledAeTitle(), 16, " "), e3.writeStringWithPadding("Calling AE", this.association.getCallingAeTitle(), 16, " "), e3.writeByteMultiple("Reserved", 0, 32), e3.writeByte("Item-Type", 16), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Application Context Name", this.association.getApplicationContextName()), e3.writeLength16(), this.association.getPresentationContexts().forEach((t3) => {
31103
31103
  const s3 = this.association.getPresentationContext(t3.id);
31104
- e3.writeByte("Item-Type", 33), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeByte("Presentation Context ID", s3.getPresentationContextId()), e3.writeByte("Reserved", 0), e3.writeByte("Result", s3.getResult()), e3.writeByte("Reserved", 0), e3.writeByte("Item-Type", 64), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Transfer Syntax UID", s3.getAcceptedTransferSyntaxUid() || d4.ImplicitVRLittleEndian), e3.writeLength16(), e3.writeLength16();
31104
+ e3.writeByte("Item-Type", 33), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeByte("Presentation Context ID", s3.getPresentationContextId()), e3.writeByte("Reserved", 0), e3.writeByte("Result", s3.getResult()), e3.writeByte("Reserved", 0), e3.writeByte("Item-Type", 64), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Transfer Syntax UID", s3.getAcceptedTransferSyntaxUid() || d3.ImplicitVRLittleEndian), e3.writeLength16(), e3.writeLength16();
31105
31105
  }), e3.writeByte("Item-Type", 80), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeByte("Item-Type", 81), e3.writeByte("Reserved", 0), e3.writeUInt16("Item-Length", 4), e3.writeUInt32("Max PDU Length", this.association.getMaxPduLength()), e3.writeByte("Item-Type", 82), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Implementation Class UID", this.association.getImplementationClassUid()), e3.writeLength16(), !this.association.getNegotiateAsyncOps() || 1 === this.association.getMaxAsyncOpsInvoked() && 1 === this.association.getMaxAsyncOpsPerformed() || (e3.writeByte("Item-Type", 83), e3.writeByte("Reserved", 0), e3.writeUInt16("Item-Length", 4), e3.writeUInt16("Asynchronous Operations Invoked", this.association.getMaxAsyncOpsInvoked()), e3.writeUInt16("Asynchronous Operations Performed", this.association.getMaxAsyncOpsPerformed())), e3.writeByte("Item-Type", 85), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Implementation Version", this.association.getImplementationVersion()), e3.writeLength16(), this.association.getNegotiateUserIdentityServerResponse() && (e3.writeByte("Item-Type", 89), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.markLength16("Server Response-Length"), e3.writeString("Server Response", this.association.getUserIdentityServerResponse()), e3.writeLength16(), e3.writeLength16()), e3.writeLength16(), e3;
31106
31106
  }
31107
31107
  read(e3) {
@@ -31343,13 +31343,13 @@ var require_dcmjs_dimse_min = __commonJS({
31343
31343
  return `(P-DATA-TF) [PDV count: ${this.getPdvCount()}, PDV length: ${this.getLengthOfPdvs()}]`;
31344
31344
  }
31345
31345
  }, Pdv: g2, RawPdu: m2 };
31346
- } }, d3 = {}, function e2(t2) {
31347
- var s2 = d3[t2];
31346
+ } }, d2 = {}, function e2(t2) {
31347
+ var s2 = d2[t2];
31348
31348
  if (void 0 !== s2) return s2.exports;
31349
- var n2 = d3[t2] = { exports: {} };
31349
+ var n2 = d2[t2] = { exports: {} };
31350
31350
  return c[t2](n2, n2.exports, e2), n2.exports;
31351
31351
  }(237);
31352
- var c, d3;
31352
+ var c, d2;
31353
31353
  });
31354
31354
  }
31355
31355
  });
@@ -31453,7 +31453,7 @@ var tr = class {
31453
31453
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
31454
31454
  }
31455
31455
  };
31456
- var Re = class {
31456
+ var Ce = class {
31457
31457
  constructor(e = 10) {
31458
31458
  this.max = e, this.cache = /* @__PURE__ */ new Map();
31459
31459
  }
@@ -31483,64 +31483,64 @@ var ir = "not-modified";
31483
31483
  var sr = "not-found";
31484
31484
  var cr = "unauthorized";
31485
31485
  var ot = "accepted";
31486
- var xn = { resourceType: "OperationOutcome", id: sr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
31487
- var Ce = { resourceType: "OperationOutcome", id: cr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
- var Tn = { ...Ce, issue: [...Ce.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
- var ur = { ...Ce, issue: [...Ce.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
31490
- function S(r7, e) {
31486
+ var vn = { resourceType: "OperationOutcome", id: sr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
31487
+ var Pe = { resourceType: "OperationOutcome", id: cr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
+ var Tn = { ...Pe, issue: [...Pe.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
+ var ur = { ...Pe, issue: [...Pe.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
31490
+ function b(r7, e) {
31491
31491
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r7 }, ...e ? { expression: [e] } : void 0 }] };
31492
31492
  }
31493
31493
  function y(r7) {
31494
31494
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r7 } }] };
31495
31495
  }
31496
- function vn(r7) {
31496
+ function Sn(r7) {
31497
31497
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r7.toString() }] };
31498
31498
  }
31499
- function Pe(r7) {
31499
+ function we(r7) {
31500
31500
  return typeof r7 == "object" && r7 !== null && r7.resourceType === "OperationOutcome";
31501
31501
  }
31502
31502
  function lr(r7) {
31503
31503
  return r7.id === rr || r7.id === it || r7.id === ir || r7.id === ot;
31504
31504
  }
31505
- var d = class extends Error {
31505
+ var p = class extends Error {
31506
31506
  constructor(e, t) {
31507
- super(Sn(e)), this.outcome = e, this.cause = t;
31507
+ super(bn(e)), this.outcome = e, this.cause = t;
31508
31508
  }
31509
31509
  };
31510
31510
  function st(r7) {
31511
- return r7 instanceof d ? r7.outcome : Pe(r7) ? r7 : S(we(r7));
31511
+ return r7 instanceof p ? r7.outcome : we(r7) ? r7 : b(Ae(r7));
31512
31512
  }
31513
- function we(r7) {
31514
- return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : Pe(r7) ? Sn(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
31513
+ function Ae(r7) {
31514
+ return r7 ? typeof r7 == "string" ? r7 : r7 instanceof Error ? r7.message : we(r7) ? bn(r7) : typeof r7 == "object" && "code" in r7 && typeof r7.code == "string" ? r7.code : JSON.stringify(r7) : "Unknown error";
31515
31515
  }
31516
- function Sn(r7) {
31517
- let e = r7.issue?.map(no) ?? [];
31516
+ function bn(r7) {
31517
+ let e = r7.issue?.map(so) ?? [];
31518
31518
  return e.length > 0 ? e.join("; ") : "Unknown error";
31519
31519
  }
31520
- function no(r7) {
31520
+ function so(r7) {
31521
31521
  let e;
31522
31522
  return r7.details?.text ? r7.diagnostics ? e = `${r7.details.text} (${r7.diagnostics})` : e = r7.details.text : r7.diagnostics ? e = r7.diagnostics : e = "Unknown error", r7.expression?.length && (e += ` (${r7.expression.join(", ")})`), e;
31523
31523
  }
31524
- function oo(r7, e) {
31524
+ function co(r7, e) {
31525
31525
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
31526
31526
  return { path: r7, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
31527
31527
  }
31528
- function Rn(r7) {
31528
+ function Cn(r7) {
31529
31529
  let e = /* @__PURE__ */ Object.create(null);
31530
- for (let [t, n] of Object.entries(r7)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, oo(i, o)])), constraints: [], innerTypes: [] };
31530
+ for (let [t, n] of Object.entries(r7)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, co(i, o)])), constraints: [], innerTypes: [] };
31531
31531
  return e;
31532
31532
  }
31533
- var Cn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
31533
+ var Pn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
31534
31534
  function hr(r7) {
31535
- return new dr(r7).parse();
31535
+ return new pr(r7).parse();
31536
31536
  }
31537
- var fe = Rn(Cn);
31537
+ var fe = Cn(Pn);
31538
31538
  var mr = /* @__PURE__ */ Object.create(null);
31539
- var Pn = /* @__PURE__ */ Object.create(null);
31540
- var ao = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
31541
- function In(r7) {
31539
+ var wn = /* @__PURE__ */ Object.create(null);
31540
+ var lo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
31541
+ function kn(r7) {
31542
31542
  let e;
31543
- return e = Pn[r7], e || (e = Pn[r7] = /* @__PURE__ */ Object.create(null)), e;
31543
+ return e = wn[r7], e || (e = wn[r7] = /* @__PURE__ */ Object.create(null)), e;
31544
31544
  }
31545
31545
  function yr(r7) {
31546
31546
  let t = (Array.isArray(r7) ? r7 : r7.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
@@ -31550,28 +31550,28 @@ function yr(r7) {
31550
31550
  function gr(r7) {
31551
31551
  if (!r7?.name) throw new Error("Failed loading StructureDefinition from bundle");
31552
31552
  if (r7.resourceType !== "StructureDefinition") return;
31553
- let e = hr(r7), t = ao[r7.url], n, i;
31554
- t ? (n = fe, i = t) : r7.url === `http://hl7.org/fhir/StructureDefinition/${r7.type}` || r7.url === `https://medplum.com/fhir/StructureDefinition/${r7.type}` || r7.type?.startsWith("http://") || r7.type?.startsWith("https://") ? (n = fe, i = r7.type) : (n = In(r7.url), i = r7.type), n[i] = e;
31553
+ let e = hr(r7), t = lo[r7.url], n, i;
31554
+ t ? (n = fe, i = t) : r7.url === `http://hl7.org/fhir/StructureDefinition/${r7.type}` || r7.url === `https://medplum.com/fhir/StructureDefinition/${r7.type}` || r7.type?.startsWith("http://") || r7.type?.startsWith("https://") ? (n = fe, i = r7.type) : (n = kn(r7.url), i = r7.type), n[i] = e;
31555
31555
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
31556
31556
  mr[r7.url] = e;
31557
31557
  }
31558
- function Dn(r7) {
31558
+ function Vn(r7) {
31559
31559
  return !!fe[r7];
31560
31560
  }
31561
31561
  function Be(r7, e) {
31562
31562
  if (e) {
31563
- let t = In(e)[r7];
31563
+ let t = kn(e)[r7];
31564
31564
  if (t) return t;
31565
31565
  }
31566
31566
  return fe[r7];
31567
31567
  }
31568
- function Mn(r7) {
31568
+ function _n(r7) {
31569
31569
  return !!mr[r7];
31570
31570
  }
31571
- var dr = class {
31571
+ var pr = class {
31572
31572
  constructor(e) {
31573
31573
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
31574
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: po(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31574
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: mo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31575
31575
  }
31576
31576
  parse() {
31577
31577
  let e = this.next();
@@ -31579,7 +31579,7 @@ var dr = class {
31579
31579
  if (e.sliceName) this.parseSliceStart(e);
31580
31580
  else if (e.id?.includes(":")) {
31581
31581
  if (this.slicingContext?.current) {
31582
- let t = pr(e, this.slicingContext.path);
31582
+ let t = dr(e, this.slicingContext.path);
31583
31583
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
31584
31584
  }
31585
31585
  } else {
@@ -31588,13 +31588,13 @@ var dr = class {
31588
31588
  let n = this.backboneContext;
31589
31589
  for (; n; ) {
31590
31590
  if (e.path?.startsWith(n.path + ".")) {
31591
- n.type.elements[pr(e, n.path)] = t;
31591
+ n.type.elements[dr(e, n.path)] = t;
31592
31592
  break;
31593
31593
  }
31594
31594
  n = n.parent;
31595
31595
  }
31596
31596
  if (!n) {
31597
- let i = pr(e, this.root.path);
31597
+ let i = dr(e, this.root.path);
31598
31598
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
31599
31599
  }
31600
31600
  this.checkFieldExit(e);
@@ -31604,23 +31604,23 @@ var dr = class {
31604
31604
  return this.checkFieldExit(), this.innerTypes.length > 0 && (this.resourceSchema.innerTypes = this.innerTypes), this.resourceSchema;
31605
31605
  }
31606
31606
  checkFieldEnter(e, t) {
31607
- this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Ae(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31607
+ this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Oe(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31608
31608
  }
31609
31609
  enterInnerType(e) {
31610
- for (; this.backboneContext && !Ae(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31610
+ for (; this.backboneContext && !Oe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31611
31611
  let t = fr(e);
31612
- this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Ae(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31612
+ this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Oe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31613
31613
  }
31614
31614
  enterSlice(e, t) {
31615
- lo(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31615
+ ho(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31616
31616
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
31617
31617
  return { path: n.path, type: n.type };
31618
31618
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
31619
31619
  }
31620
31620
  checkFieldExit(e = void 0) {
31621
- if (this.backboneContext && !Ae(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31621
+ if (this.backboneContext && !Oe(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31622
31622
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31623
- while (this.backboneContext && !Ae(this.backboneContext.path, e?.path));
31623
+ while (this.backboneContext && !Oe(this.backboneContext.path, e?.path));
31624
31624
  else this.innerTypes.push(this.backboneContext.type), this.backboneContext = void 0;
31625
31625
  }
31626
31626
  next() {
@@ -31639,7 +31639,7 @@ var dr = class {
31639
31639
  }
31640
31640
  isInnerType(e) {
31641
31641
  let t = this.peek();
31642
- return !!(Ae(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31642
+ return !!(Oe(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31643
31643
  }
31644
31644
  parseSliceStart(e) {
31645
31645
  if (!this.slicingContext) throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
@@ -31652,45 +31652,45 @@ var dr = class {
31652
31652
  });
31653
31653
  }
31654
31654
  parseElementDefinition(e) {
31655
- let t = An(e.max), n = e.base?.max ? An(e.base.max) : t, i = { type: "ElementDefinition", value: e };
31656
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: On(C(i, "fixed[x]")), pattern: On(C(i, "pattern[x]")), binding: e.binding };
31655
+ let t = On(e.max), n = e.base?.max ? On(e.base.max) : t, i = { type: "ElementDefinition", value: e };
31656
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: In(C(i, "fixed[x]")), pattern: In(C(i, "pattern[x]")), binding: e.binding };
31657
31657
  }
31658
31658
  };
31659
- function An(r7) {
31659
+ function On(r7) {
31660
31660
  return r7 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r7, 10);
31661
31661
  }
31662
- function pr(r7, e = "") {
31663
- return uo(r7.path, e);
31662
+ function dr(r7, e = "") {
31663
+ return fo(r7.path, e);
31664
31664
  }
31665
- function uo(r7, e) {
31665
+ function fo(r7, e) {
31666
31666
  return r7 ? e && r7.startsWith(e) ? r7.substring(e.length + 1) : r7 : "";
31667
31667
  }
31668
- function Ae(r7, e) {
31668
+ function Oe(r7, e) {
31669
31669
  return !r7 || !e ? false : e.startsWith(r7 + ".") || e === r7;
31670
31670
  }
31671
- function On(r7) {
31672
- return Array.isArray(r7) && r7.length > 0 ? r7[0] : b(r7) ? void 0 : r7;
31671
+ function In(r7) {
31672
+ return Array.isArray(r7) && r7.length > 0 ? r7[0] : S(r7) ? void 0 : r7;
31673
31673
  }
31674
- function lo(r7) {
31674
+ function ho(r7) {
31675
31675
  let e = r7.slicing?.discriminator;
31676
31676
  return !!(r7.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
31677
31677
  }
31678
- function po(r7) {
31678
+ function mo(r7) {
31679
31679
  let e = r7.description;
31680
31680
  return e?.startsWith(`Base StructureDefinition for ${r7.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r7.name} Type: `.length)), e;
31681
31681
  }
31682
- var mo = new Re(1e3);
31682
+ var xo = new Ce(1e3);
31683
31683
  var ut = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\r\n\t\u0020-\uFFFF]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\r\n\t\u0020-\uFFFF]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
31684
31684
  function h(r7) {
31685
31685
  return [{ type: l.boolean, value: r7 }];
31686
31686
  }
31687
- function T(r7) {
31687
+ function v(r7) {
31688
31688
  return r7 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r7) ? { type: l.integer, value: r7 } : typeof r7 == "number" ? { type: l.decimal, value: r7 } : typeof r7 == "boolean" ? { type: l.boolean, value: r7 } : typeof r7 == "string" ? { type: l.string, value: r7 } : k(r7) ? { type: l.Quantity, value: r7 } : A(r7) ? { type: r7.resourceType, value: r7 } : Ar(r7) ? { type: l.CodeableConcept, value: r7 } : wr(r7) ? { type: l.Coding, value: r7 } : { type: l.BackboneElement, value: r7 };
31689
31689
  }
31690
31690
  function _(r7) {
31691
31691
  return r7.length === 0 ? false : !!r7[0].value;
31692
31692
  }
31693
- function $(r7, e) {
31693
+ function H(r7, e) {
31694
31694
  if (r7.length !== 0) {
31695
31695
  if (r7.length === 1 && (!e || r7[0].type === e)) return r7[0];
31696
31696
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r7)}`);
@@ -31699,35 +31699,35 @@ function $(r7, e) {
31699
31699
  function C(r7, e, t) {
31700
31700
  if (!r7.value) return;
31701
31701
  let n = ft(r7.type, e, t?.profileUrl);
31702
- return n ? bo(r7, e, n) : Eo(r7, e);
31702
+ return n ? Co(r7, e, n) : Po(r7, e);
31703
31703
  }
31704
- function bo(r7, e, t) {
31704
+ function Co(r7, e, t) {
31705
31705
  let n = r7.value, i = t.type;
31706
31706
  if (!i || i.length === 0) return;
31707
31707
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
31708
- for (let p of i) {
31709
- let m2 = u2.replace("[x]", I(p.code));
31708
+ for (let d2 of i) {
31709
+ let m2 = u2.replace("[x]", I(d2.code));
31710
31710
  if (o = n[m2], a2 = n["_" + m2], o !== void 0 || a2 !== void 0) {
31711
- s = p.code;
31711
+ s = d2.code;
31712
31712
  break;
31713
31713
  }
31714
31714
  }
31715
31715
  if (a2) if (Array.isArray(o)) {
31716
31716
  o = o.slice();
31717
- for (let p = 0; p < Math.max(o.length, a2.length); p++) o[p] = Wn(o[p], a2[p]);
31718
- } else o = Wn(o, a2);
31719
- if (!b(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((p) => Fn(p, s)) : Fn(o, s);
31717
+ for (let d2 = 0; d2 < Math.max(o.length, a2.length); d2++) o[d2] = qn(o[d2], a2[d2]);
31718
+ } else o = qn(o, a2);
31719
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d2) => Nn(d2, s)) : Nn(o, s);
31720
31720
  }
31721
- function Fn(r7, e) {
31721
+ function Nn(r7, e) {
31722
31722
  return e === "Resource" && A(r7) && (e = r7.resourceType), { type: e, value: r7 };
31723
31723
  }
31724
- function Eo(r7, e) {
31724
+ function Po(r7, e) {
31725
31725
  let t = r7.value;
31726
31726
  if (!t || typeof t != "object") return;
31727
31727
  let n;
31728
31728
  if (e in t) {
31729
31729
  let i = t[e];
31730
- Array.isArray(i) ? n = i.map(T) : n = T(i);
31730
+ Array.isArray(i) ? n = i.map(v) : n = v(i);
31731
31731
  } else {
31732
31732
  let i = e.endsWith("[x]") ? e.substring(0, e.length - 3) : e;
31733
31733
  for (let o of Object.values(l)) {
@@ -31740,8 +31740,8 @@ function Eo(r7, e) {
31740
31740
  }
31741
31741
  }
31742
31742
  if (Array.isArray(n)) {
31743
- if (n.length === 0 || b(n[0])) return;
31744
- } else if (b(n)) return;
31743
+ if (n.length === 0 || S(n[0])) return;
31744
+ } else if (S(n)) return;
31745
31745
  return n;
31746
31746
  }
31747
31747
  function lt(r7) {
@@ -31756,31 +31756,31 @@ function lt(r7) {
31756
31756
  }
31757
31757
  return e;
31758
31758
  }
31759
- function qn(r7) {
31759
+ function jn(r7) {
31760
31760
  return h(!_(r7));
31761
31761
  }
31762
- function jn(r7, e) {
31762
+ function $n(r7, e) {
31763
31763
  return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? h(false) : h(r7.every((t, n) => _(je(t, e[n]))));
31764
31764
  }
31765
- function $n(r7, e) {
31765
+ function Hn(r7, e) {
31766
31766
  return r7.length === 0 || e.length === 0 ? [] : r7.length !== e.length ? h(true) : h(r7.some((t, n) => !_(je(t, e[n]))));
31767
31767
  }
31768
31768
  function je(r7, e) {
31769
31769
  let t = r7.value?.valueOf(), n = e.value?.valueOf();
31770
- return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? h(Gn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Pr(r7, e) : t === n);
31770
+ return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? h(Qn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Pr(r7, e) : t === n);
31771
31771
  }
31772
31772
  function Cr(r7, e) {
31773
- return r7.length === 0 && e.length === 0 ? h(true) : r7.length !== e.length ? h(false) : (r7.sort(Nn), e.sort(Nn), h(r7.every((t, n) => _(Ro(t, e[n])))));
31773
+ return r7.length === 0 && e.length === 0 ? h(true) : r7.length !== e.length ? h(false) : (r7.sort(Un), e.sort(Un), h(r7.every((t, n) => _(wo(t, e[n])))));
31774
31774
  }
31775
- function Ro(r7, e) {
31775
+ function wo(r7, e) {
31776
31776
  let { type: t, value: n } = r7, { type: i, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
31777
- return typeof s == "number" && typeof a2 == "number" ? h(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? h(Gn(s, a2)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? Pr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
31777
+ return typeof s == "number" && typeof a2 == "number" ? h(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? h(Qn(s, a2)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? Pr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
31778
31778
  }
31779
- function Nn(r7, e) {
31779
+ function Un(r7, e) {
31780
31780
  let t = r7.value?.valueOf(), n = e.value?.valueOf();
31781
31781
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
31782
31782
  }
31783
- function pt(r7, e) {
31783
+ function dt(r7, e) {
31784
31784
  let { value: t } = r7;
31785
31785
  if (t == null) return false;
31786
31786
  let n = e;
@@ -31791,32 +31791,32 @@ function pt(r7, e) {
31791
31791
  case "Integer":
31792
31792
  return typeof t == "number";
31793
31793
  case "Date":
31794
- return Hn(t);
31794
+ return Gn(t);
31795
31795
  case "DateTime":
31796
- return Ie(t);
31796
+ return ke(t);
31797
31797
  case "Time":
31798
31798
  return typeof t == "string" && !!/^T\d/.exec(t);
31799
31799
  case "Period":
31800
- return dt(t);
31800
+ return pt(t);
31801
31801
  case "Quantity":
31802
31802
  return k(t);
31803
31803
  default:
31804
31804
  return r7.type === n || typeof t == "object" && t?.resourceType === n;
31805
31805
  }
31806
31806
  }
31807
- function Hn(r7) {
31807
+ function Gn(r7) {
31808
31808
  return typeof r7 == "string" && !!ut.date.exec(r7);
31809
31809
  }
31810
- function Ie(r7) {
31810
+ function ke(r7) {
31811
31811
  return typeof r7 == "string" && !!ut.dateTime.exec(r7);
31812
31812
  }
31813
- function dt(r7) {
31814
- return !!(r7 && typeof r7 == "object" && ("start" in r7 && Ie(r7.start) || "end" in r7 && Ie(r7.end)));
31813
+ function pt(r7) {
31814
+ return !!(r7 && typeof r7 == "object" && ("start" in r7 && ke(r7.start) || "end" in r7 && ke(r7.end)));
31815
31815
  }
31816
31816
  function k(r7) {
31817
31817
  return !!(r7 && typeof r7 == "object" && "value" in r7 && typeof r7.value == "number");
31818
31818
  }
31819
- function Gn(r7, e) {
31819
+ function Qn(r7, e) {
31820
31820
  return Math.abs(r7.value - e.value) < 0.01 && (r7.unit === e.unit || r7.code === e.code || r7.unit === e.code || r7.code === e.unit);
31821
31821
  }
31822
31822
  function Pr(r7, e) {
@@ -31824,49 +31824,49 @@ function Pr(r7, e) {
31824
31824
  if (t.length !== n.length) return false;
31825
31825
  for (let i of t) {
31826
31826
  let o = r7[i], s = e[i];
31827
- if (Bn(o) && Bn(s)) {
31827
+ if (Wn(o) && Wn(s)) {
31828
31828
  if (!Pr(o, s)) return false;
31829
31829
  } else if (o !== s) return false;
31830
31830
  }
31831
31831
  return true;
31832
31832
  }
31833
- function Bn(r7) {
31833
+ function Wn(r7) {
31834
31834
  return r7 !== null && typeof r7 == "object";
31835
31835
  }
31836
- function Wn(r7, e) {
31836
+ function qn(r7, e) {
31837
31837
  if (e) {
31838
31838
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
31839
- return Co(r7 ?? {}, e);
31839
+ return Ao(r7 ?? {}, e);
31840
31840
  }
31841
31841
  return r7;
31842
31842
  }
31843
- function Co(r7, e) {
31843
+ function Ao(r7, e) {
31844
31844
  return delete e.__proto__, delete e.constructor, Object.assign(r7, e);
31845
31845
  }
31846
31846
  function Ir(r7, e) {
31847
31847
  return A(r7, e) && "id" in r7 && typeof r7.id == "string";
31848
31848
  }
31849
- function ke(r7) {
31850
- let e = Y(r7) ?? "undefined/undefined", t = wo(r7);
31849
+ function he(r7) {
31850
+ let e = B(r7) ?? "undefined/undefined", t = Io(r7);
31851
31851
  return t === e ? { reference: e } : { reference: e, display: t };
31852
31852
  }
31853
- function Y(r7) {
31854
- if (K(r7)) return r7.reference;
31853
+ function B(r7) {
31854
+ if (Y(r7)) return r7.reference;
31855
31855
  if (Ir(r7)) return `${r7.resourceType}/${r7.id}`;
31856
31856
  }
31857
- function he(r7) {
31858
- if (r7) return K(r7) ? r7.reference.split("/")[1] : r7.id;
31857
+ function me(r7) {
31858
+ if (r7) return Y(r7) ? r7.reference.split("/")[1] : r7.id;
31859
31859
  }
31860
- function Po(r7) {
31860
+ function Oo(r7) {
31861
31861
  return r7.resourceType === "Patient" || r7.resourceType === "Practitioner" || r7.resourceType === "RelatedPerson";
31862
31862
  }
31863
- function wo(r7) {
31864
- if (Po(r7)) {
31865
- let e = Ao(r7);
31863
+ function Io(r7) {
31864
+ if (Oo(r7)) {
31865
+ let e = ko(r7);
31866
31866
  if (e) return e;
31867
31867
  }
31868
31868
  if (r7.resourceType === "Device") {
31869
- let e = Oo(r7);
31869
+ let e = Do(r7);
31870
31870
  if (e) return e;
31871
31871
  }
31872
31872
  if (r7.resourceType === "MedicationRequest" && r7.medicationCodeableConcept) return $e(r7.medicationCodeableConcept);
@@ -31876,15 +31876,15 @@ function wo(r7) {
31876
31876
  if ("code" in r7 && r7.code) {
31877
31877
  let e = r7.code;
31878
31878
  if (Array.isArray(e) && (e = e[0]), Ar(e)) return $e(e);
31879
- if (Fo(e)) return e.text;
31879
+ if (Bo(e)) return e.text;
31880
31880
  }
31881
- return Y(r7) ?? "";
31881
+ return B(r7) ?? "";
31882
31882
  }
31883
- function Ao(r7) {
31883
+ function ko(r7) {
31884
31884
  let e = r7.name;
31885
31885
  if (e && e.length > 0) return He(e[0]);
31886
31886
  }
31887
- function Oo(r7) {
31887
+ function Do(r7) {
31888
31888
  let e = r7.deviceName;
31889
31889
  if (e && e.length > 0) return e[0].name;
31890
31890
  }
@@ -31893,12 +31893,12 @@ function ht(r7, e) {
31893
31893
  t.setUTCHours(0, 0, 0, 0);
31894
31894
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
31895
31895
  n.setUTCHours(0, 0, 0, 0);
31896
- let i = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a2 = n.getUTCFullYear(), c = n.getUTCMonth(), u2 = n.getUTCDate(), p = a2 - i;
31897
- (c < o || c === o && u2 < s) && p--;
31896
+ let i = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a2 = n.getUTCFullYear(), c = n.getUTCMonth(), u2 = n.getUTCDate(), d2 = a2 - i;
31897
+ (c < o || c === o && u2 < s) && d2--;
31898
31898
  let m2 = a2 * 12 + c - (i * 12 + o);
31899
31899
  u2 < s && m2--;
31900
31900
  let x2 = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
31901
- return { years: p, months: m2, days: x2 };
31901
+ return { years: d2, months: m2, days: x2 };
31902
31902
  }
31903
31903
  function ne(r7, ...e) {
31904
31904
  let t = r7;
@@ -31910,9 +31910,9 @@ function mt(r7, e) {
31910
31910
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
31911
31911
  }
31912
31912
  function kr(r7) {
31913
- if (!(r7 == null || r7 === "")) return typeof r7 == "object" ? Array.isArray(r7) ? ko(r7) : Do(r7) : r7;
31913
+ if (!(r7 == null || r7 === "")) return typeof r7 == "object" ? Array.isArray(r7) ? Mo(r7) : _o(r7) : r7;
31914
31914
  }
31915
- function ko(r7) {
31915
+ function Mo(r7) {
31916
31916
  let e = r7.length;
31917
31917
  if (e === 0) return;
31918
31918
  let t, n = 0;
@@ -31922,7 +31922,7 @@ function ko(r7) {
31922
31922
  }
31923
31923
  if (n !== 0) return t ?? r7;
31924
31924
  }
31925
- function Do(r7) {
31925
+ function _o(r7) {
31926
31926
  let e, t = 0;
31927
31927
  for (let n in r7) {
31928
31928
  let i = r7[n], o = kr(i);
@@ -31930,7 +31930,7 @@ function Do(r7) {
31930
31930
  }
31931
31931
  if (t !== 0) return e ?? r7;
31932
31932
  }
31933
- function b(r7) {
31933
+ function S(r7) {
31934
31934
  if (r7 == null) return true;
31935
31935
  let e = typeof r7;
31936
31936
  return e === "string" || e === "object" ? !Z(r7) : false;
@@ -31941,14 +31941,14 @@ function Z(r7) {
31941
31941
  return e === "string" && r7 !== "" || e === "object" && ("length" in r7 && r7.length > 0 || Object.keys(r7).length > 0);
31942
31942
  }
31943
31943
  function ie(r7, e, t) {
31944
- return r7 === e || b(r7) && b(e) ? true : b(r7) || b(e) ? false : Array.isArray(r7) && Array.isArray(e) ? Vo(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : E(r7) && E(e) ? Mo(r7, e, t) : (E(r7) || E(e), false);
31944
+ return r7 === e || S(r7) && S(e) ? true : S(r7) || S(e) ? false : Array.isArray(r7) && Array.isArray(e) ? Fo(r7, e) : Array.isArray(r7) || Array.isArray(e) ? false : E(r7) && E(e) ? Lo(r7, e, t) : (E(r7) || E(e), false);
31945
31945
  }
31946
- function Vo(r7, e) {
31946
+ function Fo(r7, e) {
31947
31947
  if (r7.length !== e.length) return false;
31948
31948
  for (let t = 0; t < r7.length; t++) if (!ie(r7[t], e[t])) return false;
31949
31949
  return true;
31950
31950
  }
31951
- function Mo(r7, e, t) {
31951
+ function Lo(r7, e, t) {
31952
31952
  let n = /* @__PURE__ */ new Set();
31953
31953
  Object.keys(r7).forEach((i) => n.add(i)), Object.keys(e).forEach((i) => n.add(i)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
31954
31954
  for (let i of n) {
@@ -31960,7 +31960,7 @@ function Mo(r7, e, t) {
31960
31960
  function E(r7) {
31961
31961
  return r7 !== null && typeof r7 == "object";
31962
31962
  }
31963
- function Kn(r7) {
31963
+ function Yn(r7) {
31964
31964
  return r7.every(Dr);
31965
31965
  }
31966
31966
  function Dr(r7) {
@@ -31972,22 +31972,22 @@ function wr(r7) {
31972
31972
  function Ar(r7) {
31973
31973
  return E(r7) && "coding" in r7 && Array.isArray(r7.coding) && r7.coding.every(wr);
31974
31974
  }
31975
- function Fo(r7) {
31975
+ function Bo(r7) {
31976
31976
  return E(r7) && "text" in r7 && typeof r7.text == "string";
31977
31977
  }
31978
- var Yn = [];
31979
- for (let r7 = 0; r7 < 256; r7++) Yn.push(r7.toString(16).padStart(2, "0"));
31980
- function Zn(r7) {
31981
- let e = ei(r7), t = new Uint8Array(e), n = new Array(t.length);
31982
- for (let i = 0; i < t.length; i++) n[i] = Yn[t[i]];
31978
+ var Zn = [];
31979
+ for (let r7 = 0; r7 < 256; r7++) Zn.push(r7.toString(16).padStart(2, "0"));
31980
+ function Xn(r7) {
31981
+ let e = ti(r7), t = new Uint8Array(e), n = new Array(t.length);
31982
+ for (let i = 0; i < t.length; i++) n[i] = Zn[t[i]];
31983
31983
  return n.join("");
31984
31984
  }
31985
- function Xn(r7) {
31986
- let e = ei(r7), t = new Uint8Array(e), n = new Array(t.length);
31985
+ function ei(r7) {
31986
+ let e = ti(r7), t = new Uint8Array(e), n = new Array(t.length);
31987
31987
  for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
31988
31988
  return window.btoa(n.join(""));
31989
31989
  }
31990
- function ei(r7) {
31990
+ function ti(r7) {
31991
31991
  return ArrayBuffer.isView(r7) ? r7.buffer : r7;
31992
31992
  }
31993
31993
  function I(r7) {
@@ -31999,77 +31999,77 @@ var Mr = (r7) => new Promise((e) => {
31999
31999
  function yt(r7) {
32000
32000
  return r7.sort((e, t) => e.localeCompare(t));
32001
32001
  }
32002
- function Lr(r7) {
32002
+ function Fr(r7) {
32003
32003
  return r7.endsWith("/") ? r7 : r7 + "/";
32004
32004
  }
32005
- function $o(r7) {
32005
+ function Qo(r7) {
32006
32006
  return r7.startsWith("/") ? r7.slice(1) : r7;
32007
32007
  }
32008
- function B(r7, e) {
32009
- return new URL($o(e), Lr(r7.toString())).toString();
32008
+ function W(r7, e) {
32009
+ return new URL(Qo(e), Fr(r7.toString())).toString();
32010
32010
  }
32011
- function ii(r7, e) {
32012
- return B(r7, e).toString().replace("http://", "ws://").replace("https://", "wss://");
32011
+ function oi(r7, e) {
32012
+ return W(r7, e).toString().replace("http://", "ws://").replace("https://", "wss://");
32013
32013
  }
32014
- function oi(r7) {
32014
+ function si(r7) {
32015
32015
  return typeof r7 == "object" && !Array.isArray(r7) && !(r7 instanceof URLSearchParams) && (r7 = Object.fromEntries(Object.entries(r7).filter((e) => e[1] !== void 0))), new URLSearchParams(r7).toString();
32016
32016
  }
32017
- var Ho = /^(([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])$/;
32018
- function yl(r7) {
32019
- return Ho.test(r7);
32017
+ var zo = /^(([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])$/;
32018
+ function Sl(r7) {
32019
+ return zo.test(r7);
32020
32020
  }
32021
32021
  function He(r7, e) {
32022
32022
  if (!r7) return "";
32023
32023
  let t = [];
32024
32024
  if (r7.prefix && e?.prefix !== false && t.push(...r7.prefix), r7.given && t.push(...r7.given), r7.family && t.push(r7.family), r7.suffix && e?.suffix !== false && t.push(...r7.suffix), r7.use && (e?.all || e?.use) && t.push("[" + r7.use + "]"), t.length === 0) {
32025
- let n = ye(r7.text);
32025
+ let n = ge(r7.text);
32026
32026
  if (n) return n;
32027
32027
  }
32028
32028
  return t.join(" ").trim();
32029
32029
  }
32030
32030
  function $e(r7) {
32031
32031
  if (!r7) return "";
32032
- let e = ye(r7.text);
32033
- return e || (r7.coding ? r7.coding.map((t) => si(t)).join(", ") : "");
32032
+ let e = ge(r7.text);
32033
+ return e || (r7.coding ? r7.coding.map((t) => ai(t)).join(", ") : "");
32034
32034
  }
32035
- function si(r7, e) {
32036
- let t = ye(r7?.display);
32035
+ function ai(r7, e) {
32036
+ let t = ge(r7?.display);
32037
32037
  if (t) {
32038
- let n = e ? ye(r7?.code) : void 0;
32038
+ let n = e ? ge(r7?.code) : void 0;
32039
32039
  return `${t}${n ? " (" + n + ")" : ""}`;
32040
32040
  }
32041
- return ye(r7?.code) ?? "";
32041
+ return ge(r7?.code) ?? "";
32042
32042
  }
32043
- function ye(r7) {
32043
+ function ge(r7) {
32044
32044
  return typeof r7 == "string" ? r7 : void 0;
32045
32045
  }
32046
32046
  var l = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
32047
32047
  function Ln(r7) {
32048
32048
  let e = Array.isArray(r7) ? r7 : r7.entry?.map((t) => t.resource) ?? [];
32049
- for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ui(t.type);
32049
+ for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && li(t.type);
32050
32050
  }
32051
- function ui(r7) {
32052
- let e = L.types[r7];
32053
- return e || (e = { searchParamsDetails: {} }, L.types[r7] = e), e.searchParams || (e.searchParams = { _id: { base: [r7], code: "_id", type: "token", expression: r7 + ".id" }, _lastUpdated: { base: [r7], code: "_lastUpdated", type: "date", expression: r7 + ".meta.lastUpdated" }, _compartment: { base: [r7], code: "_compartment", type: "reference", expression: r7 + ".meta.compartment" }, _profile: { base: [r7], code: "_profile", type: "uri", expression: r7 + ".meta.profile" }, _security: { base: [r7], code: "_security", type: "token", expression: r7 + ".meta.security" }, _source: { base: [r7], code: "_source", type: "uri", expression: r7 + ".meta.source" }, _tag: { base: [r7], code: "_tag", type: "token", expression: r7 + ".meta.tag" } }), e;
32051
+ function li(r7) {
32052
+ let e = F.types[r7];
32053
+ return e || (e = { searchParamsDetails: {} }, F.types[r7] = e), e.searchParams || (e.searchParams = { _id: { base: [r7], code: "_id", type: "token", expression: r7 + ".id" }, _lastUpdated: { base: [r7], code: "_lastUpdated", type: "date", expression: r7 + ".meta.lastUpdated" }, _compartment: { base: [r7], code: "_compartment", type: "reference", expression: r7 + ".meta.compartment" }, _profile: { base: [r7], code: "_profile", type: "uri", expression: r7 + ".meta.profile" }, _security: { base: [r7], code: "_security", type: "token", expression: r7 + ".meta.security" }, _source: { base: [r7], code: "_source", type: "uri", expression: r7 + ".meta.source" }, _tag: { base: [r7], code: "_tag", type: "token", expression: r7 + ".meta.tag" } }), e;
32054
32054
  }
32055
32055
  function Ur(r7) {
32056
32056
  for (let e of r7.base ?? []) {
32057
- let t = ui(e);
32057
+ let t = li(e);
32058
32058
  t.searchParams || (t.searchParams = {}), t.searchParams[r7.code] = r7;
32059
32059
  }
32060
32060
  }
32061
32061
  function fr(r7) {
32062
32062
  let e = r7.type?.[0]?.code;
32063
- return e === "BackboneElement" || e === "Element" ? rs((r7.base?.path ?? r7.path)?.split(".")) : e;
32063
+ return e === "BackboneElement" || e === "Element" ? os((r7.base?.path ?? r7.path)?.split(".")) : e;
32064
32064
  }
32065
- function rs(r7) {
32065
+ function os(r7) {
32066
32066
  return r7.length === 1 ? r7[0] : r7.map(I).join("");
32067
32067
  }
32068
32068
  function ft(r7, e, t) {
32069
32069
  let n = Be(r7, t);
32070
- if (n) return ss(n.elements, e);
32070
+ if (n) return us(n.elements, e);
32071
32071
  }
32072
- function ss(r7, e) {
32072
+ function us(r7, e) {
32073
32073
  let t = r7[e] ?? r7[e + "[x]"];
32074
32074
  if (t) return t;
32075
32075
  for (let n = 0; n < e.length; n++) {
@@ -32083,10 +32083,10 @@ function ss(r7, e) {
32083
32083
  function A(r7, e) {
32084
32084
  return !(!r7 || typeof r7 != "object" || !("resourceType" in r7) || e && r7.resourceType !== e);
32085
32085
  }
32086
- function K(r7) {
32086
+ function Y(r7) {
32087
32087
  return !!(r7 && typeof r7 == "object" && "reference" in r7 && typeof r7.reference == "string");
32088
32088
  }
32089
- var L = { types: {} };
32089
+ var F = { types: {} };
32090
32090
  function Ve(r7) {
32091
32091
  if (r7.startsWith("T")) return r7 + "T00:00:00.000Z".substring(r7.length);
32092
32092
  if (r7.length <= 10) return r7;
@@ -32097,7 +32097,7 @@ function Ve(r7) {
32097
32097
  }
32098
32098
  }
32099
32099
  var X = () => [];
32100
- var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), hasValue: (r7, e) => h(e.length !== 0), exists: (r7, e, t) => t ? h(e.filter((n) => _(t.eval(r7, [n]))).length > 0) : h(e.length > 0 && e.every((n) => !b(n.value))), all: (r7, e, t) => h(e.every((n) => _(t.eval(r7, [n])))), allTrue: (r7, e) => {
32100
+ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r7, e) => h(e.length !== 0), exists: (r7, e, t) => t ? h(e.filter((n) => _(t.eval(r7, [n]))).length > 0) : h(e.length > 0 && e.every((n) => !S(n.value))), all: (r7, e, t) => h(e.every((n) => _(t.eval(r7, [n])))), allTrue: (r7, e) => {
32101
32101
  for (let t of e) if (!t.value) return h(false);
32102
32102
  return h(true);
32103
32103
  }, anyTrue: (r7, e) => {
@@ -32111,10 +32111,10 @@ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), has
32111
32111
  return h(false);
32112
32112
  }, subsetOf: (r7, e, t) => {
32113
32113
  if (e.length === 0) return h(true);
32114
- let n = t.eval(r7, ge(r7));
32114
+ let n = t.eval(r7, xe(r7));
32115
32115
  return n.length === 0 ? h(false) : h(e.every((i) => n.some((o) => o.value === i.value)));
32116
32116
  }, supersetOf: (r7, e, t) => {
32117
- let n = t.eval(r7, ge(r7));
32117
+ let n = t.eval(r7, xe(r7));
32118
32118
  return n.length === 0 ? h(true) : e.length === 0 ? h(false) : h(n.every((i) => e.some((o) => o.value === i.value)));
32119
32119
  }, count: (r7, e) => [{ type: l.integer, value: e.length }], distinct: (r7, e) => {
32120
32120
  let t = [];
@@ -32133,29 +32133,29 @@ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), has
32133
32133
  return n >= e.length ? e : n <= 0 ? [] : e.slice(0, n);
32134
32134
  }, intersect: (r7, e, t) => {
32135
32135
  if (!t) return e;
32136
- let n = t.eval(r7, ge(r7)), i = [];
32136
+ let n = t.eval(r7, xe(r7)), i = [];
32137
32137
  for (let o of e) !i.some((s) => s.value === o.value) && n.some((s) => s.value === o.value) && i.push(o);
32138
32138
  return i;
32139
32139
  }, exclude: (r7, e, t) => {
32140
32140
  if (!t) return e;
32141
- let n = t.eval(r7, ge(r7)), i = [];
32141
+ let n = t.eval(r7, xe(r7)), i = [];
32142
32142
  for (let o of e) n.some((s) => s.value === o.value) || i.push(o);
32143
32143
  return i;
32144
32144
  }, union: (r7, e, t) => {
32145
32145
  if (!t) return e;
32146
- let n = t.eval(r7, ge(r7));
32146
+ let n = t.eval(r7, xe(r7));
32147
32147
  return lt([...e, ...n]);
32148
32148
  }, combine: (r7, e, t) => {
32149
32149
  if (!t) return e;
32150
- let n = t.eval(r7, ge(r7));
32150
+ let n = t.eval(r7, xe(r7));
32151
32151
  return [...e, ...n];
32152
- }, htmlChecks: (r7, e, t) => [T(true)], iif: (r7, e, t, n, i) => {
32152
+ }, htmlChecks: (r7, e, t) => [v(true)], iif: (r7, e, t, n, i) => {
32153
32153
  let o = t.eval(r7, e);
32154
32154
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean") throw new Error("Expected criterion to evaluate to a Boolean");
32155
32155
  return _(o) ? n.eval(r7, e) : i ? i.eval(r7, e) : [];
32156
32156
  }, toBoolean: (r7, e) => {
32157
32157
  if (e.length === 0) return [];
32158
- let [{ value: t }] = Q(e, 1);
32158
+ let [{ value: t }] = z(e, 1);
32159
32159
  if (typeof t == "boolean") return [{ type: l.boolean, value: t }];
32160
32160
  if (typeof t == "number" && (t === 0 || t === 1)) return h(!!t);
32161
32161
  if (typeof t == "string") {
@@ -32166,44 +32166,44 @@ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), has
32166
32166
  return [];
32167
32167
  }, convertsToBoolean: (r7, e) => e.length === 0 ? [] : h(O.toBoolean(r7, e).length === 1), toInteger: (r7, e) => {
32168
32168
  if (e.length === 0) return [];
32169
- let [{ value: t }] = Q(e, 1);
32169
+ let [{ value: t }] = z(e, 1);
32170
32170
  return typeof t == "number" ? [{ type: l.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: l.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: l.integer, value: t ? 1 : 0 }] : [];
32171
32171
  }, convertsToInteger: (r7, e) => e.length === 0 ? [] : h(O.toInteger(r7, e).length === 1), toDate: (r7, e) => {
32172
32172
  if (e.length === 0) return [];
32173
- let [{ value: t }] = Q(e, 1);
32173
+ let [{ value: t }] = z(e, 1);
32174
32174
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Ve(t) }] : [];
32175
32175
  }, convertsToDate: (r7, e) => e.length === 0 ? [] : h(O.toDate(r7, e).length === 1), toDateTime: (r7, e) => {
32176
32176
  if (e.length === 0) return [];
32177
- let [{ value: t }] = Q(e, 1);
32177
+ let [{ value: t }] = z(e, 1);
32178
32178
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Ve(t) }] : [];
32179
32179
  }, convertsToDateTime: (r7, e) => e.length === 0 ? [] : h(O.toDateTime(r7, e).length === 1), toDecimal: (r7, e) => {
32180
32180
  if (e.length === 0) return [];
32181
- let [{ value: t }] = Q(e, 1);
32181
+ let [{ value: t }] = z(e, 1);
32182
32182
  return typeof t == "number" ? [{ type: l.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: l.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: l.decimal, value: t ? 1 : 0 }] : [];
32183
32183
  }, convertsToDecimal: (r7, e) => e.length === 0 ? [] : h(O.toDecimal(r7, e).length === 1), toQuantity: (r7, e) => {
32184
32184
  if (e.length === 0) return [];
32185
- let [{ value: t }] = Q(e, 1);
32185
+ let [{ value: t }] = z(e, 1);
32186
32186
  return k(t) ? [{ type: l.Quantity, value: t }] : typeof t == "number" ? [{ type: l.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: l.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: l.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
32187
32187
  }, convertsToQuantity: (r7, e) => e.length === 0 ? [] : h(O.toQuantity(r7, e).length === 1), toString: (r7, e) => {
32188
32188
  if (e.length === 0) return [];
32189
- let [{ value: t }] = Q(e, 1);
32189
+ let [{ value: t }] = z(e, 1);
32190
32190
  return t == null ? [] : k(t) ? [{ type: l.string, value: `${t.value} '${t.unit}'` }] : [{ type: l.string, value: t.toString() }];
32191
32191
  }, convertsToString: (r7, e) => e.length === 0 ? [] : h(O.toString(r7, e).length === 1), toTime: (r7, e) => {
32192
32192
  if (e.length === 0) return [];
32193
- let [{ value: t }] = Q(e, 1);
32193
+ let [{ value: t }] = z(e, 1);
32194
32194
  if (typeof t == "string") {
32195
32195
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
32196
32196
  if (n) return [{ type: l.time, value: Ve("T" + n[1]) }];
32197
32197
  }
32198
32198
  return [];
32199
- }, convertsToTime: (r7, e) => e.length === 0 ? [] : h(O.toTime(r7, e).length === 1), indexOf: (r7, e, t) => F((n, i) => n.indexOf(i), r7, e, t), substring: (r7, e, t, n) => F((i, o, s) => {
32199
+ }, convertsToTime: (r7, e) => e.length === 0 ? [] : h(O.toTime(r7, e).length === 1), indexOf: (r7, e, t) => L((n, i) => n.indexOf(i), r7, e, t), substring: (r7, e, t, n) => L((i, o, s) => {
32200
32200
  let a2 = o, c = s ? a2 + s : i.length;
32201
32201
  return a2 < 0 || a2 >= i.length ? void 0 : i.substring(a2, c);
32202
- }, r7, e, t, n), startsWith: (r7, e, t) => F((n, i) => n.startsWith(i), r7, e, t), endsWith: (r7, e, t) => F((n, i) => n.endsWith(i), r7, e, t), contains: (r7, e, t) => F((n, i) => n.includes(i), r7, e, t), upper: (r7, e) => F((t) => t.toUpperCase(), r7, e), lower: (r7, e) => F((t) => t.toLowerCase(), r7, e), replace: (r7, e, t, n) => F((i, o, s) => i.replaceAll(o, s), r7, e, t, n), matches: (r7, e, t) => F((n, i) => !!new RegExp(i).exec(n), r7, e, t), replaceMatches: (r7, e, t, n) => F((i, o, s) => i.replaceAll(o, s), r7, e, t, n), length: (r7, e) => F((t) => t.length, r7, e), toChars: (r7, e) => F((t) => t ? t.split("") : void 0, r7, e), encode: X, decode: X, escape: X, unescape: X, trim: X, split: X, join: (r7, e, t) => {
32203
- let n = t?.eval(r7, ge(r7))[0]?.value ?? "";
32202
+ }, r7, e, t, n), startsWith: (r7, e, t) => L((n, i) => n.startsWith(i), r7, e, t), endsWith: (r7, e, t) => L((n, i) => n.endsWith(i), r7, e, t), contains: (r7, e, t) => L((n, i) => n.includes(i), r7, e, t), upper: (r7, e) => L((t) => t.toUpperCase(), r7, e), lower: (r7, e) => L((t) => t.toLowerCase(), r7, e), replace: (r7, e, t, n) => L((i, o, s) => i.replaceAll(o, s), r7, e, t, n), matches: (r7, e, t) => L((n, i) => !!new RegExp(i).exec(n), r7, e, t), replaceMatches: (r7, e, t, n) => L((i, o, s) => i.replaceAll(o, s), r7, e, t, n), length: (r7, e) => L((t) => t.length, r7, e), toChars: (r7, e) => L((t) => t ? t.split("") : void 0, r7, e), encode: X, decode: X, escape: X, unescape: X, trim: X, split: X, join: (r7, e, t) => {
32203
+ let n = t?.eval(r7, xe(r7))[0]?.value ?? "";
32204
32204
  if (typeof n != "string") throw new Error("Separator must be a string.");
32205
32205
  return [{ type: l.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
32206
- }, abs: (r7, e) => G(Math.abs, r7, e), ceiling: (r7, e) => G(Math.ceil, r7, e), exp: (r7, e) => G(Math.exp, r7, e), floor: (r7, e) => G(Math.floor, r7, e), ln: (r7, e) => G(Math.log, r7, e), log: (r7, e, t) => G((n, i) => Math.log(n) / Math.log(i), r7, e, t), power: (r7, e, t) => G(Math.pow, r7, e, t), round: (r7, e) => G(Math.round, r7, e), sqrt: (r7, e) => G(Math.sqrt, r7, e), truncate: (r7, e) => G((t) => t | 0, r7, e), children: X, descendants: X, trace: (r7, e, t) => e, now: () => [{ type: l.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: l.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: l.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r7, e, t, n, i) => {
32206
+ }, abs: (r7, e) => Q(Math.abs, r7, e), ceiling: (r7, e) => Q(Math.ceil, r7, e), exp: (r7, e) => Q(Math.exp, r7, e), floor: (r7, e) => Q(Math.floor, r7, e), ln: (r7, e) => Q(Math.log, r7, e), log: (r7, e, t) => Q((n, i) => Math.log(n) / Math.log(i), r7, e, t), power: (r7, e, t) => Q(Math.pow, r7, e, t), round: (r7, e) => Q(Math.round, r7, e), sqrt: (r7, e) => Q(Math.sqrt, r7, e), truncate: (r7, e) => Q((t) => t | 0, r7, e), children: X, descendants: X, trace: (r7, e, t) => e, now: () => [{ type: l.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: l.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: l.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r7, e, t, n, i) => {
32207
32207
  let o = O.toDateTime(r7, t.eval(r7, e));
32208
32208
  if (o.length === 0) throw new Error("Invalid start date");
32209
32209
  let s = O.toDateTime(r7, n.eval(r7, e));
@@ -32214,13 +32214,13 @@ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), has
32214
32214
  return [{ type: l.Quantity, value: { value: c[a2], unit: a2 } }];
32215
32215
  }, is: (r7, e, t) => {
32216
32216
  let n = "";
32217
- return t instanceof W ? n = t.name : t instanceof ae && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: pt(i, n) })) : [];
32217
+ return t instanceof q ? n = t.name : t instanceof ae && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: dt(i, n) })) : [];
32218
32218
  }, not: (r7, e) => O.toBoolean(r7, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r7, e) => e.map((t) => {
32219
32219
  let n = t.value, i;
32220
32220
  if (typeof n == "string") i = n;
32221
32221
  else if (typeof n == "object") {
32222
32222
  let o = n;
32223
- if (o.resource) return T(o.resource);
32223
+ if (o.resource) return v(o.resource);
32224
32224
  o.reference ? i = o.reference : o.type && o.identifier && (i = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
32225
32225
  }
32226
32226
  if (i?.includes("?")) {
@@ -32244,7 +32244,7 @@ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), has
32244
32244
  let n = e[0].value;
32245
32245
  if (!n?.reference) return [];
32246
32246
  let i = "";
32247
- return t instanceof W && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: he(n) }];
32247
+ return t instanceof q && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: me(n) }];
32248
32248
  }, extension: (r7, e, t) => {
32249
32249
  let n = t.eval(r7, e)[0].value, i = e?.[0]?.value;
32250
32250
  if (i) {
@@ -32253,26 +32253,26 @@ var O = { empty: (r7, e) => h(e.length === 0 || e.every((t) => b(t.value))), has
32253
32253
  }
32254
32254
  return [];
32255
32255
  } };
32256
- function F(r7, e, t, ...n) {
32256
+ function L(r7, e, t, ...n) {
32257
32257
  if (t.length === 0) return [];
32258
- let [{ value: i }] = Q(t, 1);
32258
+ let [{ value: i }] = z(t, 1);
32259
32259
  if (typeof i != "string") throw new Error("String function cannot be called with non-string");
32260
32260
  let o = r7(i, ...n.map((s) => s?.eval(e, t)[0]?.value));
32261
- return o === void 0 ? [] : Array.isArray(o) ? o.map(T) : [T(o)];
32261
+ return o === void 0 ? [] : Array.isArray(o) ? o.map(v) : [v(o)];
32262
32262
  }
32263
- function G(r7, e, t, ...n) {
32263
+ function Q(r7, e, t, ...n) {
32264
32264
  if (t.length === 0) return [];
32265
- let [{ value: i }] = Q(t, 1), o = k(i), s = o ? i.value : i;
32265
+ let [{ value: i }] = z(t, 1), o = k(i), s = o ? i.value : i;
32266
32266
  if (typeof s != "number") throw new Error("Math function cannot be called with non-number");
32267
- let a2 = r7(s, ...n.map((p) => p.eval(e, t)[0]?.value)), c = o ? l.Quantity : t[0].type, u2 = o ? { ...i, value: a2 } : a2;
32267
+ let a2 = r7(s, ...n.map((d2) => d2.eval(e, t)[0]?.value)), c = o ? l.Quantity : t[0].type, u2 = o ? { ...i, value: a2 } : a2;
32268
32268
  return [{ type: c, value: u2 }];
32269
32269
  }
32270
- function Q(r7, e) {
32270
+ function z(r7, e) {
32271
32271
  if (r7.length !== e) throw new Error(`Expected ${e} arguments`);
32272
32272
  for (let t of r7) if (t == null) throw new Error("Expected non-null argument");
32273
32273
  return r7;
32274
32274
  }
32275
- function ge(r7) {
32275
+ function xe(r7) {
32276
32276
  let e = r7;
32277
32277
  for (; e.parent?.variables.$this; ) e = e.parent;
32278
32278
  return [e.variables.$this];
@@ -32289,7 +32289,7 @@ var N = class {
32289
32289
  return typeof e == "string" ? `'${e}'` : e.toString();
32290
32290
  }
32291
32291
  };
32292
- var W = class {
32292
+ var q = class {
32293
32293
  constructor(e) {
32294
32294
  this.name = e;
32295
32295
  }
@@ -32352,10 +32352,10 @@ var D = class extends R {
32352
32352
  let i = this.right.eval(e, t);
32353
32353
  if (i.length !== 1) return [];
32354
32354
  let o = n[0].value, s = i[0].value, a2 = k(o) ? o.value : o, c = k(s) ? s.value : s, u2 = this.impl(a2, c);
32355
- return typeof u2 == "boolean" ? h(u2) : k(o) ? [{ type: l.Quantity, value: { ...o, value: u2 } }] : [T(u2)];
32355
+ return typeof u2 == "boolean" ? h(u2) : k(o) ? [{ type: l.Quantity, value: { ...o, value: u2 } }] : [v(u2)];
32356
32356
  }
32357
32357
  };
32358
- var Tt = class extends te {
32358
+ var vt = class extends te {
32359
32359
  constructor(e, t) {
32360
32360
  super("&", e, t);
32361
32361
  }
@@ -32364,7 +32364,7 @@ var Tt = class extends te {
32364
32364
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: l.string, value: o.map((s) => s.value).join("") }] : o;
32365
32365
  }
32366
32366
  };
32367
- var vt = class extends R {
32367
+ var Tt = class extends R {
32368
32368
  constructor(e, t) {
32369
32369
  super("contains", e, t);
32370
32370
  }
@@ -32378,7 +32378,7 @@ var St = class extends R {
32378
32378
  super("in", e, t);
32379
32379
  }
32380
32380
  eval(e, t) {
32381
- let n = $(this.left.eval(e, t)), i = this.right.eval(e, t);
32381
+ let n = H(this.left.eval(e, t)), i = this.right.eval(e, t);
32382
32382
  return n ? h(i.some((o) => je(n, o)[0].value)) : [];
32383
32383
  }
32384
32384
  };
@@ -32393,7 +32393,7 @@ var ae = class extends te {
32393
32393
  return `${this.left.toString()}.${this.right.toString()}`;
32394
32394
  }
32395
32395
  };
32396
- var xe = class extends te {
32396
+ var ve = class extends te {
32397
32397
  constructor(e, t) {
32398
32398
  super("|", e, t);
32399
32399
  }
@@ -32408,7 +32408,7 @@ var bt = class extends R {
32408
32408
  }
32409
32409
  eval(e, t) {
32410
32410
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
32411
- return jn(n, i);
32411
+ return $n(n, i);
32412
32412
  }
32413
32413
  };
32414
32414
  var Et = class extends R {
@@ -32417,7 +32417,7 @@ var Et = class extends R {
32417
32417
  }
32418
32418
  eval(e, t) {
32419
32419
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
32420
- return $n(n, i);
32420
+ return Hn(n, i);
32421
32421
  }
32422
32422
  };
32423
32423
  var Rt = class extends R {
@@ -32435,7 +32435,7 @@ var Ct = class extends R {
32435
32435
  }
32436
32436
  eval(e, t) {
32437
32437
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
32438
- return qn(Cr(n, i));
32438
+ return jn(Cr(n, i));
32439
32439
  }
32440
32440
  };
32441
32441
  var Te = class extends R {
@@ -32446,7 +32446,7 @@ var Te = class extends R {
32446
32446
  let n = this.left.eval(e, t);
32447
32447
  if (n.length !== 1) return [];
32448
32448
  let i = this.right.name;
32449
- return h(pt(n[0], i));
32449
+ return h(dt(n[0], i));
32450
32450
  }
32451
32451
  };
32452
32452
  var Pt = class extends R {
@@ -32454,7 +32454,7 @@ var Pt = class extends R {
32454
32454
  super("and", e, t);
32455
32455
  }
32456
32456
  eval(e, t) {
32457
- let n = $(this.left.eval(e, t), "boolean"), i = $(this.right.eval(e, t), "boolean");
32457
+ let n = H(this.left.eval(e, t), "boolean"), i = H(this.right.eval(e, t), "boolean");
32458
32458
  return n?.value === true && i?.value === true ? h(true) : n?.value === false || i?.value === false ? h(false) : [];
32459
32459
  }
32460
32460
  };
@@ -32463,7 +32463,7 @@ var wt = class extends R {
32463
32463
  super("or", e, t);
32464
32464
  }
32465
32465
  eval(e, t) {
32466
- let n = $(this.left.eval(e, t), "boolean"), i = $(this.right.eval(e, t), "boolean");
32466
+ let n = H(this.left.eval(e, t), "boolean"), i = H(this.right.eval(e, t), "boolean");
32467
32467
  return n?.value === false && i?.value === false ? h(false) : n?.value || i?.value ? h(true) : [];
32468
32468
  }
32469
32469
  };
@@ -32472,7 +32472,7 @@ var At = class extends R {
32472
32472
  super("xor", e, t);
32473
32473
  }
32474
32474
  eval(e, t) {
32475
- let n = $(this.left.eval(e, t), "boolean"), i = $(this.right.eval(e, t), "boolean");
32475
+ let n = H(this.left.eval(e, t), "boolean"), i = H(this.right.eval(e, t), "boolean");
32476
32476
  return !n || !i ? [] : h(n.value !== i.value);
32477
32477
  }
32478
32478
  };
@@ -32481,7 +32481,7 @@ var Ot = class extends R {
32481
32481
  super("implies", e, t);
32482
32482
  }
32483
32483
  eval(e, t) {
32484
- let n = $(this.left.eval(e, t), "boolean"), i = $(this.right.eval(e, t), "boolean");
32484
+ let n = H(this.left.eval(e, t), "boolean"), i = H(this.right.eval(e, t), "boolean");
32485
32485
  return i?.value === true || n?.value === false ? h(true) : !n || !i ? [] : h(false);
32486
32486
  }
32487
32487
  };
@@ -32498,7 +32498,7 @@ var ee = class {
32498
32498
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
32499
32499
  }
32500
32500
  };
32501
- var ve = class {
32501
+ var Se = class {
32502
32502
  constructor(e, t) {
32503
32503
  this.left = e, this.expr = t;
32504
32504
  }
@@ -32516,36 +32516,36 @@ var ve = class {
32516
32516
  };
32517
32517
  var Qe = ["!=", "!~", "<=", ">=", "{}", "->"];
32518
32518
  var g = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
32519
- var us = { parse(r7) {
32519
+ var ps = { parse(r7) {
32520
32520
  let e = r7.consumeAndParse();
32521
32521
  if (!r7.match(")")) throw new Error("Parse error: expected `)` got `" + r7.peek()?.value + "`");
32522
32522
  return e;
32523
32523
  } };
32524
- var ls = { parse(r7, e) {
32524
+ var fs2 = { parse(r7, e) {
32525
32525
  let t = r7.consumeAndParse();
32526
32526
  if (!r7.match("]")) throw new Error("Parse error: expected `]`");
32527
- return new ve(e, t);
32527
+ return new Se(e, t);
32528
32528
  }, precedence: g.Indexer };
32529
- var ps = { parse(r7, e) {
32530
- if (!(e instanceof W)) throw new Error("Unexpected parentheses");
32529
+ var hs = { parse(r7, e) {
32530
+ if (!(e instanceof q)) throw new Error("Unexpected parentheses");
32531
32531
  let t = [];
32532
32532
  for (; !r7.match(")"); ) t.push(r7.consumeAndParse()), r7.match(",");
32533
32533
  return new ee(e.name, t);
32534
32534
  }, precedence: g.FunctionCall };
32535
- function ds(r7) {
32535
+ function ms(r7) {
32536
32536
  let e = r7.split(" "), t = parseFloat(e[0]), n = e[1];
32537
32537
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
32538
32538
  }
32539
32539
  function ze() {
32540
- return new nt().registerPrefix("String", { parse: (r7, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new N({ type: l.dateTime, value: Ve(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new N({ type: l.Quantity, value: ds(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new W(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", us).registerInfix("[", ls).registerInfix("(", ps).prefix("+", g.UnaryAdd, (r7, e) => new xt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r7, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r7, e, t) => new ae(r7, t)).infixLeft("/", g.Divide, (r7, e, t) => new D("/", r7, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r7, e, t) => new D("*", r7, t, (n, i) => n * i)).infixLeft("+", g.Add, (r7, e, t) => new D("+", r7, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r7, e, t) => new D("-", r7, t, (n, i) => n - i)).infixLeft("|", g.Union, (r7, e, t) => new xe(r7, t)).infixLeft("=", g.Equals, (r7, e, t) => new bt(r7, t)).infixLeft("!=", g.NotEquals, (r7, e, t) => new Et(r7, t)).infixLeft("~", g.Equivalent, (r7, e, t) => new Rt(r7, t)).infixLeft("!~", g.NotEquivalent, (r7, e, t) => new Ct(r7, t)).infixLeft("<", g.LessThan, (r7, e, t) => new D("<", r7, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r7, e, t) => new D("<=", r7, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r7, e, t) => new D(">", r7, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r7, e, t) => new D(">=", r7, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r7, e, t) => new Tt(r7, t)).infixLeft("and", g.And, (r7, e, t) => new Pt(r7, t)).infixLeft("as", g.As, (r7, e, t) => new ce(r7, t)).infixLeft("contains", g.Contains, (r7, e, t) => new vt(r7, t)).infixLeft("div", g.Divide, (r7, e, t) => new D("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r7, e, t) => new St(r7, t)).infixLeft("is", g.Is, (r7, e, t) => new Te(r7, t)).infixLeft("mod", g.Modulo, (r7, e, t) => new D("mod", r7, t, (n, i) => n % i)).infixLeft("or", g.Or, (r7, e, t) => new wt(r7, t)).infixLeft("xor", g.Xor, (r7, e, t) => new At(r7, t)).infixLeft("implies", g.Implies, (r7, e, t) => new Ot(r7, t));
32540
+ return new nt().registerPrefix("String", { parse: (r7, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r7, e) => new N({ type: l.dateTime, value: Ve(e.value) }) }).registerPrefix("Quantity", { parse: (r7, e) => new N({ type: l.Quantity, value: ms(e.value) }) }).registerPrefix("Number", { parse: (r7, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r7, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", ps).registerInfix("[", fs2).registerInfix("(", hs).prefix("+", g.UnaryAdd, (r7, e) => new xt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r7, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r7, e, t) => new ae(r7, t)).infixLeft("/", g.Divide, (r7, e, t) => new D("/", r7, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r7, e, t) => new D("*", r7, t, (n, i) => n * i)).infixLeft("+", g.Add, (r7, e, t) => new D("+", r7, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r7, e, t) => new D("-", r7, t, (n, i) => n - i)).infixLeft("|", g.Union, (r7, e, t) => new ve(r7, t)).infixLeft("=", g.Equals, (r7, e, t) => new bt(r7, t)).infixLeft("!=", g.NotEquals, (r7, e, t) => new Et(r7, t)).infixLeft("~", g.Equivalent, (r7, e, t) => new Rt(r7, t)).infixLeft("!~", g.NotEquivalent, (r7, e, t) => new Ct(r7, t)).infixLeft("<", g.LessThan, (r7, e, t) => new D("<", r7, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r7, e, t) => new D("<=", r7, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r7, e, t) => new D(">", r7, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r7, e, t) => new D(">=", r7, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r7, e, t) => new vt(r7, t)).infixLeft("and", g.And, (r7, e, t) => new Pt(r7, t)).infixLeft("as", g.As, (r7, e, t) => new ce(r7, t)).infixLeft("contains", g.Contains, (r7, e, t) => new Tt(r7, t)).infixLeft("div", g.Divide, (r7, e, t) => new D("div", r7, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r7, e, t) => new St(r7, t)).infixLeft("is", g.Is, (r7, e, t) => new Te(r7, t)).infixLeft("mod", g.Modulo, (r7, e, t) => new D("mod", r7, t, (n, i) => n % i)).infixLeft("or", g.Or, (r7, e, t) => new wt(r7, t)).infixLeft("xor", g.Xor, (r7, e, t) => new At(r7, t)).infixLeft("implies", g.Implies, (r7, e, t) => new Ot(r7, t));
32541
32541
  }
32542
- var fs2 = ze();
32542
+ var ys = ze();
32543
32543
  var f = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
32544
- var gi = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
32544
+ var xi = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
32545
32545
  var Wr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
32546
- var Es = [f.MISSING, f.PRESENT];
32546
+ var Ps = [f.MISSING, f.PRESENT];
32547
32547
  var Ke = { READ: "read", VREAD: "vread", UPDATE: "update", PATCH: "patch", DELETE: "delete", HISTORY: "history", HISTORY_INSTANCE: "history-instance", HISTORY_TYPE: "history-type", HISTORY_SYSTEM: "history-system", CREATE: "create", SEARCH: "search", SEARCH_TYPE: "search-type", SEARCH_SYSTEM: "search-system", SEARCH_COMPARTMENT: "search-compartment", CAPABILITIES: "capabilities", TRANSACTION: "transaction", BATCH: "batch", OPERATION: "operation" };
32548
- var js = [Ke.READ, Ke.VREAD, Ke.HISTORY, Ke.HISTORY_INSTANCE];
32548
+ var Gs = [Ke.READ, Ke.VREAD, Ke.HISTORY, Ke.HISTORY_INSTANCE];
32549
32549
  function Ti(r7) {
32550
32550
  if (typeof window < "u") {
32551
32551
  let e = window.atob(r7), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
@@ -32564,12 +32564,12 @@ function $r(r7) {
32564
32564
  }
32565
32565
  function Hr() {
32566
32566
  let r7 = new Uint32Array(28);
32567
- return crypto.getRandomValues(r7), Zn(r7.buffer);
32567
+ return crypto.getRandomValues(r7), Xn(r7.buffer);
32568
32568
  }
32569
- async function vi(r7) {
32569
+ async function Si(r7) {
32570
32570
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r7));
32571
32571
  }
32572
- function Se() {
32572
+ function be() {
32573
32573
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r7) => {
32574
32574
  let e = Math.random() * 16 | 0;
32575
32575
  return (r7 === "x" ? e : e & 3 | 8).toString(16);
@@ -32601,7 +32601,7 @@ var Gr = class {
32601
32601
  this.listeners = {};
32602
32602
  }
32603
32603
  };
32604
- var z = class {
32604
+ var J = class {
32605
32605
  constructor() {
32606
32606
  this.emitter = new Gr();
32607
32607
  }
@@ -32619,72 +32619,72 @@ var z = class {
32619
32619
  }
32620
32620
  };
32621
32621
  var Qr = { "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" };
32622
- var Zs = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32622
+ var ta = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32623
32623
  var zr = ["DiagnosticReport-update"];
32624
- function bi(r7) {
32624
+ function Ei(r7) {
32625
32625
  return zr.includes(r7);
32626
32626
  }
32627
- function Ei(r7) {
32628
- if (zr.includes(r7)) throw new d(y(`'context.version' is required for '${r7}'.`));
32627
+ function Ri(r7) {
32628
+ if (zr.includes(r7)) throw new p(y(`'context.version' is required for '${r7}'.`));
32629
32629
  }
32630
- var Xs = { "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" } } };
32631
- function ea(r7) {
32632
- return Zs.includes(r7);
32630
+ var ra = { "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" } } };
32631
+ function na(r7) {
32632
+ return ta.includes(r7);
32633
32633
  }
32634
- function Ri(r7) {
32634
+ function Ci(r7) {
32635
32635
  return !!r7.endpoint;
32636
32636
  }
32637
32637
  function Jr(r7) {
32638
- if (!Nt(r7)) throw new d(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32638
+ if (!Nt(r7)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32639
32639
  let { channelType: e, mode: t, topic: n, events: i } = r7, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
32640
- return Ri(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
32640
+ return Ci(r7) && (o.endpoint = r7.endpoint), new URLSearchParams(o).toString();
32641
32641
  }
32642
32642
  function Nt(r7) {
32643
32643
  if (typeof r7 != "object") return false;
32644
32644
  let { channelType: e, mode: t, topic: n, events: i } = r7;
32645
32645
  if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
32646
32646
  for (let o of i) if (!Qr[o]) return false;
32647
- return !(Ri(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
32647
+ return !(Ci(r7) && !(typeof r7.endpoint == "string" && r7.endpoint.startsWith("ws")));
32648
32648
  }
32649
- function ta(r7, e, t, n) {
32650
- if (typeof e != "object") throw new d(y(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
32651
- if (!(e.id && typeof e.id == "string")) throw new d(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
32652
- if (!e.resourceType) throw new d(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
32649
+ function ia(r7, e, t, n) {
32650
+ if (typeof e != "object") throw new p(y(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
32651
+ if (!(e.id && typeof e.id == "string")) throw new p(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
32652
+ if (!e.resourceType) throw new p(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
32653
32653
  let i = n.resourceType;
32654
32654
  if (i !== "*") {
32655
- if (!ea(e.resourceType)) throw new d(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
32656
- if (i && e.resourceType !== i) throw new d(y(`context[${t}] is invalid. context[${t}] for the '${r7}' event should contain resource of type ${i}.`));
32655
+ if (!na(e.resourceType)) throw new p(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
32656
+ if (i && e.resourceType !== i) throw new p(y(`context[${t}] is invalid. context[${t}] for the '${r7}' event should contain resource of type ${i}.`));
32657
32657
  }
32658
32658
  }
32659
- function ra(r7, e, t, n, i) {
32659
+ function oa(r7, e, t, n, i) {
32660
32660
  if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
32661
- if (!K(e.reference)) throw new d(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32662
- } else ta(r7, e.resource, t, n);
32661
+ if (!Y(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32662
+ } else ia(r7, e.resource, t, n);
32663
32663
  }
32664
- function na(r7, e) {
32665
- let t = /* @__PURE__ */ new Map(), n = Xs[r7];
32664
+ function sa(r7, e) {
32665
+ let t = /* @__PURE__ */ new Map(), n = ra[r7];
32666
32666
  for (let i = 0; i < e.length; i++) {
32667
32667
  let o = e[i].key;
32668
- if (!n[o]) throw new d(y(`Key '${o}' not found for event '${r7}'. Make sure to add only valid keys.`));
32669
- ra(r7, e[i], i, n[o], t);
32668
+ if (!n[o]) throw new p(y(`Key '${o}' not found for event '${r7}'. Make sure to add only valid keys.`));
32669
+ oa(r7, e[i], i, n[o], t);
32670
32670
  }
32671
32671
  for (let [i, o] of Object.entries(n)) {
32672
- if (!(o.optional || t.has(i))) throw new d(y(`Missing required key '${i}' on context for '${r7}' event.`));
32673
- if (!o.manyAllowed && (t.get(i) ?? 0) > 1) throw new d(y(`${t.get(i)} context entries with key '${i}' found for the '${r7}' event when schema only allows for 1.`));
32672
+ if (!(o.optional || t.has(i))) throw new p(y(`Missing required key '${i}' on context for '${r7}' event.`));
32673
+ if (!o.manyAllowed && (t.get(i) ?? 0) > 1) throw new p(y(`${t.get(i)} context entries with key '${i}' found for the '${r7}' event when schema only allows for 1.`));
32674
32674
  }
32675
32675
  }
32676
32676
  function Kr(r7, e, t, n) {
32677
- if (!(r7 && typeof r7 == "string")) throw new d(y("Must provide a topic."));
32678
- if (!Qr[e]) throw new d(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Qr).join(", ")}`));
32679
- if (typeof t != "object") throw new d(y("context must be a context object or array of context objects."));
32680
- if (zr.includes(e) && !n) throw new d(y(`The '${e}' event must contain a 'context.versionId'.`));
32677
+ if (!(r7 && typeof r7 == "string")) throw new p(y("Must provide a topic."));
32678
+ if (!Qr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Qr).join(", ")}`));
32679
+ if (typeof t != "object") throw new p(y("context must be a context object or array of context objects."));
32680
+ if (zr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
32681
32681
  let i = Array.isArray(t) ? t : [t];
32682
- return na(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Se(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
32682
+ return sa(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: be(), event: { "hub.topic": r7, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
32683
32683
  }
32684
- var Ft = class extends z {
32684
+ var Lt = class extends J {
32685
32685
  constructor(e) {
32686
- if (super(), this.subRequest = e, !e.endpoint) throw new d(y("Subscription request should contain an endpoint."));
32687
- if (!Nt(e)) throw new d(y("Subscription request failed validation."));
32686
+ if (super(), this.subRequest = e, !e.endpoint) throw new p(y("Subscription request should contain an endpoint."));
32687
+ if (!Nt(e)) throw new p(y("Subscription request failed validation."));
32688
32688
  let t = new WebSocket(e.endpoint);
32689
32689
  t.addEventListener("open", () => {
32690
32690
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -32701,28 +32701,28 @@ var Ft = class extends z {
32701
32701
  this.websocket.close();
32702
32702
  }
32703
32703
  };
32704
- function ia(r7) {
32704
+ function aa(r7) {
32705
32705
  let e = r7.replace(/-/g, "+").replace(/_/g, "/"), t = Ti(e), n = Array.from(t).reduce((o, s) => {
32706
32706
  let a2 = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
32707
32707
  return `${o}%${a2}`;
32708
32708
  }, ""), i = decodeURIComponent(n);
32709
32709
  return JSON.parse(i);
32710
32710
  }
32711
- function Ci(r7) {
32711
+ function Pi(r7) {
32712
32712
  return r7.split(".").length === 3;
32713
32713
  }
32714
32714
  function Ut(r7) {
32715
32715
  let [e, t, n] = r7.split(".");
32716
- return ia(t);
32716
+ return aa(t);
32717
32717
  }
32718
- function Pi(r7) {
32718
+ function wi(r7) {
32719
32719
  try {
32720
32720
  return typeof Ut(r7).login_id == "string";
32721
32721
  } catch {
32722
32722
  return false;
32723
32723
  }
32724
32724
  }
32725
- function wi(r7) {
32725
+ function Ai(r7) {
32726
32726
  try {
32727
32727
  let t = Ut(r7).exp;
32728
32728
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -32744,11 +32744,11 @@ var Bt = class {
32744
32744
  await this.medplum.delete(`keyvalue/v1/${e}`);
32745
32745
  }
32746
32746
  };
32747
- var Ai;
32748
- Ai = Symbol.toStringTag;
32747
+ var Oi;
32748
+ Oi = Symbol.toStringTag;
32749
32749
  var V = class {
32750
32750
  constructor(e) {
32751
- this[Ai] = "ReadablePromise";
32751
+ this[Oi] = "ReadablePromise";
32752
32752
  this.status = "pending";
32753
32753
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
32754
32754
  throw this.status = "error", this.error = t, t;
@@ -32824,15 +32824,15 @@ var Yr = class {
32824
32824
  return Array.from(this.data.keys())[e];
32825
32825
  }
32826
32826
  };
32827
- var Fe = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
32828
- var Ii = false;
32829
- function oa() {
32827
+ var Le = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
32828
+ var ki = false;
32829
+ function ca() {
32830
32830
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
32831
- Fe.Event = globalThis.Event, Fe.ErrorEvent = class extends Event {
32831
+ Le.Event = globalThis.Event, Le.ErrorEvent = class extends Event {
32832
32832
  constructor(e, t) {
32833
32833
  super("error", t), this.message = e.message, this.error = e;
32834
32834
  }
32835
- }, Fe.CloseEvent = class extends Event {
32835
+ }, Le.CloseEvent = class extends Event {
32836
32836
  constructor(t = 1e3, n = "", i) {
32837
32837
  super("close", i);
32838
32838
  this.wasClean = true;
@@ -32840,17 +32840,17 @@ function oa() {
32840
32840
  }
32841
32841
  };
32842
32842
  }
32843
- function sa(r7, e) {
32843
+ function ua(r7, e) {
32844
32844
  if (!r7) throw new Error(e);
32845
32845
  }
32846
32846
  function Wt(r7) {
32847
32847
  return new r7.constructor(r7.type, r7);
32848
32848
  }
32849
- var be = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
32850
- var ki = false;
32851
- var qt = class r extends z {
32849
+ var Ee = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
32850
+ var Di = false;
32851
+ var qt = class r extends J {
32852
32852
  constructor(t, n, i = {}) {
32853
- Ii || (oa(), Ii = true);
32853
+ ki || (ca(), ki = true);
32854
32854
  super();
32855
32855
  this._retryCount = -1;
32856
32856
  this._shouldReconnect = true;
@@ -32864,8 +32864,8 @@ var qt = class r extends z {
32864
32864
  this.onopen = null;
32865
32865
  this._handleOpen = (t2) => {
32866
32866
  this._debug("open event");
32867
- let { minUptime: n2 = be.minUptime } = this._options;
32868
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), sa(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(Wt(t2));
32867
+ let { minUptime: n2 = Ee.minUptime } = this._options;
32868
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ua(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(Wt(t2));
32869
32869
  };
32870
32870
  this._handleMessage = (t2) => {
32871
32871
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Wt(t2));
@@ -32946,7 +32946,7 @@ var qt = class r extends z {
32946
32946
  send(t) {
32947
32947
  if (this._ws && this._ws.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
32948
32948
  else {
32949
- let { maxEnqueuedMessages: n = be.maxEnqueuedMessages } = this._options;
32949
+ let { maxEnqueuedMessages: n = Ee.maxEnqueuedMessages } = this._options;
32950
32950
  this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
32951
32951
  }
32952
32952
  }
@@ -32954,7 +32954,7 @@ var qt = class r extends z {
32954
32954
  this._options.debug && this._debugLogger("RWS>", ...t);
32955
32955
  }
32956
32956
  _getNextDelay() {
32957
- let { reconnectionDelayGrowFactor: t = be.reconnectionDelayGrowFactor, minReconnectionDelay: n = be.minReconnectionDelay, maxReconnectionDelay: i = be.maxReconnectionDelay } = this._options, o = 0;
32957
+ let { reconnectionDelayGrowFactor: t = Ee.reconnectionDelayGrowFactor, minReconnectionDelay: n = Ee.minReconnectionDelay, maxReconnectionDelay: i = Ee.maxReconnectionDelay } = this._options, o = 0;
32958
32958
  return this._retryCount > 0 && (o = n * Math.pow(t, this._retryCount - 1), o > i && (o = i)), this._debug("next delay", o), o;
32959
32959
  }
32960
32960
  _wait() {
@@ -32965,7 +32965,7 @@ var qt = class r extends z {
32965
32965
  _connect() {
32966
32966
  if (this._connectLock || !this._shouldReconnect) return;
32967
32967
  this._connectLock = true;
32968
- let { maxRetries: t = be.maxRetries, connectionTimeout: n = be.connectionTimeout } = this._options;
32968
+ let { maxRetries: t = Ee.maxRetries, connectionTimeout: n = Ee.connectionTimeout } = this._options;
32969
32969
  if (this._retryCount >= t) {
32970
32970
  this._debug("max retries reached", this._retryCount, ">=", t);
32971
32971
  return;
@@ -32975,21 +32975,21 @@ var qt = class r extends z {
32975
32975
  this._connectLock = false;
32976
32976
  return;
32977
32977
  }
32978
- !this._options.WebSocket && typeof WebSocket > "u" && !ki && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), ki = true);
32978
+ !this._options.WebSocket && typeof WebSocket > "u" && !Di && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Di = true);
32979
32979
  let i = this._options.WebSocket || WebSocket;
32980
32980
  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);
32981
32981
  }).catch((i) => {
32982
- this._connectLock = false, this._handleError(new Fe.ErrorEvent(Error(i.message), this));
32982
+ this._connectLock = false, this._handleError(new Le.ErrorEvent(Error(i.message), this));
32983
32983
  });
32984
32984
  }
32985
32985
  _handleTimeout() {
32986
- this._debug("timeout event"), this._handleError(new Fe.ErrorEvent(Error("TIMEOUT"), this));
32986
+ this._debug("timeout event"), this._handleError(new Le.ErrorEvent(Error("TIMEOUT"), this));
32987
32987
  }
32988
32988
  _disconnect(t = 1e3, n) {
32989
32989
  if (this._clearTimeouts(), !!this._ws) {
32990
32990
  this._removeListeners();
32991
32991
  try {
32992
- this._ws.close(t, n), this._handleClose(new Fe.CloseEvent(t, n, this));
32992
+ this._ws.close(t, n), this._handleClose(new Le.CloseEvent(t, n, this));
32993
32993
  } catch {
32994
32994
  }
32995
32995
  }
@@ -33007,8 +33007,8 @@ var qt = class r extends z {
33007
33007
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
33008
33008
  }
33009
33009
  };
33010
- var aa = 5e3;
33011
- var Ze = class extends z {
33010
+ var la = 5e3;
33011
+ var Ze = class extends J {
33012
33012
  constructor(...e) {
33013
33013
  super(), this.criteria = new Set(e);
33014
33014
  }
@@ -33035,15 +33035,15 @@ var jt = class {
33035
33035
  constructor(e, t, n) {
33036
33036
  this.pingTimer = void 0;
33037
33037
  this.waitingForPong = false;
33038
- if (!(e instanceof $t)) throw new d(y("First arg of constructor should be a `MedplumClient`"));
33038
+ if (!(e instanceof $t)) throw new p(y("First arg of constructor should be a `MedplumClient`"));
33039
33039
  let i;
33040
33040
  try {
33041
33041
  i = new URL(t).toString();
33042
33042
  } catch {
33043
- throw new d(y("Not a valid URL"));
33043
+ throw new p(y("Not a valid URL"));
33044
33044
  }
33045
33045
  let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new qt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
33046
- this.medplum = e, this.ws = o, this.masterSubEmitter = new Ze(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? aa, this.currentProfile = e.getProfile(), this.setupListeners();
33046
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new Ze(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? la, this.currentProfile = e.getProfile(), this.setupListeners();
33047
33047
  }
33048
33048
  setupListeners() {
33049
33049
  let e = this.ws;
@@ -33060,7 +33060,7 @@ var jt = class {
33060
33060
  return;
33061
33061
  }
33062
33062
  if (o.type === "handshake") {
33063
- let a2 = he(o.subscription), c = { type: "connect", payload: { subscriptionId: a2 } };
33063
+ let a2 = me(o.subscription), c = { type: "connect", payload: { subscriptionId: a2 } };
33064
33064
  this.masterSubEmitter?.dispatchEvent(c);
33065
33065
  let u2 = this.criteriaEntriesBySubscriptionId.get(a2);
33066
33066
  if (!u2) {
@@ -33071,7 +33071,7 @@ var jt = class {
33071
33071
  return;
33072
33072
  }
33073
33073
  this.masterSubEmitter?.dispatchEvent({ type: "message", payload: i });
33074
- let s = this.criteriaEntriesBySubscriptionId.get(he(o.subscription));
33074
+ let s = this.criteriaEntriesBySubscriptionId.get(me(o.subscription));
33075
33075
  if (!s) {
33076
33076
  console.warn("Received notification for criteria the SubscriptionManager is not listening for");
33077
33077
  return;
@@ -33084,7 +33084,7 @@ var jt = class {
33084
33084
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i });
33085
33085
  }
33086
33086
  }), e.addEventListener("error", () => {
33087
- let t = { type: "error", payload: new d(vn(new Error("WebSocket error"))) };
33087
+ let t = { type: "error", payload: new p(Sn(new Error("WebSocket error"))) };
33088
33088
  this.masterSubEmitter?.dispatchEvent(t);
33089
33089
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
33090
33090
  }), e.addEventListener("close", () => {
@@ -33121,10 +33121,10 @@ var jt = class {
33121
33121
  }
33122
33122
  async getTokenForCriteria(e) {
33123
33123
  let t = e?.subscriptionId;
33124
- t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${Y(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
33124
+ t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${B(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
33125
33125
  let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`), i = n?.find((s) => s.name === "token")?.valueString, o = n?.find((s) => s.name === "websocket-url")?.valueUrl;
33126
- if (!i) throw new d(y("Failed to get token"));
33127
- if (!o) throw new d(y("Failed to get URL from $get-ws-binding-token"));
33126
+ if (!i) throw new p(y("Failed to get token"));
33127
+ if (!o) throw new p(y("Failed to get URL from $get-ws-binding-token"));
33128
33128
  return [t, i];
33129
33129
  }
33130
33130
  maybeGetCriteriaEntry(e, t) {
@@ -33162,7 +33162,7 @@ var jt = class {
33162
33162
  let [t, n] = await this.getTokenForCriteria(e);
33163
33163
  e.subscriptionId = t, e.token = n, this.criteriaEntriesBySubscriptionId.set(t, e), this.ws.send(JSON.stringify({ type: "bind-with-token", payload: { token: n } }));
33164
33164
  } catch (t) {
33165
- console.error(we(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33165
+ console.error(Ae(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33166
33166
  }
33167
33167
  }
33168
33168
  }
@@ -33201,24 +33201,24 @@ var jt = class {
33201
33201
  return this.masterSubEmitter || (this.masterSubEmitter = new Ze(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
33202
33202
  }
33203
33203
  };
33204
- var Xr = "4.1.6-489ec081e";
33205
- var la = w.FHIR_JSON + ", */*; q=0.1";
33206
- var pa = "https://api.medplum.com/";
33207
- var da = 1e3;
33208
- var fa = 6e4;
33209
- var ha = 0;
33210
- var ma = 3e5;
33211
- var ya = "Binary/";
33212
- var Di = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33204
+ var Xr = "4.1.7-a8a6c7c48";
33205
+ var fa = w.FHIR_JSON + ", */*; q=0.1";
33206
+ var ha = "https://api.medplum.com/";
33207
+ var ma = 1e3;
33208
+ var ya = 6e4;
33209
+ var ga = 0;
33210
+ var xa = 3e5;
33211
+ var va = "Binary/";
33212
+ var Vi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33213
33213
  var Ne = { 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" };
33214
- var ga = { 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" };
33215
- var xa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33216
- var $t = class extends z {
33214
+ var Ta = { 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" };
33215
+ var Sa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33216
+ var $t = class extends J {
33217
33217
  constructor(t) {
33218
33218
  super();
33219
33219
  this.initComplete = true;
33220
33220
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
33221
- this.options = t ?? {}, this.fetch = t?.fetch ?? Ta(), this.storage = t?.storage ?? new Ye(), this.createPdfImpl = t?.createPdf, this.baseUrl = Lr(t?.baseUrl ?? pa), this.fhirBaseUrl = B(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = B(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = B(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = B(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = B(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? ma, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? ha : fa), this.cacheTime > 0 ? this.requestCache = new Re(t?.resourceCacheSize ?? da) : 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(() => {
33221
+ this.options = t ?? {}, this.fetch = t?.fetch ?? ba(), this.storage = t?.storage ?? new Ye(), this.createPdfImpl = t?.createPdf, this.baseUrl = Fr(t?.baseUrl ?? ha), this.fhirBaseUrl = W(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? xa, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? ga : ya), this.cacheTime > 0 ? this.requestCache = new Ce(t?.resourceCacheSize ?? ma) : 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(() => {
33222
33222
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
33223
33223
  }).catch((n) => {
33224
33224
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -33265,7 +33265,7 @@ var $t = class extends z {
33265
33265
  this.requestCache?.clear();
33266
33266
  }
33267
33267
  invalidateSearches(t) {
33268
- let n = B(this.fhirBaseUrl, t);
33268
+ let n = W(this.fhirBaseUrl, t);
33269
33269
  if (this.requestCache) for (let i of this.requestCache.keys()) (i.endsWith(n) || i.includes(n + "?")) && this.requestCache.delete(i);
33270
33270
  }
33271
33271
  get(t, n = {}) {
@@ -33330,7 +33330,7 @@ var $t = class extends z {
33330
33330
  }
33331
33331
  async exchangeExternalAccessToken(t, n) {
33332
33332
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
33333
- return this.fetchTokens({ grant_type: Ne.TokenExchange, subject_token_type: ga.AccessToken, client_id: n, subject_token: t });
33333
+ return this.fetchTokens({ grant_type: Ne.TokenExchange, subject_token_type: Ta.AccessToken, client_id: n, subject_token: t });
33334
33334
  }
33335
33335
  getExternalAuthRedirectUri(t, n, i, o, s = true) {
33336
33336
  let a2 = new URL(t);
@@ -33343,11 +33343,11 @@ var $t = class extends z {
33343
33343
  return a2.toString();
33344
33344
  }
33345
33345
  fhirUrl(...t) {
33346
- return new URL(B(this.fhirBaseUrl, t.join("/")));
33346
+ return new URL(W(this.fhirBaseUrl, t.join("/")));
33347
33347
  }
33348
33348
  fhirSearchUrl(t, n) {
33349
33349
  let i = this.fhirUrl(t);
33350
- return n && (i.search = oi(n)), i;
33350
+ return n && (i.search = si(n)), i;
33351
33351
  }
33352
33352
  search(t, n, i) {
33353
33353
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a2 = this.getCacheEntry(s, i);
@@ -33366,7 +33366,7 @@ var $t = class extends z {
33366
33366
  searchResources(t, n, i) {
33367
33367
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i);
33368
33368
  if (a2) return a2.value;
33369
- let c = new V(this.search(t, n, i).then(_i));
33369
+ let c = new V(this.search(t, n, i).then(Fi));
33370
33370
  return this.setCacheEntry(s, c), c;
33371
33371
  }
33372
33372
  async *searchResourcePages(t, n, i) {
@@ -33374,7 +33374,7 @@ var $t = class extends z {
33374
33374
  for (; o; ) {
33375
33375
  let s = new URL(o).searchParams, a2 = await this.search(t, s, i), c = a2.link?.find((u2) => u2.relation === "next");
33376
33376
  if (!a2.entry?.length && !c) break;
33377
- yield _i(a2), o = c?.url ? new URL(c.url) : void 0;
33377
+ yield Fi(a2), o = c?.url ? new URL(c.url) : void 0;
33378
33378
  }
33379
33379
  }
33380
33380
  valueSetExpand(t, n) {
@@ -33388,7 +33388,7 @@ var $t = class extends z {
33388
33388
  getCachedReference(t) {
33389
33389
  let n = t.reference;
33390
33390
  if (!n) return;
33391
- if (n === "system") return Di;
33391
+ if (n === "system") return Vi;
33392
33392
  let [i, o] = n.split("/");
33393
33393
  if (!(!i || !o)) return this.getCached(i, o);
33394
33394
  }
@@ -33399,12 +33399,12 @@ var $t = class extends z {
33399
33399
  readReference(t, n) {
33400
33400
  let i = t.reference;
33401
33401
  if (!i) return new V(Promise.reject(new Error("Missing reference")));
33402
- if (i === "system") return new V(Promise.resolve(Di));
33402
+ if (i === "system") return new V(Promise.resolve(Vi));
33403
33403
  let [o, s] = i.split("/");
33404
33404
  return !o || !s ? new V(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
33405
33405
  }
33406
33406
  requestSchema(t) {
33407
- if (Dn(t)) return Promise.resolve();
33407
+ if (Vn(t)) return Promise.resolve();
33408
33408
  let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
33409
33409
  if (i) return i.value;
33410
33410
  let o = new V((async () => {
@@ -33455,7 +33455,7 @@ var $t = class extends z {
33455
33455
  return this.setCacheEntry(n, o), o;
33456
33456
  }
33457
33457
  requestProfileSchema(t, n) {
33458
- if (!n?.expandProfile && Mn(t)) return Promise.resolve();
33458
+ if (!n?.expandProfile && _n(t)) return Promise.resolve();
33459
33459
  let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i, void 0);
33460
33460
  if (o) return o.value;
33461
33461
  let s = new V((async () => {
@@ -33504,49 +33504,49 @@ var $t = class extends z {
33504
33504
  async createAttachment(t, n, i, o, s) {
33505
33505
  let a2 = Li(t, n, i, o);
33506
33506
  if (a2.contentType === w.XML) {
33507
- let p = a2.data, m2;
33508
- p instanceof Blob ? m2 = await new Promise((x2, U) => {
33509
- let j = new FileReader();
33510
- j.onload = () => {
33511
- if (!j.result) {
33507
+ let d2 = a2.data, m2;
33508
+ d2 instanceof Blob ? m2 = await new Promise((x2, U) => {
33509
+ let $ = new FileReader();
33510
+ $.onload = () => {
33511
+ if (!$.result) {
33512
33512
  U(new Error("Failed to load file"));
33513
33513
  return;
33514
33514
  }
33515
- x2(j.result);
33516
- }, j.readAsText(p, "utf-8");
33517
- }) : ArrayBuffer.isView(p) ? m2 = new TextDecoder().decode(p) : m2 = p, m2.includes("<ClinicalDocument") && m2.includes("urn:hl7-org:v3") && (a2 = { ...a2, contentType: w.CDA_XML });
33515
+ x2($.result);
33516
+ }, $.readAsText(d2, "utf-8");
33517
+ }) : ArrayBuffer.isView(d2) ? m2 = new TextDecoder().decode(d2) : m2 = d2, m2.includes("<ClinicalDocument") && m2.includes("urn:hl7-org:v3") && (a2 = { ...a2, contentType: w.CDA_XML });
33518
33518
  }
33519
33519
  let c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
33520
33520
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
33521
33521
  }
33522
33522
  createBinary(t, n, i, o, s) {
33523
- let a2 = Li(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p, filename: m2, securityContext: x2, onProgress: U } = a2, j = this.fhirUrl("Binary");
33524
- return m2 && j.searchParams.set("_filename", m2), x2?.reference && this.setRequestHeader(c, "X-Security-Context", x2.reference), U ? this.uploadwithProgress(j, u2, p, U, c) : this.post(j, u2, p, c);
33523
+ let a2 = Li(t, n, i, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: d2, filename: m2, securityContext: x2, onProgress: U } = a2, $ = this.fhirUrl("Binary");
33524
+ return m2 && $.searchParams.set("_filename", m2), x2?.reference && this.setRequestHeader(c, "X-Security-Context", x2.reference), U ? this.uploadwithProgress($, u2, d2, U, c) : this.post($, u2, d2, c);
33525
33525
  }
33526
33526
  uploadwithProgress(t, n, i, o, s) {
33527
33527
  return new Promise((a2, c) => {
33528
- let u2 = new XMLHttpRequest(), p = () => u2.abort();
33529
- s?.signal?.addEventListener("abort", p);
33528
+ let u2 = new XMLHttpRequest(), d2 = () => u2.abort();
33529
+ s?.signal?.addEventListener("abort", d2);
33530
33530
  let m2 = (x2) => {
33531
- s?.signal?.removeEventListener("abort", p), x2 instanceof Error ? c(x2) : a2(x2);
33531
+ s?.signal?.removeEventListener("abort", d2), x2 instanceof Error ? c(x2) : a2(x2);
33532
33532
  };
33533
33533
  if (u2.responseType = "json", u2.onabort = () => m2(new DOMException("Request aborted", "AbortError")), u2.onerror = () => m2(new Error("Request error")), o && (u2.upload.onprogress = (x2) => o(x2), u2.upload.onload = (x2) => o(x2)), u2.onload = () => {
33534
- u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new d(st(u2.response || u2.statusText)));
33534
+ u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new p(st(u2.response || u2.statusText)));
33535
33535
  }, u2.open("POST", t), u2.withCredentials = true, u2.setRequestHeader("Authorization", "Bearer " + this.accessToken), u2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), u2.setRequestHeader("Content-Type", i), this.options.extendedMode !== false && u2.setRequestHeader("X-Medplum", "extended"), s?.headers) {
33536
33536
  let x2 = s.headers;
33537
- for (let [U, j] of Object.entries(x2)) u2.setRequestHeader(U, j);
33537
+ for (let [U, $] of Object.entries(x2)) u2.setRequestHeader(U, $);
33538
33538
  }
33539
33539
  u2.send(n);
33540
33540
  });
33541
33541
  }
33542
33542
  async createPdf(t, n, i, o) {
33543
33543
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
33544
- let s = ba(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p, ...m2 } = s, x2 = await this.createPdfImpl(c, u2, p), U = { ...m2, data: x2, contentType: "application/pdf" };
33544
+ let s = Ca(t, n, i, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: d2, ...m2 } = s, x2 = await this.createPdfImpl(c, u2, d2), U = { ...m2, data: x2, contentType: "application/pdf" };
33545
33545
  return this.createBinary(U, a2);
33546
33546
  }
33547
33547
  createComment(t, n, i) {
33548
33548
  let o = this.getProfile(), s, a2;
33549
- return t.resourceType === "Encounter" && (s = ke(t), a2 = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a2 = t.subject), t.resourceType === "Patient" && (a2 = ke(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [ke(t)], encounter: s, subject: a2, sender: o ? ke(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
33549
+ return t.resourceType === "Encounter" && (s = he(t), a2 = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a2 = t.subject), t.resourceType === "Patient" && (a2 = he(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [he(t)], encounter: s, subject: a2, sender: o ? he(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
33550
33550
  }
33551
33551
  async updateResource(t, n) {
33552
33552
  if (!t.resourceType) throw new Error("Missing resourceType");
@@ -33588,13 +33588,13 @@ var $t = class extends z {
33588
33588
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i}`, o);
33589
33589
  }
33590
33590
  pushToAgent(t, n, i, o, s, a2) {
33591
- return this.post(this.fhirUrl("Agent", he(t), "$push"), { destination: typeof n == "string" ? n : Y(n), body: i, contentType: o, waitForResponse: s }, w.FHIR_JSON, a2);
33591
+ return this.post(this.fhirUrl("Agent", me(t), "$push"), { destination: typeof n == "string" ? n : B(n), body: i, contentType: o, waitForResponse: s }, w.FHIR_JSON, a2);
33592
33592
  }
33593
33593
  getActiveLogin() {
33594
33594
  return this.storage.getObject("activeLogin");
33595
33595
  }
33596
33596
  async setActiveLogin(t) {
33597
- (!this.sessionDetails?.profile || Y(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
33597
+ (!this.sessionDetails?.profile || B(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
33598
33598
  }
33599
33599
  getAccessToken() {
33600
33600
  return this.accessToken;
@@ -33603,7 +33603,7 @@ var $t = class extends z {
33603
33603
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
33604
33604
  }
33605
33605
  setAccessToken(t, n) {
33606
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = wi(t), this.medplumServer = Pi(t);
33606
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ai(t), this.medplumServer = wi(t);
33607
33607
  }
33608
33608
  getLogins() {
33609
33609
  return this.storage.getObject("logins") ?? [];
@@ -33651,19 +33651,25 @@ var $t = class extends z {
33651
33651
  async download(t, n = {}) {
33652
33652
  this.refreshPromise && await this.refreshPromise;
33653
33653
  let i = t.toString();
33654
- i.startsWith(ya) && (t = this.fhirUrl(i));
33654
+ i.startsWith(va) && (t = this.fhirUrl(i));
33655
33655
  let o = n.headers;
33656
33656
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
33657
33657
  }
33658
33658
  async createMedia(t, n) {
33659
33659
  let { additionalFields: i, ...o } = t, s = await this.createResource({ resourceType: "Media", status: "preparation", content: { contentType: t.contentType }, ...i });
33660
- o.securityContext || (o.securityContext = ke(s));
33660
+ o.securityContext || (o.securityContext = he(s));
33661
33661
  let a2 = await this.createAttachment(o, n);
33662
33662
  return this.updateResource({ ...s, status: "completed", content: a2 });
33663
33663
  }
33664
33664
  async uploadMedia(t, n, i, o, s) {
33665
33665
  return this.createMedia({ data: t, contentType: n, filename: i, additionalFields: o }, s);
33666
33666
  }
33667
+ async createDocumentReference(t, n) {
33668
+ let { additionalFields: i, ...o } = t, s = await this.createResource({ resourceType: "DocumentReference", status: "current", content: [{ attachment: { contentType: t.contentType } }], ...i });
33669
+ o.securityContext || (o.securityContext = he(s));
33670
+ let a2 = await this.createAttachment(o, n);
33671
+ return this.updateResource({ ...s, content: [{ attachment: a2 }] });
33672
+ }
33667
33673
  async bulkExport(t = "", n, i, o) {
33668
33674
  let s = t && `${t}/`, a2 = this.fhirUrl(`${s}$export`);
33669
33675
  return n && a2.searchParams.set("_type", n), i && a2.searchParams.set("_since", i), this.startAsyncRequest(a2.toString(), o);
@@ -33703,17 +33709,17 @@ var $t = class extends z {
33703
33709
  if (s.status === 401) return this.handleUnauthenticated(t, n, i);
33704
33710
  if (s.status === 204 || s.status === 304) return;
33705
33711
  let c = s.headers.get("content-type")?.includes("json");
33706
- if (s.status === 404 && !c) throw new d(xn);
33712
+ if (s.status === 404 && !c) throw new p(vn);
33707
33713
  let u2 = await this.parseBody(s, c);
33708
33714
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
33709
- let p = await Mi(s, u2);
33710
- if (p) return this.request("GET", p, { ...i, body: void 0 });
33715
+ let d2 = await _i(s, u2);
33716
+ if (d2) return this.request("GET", d2, { ...i, body: void 0 });
33711
33717
  }
33712
33718
  if (s.status === 202 && i.pollStatusOnAccepted) {
33713
- let m2 = await Mi(s, u2) ?? o.statusUrl;
33719
+ let m2 = await _i(s, u2) ?? o.statusUrl;
33714
33720
  if (m2) return this.pollStatus(m2, i, o);
33715
33721
  }
33716
- if (s.status >= 400) throw new d(st(u2));
33722
+ if (s.status >= 400) throw new p(st(u2));
33717
33723
  return u2;
33718
33724
  }
33719
33725
  async parseBody(t, n) {
@@ -33729,13 +33735,15 @@ var $t = class extends z {
33729
33735
  }
33730
33736
  }
33731
33737
  async fetchWithRetry(t, n) {
33732
- t.startsWith("http") || (t = B(this.baseUrl, t));
33738
+ t.startsWith("http") || (t = W(this.baseUrl, t));
33733
33739
  let i = n?.maxRetries ?? 2;
33734
33740
  for (let o = 0; o <= i; o++) try {
33735
33741
  this.options.verbose && this.logRequest(t, n);
33736
33742
  let s = await this.fetch(t, n);
33737
- if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i || !Ea(s)) return s;
33738
- await Mr(this.getRetryDelay(o));
33743
+ if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i || !Pa(s)) return s;
33744
+ let a2 = this.getRetryDelay(o), c = n.maxRetryTime ?? 2e3;
33745
+ if (a2 > c) return s;
33746
+ await Mr(a2);
33739
33747
  } catch (s) {
33740
33748
  if (s.message === "Failed to fetch" && o === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o === i) throw s;
33741
33749
  }
@@ -33760,7 +33768,7 @@ var $t = class extends z {
33760
33768
  return t.split(/\s*;\s*/g).map((n) => {
33761
33769
  let i = n.split(/\s*,\s*/g);
33762
33770
  if (i.length !== 3) throw new Error("Could not parse RateLimit header: " + t);
33763
- let o = i[0].substring(1, i[0].length - 1), s = i.find((p) => p.startsWith("r=")), a2 = s ? parseInt(s.substring(2), 10) : NaN, c = i.find((p) => p.startsWith("t=")), u2 = c ? parseInt(c.substring(2), 10) : NaN;
33771
+ let o = i[0].substring(1, i[0].length - 1), s = i.find((d2) => d2.startsWith("r=")), a2 = s ? parseInt(s.substring(2), 10) : NaN, c = i.find((d2) => d2.startsWith("t=")), u2 = c ? parseInt(c.substring(2), 10) : NaN;
33764
33772
  if (!o || Number.isNaN(a2) || Number.isNaN(u2)) throw new Error("Could not parse RateLimit header: " + t);
33765
33773
  return { name: o, remainingUnits: a2, secondsUntilReset: u2 };
33766
33774
  });
@@ -33785,22 +33793,22 @@ var $t = class extends z {
33785
33793
  if (this.autoBatchQueue.length = 0, this.autoBatchTimerId = void 0, t.length === 1) {
33786
33794
  let o = t[0];
33787
33795
  try {
33788
- o.resolve(await this.request(o.method, B(this.fhirBaseUrl, o.url), o.options));
33796
+ o.resolve(await this.request(o.method, W(this.fhirBaseUrl, o.url), o.options));
33789
33797
  } catch (s) {
33790
- o.reject(new d(st(s)));
33798
+ o.reject(new p(st(s)));
33791
33799
  }
33792
33800
  return;
33793
33801
  }
33794
33802
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
33795
33803
  for (let o = 0; o < t.length; o++) {
33796
33804
  let s = t[o], a2 = i.entry?.[o];
33797
- a2?.response?.outcome && !lr(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
33805
+ a2?.response?.outcome && !lr(a2.response.outcome) ? s.reject(new p(a2.response.outcome)) : s.resolve(a2?.resource);
33798
33806
  }
33799
33807
  }
33800
33808
  addFetchOptionsDefaults(t) {
33801
33809
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
33802
33810
  this.setRequestHeader(t, n, i);
33803
- }), this.setRequestHeader(t, "Accept", la, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", w.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");
33811
+ }), this.setRequestHeader(t, "Accept", fa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", w.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");
33804
33812
  }
33805
33813
  setRequestContentType(t, n) {
33806
33814
  this.setRequestHeader(t, "Content-Type", n);
@@ -33814,22 +33822,22 @@ var $t = class extends z {
33814
33822
  typeof n == "string" || typeof Blob < "u" && (n instanceof Blob || n?.constructor.name === "Blob") || typeof File < "u" && (n instanceof File || n?.constructor.name === "File") || typeof Uint8Array < "u" && (n instanceof Uint8Array || n?.constructor.name === "Uint8Array") ? t.body = n : n && (t.body = JSON.stringify(n));
33815
33823
  }
33816
33824
  handleUnauthenticated(t, n, i) {
33817
- return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(Ce)));
33825
+ return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(Pe)));
33818
33826
  }
33819
33827
  async startPkce() {
33820
33828
  let t = Hr();
33821
33829
  sessionStorage.setItem("pkceState", t);
33822
33830
  let n = Hr().slice(0, 128);
33823
33831
  sessionStorage.setItem("codeVerifier", n);
33824
- let i = await vi(n), o = Xn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33832
+ let i = await Si(n), o = ei(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33825
33833
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
33826
33834
  }
33827
33835
  async requestAuthorization(t) {
33828
33836
  let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
33829
- 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 ?? Vi()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
33837
+ 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 ?? Mi()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
33830
33838
  }
33831
33839
  processCode(t, n) {
33832
- let i = { grant_type: Ne.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Vi() };
33840
+ let i = { grant_type: Ne.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Mi() };
33833
33841
  if (typeof sessionStorage < "u") {
33834
33842
  let o = sessionStorage.getItem("codeVerifier");
33835
33843
  o && (i.code_verifier = o);
@@ -33851,28 +33859,28 @@ var $t = class extends z {
33851
33859
  return this.clientId = t, this.fetchTokens({ grant_type: Ne.JwtBearer, client_id: t, assertion: n, scope: i });
33852
33860
  }
33853
33861
  async startJwtAssertionLogin(t) {
33854
- return this.fetchTokens({ grant_type: Ne.ClientCredentials, client_assertion_type: xa.JwtBearer, client_assertion: t });
33862
+ return this.fetchTokens({ grant_type: Ne.ClientCredentials, client_assertion_type: Sa.JwtBearer, client_assertion: t });
33855
33863
  }
33856
33864
  setBasicAuth(t, n) {
33857
33865
  this.clientId = t, this.clientSecret = n, this.basicAuth = $r(t + ":" + n);
33858
33866
  }
33859
33867
  async fhircastSubscribe(t, n) {
33860
- if (!(typeof t == "string" && t !== "")) throw new d(y("Invalid topic provided. Topic must be a valid string."));
33861
- if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new d(y("Invalid events provided. Events must be an array of event names containing at least one event."));
33868
+ if (!(typeof t == "string" && t !== "")) throw new p(y("Invalid topic provided. Topic must be a valid string."));
33869
+ if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new p(y("Invalid events provided. Events must be an array of event names containing at least one event."));
33862
33870
  let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Jr(i), w.FORM_URL_ENCODED))["hub.channel.endpoint"];
33863
33871
  if (!s) throw new Error("Invalid response!");
33864
33872
  return i.endpoint = s, i;
33865
33873
  }
33866
33874
  async fhircastUnsubscribe(t) {
33867
- if (!Nt(t)) throw new d(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33868
- if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new d(y("Provided subscription request must have an endpoint in order to unsubscribe."));
33875
+ if (!Nt(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33876
+ if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new p(y("Provided subscription request must have an endpoint in order to unsubscribe."));
33869
33877
  t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Jr(t), w.FORM_URL_ENCODED);
33870
33878
  }
33871
33879
  fhircastConnect(t) {
33872
- return new Ft(t);
33880
+ return new Lt(t);
33873
33881
  }
33874
33882
  async fhircastPublish(t, n, i, o) {
33875
- return bi(n) ? this.post(this.fhircastHubUrl, Kr(t, n, i, o), w.JSON) : (Ei(n), this.post(this.fhircastHubUrl, Kr(t, n, i), w.JSON));
33883
+ return Ei(n) ? this.post(this.fhircastHubUrl, Kr(t, n, i, o), w.JSON) : (Ri(n), this.post(this.fhircastHubUrl, Kr(t, n, i), w.JSON));
33876
33884
  }
33877
33885
  async fhircastGetContext(t) {
33878
33886
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -33893,9 +33901,9 @@ var $t = class extends z {
33893
33901
  this.clearActiveLogin();
33894
33902
  try {
33895
33903
  let c = await s.json();
33896
- throw new d(S(c.error_description));
33904
+ throw new p(b(c.error_description));
33897
33905
  } catch (c) {
33898
- throw new d(S("Failed to fetch tokens"), c);
33906
+ throw new p(b("Failed to fetch tokens"), c);
33899
33907
  }
33900
33908
  }
33901
33909
  let a2 = await s.json();
@@ -33903,12 +33911,12 @@ var $t = class extends z {
33903
33911
  }
33904
33912
  async verifyTokens(t) {
33905
33913
  let n = t.access_token;
33906
- if (Ci(n)) {
33914
+ if (Pi(n)) {
33907
33915
  let i = Ut(n);
33908
- if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new d(Tn);
33916
+ if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new p(Tn);
33909
33917
  if (i.cid) {
33910
- if (i.cid !== this.clientId) throw this.clearActiveLogin(), new d(ur);
33911
- } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new d(ur);
33918
+ if (i.cid !== this.clientId) throw this.clearActiveLogin(), new p(ur);
33919
+ } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new p(ur);
33912
33920
  }
33913
33921
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
33914
33922
  }
@@ -33928,7 +33936,7 @@ var $t = class extends z {
33928
33936
  }
33929
33937
  }
33930
33938
  getSubscriptionManager() {
33931
- return this.subscriptionManager || (this.subscriptionManager = new jt(this, ii(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
33939
+ return this.subscriptionManager || (this.subscriptionManager = new jt(this, oi(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
33932
33940
  }
33933
33941
  subscribeToCriteria(t, n) {
33934
33942
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -33940,46 +33948,46 @@ var $t = class extends z {
33940
33948
  return this.getSubscriptionManager().getMasterEmitter();
33941
33949
  }
33942
33950
  };
33943
- function Ta() {
33951
+ function ba() {
33944
33952
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
33945
33953
  return globalThis.fetch.bind(globalThis);
33946
33954
  }
33947
- function Vi() {
33955
+ function Mi() {
33948
33956
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
33949
33957
  }
33950
- async function Mi(r7, e) {
33958
+ async function _i(r7, e) {
33951
33959
  let t = r7.headers.get("content-location");
33952
33960
  if (t) return t;
33953
33961
  let n = r7.headers.get("location");
33954
33962
  if (n) return n;
33955
- if (Pe(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33963
+ if (we(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33956
33964
  }
33957
- function _i(r7) {
33965
+ function Fi(r7) {
33958
33966
  let e = r7.entry?.map((t) => t.resource) ?? [];
33959
33967
  return Object.assign(e, { bundle: r7 });
33960
33968
  }
33961
- function va(r7) {
33969
+ function Ea(r7) {
33962
33970
  return E(r7) && "data" in r7 && "contentType" in r7;
33963
33971
  }
33964
33972
  function Li(r7, e, t, n) {
33965
- return va(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
33973
+ return Ea(r7) ? r7 : { data: r7, filename: e, contentType: t, onProgress: n };
33966
33974
  }
33967
- function Sa(r7) {
33975
+ function Ra(r7) {
33968
33976
  return E(r7) && "docDefinition" in r7;
33969
33977
  }
33970
- function ba(r7, e, t, n) {
33971
- return Sa(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
33978
+ function Ca(r7, e, t, n) {
33979
+ return Ra(r7) ? r7 : { docDefinition: r7, filename: e, tableLayouts: t, fonts: n };
33972
33980
  }
33973
- function Ea(r7) {
33981
+ function Pa(r7) {
33974
33982
  return r7.status === 429 || r7.status >= 500;
33975
33983
  }
33976
- var Ma = [...Qe, "->", "<<", ">>", "=="];
33977
- var Fa = ze().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33978
- var tc = " ".repeat(2);
33979
- var nc = [...Qe, "eq", "ne", "co"];
33980
- var ic = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
33981
- var sc = ze();
33982
- var pe = class {
33984
+ var Ua = [...Qe, "->", "<<", ">>", "=="];
33985
+ var qa = ze().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33986
+ var sc = " ".repeat(2);
33987
+ var cc = [...Qe, "eq", "ne", "co"];
33988
+ var uc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
33989
+ var dc = ze();
33990
+ var de = class {
33983
33991
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
33984
33992
  this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i, this.escapeCharacter = o, this.subcomponentSeparator = s;
33985
33993
  }
@@ -33990,8 +33998,8 @@ var pe = class {
33990
33998
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
33991
33999
  }
33992
34000
  };
33993
- var eo = class r2 {
33994
- constructor(e, t = new pe()) {
34001
+ var no = class r2 {
34002
+ constructor(e, t = new de()) {
33995
34003
  this.context = t, this.segments = e;
33996
34004
  }
33997
34005
  get header() {
@@ -34014,7 +34022,7 @@ var eo = class r2 {
34014
34022
  }
34015
34023
  buildAck() {
34016
34024
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a2 = t?.getField(10)?.toString() ?? "", c = t?.getField(12)?.toString() ?? "2.5.1";
34017
- return new r2([new tt(["MSH", this.context.getMsh2(), o, s, n, i, cc(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new tt(["MSA", "AA", a2, "OK"], this.context)]);
34025
+ return new r2([new tt(["MSH", this.context.getMsh2(), o, s, n, i, fc(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c], this.context), new tt(["MSA", "AA", a2, "OK"], this.context)]);
34018
34026
  }
34019
34027
  buildAckMessageType(e) {
34020
34028
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -34025,7 +34033,7 @@ var eo = class r2 {
34025
34033
  let n = new Error("Invalid HL7 message");
34026
34034
  throw n.type = "entity.parse.failed", n;
34027
34035
  }
34028
- let t = new pe("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
34036
+ let t = new de("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
34029
34037
  return new r2(e.split(/[\r\n]+/).map((n) => tt.parse(n, t)), t);
34030
34038
  }
34031
34039
  setSegment(e, t) {
@@ -34040,16 +34048,16 @@ var eo = class r2 {
34040
34048
  }
34041
34049
  };
34042
34050
  var tt = class r3 {
34043
- constructor(e, t = new pe()) {
34044
- this.context = t, Kn(e) ? this.fields = e.map((n) => J.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34051
+ constructor(e, t = new de()) {
34052
+ this.context = t, Yn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34045
34053
  }
34046
34054
  get(e) {
34047
34055
  return this.fields[e];
34048
34056
  }
34049
34057
  getField(e) {
34050
34058
  if (this.name === "MSH") {
34051
- if (e === 1) return new J([[this.context.getMsh1()]], this.context);
34052
- if (e === 2) return new J([[this.context.getMsh2()]], this.context);
34059
+ if (e === 1) return new K([[this.context.getMsh1()]], this.context);
34060
+ if (e === 2) return new K([[this.context.getMsh2()]], this.context);
34053
34061
  if (e > 2) return this.fields[e - 1];
34054
34062
  }
34055
34063
  return this.fields[e];
@@ -34060,28 +34068,28 @@ var tt = class r3 {
34060
34068
  toString() {
34061
34069
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
34062
34070
  }
34063
- static parse(e, t = new pe()) {
34064
- return new r3(e.split(t.fieldSeparator).map((n) => J.parse(n, t)), t);
34071
+ static parse(e, t = new de()) {
34072
+ return new r3(e.split(t.fieldSeparator).map((n) => K.parse(n, t)), t);
34065
34073
  }
34066
34074
  setField(e, t) {
34067
34075
  if (this.name === "MSH") {
34068
34076
  if (e === 1 || e === 2) return false;
34069
34077
  if (e > 2) {
34070
34078
  let n = e - 1;
34071
- for (; this.fields.length <= n; ) this.fields.push(new J([[""]], this.context));
34072
- return this.fields[n] = typeof t == "string" ? J.parse(t, this.context) : t, true;
34079
+ for (; this.fields.length <= n; ) this.fields.push(new K([[""]], this.context));
34080
+ return this.fields[n] = typeof t == "string" ? K.parse(t, this.context) : t, true;
34073
34081
  }
34074
34082
  }
34075
- for (; this.fields.length <= e; ) this.fields.push(new J([[""]], this.context));
34076
- return this.fields[e] = typeof t == "string" ? J.parse(t, this.context) : t, true;
34083
+ for (; this.fields.length <= e; ) this.fields.push(new K([[""]], this.context));
34084
+ return this.fields[e] = typeof t == "string" ? K.parse(t, this.context) : t, true;
34077
34085
  }
34078
34086
  setComponent(e, t, n, i, o = 0) {
34079
34087
  let s = this.getField(e);
34080
34088
  return s ? s.setComponent(t, n, i, o) : false;
34081
34089
  }
34082
34090
  };
34083
- var J = class r4 {
34084
- constructor(e, t = new pe()) {
34091
+ var K = class r4 {
34092
+ constructor(e, t = new de()) {
34085
34093
  this.context = t, this.components = e;
34086
34094
  }
34087
34095
  get(e, t, n = 0) {
@@ -34094,7 +34102,7 @@ var J = class r4 {
34094
34102
  toString() {
34095
34103
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
34096
34104
  }
34097
- static parse(e, t = new pe()) {
34105
+ static parse(e, t = new de()) {
34098
34106
  return new r4(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
34099
34107
  }
34100
34108
  setComponent(e, t, n, i = 0) {
@@ -34109,13 +34117,13 @@ var J = class r4 {
34109
34117
  return true;
34110
34118
  }
34111
34119
  };
34112
- function cc(r7) {
34120
+ function fc(r7) {
34113
34121
  let e = r7 instanceof Date ? r7 : new Date(r7), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
34114
34122
  return i > 0 && (n += "." + i.toString()), n;
34115
34123
  }
34116
34124
  var Ue = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
34117
- var uc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34118
- var to = class r5 {
34125
+ var hc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34126
+ var io = class r5 {
34119
34127
  constructor(e, t = {}, n = Ue.INFO, i = {}) {
34120
34128
  this.write = e, this.metadata = t, this.level = n, this.options = i, i?.prefix && (this.prefix = i.prefix), this.error = this.error.bind(this), this.warn = this.warn.bind(this), this.info = this.info.bind(this), this.debug = this.debug.bind(this), this.log = this.log.bind(this);
34121
34129
  }
@@ -34141,17 +34149,17 @@ var to = class r5 {
34141
34149
  }
34142
34150
  log(e, t, n) {
34143
34151
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
34144
- `) }), this.write(JSON.stringify({ level: uc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34152
+ `) }), this.write(JSON.stringify({ level: hc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34145
34153
  }
34146
34154
  };
34147
- function Oh(r7) {
34155
+ function Nh(r7) {
34148
34156
  let e = Ue[r7.toUpperCase()];
34149
34157
  if (e === void 0) throw new Error(`Invalid log level: ${r7}`);
34150
34158
  return e;
34151
34159
  }
34152
- var yc = "https://meta.medplum.com/releases";
34160
+ var Sc = "https://meta.medplum.com/releases";
34153
34161
  var er = /* @__PURE__ */ new Map();
34154
- function gc(r7) {
34162
+ function bc(r7) {
34155
34163
  let e = r7;
34156
34164
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
34157
34165
  let t = e.assets;
@@ -34161,10 +34169,10 @@ function gc(r7) {
34161
34169
  if (!n.name) throw new Error("Asset missing name");
34162
34170
  }
34163
34171
  }
34164
- async function ln(r7, e, t) {
34172
+ async function dn(r7, e, t) {
34165
34173
  let n = er.get(e ?? "latest");
34166
34174
  if (!n) {
34167
- let i = e ? `v${e}` : "latest", o = new URL(`${yc}/${i}.json`);
34175
+ let i = e ? `v${e}` : "latest", o = new URL(`${Sc}/${i}.json`);
34168
34176
  if (o.searchParams.set("a", r7), o.searchParams.set("c", Xr), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
34169
34177
  let s = await fetch(o.toString());
34170
34178
  if (s.status !== 200) {
@@ -34172,29 +34180,29 @@ async function ln(r7, e, t) {
34172
34180
  try {
34173
34181
  c = (await s.json()).message;
34174
34182
  } catch (u2) {
34175
- console.error(`Failed to parse message from body: ${we(u2)}`);
34183
+ console.error(`Failed to parse message from body: ${Ae(u2)}`);
34176
34184
  }
34177
34185
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c}`);
34178
34186
  }
34179
34187
  let a2 = await s.json();
34180
- gc(a2), n = a2, er.set(e ?? "latest", n), e || er.set(n.tag_name.slice(1), n);
34188
+ bc(a2), n = a2, er.set(e ?? "latest", n), e || er.set(n.tag_name.slice(1), n);
34181
34189
  }
34182
34190
  return n;
34183
34191
  }
34184
- function xc(r7) {
34192
+ function Ec(r7) {
34185
34193
  return /^\d+\.\d+\.\d+$/.test(r7);
34186
34194
  }
34187
- async function $h(r7, e) {
34188
- if (!xc(e)) return false;
34195
+ async function Xh(r7, e) {
34196
+ if (!Ec(e)) return false;
34189
34197
  try {
34190
- await ln(r7, e);
34198
+ await dn(r7, e);
34191
34199
  } catch {
34192
34200
  return false;
34193
34201
  }
34194
34202
  return true;
34195
34203
  }
34196
- async function Hh(r7) {
34197
- let e = await ln(r7);
34204
+ async function em(r7) {
34205
+ let e = await dn(r7);
34198
34206
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
34199
34207
  return e.tag_name.slice(1);
34200
34208
  }
@@ -34214,7 +34222,7 @@ var a = class extends EventTarget {
34214
34222
  super.removeEventListener(s, e, t);
34215
34223
  }
34216
34224
  };
34217
- var d2 = class extends Event {
34225
+ var d = class extends Event {
34218
34226
  constructor(s, e) {
34219
34227
  super("message"), this.connection = s, this.message = e;
34220
34228
  }
@@ -34237,8 +34245,8 @@ var h2 = class extends a {
34237
34245
  this.socket = e, this.encoding = t, e.on("data", (n) => {
34238
34246
  try {
34239
34247
  if (this.appendData(n), n.at(-2) === 28 && n.at(-1) === 13) {
34240
- let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), g2 = import_iconv_lite.default.decode(i, this.encoding), E2 = eo.parse(g2);
34241
- this.dispatchEvent(new d2(this, E2)), this.resetBuffer();
34248
+ let o = Buffer.concat(this.chunks), i = o.subarray(1, o.length - 2), g2 = import_iconv_lite.default.decode(i, this.encoding), E2 = no.parse(g2);
34249
+ this.dispatchEvent(new d(this, E2)), this.resetBuffer();
34242
34250
  }
34243
34251
  } catch (o) {
34244
34252
  this.dispatchEvent(new r6(o));
@@ -34498,7 +34506,7 @@ var AgentDicomChannel = class extends BaseChannel {
34498
34506
  calledAeTitle: this.association?.getCalledAeTitle()
34499
34507
  },
34500
34508
  dataset: dicomJson,
34501
- binary: binary ? ke(binary) : void 0
34509
+ binary: binary ? he(binary) : void 0
34502
34510
  };
34503
34511
  App.instance.addToWebSocketQueue({
34504
34512
  type: "agent:transmit:request",
@@ -34511,7 +34519,7 @@ var AgentDicomChannel = class extends BaseChannel {
34511
34519
  });
34512
34520
  response2.setStatus(dimse.constants.Status.Success);
34513
34521
  } catch (err) {
34514
- DcmjsDimseScp.channel.log.error(`DICOM error: ${we(err)}`);
34522
+ DcmjsDimseScp.channel.log.error(`DICOM error: ${Ae(err)}`);
34515
34523
  response2.setStatus(dimse.constants.Status.ProcessingFailure);
34516
34524
  }
34517
34525
  return response2;
@@ -34586,7 +34594,7 @@ var AgentHl7Channel = class extends BaseChannel {
34586
34594
  sendToRemote(msg) {
34587
34595
  const connection = this.connections.get(msg.remote);
34588
34596
  if (connection) {
34589
- connection.hl7Connection.send(eo.parse(msg.body));
34597
+ connection.hl7Connection.send(no.parse(msg.body));
34590
34598
  }
34591
34599
  }
34592
34600
  handleNewConnection(connection) {
@@ -34615,7 +34623,7 @@ var AgentHl7ChannelConnection = class {
34615
34623
  callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto2.randomUUID)()}`
34616
34624
  });
34617
34625
  } catch (err) {
34618
- this.channel.log.error(`HL7 error: ${we(err)}`);
34626
+ this.channel.log.error(`HL7 error: ${Ae(err)}`);
34619
34627
  }
34620
34628
  }
34621
34629
  close() {
@@ -34635,7 +34643,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path2.resolve)(
34635
34643
  );
34636
34644
  var RELEASES_PATH = (0, import_node_path2.resolve)(__dirname);
34637
34645
  async function downloadRelease(version, path3) {
34638
- const release = await ln("agent-upgrader", version);
34646
+ const release = await dn("agent-upgrader", version);
34639
34647
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os2.platform)());
34640
34648
  const { body } = await fetch(downloadUrl);
34641
34649
  if (!body) {
@@ -34647,9 +34655,9 @@ async function downloadRelease(version, path3) {
34647
34655
  writeStream.once("close", resolve2);
34648
34656
  });
34649
34657
  }
34650
- function parseDownloadUrl(release, os) {
34658
+ function parseDownloadUrl(release, os2) {
34651
34659
  let endingToMatch;
34652
- switch (os) {
34660
+ switch (os2) {
34653
34661
  case "win32":
34654
34662
  endingToMatch = ".exe";
34655
34663
  break;
@@ -34657,14 +34665,14 @@ function parseDownloadUrl(release, os) {
34657
34665
  endingToMatch = "linux";
34658
34666
  break;
34659
34667
  default:
34660
- throw new Error(`Unsupported platform: ${os}`);
34668
+ throw new Error(`Unsupported platform: ${os2}`);
34661
34669
  }
34662
34670
  for (const asset of release.assets) {
34663
34671
  if (asset.name.endsWith(endingToMatch)) {
34664
34672
  return asset.browser_download_url;
34665
34673
  }
34666
34674
  }
34667
- throw new Error(`No download URL found for release '${release.tag_name}' for ${os}`);
34675
+ throw new Error(`No download URL found for release '${release.tag_name}' for ${os2}`);
34668
34676
  }
34669
34677
  function getReleaseBinPath(version) {
34670
34678
  let binaryName;
@@ -34709,7 +34717,7 @@ var App = class _App {
34709
34717
  this.medplum = medplum;
34710
34718
  this.agentId = agentId;
34711
34719
  this.logLevel = logLevel;
34712
- this.log = new to((msg) => console.log(msg), void 0, logLevel);
34720
+ this.log = new io((msg) => console.log(msg), void 0, logLevel);
34713
34721
  }
34714
34722
  async start() {
34715
34723
  this.log.info("Medplum service starting...");
@@ -34855,7 +34863,7 @@ var App = class _App {
34855
34863
  } catch (err) {
34856
34864
  await this.sendToWebSocket({
34857
34865
  type: "agent:error",
34858
- body: we(err),
34866
+ body: Ae(err),
34859
34867
  callback: command.callback
34860
34868
  });
34861
34869
  }
@@ -34870,7 +34878,7 @@ var App = class _App {
34870
34878
  this.log.error(`Unknown message type: ${command.type}`);
34871
34879
  }
34872
34880
  } catch (err) {
34873
- this.log.error(`WebSocket error on incoming message: ${we(err)}`);
34881
+ this.log.error(`WebSocket error on incoming message: ${Ae(err)}`);
34874
34882
  }
34875
34883
  });
34876
34884
  return new Promise((resolve2) => {
@@ -34942,7 +34950,7 @@ var App = class _App {
34942
34950
  try {
34943
34951
  await this.startOrReloadChannel(definition, endpoint);
34944
34952
  } catch (err) {
34945
- this.log.error(we(err));
34953
+ this.log.error(Ae(err));
34946
34954
  }
34947
34955
  }
34948
34956
  }
@@ -34968,7 +34976,7 @@ var App = class _App {
34968
34976
  parsedEndpoint = new URL(endpoint.address);
34969
34977
  } catch (err) {
34970
34978
  throw new Error(
34971
- `Error while validating endpoint address for channel '${channel.name}': ${we(err)}`
34979
+ `Error while validating endpoint address for channel '${channel.name}': ${Ae(err)}`
34972
34980
  );
34973
34981
  }
34974
34982
  if (seenPorts.has(parsedEndpoint.port)) {
@@ -35047,7 +35055,7 @@ var App = class _App {
35047
35055
  try {
35048
35056
  await this.sendToWebSocket(msg);
35049
35057
  } catch (err) {
35050
- this.log.error(`WebSocket error while attempting to send message: ${we(err)}`);
35058
+ this.log.error(`WebSocket error while attempting to send message: ${Ae(err)}`);
35051
35059
  this.webSocketQueue.unshift(msg);
35052
35060
  throw err;
35053
35061
  }
@@ -35084,7 +35092,7 @@ IPv6 is currently unsupported.`;
35084
35092
  this.log.error(errMsg);
35085
35093
  throw new Error(errMsg);
35086
35094
  }
35087
- if (!((0, import_node_net3.isIPv4)(message.remote) || yl(message.remote))) {
35095
+ if (!((0, import_node_net3.isIPv4)(message.remote) || Sl(message.remote))) {
35088
35096
  const errMsg = `Attempted to ping an invalid host.
35089
35097
 
35090
35098
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -35123,7 +35131,7 @@ ${result}`);
35123
35131
  body: result
35124
35132
  });
35125
35133
  } catch (err) {
35126
- this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${we(err)}`);
35134
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ae(err)}`);
35127
35135
  this.addToWebSocketQueue({
35128
35136
  type: "agent:transmit:response",
35129
35137
  channel: message.channel,
@@ -35131,7 +35139,7 @@ ${result}`);
35131
35139
  remote: message.remote,
35132
35140
  callback: message.callback,
35133
35141
  statusCode: 400,
35134
- body: we(err)
35142
+ body: Ae(err)
35135
35143
  });
35136
35144
  }
35137
35145
  }
@@ -35147,7 +35155,7 @@ ${result}`);
35147
35155
  return;
35148
35156
  }
35149
35157
  let child;
35150
- if (message.version && !await $h("agent-upgrader", message.version)) {
35158
+ if (message.version && !await Xh("agent-upgrader", message.version)) {
35151
35159
  const versionTag = message.version ? `v${message.version}` : "latest";
35152
35160
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
35153
35161
  this.log.error(errMsg);
@@ -35158,7 +35166,7 @@ ${result}`);
35158
35166
  });
35159
35167
  return;
35160
35168
  }
35161
- const targetVersion = message.version ?? await Hh("agent-upgrader");
35169
+ const targetVersion = message.version ?? await em("agent-upgrader");
35162
35170
  if (Xr.startsWith(targetVersion)) {
35163
35171
  if (!message?.force) {
35164
35172
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
@@ -35191,11 +35199,11 @@ ${result}`);
35191
35199
  });
35192
35200
  });
35193
35201
  child.on("error", (err) => {
35194
- this.log.error(we(err));
35202
+ this.log.error(Ae(err));
35195
35203
  });
35196
35204
  } catch (err) {
35197
35205
  const versionTag = message.version ? `v${message.version}` : "latest";
35198
- const errMsg = `Error during upgrading to version '${versionTag}': ${we(err)}`;
35206
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Ae(err)}`;
35199
35207
  this.log.error(errMsg);
35200
35208
  await this.sendToWebSocket({
35201
35209
  type: "agent:error",
@@ -35221,7 +35229,7 @@ ${result}`);
35221
35229
  child.disconnect();
35222
35230
  } catch (err) {
35223
35231
  this.log.error(
35224
- `Error while stopping agent or messaging child process as part of upgrade: ${we(err)}`
35232
+ `Error while stopping agent or messaging child process as part of upgrade: ${Ae(err)}`
35225
35233
  );
35226
35234
  import_node_process.default.exit(1);
35227
35235
  }
@@ -35279,7 +35287,7 @@ ${result}`);
35279
35287
  });
35280
35288
  }
35281
35289
  }
35282
- client.sendAndWait(eo.parse(message.body)).then((response2) => {
35290
+ client.sendAndWait(no.parse(message.body)).then((response2) => {
35283
35291
  this.log.info(`Response: ${response2.toString().replaceAll("\r", "\n")}`);
35284
35292
  this.addToWebSocketQueue({
35285
35293
  type: "agent:transmit:response",
@@ -35291,7 +35299,7 @@ ${result}`);
35291
35299
  body: response2.toString()
35292
35300
  });
35293
35301
  }).catch((err) => {
35294
- this.log.error(`HL7 error: ${we(err)}`);
35302
+ this.log.error(`HL7 error: ${Ae(err)}`);
35295
35303
  this.addToWebSocketQueue({
35296
35304
  type: "agent:transmit:response",
35297
35305
  channel: message.channel,
@@ -35299,7 +35307,7 @@ ${result}`);
35299
35307
  callback: message.callback,
35300
35308
  contentType: w.TEXT,
35301
35309
  statusCode: 400,
35302
- body: we(err)
35310
+ body: Ae(err)
35303
35311
  });
35304
35312
  if (client.keepAlive) {
35305
35313
  this.hl7Clients.delete(message.remote);
@@ -35353,12 +35361,12 @@ async function agentMain(argv) {
35353
35361
  await medplum.startClientLogin(clientId, clientSecret);
35354
35362
  loggedIn = true;
35355
35363
  } catch (err) {
35356
- console.error("Failed to login", { err: we(err) });
35364
+ console.error("Failed to login", { err: Ae(err) });
35357
35365
  console.log("Retrying login in 10 seconds...");
35358
35366
  await Mr(RETRY_WAIT_DURATION_MS);
35359
35367
  }
35360
35368
  }
35361
- const app = new App(medplum, agentId, Oh(args.logLevel ?? "INFO"));
35369
+ const app = new App(medplum, agentId, Nh(args.logLevel ?? "INFO"));
35362
35370
  await app.start();
35363
35371
  process.on("SIGINT", async () => {
35364
35372
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -35383,7 +35391,7 @@ var import_node_os4 = require("node:os");
35383
35391
  var import_node_path3 = __toESM(require("node:path"));
35384
35392
  var import_node_process2 = __toESM(require("node:process"));
35385
35393
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
35386
- var pidLogger = new to((msg) => `[PID]: ${msg}`);
35394
+ var pidLogger = new io((msg) => `[PID]: ${msg}`);
35387
35395
  var pidFilePaths = /* @__PURE__ */ new Set();
35388
35396
  var processExitListener = () => {
35389
35397
  removeAllPidFiles();
@@ -35485,7 +35493,7 @@ async function upgraderMain(argv) {
35485
35493
  if ((0, import_node_os5.platform)() !== "win32") {
35486
35494
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
35487
35495
  }
35488
- const globalLogger = new to((msg) => console.log(msg));
35496
+ const globalLogger = new io((msg) => console.log(msg));
35489
35497
  if (!import_node_process3.default.send) {
35490
35498
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
35491
35499
  import_node_process3.default.exit(1);
@@ -35498,10 +35506,10 @@ async function upgraderMain(argv) {
35498
35506
  });
35499
35507
  });
35500
35508
  import_node_process3.default.send({ type: "STARTED" });
35501
- if (argv[3] && !xc(argv[3])) {
35509
+ if (argv[3] && !Ec(argv[3])) {
35502
35510
  throw new Error("Invalid version specified");
35503
35511
  }
35504
- const version = argv[3] ?? await Hh("agent-upgrader");
35512
+ const version = argv[3] ?? await em("agent-upgrader");
35505
35513
  const binPath = getReleaseBinPath(version);
35506
35514
  if (!(0, import_node_fs6.existsSync)(binPath)) {
35507
35515
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -35524,7 +35532,7 @@ async function upgraderMain(argv) {
35524
35532
  (0, import_node_child_process2.spawnSync)(binPath, ["/S"]);
35525
35533
  globalLogger.info(`Agent version ${version} successfully installed`);
35526
35534
  } catch (err) {
35527
- globalLogger.error(`Error while attempting to run installer: ${we(err)}`);
35535
+ globalLogger.error(`Error while attempting to run installer: ${Ae(err)}`);
35528
35536
  globalLogger.error("Failed to run installer, attempting to restart agent service...");
35529
35537
  try {
35530
35538
  (0, import_node_child_process2.execSync)('net start "Medplum Agent"');